@architect/hydrate
Advanced tools
Comparing version 3.0.0-RC.1 to 3.0.0-RC.2
@@ -14,3 +14,5 @@ # Architect Hydrate changelog | ||
- Lambda treeshaking (currently for Node.js) is now the default when being run from CLI | ||
- Breaking change: legacy `@tables-streams` folders (`src/tables/...` and `src/streams/...`) are now deprecated | ||
- Breaking change: bare CLI arguments (e.g. `hydrate update`) as aliases to flags are no longer used, please use CLI flags (e.g. `hydrate --update` or `hydrate -u`) | ||
- Stop publishing to the GitHub Package registry | ||
@@ -17,0 +19,0 @@ - Updated dependencies |
52
cli.js
#!/usr/bin/env node | ||
let minimist = require('minimist') | ||
let hydrate = require('.') | ||
@@ -10,32 +11,39 @@ | ||
* options | ||
* (default) .............. hydrates all functions, shared, copies files | ||
* -s|--shared|shared ..... hydrates and copies shared files only | ||
* -u|--update|update ..... updates each function's dependencies | ||
* -v|--verbose|verbose ... prints additional output to console | ||
* (default) ...... hydrates all functions, shared, copies files | ||
* -s|--shared .... hydrates and copies shared files only | ||
* -u|--update .... updates each function's dependencies | ||
* -v|--verbose ... prints additional output to console | ||
*/ | ||
let isShared = opt => opt === 'shared' || opt === '--shared' || opt === '-s' | ||
let isUpdate = opt => opt === 'update' || opt === '--update' || opt === '-u' || | ||
opt === 'upgrade' || opt === '--upgrade' // jic | ||
let isVerbose = opt => opt === 'verbose' || opt === '--verbose' || opt === '-v' | ||
let isAutoinstall = opt => opt === 'autoinstall' || opt === '--autoinstall' | ||
async function main (options = {}) { | ||
let { inventory } = options | ||
// eslint-disable-next-line | ||
async function cmd (opts = []) { | ||
let args = { | ||
verbose: opts.some(isVerbose), | ||
autoinstall: opts.some(isAutoinstall), | ||
let alias = { | ||
update: [ 'u', 'upgrade' ], | ||
shared: [ 's' ], | ||
debug: [ 'd' ], | ||
verbose: [ 'v' ], | ||
} | ||
let boolean = [ 'autoinstall', 'update', 'production', 'verbose' ] | ||
let def = { autoinstall: true } | ||
let args = minimist(process.argv.slice(2), { alias, boolean, default: def }) | ||
if (args._[0] === 'hydrate') args._.splice(0, 1) | ||
if (opts.some(isShared)) { | ||
return hydrate.shared(args) | ||
let params = { | ||
inventory, | ||
autoinstall: args.autoinstall, | ||
verbose: args.verbose, | ||
} | ||
if (opts.some(isUpdate)) { | ||
return hydrate.update(args) | ||
if (args.shared) { | ||
hydrate.shared(params) | ||
} | ||
return hydrate.install(args) | ||
else if (args.update) { | ||
hydrate.update(params) | ||
} | ||
else { | ||
hydrate.install(params) | ||
} | ||
} | ||
module.exports = cmd | ||
module.exports = main | ||
@@ -46,3 +54,3 @@ // allow direct invoke | ||
try { | ||
await cmd(process.argv) | ||
await main() | ||
} | ||
@@ -49,0 +57,0 @@ catch (err) { |
{ | ||
"name": "@architect/hydrate", | ||
"version": "3.0.0-RC.1", | ||
"version": "3.0.0-RC.2", | ||
"description": "Architect dependency hydrator and shared file manager", | ||
@@ -40,2 +40,3 @@ "main": "index.js", | ||
"glob": "~7.2.0", | ||
"minimist": "~1.2.5", | ||
"run-series": "~1.1.9", | ||
@@ -42,0 +43,0 @@ "symlink-or-copy": "~1.3.1" |
@@ -32,3 +32,5 @@ let { sync: glob } = require('glob') | ||
} | ||
if (params.inventory) hydrator(params.inventory, true, params, callback) | ||
if (params.inventory) { | ||
hydrator(params.inventory, true, params, callback) | ||
} | ||
else { | ||
@@ -42,2 +44,3 @@ _inventory({ cwd: params.cwd }, function (err, inventory) { | ||
} | ||
module.exports = { | ||
@@ -52,3 +55,3 @@ install: run.bind({}, true), | ||
// Main params | ||
autoinstall = false, | ||
autoinstall = true, | ||
installRoot = false, | ||
@@ -144,3 +147,3 @@ basepath, | ||
} | ||
let result = actions.autoinstall({ dirs, update, inventory, ...params }) | ||
let result = actions.autoinstall({ dirs, update, ...params, inventory }) | ||
if (result.length) { | ||
@@ -147,0 +150,0 @@ autoinstalled = result |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60650
949
10
+ Addedminimist@~1.2.5