@shopify/cli-hydrogen 11.1.9 → 11.1.11
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/dist/assets/hydrogen/starter/CHANGELOG.md +28 -0
- package/dist/assets/hydrogen/starter/app/components/Aside.tsx +4 -2
- package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +6 -3
- package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +117 -23
- package/dist/assets/hydrogen/starter/app/components/Header.tsx +3 -3
- package/dist/assets/hydrogen/starter/app/components/MockShopNotice.tsx +20 -0
- package/dist/assets/hydrogen/starter/app/entry.client.tsx +2 -3
- package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +14 -53
- package/dist/assets/hydrogen/starter/app/routes/_index.tsx +15 -9
- package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +13 -13
- package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/account.tsx +4 -7
- package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle._index.tsx +2 -9
- package/dist/assets/hydrogen/starter/app/routes/blogs._index.tsx +1 -4
- package/dist/assets/hydrogen/starter/app/routes/cart.tsx +1 -5
- package/dist/assets/hydrogen/starter/app/routes/collections.all.tsx +1 -3
- package/dist/assets/hydrogen/starter/app/routes/pages.$handle.tsx +2 -8
- package/dist/assets/hydrogen/starter/app/routes/policies.$handle.tsx +1 -4
- package/dist/assets/hydrogen/starter/app/routes/policies._index.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/products.$handle.tsx +2 -9
- package/dist/assets/hydrogen/starter/app/routes/search.tsx +18 -12
- package/dist/assets/hydrogen/starter/app/styles/app.css +51 -0
- package/dist/assets/hydrogen/starter/guides/predictiveSearch/predictiveSearch.md +3 -3
- package/dist/assets/hydrogen/starter/guides/search/search.md +1 -1
- package/dist/assets/hydrogen/starter/package.json +10 -10
- package/dist/assets/hydrogen/starter/vite.config.ts +1 -1
- package/dist/assets/hydrogen/vite/vite.config.js +1 -1
- package/dist/commands/hydrogen/dev.js +0 -4
- package/dist/commands/hydrogen/init.d.ts +2 -4
- package/dist/commands/hydrogen/init.js +2 -8
- package/dist/commands/hydrogen/preview.js +1 -1
- package/dist/commands/hydrogen/setup/css.js +1 -1
- package/dist/commands/hydrogen/setup/vite.js +1 -1
- package/dist/commands/hydrogen/setup.js +31 -33
- package/dist/commands/hydrogen/upgrade.js +7 -0
- package/dist/lib/build.js +4 -5
- package/dist/lib/codegen.js +2 -2
- package/dist/lib/format-code.js +3 -3
- package/dist/lib/mini-oxygen/workerd.js +3 -5
- package/dist/lib/onboarding/common.js +21 -26
- package/dist/lib/onboarding/local.js +46 -59
- package/dist/lib/template-pack.js +84 -0
- package/oclif.manifest.json +2 -9
- package/package.json +18 -15
- package/dist/lib/react-router-version-check.js +0 -82
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { resolvePath, dirname } from '@shopify/cli-kit/node/path';
|
|
3
|
-
import {
|
|
3
|
+
import { createFileReadStream, readFile } from '@shopify/cli-kit/node/fs';
|
|
4
4
|
import { renderSuccess } from '@shopify/cli-kit/node/ui';
|
|
5
5
|
import { outputNewline } from '@shopify/cli-kit/node/output';
|
|
6
6
|
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
7
7
|
import colors from '@shopify/cli-kit/node/colors';
|
|
8
8
|
import { handleMiniOxygenImportFail, SUBREQUEST_PROFILER_ENDPOINT, logRequestLine } from './common.js';
|
|
9
9
|
import { TUNNEL_DOMAIN, getUtilityBannerlines, getDebugBannerLine } from '../dev-shared.js';
|
|
10
|
-
import { setConstructors, handleDebugNetworkRequest,
|
|
10
|
+
import { setConstructors, handleDebugNetworkRequest, H2O_BINDING_NAME, createLogRequestEvent } from '../request-events.js';
|
|
11
11
|
import { importLocal } from '../import-utils.js';
|
|
12
12
|
|
|
13
13
|
async function startWorkerdServer({
|
|
@@ -28,9 +28,7 @@ async function startWorkerdServer({
|
|
|
28
28
|
setConstructors({ Response });
|
|
29
29
|
async function handleCustomerAccountSchema() {
|
|
30
30
|
const require2 = createRequire(import.meta.url);
|
|
31
|
-
const filePath = require2.resolve(
|
|
32
|
-
"@shopify/hydrogen/customer-account.schema.json"
|
|
33
|
-
);
|
|
31
|
+
const filePath = require2.resolve("@shopify/hydrogen/customer-account.schema.json");
|
|
34
32
|
return new Response(createFileReadStream(filePath), {
|
|
35
33
|
headers: { "Content-Type": "application/json" }
|
|
36
34
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { symlink, readdir } from 'node:fs/promises';
|
|
2
2
|
import { packageManagerFromUserAgent, installNodeModules } from '@shopify/cli-kit/node/node-package-manager';
|
|
3
|
-
import { renderConfirmationPrompt, renderInfo, renderTextPrompt, renderSelectPrompt, renderWarning, renderSuccess
|
|
3
|
+
import { renderConfirmationPrompt, renderInfo, renderTextPrompt, renderSelectPrompt, renderFatalError, renderWarning, renderSuccess } from '@shopify/cli-kit/node/ui';
|
|
4
4
|
import { hyphenate, capitalize } from '@shopify/cli-kit/common/string';
|
|
5
5
|
import { joinPath, resolvePath, basename } from '@shopify/cli-kit/node/path';
|
|
6
6
|
import { initializeGitRepository, addAllToGitFromDirectory, createGitCommit } from '@shopify/cli-kit/node/git';
|
|
@@ -15,7 +15,7 @@ import { titleize } from '../string.js';
|
|
|
15
15
|
import { ALIAS_NAME, createPlatformShortcut } from '../shell.js';
|
|
16
16
|
import { transpileProject } from '../transpile/index.js';
|
|
17
17
|
import { renderCssPrompt, setupCssStrategy, CSS_STRATEGY_NAME_MAP } from '../setups/css/index.js';
|
|
18
|
-
import {
|
|
18
|
+
import { generateRoutes, generateProjectFile } from '../setups/routes/generate.js';
|
|
19
19
|
import { execAsync } from '../process.js';
|
|
20
20
|
import { getStorefronts } from '../graphql/admin/link-storefront.js';
|
|
21
21
|
import { isHydrogenMonorepo, getSkeletonSourceDir, getRepoNodeModules } from '../build.js';
|
|
@@ -42,32 +42,25 @@ async function handleI18n(controller, cliCommand, flagI18n) {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
const routesToScaffold = flagRoutes === true ? "all" : flagRoutes === false ? [] : await renderRoutePrompt({
|
|
47
|
-
abortSignal: controller.signal
|
|
48
|
-
});
|
|
49
|
-
const needsRouteGeneration = routesToScaffold === "all" || routesToScaffold.length > 0;
|
|
45
|
+
function handleRouteGeneration(controller) {
|
|
50
46
|
return {
|
|
51
|
-
needsRouteGeneration,
|
|
52
47
|
setupRoutes: async (directory, language, options) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return result.routeGroups;
|
|
70
|
-
}
|
|
48
|
+
const result = await generateRoutes(
|
|
49
|
+
{
|
|
50
|
+
routeName: "all",
|
|
51
|
+
directory,
|
|
52
|
+
force: true,
|
|
53
|
+
typescript: language === "ts",
|
|
54
|
+
localePrefix: options?.i18nStrategy === "subfolders" ? "locale" : false,
|
|
55
|
+
signal: controller.signal,
|
|
56
|
+
...options
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
rootDirectory: directory,
|
|
60
|
+
appDirectory: joinPath(directory, "app")
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return result.routeGroups;
|
|
71
64
|
}
|
|
72
65
|
};
|
|
73
66
|
}
|
|
@@ -284,6 +277,8 @@ async function handleDependencies(projectDir, controller, packageManagerFromFlag
|
|
|
284
277
|
cancellationMessage: "No",
|
|
285
278
|
abortSignal: controller.signal
|
|
286
279
|
});
|
|
280
|
+
} else {
|
|
281
|
+
actualPackageManager = detectedPackageManager;
|
|
287
282
|
}
|
|
288
283
|
}
|
|
289
284
|
if (isHydrogenMonorepo) {
|
|
@@ -2,8 +2,7 @@ import { cp } from 'node:fs/promises';
|
|
|
2
2
|
import { writeFile } from '@shopify/cli-kit/node/fs';
|
|
3
3
|
import { relativePath, joinPath } from '@shopify/cli-kit/node/path';
|
|
4
4
|
import { hyphenate } from '@shopify/cli-kit/common/string';
|
|
5
|
-
import
|
|
6
|
-
import { renderSelectPrompt, renderSuccess, renderConfirmationPrompt, renderTasks } from '@shopify/cli-kit/node/ui';
|
|
5
|
+
import { renderSelectPrompt, renderSuccess, renderTasks } from '@shopify/cli-kit/node/ui';
|
|
7
6
|
import { handleStorefrontLink, handleProjectLocation, createAbortHandler, generateProjectEntries, handleLanguage, createInitialCommit, handleCssStrategy, commitAll, handleDependencies, handleCliShortcut, handleI18n, handleRouteGeneration, renderProjectReady } from './common.js';
|
|
8
7
|
import { createStorefront } from '../graphql/admin/create-storefront.js';
|
|
9
8
|
import { waitForJob } from '../graphql/admin/fetch-job.js';
|
|
@@ -49,7 +48,7 @@ async function setupLocalStarterTemplate(options, controller) {
|
|
|
49
48
|
{
|
|
50
49
|
force: true,
|
|
51
50
|
recursive: true,
|
|
52
|
-
filter: (filepath) => !/^(app
|
|
51
|
+
filter: (filepath) => !/^(app(\/|$)|dist(\/|$)|node_modules(\/|$)|server\.ts$|\.shopify(\/|$))/i.test(
|
|
53
52
|
relativePath(templateDir, filepath)
|
|
54
53
|
)
|
|
55
54
|
}
|
|
@@ -217,65 +216,53 @@ async function setupLocalStarterTemplate(options, controller) {
|
|
|
217
216
|
]
|
|
218
217
|
});
|
|
219
218
|
}
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
overwriteFileDeps: false
|
|
255
|
-
}).then(async (routes) => {
|
|
256
|
-
setupSummary.routes = routes;
|
|
257
|
-
if (language === "ts" && setupSummary.depsInstalled) {
|
|
258
|
-
try {
|
|
259
|
-
await execAsync("npx react-router typegen", {
|
|
260
|
-
cwd: project.directory
|
|
261
|
-
});
|
|
262
|
-
} catch (error) {
|
|
263
|
-
outputWarn(
|
|
264
|
-
"Failed to generate React Router types after route generation. You may need to run `npx react-router typegen` manually."
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (options.git && routes) {
|
|
269
|
-
return commitAll(
|
|
270
|
-
project.directory,
|
|
271
|
-
`Generate routes for core functionality`
|
|
219
|
+
const { i18nStrategy, setupI18n } = await handleI18n(
|
|
220
|
+
controller,
|
|
221
|
+
setupSummary.cliCommand,
|
|
222
|
+
options.i18n
|
|
223
|
+
);
|
|
224
|
+
const { setupRoutes } = handleRouteGeneration(controller);
|
|
225
|
+
setupSummary.i18n = i18nStrategy;
|
|
226
|
+
backgroundWorkPromise = backgroundWorkPromise.then(async () => {
|
|
227
|
+
await setupI18n({
|
|
228
|
+
rootDirectory: project.directory,
|
|
229
|
+
contextCreate: language === "ts" ? "app/lib/context.ts" : "app/lib/context.js"
|
|
230
|
+
}).then(
|
|
231
|
+
() => options.git ? commitAll(
|
|
232
|
+
project.directory,
|
|
233
|
+
`Setup markets support using ${i18nStrategy}`
|
|
234
|
+
) : void 0
|
|
235
|
+
).catch((error) => {
|
|
236
|
+
setupSummary.i18nError = error;
|
|
237
|
+
});
|
|
238
|
+
await setupRoutes(project.directory, language, {
|
|
239
|
+
i18nStrategy,
|
|
240
|
+
// The init process might have added and modified files. Do not overwrite them.
|
|
241
|
+
// E.g. CSS imports might have been added to the root.
|
|
242
|
+
overwriteFileDeps: false
|
|
243
|
+
}).then(async (routes) => {
|
|
244
|
+
setupSummary.routes = routes;
|
|
245
|
+
if (language === "ts" && setupSummary.depsInstalled) {
|
|
246
|
+
try {
|
|
247
|
+
await execAsync("npx react-router typegen", {
|
|
248
|
+
cwd: project.directory
|
|
249
|
+
});
|
|
250
|
+
} catch (error) {
|
|
251
|
+
outputWarn(
|
|
252
|
+
"Failed to generate React Router types after route generation. You may need to run `npx react-router typegen` manually."
|
|
272
253
|
);
|
|
273
254
|
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
255
|
+
}
|
|
256
|
+
if (options.git && routes) {
|
|
257
|
+
return commitAll(
|
|
258
|
+
project.directory,
|
|
259
|
+
`Generate routes for core functionality`
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
}).catch((error) => {
|
|
263
|
+
setupSummary.routesError = error;
|
|
277
264
|
});
|
|
278
|
-
}
|
|
265
|
+
});
|
|
279
266
|
await renderTasks(tasks);
|
|
280
267
|
if (options.git) {
|
|
281
268
|
await commitAll(project.directory, "Lockfile");
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { readFile, writeFile, mkdtemp, rm } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
|
|
6
|
+
const DEPENDENCY_SECTIONS = [
|
|
7
|
+
"dependencies",
|
|
8
|
+
"devDependencies",
|
|
9
|
+
"peerDependencies",
|
|
10
|
+
"optionalDependencies"
|
|
11
|
+
];
|
|
12
|
+
function hasReplaceableProtocol(version) {
|
|
13
|
+
return version.startsWith("workspace:") || version.startsWith("catalog:");
|
|
14
|
+
}
|
|
15
|
+
async function getPackedTemplatePackageJson(sourceTemplateDir) {
|
|
16
|
+
const tempDir = await mkdtemp(join(tmpdir(), "hydrogen-template-pack-"));
|
|
17
|
+
try {
|
|
18
|
+
const rawPackResult = execFileSync(
|
|
19
|
+
"pnpm",
|
|
20
|
+
["pack", "--pack-destination", tempDir, "--json"],
|
|
21
|
+
{
|
|
22
|
+
cwd: sourceTemplateDir,
|
|
23
|
+
encoding: "utf8"
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
const parsedResult = JSON.parse(rawPackResult.trim());
|
|
27
|
+
const packedTarball = Array.isArray(parsedResult) ? parsedResult[0]?.filename : parsedResult.filename;
|
|
28
|
+
if (!packedTarball) {
|
|
29
|
+
throw new Error("pnpm pack did not return a tarball filename.");
|
|
30
|
+
}
|
|
31
|
+
const packedManifestRaw = execFileSync(
|
|
32
|
+
"tar",
|
|
33
|
+
[
|
|
34
|
+
"-xOf",
|
|
35
|
+
packedTarball.startsWith("/") ? packedTarball : join(tempDir, packedTarball),
|
|
36
|
+
"package/package.json"
|
|
37
|
+
],
|
|
38
|
+
{ encoding: "utf8" }
|
|
39
|
+
);
|
|
40
|
+
return JSON.parse(packedManifestRaw);
|
|
41
|
+
} finally {
|
|
42
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function replaceWorkspaceProtocolVersionsInPackageJson({
|
|
46
|
+
packedManifest,
|
|
47
|
+
targetPackageJson
|
|
48
|
+
}) {
|
|
49
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
50
|
+
const targetDeps = targetPackageJson[section];
|
|
51
|
+
if (!targetDeps) continue;
|
|
52
|
+
for (const [name, version] of Object.entries(targetDeps)) {
|
|
53
|
+
if (!hasReplaceableProtocol(version)) continue;
|
|
54
|
+
const packedVersion = packedManifest[section]?.[name];
|
|
55
|
+
if (!packedVersion) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Unable to resolve ${name} from ${section} in packed template manifest.`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
targetDeps[name] = packedVersion;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function replaceWorkspaceProtocolVersions({
|
|
65
|
+
sourceTemplateDir,
|
|
66
|
+
targetTemplateDir
|
|
67
|
+
}) {
|
|
68
|
+
const packedManifest = await getPackedTemplatePackageJson(sourceTemplateDir);
|
|
69
|
+
const targetPackageJsonPath = join(targetTemplateDir, "package.json");
|
|
70
|
+
const targetPackageJson = JSON.parse(
|
|
71
|
+
await readFile(targetPackageJsonPath, "utf8")
|
|
72
|
+
);
|
|
73
|
+
replaceWorkspaceProtocolVersionsInPackageJson({
|
|
74
|
+
packedManifest,
|
|
75
|
+
targetPackageJson
|
|
76
|
+
});
|
|
77
|
+
await writeFile(
|
|
78
|
+
targetPackageJsonPath,
|
|
79
|
+
`${JSON.stringify(targetPackageJson, null, 2)}
|
|
80
|
+
`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { replaceWorkspaceProtocolVersions };
|
package/oclif.manifest.json
CHANGED
|
@@ -1048,13 +1048,6 @@
|
|
|
1048
1048
|
"allowNo": true,
|
|
1049
1049
|
"type": "boolean"
|
|
1050
1050
|
},
|
|
1051
|
-
"routes": {
|
|
1052
|
-
"description": "Generate routes for all pages.",
|
|
1053
|
-
"env": "SHOPIFY_HYDROGEN_FLAG_ROUTES",
|
|
1054
|
-
"name": "routes",
|
|
1055
|
-
"allowNo": true,
|
|
1056
|
-
"type": "boolean"
|
|
1057
|
-
},
|
|
1058
1051
|
"git": {
|
|
1059
1052
|
"description": "Init Git and create initial commits.",
|
|
1060
1053
|
"env": "SHOPIFY_HYDROGEN_FLAG_GIT",
|
|
@@ -1063,7 +1056,7 @@
|
|
|
1063
1056
|
"type": "boolean"
|
|
1064
1057
|
},
|
|
1065
1058
|
"quickstart": {
|
|
1066
|
-
"description": "Scaffolds a new Hydrogen project with a set of sensible defaults. Equivalent to `shopify hydrogen init --path hydrogen-quickstart --mock-shop --language js --shortcut --
|
|
1059
|
+
"description": "Scaffolds a new Hydrogen project with a set of sensible defaults. Equivalent to `shopify hydrogen init --path hydrogen-quickstart --mock-shop --language js --shortcut --markets none`",
|
|
1067
1060
|
"env": "SHOPIFY_HYDROGEN_FLAG_QUICKSTART",
|
|
1068
1061
|
"name": "quickstart",
|
|
1069
1062
|
"allowNo": false,
|
|
@@ -1683,5 +1676,5 @@
|
|
|
1683
1676
|
]
|
|
1684
1677
|
}
|
|
1685
1678
|
},
|
|
1686
|
-
"version": "11.1.
|
|
1679
|
+
"version": "11.1.11"
|
|
1687
1680
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"@shopify:registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
7
|
-
"version": "11.1.
|
|
7
|
+
"version": "11.1.11",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
@@ -12,18 +12,12 @@
|
|
|
12
12
|
"url": "git+https://github.com/Shopify/hydrogen.git",
|
|
13
13
|
"directory": "packages/cli-hydrogen"
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsup && node scripts/build-check.mjs",
|
|
17
|
-
"dev": "tsup --watch ./src --watch ../../templates/skeleton",
|
|
18
|
-
"typecheck": "tsc --noEmit",
|
|
19
|
-
"generate:manifest": "node scripts/generate-manifest.mjs",
|
|
20
|
-
"test": "cross-env SHOPIFY_UNIT_TEST=1 LANG=en-US.UTF-8 vitest run --test-timeout=60000",
|
|
21
|
-
"test:watch": "cross-env SHOPIFY_UNIT_TEST=1 LANG=en-US.UTF-8 vitest --test-timeout=60000"
|
|
22
|
-
},
|
|
23
15
|
"devDependencies": {
|
|
24
16
|
"@react-router/dev": "7.12.0",
|
|
25
17
|
"@types/diff": "^5.0.2",
|
|
26
18
|
"@types/gunzip-maybe": "^1.4.0",
|
|
19
|
+
"@types/node": "^22",
|
|
20
|
+
"esbuild": "^0.25.0",
|
|
27
21
|
"@types/prettier": "^2.7.2",
|
|
28
22
|
"@types/source-map-support": "^0.5.10",
|
|
29
23
|
"@types/tar-fs": "^2.0.1",
|
|
@@ -46,10 +40,11 @@
|
|
|
46
40
|
"chokidar": "3.5.3",
|
|
47
41
|
"cli-truncate": "^4.0.0",
|
|
48
42
|
"diff": "^5.1.0",
|
|
43
|
+
"esbuild": "^0.25.12",
|
|
49
44
|
"get-east-asian-width": "^1.3.0",
|
|
50
45
|
"get-port": "^7.0.0",
|
|
51
46
|
"gunzip-maybe": "^1.4.2",
|
|
52
|
-
"prettier": "^
|
|
47
|
+
"prettier": "^3.4.2",
|
|
53
48
|
"semver": "^7.7.1",
|
|
54
49
|
"source-map": "^0.7.4",
|
|
55
50
|
"source-map-support": "^0.5.21",
|
|
@@ -61,10 +56,10 @@
|
|
|
61
56
|
"peerDependencies": {
|
|
62
57
|
"@graphql-codegen/cli": "^5.0.2",
|
|
63
58
|
"@react-router/dev": "7.12.0",
|
|
64
|
-
"@shopify/hydrogen-codegen": "^0.3.3",
|
|
65
|
-
"@shopify/mini-oxygen": "^4.0.0",
|
|
66
59
|
"graphql-config": "^5.0.3",
|
|
67
|
-
"vite": "^5.1.0 || ^6.2.0"
|
|
60
|
+
"vite": "^5.1.0 || ^6.2.0",
|
|
61
|
+
"@shopify/hydrogen-codegen": "0.3.3",
|
|
62
|
+
"@shopify/mini-oxygen": "4.0.1"
|
|
68
63
|
},
|
|
69
64
|
"peerDependenciesMeta": {
|
|
70
65
|
"@graphql-codegen/cli": {
|
|
@@ -103,7 +98,7 @@
|
|
|
103
98
|
"oclif.manifest.json"
|
|
104
99
|
],
|
|
105
100
|
"engines": {
|
|
106
|
-
"node": "
|
|
101
|
+
"node": "^20 || ^22 || ^24"
|
|
107
102
|
},
|
|
108
103
|
"oclif": {
|
|
109
104
|
"commands": "dist/commands",
|
|
@@ -130,5 +125,13 @@
|
|
|
130
125
|
"plugins": [
|
|
131
126
|
"@shopify/plugin-cloudflare"
|
|
132
127
|
]
|
|
128
|
+
},
|
|
129
|
+
"scripts": {
|
|
130
|
+
"build": "tsup && node scripts/build-check.mjs",
|
|
131
|
+
"dev": "tsup --watch ./src --watch ../../templates/skeleton",
|
|
132
|
+
"typecheck": "tsc --noEmit",
|
|
133
|
+
"generate:manifest": "node scripts/generate-manifest.mjs",
|
|
134
|
+
"test": "cross-env SHOPIFY_UNIT_TEST=1 LANG=en-US.UTF-8 vitest run --test-timeout=60000",
|
|
135
|
+
"test:watch": "cross-env SHOPIFY_UNIT_TEST=1 LANG=en-US.UTF-8 vitest --test-timeout=60000"
|
|
133
136
|
}
|
|
134
|
-
}
|
|
137
|
+
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { readFile } from '@shopify/cli-kit/node/fs';
|
|
2
|
-
import { joinPath } from '@shopify/cli-kit/node/path';
|
|
3
|
-
import { renderWarning } from '@shopify/cli-kit/node/ui';
|
|
4
|
-
import { outputDebug } from '@shopify/cli-kit/node/output';
|
|
5
|
-
import semver from 'semver';
|
|
6
|
-
|
|
7
|
-
const REACT_ROUTER_PACKAGES = [
|
|
8
|
-
"react-router",
|
|
9
|
-
"react-router-dom",
|
|
10
|
-
"@react-router/dev",
|
|
11
|
-
"@react-router/fs-routes"
|
|
12
|
-
];
|
|
13
|
-
const EXPECTED_VERSION = "7.12.0";
|
|
14
|
-
async function checkReactRouterVersions(appPath) {
|
|
15
|
-
const mismatches = [];
|
|
16
|
-
const packageJsonPath = joinPath(appPath, "package.json");
|
|
17
|
-
let packageJson;
|
|
18
|
-
try {
|
|
19
|
-
packageJson = JSON.parse(await readFile(packageJsonPath));
|
|
20
|
-
} catch (error) {
|
|
21
|
-
outputDebug(
|
|
22
|
-
`Unable to read package.json for React Router version check: ${error}`
|
|
23
|
-
);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const allDeps = {
|
|
27
|
-
...packageJson.dependencies,
|
|
28
|
-
...packageJson.devDependencies,
|
|
29
|
-
...packageJson.peerDependencies
|
|
30
|
-
};
|
|
31
|
-
for (const pkg of REACT_ROUTER_PACKAGES) {
|
|
32
|
-
const installedVersion = allDeps[pkg];
|
|
33
|
-
if (!installedVersion) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
installedVersion.replace(/^[\^~]/, "");
|
|
37
|
-
if (!semver.satisfies(EXPECTED_VERSION, installedVersion)) {
|
|
38
|
-
mismatches.push({
|
|
39
|
-
package: pkg,
|
|
40
|
-
installed: installedVersion,
|
|
41
|
-
expected: EXPECTED_VERSION
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (mismatches.length > 0) {
|
|
46
|
-
const mismatchList = mismatches.map(
|
|
47
|
-
(m) => ` \u2022 ${m.package}: installed ${m.installed}, expected ${m.expected}`
|
|
48
|
-
).join("\n");
|
|
49
|
-
const devPackages = ["@react-router/dev", "@react-router/fs-routes"];
|
|
50
|
-
const regularMismatches = mismatches.filter(
|
|
51
|
-
(m) => !devPackages.includes(m.package)
|
|
52
|
-
);
|
|
53
|
-
const devMismatches = mismatches.filter(
|
|
54
|
-
(m) => devPackages.includes(m.package)
|
|
55
|
-
);
|
|
56
|
-
const commands = [];
|
|
57
|
-
if (regularMismatches.length > 0) {
|
|
58
|
-
const regularList = regularMismatches.map((m) => `${m.package}@${EXPECTED_VERSION}`).join(" ");
|
|
59
|
-
commands.push(`npm install ${regularList}`);
|
|
60
|
-
}
|
|
61
|
-
if (devMismatches.length > 0) {
|
|
62
|
-
const devList = devMismatches.map((m) => `${m.package}@${EXPECTED_VERSION}`).join(" ");
|
|
63
|
-
commands.push(`npm install -D ${devList}`);
|
|
64
|
-
}
|
|
65
|
-
renderWarning({
|
|
66
|
-
headline: "React Router version mismatch detected",
|
|
67
|
-
body: [
|
|
68
|
-
"Hydrogen requires React Router 7.12.0 for proper functionality.",
|
|
69
|
-
"",
|
|
70
|
-
"Version mismatches found:",
|
|
71
|
-
mismatchList,
|
|
72
|
-
"",
|
|
73
|
-
"To fix this issue, run:",
|
|
74
|
-
...commands.map((cmd) => ` ${cmd}`),
|
|
75
|
-
"",
|
|
76
|
-
"This may cause issues with routing, code splitting, and other features."
|
|
77
|
-
].join("\n")
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export { checkReactRouterVersions };
|