From 1eaf3167afbb1b30cead8810555376b5d0b49a67 Mon Sep 17 00:00:00 2001 From: Maxime Thirouin Date: Tue, 15 Nov 2016 09:11:32 +0100 Subject: [PATCH] More solid way to stick with npm instead of yarn --- appveyor.yml | 2 +- circle.yml | 4 +++ docs/content/contributing/index.md | 51 ++++++++++++++++++++++-------- scripts/utils/test-folder.js | 7 +++- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9697b235f..8faad087c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: - nodejs_version: '6' # stick to npm - PHENOMIC_TEST_WITH_YARN: 0 + PHENOMIC_TEST_WITH_YARN: false version: "{build}" build: off diff --git a/circle.yml b/circle.yml index 8901e4c00..6d489633c 100644 --- a/circle.yml +++ b/circle.yml @@ -2,6 +2,10 @@ machine: node: version: 6 + environment: + # stick to npm + PHENOMIC_TEST_WITH_YARN: false + dependencies: override: - npm prune diff --git a/docs/content/contributing/index.md b/docs/content/contributing/index.md index e3775f47d..1aad06d74 100644 --- a/docs/content/contributing/index.md +++ b/docs/content/contributing/index.md @@ -2,32 +2,56 @@ title: How to contribute to Phenomic --- +## Clone the repository & get dependencies + +``` +git clone https://github.com/MoOx/phenomic.git +cd phenomic +``` + +**Note about dependencies:** +We support both [npm](http://npmjs.com/) and [Yarn](http://yarnpkg.com/) +but to make developer experience faster we use yarn by default. +Some scripts use yarn under the hood. To force npm usage, just export this in +your current terminal session: + +```console +export PHENOMIC_TEST_WITH_YARN=false +``` + ## Update the phenomic-theme-base To work on the phenomic-theme-base, run the following: -```sh +```console npm run phenomic-theme-base-start ``` + _or with `yarn`_ -```sh + +```console yarn run phenomic-theme-base-start ``` -Then you can edit files in the `phenomic-theme-base` folder. +Then you can edit files in the `themes/phenomic-theme-base` folder, you should +see change immediately. ## Update the docs To work on the docs, run the following: -```sh + +```console npm run docs-start ``` + _or with `yarn`_ -```sh + +```console yarn run docs-start ``` -Then you can edit files in the `docs` folder. +Then you can edit files in the `docs` folder and you will get changes +immediately. ## Work on the core @@ -36,13 +60,11 @@ Then you can edit files in the `docs` folder. - Integration tests are located at the root of the project (`__tests__/*`). _After every modification, please run the entire test suite by using -`npm test`._ -_or with `yarn`_ -`yarn test`._ +`npm test` (or with `yarn`, using `yarn test`)._ Note that the full test suite can take a few minutes, as it runs unit tests and -integration tests (with several builds, including docs and a new project from -the phenomic-theme-base). +end to end tests +(with several builds, including docs and a new project from the phenomic-theme-base). To speed things up, you can limit tests to the specific component you are working on. @@ -53,11 +75,12 @@ Tests will be in ``src/PageContainer/__tests__/*``. To run tests for the ``PageContainer`` component: -```sh -ava src/PageContainer/__tests__/* +```console +jest src/PageContainer/__tests__/* ``` -When you think you are done with your update, remember to run either `npm test` or `yarn test`. +When you think you are done with your update, remember to run either `npm test` (or `yarn test`). + Anyway, CI will warn us if something goes wrong. --- diff --git a/scripts/utils/test-folder.js b/scripts/utils/test-folder.js index 03d2c5ff6..aeefd7ca8 100644 --- a/scripts/utils/test-folder.js +++ b/scripts/utils/test-folder.js @@ -27,7 +27,12 @@ export default async function test( try { const targetModules = `${ target }/node_modules` - let yarn = process.env.PHENOMIC_TEST_WITH_YARN || true + let yarn = ( + typeof process.env.PHENOMIC_TEST_WITH_YARN !== "undefined" + ? Boolean(JSON.parse(process.env.PHENOMIC_TEST_WITH_YARN)) + : true + ) + if (yarn) { try { await exec("yarn --version")