diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index ccdc85d5..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "root": true, - "ignorePatterns": ["**/*"], - "plugins": ["@nx"], - "overrides": [ - { - "files": "*.json", - "parser": "jsonc-eslint-parser", - "rules": {} - }, - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": { - "@nx/enforce-module-boundaries": [ - "error", - { - "enforceBuildableLibDependency": true, - "allow": [], - "depConstraints": [ - { - "sourceTag": "*", - "onlyDependOnLibsWithTags": ["*"] - } - ] - } - ] - } - }, - { - "files": ["*.ts", "*.tsx"], - "extends": ["plugin:@nx/typescript"], - "rules": { - "@typescript-eslint/no-extra-semi": "error", - "no-extra-semi": "off" - } - }, - { - "files": ["*.js", "*.jsx"], - "extends": ["plugin:@nx/javascript"], - "rules": { - "@typescript-eslint/no-extra-semi": "error", - "no-extra-semi": "off" - } - }, - { - "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], - "env": { - "jest": true - }, - "rules": {} - } - ] -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index fb427b8f..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CI - -on: - push: - branches: - - main - pull_request: - -# Needed for nx-set-shas within nx-cloud-main.yml, when run on the main branch -permissions: - actions: read - contents: read - -jobs: - main: - name: Nx Cloud - Main Job - uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.15.0 - with: - main-branch-name: main - number-of-agents: 3 - init-commands: | - pnpm nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3 - parallel-commands: | - pnpm nx-cloud record -- pnpm nx format:check - parallel-commands-on-agents: | - pnpm nx affected --target=lint --parallel=3 - pnpm nx affected --target=test --parallel=3 --ci --code-coverage - pnpm nx affected --target=build --parallel=3 - - agents: - name: Nx Cloud - Agents - uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.15.0 - with: - number-of-agents: 3 diff --git a/.verdaccio/config.yml b/.verdaccio/config.yml deleted file mode 100644 index 5d7b3122..00000000 --- a/.verdaccio/config.yml +++ /dev/null @@ -1,28 +0,0 @@ -# path to a directory with all packages -storage: ../tmp/local-registry/storage - -# a list of other known repositories we can talk to -uplinks: - npmjs: - url: https://registry.yarnpkg.com - maxage: 60m - -packages: - '**': - # give all users (including non-authenticated users) full access - # because it is a local registry - access: $all - publish: $all - unpublish: $all - - # if package is not available locally, proxy requests to npm registry - proxy: npmjs - -# log settings -logs: - type: stdout - format: pretty - level: warn - -publish: - allow_offline: true # set offline to true to allow publish offline diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c1564db..5cc3e192 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,271 +1 @@ -# Contributing to create-solana-dapp - -We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: - -- Reporting a bug -- Discussing the current state of the code -- Submitting a fix -- Proposing new features -- Becoming a maintainer - -## We Develop with GitHub - -We use GitHub to host code, to track issues and feature requests, as well as accept pull requests. - -## We use [GitHub Flow](https://guides.github.com/introduction/flow/index.html), so all code changes happen through pull requests - -Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: - -1. Fork the repo and create your branch from `main`. -2. If you've added code that should be tested, add tests. -3. If you've changed APIs, update the documentation. -4. Ensure the test suite passes. -5. Make sure your code lints. -6. Issue that pull request! - -## Any contributions you make will be under the MIT Software License - -In short, when you submit code changes, your submissions are understood to be under the same -[MIT License](https://choosealicense.com/licenses/mit/) that covers the project. - -## Report bugs using GitHub's [issues](https://github.com/solana-developers/create-solana-dapp/issues) - -We use GitHub issues to track public bugs. Report a bug by -[opening a new issue](https://github.com/solana-developers/create-solana-dapp/issues/new); it's that easy! - -**Great Bug Reports** tend to have: - -- A quick summary and/or background -- Steps to reproduce - - Be specific! - - Give sample code if you can. -- What you expected would happen -- What actually happens -- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) - -People _love_ thorough bug reports. - -## Use a Consistent Coding Style - -- 2 spaces for indentation rather than tabs -- You can try running `npm run lint` for style unification - -## Development Workflow - -In this section, you'll find the basic commands you need to run for building, testing, and maintaining the quality of -the codebase. - -This project is structured within an Nx Workspace, providing powerful tools and capabilities to enhance development -practices. For more information, see the [Nx Documentation](https://nx.dev/). - -### Repo structure - -The project is structured as a monorepo, with each package in the `packages` directory. - -To view the list of packages, run: - -```shell -pnpm nx show projects -``` - -The e2e tests are located in the `e2e` directory. - -### Nx Cache - -Nx uses a cache to speed up development. If you want to bypass the cache, you can use the `--skip-nx-cache` flag: - -```shell -pnpm nx build create-solana-dapp --skip-nx-cache -``` - -### Building the Project - -To compile the project and generate the necessary artifacts, use the build command: - -```shell -pnpm build -``` - -To build an individual package, invoke the `nx build` command with the project name: - -```shell -pnpm nx build create-solana-dapp -``` - -You can build the project in watch mode by appending the `--watch` flag for faster feedback: - -```shell -pnpm nx build create-solana-dapp --watch -``` - -### Running Tests - -To ensure your contributions do not break any existing functionality, run the test suite with the following command: - -```shell -pnpm test -``` - -To run the tests for a specific package, invoke the `nx test` command with the project name: - -```shell -pnpm nx test preset-react -``` - -You can run the tests in watch mode by appending the `--watch` flag for faster feedback: - -```shell -pnpm nx test preset-react --watch -``` - -### Snapshots - -To support better testing and tracking of changes to the generated applications, each template preset has snapshots -generated (which are committed). As part of the each preset's `test`, its respective snapshot is checked to verify -generated output is as expected. - -When making adjustments to a generator that affected the outputted scaffold, the respective preset's snapshot will need -to be updated. - -To update all snapshots, run the `test` for each preset via NX with the update flag (i.e. `-u`): - -```shell -# full command -pnpm nx run-many --target test --skip-nx-cache -u - -# or the shorthand script -pnpm test -u -``` - -### Linting Your Code - -It's important to maintain the coding standards of the project. Lint your code by executing: - -```shell -pnpm lint -``` - -To lint a specific package, invoke the `nx lint` command with the project name: - -```shell -pnpm nx lint preset-react -``` - -### Working on the CLI - -If you want to quickly test your changes to the CLI, you can do the following: - -#### create-solana-dapp - -Run the build in watch mode in one terminal: - -```shell -pnpm nx build create-solana-dapp --watch -``` - -In another terminal, move to the directory where you want to test the `create-solana-dapp` CLI and run by invoking the -`node` command with the path to the compiled CLI: - -```shell -cd /tmp -node ~/path/to/create-solana-dapp/dist/packages/create-solana-dapp/bin/index.js --help -``` - -#### solana-dev - -The same goes for the `solana-dev` CLI: - -```shell -# In one terminal -pnpm nx build solana-dev --watch -# In another terminal -cd /tmp -node ~/path/to/create-solana-dapp/dist/packages/solana-dev/bin/index.js --help -``` - -### Publishing to a local registry - -If you want to test your changes to the CLI in a local registry, you can do the following: - -Start the local registry: - -```shell -pnpm local-registry -``` - -In another terminal, run the following command to publish the packages to the local registry: - -```shell -pnpm local-publish -``` - -Note: This will publish all the packages to the local registry with the `local` tag. Therefore, to utilize any of these -packages from your local registry, you must specify using this same `local` tag on the packages (e.g. -`create-solana-dapp@local`). - -Once that's done, with the local registry still running, you can run the `create-solana-dapp` CLI by invoking the -following command: - -```shell -npx create-solana-dapp@local -``` - -For example, this one-liner will create a new app with the latest version of the `create-solana-dapp` CLI using the -React preset and yarn as the package manager: - -```shell - npx --yes create-solana-dapp@local app-"$(date +%s)" --preset react --package-manager yarn -``` - -To check all the options, run: - -```shell -npx create-solana-dapp@local --help -``` - -The local registry will be running at http://localhost:4873 and in order to use it, changes to the `~/.npmrc` file are -required. The local-registry script will do this for you, but it might fail to clean up after itself. If you run into -any issues, try removing the following lines from your `~/.npmrc` file: - -```shell -registry=http://localhost:4873/ -//localhost:4873/:_authToken=secretVerdaccioToken -``` - -and replace them with: - -```shell -registry=https://registry.npmjs.org/ -``` - -### E2E Testing - -To run the e2e tests, use the following command: - -```shell -pnpm nx e2e preset-react-e2e -``` - -This will spin up a local registry, publish a package with the e2e tag, and run the e2e tests. - -### Committing Your Changes - -We follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for commit: - -- `fix`: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in semantic versioning). -- `feat`: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in semantic - versioning). -- `BREAKING CHANGE`: a commit that has the text BREAKING CHANGE: at the beginning of its optional body or footer section - introduces a breaking API change (correlating with MAJOR in semantic versioning). A BREAKING CHANGE can be part of - commits of any type. -- Others: commit types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the - Angular convention) recommends build:, chore:, ci:, docs:, style:, refactor:, perf:, test:, and others. - -## License - -By contributing, you agree that your contributions will be licensed under its MIT License. - -## References - -This document was adapted from the open-source contribution guidelines for -[Facebook's Draft](https://github.com/facebook/draft-js/blob/master/CONTRIBUTING.md) +# CONTRIBUTING TBD diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 0a0170f6..3768103b 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,71 +1 @@ -# Maintaining create-solana-dapp - -The document has a collection of information for the maintainers of this mono repo and the child packages contained -within. - -## Publishing new versions - -Normally, all the packages included within this repo are published together and should use the same specific version -number between all packages. This includes the primary `create-solana-dapp` CLI tool and the -`@solana-developers/preset-*` child packages. As such, all these packages are collectively referred to as -`create-solana-dapp` or `CSD` for short. - -> Note: Your NPM cli must be logged into the NPM registry and have the correct permissions to publish a new version. - -### `next` tag - -The `next` tag is considered the beta/testing version of the `create-solana-dapp` tool, and the specific version will -normally include such a `beta` flag in it: - -```shell -npx nx run-many --targets publish --tag next --ver x.x.x-beta.x -``` - -This will allow anyone to use the current beta/next version of the CLI using the following command: - -```shell -npx create-solana-dapp@next -``` - -### `latest` tag - -The `latest` tag is considered the production/stable version of the `create-solana-dapp` tool. To publish to the -`latest` tag: - -```shell -npx nx run-many --targets publish --tag latest --ver x.x.x -``` - -This will allow anyone to use the current production/stable version of the CLI using the following command: - -```shell -npx create-solana-dapp@latest -``` - -### Set a tagged version to a specific published version - -In the case we need to set the specific version associated with `create-solana-dapp` and child packages (e.g. rolling -back the `latest` tag to a previous version) you can run the `dist-tag` target via NX on any of the CSD packages in this -monorepo. - -#### All child packages - -To force all child packages to have a specific tag with a specific published version: - -```shell -npx nx run-many --targets dist-tag --tag next --ver x.x.x -``` - -#### Single child package - -To set a specific child package's tag to be a specific published version: - -```shell -# `next` tag -npx nx run solana-dev:dist-tag --tag next --ver x.x.x -``` - -```shell -# `latest` tag -npx nx run solana-dev:dist-tag --tag latest --ver x.x.x -``` +# MAINTAINERS TBD diff --git a/README.md b/README.md index 3894e15f..67122a6d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The following UI frameworks are planned and expected to be supported in the futu ## Supported onchain program frameworks -The following onchain programs (aka smart contract) frameworks are supported within `create-solana-dapp`: +The following on-chain programs (aka smart contracts) frameworks are supported within `create-solana-dapp`: - Anchor @@ -34,15 +34,6 @@ The following onchain programs (aka smart contract) frameworks are supported wit This projects operates as an NX monorepo that requires each of the child packages deployed to the NPM package registry: - [create-solana-dapp](./packages/create-solana-dapp): The CLI tool that generates a new project. -- [preset-anchor](./packages/preset-anchor): A preset for [create-solana-dapp](./packages/create-solana-dapp) that adds - [Anchor](https://www.anchor-lang.com) support. -- [preset-common](./packages/preset-common): Shared utilities for [create-solana-dapp](./packages/create-solana-dapp) - presets. -- [preset-next](./packages/preset-next): A preset for [create-solana-dapp](./packages/create-solana-dapp) that adds - [Next.js](https://nextjs.org) support. -- [preset-react](./packages/preset-react): A preset for [create-solana-dapp](./packages/create-solana-dapp) that adds - [React](https://reactjs.org) support. -- [solana-dev](./packages/solana-dev): A CLI tool that with utilities for developing Solana dApps. ## Contributing diff --git a/e2e/create-solana-dapp-e2e/.eslintrc.json b/e2e/create-solana-dapp-e2e/.eslintrc.json deleted file mode 100644 index 9d9c0db5..00000000 --- a/e2e/create-solana-dapp-e2e/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/e2e/create-solana-dapp-e2e/jest.config.ts b/e2e/create-solana-dapp-e2e/jest.config.ts deleted file mode 100644 index df6a5e15..00000000 --- a/e2e/create-solana-dapp-e2e/jest.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'create-solana-dapp-e2e', - preset: '../../jest.preset.js', - transform: { - '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], - }, - moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../coverage/e2e/create-solana-dapp-e2e', - globalSetup: '../../tools/scripts/start-local-registry.ts', - globalTeardown: '../../tools/scripts/stop-local-registry.ts', -} diff --git a/e2e/create-solana-dapp-e2e/project.json b/e2e/create-solana-dapp-e2e/project.json deleted file mode 100644 index ff580eab..00000000 --- a/e2e/create-solana-dapp-e2e/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "create-solana-dapp-e2e", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "application", - "sourceRoot": "e2e/create-solana-dapp-e2e/src", - "targets": { - "e2e": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "e2e/create-solana-dapp-e2e/jest.config.ts", - "runInBand": true - }, - "dependsOn": ["^build"] - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - }, - "implicitDependencies": ["create-solana-dapp"] -} diff --git a/e2e/create-solana-dapp-e2e/src/__snapshots__/create-solana-dapp.spec.ts.snap b/e2e/create-solana-dapp-e2e/src/__snapshots__/create-solana-dapp.spec.ts.snap deleted file mode 100644 index c775e6c1..00000000 --- a/e2e/create-solana-dapp-e2e/src/__snapshots__/create-solana-dapp.spec.ts.snap +++ /dev/null @@ -1,40 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`create-solana-dapp should print the help command 1`] = ` -"Usage: create-solana-dapp [options] [name] -Arguments: -name Name of the project (default: ) -Options: --V, --version -Output the version number --p, --preset -Preset to use (default: , options: next, react) ---ui -UI library to use (default: ) --a, --anchor