Browse Source

Add README and CONTRIBUTING guides

Loris Leiva 1 year ago
parent
commit
28e9d8f39b
2 changed files with 111 additions and 0 deletions
  1. 38 0
      CONTRIBUTING.md
  2. 73 0
      README.md

+ 38 - 0
CONTRIBUTING.md

@@ -0,0 +1,38 @@
+# `create-solana-program` contributing guide
+
+Before submitting your contribution, please make sure to take a moment and read through the following guide:
+
+## Repo Setup
+
+This repo uses [Git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to store snapshots of the pre-defined templates after each release. So when cloning the repository, please make sure you have also initialized the submodules. You may do this using the `--recursive` flag when cloning the repository.
+
+```sh
+git clone --recursive https://github.com/vuejs/create-vue.git
+```
+
+Alternatively, if you have already cloned the repository without the `--recursive` flag, you can initialize the submodules afterwards using the following command:
+
+```sh
+git submodule update --init --recursive
+```
+
+## Package manager and scripts
+
+The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/).
+
+The following scripts are available:
+
+```sh
+pnpm build      # Build the `create-solana-program` package.
+pnpm snapshot   # Update the `projects` directory with the latest pre-defined templates.
+pnpm test       # Runs a snapshot and executes tests against each generated project.
+pnpm format     # Format the code using Prettier.
+```
+
+Additionally, a `prepublishOnly` script — that executes before every `pnpm publish` command — exists to update the snapshots and commit their changes to the relevant submodules. This allows us to have various template repositories that are always up-to-date with the latest changes of the `create-solana-program` package.
+
+Therefore, please make sure you do not commit any changes to the `projects` directory manually as they will be updated automatically during each release.
+
+## Changesets
+
+This repository uses [Changesets](https://github.com/changesets/changesets) to manage the versioning of the `create-solana-program` package. When submitting a pull request, please make sure to include a Changeset if your contribution introduces a change that requires a version bump.

+ 73 - 0
README.md

@@ -0,0 +1,73 @@
+# create-solana-program <a href="https://npmjs.com/package/create-solana-program"><img src="https://badgen.net/npm/v/create-solana-program" alt="npm package"></a> <a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/create-solana-program" alt="node compatibility"></a>
+
+The fastest way to get started with Solana program development.
+
+![Solana Program banner](https://github.com/solana-program/create-solana-program/assets/3642397/ebd0c01e-52d3-45ef-b1f3-e07bee53ab13)
+
+## Usage
+
+```sh
+pnpm create solana-program
+```
+
+Note that, when using `npm`, the `@latest` tag name must be provided, otherwise `npm` may resolve to a cached and outdated version of the package.
+
+```sh
+npm create solana-program@latest
+```
+
+## CLI arguments
+
+Whilst you don't need to provide any CLI arguments, you can use them to customize the generated program repository. Any missing information will either be inferred from the provided input or prompted to the user.
+
+The first CLI argument allows you to specify the program name and the directory of the new program repository.
+
+```sh
+# The generated directory is "counter" and the program name is "counter".
+pnpm create solana-program counter
+```
+
+When a second CLI argument is provided, it allows you to specify a program name that differs from the directory name.
+
+```sh
+# The generated directory is "my-projects/counter-program" and the program name is "counter".
+pnpm create solana-program my-projects/counter-program counter
+```
+
+## CLI options
+
+Various CLI options are also available to customize the generated program repository further and even skip user input altogether.
+
+```sh
+# Specify the organization name for the program.
+pnpm create solana-program --org acme
+
+# Select a program framework.
+pnpm create solana-program --anchor
+pnpm create solana-program --shank
+
+# Select the clients to generate for your program (default to all clients).
+pnpm create solana-program --client js --client rust
+
+# Opt out of generating any clients for your program.
+pnpm create solana-program --no-clients
+
+# Do not prompt use input and use all default values (alias: -d).
+pnpm create solana-program --default
+
+# The --default flag can be combined with other flags.
+pnpm create solana-program counter --org acme --default
+
+# Skip generating a new program keypair and use the provided address instead.
+pnpm create solana-program --address "MyProgram11111111111111111"
+
+# Use a specific Solana version instead of detecting the one installed on the system.
+pnpm create solana-program --solana 1.18
+
+# Force the creation of the program repository even if the directory is not empty.
+pnpm create solana-program --force
+```
+
+## Contributing
+
+If you're interested in contributing to this project, please make sure to read our [contributing guide](./CONTRIBUTING.md).