create-gasket-app 7.3.11 → 7.4.0
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.
- package/lib/commands/create.js +2 -2
- package/lib/internal.d.ts +1 -1
- package/lib/scaffold/actions/create-hooks.js +1 -1
- package/lib/scaffold/actions/generate-files.js +5 -5
- package/lib/scaffold/actions/global-prompts.js +28 -13
- package/lib/scaffold/actions/install-modules.js +1 -1
- package/lib/scaffold/actions/link-modules.js +1 -1
- package/lib/scaffold/actions/load-preset.js +1 -1
- package/lib/scaffold/actions/mkdir.js +1 -1
- package/lib/scaffold/actions/post-create-hooks.js +1 -1
- package/lib/scaffold/actions/preset-config-hooks.js +1 -1
- package/lib/scaffold/actions/preset-prompt-hooks.js +1 -1
- package/lib/scaffold/actions/print-report.js +2 -2
- package/lib/scaffold/actions/prompt-hooks.js +2 -2
- package/lib/scaffold/actions/setup-pkg.js +1 -1
- package/lib/scaffold/actions/write-gasket-config.js +7 -7
- package/lib/scaffold/actions/write-pkg.js +1 -1
- package/lib/scaffold/config-builder.js +1 -1
- package/lib/scaffold/create-context.js +6 -3
- package/lib/scaffold/dump-error-context.js +1 -1
- package/lib/scaffold/files.js +1 -1
- package/lib/scaffold/readme.js +1 -1
- package/lib/scaffold/utils.js +1 -1
- package/lib/scaffold/with-spinner.js +4 -4
- package/lib/utils/create-option.js +1 -1
- package/lib/utils/process-args.js +2 -2
- package/lib/utils/process-command.js +2 -2
- package/lib/utils/process-options.js +2 -2
- package/package.json +10 -10
package/lib/commands/create.js
CHANGED
|
@@ -22,7 +22,7 @@ import printReport from '../scaffold/actions/print-report.js';
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Parses comma separated option input to array
|
|
25
|
-
* @type {import('../internal').commasToArray}
|
|
25
|
+
* @type {import('../internal.js').commasToArray}
|
|
26
26
|
*/
|
|
27
27
|
const commasToArray = input => input.split(',').map(name => name.trim());
|
|
28
28
|
|
|
@@ -92,7 +92,7 @@ const createCommand = {
|
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* createCommand action
|
|
95
|
-
* @type {import('../index').createCommandAction}
|
|
95
|
+
* @type {import('../index.js').createCommandAction}
|
|
96
96
|
*/
|
|
97
97
|
createCommand.action = async function run(appname, options, command) {
|
|
98
98
|
// eslint-disable-next-line no-process-env
|
package/lib/internal.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ export function chooseTestPlugins(context: PartialCreateContext, prompt: CreateP
|
|
|
99
99
|
export function promptForTestPlugin(
|
|
100
100
|
prompt: CreatePrompt,
|
|
101
101
|
message: string,
|
|
102
|
-
|
|
102
|
+
isDefault: boolean
|
|
103
103
|
): Promise<string | null>;
|
|
104
104
|
export function allowExtantOverwriting(context: PartialCreateContext, prompt: CreatePrompt): Promise<void>;
|
|
105
105
|
export function globalPrompts(params: { context: PartialCreateContext }): Promise<void>;
|
|
@@ -6,7 +6,7 @@ import Readme from '../readme.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Executes the `create` hook for all registered plugins.
|
|
8
8
|
* Adds `files` to context for plugins to add their files and templates.
|
|
9
|
-
* @type {import('../../internal').createHooks}
|
|
9
|
+
* @type {import('../../internal.js').createHooks}
|
|
10
10
|
*/
|
|
11
11
|
async function createHooks({ gasket, context }) {
|
|
12
12
|
const { warnings } = context;
|
|
@@ -20,7 +20,7 @@ const splitSep = pthStr => pthStr.split(reSep);
|
|
|
20
20
|
* Find all duplicate target files and reduce to single descriptor.
|
|
21
21
|
* Keeps track of overrides.
|
|
22
22
|
* Last in wins.
|
|
23
|
-
* @type {import('../../internal').reduceDescriptors}
|
|
23
|
+
* @type {import('../../internal.js').reduceDescriptors}
|
|
24
24
|
*/
|
|
25
25
|
function reduceDescriptors(descriptors) {
|
|
26
26
|
const reduced = descriptors.reduce((acc, desc) => {
|
|
@@ -41,7 +41,7 @@ function reduceDescriptors(descriptors) {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Assemble the description objects from glob results
|
|
44
|
-
* @type {import('../../internal').assembleDescriptors}
|
|
44
|
+
* @type {import('../../internal.js').assembleDescriptors}
|
|
45
45
|
*/
|
|
46
46
|
function assembleDescriptors(dest, from, pattern, srcPaths) {
|
|
47
47
|
const output = joinSep(splitSep(dest));
|
|
@@ -64,7 +64,7 @@ function assembleDescriptors(dest, from, pattern, srcPaths) {
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Build a list of descriptions of all files we want to generate
|
|
67
|
-
* @type {import('../../internal').getDescriptors}
|
|
67
|
+
* @type {import('../../internal.js').getDescriptors}
|
|
68
68
|
*/
|
|
69
69
|
async function getDescriptors(context) {
|
|
70
70
|
const { dest, files } = context;
|
|
@@ -85,7 +85,7 @@ async function getDescriptors(context) {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Read file content, apply templating, then write out target file.
|
|
88
|
-
* @type {import('../../internal').performGenerate}
|
|
88
|
+
* @type {import('../../internal.js').performGenerate}
|
|
89
89
|
*/
|
|
90
90
|
async function performGenerate(context, descriptors) {
|
|
91
91
|
const { warnings, errors, generatedFiles } = context;
|
|
@@ -151,7 +151,7 @@ async function performGenerate(context, descriptors) {
|
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Generate the app files and templates using context
|
|
154
|
-
* @type {import('../../internal').generateFiles}
|
|
154
|
+
* @type {import('../../internal.js').generateFiles}
|
|
155
155
|
*/
|
|
156
156
|
async function generateFiles({ context, spinner }) {
|
|
157
157
|
const { files } = context;
|
|
@@ -3,7 +3,7 @@ import { withSpinner } from '../with-spinner.js';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* What is your app description?
|
|
6
|
-
* @type {import('../../internal').chooseAppDescription}
|
|
6
|
+
* @type {import('../../internal.js').chooseAppDescription}
|
|
7
7
|
*/
|
|
8
8
|
async function chooseAppDescription(context, prompt) {
|
|
9
9
|
if (!('appDescription' in context)) {
|
|
@@ -22,7 +22,7 @@ async function chooseAppDescription(context, prompt) {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* What package manager do you want to use?
|
|
25
|
-
* @type {import('../../internal').choosePackageManager}
|
|
25
|
+
* @type {import('../../internal.js').choosePackageManager}
|
|
26
26
|
*/
|
|
27
27
|
async function choosePackageManager(context, prompt) {
|
|
28
28
|
const packageManager =
|
|
@@ -56,13 +56,14 @@ async function choosePackageManager(context, prompt) {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Choose your unit test suite and integration test suite
|
|
59
|
-
* @type {import('../../internal').chooseTestPlugins}
|
|
59
|
+
* @type {import('../../internal.js').chooseTestPlugins}
|
|
60
60
|
*/
|
|
61
61
|
async function chooseTestPlugins(context, prompt) {
|
|
62
62
|
const knownTestPlugins = {
|
|
63
63
|
unit: {
|
|
64
64
|
jest: '@gasket/plugin-jest',
|
|
65
|
-
mocha: '@gasket/plugin-mocha'
|
|
65
|
+
mocha: '@gasket/plugin-mocha',
|
|
66
|
+
vitest: '@gasket/plugin-vitest'
|
|
66
67
|
},
|
|
67
68
|
integration: {
|
|
68
69
|
cypress: '@gasket/plugin-cypress'
|
|
@@ -72,19 +73,33 @@ async function chooseTestPlugins(context, prompt) {
|
|
|
72
73
|
const testTypes = ['unit', 'integration'];
|
|
73
74
|
const testPlugins = [];
|
|
74
75
|
|
|
76
|
+
const testPromptOptions = {
|
|
77
|
+
unit: {
|
|
78
|
+
name: 'Vitest',
|
|
79
|
+
plugin: '@gasket/plugin-vitest',
|
|
80
|
+
isDefault: true
|
|
81
|
+
},
|
|
82
|
+
integration: {
|
|
83
|
+
name: 'Cypress',
|
|
84
|
+
plugin: '@gasket/plugin-cypress',
|
|
85
|
+
isDefault: false
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
75
89
|
if (!('testPlugins' in context)) {
|
|
76
90
|
for (const type of testTypes) {
|
|
77
91
|
if (type + 'TestSuite' in context) {
|
|
78
92
|
const testSuite = knownTestPlugins[type][context[type + 'TestSuite']];
|
|
79
93
|
if (testSuite) testPlugins.push(testSuite);
|
|
80
94
|
} else {
|
|
95
|
+
const { name, isDefault, plugin: testPlugin } = testPromptOptions[type];
|
|
81
96
|
const plugin = await promptForTestPlugin(
|
|
82
97
|
prompt,
|
|
83
|
-
`
|
|
84
|
-
|
|
98
|
+
`Do you want to use ${name} for ${type} testing?`,
|
|
99
|
+
isDefault
|
|
85
100
|
);
|
|
86
101
|
|
|
87
|
-
if (plugin) testPlugins.push(
|
|
102
|
+
if (plugin) testPlugins.push(testPlugin);
|
|
88
103
|
}
|
|
89
104
|
}
|
|
90
105
|
|
|
@@ -96,15 +111,15 @@ async function chooseTestPlugins(context, prompt) {
|
|
|
96
111
|
|
|
97
112
|
/**
|
|
98
113
|
*
|
|
99
|
-
* @type {import('../../internal').promptForTestPlugin}
|
|
114
|
+
* @type {import('../../internal.js').promptForTestPlugin}
|
|
100
115
|
*/
|
|
101
|
-
async function promptForTestPlugin(prompt, message,
|
|
116
|
+
async function promptForTestPlugin(prompt, message, isDefault) {
|
|
102
117
|
const { testPlugin } = await prompt([
|
|
103
118
|
{
|
|
104
119
|
name: 'testPlugin',
|
|
105
120
|
message,
|
|
106
|
-
type: '
|
|
107
|
-
|
|
121
|
+
type: 'confirm',
|
|
122
|
+
default: isDefault
|
|
108
123
|
}
|
|
109
124
|
]);
|
|
110
125
|
|
|
@@ -114,7 +129,7 @@ async function promptForTestPlugin(prompt, message, choices) {
|
|
|
114
129
|
/**
|
|
115
130
|
* Given that gasket is creating in an already existing directory, it should
|
|
116
131
|
* confirm with the user that it's intentionally overwriting that directory
|
|
117
|
-
* @type {import('../../internal').allowExtantOverwriting}
|
|
132
|
+
* @type {import('../../internal.js').allowExtantOverwriting}
|
|
118
133
|
*/
|
|
119
134
|
async function allowExtantOverwriting(context, prompt) {
|
|
120
135
|
const { dest, extant } = context;
|
|
@@ -141,7 +156,7 @@ export const questions = [
|
|
|
141
156
|
|
|
142
157
|
/**
|
|
143
158
|
* Fire off prompts for user input
|
|
144
|
-
* @type {import('../../internal').globalPrompts}
|
|
159
|
+
* @type {import('../../internal.js').globalPrompts}
|
|
145
160
|
*/
|
|
146
161
|
async function globalPrompts({ context }) {
|
|
147
162
|
const prompt = context.prompts ? inquirer.createPromptModule() : () => ({});
|
|
@@ -2,7 +2,7 @@ import { withSpinner } from '../with-spinner.js';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Installs node_modules using the selected package manager
|
|
5
|
-
* @type {import('../../internal').installModules}
|
|
5
|
+
* @type {import('../../internal.js').installModules}
|
|
6
6
|
*/
|
|
7
7
|
async function installModules({ context }) {
|
|
8
8
|
const { pkgManager } = context;
|
|
@@ -2,7 +2,7 @@ import { withSpinner } from '../with-spinner.js';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Links local packages using the selected package manager
|
|
5
|
-
* @type {import('../../internal').linkModules}
|
|
5
|
+
* @type {import('../../internal.js').linkModules}
|
|
6
6
|
*/
|
|
7
7
|
async function linkModules({ context, spinner }) {
|
|
8
8
|
const { pkgLinks, pkgManager } = context;
|
|
@@ -9,7 +9,7 @@ const hasVersionOrTag = /@([\^~]?\d+\.\d+\.\d+(?:-[\d\w.-]+)?|[\^~]?\d+\.\d+\.\d
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* loadPresets - Load presets to temp directory
|
|
12
|
-
* @type {import('../../internal').loadPresets}
|
|
12
|
+
* @type {import('../../internal.js').loadPresets}
|
|
13
13
|
*/
|
|
14
14
|
async function loadPresets({ context }) {
|
|
15
15
|
const tmpDir = await mkdtemp(path.join(os.tmpdir(), `gasket-create-${context.appName}`));
|
|
@@ -5,7 +5,7 @@ import { withSpinner } from '../with-spinner.js';
|
|
|
5
5
|
* Validates this instance can execute without common blockers:
|
|
6
6
|
* - Target destination on disk is available. Validate by acquiring
|
|
7
7
|
* a lock through `mkdir`.
|
|
8
|
-
* @type {import('../../internal').mkDir}
|
|
8
|
+
* @type {import('../../internal.js').mkDir}
|
|
9
9
|
*/
|
|
10
10
|
async function mkDir({ context, spinner }) {
|
|
11
11
|
const { dest, relDest, extant, destOverride } = context;
|
|
@@ -3,7 +3,7 @@ import { runShellCommand } from '@gasket/utils';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Executes the `postCreate` hook for all registered plugins.
|
|
6
|
-
* @type {import('../../internal').postCreateHooks}
|
|
6
|
+
* @type {import('../../internal.js').postCreateHooks}
|
|
7
7
|
*/
|
|
8
8
|
async function postCreateHooks({ gasket, context }) {
|
|
9
9
|
const { dest, packageManager } = context;
|
|
@@ -2,7 +2,7 @@ import { withGasketSpinner } from '../with-spinner.js';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* presetConfigHooks - exec `presetConfig` hook
|
|
5
|
-
* @type {import('../../internal').presetConfigHooks}
|
|
5
|
+
* @type {import('../../internal.js').presetConfigHooks}
|
|
6
6
|
*/
|
|
7
7
|
async function presetConfigHooks({ gasket, context }) {
|
|
8
8
|
const config = await gasket.execWaterfall('presetConfig', context);
|
|
@@ -3,7 +3,7 @@ import { withGasketSpinner } from '../with-spinner.js';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* presetPromptHooks - exec `presetPrompt` hook
|
|
6
|
-
* @type {import('../../internal').presetPromptHooks}
|
|
6
|
+
* @type {import('../../internal.js').presetPromptHooks}
|
|
7
7
|
*/
|
|
8
8
|
async function presetPromptHooks({ gasket, context }) {
|
|
9
9
|
const prompt = context.prompts ? inquirer.createPromptModule() : () => ({});
|
|
@@ -24,7 +24,7 @@ const toSpaceCase = str => str.replace(/([A-Z])/g, ' $1')
|
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Builds the report object from context
|
|
27
|
-
* @type {import('../../internal').buildReport}
|
|
27
|
+
* @type {import('../../internal.js').buildReport}
|
|
28
28
|
* @private
|
|
29
29
|
*/
|
|
30
30
|
function buildReport(context) {
|
|
@@ -53,7 +53,7 @@ function buildReport(context) {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Outputs create command details to the console
|
|
56
|
-
* @type {import('../../internal').printReport}
|
|
56
|
+
* @type {import('../../internal.js').printReport}
|
|
57
57
|
*/
|
|
58
58
|
async function printReport({ context }) {
|
|
59
59
|
const report = buildReport(context);
|
|
@@ -4,7 +4,7 @@ import { withGasketSpinner } from '../with-spinner.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Initializes engine with provide preset and plugins
|
|
6
6
|
* to execute their prompt lifecycle hooks.
|
|
7
|
-
* @type {import('../../internal').execPluginPrompts}
|
|
7
|
+
* @type {import('../../internal.js').execPluginPrompts}
|
|
8
8
|
*/
|
|
9
9
|
async function execPluginPrompts(gasket, context) {
|
|
10
10
|
//
|
|
@@ -21,7 +21,7 @@ async function execPluginPrompts(gasket, context) {
|
|
|
21
21
|
/**
|
|
22
22
|
* Executes the `prompt` hook for all registered plugins.
|
|
23
23
|
* Adds `prompt` util function for prompting features.
|
|
24
|
-
* @type {import('../../internal').promptHooks}
|
|
24
|
+
* @type {import('../../internal.js').promptHooks}
|
|
25
25
|
*/
|
|
26
26
|
async function promptHooks({ gasket, context }) {
|
|
27
27
|
//
|
|
@@ -7,7 +7,7 @@ const { dependencies } = require('../../../package.json');
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Initializes the ConfigBuilder builder and adds to context.
|
|
10
|
-
* @type {import('../../internal').setupPkg}
|
|
10
|
+
* @type {import('../../internal.js').setupPkg}
|
|
11
11
|
*/
|
|
12
12
|
async function setupPkg({ context }) {
|
|
13
13
|
const { appName, appDescription, warnings } = context;
|
|
@@ -5,7 +5,7 @@ import { withSpinner } from '../with-spinner.js';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* writePluginImports - Write string imports as value(s)
|
|
8
|
-
* @type {import('../../internal').writePluginImports}
|
|
8
|
+
* @type {import('../../internal.js').writePluginImports}
|
|
9
9
|
*/
|
|
10
10
|
function writePluginImports(plugins) {
|
|
11
11
|
return plugins.reduce((acc, cur, index) => {
|
|
@@ -16,7 +16,7 @@ function writePluginImports(plugins) {
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* writeImports - Write imports to file using key value pairs
|
|
19
|
-
* @type {import('../../internal').writeImports}
|
|
19
|
+
* @type {import('../../internal.js').writeImports}
|
|
20
20
|
*/
|
|
21
21
|
function writeImports(imports) {
|
|
22
22
|
if (!imports) return '';
|
|
@@ -25,7 +25,7 @@ function writeImports(imports) {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* createInjectionAssignments - replace object path with a temp string value
|
|
28
|
-
* @type {import('../../internal').createInjectionAssignments}
|
|
28
|
+
* @type {import('../../internal.js').createInjectionAssignments}
|
|
29
29
|
*/
|
|
30
30
|
function createInjectionAssignments(config, assignments) {
|
|
31
31
|
if (!assignments) return '';
|
|
@@ -44,7 +44,7 @@ function createInjectionAssignments(config, assignments) {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* replaceInjectionAssignments - replace temp string value with actual value
|
|
47
|
-
* @type {import('../../internal').replaceInjectionAssignments}
|
|
47
|
+
* @type {import('../../internal.js').replaceInjectionAssignments}
|
|
48
48
|
*/
|
|
49
49
|
function replaceInjectionAssignments(content, assignments) {
|
|
50
50
|
if (!assignments) return content;
|
|
@@ -57,7 +57,7 @@ function replaceInjectionAssignments(content, assignments) {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* writeExpressions - Write expressions to file
|
|
60
|
-
* @type {import('../../internal').writeExpressions}
|
|
60
|
+
* @type {import('../../internal.js').writeExpressions}
|
|
61
61
|
*/
|
|
62
62
|
function writeExpressions(expressions) {
|
|
63
63
|
if (!expressions) return '';
|
|
@@ -66,7 +66,7 @@ function writeExpressions(expressions) {
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* cleanupFields - Remove fields from config object
|
|
69
|
-
* @type {import('../../internal').cleanupFields}
|
|
69
|
+
* @type {import('../../internal.js').cleanupFields}
|
|
70
70
|
*/
|
|
71
71
|
function cleanupFields(config) {
|
|
72
72
|
delete config.fields.imports;
|
|
@@ -77,7 +77,7 @@ function cleanupFields(config) {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Writes the contents of `pkg` to the app's package.json.
|
|
80
|
-
* @type {import('../../internal').writeGasketConfig}
|
|
80
|
+
* @type {import('../../internal.js').writeGasketConfig}
|
|
81
81
|
*/
|
|
82
82
|
async function writeGasketConfig({ context }) {
|
|
83
83
|
const { dest, gasketConfig, generatedFiles, typescript } = context;
|
|
@@ -4,7 +4,7 @@ import { withSpinner } from '../with-spinner.js';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Writes the contents of `pkg` to the app's package.json.
|
|
7
|
-
* @type {import('../../internal').writePkg}
|
|
7
|
+
* @type {import('../../internal.js').writePkg}
|
|
8
8
|
*/
|
|
9
9
|
async function writePkg({ context }) {
|
|
10
10
|
const { dest, pkg, generatedFiles } = context;
|
|
@@ -52,7 +52,7 @@ function isValidVersion(v) {
|
|
|
52
52
|
/**
|
|
53
53
|
* ConfigBuilder is an extensible data structure for **specifically**
|
|
54
54
|
* managing `package.json` data.
|
|
55
|
-
* @type {import('../index').ConfigBuilder}
|
|
55
|
+
* @type {import('../index.js').ConfigBuilder}
|
|
56
56
|
*/
|
|
57
57
|
export class ConfigBuilder {
|
|
58
58
|
/**
|
|
@@ -7,7 +7,7 @@ import { readConfig } from '../scaffold/utils.js';
|
|
|
7
7
|
* The CreateRuntime represents a shallow proxy to a CreateContext
|
|
8
8
|
* that automatically adds transactional information for providing
|
|
9
9
|
* CLI users with blame information in the event of conflicts.
|
|
10
|
-
* @type {import('../internal').makeCreateRuntime}
|
|
10
|
+
* @type {import('../internal.js').makeCreateRuntime}
|
|
11
11
|
*/
|
|
12
12
|
function makeCreateRuntime(context, source) {
|
|
13
13
|
//
|
|
@@ -38,6 +38,7 @@ function makeCreateRuntime(context, source) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
// @ts-ignore - Proxy for CreateContext
|
|
41
42
|
return new Proxy(context, {
|
|
42
43
|
get(obj, key) {
|
|
43
44
|
if (overrides[key]) return overrides[key];
|
|
@@ -62,11 +63,12 @@ export class CreateContext {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
runWith(plugin) {
|
|
66
|
+
// @ts-ignore - partial context at this point
|
|
65
67
|
return makeCreateRuntime(this, plugin);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
/** @type {import('../internal').makeCreateContext} */
|
|
71
|
+
/** @type {import('../internal.js').makeCreateContext} */
|
|
70
72
|
export function makeCreateContext(argv = [], options = {}) {
|
|
71
73
|
const appName = argv[0] || 'templated-app';
|
|
72
74
|
const {
|
|
@@ -92,8 +94,9 @@ export function makeCreateContext(argv = [], options = {}) {
|
|
|
92
94
|
|
|
93
95
|
/**
|
|
94
96
|
* Input context which will be appended by prompts and passed to create hooks
|
|
95
|
-
* @type {import('../
|
|
97
|
+
* @type {import('../index.js').CreateContext}
|
|
96
98
|
*/
|
|
99
|
+
// @ts-ignore - some properties not defined in constructor will be added later
|
|
97
100
|
const context = new CreateContext({
|
|
98
101
|
destOverride: true,
|
|
99
102
|
cwd,
|
|
@@ -4,7 +4,7 @@ import { writeFile } from 'fs/promises';
|
|
|
4
4
|
/**
|
|
5
5
|
* If an error occurs during create, dump the context for debugging.
|
|
6
6
|
* The error which cause the exit is also included in the log.
|
|
7
|
-
* @type {import('../internal').dumpErrorContext}
|
|
7
|
+
* @type {import('../internal.js').dumpErrorContext}
|
|
8
8
|
*/
|
|
9
9
|
export async function dumpErrorContext(context, error) {
|
|
10
10
|
const { cwd } = context;
|
package/lib/scaffold/files.js
CHANGED
package/lib/scaffold/readme.js
CHANGED
package/lib/scaffold/utils.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
/** @type {import('../internal').readConfig} */
|
|
5
|
+
/** @type {import('../internal.js').readConfig} */
|
|
6
6
|
export function readConfig(context, { config, configFile }) {
|
|
7
7
|
if (config) {
|
|
8
8
|
const parsedConfig = JSON.parse(config);
|
|
@@ -2,10 +2,10 @@ import ora from 'ora';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Base function to handle spinner logic
|
|
5
|
-
* @type {import('../internal').wrapWithSpinner}
|
|
5
|
+
* @type {import('../internal.js').wrapWithSpinner}
|
|
6
6
|
*/
|
|
7
7
|
function wrapWithSpinner(label, task, { startSpinner = true } = {}) {
|
|
8
|
-
/** @type {import('../internal').execute} */
|
|
8
|
+
/** @type {import('../internal.js').execute} */
|
|
9
9
|
async function execute(context) {
|
|
10
10
|
const spinner = ora(label);
|
|
11
11
|
if (startSpinner) spinner.start();
|
|
@@ -27,7 +27,7 @@ function wrapWithSpinner(label, task, { startSpinner = true } = {}) {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Wrap a task with a spinner, including gasket and context.
|
|
30
|
-
* @type {import('../internal').withGasketSpinner}
|
|
30
|
+
* @type {import('../internal.js').withGasketSpinner}
|
|
31
31
|
*/
|
|
32
32
|
export function withGasketSpinner(label, task, options) {
|
|
33
33
|
return wrapWithSpinner(label, ({ gasket, context, spinner }) =>
|
|
@@ -38,7 +38,7 @@ export function withGasketSpinner(label, task, options) {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Wrap a task with a spinner, using only context.
|
|
41
|
-
* @type {import('../internal').withSpinner}
|
|
41
|
+
* @type {import('../internal.js').withSpinner}
|
|
42
42
|
*/
|
|
43
43
|
export function withSpinner(label, task, options) {
|
|
44
44
|
return wrapWithSpinner(label, ({ context, spinner }) =>
|
|
@@ -2,7 +2,7 @@ import { Option } from 'commander';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* createOption - Create a commander option
|
|
5
|
-
* @type {import('../internal').createOption}
|
|
5
|
+
* @type {import('../internal.js').createOption}
|
|
6
6
|
*/
|
|
7
7
|
export function createOption(definition) {
|
|
8
8
|
const option = new Option(...definition.options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* isValidArg - Validates the argument configuration
|
|
3
|
-
* @type {import('../internal').isValidArg}
|
|
3
|
+
* @type {import('../internal.js').isValidArg}
|
|
4
4
|
*/
|
|
5
5
|
function isValidArg(arg) {
|
|
6
6
|
const keys = Object.keys(arg);
|
|
@@ -12,7 +12,7 @@ function isValidArg(arg) {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* processArgs - Process the arguments configuration
|
|
15
|
-
* @type {import('../internal').processArgs}
|
|
15
|
+
* @type {import('../internal.js').processArgs}
|
|
16
16
|
*/
|
|
17
17
|
export function processArgs(args) {
|
|
18
18
|
if (!Array.isArray(args) || !args.every(isValidArg)) throw new Error('Invalid argument(s) configuration');
|
|
@@ -6,7 +6,7 @@ const program = new Command();
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* isValidCommand - Validates the command configuration
|
|
9
|
-
* @type {import('../internal').isValidCommand}
|
|
9
|
+
* @type {import('../internal.js').isValidCommand}
|
|
10
10
|
*/
|
|
11
11
|
function isValidCommand(command) {
|
|
12
12
|
const keys = Object.keys(command);
|
|
@@ -21,7 +21,7 @@ function isValidCommand(command) {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* processCommand - Process the command configuration
|
|
24
|
-
* @type {import('../internal').processCommand}
|
|
24
|
+
* @type {import('../internal.js').processCommand}
|
|
25
25
|
*/
|
|
26
26
|
export function processCommand(command) {
|
|
27
27
|
if (!isValidCommand(command)) throw new Error('Invalid command configuration');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* isValidOption - Validate the option
|
|
3
|
-
* @type {import('../internal').isValidOption}
|
|
3
|
+
* @type {import('../internal.js').isValidOption}
|
|
4
4
|
*/
|
|
5
5
|
function isValidOption(option) {
|
|
6
6
|
const keys = Object.keys(option);
|
|
@@ -12,7 +12,7 @@ function isValidOption(option) {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* processOptions - Process the options configuration
|
|
15
|
-
* @type {import('../internal').processOptions}
|
|
15
|
+
* @type {import('../internal.js').processOptions}
|
|
16
16
|
*/
|
|
17
17
|
export function processOptions(options) {
|
|
18
18
|
if (!Array.isArray(options) || !options.every(isValidOption)) throw new Error('Invalid option(s) configuration');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-gasket-app",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "starter pack for creating a gasket app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"mkdirp": "^1.0.4",
|
|
32
32
|
"ora": "^3.4.0",
|
|
33
33
|
"semver": "^7.7.1",
|
|
34
|
-
"@gasket/core": "7.
|
|
35
|
-
"@gasket/plugin-command": "7.
|
|
36
|
-
"@gasket/plugin-docs": "7.
|
|
34
|
+
"@gasket/core": "7.5.0",
|
|
35
|
+
"@gasket/plugin-command": "7.4.0",
|
|
36
|
+
"@gasket/plugin-docs": "7.4.0",
|
|
37
37
|
"@gasket/plugin-docusaurus": "7.4.2",
|
|
38
38
|
"@gasket/plugin-dynamic-plugins": "7.3.7",
|
|
39
|
-
"@gasket/plugin-git": "7.
|
|
39
|
+
"@gasket/plugin-git": "7.4.0",
|
|
40
40
|
"@gasket/plugin-logger": "7.3.4",
|
|
41
|
-
"@gasket/plugin-metadata": "7.
|
|
42
|
-
"@gasket/request": "7.
|
|
43
|
-
"@gasket/utils": "7.
|
|
41
|
+
"@gasket/plugin-metadata": "7.4.0",
|
|
42
|
+
"@gasket/request": "7.4.0",
|
|
43
|
+
"@gasket/utils": "7.4.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^29.7.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
57
57
|
"jest": "^29.7.0",
|
|
58
58
|
"typescript": "^5.8.2",
|
|
59
|
-
"@gasket/request": "7.
|
|
59
|
+
"@gasket/request": "7.4.0"
|
|
60
60
|
},
|
|
61
61
|
"eslintConfig": {
|
|
62
62
|
"extends": [
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"scripts": {
|
|
95
95
|
"lint": "eslint .",
|
|
96
96
|
"lint:fix": "pnpm run lint --fix",
|
|
97
|
-
"posttest": "pnpm run lint",
|
|
97
|
+
"posttest": "pnpm run lint && pnpm run typecheck",
|
|
98
98
|
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
|
|
99
99
|
"test:coverage": "jest --coverage",
|
|
100
100
|
"test:watch": "pnpm run test --watch",
|