Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use more idiomatic name for transpilation (lib->src), remove preset … #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,26 @@ getting something going, it's not a good idea to use it in production.

We should be precompiling our files, so let's do that now.

First let's move our server `index.js` file to `lib/index.js`.
First let's move our server `index.js` file to `src/index.js`.

```shell
$ mv index.js lib/index.js
$ mv index.js src/index.js
```

And update our `npm start` script to reflect the location change.

```diff
"scripts": {
- "start": "nodemon index.js --exec babel-node --presets es2015,stage-2"
+ "start": "nodemon lib/index.js --exec babel-node --presets es2015,stage-2"
+ "start": "nodemon src/index.js --exec babel-node --presets es2015,stage-2"
}
```

Next let's add two new tasks, `npm run build` and `npm run serve`.

```diff
"scripts": {
"start": "nodemon lib/index.js --exec babel-node --presets es2015,stage-2",
"start": "nodemon src/index.js --exec babel-node --presets es2015,stage-2",
+ "build": "babel lib -d dist --presets es2015,stage-2",
+ "serve": "node dist/index.js"
}
Expand Down Expand Up @@ -153,7 +153,7 @@ Now we can remove the duplicated options from our npm scripts

```diff
"scripts": {
+ "start": "nodemon lib/index.js --exec babel-node",
+ "start": "nodemon src/index.js --exec babel-node",
+ "build": "babel lib -d dist",
"serve": "node dist/index.js"
}
Expand All @@ -180,7 +180,7 @@ $ touch test/index.js
import http from 'http';
import assert from 'assert';

import '../lib/index.js';
import '../src/index.js';

describe('Example Node Server', () => {
it('should return 200', done => {
Expand All @@ -202,7 +202,7 @@ Then we can add an `npm test` script.

```diff
"scripts": {
"start": "nodemon lib/index.js --exec babel-node",
"start": "nodemon src/index.js --exec babel-node",
"build": "babel lib -d dist",
"serve": "node dist/index.js",
+ "test": "mocha --compilers js:babel-register"
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "example-node-server",
"version": "1.0.0",
"description": "Example Node Server w/ Babel",
"main": "lib/index.js",
"main": "src/index.js",
"scripts": {
"start": "nodemon lib/index.js --exec babel-node --presets es2015,stage-2",
"build": "babel lib -d dist",
"start": "nodemon src/index.js --exec babel-node",
"build": "babel src -d dist",
"serve": "node dist/index.js",
"test": "mocha --compilers js:babel-register"
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import http from 'http';
import assert from 'assert';

import '../lib/index.js';
import '../src/index.js';

describe('Example Node Server', () => {
it('should return 200', done => {
Expand Down