Pancake
Pancake flattens npm packages for GOLD Design System in to a pancake directory.
Pancake is a dependency of @gold.au
packages.
Pancake runs on the postinstall
hook of packages, for instance when running npm install @gold.au/buttons
in your project, pancake will create a pancake directory in the root of your project containing the flattened assets.
Install
Install with npm:
npm install @gold.au/pancake
Or install with Yarn:
yarn add @gold.au/pancake --dev
Requirements
- npm version >=
~3.0.0
- A
package.json
file in your root (run npm init --yes
)
Settings
Pancake comes with two different level of settings. Global settings can persist across projects and local settings that are project specific.
Global settings
To change global settings run Pancake with the --set
flag.
npx pancake --set [settingName] [value]
setting | value | default |
---|
npmOrg | This is the npm org scope | @gold.au |
plugins | A switch to disable or enable plugins | true |
ignorePlugins | An array of plugins to be ignored | [] |
Example:
npx pancake --set npmOrg yourOrg
Local settings
To change local settings all you have to do is include a pancake
object into your package.json
file. All possible settings are stated below:
{
"name": "your-name",
"version": "0.1.0",
"pancake": {
"auto-save": true,
"plugins": true,
"ignore": [],
"css": {
"minified": true,
"modules": false,
"browsers": [
"last 2 versions",
"ie 8",
"ie 9",
"ie 10"
],
"location": "pancake/css/",
"name": "pancake.min.css"
},
"sass": {
"modules": false,
"location": "pancake/sass/",
"name": "pancake.scss"
},
"js": {
"minified": true,
"modules": false,
"location": "pancake/js/",
"name": "pancake.min.js"
},
"react": {
"location": "pancake/react/",
},
"json": {
"enable": false,
"location": "pancake/js/",
"name": "pancake",
"content": {
"name": true,
"version": true,
"dependencies": true,
"path": true,
"settings": true
}
}
}
}
To remove js
you can set the value of "name": false
and remove the values minified
, modules
and location
.
CLI
You can display the help with pancake --help
.
Don’t save to package.json
-n
, --nosave
Type: <flag>
The command will stop Pancake from merging your local settings, complete them with the defaults and save them into your package.json
.
This will sort-of shrink-wrap all settings in so you are completely reproducible.
You can also opt-out of this behavior by adding "auds": { "auto-save": false }
into your package.json.
npx pancake --nosave
Overwrite npm org name
-o
, --org
Type: <flag> [value]
You can temporarily overwrite the npm org scope by suppling this flag. This can be useful for testing. Do make sure to use the settings for a
permanent change.
npx pancake --org @otherOrg
Overwrite the plugin toggle
-p
, --noplugins
Type: <flag>
You can temporarily disable all plugins. This is great for ci integration.
npx pancake --noplugins
Overwrite the plugin ignore list
-i
, --ignore
Type: <flag> [comma separated list]
You can temporarily overwrite the list of plugins to be disabled.
npx pancake --ignore @gov.au/pancake-svg,@gov.au/pancake-js
Verbose output
-v
, --verbose
Type: <flag>
Run Pancake in verbose silly mode.
npx pancake --verbose
};