create-gasket-app 7.4.1 → 7.4.3
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.
|
@@ -7,6 +7,24 @@ import { createRequire } from 'module';
|
|
|
7
7
|
const require = createRequire(import.meta.url);
|
|
8
8
|
const hasVersionOrTag = /@([\^~]?\d+\.\d+\.\d+(?:-[\d\w.-]+)?|[\^~]?\d+\.\d+\.\d+|[a-zA-Z]+|file:.+)$/;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* validatePresetName - Validate the preset name
|
|
12
|
+
* @param {string} preset - The preset name
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
function validatePresetName(preset) {
|
|
16
|
+
const isNotShortName = preset.includes('/gasket-preset-') || preset.includes('@gasket/preset-');
|
|
17
|
+
const isMispelled = preset.endsWith('-preset');
|
|
18
|
+
|
|
19
|
+
if (isMispelled) {
|
|
20
|
+
throw new Error(`Invalid preset name: ${preset}. Please check the name and try again.`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!isNotShortName) {
|
|
24
|
+
throw new Error(`Invalid preset short name: ${preset}. Presets must be a full name.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
10
28
|
/**
|
|
11
29
|
* loadPresets - Load presets to temp directory
|
|
12
30
|
* @type {import('../../internal.js').loadPresets}
|
|
@@ -23,6 +41,7 @@ async function loadPresets({ context }) {
|
|
|
23
41
|
const pkgVerb = pkgManager.manager === 'npm' ? 'install' : 'add';
|
|
24
42
|
|
|
25
43
|
const remotePresets = context.rawPresets.map(async preset => {
|
|
44
|
+
validatePresetName(preset);
|
|
26
45
|
const parts = hasVersionOrTag.test(preset) && preset.split('@').filter(Boolean);
|
|
27
46
|
const name = parts ? `@${parts[0]}` : preset;
|
|
28
47
|
const version = parts ? `@${parts[1]}` : '@latest';
|
|
@@ -39,12 +58,16 @@ async function loadPresets({ context }) {
|
|
|
39
58
|
const mod = await import(`${modPath}/${name}/${entryPath}`);
|
|
40
59
|
return mod.default?.default || mod.default || mod;
|
|
41
60
|
} catch (err) {
|
|
42
|
-
|
|
61
|
+
const errorMessage = err.stderr || err.message;
|
|
62
|
+
if (err.stderr && err.stderr.includes('is not in this registry')) {
|
|
63
|
+
throw new Error(`Preset not found in registry: ${name}${version}. Use npm_config_registry=<registry> to use privately scoped presets.`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
throw new Error(`Failed to install preset ${name}${version}: ${errorMessage}`);
|
|
43
67
|
}
|
|
44
68
|
});
|
|
45
69
|
|
|
46
70
|
const localPresets = context.localPresets.map(async localPresetPath => {
|
|
47
|
-
|
|
48
71
|
try {
|
|
49
72
|
await pkgManager.exec(pkgVerb, [localPresetPath]);
|
|
50
73
|
const pkgFile = require(path.join(localPresetPath, 'package.json'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-gasket-app",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.3",
|
|
4
4
|
"description": "starter pack for creating a gasket app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"semver": "^7.7.1",
|
|
34
34
|
"@gasket/core": "7.5.0",
|
|
35
35
|
"@gasket/plugin-command": "7.4.0",
|
|
36
|
-
"@gasket/plugin-docs": "7.4.0",
|
|
37
36
|
"@gasket/plugin-docusaurus": "7.4.2",
|
|
38
37
|
"@gasket/plugin-dynamic-plugins": "7.3.7",
|
|
39
38
|
"@gasket/plugin-git": "7.4.0",
|
|
40
39
|
"@gasket/plugin-logger": "7.3.4",
|
|
41
|
-
"@gasket/plugin-metadata": "7.4.
|
|
40
|
+
"@gasket/plugin-metadata": "7.4.2",
|
|
42
41
|
"@gasket/request": "7.4.0",
|
|
43
|
-
"@gasket/utils": "7.4.0"
|
|
42
|
+
"@gasket/utils": "7.4.0",
|
|
43
|
+
"@gasket/plugin-docs": "7.4.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^29.7.0",
|