@gasket/cli
Advanced tools
Comparing version 7.0.0-next.21 to 7.0.0-next.22
@@ -7,3 +7,4 @@ #!/usr/bin/env node | ||
const program = new Command(); | ||
const { logo, warnIfOutdated } = require('../lib/utils'); | ||
const { logo } = require('../lib/utils'); | ||
const { warnIfOutdated } = require('@gasket/utils'); | ||
const init = require('../lib/init'); | ||
@@ -10,0 +11,0 @@ |
@@ -30,10 +30,2 @@ # Configuring Gasket | ||
### Short names | ||
Items in these arrays are module names. Gasket supports shorthand naming; | ||
`'@gasket/mocha'` expands to `@gasket/plugin-mocha` in the `add` and `remove` | ||
arrays. For `presets`, `@gasket/nextjs` expands to `@gasket/preset-nextjs`. | ||
See the [naming convention] for more details. | ||
## Environments | ||
@@ -152,7 +144,7 @@ | ||
application configuration. If you must access the Gasket configuration, you can | ||
add a [lifecycle script][lifecycle plugin] to your application and access the | ||
Gasket configuration via the `gasket.config` property: | ||
create a custom app-level plugin and add a lifecycle hook to your application | ||
and access the Gasket configuration via the `gasket.config` property: | ||
```js | ||
// lifecycles/express.js | ||
// my-custom-app/lifecycles/express.js | ||
@@ -194,3 +186,1 @@ module.exports = (gasket, app) => { | ||
[start plugin]: /packages/gasket-plugin-start/README.md | ||
[lifecycle plugin]: /packages/gasket-plugin-lifecycle/README.md | ||
[naming convention]: /packages/gasket-resolve/README.md |
module.exports = [ | ||
require('@gasket/plugin-lifecycle'), | ||
require('@gasket/plugin-metadata'), | ||
@@ -4,0 +3,0 @@ require('@gasket/plugin-start'), |
@@ -1,2 +0,1 @@ | ||
const { pluginIdentifier } = require('@gasket/resolve'); | ||
const defaultPlugins = require('./default-plugins'); | ||
@@ -48,6 +47,6 @@ | ||
const name = typeof p === 'string' ? p : p.name; | ||
return pluginIdentifier(name).fullName; | ||
return name; | ||
}) | ||
); | ||
const pluginsToAdd = defaultPlugins.filter(p => !filteredNames.has(pluginIdentifier(p.name).fullName)); | ||
const pluginsToAdd = defaultPlugins.filter(p => !filteredNames.has(p.name)); | ||
return { | ||
@@ -54,0 +53,0 @@ ...gasketConfig, |
@@ -1,2 +0,2 @@ | ||
import type { MaybeAsync } from '@gasket/engine'; | ||
import type { MaybeAsync } from '@gasket/core'; | ||
import type { Command } from 'commander'; | ||
@@ -110,3 +110,3 @@ | ||
declare module '@gasket/engine' { | ||
declare module '@gasket/core' { | ||
export interface HookExecTypes { | ||
@@ -113,0 +113,0 @@ commandOptions(config: Config): MaybeAsync<Array<GasketOptionDefinition> | GasketOptionDefinition>; |
/* eslint-disable max-statements */ | ||
const debug = require('diagnostics')('gasket:cli:hooks:init'); | ||
const { loadGasketConfigFile, assignPresetConfig } = require('@gasket/resolve'); | ||
const { getEnvironment, addDefaultPlugins } = require('./config/utils'); | ||
const PluginEngine = require('@gasket/engine'); | ||
const { getEnvironment } = require('./config/utils'); | ||
const { | ||
processOptions, | ||
processCommand, | ||
createOption, | ||
parseEnvOption, | ||
@@ -30,3 +25,3 @@ handleEnvVars | ||
try { | ||
const { root, bin, options } = config; | ||
const { root, options } = config; | ||
// Parse the env option manually before Commander does its own parsing | ||
@@ -39,40 +34,3 @@ options.env = parseEnvOption(argv); | ||
let configFile = await loadGasketConfigFile(root, env, id, options.gasketConfig); | ||
if (configFile) { | ||
configFile = addDefaultPlugins(configFile); | ||
const gasket = new PluginEngine(configFile, { resolveFrom: root }); | ||
assignPresetConfig(gasket); | ||
config.gasket = gasket; | ||
// Add global options to the bin | ||
const globalOptions = (await gasket.exec('commandOptions', config)) | ||
.reduce((all, opts) => all.concat(opts), []) | ||
.filter(opt => Boolean(opt)); | ||
processOptions(globalOptions) | ||
.forEach(opt => { | ||
bin.addOption(createOption(opt)); | ||
}); | ||
// Add commands to the bin | ||
const commands = (await gasket.exec('commands', config)) | ||
.reduce((all, cmds) => all.concat(cmds), []) | ||
.filter(cmd => Boolean(cmd)) | ||
.map(cmd => processCommand(cmd)); | ||
commands.forEach(cmd => | ||
bin.addCommand(cmd.command, { hidden: cmd.hidden, isDefault: cmd.isDefault })); | ||
// Set the gasket command and options for lifecycles | ||
// Need to define after commandOptions and commands are executed | ||
config.gasket.command = { id, argv, options: bin.opts() }; | ||
// Initialize Gasket | ||
await gasket.exec('init'); | ||
gasket.config = await gasket.execWaterfall('configure', gasket.config); | ||
// Parse command options and execute command action | ||
await bin.parseAsync(); | ||
} else { | ||
await bin.parseAsync(); | ||
warn('No gasket.config file was found.'); | ||
} | ||
// TODO: investigate an alternate CLI init | ||
} catch (err) { | ||
@@ -79,0 +37,0 @@ console.error(err, { exit: 1 }); |
@@ -7,3 +7,2 @@ const processCommand = require('./process-command'); | ||
const logo = require('./logo'); | ||
const warnIfOutdated = require('./warn-if-outdated'); | ||
@@ -18,4 +17,3 @@ | ||
parseEnvOption, | ||
logo, | ||
warnIfOutdated | ||
logo | ||
}; |
{ | ||
"name": "@gasket/cli", | ||
"version": "7.0.0-next.21", | ||
"version": "7.0.0-next.22", | ||
"description": "CLI for rapid application development with gasket", | ||
@@ -47,10 +47,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@gasket/engine": "^7.0.0-next.21", | ||
"@gasket/plugin-git": "^7.0.0-next.21", | ||
"@gasket/plugin-lifecycle": "^7.0.0-next.21", | ||
"@gasket/plugin-logger": "^7.0.0-next.21", | ||
"@gasket/plugin-metadata": "^7.0.0-next.21", | ||
"@gasket/plugin-start": "^7.0.0-next.21", | ||
"@gasket/resolve": "^7.0.0-next.21", | ||
"@gasket/utils": "^7.0.0-next.21", | ||
"@gasket/core": "^7.0.0-next.22", | ||
"@gasket/plugin-git": "^7.0.0-next.22", | ||
"@gasket/plugin-logger": "^7.0.0-next.22", | ||
"@gasket/plugin-metadata": "^7.0.0-next.22", | ||
"@gasket/plugin-start": "^7.0.0-next.22", | ||
"@gasket/utils": "^7.0.0-next.22", | ||
"commander": "^12.0.0", | ||
@@ -202,3 +200,3 @@ "cross-env": "^7.0.3", | ||
}, | ||
"gitHead": "52718d035b5a33c04de7043587f89596dd6da6f4" | ||
"gitHead": "b477b086bf8938f34fffa673e396920eae9a0263" | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
13
4
49523
23
458
+ Added@gasket/core@^7.0.0-next.22
- Removed@gasket/engine@^7.0.0-next.21
- Removed@gasket/resolve@^7.0.0-next.21
- Removed@gasket/engine@7.0.0-next.21(transitive)
- Removed@gasket/plugin-lifecycle@7.0.0-next.21(transitive)
- Removed@gasket/resolve@7.0.0-next.21(transitive)
- Removedlodash.camelcase@4.3.0(transitive)
- Removedlodash.defaultsdeep@4.6.1(transitive)
Updated@gasket/utils@^7.0.0-next.22