Skip to content

Commit

Permalink
Replace NPM with Yarn; add yarn.lock (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
koistya committed Dec 22, 2016
1 parent ac26f54 commit 78868e6
Show file tree
Hide file tree
Showing 10 changed files with 6,629 additions and 69 deletions.
29 changes: 14 additions & 15 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
### Requirements

* Mac OS X, Windows, or Linux
* [Node.js](https://nodejs.org/) v6.5 or newer
* `npm` v3.10 or newer (new to [npm](https://docs.npmjs.com/)?)
* [Yarn][https://yarnpkg.com/] package + [Node.js](https://nodejs.org/) v6.5 or newer
* `node-gyp` prerequisites mentioned [here](https://github.com/nodejs/node-gyp)
* Text editor or IDE pre-configured with React/JSX/Flow/ESlint ([learn more](./how-to-configure-text-editors.md))

Expand Down Expand Up @@ -63,12 +62,12 @@ Alternatively, you can start a new project based on RSK right from
[WebStorm IDE](https://www.jetbrains.com/webstorm/help/create-new-project-react-starter-kit.html),
or by using [Yeoman generator](https://www.npmjs.com/package/generator-react-fullstack).

#### 2. Run `npm install`
#### 2. Run `yarn install`

This will install both run-time project dependencies and developer tools listed
in [package.json](../package.json) file.

#### 3. Run `npm start`
#### 3. Run `yarn start`

This command will build the app from the source files (`/src`) into the output
`/build` folder. As soon as the initial build completes, it will start the
Expand All @@ -87,13 +86,13 @@ app on the fly and refresh all the connected browsers.

![browsersync](https://dl.dropboxusercontent.com/u/16006521/react-starter-kit/brwosersync.jpg)

Note that the `npm start` command launches the app in `development` mode,
Note that the `yarn start` command launches the app in `development` mode,
the compiled output files are not optimized and minimized in this case.
You can use `--release` command line argument to check how your app works
in release (production) mode:

```shell
$ npm start -- --release
$ yarn start -- --release
```
*NOTE: double dashes are required*

Expand All @@ -103,19 +102,19 @@ $ npm start -- --release
If you need just to build the app (without running a dev server), simply run:

```shell
$ npm run build
$ yarn run build
```

or, for a production build:

```shell
$ npm run build -- --release
$ yarn run build -- --release
```

or, for a production docker build:

```shell
$ npm run build -- --release --docker
$ yarn run build -- --release --docker
```

*NOTE: double dashes are required*
Expand All @@ -127,14 +126,14 @@ running `node build/server.js`.
To check the source code for syntax errors and potential issues run:

```shell
$ npm run lint
$ yarn run lint
```

To launch unit tests:

```shell
$ npm test # Run unit tests with Mocha
$ npm run test:watch # Launch unit test runner and start watching for changes
$ yarn run test # Run unit tests with Mocha
$ yarn run test:watch # Launch unit test runner and start watching for changes
```

By default, [Mocha](https://mochajs.org/) test runner is looking for test files
Expand All @@ -144,13 +143,13 @@ as an example.
To deploy the app, run:

```shell
$ npm run deploy
$ yarn run deploy
```

The deployment script `tools/deploy.js` is configured to push the contents of
the `/build` folder to a remote server via Git. You can easily deploy your app
to [Azure Web Apps](https://azure.microsoft.com/en-us/services/app-service/web/),
or [Heroku](https://www.heroku.com/) this way. Both will execute `npm install --production`
or [Heroku](https://www.heroku.com/) this way. Both will execute `yarn install --production`
upon receiving new files from you. Note, you should only deploy the contents
of the `/build` folder to a remote server.

Expand All @@ -164,5 +163,5 @@ back into your own project by running:
$ git checkout master
$ git fetch react-starter-kit
$ git merge react-starter-kit/master
$ npm install
$ yarn install
```
11 changes: 6 additions & 5 deletions docs/how-to-configure-text-editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Install local npm packages
* [stylelint](https://www.npmjs.com/package/stylelint)

```shell
npm install --save-dev eslint babel-eslint eslint-plugin-react stylelint
yarn add --dev eslint babel-eslint eslint-plugin-react stylelint
```

*You may need to restart atom for changes to take effect*
Expand All @@ -71,9 +71,10 @@ Set Babel as default syntax for a particular extension:
* Repeat this for each extension (e.g.: .js and .jsx).

Install local npm packages

```
npm install eslint@latest
npm install babel-eslint@latest
npm install eslint-plugin-react
npm install stylelint
yarn add --dev eslint@latest
yarn add --dev babel-eslint@latest
yarn add --dev eslint-plugin-react
yarn add --dev stylelint
```
4 changes: 2 additions & 2 deletions docs/recipes/how-to-integrate-react-intl.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
[en, cs].forEach(addLocaleData);
```

5. Execute `npm run extractMessages` or `npm start` to strip out messages.
5. Execute `yarn run extractMessages` or `yarn start` to strip out messages.
Message files are created in `src/messages` directory.

6. Edit `src/messages/*.json` files, change only `message` property.

7. Execute `npm run build`,
7. Execute `yarn run build`,
your translations should be copied to `build/messages/` directory.


Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/how-to-use-sass.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Install [`node-sass`](https://github.com/sass/node-sass) and
[`sass-loader`](https://github.com/jtangelder/sass-loader) modules as dev dependencies:

```sh
$ npm install node-sass --save-dev
$ npm install sass-loader --save-dev
$ yarn add node-sass --dev
$ yarn add sass-loader --dev
```

### Step 2
Expand Down
10 changes: 5 additions & 5 deletions docs/recipes/using-npm-and-webpack-as-a-build-tool.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Using NPM and Webpack as a Build Tool
## Using Yarn and Webpack as a Build Tool

The [npm](https://docs.npmjs.com/) command line utility that comes with Node.js
The [Yarn](https://yarnpkg.com/) command line utility that comes with Node.js
allows you to run arbitrary scripts and [Node.js modules](https://www.npmjs.com/)
without them being globally installed. This is very convenient, because other
developers in your team don't need to worry about having some set of tools
Expand All @@ -11,7 +11,7 @@ For example, if you need to lint your JavaScript code with [ESLint](http://eslin
and [JSCS](http://jscs.info/), you just install them as project's dependencies:

```shell
$ npm install eslint jscs --save-dev
$ yarn add eslint jscs --dev
```

Add a new command line to `package.json/scripts`:
Expand All @@ -31,7 +31,7 @@ Add a new command line to `package.json/scripts`:
And execute it by running:

```shell
$ npm run lint # npm run <script-name>
$ yarn run lint # yarn run <script-name>
```

Which will be the same as running `./node_modules/bin/eslint src && ./node_modules/bin/jscs src`,
Expand Down Expand Up @@ -89,5 +89,5 @@ The `npm` script for it may look like this:
You can run it as follows:

```shell
$ npm run build
$ yarn run build
```
10 changes: 5 additions & 5 deletions docs/testing-your-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ You may also want to take a look at the following related packages:
### Running tests

To test your application simply run the
[`npm test`](https://github.com/kriasoft/react-starter-kit/blob/b22b1810461cec9c53eedffe632a3ce70a6b29a3/package.json#L154)
[`yarn test`](https://github.com/kriasoft/react-starter-kit/blob/b22b1810461cec9c53eedffe632a3ce70a6b29a3/package.json#L154)
command which will:
- recursively find all files ending with `.test.js` in your `src/` directory
- mocha execute found files

```bash
npm test
yarn test
```

### Conventions

- test filenames MUST end with `test.js` or `npm test` will not be able to detect them
- test filenames MUST end with `test.js` or `yarn test` will not be able to detect them
- test filenames SHOULD be named after the related component (e.g. create `Login.test.js` for
`Login.js` component)

Expand Down Expand Up @@ -92,9 +92,9 @@ Please note that NOT using IntlProvider will produce the following error:
### Linting

Running RSK eslint will also scan your test files:
In order to check if your JavaScript and CSS code follows the suggested style guidelines run:

```bash
npm run eslint
yarn run lint
```

58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@
"npm": ">=3.10"
},
"dependencies": {
"babel-polyfill": "6.20.0",
"babel-runtime": "6.20.0",
"bluebird": "3.4.6",
"body-parser": "1.15.2",
"classnames": "2.2.5",
"cookie-parser": "1.4.3",
"core-js": "2.4.1",
"express": "4.14.0",
"express-graphql": "0.6.1",
"express-jwt": "5.1.0",
"fastclick": "1.0.6",
"fbjs": "0.8.6",
"graphql": "0.8.2",
"history": "4.5.0",
"isomorphic-style-loader": "1.1.0",
"jsonwebtoken": "7.2.1",
"node-fetch": "1.6.3",
"normalize.css": "5.0.0",
"passport": "0.3.2",
"passport-facebook": "2.1.1",
"pretty-error": "2.0.2",
"query-string": "4.2.3",
"react": "15.4.1",
"react-dom": "15.4.1",
"sequelize": "3.28.0",
"source-map-support": "0.4.6",
"sqlite3": "3.1.8",
"universal-router": "2.0.0",
"whatwg-fetch": "2.0.1"
"babel-polyfill": "^6.20.0",
"babel-runtime": "^6.20.0",
"bluebird": "^3.4.6",
"body-parser": "^1.15.2",
"classnames": "^2.2.5",
"cookie-parser": "^1.4.3",
"core-js": "^2.4.1",
"express": "^4.14.0",
"express-graphql": "^0.6.1",
"express-jwt": "^5.1.0",
"fastclick": "^1.0.6",
"fbjs": "^0.8.6",
"graphql": "^0.8.2",
"history": "^4.5.0",
"isomorphic-style-loader": "^1.1.0",
"jsonwebtoken": "^7.2.1",
"node-fetch": "^1.6.3",
"normalize.css": "^5.0.0",
"passport": "^0.3.2",
"passport-facebook": "^2.1.1",
"pretty-error": "^2.0.2",
"query-string": "^4.2.3",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"sequelize": "^3.28.0",
"source-map-support": "^0.4.6",
"sqlite3": "^3.1.8",
"universal-router": "^2.0.0",
"whatwg-fetch": "^2.0.1"
},
"devDependencies": {
"assets-webpack-plugin": "^3.5.0",
Expand Down
10 changes: 5 additions & 5 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Build Automation Tools

##### `npm start` (`start.js`)
##### `yarn start` (`start.js`)

* Cleans up the output `/build` directory (`clean.js`)
* Copies static files to the output folder (`copy.js`)
Expand All @@ -10,13 +10,13 @@
[Hot Module Replacement](https://webpack.github.io/docs/hot-module-replacement), and
[React Hot Loader](https://github.com/gaearon/react-hot-loader)

##### `npm run build` (`build.js`)
##### `yarn run build` (`build.js`)

* Cleans up the output `/build` folder (`clean.js`)
* Copies static files to the output folder (`copy.js`)
* Creates application bundles with Webpack (`bundle.js`, `webpack.config.js`)

##### `npm run deploy` (`deploy.js`)
##### `yarn run deploy` (`deploy.js`)

* Builds the project from source files (`build.js`)
* Pushes the contents of the `/build` folder to a remote server with Git
Expand All @@ -32,13 +32,13 @@ Flag | Description
For example:

```sh
$ npm run build -- --release --verbose # Build the app in production mode
$ yarn run build -- --release --verbose # Build the app in production mode
```

or

```sh
$ npm start -- --release # Launch dev server in production mode
$ yarn start -- --release # Launch dev server in production mode
```

#### Misc
Expand Down
2 changes: 1 addition & 1 deletion tools/deployToAzureWebApps.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getRemote(slot) {

/**
* Deploy the contents of the `/build` folder to a remote
* server via Git. Example: `npm run deploy -- production`
* server via Git. Example: `yarn run deploy -- --production`
*/
async function deployToAzureWebApps() {
// By default deploy to the staging deployment slot
Expand Down
Loading

0 comments on commit 78868e6

Please sign in to comment.