create-gasket-app 7.3.11 → 7.3.12

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.
@@ -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
@@ -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,7 +56,7 @@ 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 = {
@@ -96,7 +96,7 @@ async function chooseTestPlugins(context, prompt) {
96
96
 
97
97
  /**
98
98
  *
99
- * @type {import('../../internal').promptForTestPlugin}
99
+ * @type {import('../../internal.js').promptForTestPlugin}
100
100
  */
101
101
  async function promptForTestPlugin(prompt, message, choices) {
102
102
  const { testPlugin } = await prompt([
@@ -114,7 +114,7 @@ async function promptForTestPlugin(prompt, message, choices) {
114
114
  /**
115
115
  * Given that gasket is creating in an already existing directory, it should
116
116
  * confirm with the user that it's intentionally overwriting that directory
117
- * @type {import('../../internal').allowExtantOverwriting}
117
+ * @type {import('../../internal.js').allowExtantOverwriting}
118
118
  */
119
119
  async function allowExtantOverwriting(context, prompt) {
120
120
  const { dest, extant } = context;
@@ -141,7 +141,7 @@ export const questions = [
141
141
 
142
142
  /**
143
143
  * Fire off prompts for user input
144
- * @type {import('../../internal').globalPrompts}
144
+ * @type {import('../../internal.js').globalPrompts}
145
145
  */
146
146
  async function globalPrompts({ context }) {
147
147
  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('../internal').PartialCreateContext}
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;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Utility for plugins to add files and templates for generating
3
- * @type {import('../index').Files}
3
+ * @type {import('../index.js').Files}
4
4
  */
5
5
  export class Files {
6
6
  constructor() {
@@ -1,6 +1,6 @@
1
1
  import { readFile } from 'fs/promises';
2
2
 
3
- /** @type {import('../index').Readme} */
3
+ /** @type {import('../index.js').Readme} */
4
4
  export default class Readme {
5
5
  constructor() {
6
6
  this.markdown = [];
@@ -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.11",
3
+ "version": "7.3.12",
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.4.1",
35
- "@gasket/plugin-command": "7.3.8",
36
- "@gasket/plugin-docs": "7.3.8",
34
+ "@gasket/core": "7.4.2",
35
+ "@gasket/plugin-command": "7.3.9",
36
+ "@gasket/plugin-docs": "7.3.9",
37
37
  "@gasket/plugin-docusaurus": "7.4.2",
38
38
  "@gasket/plugin-dynamic-plugins": "7.3.7",
39
- "@gasket/plugin-git": "7.3.4",
39
+ "@gasket/plugin-git": "7.3.5",
40
40
  "@gasket/plugin-logger": "7.3.4",
41
- "@gasket/plugin-metadata": "7.3.11",
42
- "@gasket/request": "7.3.5",
43
- "@gasket/utils": "7.3.4"
41
+ "@gasket/plugin-metadata": "7.3.12",
42
+ "@gasket/request": "7.3.6",
43
+ "@gasket/utils": "7.3.5"
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.3.5"
59
+ "@gasket/request": "7.3.6"
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",