1.0.6 • Published 7 years ago

node-scripts v1.0.6

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
7 years ago

Node scripts

About

Opinionated scripts for node projects using:

Configuration

Package.json

Example scripts configuration in package.json:

  "scripts": {
    "clean": "node-scripts clean ./build ./coverage",
    "lint": "node-scripts lint ./src ./test",
    "test": "node-scripts test",
    "test:watch": "node-scripts test:watch",
    "test:cov": "node-scripts test:cov",
    "build": "node-scripts build ./src ./build",
    "start": "node-scripts start ./src/index.js",
    "prepare": "node-scripts prepare"
  }

Example node-scripts configuration in package.json:

  "node-scripts": {
    "package": [
      "name",
      "version",
      "bin",
      "keywords",
      "authors",
      "license"
    ],
    "dependencies": [
      "lodash.map",
      "lodash.reduce"
    ],
    "copy": [
      { "src": "LICENSE", "dest": "LICENSE" },
      { "src": "README.md", "dest": "README.md" }
    ]
  }

Example jest configuration in package.json:

  "jest": {
    "testRegex": "(/test/.*\\.spec.js)$",
    "collectCoverage": true,
    "collectCoverageFrom": [ "**/src/**/*.js" ]
  }

.babelrc

Example .babelrc file:

{
  "presets": [
    [
      "env",
      { "targets": { "node": "current" } }
    ]
  ],
  "plugins": [
    ["transform-object-rest-spread", { "useBuiltIns": true }]
  ]
}

.eslintrc

Example .eslintrc file:

{
  "parser": "babel-eslint",
  // Add rules...
}

Scripts

Clean Script

"clean": "node-scripts clean ./build ./coverage",

Remove the path(s) passed as arguments.

Lint Script

"lint": "node-scripts lint ./src ./test",

Use ESLint to lint javascript in the path(s) passed as arguments.

Test Script

"test": "node-scripts test",

Use Jest to test javascript in the path(s) passed as arguments.

Start Script

"start": "node-scripts start ./src/index.js",

Use Babel Watch to start the app, using the javascript file passed passed as an argument as the entry point.

Build Script

"build": "node-scripts build ./src ./build",

or

"build": "node-scripts build ./src ./build --no-minify",

Use Babel/Webpack/UglifyJS to build and minify the app. This will add a #!/usr/bin/env node line to the top of the file.

The build script will generate a package.json file, based on the app's package.json file.

The keys to include can be configured in the package section of the node-scripts configuration.

Dependencies can be bundled by including them in dependencies section of the node-scripts configuration.

The generated package.json file will include all dependencies from the app's package.json file, except dependencies which have been bundled.

Artefacts which need to be copied to the build folder can be configured in the copy section of the node-scripts configuration.

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.15

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago