From 370e87f53bd174aacb7c78af8d38f111f51b225c Mon Sep 17 00:00:00 2001 From: Victor Savkin Date: Wed, 4 Dec 2019 14:47:21 -0500 Subject: [PATCH] cleanup(repo): dev experience cleanup (#2142) --- CONTRIBUTING.md | 57 +++++++++++++++++++++++------------ README.md | 6 ++-- e2e/create-playground.test.ts | 9 ++++++ package.json | 1 + scripts/commit-lint.js | 10 +++--- 5 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 e2e/create-playground.test.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 29fe8e38ca..476d89d164 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,9 +15,10 @@ If you find a bug in the source code or a mistake in the documentation, you can Source code and documentation are included in the top-level folders listed below. - `docs` - Markdown and configuration files for documentation including tutorials, guides for each supported platform, and API docs. -- `e2e` - E2E tests for Nx packages and schematics. -- `packages` - Source code for Nx packages such as Angular, React, Web, and others including schematics and builders. +- `e2e` - E2E tests. +- `packages` - Source code for Nx packages such as Angular, React, Web, NestJS, Next and others including schematics and builders. - `scripts` - Miscellaneous scripts for project tasks such as building documentation, testing, and code formatting. +- `tmp` - Folder used by e2e tests. If you are a WebStorm user, make sure to mark this folder as excluded. ## Building the Project @@ -61,6 +62,27 @@ Running E2E tests can take some time, so it is often useful to run a single test yarn e2e affected ``` +The `yarn e2e` command is going to remove the `tmp` folder and will recreate the sandbox from scratch. This can take a long time. If you are working on the same e2e test, you can use `yarn e2e-rerun affected`, which is significantly faster. + +### Playground + +While developing you may want to try out the changes you have made. The easier way to do it is to run: + +```bash +yarn create-playground +``` + +You can then go to `tmp/nx` (this is set up to use Nx CLI) or `tmp/angular` (this is set up to use Angular CLI), where you will find an empty workspace with your changes in it, something this that: + +```bash +yarn create-playground +cd tmp/nx +nx g @nrwl/express:app backend +nx build backend +``` + +You can fix the changed files in `tmp/nx/node_modules/@nrwl/...` and `tmp/angular/node_modules/@nrwl/...`. + ### Developing on Windows To build Nx on Windows, you need to use WSL. @@ -76,7 +98,7 @@ Before you submit an issue, please search the issue tracker. An issue for your p We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. Having a reproducible scenario gives us wealth of important information without going back and forth with you requiring additional information, such as: -- version of Nx used +- the output of `nx report` - `yarn.lock` or `package-lock.json` - and most importantly - a use-case that fails @@ -91,7 +113,7 @@ You can file new issues by filling out our [issue form](https://github.com/nrwl/ Please follow the following guidelines: - Make sure unit tests pass -- Make sure e2e tests pass +- Make sure e2e tests pass (this can take a while, so you can always let CI check those) - Make sure you run `yarn format` - For documentation, check for spelling and grammatical errors. - Update your commit message to follow the guidelines below @@ -111,23 +133,26 @@ body The type must be one of the following: - chore -- build - feat - fix -- refactor -- style +- cleanup - docs ##### Scope The scope must be one of the following: -- backend - anything backend specific -- testing - anything related to jest or cypress -- web - anything web specific -- react - anything react specific -- angular - anything angular specific -- nx - dependency management, basic workspace structure, anything touching both backend and frontend, and other related areas +- angular - anything Angular specific +- bazel - anything Bazel specific +- core - anything Nx core specific +- docs - anything related to docs infrastructure +- nextjs - anything Next specific +- node - anything Node specific +- react - anything React specific +- storybook - anything Storybook specific +- testing - anything testing specific (e.g., jest or cypress) +- repo - anything related to managing the repo itself +- misc - misc stuff ##### Subject and Body @@ -149,9 +174,3 @@ Closes #157 To simplify and automate the process of committing with this format, **Nx is a [Commitizen](https://github.com/commitizen/cz-cli) friendly repository**, just do `git add` and execute `yarn commit`. - -## Migrations - -Nx allows users to automatically upgrade to the newest version of the package. If you are introducing a change that would require the users to upgrade their workspace, add a migration to `packages/schematics/migrations`. - -Migrations are named using version numbers in the following fashion: `update-major-minor-patch/update-major-minor-patch.ts`, for example, `update-8-1-0/update-8-1-0.ts`. diff --git a/README.md b/README.md index b91cab8afd..5c166fdefc 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,19 @@ With Nx, you can develop multiple full-stack applications holistically and share **Using `npx`** ```bash -npx create-nx-workspace myworkspace +npx create-nx-workspace ``` **Using `npm init`** ```bash -npm init nx-workspace myworkspace +npm init nx-workspace ``` **Using `yarn create`** ```bash -yarn create nx-workspace myworkspace +yarn create nx-workspace ``` If it's your first Nx project, the command will recommend you to install `@nrwl/cli` globally, so you can invoke `nx` directly without going through yarn or npm. diff --git a/e2e/create-playground.test.ts b/e2e/create-playground.test.ts new file mode 100644 index 0000000000..3b3d0283ff --- /dev/null +++ b/e2e/create-playground.test.ts @@ -0,0 +1,9 @@ +import { ensureProject, forEachCli } from './utils'; + +forEachCli(() => { + describe('create playground', () => { + it('create playground', () => { + ensureProject(); + }, 120000); + }); +}); diff --git a/package.json b/package.json index 98a0dbfad0..f48700b65c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "checkcommit": "node ./scripts/commit-lint.js", "e2e": "./scripts/e2e.sh", "e2e-rerun": "./scripts/e2e-rerun.sh", + "create-playground": "./scripts/e2e.sh create-playground", "e2e-ci1": "./scripts/e2e-ci1.sh", "e2e-ci2": "./scripts/e2e-ci2.sh", "format": "./scripts/format.sh", diff --git a/scripts/commit-lint.js b/scripts/commit-lint.js index b7633d8283..fc1d4dddfe 100755 --- a/scripts/commit-lint.js +++ b/scripts/commit-lint.js @@ -17,10 +17,10 @@ if (exitCode === 0) { } else { console.log( '[Error]: Ho no! 😦 Your commit message: \n' + - '-------------------------------------------------------------------\n' + - gitMessage + - '\n-------------------------------------------------------------------' + - '\n\n 👉️ Does not follow the commit message convention specified in the CONTRIBUTING.MD file.' + '-------------------------------------------------------------------\n' + + gitMessage + + '\n-------------------------------------------------------------------' + + '\n\n 👉️ Does not follow the commit message convention specified in the CONTRIBUTING.MD file.' ); console.log('\ntype(scope): subject \n BLANK LINE \n body'); console.log('\n'); @@ -30,7 +30,7 @@ if (exitCode === 0) { ); console.log( '\nEXAMPLE: \n' + - 'feat(nx): add an option to generate lazy-loadable modules\n' + 'feat(nx): add an option to generate lazy-loadable modules\n' ); } process.exit(exitCode);