Skip to content

Instantly share code, notes, and snippets.

@Hypercubed
Last active June 20, 2018 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hypercubed/9979190ea462c76d13e80def7b5aa3d8 to your computer and use it in GitHub Desktop.
Save Hypercubed/9979190ea462c76d13e80def7b5aa3d8 to your computer and use it in GitHub Desktop.
node_modules
package-lock.json
#!/usr/bin/env node
'use strict';
const execa = require('execa');
const needBranch = process.argv[2];
// from https://github.com/sindresorhus/np/blob/master/lib/git.js
execa.stdout('git', ['symbolic-ref', '--short', 'HEAD']).then(branch => {
if (branch !== needBranch) {
console.error('Not on "%s" branch.', needBranch);
process.exit(1);
}
});
#!/usr/bin/env node
'use strict';
const execa = require('execa');
// from https://github.com/sindresorhus/np/blob/master/lib/git.js
execa.stdout('git', ['status', '--porcelain']).then(status => {
if (status !== '') {
console.error('Unclean working tree. Commit or stash changes first.');
process.exit(1);
}
});
#!/usr/bin/env node
'use strict';
const execa = require('execa');
// from https://github.com/sindresorhus/np/blob/master/lib/git.js
execa.stdout('git', ['rev-list', '--count', '--left-only', '@{u}...HEAD']).then(result => {
if (result !== '0') {
console.error('Remote history differs. Please pull changes.');
process.exit(1);
}
})
scripts:
serve: ng serve
lint: ng lint
build:
default: ng build
prod: ng build --prod
start:
default: nps build.lib serve
prod: nps build.lib.prod serve
test:
default: start-server-and-test serve http-get://localhost:4200 cypress.run
watch: start-server-and-test serve http-get://localhost:4200 cypress.open
cypress:
open: cypress open
run: cypress run
prettier: prettier --write "**/*.{js,ts}"
changelog: >
chg release -y &&
git add -A CHANGELOG.md
version: nps changelog
postversion: >
cpy CHANGELOG.md ./projects/swimlane/ngx-dnd &
ts-node ./tools/set-metadata.ts
scss:
default: >
echo 'scss.build' &
echo 'scss.bundle'
bundle: scss-bundle -c ./projects/swimlane/ngx-dnd/scss-bundle.config.json
build: node-sass ./projects/swimlane/ngx-dnd/src/lib/ngx-dnd.scss ./dist/swimlane/ngx-dnd/release/index.css
lib:
build: >
ng build @swimlane/ngx-dnd &&
nps scss
prod: >
ng build --prod @swimlane/ngx-dnd &&
nps scss
publish: >
cd dist/swimlane/ngx-dnd &&
npm publish --tag next
pack: >
cd dist/swimlane/ngx-dnd &&
npm pack
deploy:
default: nps build deploy.ghpages
ghpages: angular-cli-ghpages --dir ./dist/ngx-dnd/
publish:
default: >
nps publish.git-check publish.clean-install &&
concurrently "nps build" "nps lib.prod" &&
concurrently "nps test" "nps lint" &&
concurrently "nps lib.publish" "nps deploy"
git-check: >
node ./check-current-branch.js master &&
node ./check-local-working-tree.js &&
node ./check-remote-history.js
clean-install: >
rimraf node_modules &&
npm install
{
"name": "nps-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"nps": "nps",
"build": "nps build",
"start": "nps start",
"test": "nps test",
"version": "nps version",
"postversion": "nps postversion",
"publish": "nps publish",
"deploy": "nps deploy"
},
"author": "",
"license": "ISC",
"devDependencies": {
"concurrently": "^3.6.0",
"cpy-cli": "^2.0.0",
"execa": "^0.10.0",
"nps": "^5.9.0",
"rimraf": "^2.6.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment