heisenberg-scripts
Heisenberg is a modern build setup, inspired by [Create react app](https://github.com/facebookincubator/create-react-app/).
Last updated 10 months ago by walbo .
GPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install heisenberg-scripts 
SYNC missed versions from official npm registry.

Heisenberg

Heisenberg is a modern build setup, inspired by Create react app.

Heisenberg works on macOS, Windows, and Linux.
If something doesn’t work please file an issue.

Available Scripts

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.

To run the development task it is required to define the proxy field in package.json.

yarn build

Builds the app for production to the dist folder.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

yarn icons

Builds a php icon file.

Configuration

Loading the configuration object

Finding and loading of your configuration object is done with cosmiconfig. Starting from the current working directory, it will look for the following possible sources, in this order:

  • a heisenberg property in package.json
  • a .heisenbergrc file
  • a heisenberg.config.js file exporting a JS object

The .heisenbergrc file (without extension) can be in JSON or YAML format. Alternately, you can add a filename extension to designate JSON, YAML, or JS format: .heisenbergrc.json, .heisenbergrc.yaml, .heisenbergrc.yml, .heisenbergrc.js. You may want to use an extension so that your text editor can better interpret the file, and help with syntax checking and highlighting.

Once one of these is found and parsed, the search will stop and that object will be used.

The configuration object

The configuration object can have the following properties.

build

Build determine how files should be build.

"build": {
	"commonsChunkPlugin": true,
	"dest": "dist",
	"hashFilenames": true,
	"manifest": true,
}

icons

Build determine how the icon file should be build.

"icons": {
	"package": "Heisenberg",
	"name": "heisenberg",
	"src": "src/icons",
	"dest": "inc/icons.php",
	"options": {
		"plugins": [
			{ "removeAttrs": {} },
			{ "removeDimensions": true },
			{ "removeEmptyAttrs": false },
			{ "removeTitle": true },
			{ "removeViewBox": false }
		]
	}
}

Proxy

The development mode is proxying an existing vhost. It will wrap your vhost with a proxy URL to view your site.

To define the proxy add a proxy field to your package.json, for example:

"proxy": "http://local-url.test",

You can overwrite the proxy defined in package.json by using the environment variable HEISENBERG_PROXY.

Editor style

In WordPress you can create a separate TinyMCE editor style, but WordPress does not need this front-end, so you don't want to add this to the entry key. To create a editor file on build add this to your package.json:

"editor": "./src/editor.scss",

Using Global Variables

When you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable.

You can avoid this by reading the global variable explicitly from the window object, for example:

const $ = window.$;

This makes it obvious you are using a global variable intentionally rather than because of a typo.

Alternatively, you can force the linter to ignore any line by adding // eslint-disable-line after it.

Custom linting rules

Heisenberg comes with a default set of stylelint and ESLint rules. These can however be overwritten in your project. To create your own config create a .stylelintrc.js or .eslintrc.js in the same folder your package.json file exists. Heisenberg will now use these files when linting your scss/js code.

Adding Flow

Flow is a static type checker that helps you write code with fewer bugs. Check out this introduction to using static types in JavaScript if you are new to this concept.

Recent versions of Flow work with Heisenberg projects out of the box.

To add Flow to a Heisenberg project, follow these steps:

  1. Run yarn add --dev flow-bin.
  2. Add "flow": "flow" to the scripts section of your package.json.
  3. Run yarn flow -- init to create a .flowconfig file in the root directory.
  4. Add // @flow to any files you want to type check (for example, to src/main.js).

Now you can run yarn flow to check the files for type errors.

To learn more about Flow, check out its documentation.

Current Tags

  • 0.3.0-beta.0                                ...           alpha (2 years ago)
  • 0.3.0-beta.11                                ...           beta (a year ago)
  • 0.3.13                                ...           latest (10 months ago)
  • 1.0.0-beta.4                                ...           next (9 months ago)

37 Versions

  • 1.0.0-beta.4                                ...           9 months ago
  • 1.0.0-beta.3                                ...           9 months ago
  • 1.0.0-beta.2                                ...           9 months ago
  • 1.0.0-beta                                ...           9 months ago
  • 0.3.13                                ...           10 months 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.6-1                                ...           a year ago
  • 0.3.6-0                                ...           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.3.0-beta.11                                ...           a year ago
  • 0.3.0-beta.10                                ...           a year ago
  • 0.3.0-beta.9                                ...           a year ago
  • 0.3.0-beta.8                                ...           a year ago
  • 0.3.0-beta.7                                ...           a year ago
  • 0.3.0-beta.6                                ...           a year ago
  • 0.3.0-beta.5                                ...           a year ago
  • 0.3.0-beta.4                                ...           a year ago
  • 0.3.0-beta.3                                ...           a year ago
  • 0.3.0-beta.2                                ...           2 years ago
  • 0.3.0-beta.1                                ...           2 years ago
  • 0.3.0-beta.0                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 38
Last Day 0
Last Week 0
Last Month 2
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |