@shopify/cli-hydrogen 12.0.0 → 12.0.2

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.
Files changed (73) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/hydrogen/routes/locale-check.ts +3 -3
  3. package/dist/assets/hydrogen/starter/.graphqlrc.ts +4 -2
  4. package/dist/assets/hydrogen/starter/CHANGELOG.md +278 -0
  5. package/dist/assets/hydrogen/starter/app/components/Aside.tsx +4 -2
  6. package/dist/assets/hydrogen/starter/app/components/CartLineItem.tsx +67 -38
  7. package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +49 -8
  8. package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +133 -57
  9. package/dist/assets/hydrogen/starter/app/components/Header.tsx +3 -3
  10. package/dist/assets/hydrogen/starter/app/components/MockShopNotice.tsx +20 -0
  11. package/dist/assets/hydrogen/starter/app/components/PaginatedResourceSection.tsx +24 -4
  12. package/dist/assets/hydrogen/starter/app/components/ProductPrice.tsx +1 -1
  13. package/dist/assets/hydrogen/starter/app/entry.client.tsx +2 -3
  14. package/dist/assets/hydrogen/starter/app/lib/context.ts +5 -0
  15. package/dist/assets/hydrogen/starter/app/lib/fragments.ts +8 -0
  16. package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +14 -53
  17. package/dist/assets/hydrogen/starter/app/routes/_index.tsx +15 -9
  18. package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +1 -1
  19. package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +14 -14
  20. package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +1 -1
  21. package/dist/assets/hydrogen/starter/app/routes/account.tsx +4 -7
  22. package/dist/assets/hydrogen/starter/app/routes/account_.login.tsx +10 -0
  23. package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle._index.tsx +2 -9
  24. package/dist/assets/hydrogen/starter/app/routes/blogs._index.tsx +1 -4
  25. package/dist/assets/hydrogen/starter/app/routes/cart.tsx +3 -11
  26. package/dist/assets/hydrogen/starter/app/routes/collections.all.tsx +1 -3
  27. package/dist/assets/hydrogen/starter/app/routes/pages.$handle.tsx +2 -8
  28. package/dist/assets/hydrogen/starter/app/routes/policies.$handle.tsx +1 -4
  29. package/dist/assets/hydrogen/starter/app/routes/policies._index.tsx +1 -1
  30. package/dist/assets/hydrogen/starter/app/routes/products.$handle.tsx +2 -9
  31. package/dist/assets/hydrogen/starter/app/routes/search.tsx +18 -12
  32. package/dist/assets/hydrogen/starter/app/styles/app.css +72 -1
  33. package/dist/assets/hydrogen/starter/eslint.config.js +1 -0
  34. package/dist/assets/hydrogen/starter/guides/predictiveSearch/predictiveSearch.md +3 -3
  35. package/dist/assets/hydrogen/starter/guides/search/search.md +1 -1
  36. package/dist/assets/hydrogen/starter/package.json +16 -16
  37. package/dist/assets/hydrogen/starter/server.ts +5 -7
  38. package/dist/assets/hydrogen/starter/storefrontapi.generated.d.ts +89 -11
  39. package/dist/assets/hydrogen/starter/vite.config.ts +10 -4
  40. package/dist/assets/hydrogen/vite/package.json +1 -2
  41. package/dist/assets/hydrogen/vite/vite.config.js +4 -3
  42. package/dist/commands/hydrogen/deploy.js +19 -13
  43. package/dist/commands/hydrogen/dev.js +6 -6
  44. package/dist/commands/hydrogen/generate/route.js +1 -1
  45. package/dist/commands/hydrogen/init.d.ts +2 -4
  46. package/dist/commands/hydrogen/init.js +2 -8
  47. package/dist/commands/hydrogen/preview.js +1 -1
  48. package/dist/commands/hydrogen/setup/css.js +1 -1
  49. package/dist/commands/hydrogen/setup/markets.js +1 -1
  50. package/dist/commands/hydrogen/setup/vite.js +1 -1
  51. package/dist/commands/hydrogen/setup.js +31 -33
  52. package/dist/commands/hydrogen/upgrade.js +173 -39
  53. package/dist/lib/build.js +4 -5
  54. package/dist/lib/bundle/vite-plugin.js +7 -21
  55. package/dist/lib/check-lockfile.js +16 -7
  56. package/dist/lib/codegen.js +2 -2
  57. package/dist/lib/format-code.js +3 -3
  58. package/dist/lib/graphql/admin/client.js +48 -23
  59. package/dist/lib/import-utils.js +20 -4
  60. package/dist/lib/mini-oxygen/workerd.js +3 -5
  61. package/dist/lib/onboarding/common.js +21 -26
  62. package/dist/lib/onboarding/local.js +46 -59
  63. package/dist/lib/package-managers.js +2 -0
  64. package/dist/lib/patch-cli.js +198 -0
  65. package/dist/lib/setups/routes/generate.js +5 -3
  66. package/dist/lib/template-pack.js +93 -0
  67. package/dist/lib/transpile/morph/functions.js +1 -1
  68. package/dist/lib/transpile/morph/typedefs.js +2 -3
  69. package/dist/lib/upgrade-e2e-utils.js +50 -0
  70. package/oclif.manifest.json +7 -15
  71. package/package.json +22 -19
  72. package/dist/assets/hydrogen/starter/app/routes/api.$version.[graphql.json].tsx +0 -14
  73. package/dist/lib/react-router-version-check.js +0 -82
@@ -36,6 +36,9 @@ export type CartLineFragment = Pick<
36
36
  Pick<StorefrontAPI.SelectedOption, 'name' | 'value'>
37
37
  >;
38
38
  };
39
+ parentRelationship?: StorefrontAPI.Maybe<{
40
+ parent: Pick<StorefrontAPI.CartLine, 'id'>;
41
+ }>;
39
42
  };
40
43
 
41
44
  export type CartLineComponentFragment = Pick<
@@ -66,6 +69,46 @@ export type CartLineComponentFragment = Pick<
66
69
  Pick<StorefrontAPI.SelectedOption, 'name' | 'value'>
67
70
  >;
68
71
  };
72
+ lineComponents: Array<
73
+ Pick<StorefrontAPI.CartLine, 'id' | 'quantity'> & {
74
+ attributes: Array<Pick<StorefrontAPI.Attribute, 'key' | 'value'>>;
75
+ cost: {
76
+ totalAmount: Pick<StorefrontAPI.MoneyV2, 'currencyCode' | 'amount'>;
77
+ amountPerQuantity: Pick<
78
+ StorefrontAPI.MoneyV2,
79
+ 'currencyCode' | 'amount'
80
+ >;
81
+ compareAtAmountPerQuantity?: StorefrontAPI.Maybe<
82
+ Pick<StorefrontAPI.MoneyV2, 'currencyCode' | 'amount'>
83
+ >;
84
+ };
85
+ merchandise: Pick<
86
+ StorefrontAPI.ProductVariant,
87
+ 'id' | 'availableForSale' | 'requiresShipping' | 'title'
88
+ > & {
89
+ compareAtPrice?: StorefrontAPI.Maybe<
90
+ Pick<StorefrontAPI.MoneyV2, 'currencyCode' | 'amount'>
91
+ >;
92
+ price: Pick<StorefrontAPI.MoneyV2, 'currencyCode' | 'amount'>;
93
+ image?: StorefrontAPI.Maybe<
94
+ Pick<
95
+ StorefrontAPI.Image,
96
+ 'id' | 'url' | 'altText' | 'width' | 'height'
97
+ >
98
+ >;
99
+ product: Pick<
100
+ StorefrontAPI.Product,
101
+ 'handle' | 'title' | 'id' | 'vendor'
102
+ >;
103
+ selectedOptions: Array<
104
+ Pick<StorefrontAPI.SelectedOption, 'name' | 'value'>
105
+ >;
106
+ };
107
+ parentRelationship?: StorefrontAPI.Maybe<{
108
+ parent: Pick<StorefrontAPI.CartLine, 'id'>;
109
+ }>;
110
+ }
111
+ >;
69
112
  };
70
113
 
71
114
  export type CartApiQueryFragment = Pick<
@@ -124,6 +167,9 @@ export type CartApiQueryFragment = Pick<
124
167
  Pick<StorefrontAPI.SelectedOption, 'name' | 'value'>
125
168
  >;
126
169
  };
170
+ parentRelationship?: StorefrontAPI.Maybe<{
171
+ parent: Pick<StorefrontAPI.CartLine, 'id'>;
172
+ }>;
127
173
  })
128
174
  | (Pick<StorefrontAPI.ComponentizableCartLine, 'id' | 'quantity'> & {
129
175
  attributes: Array<Pick<StorefrontAPI.Attribute, 'key' | 'value'>>;
@@ -159,6 +205,49 @@ export type CartApiQueryFragment = Pick<
159
205
  Pick<StorefrontAPI.SelectedOption, 'name' | 'value'>
160
206
  >;
161
207
  };
208
+ lineComponents: Array<
209
+ Pick<StorefrontAPI.CartLine, 'id' | 'quantity'> & {
210
+ attributes: Array<Pick<StorefrontAPI.Attribute, 'key' | 'value'>>;
211
+ cost: {
212
+ totalAmount: Pick<
213
+ StorefrontAPI.MoneyV2,
214
+ 'currencyCode' | 'amount'
215
+ >;
216
+ amountPerQuantity: Pick<
217
+ StorefrontAPI.MoneyV2,
218
+ 'currencyCode' | 'amount'
219
+ >;
220
+ compareAtAmountPerQuantity?: StorefrontAPI.Maybe<
221
+ Pick<StorefrontAPI.MoneyV2, 'currencyCode' | 'amount'>
222
+ >;
223
+ };
224
+ merchandise: Pick<
225
+ StorefrontAPI.ProductVariant,
226
+ 'id' | 'availableForSale' | 'requiresShipping' | 'title'
227
+ > & {
228
+ compareAtPrice?: StorefrontAPI.Maybe<
229
+ Pick<StorefrontAPI.MoneyV2, 'currencyCode' | 'amount'>
230
+ >;
231
+ price: Pick<StorefrontAPI.MoneyV2, 'currencyCode' | 'amount'>;
232
+ image?: StorefrontAPI.Maybe<
233
+ Pick<
234
+ StorefrontAPI.Image,
235
+ 'id' | 'url' | 'altText' | 'width' | 'height'
236
+ >
237
+ >;
238
+ product: Pick<
239
+ StorefrontAPI.Product,
240
+ 'handle' | 'title' | 'id' | 'vendor'
241
+ >;
242
+ selectedOptions: Array<
243
+ Pick<StorefrontAPI.SelectedOption, 'name' | 'value'>
244
+ >;
245
+ };
246
+ parentRelationship?: StorefrontAPI.Maybe<{
247
+ parent: Pick<StorefrontAPI.CartLine, 'id'>;
248
+ }>;
249
+ }
250
+ >;
162
251
  })
163
252
  >;
164
253
  };
@@ -288,13 +377,6 @@ export type FooterQuery = {
288
377
  >;
289
378
  };
290
379
 
291
- export type StoreRobotsQueryVariables = StorefrontAPI.Exact<{
292
- country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
293
- language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
294
- }>;
295
-
296
- export type StoreRobotsQuery = {shop: Pick<StorefrontAPI.Shop, 'id'>};
297
-
298
380
  export type FeaturedCollectionFragment = Pick<
299
381
  StorefrontAPI.Collection,
300
382
  'id' | 'title' | 'handle'
@@ -1194,10 +1276,6 @@ interface GeneratedQueryTypes {
1194
1276
  return: FooterQuery;
1195
1277
  variables: FooterQueryVariables;
1196
1278
  };
1197
- '#graphql\n query StoreRobots($country: CountryCode, $language: LanguageCode)\n @inContext(country: $country, language: $language) {\n shop {\n id\n }\n }\n': {
1198
- return: StoreRobotsQuery;
1199
- variables: StoreRobotsQueryVariables;
1200
- };
1201
1279
  '#graphql\n fragment FeaturedCollection on Collection {\n id\n title\n image {\n id\n url\n altText\n width\n height\n }\n handle\n }\n query FeaturedCollection($country: CountryCode, $language: LanguageCode)\n @inContext(country: $country, language: $language) {\n collections(first: 1, sortKey: UPDATED_AT, reverse: true) {\n nodes {\n ...FeaturedCollection\n }\n }\n }\n': {
1202
1280
  return: FeaturedCollectionQuery;
1203
1281
  variables: FeaturedCollectionQueryVariables;
@@ -2,13 +2,15 @@ import {defineConfig} from 'vite';
2
2
  import {hydrogen} from '@shopify/hydrogen/vite';
3
3
  import {oxygen} from '@shopify/mini-oxygen/vite';
4
4
  import {reactRouter} from '@react-router/dev/vite';
5
- import tsconfigPaths from 'vite-tsconfig-paths';
6
5
 
7
6
  export default defineConfig({
8
- plugins: [hydrogen(), oxygen(), reactRouter(), tsconfigPaths()],
7
+ plugins: [hydrogen(), oxygen(), reactRouter()],
8
+ resolve: {
9
+ tsconfigPaths: true,
10
+ },
9
11
  build: {
10
12
  // Allow a strict Content-Security-Policy
11
- // withtout inlining assets as base64:
13
+ // without inlining assets as base64:
12
14
  assetsInlineLimit: 0,
13
15
  },
14
16
  ssr: {
@@ -23,7 +25,11 @@ export default defineConfig({
23
25
  * Include 'example-dep' in the array below.
24
26
  * @see https://vitejs.dev/config/dep-optimization-options
25
27
  */
26
- include: ['set-cookie-parser', 'cookie', 'react-router'],
28
+ include: [
29
+ 'react-router > set-cookie-parser',
30
+ 'react-router > cookie',
31
+ 'react-router',
32
+ ],
27
33
  },
28
34
  },
29
35
  server: {
@@ -8,7 +8,6 @@
8
8
  "isbot": "^5.1.21"
9
9
  },
10
10
  "devDependencies": {
11
- "vite": "^6.2.0",
12
- "vite-tsconfig-paths": "^4.3.1"
11
+ "vite": "^8.0.1"
13
12
  }
14
13
  }
@@ -2,9 +2,11 @@ import {defineConfig} from 'vite';
2
2
  import {hydrogen} from '@shopify/hydrogen/vite';
3
3
  import {oxygen} from '@shopify/mini-oxygen/vite';
4
4
  import {vitePlugin as remix} from '@remix-run/dev';
5
- import tsconfigPaths from 'vite-tsconfig-paths';
6
5
 
7
6
  export default defineConfig({
7
+ resolve: {
8
+ tsconfigPaths: true,
9
+ },
8
10
  plugins: [
9
11
  hydrogen(),
10
12
  oxygen(),
@@ -17,11 +19,10 @@ export default defineConfig({
17
19
  v3_routeConfig: false,
18
20
  },
19
21
  }),
20
- tsconfigPaths(),
21
22
  ],
22
23
  build: {
23
24
  // Allow a strict Content-Security-Policy
24
- // withtout inlining assets as base64:
25
+ // without inlining assets as base64:
25
26
  assetsInlineLimit: 0,
26
27
  },
27
28
  ssr: {
@@ -46,7 +46,7 @@ class Deploy extends Command {
46
46
  }),
47
47
  force: Flags.boolean({
48
48
  char: "f",
49
- description: "Forces a deployment to proceed if there are uncommited changes in its Git repository.",
49
+ description: "Forces a deployment to proceed if there are uncommitted changes in its Git repository.",
50
50
  default: false,
51
51
  env: "SHOPIFY_HYDROGEN_FLAG_FORCE",
52
52
  required: false
@@ -88,7 +88,7 @@ class Deploy extends Command {
88
88
  required: false
89
89
  }),
90
90
  "metadata-description": Flags.string({
91
- description: "Description of the changes in the deployment. Defaults to the commit message of the latest commit if there are no uncommited changes.",
91
+ description: "Description of the changes in the deployment. Defaults to the commit message of the latest commit if there are no uncommitted changes.",
92
92
  required: false,
93
93
  env: "SHOPIFY_HYDROGEN_FLAG_METADATA_DESCRIPTION"
94
94
  }),
@@ -155,7 +155,7 @@ async function runDeploy(options) {
155
155
  env: envHandle,
156
156
  envBranch,
157
157
  environmentFile,
158
- force: forceOnUncommitedChanges,
158
+ force: forceOnUncommittedChanges,
159
159
  forceClientSourcemap = false,
160
160
  noVerify,
161
161
  lockfileCheck,
@@ -175,7 +175,7 @@ async function runDeploy(options) {
175
175
  if (error instanceof GitDirectoryNotCleanError) {
176
176
  isCleanGit = false;
177
177
  }
178
- if (!forceOnUncommitedChanges && !isCleanGit) {
178
+ if (!forceOnUncommittedChanges && !isCleanGit) {
179
179
  let errorMessage = "Uncommitted changes detected";
180
180
  let changedFiles = void 0;
181
181
  const nextSteps = [
@@ -193,15 +193,21 @@ async function runDeploy(options) {
193
193
  errorMessage += `:
194
194
 
195
195
  ${changedFiles.trimEnd()}`;
196
- packageManagers.forEach(({ name, lockfile, installCommand }) => {
197
- if (changedFiles.includes(lockfile)) {
198
- nextSteps.push([
199
- `If you are using ${name}, try running`,
200
- { command: installCommand },
201
- `to avoid changes to ${lockfile}.`
202
- ]);
196
+ packageManagers.forEach(
197
+ ({ name, lockfile, alternativeLockfiles, installCommand }) => {
198
+ const allLockfiles = [lockfile, ...alternativeLockfiles || []];
199
+ const changedLockfile = allLockfiles.find(
200
+ (lf) => changedFiles.includes(lf)
201
+ );
202
+ if (changedLockfile) {
203
+ nextSteps.push([
204
+ `If you are using ${name}, try running`,
205
+ { command: installCommand },
206
+ `to avoid changes to ${changedLockfile}.`
207
+ ]);
208
+ }
203
209
  }
204
- });
210
+ );
205
211
  }
206
212
  throw new AbortError(errorMessage, null, nextSteps);
207
213
  }
@@ -225,7 +231,7 @@ ${changedFiles.trimEnd()}`;
225
231
  renderWarning({
226
232
  headline: "No deployment description provided",
227
233
  body: [
228
- "Deploying uncommited changes, but no description has been provided. Use the ",
234
+ "Deploying uncommitted changes, but no description has been provided. Use the ",
229
235
  { command: "--metadata-description" },
230
236
  "flag to provide a description. If no description is provided, the description defaults to ",
231
237
  { userInput: "<sha> with additional changes" },
@@ -7,11 +7,10 @@ import { renderSuccess, renderInfo } from '@shopify/cli-kit/node/ui';
7
7
  import { AbortError } from '@shopify/cli-kit/node/error';
8
8
  import { removeFile } from '@shopify/cli-kit/node/fs';
9
9
  import { setH2OVerbose, isH2Verbose, muteDevLogs, enhanceH2Logs } from '../../lib/log.js';
10
- import { commonFlags, overrideFlag, flagsToCamelObject, DEFAULT_INSPECTOR_PORT, DEFAULT_APP_PORT } from '../../lib/flags.js';
10
+ import { commonFlags, overrideFlag, flagsToCamelObject, DEFAULT_APP_PORT, DEFAULT_INSPECTOR_PORT } from '../../lib/flags.js';
11
11
  import { spawnCodegenProcess } from '../../lib/codegen.js';
12
12
  import { getAllEnvironmentVariables } from '../../lib/environment-variables.js';
13
13
  import { displayDevUpgradeNotice } from './upgrade.js';
14
- import { checkReactRouterVersions } from '../../lib/react-router-version-check.js';
15
14
  import { getDevConfigInBackground, TUNNEL_DOMAIN, startTunnelAndPushConfig, isMockShop, notifyIssueWithTunnelAndMockShop, getUtilityBannerlines, getDebugBannerLine } from '../../lib/dev-shared.js';
16
15
  import { getCliCommand } from '../../lib/shell.js';
17
16
  import { findPort } from '../../lib/find-port.js';
@@ -104,6 +103,9 @@ async function runDev({
104
103
  if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
105
104
  if (verbose) setH2OVerbose();
106
105
  if (!isH2Verbose()) muteDevLogs();
106
+ if (appPort === 0) {
107
+ appPort = await findPort(DEFAULT_APP_PORT);
108
+ }
107
109
  const root = appPath ?? process.cwd();
108
110
  const cliCommandPromise = getCliCommand(root);
109
111
  const backgroundPromise = getDevConfigInBackground(
@@ -134,6 +136,8 @@ async function runDev({
134
136
  const viteServer = await vite.createServer({
135
137
  root,
136
138
  clearScreen: false,
139
+ // In unit tests, node_modules is a symlink. Avoid writing .vite cache inside it.
140
+ cacheDir: process.env.SHOPIFY_UNIT_TEST ? joinPath(root, ".vite") : void 0,
137
141
  customLogger: process.env.SHOPIFY_UNIT_TEST ? Object.assign(vite.createLogger(), {
138
142
  info: (msg) => collectLog("info", msg),
139
143
  warn: (msg) => collectLog("warn", msg),
@@ -197,7 +201,6 @@ async function runDev({
197
201
  "Add `hydrogen()` plugin to your Vite config."
198
202
  );
199
203
  }
200
- h2Plugin.api?.getPluginOptions?.();
201
204
  const remixConfig = (await getViteConfig(root)).remixConfig;
202
205
  let codegenProcess;
203
206
  const setupCodegen = useCodegen ? () => {
@@ -236,9 +239,6 @@ async function runDev({
236
239
  viteServer.bindCLIShortcuts({ print: true });
237
240
  console.log("\n");
238
241
  const storefrontTitle = (await backgroundPromise).storefrontTitle;
239
- if (!disableVersionCheck) {
240
- await checkReactRouterVersions(root);
241
- }
242
242
  showSuccessBanner({
243
243
  disableVirtualRoutes,
244
244
  debug,
@@ -12,7 +12,7 @@ class GenerateRoute extends Command {
12
12
  static description = "Generates a standard Shopify route.";
13
13
  static flags = {
14
14
  adapter: Flags.string({
15
- description: "Remix adapter used in the route. The default is `@shopify/remix-oxygen`.",
15
+ description: "React Router adapter used in the route. The default is `react-router`.",
16
16
  env: "SHOPIFY_HYDROGEN_FLAG_ADAPTER"
17
17
  }),
18
18
  typescript: Flags.boolean({
@@ -1,6 +1,6 @@
1
+ import { PackageManager } from '@shopify/cli-kit/node/node-package-manager';
1
2
  import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
2
3
  import Command from '@shopify/cli-kit/node/base-command';
3
- import { PackageManager } from '@shopify/cli-kit/node/node-package-manager';
4
4
 
5
5
  declare const SETUP_I18N_STRATEGIES: readonly ["subfolders", "domains", "subdomains"];
6
6
  type I18nStrategy = (typeof SETUP_I18N_STRATEGIES)[number];
@@ -24,7 +24,6 @@ type InitOptions = {
24
24
  i18n?: I18nChoice;
25
25
  token?: string;
26
26
  force?: boolean;
27
- routes?: boolean;
28
27
  shortcut?: boolean;
29
28
  installDeps?: boolean;
30
29
  git?: boolean;
@@ -41,7 +40,6 @@ declare class Init extends Command {
41
40
  static descriptionWithMarkdown: string;
42
41
  static description: string;
43
42
  static flags: {
44
- routes: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
45
43
  git: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
46
44
  quickstart: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
47
45
  'package-manager': _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
@@ -60,7 +58,7 @@ declare class Init extends Command {
60
58
  declare function runInit({ markets, ...options }?: InitOptions & {
61
59
  markets?: InitOptions['i18n'];
62
60
  }): Promise<{
63
- language?: "ts" | "js";
61
+ language?: Language;
64
62
  packageManager: "npm" | "pnpm" | "yarn" | "bun" | "unknown";
65
63
  cssStrategy?: CssStrategy;
66
64
  cliCommand: CliCommand;
@@ -1,7 +1,7 @@
1
1
  import Command from '@shopify/cli-kit/node/base-command';
2
2
  import { Flags } from '@oclif/core';
3
3
  import { AbortError } from '@shopify/cli-kit/node/error';
4
- import { commonFlags, parseProcessFlags, flagsToCamelObject } from '../../lib/flags.js';
4
+ import { commonFlags, flagsToCamelObject, parseProcessFlags } from '../../lib/flags.js';
5
5
  import { checkCurrentCLIVersion } from '../../lib/check-cli-version.js';
6
6
  import { STYLING_CHOICES } from '../../lib/setups/css/index.js';
7
7
  import { I18N_CHOICES } from '../../lib/setups/i18n/index.js';
@@ -36,11 +36,6 @@ class Init extends Command {
36
36
  ...commonFlags.styling,
37
37
  ...commonFlags.markets,
38
38
  ...commonFlags.shortcut,
39
- routes: Flags.boolean({
40
- description: "Generate routes for all pages.",
41
- env: "SHOPIFY_HYDROGEN_FLAG_ROUTES",
42
- allowNo: true
43
- }),
44
39
  git: Flags.boolean({
45
40
  description: "Init Git and create initial commits.",
46
41
  env: "SHOPIFY_HYDROGEN_FLAG_GIT",
@@ -48,7 +43,7 @@ class Init extends Command {
48
43
  allowNo: true
49
44
  }),
50
45
  quickstart: Flags.boolean({
51
- 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 --routes --markets none`",
46
+ 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`",
52
47
  env: "SHOPIFY_HYDROGEN_FLAG_QUICKSTART",
53
48
  default: false
54
49
  }),
@@ -91,7 +86,6 @@ async function runInit({
91
86
  options.language ??= "js";
92
87
  options.mockShop ??= true;
93
88
  options.path ??= "./hydrogen-quickstart";
94
- options.routes ??= true;
95
89
  options.shortcut ??= true;
96
90
  options.styling ??= "none";
97
91
  }
@@ -5,7 +5,7 @@ import { outputInfo } from '@shopify/cli-kit/node/output';
5
5
  import { resolvePath, joinPath } from '@shopify/cli-kit/node/path';
6
6
  import { setH2OVerbose, isH2Verbose, muteDevLogs } from '../../lib/log.js';
7
7
  import { getProjectPaths, isClassicProject } from '../../lib/remix-config.js';
8
- import { overrideFlag, commonFlags, flagsToCamelObject, DEFAULT_APP_PORT } from '../../lib/flags.js';
8
+ import { commonFlags, overrideFlag, flagsToCamelObject, DEFAULT_APP_PORT } from '../../lib/flags.js';
9
9
  import { startMiniOxygen } from '../../lib/mini-oxygen/index.js';
10
10
  import { getAllEnvironmentVariables } from '../../lib/environment-variables.js';
11
11
  import { getConfig } from '../../lib/shopify-config.js';
@@ -1,5 +1,5 @@
1
1
  import { resolvePath } from '@shopify/cli-kit/node/path';
2
- import { overrideFlag, commonFlags, flagsToCamelObject } from '../../../lib/flags.js';
2
+ import { commonFlags, overrideFlag, flagsToCamelObject } from '../../../lib/flags.js';
3
3
  import Command from '@shopify/cli-kit/node/base-command';
4
4
  import { renderSuccess, renderTasks, renderWarning } from '@shopify/cli-kit/node/ui';
5
5
  import { getPackageManager, installNodeModules } from '@shopify/cli-kit/node/node-package-manager';
@@ -45,7 +45,7 @@ async function runSetupMarkets({
45
45
  }
46
46
  ]);
47
47
  renderSuccess({
48
- headline: `Makerts support setup complete with strategy ${I18N_STRATEGY_NAME_MAP[strategy].toLocaleLowerCase()}.`,
48
+ headline: `Markets support setup complete with strategy ${I18N_STRATEGY_NAME_MAP[strategy].toLowerCase()}.`,
49
49
  body: `You can now modify the supported locales in ${remixConfig.serverEntryPoint ?? "your server entry file."}
50
50
  `
51
51
  });
@@ -5,7 +5,7 @@ import { removeFile, moveFile, readFile, writeFile, fileExists } from '@shopify/
5
5
  import { readAndParsePackageJson, installNodeModules, getPackageManager } from '@shopify/cli-kit/node/node-package-manager';
6
6
  import { commonFlags, flagsToCamelObject } from '../../../lib/flags.js';
7
7
  import { getRawRemixConfig } from '../../../lib/remix-config.js';
8
- import { mergePackageJson, replaceFileContent } from '../../../lib/file.js';
8
+ import { replaceFileContent, mergePackageJson } from '../../../lib/file.js';
9
9
  import { importLangAstGrep } from '../../../lib/ast.js';
10
10
  import { getAssetsDir } from '../../../lib/build.js';
11
11
  import { getCodeFormatOptions, formatCode } from '../../../lib/format-code.js';
@@ -3,7 +3,7 @@ import { AbortController } from '@shopify/cli-kit/node/abort';
3
3
  import { renderTasks } from '@shopify/cli-kit/node/ui';
4
4
  import { resolvePath, basename, joinPath } from '@shopify/cli-kit/node/path';
5
5
  import { fileExists, glob, copyFile } from '@shopify/cli-kit/node/fs';
6
- import { overrideFlag, commonFlags, flagsToCamelObject } from '../../lib/flags.js';
6
+ import { commonFlags, overrideFlag, flagsToCamelObject } from '../../lib/flags.js';
7
7
  import { renderI18nPrompt, setupI18nStrategy } from '../../lib/setups/i18n/index.js';
8
8
  import { getRemixConfig } from '../../lib/remix-config.js';
9
9
  import { handleRouteGeneration, generateProjectEntries, handleCliShortcut, renderProjectReady } from '../../lib/onboarding/common.js';
@@ -49,39 +49,37 @@ async function runSetup(options) {
49
49
  extraChoices: { none: "Set up later" }
50
50
  });
51
51
  const i18n = i18nStrategy === "none" ? void 0 : i18nStrategy;
52
- const { needsRouteGeneration, setupRoutes } = await handleRouteGeneration(controller);
52
+ const { setupRoutes } = handleRouteGeneration(controller);
53
53
  let routes;
54
- if (needsRouteGeneration) {
55
- const templateRoot = await getTemplateAppFile("..");
56
- const [typescript, dtsFiles] = await Promise.all([
57
- fileExists(joinPath(rootDirectory, "tsconfig.json")),
58
- glob("*.d.ts", { cwd: templateRoot })
59
- ]);
60
- backgroundWorkPromise = backgroundWorkPromise.then(
61
- () => Promise.all([
62
- ...dtsFiles.map(
63
- (filename) => copyFile(
64
- joinPath(templateRoot, filename),
65
- resolvePath(rootDirectory, filename)
66
- )
67
- ),
68
- // Copy app entries
69
- generateProjectEntries({
70
- rootDirectory,
71
- appDirectory,
72
- typescript
73
- })
74
- ])
75
- ).then(async () => {
76
- routes = await setupRoutes(rootDirectory, typescript ? "ts" : "js", {
77
- i18nStrategy: i18n,
78
- // User might have added files before running this command.
79
- // We should overwrite them to ensure the routes are set up correctly.
80
- // Relies on Git to restore the files if needed.
81
- overwriteFileDeps: true
82
- });
54
+ const templateRoot = await getTemplateAppFile("..");
55
+ const [typescript, dtsFiles] = await Promise.all([
56
+ fileExists(joinPath(rootDirectory, "tsconfig.json")),
57
+ glob("*.d.ts", { cwd: templateRoot })
58
+ ]);
59
+ backgroundWorkPromise = backgroundWorkPromise.then(
60
+ () => Promise.all([
61
+ ...dtsFiles.map(
62
+ (filename) => copyFile(
63
+ joinPath(templateRoot, filename),
64
+ resolvePath(rootDirectory, filename)
65
+ )
66
+ ),
67
+ // Copy app entries
68
+ generateProjectEntries({
69
+ rootDirectory,
70
+ appDirectory,
71
+ typescript
72
+ })
73
+ ])
74
+ ).then(async () => {
75
+ routes = await setupRoutes(rootDirectory, typescript ? "ts" : "js", {
76
+ i18nStrategy: i18n,
77
+ // User might have added files before running this command.
78
+ // We should overwrite them to ensure the routes are set up correctly.
79
+ // Relies on Git to restore the files if needed.
80
+ overwriteFileDeps: true
83
81
  });
84
- }
82
+ });
85
83
  if (i18n) {
86
84
  backgroundWorkPromise = backgroundWorkPromise.then(
87
85
  () => setupI18nStrategy(i18n, { rootDirectory })
@@ -93,7 +91,7 @@ async function runSetup(options) {
93
91
  cliCommand,
94
92
  options.shortcut
95
93
  );
96
- if (!i18n && !needsRouteGeneration && !createShortcut) return;
94
+ if (!i18n && !createShortcut) return;
97
95
  if (createShortcut) {
98
96
  backgroundWorkPromise = backgroundWorkPromise.then(async () => {
99
97
  if (await createShortcut()) {