orc-scripts
Scripts toolbox for Orckestra
Last updated 3 days ago by autochton .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install orc-scripts 
SYNC missed versions from official npm registry.

Script and dependency toolbox for Orckestra web applications

Build Status Coverage Status

This package contains a standard set of dependencies and tooling for web applications. It is based on kcd-scripts (copyright © 2017 Kent C. Dodds, licensed via MIT License) in both concept and code.

Installation and use

Installing this package is done via npm: npm install orc-scripts. This will also install the dependency set provided.

Scripts

Where one exists, these scripts are intended to perform the role of the eponymous npm script. The scripts are invoked by running orc-scripts <script> <options>.

prep: Sets up for the build script (below). This creates the dist/ directory and copies src/content/ to dist/content/. If not production building, also copies any files in src/static to dist/.

build: Runs the build process, creating the distribution files for the package. This is typically used for preparing a release. Adding the --watch option starts a watch for file changes, rebuilding when a source file changes. This is useful for developing in a linked library. For web apps, this will use Webpack, for libraries, it uses Babel. Expects to have prep (above) run before it.

start: Starts a web server locally, with hot module reloading enabled. Intended to support development work. You may set a specific port using the --port <port> option, or with the PORT environment variable. If a HOST environment variable is supplied, it will set up as an HTTPS server, expecting to be accessed at that hostname. Expects to have prep (above) run before it.

test: Starts the Jest test runner in watch mode. This will run and rerun all tests relating to files changed from the git HEAD by default. Adding the --no-watch option instead runs all tests once and exits. The --coverage option generates a code coverage report for the test suite under coverage/. Jest command-line options are in general applicable.

extract-messages: Searches through all JS files in the src/ directory, extracting any react-intl messages found. It creates JSON files under src/translations/ with all keys, using default values to populate the default language (by default the first supported locale). Other languages are left empty. Existing keys are not changed. Use this to ensure that translations are made. This script requires the presence of a .babelrc file; the simplest way to solve this is to create a .babelrc.js file containing only module.exports = require("orc-scripts/babel");.

The easiest way to use these scripts is to add entries to your package.json under "scripts", invoking the orc-scripts command. A typical "scripts" section might look like this:

{
	"scripts": {
		"clean": "orc-scripts clean",
		"build": "orc-scripts prep && orc-scripts build",
		"start": "orc-scripts prep && orc-scripts start",
		"test": "orc-scripts test",
		"coverage": "orc-scripts test --coverage"
	}
}

Code tools

The toolbox contains support for eslint and prettier, both for use with development tools (such as Atom or VS Code) and in git hooks. To integrate with your development tool of choice, ensure the suitable plugin is installed if applicable, and create a config file or package.json entry that points to the orc-scripts preset for that tool (orc-scripts/eslint, resp. orc-scripts/prettier).

To set up a git commit hook that runs prettier on all staged files, add the following section to package.json:

{
	"husky": {
		"hooks": {
			"pre-commit": "lint-staged"
		}
	}
}

This will run the lint-staged tool whenever you commit files to git. Configure this tool with a section in your package.json as follows:

{
	"lint-staged": {
		"linters": {
			"*.{js,json,md}": ["prettier --write", "git add"]
		},
		"ignore": ["package.json", "package-lock.json", "src/translations/*.json"]
	}
}

This instructs lint-staged to run prettier on staged files, rewriting the file to specifications, and then re-staging it for the commit. This ensures that all code in the app lives up to the strict standards set by prettier. It is recommended to not let it process package.json, package-lock.json and translation files, as these are automatically processed and changed. Prettier can be told to ignore these by adding a .prettierignore file using the same syntax as .gitignore.

Testing

Testing with Jest and unexpected is built into the toolbox, allowing test setup to be as simple as adding a file with a .test.js suffix to your file tree. A number of plugins and custom assertions are provided as well.

Deploying

An application that employs code splitting (resulting in multiple output bundle files) and is to be deployed to a CDN will need to pass the CDN location to the entry bundle to ensure that further bundles are fetched from the right location. To do this, include a script in the header of the index.html file which sets window.ASSET_PATH to the CDN location (a slash-terminated url, i.e. "https://foo.cdn.org/my-bundle/"). This needs to be executed before the entry bundle.

License

Copyright © 2018 Orckestra Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 0.6.26                                ...           latest (3 days ago)

134 Versions

  • 0.6.26                                ...           3 days ago
  • 0.6.25                                ...           6 days ago
  • 0.6.24                                ...           9 days ago
  • 0.6.23                                ...           11 days ago
  • 0.6.22                                ...           23 days ago
  • 0.6.21                                ...           23 days ago
  • 0.6.20                                ...           23 days ago
  • 0.6.19                                ...           24 days ago
  • 0.6.18                                ...           a month ago
  • 0.6.17                                ...           a month ago
  • 0.6.16                                ...           a month ago
  • 0.6.15                                ...           a month ago
  • 0.6.14                                ...           a month ago
  • 0.6.13                                ...           a month ago
  • 0.6.11                                ...           2 months ago
  • 0.6.10                                ...           2 months ago
  • 0.6.9                                ...           3 months ago
  • 0.6.8                                ...           3 months ago
  • 0.6.7                                ...           4 months ago
  • 0.6.6                                ...           4 months ago
  • 0.6.5                                ...           5 months ago
  • 0.6.4                                ...           5 months ago
  • 0.6.3                                ...           6 months ago
  • 0.6.2                                ...           6 months ago
  • 0.6.1                                ...           6 months ago
  • 0.6.0                                ...           6 months ago
  • 0.5.5                                ...           7 months ago
  • 0.5.4                                ...           7 months ago
  • 0.5.3                                ...           7 months ago
  • 0.5.2                                ...           7 months ago
  • 0.5.1                                ...           7 months ago
  • 0.4.2                                ...           7 months ago
  • 0.5.0                                ...           7 months ago
  • 0.4.1                                ...           9 months ago
  • 0.4.0                                ...           10 months ago
  • 0.4.0-rc.15                                ...           10 months ago
  • 0.4.0-rc.14                                ...           a year ago
  • 0.4.0-rc.13                                ...           a year ago
  • 0.4.0-rc.12                                ...           a year ago
  • 0.4.0-rc.11                                ...           a year ago
  • 0.4.0-rc.10                                ...           a year ago
  • 0.4.0-rc.9                                ...           a year ago
  • 0.4.0-rc.8                                ...           a year ago
  • 0.4.0-rc.7                                ...           a year ago
  • 0.4.0-rc.6                                ...           a year ago
  • 0.4.0-rc.5                                ...           a year ago
  • 0.4.0-rc.4                                ...           a year ago
  • 0.4.0-rc.3                                ...           a year ago
  • 0.4.0-rc.2                                ...           a year ago
  • 0.4.0-rc.1                                ...           a year ago
  • 0.3.47                                ...           a year ago
  • 0.3.46                                ...           a year ago
  • 0.3.45                                ...           a year ago
  • 0.3.44                                ...           a year ago
  • 0.3.43                                ...           a year ago
  • 0.3.42                                ...           a year ago
  • 0.3.41                                ...           a year ago
  • 0.3.40                                ...           a year ago
  • 0.3.39                                ...           a year ago
  • 0.3.38                                ...           a year ago
  • 0.3.37                                ...           a year ago
  • 0.3.36                                ...           a year ago
  • 0.3.35                                ...           a year ago
  • 0.3.34                                ...           a year ago
  • 0.3.33                                ...           a year ago
  • 0.3.32                                ...           a year ago
  • 0.3.31                                ...           a year ago
  • 0.3.30                                ...           a year ago
  • 0.3.28                                ...           a year ago
  • 0.3.27                                ...           a year ago
  • 0.3.26                                ...           a year ago
  • 0.3.25                                ...           a year ago
  • 0.3.24                                ...           a year ago
  • 0.3.24-0                                ...           a year ago
  • 0.3.23                                ...           a year ago
  • 0.3.22                                ...           a year ago
  • 0.3.21                                ...           a year ago
  • 0.3.20                                ...           a year ago
  • 0.3.19                                ...           a year ago
  • 0.3.18                                ...           a year ago
  • 0.3.17                                ...           a year ago
  • 0.3.16                                ...           a year ago
  • 0.3.15                                ...           a year ago
  • 0.3.14                                ...           a year ago
  • 0.3.13                                ...           a year ago
  • 0.3.12                                ...           a year ago
  • 0.3.11                                ...           a year ago
  • 0.3.10                                ...           a year ago
  • 0.3.9                                ...           a year ago
  • 0.3.8                                ...           a year ago
  • 0.3.7                                ...           a year ago
  • 0.3.6                                ...           a year ago
  • 0.3.5                                ...           a year ago
  • 0.3.4                                ...           a year ago
  • 0.3.3                                ...           a year ago
  • 0.3.2                                ...           a year ago
  • 0.3.1                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.3                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.0.31                                ...           a year ago
  • 0.0.30                                ...           a year ago
  • 0.0.29                                ...           a year ago
  • 0.0.28                                ...           a year ago
  • 0.0.27                                ...           2 years ago
  • 0.0.26                                ...           2 years ago
  • 0.0.25                                ...           2 years ago
  • 0.0.24                                ...           2 years ago
  • 0.0.23                                ...           2 years ago
  • 0.0.22                                ...           2 years ago
  • 0.0.21                                ...           2 years ago
  • 0.0.20                                ...           2 years ago
  • 0.0.19                                ...           2 years ago
  • 0.0.18                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.16                                ...           2 years ago
  • 0.0.15                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 20
This Month 121
Last Day 0
Last Week 71
Last Month 450
Dependencies (77)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |