create-gasket-app 7.0.0-next.2 → 7.0.0-next.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/lib/commands/create.js +40 -85
  2. package/lib/config/default-plugins.js +6 -6
  3. package/lib/index.d.ts +81 -25
  4. package/lib/index.js +7 -6
  5. package/lib/main.js +5 -4
  6. package/lib/scaffold/action-wrapper.js +8 -7
  7. package/lib/scaffold/actions/create-hooks.js +8 -9
  8. package/lib/scaffold/actions/generate-files.js +17 -15
  9. package/lib/scaffold/actions/global-prompts.js +11 -26
  10. package/lib/scaffold/actions/index.js +18 -21
  11. package/lib/scaffold/actions/install-modules.js +3 -6
  12. package/lib/scaffold/actions/link-modules.js +3 -5
  13. package/lib/scaffold/actions/load-preset.js +50 -72
  14. package/lib/scaffold/actions/mkdir.js +4 -4
  15. package/lib/scaffold/actions/post-create-hooks.js +6 -8
  16. package/lib/scaffold/actions/preset-config-hooks.js +13 -0
  17. package/lib/scaffold/actions/preset-prompt-hooks.js +17 -0
  18. package/lib/scaffold/actions/print-report.js +8 -7
  19. package/lib/scaffold/actions/prompt-hooks.js +10 -57
  20. package/lib/scaffold/actions/setup-pkg.js +17 -29
  21. package/lib/scaffold/actions/write-gasket-config.js +102 -17
  22. package/lib/scaffold/actions/write-pkg.js +5 -9
  23. package/lib/scaffold/config-builder.js +82 -7
  24. package/lib/scaffold/create-context.js +15 -21
  25. package/lib/scaffold/dump-error-context.js +5 -5
  26. package/lib/scaffold/files.js +2 -2
  27. package/lib/scaffold/utils.js +4 -97
  28. package/lib/utils/create-option.js +2 -4
  29. package/lib/utils/index.js +6 -16
  30. package/lib/utils/logo.js +1 -3
  31. package/lib/utils/process-args.js +1 -3
  32. package/lib/utils/process-command.js +3 -7
  33. package/lib/utils/process-options.js +1 -3
  34. package/lib/utils/warn-if-outdated.js +11 -9
  35. package/package.json +14 -12
  36. package/lib/scaffold/actions/apply-preset-config.js +0 -29
  37. package/lib/scaffold/actions/cli-version.js +0 -84
  38. package/lib/scaffold/actions/load-pkg-for-debug.js +0 -24
  39. package/lib/scaffold/create-engine.js +0 -21
  40. package/lib/scaffold/fetcher.js +0 -194
  41. package/lib/utils/setup.js +0 -25
@@ -1,7 +1,8 @@
1
1
  /* eslint-disable complexity, max-statements */
2
- const deepmerge = require('deepmerge');
3
- const semver = require('semver');
4
- const debug = require('diagnostics')('gasket:create-gasket-app:package');
2
+ import deepmerge from 'deepmerge';
3
+ import { default as semver } from 'semver';
4
+ import { default as diagnostics } from 'diagnostics';
5
+ const debug = diagnostics('gasket:cli:package');
5
6
 
6
7
  /**
7
8
  * Simple object check without bringing in a large
@@ -56,7 +57,7 @@ function isValidVersion(v) {
56
57
  *
57
58
  * @type {ConfigBuilder}
58
59
  */
59
- class ConfigBuilder {
60
+ export class ConfigBuilder {
60
61
  /**
61
62
  * ConfigBuilder
62
63
  *
@@ -179,7 +180,6 @@ class ConfigBuilder {
179
180
  */
180
181
  add(key, value, source, options = {}) {
181
182
  if (typeof value === 'undefined') return;
182
-
183
183
  const existing = this.fields[key];
184
184
  const { name = 'Unknown plugin' } = (source || this.source || {});
185
185
 
@@ -226,6 +226,83 @@ class ConfigBuilder {
226
226
  }
227
227
  }
228
228
 
229
+ /**
230
+ * addPlugin - Add plugin import to the gasket file and use the value in the plugins array
231
+ * @param {string} pluginImport - name of the import used as a value - `import pluginImport...`
232
+ * @param {string} pluginName - name of the plugin import/package - `from 'pluginName'`
233
+ * @example
234
+ * addPlugin('pluginA', '@gasket/plugin-a')
235
+ *
236
+ * // gasket.js
237
+ * import pluginA from '@gasket/plugin-a';
238
+ *
239
+ * export default makeGasket({
240
+ * plugins: [
241
+ * pluginA
242
+ * ]
243
+ * });
244
+ */
245
+ addPlugin(pluginImport, pluginName) {
246
+ this.add('plugins', [`${pluginImport}`]);
247
+ this.add('pluginImports', { [pluginImport]: pluginName });
248
+ }
249
+
250
+ /**
251
+ * addImport - Add a non-plugin import to the gasket file
252
+ * @param {string} importName - name of the import used as a value - `import fs...`
253
+ * @param {string} importPath - path of the import - `from 'fs'`
254
+ * @returns {ConfigBuilder} - instance for chaining
255
+ * @example
256
+ * Can be default or named import
257
+ * addImport('{ readFileSync }', 'fs')
258
+ * addImport('fs', 'fs')
259
+ *
260
+ * // gasket.js
261
+ * import { readFileSync } from 'fs';
262
+ * import fs from 'fs';
263
+ */
264
+ addImport(importName, importPath) {
265
+ this.add('imports', { [importName]: importPath });
266
+ return this;
267
+ }
268
+
269
+ /**
270
+ * addExpression - add programmatic expression to the gasket file
271
+ * @param {string} expression - expression to add after imports
272
+ * @returns {ConfigBuilder} - instance for chaining
273
+ * @example
274
+ *
275
+ * .addImport('fs', 'fs')
276
+ * .addExpression('const file = fs.readFileSync(\'./file.txt\')')
277
+ *
278
+ * // gasket.js
279
+ * import fs from 'fs';
280
+ * const file = fs.readFileSync('./file.txt');
281
+ */
282
+ addExpression(expression) {
283
+ this.add('expressions', [expression.trim()]);
284
+ return this;
285
+ }
286
+
287
+ /**
288
+ * injectValue - Inject a value into the gasket config object
289
+ * @param {string} configKey - collapsed object path to inject value into - `express.config.routes`
290
+ * @param {string} injectedValue - string used as a value
291
+ * @example
292
+ * .addImport('{ routes }', './routes')
293
+ * .injectValue('express.routes', 'routes');
294
+ *
295
+ * // gasket.js
296
+ * export default makeGasket({
297
+ * express: {
298
+ * routes: routes
299
+ * }
300
+ * });
301
+ */
302
+ injectValue(configKey, injectedValue) {
303
+ this.add('injectionAssignments', { [configKey]: injectedValue });
304
+ }
305
+
229
306
  /**
230
307
  * Checks if a dependency has been already added
231
308
  * @param {String} key Dependency bucket
@@ -444,5 +521,3 @@ class ConfigBuilder {
444
521
  }, {});
445
522
  }
446
523
  }
447
-
448
- module.exports = ConfigBuilder;
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable max-len, max-statements */
2
- const fs = require('fs');
3
- const path = require('path');
4
- const { addPluginsToContext, readConfig } = require('../scaffold/utils');
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { readConfig } from '../scaffold/utils.js';
5
5
 
6
6
  /**
7
7
  * The CreateRuntime represents a shallow proxy to a CreateContext
@@ -70,14 +70,14 @@ function flatten(acc, values) {
70
70
  * @property {Boolean} extant - Whether or not target directory already exists
71
71
  * @property {[String]} localPresets - paths to the local presets packages
72
72
  * @property {PresetDesc[]} rawPresets - Raw preset desc from args. Can include version constraint. Added by load-preset if using localPresets.
73
- * @property {PluginDesc[]} rawPlugins - Raw plugin desc from options, prompts, etc. Can include constraints.
74
- * @property {PluginName[]} plugins - Short names of plugins
75
73
  * @property {String[]} pkgLinks - Local packages that should be linked
76
74
  * @property {String[]} messages - non-error/warning messages to report
77
75
  * @property {String[]} warnings - warnings messages to report
78
76
  * @property {String[]} errors - error messages to report but do not exit process
79
77
  * @property {String[]} nextSteps - any next steps to report for user
80
78
  * @property {Set<String>} generatedFiles - any generated files to show in report
79
+ * @property {any[]} presets - Default empty array, populated by load-preset with actual imports
80
+ * @property {Object} presetConfig - Default to object w/empty plugins array to be populated by `presetConfig` hook
81
81
  *
82
82
  * -- Added by `global-prompts`
83
83
  *
@@ -92,12 +92,7 @@ function flatten(acc, values) {
92
92
  * -- Added by `load-preset`
93
93
  *
94
94
  * @property {PresetName[]} presets - Short name of presets
95
- * @property {PresetInfo[]} presetInfos - Shallow load of presets with meta data
96
95
  *
97
- * -- Added by `cli-version`
98
- *
99
- * @property {string} cliVersion - Version of current CLI used to issue `create` command
100
- * @property {string} cliVersionRequired - Version of CLI to install, either current or min compatible version required by preset(s)
101
96
  *
102
97
  * -- Added by `setup-pkg`
103
98
  *
@@ -112,7 +107,7 @@ function flatten(acc, values) {
112
107
  *
113
108
  * @property {Files} files - Use to add files and templates to generate
114
109
  */
115
- class CreateContext {
110
+ export class CreateContext {
116
111
  constructor(initContext = {}) {
117
112
  Object.assign(this, initContext);
118
113
  }
@@ -129,24 +124,22 @@ class CreateContext {
129
124
  * @param {Object} options - Command options
130
125
  * @returns {CreateContext} context
131
126
  */
132
- module.exports = function makeCreateContext(argv = [], options = {}) {
127
+ export function makeCreateContext(argv = [], options = {}) {
133
128
  const appName = argv[0] || 'templated-app';
134
129
  const {
135
- plugins = [],
136
130
  presets = [],
137
131
  npmLink = [],
138
132
  presetPath = [],
139
133
  packageManager,
140
134
  prompts,
141
135
  config,
142
- 'config-file': configFile
136
+ configFile
143
137
  } = options;
144
138
 
145
- // Flatten the array of array created by the plugins flag – it
139
+ // Flatten the array of array created by the plugins flag – it
146
140
  // supports both multiple instances as well as comma-separated lists.
147
141
  const rawPresets = presets.reduce(flatten, []);
148
142
  const localPresets = presetPath.reduce(flatten, []);
149
- const rawPlugins = plugins.reduce(flatten, []);
150
143
  const pkgLinks = npmLink.reduce(flatten, []);
151
144
  const cwd = process.cwd();
152
145
  const dest = path.join(cwd, appName);
@@ -173,7 +166,11 @@ module.exports = function makeCreateContext(argv = [], options = {}) {
173
166
  errors: [],
174
167
  nextSteps: [],
175
168
  generatedFiles: new Set(),
176
- prompts
169
+ prompts,
170
+ presets: [],
171
+ presetConfig: {
172
+ plugins: []
173
+ }
177
174
  });
178
175
 
179
176
  readConfig(context, { config, configFile });
@@ -185,9 +182,6 @@ module.exports = function makeCreateContext(argv = [], options = {}) {
185
182
  context.appName = appName;
186
183
  }
187
184
 
188
- addPluginsToContext(rawPlugins, context);
189
-
190
185
  return context;
191
- };
186
+ }
192
187
 
193
- module.exports.CreateContext = CreateContext;
@@ -1,5 +1,5 @@
1
- const path = require('path');
2
- const fs = require('fs').promises;
1
+ import path from 'path';
2
+ import { writeFile } from 'fs/promises';
3
3
 
4
4
  /**
5
5
  * If an error occurs during create, dump the context for debugging.
@@ -9,7 +9,7 @@ const fs = require('fs').promises;
9
9
  * @param {Error} error - Exiting error
10
10
  * @returns {Promise<void>} promise
11
11
  */
12
- module.exports = async function dumpErrorContext(context, error) {
12
+ export async function dumpErrorContext(context, error) {
13
13
  const { cwd } = context;
14
14
 
15
15
  try {
@@ -17,7 +17,7 @@ module.exports = async function dumpErrorContext(context, error) {
17
17
  const fileName = 'gasket-create-error.log';
18
18
 
19
19
  const filePath = path.join(cwd, fileName);
20
- await fs.writeFile(filePath, JSON.stringify(report, null, 2), 'utf8');
20
+ await writeFile(filePath, JSON.stringify(report, null, 2), 'utf8');
21
21
  console.log(`Error log dumped to: ${filePath}`);
22
22
  } catch (err) {
23
23
  //
@@ -25,4 +25,4 @@ module.exports = async function dumpErrorContext(context, error) {
25
25
  //
26
26
  console.error(`Error writing error log: ${err}`);
27
27
  }
28
- };
28
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @type {Files}
5
5
  */
6
- module.exports = class Files {
6
+ export class Files {
7
7
  constructor() {
8
8
  this.globSets = [];
9
9
  }
@@ -27,4 +27,4 @@ module.exports = class Files {
27
27
  add({ globs, source }) {
28
28
  this.globSets.push({ globs, source });
29
29
  }
30
- };
30
+ }
@@ -1,91 +1,6 @@
1
- const path = require('path');
2
- const untildify = require('untildify');
3
- const { pluginIdentifier } = require('@gasket/resolve');
4
-
5
- /**
6
- * Pushes plugins short names for use in gasket.config.js
7
- * Pushes the original plugin identifiers under rawPlugins
8
- *
9
- * @param {PluginDesc[]} plugins - Plugins names
10
- * @param {CreateContext} context - Create context
11
- */
12
- function addPluginsToContext(plugins, context) {
13
- context.rawPlugins = context.rawPlugins || [];
14
- context.plugins = context.plugins || [];
15
-
16
- context.rawPlugins = plugins.reduce((acc, cur) => {
17
- const next = pluginIdentifier(cur);
18
-
19
- // get the index of existing plugins by comparing short names
20
- const idx = acc.map(p => pluginIdentifier(p).shortName).indexOf(next.shortName);
21
-
22
- if (idx > -1) {
23
- // if the existing plugin does not specify a version, use the next one
24
- if (!pluginIdentifier(acc[idx]).version) {
25
- acc[idx] = cur;
26
- }
27
- } else {
28
- // if we don't already have an entry, push the next one
29
- acc.push(cur);
30
- }
31
-
32
- return acc;
33
- }, context.rawPlugins);
34
-
35
- context.plugins = plugins.reduce((acc, cur) => {
36
- const next = pluginIdentifier(cur).shortName;
37
- if (!acc.includes(next)) acc.push(next);
38
- return acc;
39
- }, context.plugins);
40
- }
41
-
42
- /**
43
- * Adds plugins and dependencies of the app package
44
- *
45
- * @param {PluginDesc[]|pluginIdentifier[]} plugins - Plugins names
46
- * @param {PackageJson} pkg - Package builder
47
- * @param {String} [field] - Dependency type (Default: dependencies)
48
- */
49
- function addPluginsToPkg(plugins, pkg, field = 'dependencies') {
50
- const pluginIds = plugins.map(p => pluginIdentifier(p).withVersion());
51
- pkg.add(field, pluginIds.reduce((acc, p) => {
52
- if (!acc[p.fullName]) {
53
- acc[p.fullName] = p.version;
54
- }
55
- return acc;
56
- }, {}));
57
- }
58
-
59
- /**
60
- * Look up registry version of provided plugin descriptions w/o versions set.
61
- *
62
- * @param {PluginDesc[]|pluginIdentifier[]} plugins - Plugins names
63
- * @param {PackageManager} pkgManager - Package manager instance
64
- * @returns {Promise<pluginIdentifier[]>} plugins
65
- */
66
- async function getPluginsWithVersions(plugins, pkgManager) {
67
- return await Promise.all(
68
- plugins.map(async name => {
69
- const id = pluginIdentifier(name);
70
- if (id.version != null) return id;
71
- const version = (await pkgManager.info([id.fullName, 'version'])).data;
72
- return id.withVersion(`^${version}`);
73
- })
74
- );
75
- }
76
-
77
- /**
78
- * Takes a file path and transforms it to be absolute if not already
79
- *
80
- * @param {string} filepath - Path to file that may be relative or have tildy
81
- * @returns {string} absolute filepath
82
- */
83
- function ensureAbsolute(filepath) {
84
- filepath = untildify(filepath);
85
- if (path.isAbsolute(filepath)) return filepath;
86
- return path.resolve(process.cwd(), filepath);
87
- }
88
-
1
+ import path from 'path';
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
89
4
 
90
5
  /**
91
6
  * Parses JSON file or string to assign to context
@@ -95,7 +10,7 @@ function ensureAbsolute(filepath) {
95
10
  * @param {string} configFlags.config - JSON string of config values
96
11
  * @param {string} configFlags.configFile - path to JSON file of config values
97
12
  */
98
- function readConfig(context, { config, configFile }) {
13
+ export function readConfig(context, { config, configFile }) {
99
14
  if (config) {
100
15
  const parsedConfig = JSON.parse(config);
101
16
  Object.assign(context, parsedConfig);
@@ -105,11 +20,3 @@ function readConfig(context, { config, configFile }) {
105
20
  }
106
21
  }
107
22
 
108
-
109
- module.exports = {
110
- addPluginsToContext,
111
- addPluginsToPkg,
112
- getPluginsWithVersions,
113
- ensureAbsolute,
114
- readConfig
115
- };
@@ -1,11 +1,11 @@
1
- const { Option } = require('commander');
1
+ import { Option } from 'commander';
2
2
 
3
3
  /**
4
4
  * createOption - Create a commander option
5
5
  * @param {CLICommandOption} definition - The option configuration
6
6
  * @returns {CommnaderOption} option
7
7
  */
8
- function createOption(definition) {
8
+ export function createOption(definition) {
9
9
  const option = new Option(...definition.options);
10
10
  const { defaultValue, conflicts, parse, hidden, required } = definition;
11
11
 
@@ -16,5 +16,3 @@ function createOption(definition) {
16
16
  if (required) option.makeOptionMandatory();
17
17
  return option;
18
18
  }
19
-
20
- module.exports = createOption;
@@ -1,16 +1,6 @@
1
- const processCommand = require('./process-command');
2
- const processArgs = require('./process-args');
3
- const processOptions = require('./process-options');
4
- const createOption = require('./create-option');
5
- const logo = require('./logo');
6
- const warnIfOutdated = require('./warn-if-outdated');
7
-
8
-
9
- module.exports = {
10
- processCommand,
11
- processArgs,
12
- processOptions,
13
- createOption,
14
- logo,
15
- warnIfOutdated
16
- };
1
+ export { processCommand } from './process-command.js';
2
+ export { processArgs } from './process-args.js';
3
+ export { processOptions } from './process-options.js';
4
+ export { createOption } from './create-option.js';
5
+ export { logo } from './logo.js';
6
+ export { warnIfOutdated } from './warn-if-outdated.js';
package/lib/utils/logo.js CHANGED
@@ -1,4 +1,4 @@
1
- const logo = `
1
+ export const logo = `
2
2
  ▄▄▄▄████▀▀█▄
3
3
  ▄███▀▀▀▀▀▀▀█▄▄██
4
4
  ▄██▀ ▄▄▄▄▄ ▀██▌ ▄▄▄
@@ -10,5 +10,3 @@ const logo = `
10
10
  ▀███▄▄▄▄▄▄▄█▀▀██
11
11
  ▀▀▀▀████▄▄█▀
12
12
  `;
13
-
14
- module.exports = logo;
@@ -16,7 +16,7 @@ function isValidArg(arg) {
16
16
  * @param {CLICommandArg[]} args Array of argument configurations
17
17
  * @returns {ProccesedCLICommandArg[]} Array of argument definitions
18
18
  */
19
- function processArgs(args) {
19
+ export function processArgs(args) {
20
20
  if (!Array.isArray(args) || !args.every(isValidArg)) throw new Error('Invalid argument(s) configuration');
21
21
 
22
22
  return args.reduce((acc, arg) => {
@@ -35,5 +35,3 @@ function processArgs(args) {
35
35
 
36
36
  }, []);
37
37
  }
38
-
39
- module.exports = processArgs;
@@ -1,8 +1,6 @@
1
- const { Command } = require('commander');
1
+ import { Command } from 'commander';
2
+ import { processArgs, processOptions, createOption } from './index.js';
2
3
  const program = new Command();
3
- const processArgs = require('./process-args');
4
- const processOptions = require('./process-options');
5
- const createOption = require('./create-option');
6
4
 
7
5
  /**
8
6
  * isValidCommand - Validates the command configuration
@@ -25,7 +23,7 @@ function isValidCommand(command) {
25
23
  * @param {CLICommand} command The command configuration
26
24
  * @returns {ProccesedCLICommand} The command instance
27
25
  */
28
- function processCommand(command) {
26
+ export function processCommand(command) {
29
27
  if (!isValidCommand(command)) throw new Error('Invalid command configuration');
30
28
  const { id, description, action, args, options, hidden = false, default: isDefault = false } = command;
31
29
  const cmd = program
@@ -48,5 +46,3 @@ function processCommand(command) {
48
46
 
49
47
  return { command: cmd, hidden, isDefault };
50
48
  }
51
-
52
- module.exports = processCommand;
@@ -16,7 +16,7 @@ function isValidOption(option) {
16
16
  * @param {CLICommandOption[]} options Array of option configurations
17
17
  * @returns {ProccesedCLICommandOption[]} Processed option definitions
18
18
  */
19
- function processOptions(options) {
19
+ export function processOptions(options) {
20
20
  if (!Array.isArray(options) || !options.every(isValidOption)) throw new Error('Invalid option(s) configuration');
21
21
 
22
22
  return options.reduce((acc, option) => {
@@ -42,5 +42,3 @@ function processOptions(options) {
42
42
  return acc;
43
43
  }, []);
44
44
  }
45
-
46
- module.exports = processOptions;
@@ -1,10 +1,12 @@
1
- const { runShellCommand } = require('@gasket/utils');
2
- const semver = require('semver');
3
- const chalk = require('chalk');
4
- const { readFile, writeFile } = require('fs/promises');
5
- const path = require('path');
1
+ import { default as gasketUtils } from '@gasket/utils';
2
+ import semver from 'semver';
3
+ import chalk from 'chalk';
4
+ import { readFile, writeFile } from 'fs/promises';
5
+ import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+ const __dirname = fileURLToPath(import.meta.url);
6
8
 
7
- const cachePath = path.join(__dirname, '..', '..', '.cache'); // Place at root of gasket-cli
9
+ const cachePath = path.join(__dirname, '..', '..', '..', '.cache'); // Place at root of gasket-cli
8
10
  const LATEST_VERSION = 'latestVersion';
9
11
  const LATEST_VERSION_UPDATE_TIME = 'latestVersionUpdateTime';
10
12
 
@@ -34,7 +36,7 @@ async function getLatestVersion(pkgName, currentTime, cache) {
34
36
  isOlderThanSevenDays(currentTime, cache[LATEST_VERSION_UPDATE_TIME])
35
37
  ) {
36
38
  try {
37
- const cmdResult = await runShellCommand('npm', ['view', pkgName, 'version'], {});
39
+ const cmdResult = await gasketUtils.runShellCommand('npm', ['view', pkgName, 'version'], {});
38
40
  if (cmdResult?.stdout) {
39
41
  const latestVersion = cmdResult.stdout.trim();
40
42
  cache[LATEST_VERSION_UPDATE_TIME] = currentTime;
@@ -55,7 +57,7 @@ async function getLatestVersion(pkgName, currentTime, cache) {
55
57
  * @param {string} pkgName - package name
56
58
  * @param {string} currentVersion - current version of the package
57
59
  */
58
- module.exports = async function warnIfOutdated(pkgName, currentVersion) {
60
+ export async function warnIfOutdated(pkgName, currentVersion) {
59
61
  const currentTime = new Date().getTime();
60
62
  let cache = {};
61
63
 
@@ -73,4 +75,4 @@ module.exports = async function warnIfOutdated(pkgName, currentVersion) {
73
75
  ` ${chalk.yellow('›')} Warning: ${pkgName} update available from ${chalk.green(latestVersion)} to ${chalk.green(currentVersion)}`
74
76
  );
75
77
  }
76
- };
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gasket-app",
3
- "version": "7.0.0-next.2",
3
+ "version": "7.0.0-next.21",
4
4
  "description": "starter pack for creating a gasket app",
5
5
  "main": "lib",
6
6
  "bin": {
@@ -9,11 +9,12 @@
9
9
  "files": [
10
10
  "lib"
11
11
  ],
12
+ "type": "module",
12
13
  "scripts": {
13
14
  "lint": "eslint .",
14
15
  "lint:fix": "npm run lint -- --fix",
15
- "test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' jest",
16
- "test:watch": "jest --watch",
16
+ "test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
17
+ "test:watch": "npm run test -- --watch",
17
18
  "test:coverage": "jest --coverage",
18
19
  "posttest": "npm run lint"
19
20
  },
@@ -31,16 +32,14 @@
31
32
  },
32
33
  "homepage": "https://github.com/godaddy/gasket/tree/main/packages/create-gasket-app",
33
34
  "dependencies": {
34
- "@gasket/engine": "^7.0.0-next.2",
35
- "@gasket/plugin-git": "^7.0.0-next.2",
36
- "@gasket/plugin-lifecycle": "^7.0.0-next.2",
37
- "@gasket/plugin-logger": "^7.0.0-next.2",
38
- "@gasket/plugin-metadata": "^7.0.0-next.2",
39
- "@gasket/plugin-start": "^7.0.0-next.2",
40
- "@gasket/resolve": "^7.0.0-next.2",
41
- "@gasket/utils": "^7.0.0-next.2",
35
+ "@gasket/core": "^7.0.0-next.21",
36
+ "@gasket/engine": "^7.0.0-next.21",
37
+ "@gasket/plugin-git": "^7.0.0-next.21",
38
+ "@gasket/plugin-logger": "^7.0.0-next.21",
39
+ "@gasket/utils": "^7.0.0-next.21",
42
40
  "commander": "^12.0.0",
43
41
  "deepmerge": "^4.3.1",
42
+ "glob": "^8.1.0",
44
43
  "handlebars": "^4.7.8",
45
44
  "inquirer": "6.5.2",
46
45
  "json5": "^2.2.3",
@@ -77,5 +76,8 @@
77
76
  "eslintIgnore": [
78
77
  "test/fixtures"
79
78
  ],
80
- "gitHead": "ae1c37abe63a7deea1431e37e57f2b14daa31bf5"
79
+ "jest": {
80
+ "transform": {}
81
+ },
82
+ "gitHead": "52718d035b5a33c04de7043587f89596dd6da6f4"
81
83
  }
@@ -1,29 +0,0 @@
1
- const { flattenPresets } = require('@gasket/resolve');
2
- const action = require('../action-wrapper');
3
-
4
- /**
5
- * Extracts predefined createContext from presets and applies to context.
6
- * This allows presets to preemptively define fill in the create context.
7
- * This will prevent prompts from appearing for the associated prompts.
8
- *
9
- * For example, `presetContext` contains `appDescription`, the prompt for the
10
- * newly created app's description will not appear.
11
- *
12
- * We take whatever is in the context at a higher priority, because any
13
- * config that is the context at this point must come from CLI flags,
14
- * as none of the global prompts have run yet. Parent presets take priority
15
- * over extended presets.
16
- *
17
- * @param {CreateContext} context - Create context
18
- */
19
- function applyPresetConfig(context) {
20
- const { presetInfos = [] } = context;
21
-
22
- const presetContext = flattenPresets(presetInfos).reduce((acc, presetInfo) => {
23
- return { ...(presetInfo.module && presetInfo.module.createContext || {}), ...acc };
24
- }, context);
25
-
26
- Object.assign(context, presetContext);
27
- }
28
-
29
- module.exports = action('Apply preset context', applyPresetConfig, { startSpinner: false });