-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Philipp Bergmann
committed
Jun 5, 2019
0 parents
commit 049dafe
Showing
47 changed files
with
2,087 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lib/templates/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": "eslint:recommended", | ||
"root": true, | ||
"rules": { | ||
"indent": ["error", 4], | ||
"no-undef": 0, | ||
"no-console": ["error", { "allow": ["log", "warn", "error", "info", "table"] }] | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2017, | ||
"sourceType": "module" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
web-ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
MIT License | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# VHUG BUILDING TASKS | ||
|
||
## What is this script doing? | ||
|
||
In charge of running the dev / build / release / deploy / newpattern toolchain for groundzero projects by providing a simple CLI. | ||
|
||
*** This package is a dependencie of VHUG BASE, will not work as a standalone *** | ||
|
||
## Installation | ||
|
||
1) npm install: | ||
``` | ||
npm install @vonheldenundgestalten/vhug-tasks --save-dev | ||
``` | ||
2) get all coomand options by running from the terminal: | ||
``` | ||
groundzero help | ||
``` | ||
* for convinence, groundzero projects should also come with mapped npm commands to the CLI. | ||
* if you need to overwrite some config files in your project, copy-paste the config you need from the "config-templates" folder to your project root folder and edit as you wish. | ||
## Development | ||
For development of the ***taskrunner***, you would want to: | ||
1) clone the repo and install it. | ||
2) clone the latest groundzero-pattern repo, install it and run within-it: | ||
``` | ||
npm link path/to/taskrunner | ||
```` | ||
3) this would map the taskrunner repo to run as a native node_modules package in the groundzero-pattern, giving you the ability to develope without the need to rebuild and quickly run the tasks against a sample groundzero project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
console.log('using babel default') | ||
module.exports = function (api) { | ||
api.cache(true); | ||
|
||
const presets = [ | ||
["@babel/env", { | ||
// modules: false, | ||
targets: { | ||
"browsers": [ | ||
"defaults", //(> 0.5%, last 2 versions, Firefox ESR, not dead) | ||
"ie 10", | ||
"ie 11" | ||
] | ||
}, | ||
// for uglifyjs... | ||
forceAllTransforms: process.env === "production" | ||
}], | ||
]; | ||
const plugins = []; | ||
|
||
return { | ||
presets, | ||
plugins | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
const minimist = require('minimist') | ||
const error = require('./lib/error.js') | ||
const criticalCss = require('./lib/critical-css.js').process | ||
const args = minimist(process.argv.slice(2)) | ||
|
||
let cmd = args._[0] || 'help' | ||
|
||
if (args.version || args.v) { | ||
cmd = 'version' | ||
} | ||
|
||
if (args.help || args.h) { | ||
cmd = 'help' | ||
} | ||
|
||
switch (cmd) { | ||
case 'dev': | ||
require('./cli/dev.js') | ||
break | ||
|
||
case 'build': | ||
require('./cli/build') | ||
break | ||
|
||
case 'release': | ||
require('./cli/release') | ||
break | ||
|
||
case 'deploy': | ||
require('./cli/deploy') | ||
break | ||
|
||
case 'newpattern': | ||
require('./cli/newpattern') | ||
break | ||
|
||
case 'version': | ||
require('./lib/version')(args) | ||
break | ||
|
||
case 'update': | ||
require('./lib/update') | ||
break | ||
|
||
case 'help': | ||
require('./lib/help')(args) | ||
break | ||
|
||
case 'jest': | ||
require('./cli/jest.js') | ||
break | ||
|
||
default: | ||
error(`"${cmd}" is not a valid command!`, true) | ||
break | ||
} | ||
|
||
module.exports = { | ||
criticalCss | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
const { spawn } = require('child_process'); | ||
const fs = require('fs'); | ||
// expose project root folder varialbe to load configs in npm | ||
process.env.PROJECT_CWD = process.env.PWD; | ||
|
||
// check if we have a webpack.dev config in project root | ||
try { | ||
fs.accessSync(`${ process.env.PROJECT_CWD }/webpack.dev.js`, fs.constants.R_OK | fs.constants.W_OK); | ||
process.env.WEBPACK_DEV_CONFIG = `${process.env.PROJECT_CWD}/webpack.dev.js` | ||
console.error('use webpack.dev project config!'); | ||
} catch (err) { | ||
console.error('use webpack.dev package config!'); | ||
process.env.WEBPACK_DEV_CONFIG = `./webpack.dev.js` | ||
} | ||
// check if we have a svg-sprite config in project root | ||
try { | ||
fs.accessSync(`${ process.env.PROJECT_CWD }/svg-sprite.config.js`, fs.constants.R_OK | fs.constants.W_OK); | ||
process.env.SPRITE_CONFIG = `${process.env.PROJECT_CWD}/svg-sprite.config.js` | ||
console.error('use svg-sprite.config project config!'); | ||
} catch (err) { | ||
console.error('use svg-sprite.config package config!'); | ||
process.env.SPRITE_CONFIG = `./svg-sprite.config.js` | ||
} | ||
|
||
const child = spawn('npm explore @vonheldenundgestalten/vhug-tasks -- npm run build', { | ||
stdio: 'inherit', | ||
env: process.env, | ||
shell: true | ||
}); | ||
|
||
if (child.stdin) { | ||
process.stdin.pipe(child.stdin) | ||
} | ||
|
||
if (child.stdout) { | ||
child.stdout.on('data', (data) => { | ||
console.log(`child stdout:\n${data}`); | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
const { spawn } = require('child_process'); | ||
const minimist = require('minimist') | ||
const args = minimist(process.argv.slice(2)) | ||
const fs = require('fs'); | ||
// expose project root folder varialbe to load configs in npm | ||
process.env.PROJECT_CWD = process.env.PWD; | ||
|
||
// check if we have a webpack.dev config in project root | ||
try { | ||
fs.accessSync(`${ process.env.PROJECT_CWD }/webpack.dev.js`, fs.constants.R_OK | fs.constants.W_OK); | ||
process.env.WEBPACK_DEV_CONFIG = `${process.env.PROJECT_CWD}/webpack.dev.js` | ||
console.error('use webpack.dev project config!'); | ||
} catch (err) { | ||
console.error('use webpack.dev package config!'); | ||
process.env.WEBPACK_DEV_CONFIG = `./webpack.dev.js` | ||
} | ||
// check if we have a svg-sprite config in project root | ||
try { | ||
fs.accessSync(`${ process.env.PROJECT_CWD }/svg-sprite.config.js`, fs.constants.R_OK | fs.constants.W_OK); | ||
process.env.SPRITE_CONFIG = `${process.env.PROJECT_CWD}/svg-sprite.config.js` | ||
console.error('use svg-sprite.config project config!'); | ||
} catch (err) { | ||
console.error('use svg-sprite.config package config!'); | ||
process.env.SPRITE_CONFIG = `./svg-sprite.config.js` | ||
} | ||
|
||
let options = ''; | ||
if (args.all) { | ||
options = ':all' | ||
} else { | ||
if (args.stage) { | ||
options = ':stage' | ||
} | ||
} | ||
if (args.feature) { | ||
options = ':feature' + options | ||
} | ||
|
||
const child = spawn(`npm explore @jvmn/groundzero-taskrunner -- npm run deploy${options}`, { | ||
stdio: 'inherit', | ||
env: process.env, | ||
shell: true | ||
}); | ||
|
||
if (child.stdin) { | ||
process.stdin.pipe(child.stdin) | ||
} | ||
|
||
if (child.stdout) { | ||
child.stdout.on('data', (data) => { | ||
console.log(`child stdout:\n${data}`); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
const { spawn } = require('child_process'); | ||
const fs = require('fs'); | ||
// expose project root folder varialbe to load configs in npm | ||
process.env.PROJECT_CWD = process.env.PWD; | ||
|
||
// check if we have a webpack.dev config in project root | ||
try { | ||
fs.accessSync(`${ process.env.PROJECT_CWD }/webpack.dev.js`, fs.constants.R_OK | fs.constants.W_OK); | ||
process.env.WEBPACK_DEV_CONFIG = `${process.env.PROJECT_CWD}/webpack.dev.js` | ||
console.error('use webpack.dev project config!'); | ||
} catch (err) { | ||
console.error('use webpack.dev package config!'); | ||
process.env.WEBPACK_DEV_CONFIG = `./webpack.dev.js` | ||
} | ||
// check if we have a svg-sprite config in project root | ||
try { | ||
fs.accessSync(`${ process.env.PROJECT_CWD }/svg-sprite.config.js`, fs.constants.R_OK | fs.constants.W_OK); | ||
process.env.SPRITE_CONFIG = `${process.env.PROJECT_CWD}/svg-sprite.config.js` | ||
console.error('use svg-sprite.config project config!'); | ||
} catch (err) { | ||
console.error('use svg-sprite.config package config!'); | ||
process.env.SPRITE_CONFIG = `./svg-sprite.config.js` | ||
} | ||
|
||
const child = spawn('npm explore @jvmn/groundzero-taskrunner -- npm run dev', { | ||
stdio: 'inherit', | ||
env: process.env, | ||
shell: true | ||
}); | ||
|
||
if (child.stdin) { | ||
process.stdin.pipe(child.stdin) | ||
} | ||
|
||
if (child.stdout) { | ||
child.stdout.on('data', (data) => { | ||
console.log(`child stdout:\n${data}`); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
const { spawn } = require('child_process'); | ||
|
||
console.log("running jest"); | ||
// we expose the project path to correctly use it within the tasks | ||
process.env.PROJECT_CWD = process.env.PWD; | ||
|
||
let options = ' --'; | ||
options += ' --projects ' + process.env.PROJECT_CWD; | ||
|
||
const child = spawn('npm explore @jvonheldenundgestalten/vhug-tasks -- npm run jest' + options, { | ||
stdio: 'inherit', | ||
env: process.env, | ||
shell: true | ||
}); | ||
|
||
if (child.stdin) { | ||
process.stdin.pipe(child.stdin) | ||
} | ||
|
||
if (child.stdout) { | ||
child.stdout.on('data', (data) => { | ||
console.log(`child stdout:\n${data}`); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
const { spawn } = require('child_process'); | ||
|
||
console.log("running newpattern"); | ||
// we expose the project path to correctly use it within the tasks | ||
process.env.PROJECT_CWD = process.env.PWD; | ||
|
||
const child = spawn('npm explore @vonheldenundgestalten/vhug-tasks -- npm run newpattern', { | ||
stdio: 'inherit', | ||
env: process.env, | ||
shell: true | ||
}); | ||
|
||
if (child.stdin) { | ||
process.stdin.pipe(child.stdin) | ||
} | ||
|
||
if (child.stdout) { | ||
child.stdout.on('data', (data) => { | ||
console.log(`child stdout:\n${data}`); | ||
}); | ||
} |
Oops, something went wrong.