create-gasket-app 7.4.19 → 7.4.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.
package/EXAMPLES.md CHANGED
@@ -10,20 +10,11 @@ The main interface for `create-gasket-app` is the command line:
10
10
  # Basic app creation
11
11
  npx create-gasket-app@latest my-app
12
12
 
13
- # With presets
14
- npx create-gasket-app@latest my-app --presets @gasket/preset-nextjs
15
-
16
- # With package manager selection
17
- npx create-gasket-app@latest my-app --package-manager pnpm
18
-
19
- # With configuration
20
- npx create-gasket-app@latest my-app --config '{"typescript": true}'
13
+ # With template (recommended)
14
+ npx create-gasket-app@latest my-app --template @gasket/template-nextjs-pages
21
15
 
22
- # With config file
23
- npx create-gasket-app@latest my-app --config-file ./create-config.json
24
-
25
- # Skip prompts (for CI)
26
- npx create-gasket-app@latest my-app --presets @gasket/preset-nextjs --no-prompts
16
+ # With presets (deprecated; prefer --template)
17
+ npx create-gasket-app@latest my-app --presets @gasket/preset-nextjs
27
18
  ```
28
19
 
29
20
  ## Templates
package/README.md CHANGED
@@ -40,7 +40,7 @@ Arguments:
40
40
  appname Name of the Gasket application to create
41
41
 
42
42
  Options:
43
- -p, --presets [presets] Initial Gasket preset(s) to use.
43
+ -p, --presets [presets] (Deprecated.) Initial Gasket preset(s). Prefer --template.
44
44
  Can be set as short name with version (e.g. --presets nextjs@^1.0.0)
45
45
  Or other (multiple) custom presets (e.g. --presets my-gasket-preset@1.0.0.beta-1,nextjs@^1.0.0)
46
46
  --template [template] Selects which template you would like to use during
@@ -24,6 +24,7 @@ import linkModules from '../scaffold/actions/link-modules.js';
24
24
  import postCreateHooks from '../scaffold/actions/post-create-hooks.js';
25
25
  import printReport from '../scaffold/actions/print-report.js';
26
26
  import gitInit from '../scaffold/actions/git-init.js';
27
+ import { warnPresetDeprecated } from '../utils/warn-preset-deprecated.js';
27
28
 
28
29
  /**
29
30
  * Parses comma separated option input to array
@@ -112,10 +113,14 @@ const createCommand = {
112
113
  * @returns {import('../internal.js').PartialCreateContext} Validated context
113
114
  */
114
115
  function validateOptions(context) {
115
- const hasOption = (context) => Boolean(context.template || context.templatePath || context.rawPresets.length || context.localPresets.length);
116
+ const hasOption = (ctx) =>
117
+ Boolean(ctx.template || ctx.templatePath || ctx.rawPresets?.length || ctx.localPresets?.length);
116
118
 
117
119
  if (!hasOption(context)) {
118
- console.warn('Warning: At least one of the options is required: --template, --template-path, --presets, --preset-path');
120
+ console.warn(
121
+ 'Warning: At least one option is required: --template (preferred), --template-path, ' +
122
+ '--presets (deprecated), or --preset-path (deprecated).'
123
+ );
119
124
  process.exit(1);
120
125
  }
121
126
 
@@ -196,6 +201,7 @@ createCommand.action = async function run(appname, options, command) {
196
201
  process.env.GASKET_ENV = 'create';
197
202
  const context = makeCreateContext([appname], options);
198
203
  validateOptions(context);
204
+ warnPresetDeprecated(context);
199
205
 
200
206
  try {
201
207
  await handleCreate(context);
@@ -0,0 +1,55 @@
1
+ import chalk from 'chalk';
2
+
3
+ const PRESET_TO_TEMPLATES = {
4
+ nextjs: ['@gasket/template-nextjs-pages', '@gasket/template-nextjs-express', '@gasket/template-nextjs-app'],
5
+ api: ['@gasket/template-api-express', '@gasket/template-api-fastify']
6
+ };
7
+
8
+ /**
9
+ * Derive template suggestions from raw preset names (e.g. nextjs, @gasket/preset-nextjs).
10
+ * @param {string[]} rawPresets - Raw preset specifiers from CLI (e.g. nextjs@^1.0.0).
11
+ * @returns {string[]} template package names to suggest
12
+ */
13
+ function suggestTemplates(rawPresets) {
14
+ const seen = new Set();
15
+ const suggestions = [];
16
+ for (const raw of rawPresets) {
17
+ const name = raw.replace(/@[\^~]?[\d.]*(-.*)?$/, '').trim().toLowerCase();
18
+ let base = null;
19
+ if (name.includes('nextjs')) base = 'nextjs';
20
+ else if (name.includes('api')) base = 'api';
21
+ if (base && PRESET_TO_TEMPLATES[base]) {
22
+ for (const t of PRESET_TO_TEMPLATES[base]) {
23
+ if (!seen.has(t)) {
24
+ seen.add(t);
25
+ suggestions.push(t);
26
+ }
27
+ }
28
+ }
29
+ }
30
+ return suggestions;
31
+ }
32
+
33
+ /**
34
+ * Print deprecation warning when user passes --presets or --preset-path.
35
+ * @param {import('../internal.js').PartialCreateContext} context - Create context with rawPresets/localPresets.
36
+ */
37
+ export function warnPresetDeprecated(context) {
38
+ if (!context.rawPresets?.length && !context.localPresets?.length) return;
39
+
40
+ const suggestions = suggestTemplates(context.rawPresets || []);
41
+ const lines = [
42
+ chalk.yellow.bold('*** Presets are deprecated. Use templates instead. ***'),
43
+ '',
44
+ ' Presets (--presets / --preset-path) will be removed in a future version.',
45
+ ' Templates provide a complete app and are the recommended way to create Gasket apps.',
46
+ ''
47
+ ];
48
+ if (suggestions.length) {
49
+ lines.push(' Suggested templates:');
50
+ suggestions.forEach(t => lines.push(` --template ${t}`));
51
+ lines.push('');
52
+ }
53
+ lines.push(' See: https://gasket.dev/docs/create-gasket-app/#templates');
54
+ console.warn(lines.join('\n'));
55
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gasket-app",
3
- "version": "7.4.19",
3
+ "version": "7.4.21",
4
4
  "description": "starter pack for creating a gasket app",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,23 +25,23 @@
25
25
  "commander": "^12.1.0",
26
26
  "deepmerge": "^4.3.1",
27
27
  "diagnostics": "^2.0.2",
28
- "glob": "^13.0.0",
28
+ "glob": "^13.0.1",
29
29
  "handlebars": "^4.7.8",
30
30
  "inquirer": "^6.5.2",
31
31
  "json5": "^2.2.3",
32
32
  "mkdirp": "^1.0.4",
33
33
  "ora": "^3.4.0",
34
34
  "semver": "^7.7.1",
35
- "@gasket/core": "^7.7.3",
36
- "@gasket/plugin-command": "^7.6.4",
37
- "@gasket/plugin-docs": "^7.5.4",
38
- "@gasket/plugin-docusaurus": "^7.5.1",
39
- "@gasket/plugin-dynamic-plugins": "^7.5.1",
40
- "@gasket/plugin-git": "^7.4.9",
35
+ "@gasket/core": "^7.7.4",
36
+ "@gasket/plugin-command": "^7.6.5",
37
+ "@gasket/plugin-docs": "^7.5.5",
38
+ "@gasket/plugin-docusaurus": "^7.5.2",
39
+ "@gasket/plugin-dynamic-plugins": "^7.5.2",
40
+ "@gasket/plugin-git": "^7.4.10",
41
41
  "@gasket/plugin-logger": "^7.4.0",
42
- "@gasket/plugin-metadata": "^7.5.9",
42
+ "@gasket/plugin-metadata": "^7.5.10",
43
43
  "@gasket/request": "^7.5.5",
44
- "@gasket/utils": "^7.6.5"
44
+ "@gasket/utils": "^7.6.6"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@typescript-eslint/parser": "^8.38.0",