diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d09297846b7..43e1880605ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,57 +7,30 @@ For details on contributing to documentation, see [Website Directory Readme](htt ## Setup -> Install [Node.js (LTS)](https://nodejs.org/) and [yarn](https://yarnpkg.com/en/docs/install) on your system. +> Install [Node.js (LTS)](https://nodejs.org/) on your system. ### Install dependencies -> Only required on the first run, subsequent runs can use `yarn start` to both bootstrap and run the development server. - ```sh git clone https://github.com/decaporg/decap-cms cd decap-cms -yarn -yarn bootstrap +npm install ``` ### Run locally ```sh -yarn start +npm run start ``` ## Available scripts -### bootstrap - -Bootstraps the monorepo. - -```sh -yarn bootstrap -``` - -### watch - -Watches all CMS packages and transpiles them on change. - -```sh -yarn watch -``` - -### start - -Starts the development server. This task runs both the `bootstrap` and `watch` scripts. - -```sh -yarn start -``` - ### clean Removes all of the CMS package `dist` directories. ```sh -yarn clean +npm run clean ``` ### reset @@ -65,7 +38,7 @@ yarn clean Runs the `clean` script and removes all the `node_modules` from the CMS packages. ```sh -yarn reset +npm run reset ``` ### build @@ -73,7 +46,7 @@ yarn reset Runs the `clean` script and builds the CMS packages. ```sh -yarn build +npm run build ``` ### build-preview @@ -81,7 +54,7 @@ yarn build Runs the `build` and `build-preview` scripts in each package and serves the resulting build locally. ```sh -yarn build-preview +npm run build-preview ``` ### test @@ -89,7 +62,7 @@ yarn build-preview Runs linting and Jest tests. ```sh -yarn test +npm run test ``` ### test:all @@ -97,7 +70,7 @@ yarn test Runs linting, Jest, and Cypress tests. ```sh -yarn test:all +npm run test:all ``` ### test:e2e @@ -105,7 +78,7 @@ yarn test:all Runs Cypress e2e tests. ```sh -yarn test:e2e +npm run test:e2e ``` ### test:e2e:dev @@ -113,7 +86,7 @@ yarn test:e2e Runs Cypress e2e tests on watch mode with an open instance of Chrome. ```sh -yarn test:e2e:dev +npm run test:e2e:dev ``` ### format @@ -121,7 +94,7 @@ yarn test:e2e:dev Formats code and docs according to our style guidelines. ```sh -yarn format +npm run format ``` ## Pull Requests @@ -136,14 +109,14 @@ Decap CMS uses the [Forking Workflow](https://www.atlassian.com/git/tutorials/co 2. Create a branch from `master`. If you're addressing a specific issue, prefix your branch name with the issue number. 3. If you've added code that should be tested, add tests. 4. If you've changed APIs, update the documentation. -5. Run `yarn test` and ensure the test suite passes. -6. Use `yarn format` to format and lint your code. +5. Run `npm run test` and ensure the test suite passes. +6. Use `npm run format` to format and lint your code. 7. PR's must be rebased before merge (feel free to ask for help). 8. PR should be reviewed by two maintainers prior to merging. ## Debugging -`yarn start` spawns a development server and uses `dev-test/config.yml` and `dev-test/index.html` to serve the CMS. +`npm run start` spawns a development server and uses `dev-test/config.yml` and `dev-test/index.html` to serve the CMS. In order to debug a specific issue follow the next steps: 1. Replace `dev-test/config.yml` with the relevant `config.yml`. If you want to test the backend, make sure that the `backend` property of the config indicates which backend you use (GitHub, Gitlab, Bitbucket etc) and path to the repo. @@ -174,7 +147,7 @@ backend: ``` The most important thing is to make sure that Decap CMS is loaded from the `dist` folder. This way, every time you make changes to the source code, they will be compiled and reflected immediately on `localhost`. -3. Run `yarn start` +3. Run `npm run start` 4. Open `http://localhost:8080/` in the browser and you should have access to the CMS ### Debugging Git Gateway @@ -197,25 +170,25 @@ There are situations where you would want to run a specific test file, or tests To run all the tests for a specific file, use this command: ``` -yarn jest +npx jest ``` -The first part of the command, `yarn jest` means running the locally installed version of `jest`. It is equivalent to running `node_modules/.bin/jest`. +The first part of the command, `npx jest` means running the locally installed version of `jest`. It is equivalent to running `node_modules/.bin/jest`. -Example for running all the tests for the file `gitlab.spec.js`: `yarn jest gitlab.spec.js` +Example for running all the tests for the file `gitlab.spec.js`: `npx jest gitlab.spec.js` Some test files like `API.spec.js` is available in several packages. You can pass a regexp pattern instead of file path to narrow down files. Example for running all the tests for the file `API.spec.js` in the `decap-cms-backend-gitlab` package: -`yarn jest ".+backend-gitlab/.+/API.spec.js` +`npx jest ".+backend-gitlab/.+/API.spec.js` To run a specific test in a file, add the flag `--testNamePattern`, or `-t` for short followed by a regexp to match your test name. Example for running the test "should return true on project access_level >= 30" in the API.spec.js in `decap-cms-backend-gitlab` package: ``` -yarn jest -t "true on p" ".+backend-gitlab/.+/API.spec.js" +npx jest -t "true on p" ".+backend-gitlab/.+/API.spec.js" ``` For more information about running tests exactly the way you want, check out the official documentation for [Jest CLI](https://jestjs.io/docs/cli). diff --git a/cypress/Readme.md b/cypress/Readme.md index 12d7af7c12a6..679f6dea1260 100644 --- a/cypress/Readme.md +++ b/cypress/Readme.md @@ -15,14 +15,14 @@ Tests for the other backends use previously [recorded data](fixtures) and stub ` ## Run Tests Locally ```bash -yarn test:e2e # builds the demo site and runs Cypress in headless mode with mock data +npm run test:e2e # builds the demo site and runs Cypress in headless mode with mock data ``` ## Debug Tests ```bash -yarn develop # starts a local dev server with the demo site -yarn test:e2e:exec # runs Cypress in non-headless mode with mock data +npm run develop # starts a local dev server with the demo site +npm run test:e2e:exec # runs Cypress in non-headless mode with mock data ``` ## Recording Tests Data @@ -54,10 +54,10 @@ NETLIFY_INSTALLATION_ID=netlifyGitHubInstallationId To start a recording run the following commands: ```bash -yarn develop # starts a local dev server with the demo site -yarn mock:server:start # starts the recording proxy -yarn test:e2e:record-fixtures:dev # runs Cypress in non-headless and pass data through the recording proxy -yarn mock:server:stop # stops the recording proxy +npm run develop # starts a local dev server with the demo site +npm run mock:server:start # starts the recording proxy +npm run test:e2e:record-fixtures:dev # runs Cypress in non-headless and pass data through the recording proxy +npm run mock:server:stop # stops the recording proxy ``` > During the recorded process a clone of the relevant repo will be created under `.temp` and reset between tests.