@shopify/cli-hydrogen 3.36.1 → 3.36.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.
- package/dist/cli/commands/hydrogen/add/eslint.js +2 -2
- package/dist/cli/commands/hydrogen/add/eslint.js.map +1 -1
- package/dist/cli/commands/hydrogen/add/tailwind.js +2 -2
- package/dist/cli/commands/hydrogen/add/tailwind.js.map +1 -1
- package/dist/cli/commands/hydrogen/build.js +2 -2
- package/dist/cli/commands/hydrogen/build.js.map +1 -1
- package/dist/cli/commands/hydrogen/deploy.js +2 -2
- package/dist/cli/commands/hydrogen/deploy.js.map +1 -1
- package/dist/cli/commands/hydrogen/dev.js +2 -2
- package/dist/cli/commands/hydrogen/dev.js.map +1 -1
- package/dist/cli/commands/hydrogen/info.js +2 -2
- package/dist/cli/commands/hydrogen/info.js.map +1 -1
- package/dist/cli/commands/hydrogen/preview.js +2 -2
- package/dist/cli/commands/hydrogen/preview.js.map +1 -1
- package/dist/cli/models/hydrogen.js +3 -3
- package/dist/cli/models/hydrogen.js.map +1 -1
- package/dist/cli/services/build.js +3 -2
- package/dist/cli/services/build.js.map +1 -1
- package/dist/cli/services/deploy/config.js +2 -2
- package/dist/cli/services/deploy/config.js.map +1 -1
- package/dist/cli/services/deploy/upload.js +10 -10
- package/dist/cli/services/deploy/upload.js.map +1 -1
- package/dist/cli/services/dev.js +2 -2
- package/dist/cli/services/dev.js.map +1 -1
- package/dist/cli/services/eslint.js +3 -2
- package/dist/cli/services/eslint.js.map +1 -1
- package/dist/cli/services/preview.d.ts +2 -2
- package/dist/cli/services/preview.js +3 -2
- package/dist/cli/services/preview.js.map +1 -1
- package/dist/cli/services/tailwind.js +4 -3
- package/dist/cli/services/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/dist/cli/services/deploy/error.d.ts +0 -4
- package/dist/cli/services/deploy/error.js +0 -11
- package/dist/cli/services/deploy/error.js.map +0 -1
|
@@ -4,11 +4,11 @@ import { load as loadApp } from '../../../models/hydrogen.js';
|
|
|
4
4
|
import { Flags } from '@oclif/core';
|
|
5
5
|
import { globalFlags } from '@shopify/cli-kit/node/cli';
|
|
6
6
|
import Command from '@shopify/cli-kit/node/base-command';
|
|
7
|
-
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
7
|
+
import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
|
|
8
8
|
export default class AddESLint extends Command {
|
|
9
9
|
async run() {
|
|
10
10
|
const { flags: { path: pathFlag, install, force }, } = await this.parse(AddESLint);
|
|
11
|
-
const directory = pathFlag ? resolvePath(pathFlag) :
|
|
11
|
+
const directory = pathFlag ? resolvePath(pathFlag) : cwd();
|
|
12
12
|
const app = await loadApp(directory);
|
|
13
13
|
await addESLint({ app, install, force });
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../../../src/cli/commands/hydrogen/add/eslint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAC,IAAI,IAAI,OAAO,EAAc,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../../../src/cli/commands/hydrogen/add/eslint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAC,IAAI,IAAI,OAAO,EAAc,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,WAAW,EAAE,GAAG,EAAC,MAAM,4BAA4B,CAAA;AAE3D,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAarC,KAAK,CAAC,GAAG;QACd,MAAM,EACJ,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAC,GACxC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QAC/B,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;QAE1D,MAAM,GAAG,GAAgB,MAAM,OAAO,CAAC,SAAS,CAAC,CAAA;QAEjD,MAAM,SAAS,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC,CAAA;IACxC,CAAC;;AArBM,eAAK,GAAG;IACb,GAAG,WAAW;IACd,GAAG,aAAa;IAChB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kCAAkC;QAC/C,OAAO,EAAE,KAAK;QACd,GAAG,EAAE,oBAAoB;KAC1B,CAAC;CACH,CAAA","sourcesContent":["import {hydrogenFlags} from '../../../flags.js'\nimport {addESLint} from '../../../services/eslint.js'\nimport {load as loadApp, HydrogenApp} from '../../../models/hydrogen.js'\nimport {Flags} from '@oclif/core'\nimport {globalFlags} from '@shopify/cli-kit/node/cli'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {resolvePath, cwd} from '@shopify/cli-kit/node/path'\n\nexport default class AddESLint extends Command {\n static flags = {\n ...globalFlags,\n ...hydrogenFlags,\n force: Flags.boolean({\n hidden: false,\n char: 'f',\n description: 'Overwrite existing configuration',\n default: false,\n env: 'SHOPIFY_FLAG_FORCE',\n }),\n }\n\n public async run(): Promise<void> {\n const {\n flags: {path: pathFlag, install, force},\n } = await this.parse(AddESLint)\n const directory = pathFlag ? resolvePath(pathFlag) : cwd()\n\n const app: HydrogenApp = await loadApp(directory)\n\n await addESLint({app, install, force})\n }\n}\n"]}
|
|
@@ -4,11 +4,11 @@ import { load as loadApp } from '../../../models/hydrogen.js';
|
|
|
4
4
|
import { Flags } from '@oclif/core';
|
|
5
5
|
import { globalFlags } from '@shopify/cli-kit/node/cli';
|
|
6
6
|
import Command from '@shopify/cli-kit/node/base-command';
|
|
7
|
-
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
7
|
+
import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
|
|
8
8
|
export default class AddTailwind extends Command {
|
|
9
9
|
async run() {
|
|
10
10
|
const { flags: { path: pathFlag, install, force }, } = await this.parse(AddTailwind);
|
|
11
|
-
const directory = pathFlag ? resolvePath(pathFlag) :
|
|
11
|
+
const directory = pathFlag ? resolvePath(pathFlag) : cwd();
|
|
12
12
|
const app = await loadApp(directory);
|
|
13
13
|
await addTailwind({ app, directory, install, force });
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind.js","sourceRoot":"","sources":["../../../../../src/cli/commands/hydrogen/add/tailwind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAC,IAAI,IAAI,OAAO,EAAc,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oC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oBAAoB;KAC1B,CAAC;CACH,CAAA","sourcesContent":["import {hydrogenFlags} from '../../../flags.js'\nimport {addTailwind} from '../../../services/tailwind.js'\nimport {load as loadApp, HydrogenApp} from '../../../models/hydrogen.js'\nimport {Flags} from '@oclif/core'\nimport {globalFlags} from '@shopify/cli-kit/node/cli'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {resolvePath, cwd} from '@shopify/cli-kit/node/path'\n\nexport default class AddTailwind extends Command {\n static flags = {\n ...globalFlags,\n ...hydrogenFlags,\n force: Flags.boolean({\n hidden: false,\n char: 'f',\n description: 'overwrite existing configuration',\n default: false,\n env: 'SHOPIFY_FLAG_FORCE',\n }),\n }\n\n public async run(): Promise<void> {\n const {\n flags: {path: pathFlag, install, force},\n } = await this.parse(AddTailwind)\n const directory = pathFlag ? resolvePath(pathFlag) : cwd()\n\n const app: HydrogenApp = await loadApp(directory)\n\n await addTailwind({app, directory, install, force})\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { hydrogenFlags } from '../../flags.js';
|
|
|
3
3
|
import { Flags } from '@oclif/core';
|
|
4
4
|
import { globalFlags } from '@shopify/cli-kit/node/cli';
|
|
5
5
|
import Command from '@shopify/cli-kit/node/base-command';
|
|
6
|
-
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
6
|
+
import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
|
|
7
7
|
const PLATFORM_ENTRIES = {
|
|
8
8
|
node: `@shopify/hydrogen/platforms/node`,
|
|
9
9
|
worker: `@shopify/hydrogen/platforms/worker`,
|
|
@@ -11,7 +11,7 @@ const PLATFORM_ENTRIES = {
|
|
|
11
11
|
export default class Build extends Command {
|
|
12
12
|
async run() {
|
|
13
13
|
const { flags } = await this.parse(Build);
|
|
14
|
-
const directory = flags.path ? resolvePath(flags.path) :
|
|
14
|
+
const directory = flags.path ? resolvePath(flags.path) : cwd();
|
|
15
15
|
const entry = flags.entry || PLATFORM_ENTRIES[flags.target];
|
|
16
16
|
const targets = {
|
|
17
17
|
client: flags.client,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAA;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAA;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,WAAW,EAAE,GAAG,EAAC,MAAM,4BAA4B,CAAA;AAE3D,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,kCAAkC;IACxC,MAAM,EAAE,oCAAoC;CAC7C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IA4BxC,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACvC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;QAE9D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,gBAAgB,CAAC,KAAK,CAAC,MAA2B,CAAC,CAAA;QAEhF,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;YACjD,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;SAC9C,CAAA;QAED,MAAM,KAAK,CAAC,EAAC,GAAG,KAAK,EAAE,SAAS,EAAE,OAAO,EAAC,CAAC,CAAA;IAC7C,CAAC;;AAxCM,iBAAW,GAAG,8CAA8C,CAAA;AAC5D,WAAK,GAAG;IACb,GAAG,WAAW;IACd,IAAI,EAAE,aAAa,CAAC,IAAI;IACxB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,4CAA4C;QACzD,GAAG,EAAE,yBAAyB;KAC/B,CAAC;IACF,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC;QACpB,WAAW,EAAE,uBAAuB;QACpC,GAAG,EAAE,2BAA2B;QAChC,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;KACd,CAAC;IACF,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mDAAmD;QAChE,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;QAC3B,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,2BAA2B;KACjC,CAAC;IACF,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,iEAAiE;QAC9E,GAAG,EAAE,8BAA8B;KACpC,CAAC;CACH,CAAA","sourcesContent":["import {build} from '../../services/build.js'\nimport {hydrogenFlags} from '../../flags.js'\nimport {Flags} from '@oclif/core'\nimport {globalFlags} from '@shopify/cli-kit/node/cli'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {resolvePath, cwd} from '@shopify/cli-kit/node/path'\n\nconst PLATFORM_ENTRIES = {\n node: `@shopify/hydrogen/platforms/node`,\n worker: `@shopify/hydrogen/platforms/worker`,\n}\n\nexport default class Build extends Command {\n static description = 'Builds a Hydrogen storefront for production.'\n static flags = {\n ...globalFlags,\n path: hydrogenFlags.path,\n base: Flags.string({\n description: ' the public path when served in production',\n env: 'SHOPIFY_FLAG_BUILD_BASE',\n }),\n client: Flags.boolean({\n description: 'build the client code',\n env: 'SHOPIFY_FLAG_BUILD_CLIENT',\n allowNo: true,\n default: true,\n }),\n target: Flags.string({\n char: 't',\n description: 'the target platform to build for (worker or node)',\n options: ['node', 'worker'],\n default: 'worker',\n env: 'SHOPIFY_FLAG_BUILD_TARGET',\n }),\n entry: Flags.string({\n description: 'produce Server Side Rendering (SSR) build for node environments',\n env: 'SHOPIFY_FLAG_BUILD_SSR_ENTRY',\n }),\n }\n\n async run(): Promise<void> {\n const {flags} = await this.parse(Build)\n const directory = flags.path ? resolvePath(flags.path) : cwd()\n\n const entry = flags.entry || PLATFORM_ENTRIES[flags.target as 'node' | 'worker']\n\n const targets = {\n client: flags.client,\n worker: flags.target === 'worker' ? entry : false,\n node: flags.target === 'node' ? entry : false,\n }\n\n await build({...flags, directory, targets})\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import Command from '@shopify/cli-kit/node/base-command';
|
|
|
5
5
|
import { Flags } from '@oclif/core';
|
|
6
6
|
import { isShopify } from '@shopify/cli-kit/node/environment/local';
|
|
7
7
|
import { globalFlags } from '@shopify/cli-kit/node/cli';
|
|
8
|
-
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
8
|
+
import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
|
|
9
9
|
export default class Deploy extends Command {
|
|
10
10
|
async run() {
|
|
11
11
|
const isShopifolk = await isShopify();
|
|
@@ -14,7 +14,7 @@ export default class Deploy extends Command {
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
const { flags } = await this.parse(Deploy);
|
|
17
|
-
const dir = flags.path ? resolvePath(flags.path) :
|
|
17
|
+
const dir = flags.path ? resolvePath(flags.path) : cwd();
|
|
18
18
|
await deployToOxygen({ ...flags, path: dir });
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAA;AACvC,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAA;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAA;AACvC,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAA;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,WAAW,EAAE,GAAG,EAAC,MAAM,4BAA4B,CAAA;AAE3D,MAAM,CAAC,OAAO,OAAO,MAAO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AS,EAAE,KAAK,CAAC,OAAO,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,kCAAkC;QACvC,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,4FAA4F;KAC1G,CAAC;IACF,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC;QAC1B,MAAM,EAAE,IAAI;QACZ,GAAG,EAAE,sCAAsC;QAC3C,OAAO,EAAE,6BAA6B;KACvC,CAAC;CACH,CAAA","sourcesContent":["import {hydrogenFlags} from '../../flags.js'\nimport {deployToOxygen} from '../../services/deploy.js'\nimport {output} from '@shopify/cli-kit'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {Flags} from '@oclif/core'\nimport {isShopify} from '@shopify/cli-kit/node/environment/local'\nimport {globalFlags} from '@shopify/cli-kit/node/cli'\nimport {resolvePath, cwd} from '@shopify/cli-kit/node/path'\n\nexport default class Deploy extends Command {\n static description = 'Deploy your Hydrogen app to Oxygen hosting'\n static hidden = true\n\n static flags = {\n ...globalFlags,\n ...hydrogenFlags,\n deploymentToken: Flags.string({\n required: true,\n env: 'SHOPIFY_HYDROGEN_FLAG_DEPLOYMENT_TOKEN',\n description: 'Specify your Oxygen deployment token.',\n }),\n commitMessage: Flags.string({\n env: 'SHOPIFY_HYDROGEN_FLAG_COMMIT_MESSAGE',\n description: 'Override the default Git commit message.',\n }),\n commitAuthor: Flags.string({\n env: 'SHOPIFY_HYDROGEN_FLAG_COMMIT_AUTHOR',\n description: 'Override the default Git commit author.',\n }),\n pathToBuild: Flags.string({\n hidden: true,\n env: 'SHOPIFY_HYDROGEN_FLAG_PATH_TO_BUILD',\n description: 'Skip build process and use provided value as build',\n }),\n healthCheck: Flags.boolean({\n env: 'SHOPIFY_HYDROGEN_FLAG_HEALTH_CHECK',\n default: true,\n description: 'Require a health check before the deployment succeeds.',\n }),\n assumeYes: Flags.boolean({\n char: 'y',\n env: 'SHOPIFY_HYDROGEN_FLAG_ASSUME_YES',\n default: false,\n description: 'Automatic yes to prompts. Assume \"yes\" as answer to all prompts and run non-interactively.',\n }),\n oxygenAddress: Flags.string({\n hidden: true,\n env: 'SHOPIFY_HYDROGEN_FLAG_OXYGEN_ADDRESS',\n default: 'oxygen-dms.shopifycloud.com',\n }),\n }\n\n public async run(): Promise<void> {\n const isShopifolk = await isShopify()\n if (!isShopifolk) {\n output.warn('Command coming soon...')\n return\n }\n\n const {flags} = await this.parse(Deploy)\n const dir = flags.path ? resolvePath(flags.path) : cwd()\n\n await deployToOxygen({...flags, path: dir})\n }\n}\n"]}
|
|
@@ -3,11 +3,11 @@ import { hydrogenFlags } from '../../flags.js';
|
|
|
3
3
|
import { Flags } from '@oclif/core';
|
|
4
4
|
import { globalFlags } from '@shopify/cli-kit/node/cli';
|
|
5
5
|
import Command from '@shopify/cli-kit/node/base-command';
|
|
6
|
-
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
6
|
+
import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
|
|
7
7
|
export default class Dev extends Command {
|
|
8
8
|
async run() {
|
|
9
9
|
const { flags } = await this.parse(Dev);
|
|
10
|
-
const directory = flags.path ? resolvePath(flags.path) :
|
|
10
|
+
const directory = flags.path ? resolvePath(flags.path) : cwd();
|
|
11
11
|
await devService({ directory, ...flags, commandConfig: this.config });
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/dev.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3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,CAAA","sourcesContent":["import devService from '../../services/dev.js'\nimport {hydrogenFlags} from '../../flags.js'\nimport {Flags} from '@oclif/core'\nimport {globalFlags} from '@shopify/cli-kit/node/cli'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {resolvePath, cwd} from '@shopify/cli-kit/node/path'\n\nexport default class Dev extends Command {\n static description = 'Run a Hydrogen storefront locally for development.'\n static flags = {\n ...globalFlags,\n path: hydrogenFlags.path,\n force: Flags.boolean({\n description: 'force dependency pre-bundling.',\n env: 'SHOPIFY_FLAG_DEV_FORCE',\n }),\n host: Flags.boolean({\n description: 'listen on all addresses, including LAN and public addresses.',\n env: 'SHOPIFY_FLAG_DEV_HOST',\n }),\n open: Flags.boolean({\n description: 'automatically open the app in the browser',\n env: 'SHOPIFY_FLAG_DEV_OPEN',\n default: false,\n }),\n }\n\n async run(): Promise<void> {\n const {flags} = await this.parse(Dev)\n const directory = flags.path ? resolvePath(flags.path) : cwd()\n\n await devService({directory, ...flags, commandConfig: this.config})\n }\n}\n"]}
|
|
@@ -5,11 +5,11 @@ import { Flags } from '@oclif/core';
|
|
|
5
5
|
import { globalFlags } from '@shopify/cli-kit/node/cli';
|
|
6
6
|
import { output } from '@shopify/cli-kit';
|
|
7
7
|
import Command from '@shopify/cli-kit/node/base-command';
|
|
8
|
-
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
8
|
+
import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
|
|
9
9
|
export default class Info extends Command {
|
|
10
10
|
async run() {
|
|
11
11
|
const { flags } = await this.parse(Info);
|
|
12
|
-
const directory = flags.path ? resolvePath(flags.path) :
|
|
12
|
+
const directory = flags.path ? resolvePath(flags.path) : cwd();
|
|
13
13
|
const app = await loadApp(directory);
|
|
14
14
|
output.info(info(app, { showPrivateData: flags.showToken }));
|
|
15
15
|
if (app.errors)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/info.ts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,GAAgB,MAAM,OAAO,CAAC,SAAS,CAAC,CAAA;QAEjD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAC,eAAe,EAAE,KAAK,CAAC,SAAS,EAAC,CAAC,CAAC,CAAA;QAC1D,IAAI,GAAG,CAAC,MAAM;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjC,CAAC;;AApBM,gBAAW,GAAG,kDAAkD,CAAA;AAEhE,UAAK,GAAG;IACb,GAAG,WAAW;IACd,GAAG,aAAa;IAChB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC;QACvB,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,2BAA2B;QACxC,OAAO,EAAE,KAAK;QACd,GAAG,EAAE,kCAAkC;KACxC,CAAC;CACH,CAAA","sourcesContent":["import {info} from '../../services/info.js'\nimport {load as loadApp, HydrogenApp} from '../../models/hydrogen.js'\nimport {hydrogenFlags} from '../../flags.js'\nimport {Flags} from '@oclif/core'\nimport {globalFlags} from '@shopify/cli-kit/node/cli'\nimport {output} from '@shopify/cli-kit'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {resolvePath, cwd} from '@shopify/cli-kit/node/path'\n\nexport default class Info extends Command {\n static description = 'Print basic information about your hydrogen app.'\n\n static flags = {\n ...globalFlags,\n ...hydrogenFlags,\n showToken: Flags.boolean({\n hidden: false,\n description: 'Show storefront API token',\n default: false,\n env: 'SHOPIFY_HYDROGEN_FLAG_SHOW_TOKEN',\n }),\n }\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(Info)\n const directory = flags.path ? resolvePath(flags.path) : cwd()\n const app: HydrogenApp = await loadApp(directory)\n\n output.info(info(app, {showPrivateData: flags.showToken}))\n if (app.errors) process.exit(2)\n }\n}\n"]}
|
|
@@ -3,11 +3,11 @@ import { hydrogenFlags } from '../../flags.js';
|
|
|
3
3
|
import { Flags } from '@oclif/core';
|
|
4
4
|
import { globalFlags } from '@shopify/cli-kit/node/cli';
|
|
5
5
|
import Command from '@shopify/cli-kit/node/base-command';
|
|
6
|
-
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
6
|
+
import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
|
|
7
7
|
export default class Preview extends Command {
|
|
8
8
|
async run() {
|
|
9
9
|
const { flags } = await this.parse(Preview);
|
|
10
|
-
const directory = flags.path ? resolvePath(flags.path) :
|
|
10
|
+
const directory = flags.path ? resolvePath(flags.path) : cwd();
|
|
11
11
|
const port = parseInt(flags.port, 10);
|
|
12
12
|
const envPath = flags.env;
|
|
13
13
|
if (flags.target === 'worker') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAC,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../../src/cli/commands/hydrogen/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAC,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,WAAW,EAAE,GAAG,EAAC,MAAM,4BAA4B,CAAA;AAE3D,MAAM,CAAC,OAAO,OAAO,OAAQ,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MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yCAAyC;QACtD,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;QAC3B,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,6BAA6B;KACnC,CAAC;CACH,CAAA","sourcesContent":["import {previewInWorker, previewInNode} from '../../services/preview.js'\nimport {hydrogenFlags} from '../../flags.js'\nimport {Flags} from '@oclif/core'\nimport {globalFlags} from '@shopify/cli-kit/node/cli'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {resolvePath, cwd} from '@shopify/cli-kit/node/path'\n\nexport default class Preview extends Command {\n static description = 'Run a Hydrogen storefront locally in a worker environment.'\n static flags = {\n ...globalFlags,\n path: hydrogenFlags.path,\n port: Flags.string({\n char: 'p',\n hidden: true,\n description: 'the port to run the preview server on',\n default: '3000',\n env: 'SHOPIFY_FLAG_PORT',\n }),\n env: Flags.string({\n char: 'e',\n description: 'the file path to your .env',\n default: undefined,\n parse: (input, _) => Promise.resolve(resolvePath(input)),\n env: 'SHOPIFY_FLAG_ENV_PATH',\n }),\n target: Flags.string({\n char: 't',\n description: 'the target environment (worker or node)',\n options: ['node', 'worker'],\n default: 'worker',\n env: 'SHOPIFY_FLAG_PREVIEW_TARGET',\n }),\n }\n\n async run(): Promise<void> {\n const {flags} = await this.parse(Preview)\n const directory = flags.path ? resolvePath(flags.path) : cwd()\n const port = parseInt(flags.port, 10)\n const envPath = flags.env\n\n if (flags.target === 'worker') {\n await previewInWorker({directory, port, envPath})\n } else if (flags.target === 'node') {\n await previewInNode({directory, port})\n }\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { loadConfig } from '../utilities/load-config.js';
|
|
2
|
-
import { error as kitError } from '@shopify/cli-kit';
|
|
3
2
|
import { getDependencies, getPackageName, pnpmLockfile, yarnLockfile, } from '@shopify/cli-kit/node/node-package-manager';
|
|
4
3
|
import { joinPath, basename } from '@shopify/cli-kit/node/path';
|
|
5
4
|
import { fileExists } from '@shopify/cli-kit/node/fs';
|
|
5
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
6
6
|
class AppErrors {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.errors = {};
|
|
@@ -27,7 +27,7 @@ class HydrogenAppLoader {
|
|
|
27
27
|
}
|
|
28
28
|
async loaded() {
|
|
29
29
|
if (!(await fileExists(this.directory))) {
|
|
30
|
-
throw new
|
|
30
|
+
throw new AbortError(`Couldn't find directory ${this.directory}`);
|
|
31
31
|
}
|
|
32
32
|
const { configuration } = await this.loadConfig();
|
|
33
33
|
const yarnLockPath = joinPath(this.directory, yarnLockfile);
|
|
@@ -62,7 +62,7 @@ class HydrogenAppLoader {
|
|
|
62
62
|
return app;
|
|
63
63
|
}
|
|
64
64
|
async loadConfig() {
|
|
65
|
-
const abortError = new
|
|
65
|
+
const abortError = new AbortError(`Couldn't find hydrogen configuration file`);
|
|
66
66
|
try {
|
|
67
67
|
const config = await loadConfig({ root: this.directory });
|
|
68
68
|
if (!config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrogen.js","sourceRoot":"","sources":["../../../src/cli/models/hydrogen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"hydrogen.js","sourceRoot":"","sources":["../../../src/cli/models/hydrogen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AACtD,OAAO,EACL,eAAe,EACf,cAAc,EAEd,YAAY,EACZ,YAAY,GACb,MAAM,4CAA4C,CAAA;AACnD,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AAoBtD,MAAM,SAAS;IAA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M,UAAU,CAAA;SACjB;IACH,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,SAAiB;IAC1C,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAC,SAAS,EAAC,CAAC,CAAA;IAEjD,OAAO,MAAM,CAAC,MAAM,EAAE,CAAA;AACxB,CAAC","sourcesContent":["import {loadConfig} from '../utilities/load-config.js'\nimport {\n getDependencies,\n getPackageName,\n PackageManager,\n pnpmLockfile,\n yarnLockfile,\n} from '@shopify/cli-kit/node/node-package-manager'\nimport {joinPath, basename} from '@shopify/cli-kit/node/path'\nimport {fileExists} from '@shopify/cli-kit/node/fs'\nimport {AbortError} from '@shopify/cli-kit/node/error'\n/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-ignore\nimport type {HydrogenConfig} from '@shopify/hydrogen/config'\n/* eslint-enable @typescript-eslint/ban-ts-comment */\n\nexport interface HydrogenApp {\n name: string\n directory: string\n packageManager: PackageManager\n configuration: HydrogenConfig\n nodeDependencies: {[key: string]: string}\n language: 'JavaScript' | 'TypeScript'\n errors?: AppErrors\n}\n\ninterface AppLoaderConstructorArgs {\n directory: string\n}\n\nclass AppErrors {\n private errors: {\n [key: string]: string\n } = {}\n\n addError(path: string, message: string): void {\n this.errors[path] = message\n }\n\n getError(path: string) {\n return this.errors[path]\n }\n\n isEmpty() {\n return Object.keys(this.errors).length === 0\n }\n\n toJSON(): string[] {\n return Object.values(this.errors)\n }\n}\n\nclass HydrogenAppLoader {\n private directory: string\n private errors: AppErrors = new AppErrors()\n\n constructor({directory}: AppLoaderConstructorArgs) {\n this.directory = directory\n }\n\n async loaded() {\n if (!(await fileExists(this.directory))) {\n throw new AbortError(`Couldn't find directory ${this.directory}`)\n }\n\n const {configuration} = await this.loadConfig()\n\n const yarnLockPath = joinPath(this.directory, yarnLockfile)\n const yarnLockExists = await fileExists(yarnLockPath)\n const pnpmLockPath = joinPath(this.directory, pnpmLockfile)\n const pnpmLockExists = await fileExists(pnpmLockPath)\n const packageJSONPath = joinPath(this.directory, 'package.json')\n const name = await getPackageName(packageJSONPath)\n const nodeDependencies = await getDependencies(packageJSONPath)\n const tsConfigExists = await fileExists(joinPath(this.directory, 'tsconfig.json'))\n const language = tsConfigExists && nodeDependencies.typescript ? 'TypeScript' : 'JavaScript'\n\n let packageManager: PackageManager\n if (yarnLockExists) {\n packageManager = 'yarn'\n } else if (pnpmLockExists) {\n packageManager = 'pnpm'\n } else {\n packageManager = 'npm'\n }\n\n const app: HydrogenApp = {\n name: name ?? basename(this.directory),\n directory: this.directory,\n configuration,\n packageManager,\n nodeDependencies,\n language,\n }\n\n if (!this.errors.isEmpty()) app.errors = this.errors\n\n return app\n }\n\n async loadConfig() {\n const abortError = new AbortError(`Couldn't find hydrogen configuration file`)\n\n try {\n const config = await loadConfig({root: this.directory})\n\n if (!config) {\n throw abortError\n }\n\n return config\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n abortError.stack = error.stack\n throw abortError\n }\n }\n}\n\nexport async function load(directory: string): Promise<HydrogenApp> {\n const loader = new HydrogenAppLoader({directory})\n\n return loader.loaded()\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { checkLockfileStatus } from './build/check-lockfile.js';
|
|
2
2
|
import { build as viteBuild } from 'vite';
|
|
3
|
-
import { ui
|
|
3
|
+
import { ui } from '@shopify/cli-kit';
|
|
4
4
|
import { isUnitTest } from '@shopify/cli-kit/node/environment/local';
|
|
5
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
5
6
|
export function buildTaskList({ directory, targets, base, assetBaseURL, verbose }) {
|
|
6
7
|
const commonConfig = { base, root: directory };
|
|
7
8
|
return Object.entries(targets)
|
|
@@ -28,7 +29,7 @@ export function buildTaskList({ directory, targets, base, assetBaseURL, verbose
|
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
30
|
}
|
|
30
31
|
catch (error) {
|
|
31
|
-
const abortError = new
|
|
32
|
+
const abortError = new AbortError(error.message);
|
|
32
33
|
abortError.stack = error.stack;
|
|
33
34
|
throw abortError;
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/cli/services/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAC,KAAK,IAAI,SAAS,EAAC,MAAM,MAAM,CAAA;AACvC,OAAO,EAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/cli/services/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAC,KAAK,IAAI,SAAS,EAAC,MAAM,MAAM,CAAA;AACvC,OAAO,EAAC,EAAE,EAAC,MAAM,kBAAkB,CAAA;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AAYtD,MAAM,UAAU,aAAa,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAa;IACzF,MAAM,YAAY,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,CAAA;IAE5C,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAC3B,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACtB,KAAK,EAAE,YAAY,GAAG,OAAO;QAC7B,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;YACtB,IAAI,GAAG,KAAK,QAAQ,EAAE;gBACpB,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAA;aAC5B;YACD,IAAI,YAAY,EAAE;gBAChB,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,YAAY,CAAA;aACnD;YAED,IAAI;gBACF,MAAM,SAAS,CAAC;oBACd,GAAG,YAAY;oBACf,KAAK,EAAE;wBACL,MAAM,EAAE,QAAQ,GAAG,EAAE;wBACrB,GAAG,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;wBAClD,QAAQ,EAAE,GAAG,KAAK,QAAQ;qBAC3B;oBACD,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;iBACtC,CAAC,CAAA;gBACF,8DAA8D;aAC/D;YAAC,OAAO,KAAU,EAAE;gBACnB,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;gBAChD,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;gBAC9B,MAAM,UAAU,CAAA;aACjB;YAED,IAAI,CAAC,KAAK,GAAG,SAAS,GAAG,OAAO,CAAA;QAClC,CAAC;KACF,CAAC,CAAC,CAAA;AACP,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAmB;IAC7C,MAAM,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE5C,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAA;IAE1C,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAC,cAAc,EAAE,UAAU,EAAE,EAAC,CAAC,CAAA;IAE/D,MAAM,IAAI,CAAC,GAAG,EAAE,CAAA;AAClB,CAAC","sourcesContent":["import {checkLockfileStatus} from './build/check-lockfile.js'\nimport {build as viteBuild} from 'vite'\nimport {ui} from '@shopify/cli-kit'\nimport {isUnitTest} from '@shopify/cli-kit/node/environment/local'\nimport {AbortError} from '@shopify/cli-kit/node/error'\n\ntype Target = 'node' | 'client' | 'worker'\n\ninterface DevOptions {\n directory: string\n targets: {[key in Target]: boolean | string}\n base?: string\n assetBaseURL?: string\n verbose?: boolean\n}\n\nexport function buildTaskList({directory, targets, base, assetBaseURL, verbose}: DevOptions): ui.ListrTask[] {\n const commonConfig = {base, root: directory}\n\n return Object.entries(targets)\n .filter(([_, value]) => value)\n .map(([key, value]) => ({\n title: `Building ${key} code`,\n task: async (_, task) => {\n if (key === 'worker') {\n process.env.WORKER = 'true'\n }\n if (assetBaseURL) {\n process.env.HYDROGEN_ASSET_BASE_URL = assetBaseURL\n }\n\n try {\n await viteBuild({\n ...commonConfig,\n build: {\n outDir: `dist/${key}`,\n ssr: typeof value === 'string' ? value : undefined,\n manifest: key === 'client',\n },\n logLevel: verbose ? 'info' : 'silent',\n })\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const abortError = new AbortError(error.message)\n abortError.stack = error.stack\n throw abortError\n }\n\n task.title = `Built ${key} code`\n },\n }))\n}\n\nexport async function build(options: DevOptions) {\n await checkLockfileStatus(options.directory)\n\n const tasks = await buildTaskList(options)\n\n const list = ui.newListr(tasks, {rendererSilent: isUnitTest()})\n\n await list.run()\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gitInit } from '../../prompts/git-init.js';
|
|
2
|
-
import { error } from '@shopify/cli-kit';
|
|
3
2
|
import { addAllToGitFromDirectory, createGitCommit, createGitIgnore, ensureGitIsPresentOrAbort, ensureInsideGitDirectory, getHeadSymbolicRef, getLatestGitCommit, initializeGitRepository, OutsideGitDirectoryError, } from '@shopify/cli-kit/node/git';
|
|
4
3
|
import { resolvePath } from '@shopify/cli-kit/node/path';
|
|
4
|
+
import { AbortSilentError } from '@shopify/cli-kit/node/error';
|
|
5
5
|
const MINIMAL_GIT_IGNORE = {
|
|
6
6
|
system: ['.DS_Store'],
|
|
7
7
|
logs: ['logs', '*.log', 'npm-debug.log*', 'yarn-debug.log*', 'yarn-error.log*'],
|
|
@@ -29,7 +29,7 @@ export const initializeGit = async (config) => {
|
|
|
29
29
|
if (!config.assumeYes) {
|
|
30
30
|
const shouldGitInit = await gitInit();
|
|
31
31
|
if (!shouldGitInit)
|
|
32
|
-
throw new
|
|
32
|
+
throw new AbortSilentError();
|
|
33
33
|
}
|
|
34
34
|
await initializeGitRepository(config.path);
|
|
35
35
|
createGitIgnore(config.path, MINIMAL_GIT_IGNORE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAA;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAA;AACjD,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAElB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAE5D,MAAM,kBAAkB,GAAsB;IAC5C,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;IAC/E,OAAO,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC;IAChC,YAAY,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,CAAC;IAC9E,UAAU,EAAE,CAAC,eAAe,CAAC;IAC7B,WAAW,EAAE,CAAC,MAAM,EAAE,WA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M,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;QACtE,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,YAAY,CAAC,OAAO;QAC3D,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,YAAY,CAAC,WAAW;QAC7D,SAAS,EAAE,YAAY,CAAC,IAAI;QAC5B,SAAS,EAAE,YAAY,CAAC,IAAI;QAC5B,SAAS;KACV,CAAA;AACH,CAAC,CAAA","sourcesContent":["import {DeployConfig, ReqDeployConfig} from './types.js'\nimport {gitInit} from '../../prompts/git-init.js'\nimport {\n addAllToGitFromDirectory,\n createGitCommit,\n createGitIgnore,\n ensureGitIsPresentOrAbort,\n ensureInsideGitDirectory,\n getHeadSymbolicRef,\n getLatestGitCommit,\n GitIgnoreTemplate,\n initializeGitRepository,\n OutsideGitDirectoryError,\n} from '@shopify/cli-kit/node/git'\nimport {resolvePath} from '@shopify/cli-kit/node/path'\nimport {AbortSilentError} from '@shopify/cli-kit/node/error'\n\nconst MINIMAL_GIT_IGNORE: GitIgnoreTemplate = {\n system: ['.DS_Store'],\n logs: ['logs', '*.log', 'npm-debug.log*', 'yarn-debug.log*', 'yarn-error.log*'],\n testing: ['/coverage', '*.lcov'],\n dependencies: ['/node_modules', '.npm', '.yarn-integrity', '/.pnp', '.pnp.js'],\n typescript: ['*.tsbuildinfo'],\n environment: ['.env', '.env.test', '.env.local'],\n production: ['/dist'],\n}\n\nexport const validateProject = async (config: DeployConfig) => {\n await ensureGitIsPresentOrAbort()\n try {\n await ensureInsideGitDirectory(config.path)\n } catch (err: unknown) {\n if (err instanceof OutsideGitDirectoryError) {\n await initializeGit(config)\n } else {\n throw err\n }\n }\n}\n\nexport const initializeGit = async (config: DeployConfig) => {\n if (!config.assumeYes) {\n const shouldGitInit = await gitInit()\n if (!shouldGitInit) throw new AbortSilentError()\n }\n\n await initializeGitRepository(config.path)\n createGitIgnore(config.path, MINIMAL_GIT_IGNORE)\n await addAllToGitFromDirectory(config.path)\n await createGitCommit('Initial commit generated by Hydrogen', {directory: config.path})\n}\n\nexport const fillDeployConfig = async (config: DeployConfig): Promise<ReqDeployConfig> => {\n const [latestCommit, commitRef] = await Promise.all([\n getLatestGitCommit(config.path),\n getHeadSymbolicRef(config.path),\n ])\n\n return {\n ...config,\n pathToBuild: config.pathToBuild ? resolvePath(config.pathToBuild) : '',\n commitMessage: config.commitMessage ?? latestCommit.message,\n commitAuthor: config.commitAuthor ?? latestCommit.author_name,\n commitSha: latestCommit.hash,\n timestamp: latestCommit.date,\n commitRef,\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CreateDeploymentQuery, } from './graphql/create_deployment.js';
|
|
2
|
-
import { UnrecoverableError, WebPageNotAvailable, TooManyRequestsError } from './error.js';
|
|
3
2
|
import { UploadDeploymentQuery } from './graphql/upload_deployment.js';
|
|
4
3
|
import { zip } from '@shopify/cli-kit/node/archiver';
|
|
5
4
|
import { ClientError } from 'graphql-request';
|
|
6
5
|
import { uploadOxygenDeploymentFile, oxygenRequest } from '@shopify/cli-kit/node/api/oxygen';
|
|
7
6
|
import { inTemporaryDirectory, createFileReadStream } from '@shopify/cli-kit/node/fs';
|
|
8
7
|
import { fetch, formData } from '@shopify/cli-kit/node/http';
|
|
8
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
9
9
|
export const createDeployment = async (config) => {
|
|
10
10
|
const variables = {
|
|
11
11
|
input: {
|
|
@@ -20,16 +20,16 @@ export const createDeployment = async (config) => {
|
|
|
20
20
|
const response = await oxygenRequest(config.oxygenAddress, CreateDeploymentQuery, config.deploymentToken, variables);
|
|
21
21
|
if (response.createDeployment?.error) {
|
|
22
22
|
if (response.createDeployment.error.unrecoverable) {
|
|
23
|
-
throw
|
|
23
|
+
throw new AbortError(`Unrecoverable: ${response.createDeployment.error.debugInfo}`);
|
|
24
24
|
}
|
|
25
|
-
throw new
|
|
25
|
+
throw new AbortError(`Failed to create deployment. ${response.createDeployment.error.debugInfo}`);
|
|
26
26
|
}
|
|
27
27
|
return response.createDeployment;
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
30
|
if (error instanceof ClientError) {
|
|
31
31
|
if (error.response.status === 429) {
|
|
32
|
-
throw
|
|
32
|
+
throw new AbortError("You've made too many requests. Please try again later");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
throw error;
|
|
@@ -48,23 +48,23 @@ export const uploadDeployment = async (config, deploymentID) => {
|
|
|
48
48
|
const response = await uploadOxygenDeploymentFile(config.oxygenAddress, config.deploymentToken, form);
|
|
49
49
|
if (!response.ok) {
|
|
50
50
|
if (response.status === 429) {
|
|
51
|
-
throw
|
|
51
|
+
throw new AbortError("You've made too many requests. Please try again later");
|
|
52
52
|
}
|
|
53
53
|
if (response.status !== 200 && response.status !== 202) {
|
|
54
|
-
throw new
|
|
54
|
+
throw new AbortError(`Failed to upload deployment. ${await response.json()}`);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
deploymentData = (await response.json());
|
|
58
58
|
});
|
|
59
59
|
if (!deploymentData) {
|
|
60
|
-
throw new
|
|
60
|
+
throw new AbortError('Failed to upload deployment.');
|
|
61
61
|
}
|
|
62
62
|
const deploymentError = deploymentData.data?.uploadDeployment?.error;
|
|
63
63
|
if (deploymentError) {
|
|
64
64
|
if (deploymentError.unrecoverable) {
|
|
65
|
-
throw
|
|
65
|
+
throw new AbortError(`Unrecoverable: ${deploymentError.debugInfo}`);
|
|
66
66
|
}
|
|
67
|
-
throw new
|
|
67
|
+
throw new AbortError(`Failed to upload deployment: ${deploymentError.debugInfo}`);
|
|
68
68
|
}
|
|
69
69
|
return deploymentData.data.uploadDeployment.deployment.previewURL;
|
|
70
70
|
};
|
|
@@ -72,7 +72,7 @@ export const healthCheck = async (pingUrl) => {
|
|
|
72
72
|
const url = `${pingUrl}/__health`;
|
|
73
73
|
const result = await fetch(url, { method: 'GET' });
|
|
74
74
|
if (result.status !== 200)
|
|
75
|
-
throw
|
|
75
|
+
throw new AbortError('Web page not available.');
|
|
76
76
|
};
|
|
77
77
|
const buildOperationsString = (deploymentID) => {
|
|
78
78
|
return JSON.stringify({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/upload.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,qBAAqB,GACtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/upload.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,qBAAqB,GACtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAC,GAAG,EAAC,MAAM,gCAAgC,CAAA;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAC,0BAA0B,EAAE,aAAa,EAAC,MAAM,kCAAkC,CAAA;AAC1F,OAAO,EAAC,oBAAoB,EAAE,oBAAoB,EAAC,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAuB,EAAqC,EAAE;IACnG,MAAM,SAAS,GAAG;QAChB,KAAK,EAAE;YACL,MAAM,EAAE,MAAM,CAAC,SAAS;YACxB,UAAU,EAAE,MAAM,CAAC,SAAS;YAC5B,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,eAAe,EAAE,MAAM,CAAC,SAAS;SAClC;KACF,CAAA;IAED,IAAI;QACF,MAAM,QAAQ,GAAgC,MAAM,aAAa,CAC/D,MAAM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C,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,GAAG,OAAO,WAAW,CAAA;IACjC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAA;IAChD,IAAI,MAAM,CAAC,MAAM,KAAK,GAAG;QAAE,MAAM,IAAI,UAAU,CAAC,yBAAyB,CAAC,CAAA;AAC5E,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,YAAoB,EAAU,EAAE;IAC7D,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,KAAK,EAAE,qBAAqB;QAC5B,SAAS,EAAE,EAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAC;KACtC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {ReqDeployConfig, UploadDeploymentResponse} from './types.js'\nimport {\n CreateDeploymentResponse,\n CreateDeploymentQuerySchema,\n CreateDeploymentQuery,\n} from './graphql/create_deployment.js'\nimport {UploadDeploymentQuery} from './graphql/upload_deployment.js'\nimport {zip} from '@shopify/cli-kit/node/archiver'\nimport {ClientError} from 'graphql-request'\nimport {uploadOxygenDeploymentFile, oxygenRequest} from '@shopify/cli-kit/node/api/oxygen'\nimport {inTemporaryDirectory, createFileReadStream} from '@shopify/cli-kit/node/fs'\nimport {fetch, formData} from '@shopify/cli-kit/node/http'\nimport {AbortError} from '@shopify/cli-kit/node/error'\n\nexport const createDeployment = async (config: ReqDeployConfig): Promise<CreateDeploymentResponse> => {\n const variables = {\n input: {\n branch: config.commitRef,\n commitHash: config.commitSha,\n commitAuthor: config.commitAuthor,\n commitMessage: config.commitMessage,\n commitTimestamp: config.timestamp,\n },\n }\n\n try {\n const response: CreateDeploymentQuerySchema = await oxygenRequest(\n config.oxygenAddress,\n CreateDeploymentQuery,\n config.deploymentToken,\n variables,\n )\n\n if (response.createDeployment?.error) {\n if (response.createDeployment.error.unrecoverable) {\n throw new AbortError(`Unrecoverable: ${response.createDeployment.error.debugInfo}`)\n }\n\n throw new AbortError(`Failed to create deployment. ${response.createDeployment.error.debugInfo}`)\n }\n\n return response.createDeployment\n } catch (error) {\n if (error instanceof ClientError) {\n if (error.response.status === 429) {\n throw new AbortError(\"You've made too many requests. Please try again later\")\n }\n }\n\n throw error\n }\n}\n\nexport const uploadDeployment = async (config: ReqDeployConfig, deploymentID: string): Promise<string> => {\n let deploymentData: UploadDeploymentResponse | undefined\n\n await inTemporaryDirectory(async (tmpDir) => {\n const distPath = config.pathToBuild ? config.pathToBuild : `${config.path}/dist`\n const distZipPath = `${tmpDir}/dist.zip`\n await zip(distPath, distZipPath)\n\n const form = formData()\n form.append('operations', buildOperationsString(deploymentID))\n form.append('map', JSON.stringify({'0': ['variables.file']}))\n form.append('0', createFileReadStream(distZipPath), {filename: distZipPath})\n\n const response = await uploadOxygenDeploymentFile(config.oxygenAddress, config.deploymentToken, form)\n if (!response.ok) {\n if (response.status === 429) {\n throw new AbortError(\"You've made too many requests. Please try again later\")\n }\n if (response.status !== 200 && response.status !== 202) {\n throw new AbortError(`Failed to upload deployment. ${await response.json()}`)\n }\n }\n\n deploymentData = (await response.json()) as UploadDeploymentResponse\n })\n\n if (!deploymentData) {\n throw new AbortError('Failed to upload deployment.')\n }\n const deploymentError = deploymentData.data?.uploadDeployment?.error\n if (deploymentError) {\n if (deploymentError.unrecoverable) {\n throw new AbortError(`Unrecoverable: ${deploymentError.debugInfo}`)\n }\n\n throw new AbortError(`Failed to upload deployment: ${deploymentError.debugInfo}`)\n }\n\n return deploymentData.data.uploadDeployment.deployment.previewURL\n}\n\nexport const healthCheck = async (pingUrl: string) => {\n const url = `${pingUrl}/__health`\n const result = await fetch(url, {method: 'GET'})\n if (result.status !== 200) throw new AbortError('Web page not available.')\n}\n\nconst buildOperationsString = (deploymentID: string): string => {\n return JSON.stringify({\n query: UploadDeploymentQuery,\n variables: {deploymentID, file: null},\n })\n}\n"]}
|
package/dist/cli/services/dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { checkHydrogenVersion } from './dev/check-version.js';
|
|
2
2
|
import { createServer } from 'vite';
|
|
3
|
-
import { error as kitError } from '@shopify/cli-kit';
|
|
4
3
|
import { reportAnalyticsEvent } from '@shopify/cli-kit/node/analytics';
|
|
4
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
5
5
|
async function dev({ commandConfig, directory, force, host, open }) {
|
|
6
6
|
try {
|
|
7
7
|
await checkHydrogenVersion(directory);
|
|
@@ -21,7 +21,7 @@ async function dev({ commandConfig, directory, force, host, open }) {
|
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
const abortError = new
|
|
24
|
+
const abortError = new AbortError(error.message);
|
|
25
25
|
abortError.stack = error.stack;
|
|
26
26
|
throw abortError;
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/cli/services/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,YAAY,EAAgB,MAAM,MAAM,CAAA;AAChD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/cli/services/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,YAAY,EAAgB,MAAM,MAAM,CAAA;AAChD,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AAUtD,KAAK,UAAU,GAAG,CAAC,EAAC,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAa;IAC1E,IAAI;QACF,MAAM,oBAAoB,CAAC,SAAS,CAAC,CAAA;QAErC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;YAChC,IAAI,EAAE,SAAS;YACf,MAAM,EAAE;gBACN,IAAI;gBACJ,KAAK;gBACL,IAAI;aACL;SACF,CAAC,CAAA;QACF,MAAM,MAAM,CAAC,MAAM,EAAE,CAAA;QACrB,MAAM,CAAC,SAAS,EAAE,CAAA;QAClB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC7B,MAAM,oBAAoB,CAAC,EAAC,MAAM,EAAE,aAAa,EAAC,CAAC,CAAA;QACnD,MAAM,UAAU,CAAC,MAAM,CAAC,CAAA;QACxB,8DAA8D;KAC/D;IAAC,OAAO,KAAU,EAAE;QACnB,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAChD,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QAC9B,MAAM,UAAU,CAAA;KACjB;AACH,CAAC;AAED,SAAS,UAAU,CAAC,MAAqB;IACvC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACzB,OAAO,OAAO,EAAE,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,eAAe,GAAG,CAAA","sourcesContent":["import {checkHydrogenVersion} from './dev/check-version.js'\nimport {createServer, ViteDevServer} from 'vite'\nimport {reportAnalyticsEvent} from '@shopify/cli-kit/node/analytics'\nimport {Config} from '@oclif/core'\nimport {AbortError} from '@shopify/cli-kit/node/error'\n\ninterface DevOptions {\n commandConfig: Config\n directory: string\n force: boolean\n host: boolean\n open: boolean\n}\n\nasync function dev({commandConfig, directory, force, host, open}: DevOptions) {\n try {\n await checkHydrogenVersion(directory)\n\n const server = await createServer({\n root: directory,\n server: {\n open,\n force,\n host,\n },\n })\n await server.listen()\n server.printUrls()\n server.config.logger.info('')\n await reportAnalyticsEvent({config: commandConfig})\n await closeEvent(server)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const abortError = new AbortError(error.message)\n abortError.stack = error.stack\n throw abortError\n }\n}\n\nfunction closeEvent(server: ViteDevServer): Promise<void> {\n return new Promise((resolve) => {\n server.ws.on('close', () => {\n return resolve()\n })\n })\n}\n\nexport default dev\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { genericConfigurationFileNames } from '../constants.js';
|
|
2
|
-
import { ui
|
|
2
|
+
import { ui } from '@shopify/cli-kit';
|
|
3
3
|
import { addNPMDependenciesWithoutVersionIfNeeded, findUpAndReadPackageJson, writePackageJSON, } from '@shopify/cli-kit/node/node-package-manager';
|
|
4
4
|
import { addRecommendedExtensions, isVSCode } from '@shopify/cli-kit/node/vscode';
|
|
5
5
|
import { isUnitTest } from '@shopify/cli-kit/node/environment/local';
|
|
6
6
|
import { writeFile, fileExists, removeFile, fileContentPrettyFormat } from '@shopify/cli-kit/node/fs';
|
|
7
7
|
import { joinPath } from '@shopify/cli-kit/node/path';
|
|
8
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
8
9
|
import stream from 'stream';
|
|
9
10
|
export async function addESLint({ app, force, install }) {
|
|
10
11
|
const list = ui.newListr([
|
|
@@ -42,7 +43,7 @@ export async function addESLint({ app, force, install }) {
|
|
|
42
43
|
await removeFile(eslintConfigPath);
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
|
-
throw new
|
|
46
|
+
throw new AbortError('ESLint config already exists.', 'Use --force to override existing config.');
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
const extended = [`'plugin:hydrogen/recommended'`];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../src/cli/services/eslint.ts"],"names":[],"mappings":"AACA,OAAO,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C,IAAI,EAAE,6BAA6B,CAAC,MAAM,EAAC,CAC7C,CAAA;gBAED,MAAM,SAAS,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAA;gBAE/C,IAAI,CAAC,KAAK,GAAG,4BAA4B,CAAA;YAC3C,CAAC;SACF;QACD;YACE,KAAK,EAAE,uBAAuB;YAC9B,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;gBACtB,MAAM,WAAW,GAAG,CAAC,MAAM,wBAAwB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAA;gBAC3E,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,IAAI,EAAE,CAAA;gBAC/C,WAAW,CAAC,OAAO,CAAC,IAAI,GAAG,qCAAqC,CAAA;gBAEhE,WAAW,CAAC,QAAQ,GAAG,0BAA0B,CAAA;gBAEjD,MAAM,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;gBAElD,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAA;YACrC,CAAC;SACF;QACD;YACE,KAAK,EAAE,sCAAsC;YAC7C,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAClD,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;gBACtB,MAAM,wBAAwB,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAA;gBACzE,IAAI,CAAC,KAAK,GAAG,qCAAqC,CAAA;YACpD,CAAC;SACF;KACF,EACD,EAAC,cAAc,EAAE,UAAU,EAAE,EAAC,CAC/B,CAAA;IACD,MAAM,IAAI,CAAC,GAAG,EAAE,CAAA;AAClB,CAAC","sourcesContent":["import {HydrogenApp} from '../models/hydrogen.js'\nimport {genericConfigurationFileNames} from '../constants.js'\nimport {ui} from '@shopify/cli-kit'\nimport {\n addNPMDependenciesWithoutVersionIfNeeded,\n findUpAndReadPackageJson,\n writePackageJSON,\n} from '@shopify/cli-kit/node/node-package-manager'\nimport {addRecommendedExtensions, isVSCode} from '@shopify/cli-kit/node/vscode'\nimport {isUnitTest} from '@shopify/cli-kit/node/environment/local'\nimport {writeFile, fileExists, removeFile, fileContentPrettyFormat} from '@shopify/cli-kit/node/fs'\nimport {joinPath} from '@shopify/cli-kit/node/path'\nimport {AbortError} from '@shopify/cli-kit/node/error'\nimport stream from 'stream'\n\ninterface AddESlintOptions {\n app: HydrogenApp\n force: boolean\n install: boolean\n}\n\nexport async function addESLint({app, force, install}: AddESlintOptions) {\n const list = ui.newListr(\n [\n {\n title: 'Installing additional dependencies',\n skip: () => !install,\n task: async (_, task) => {\n const requiredDependencies = ['eslint', 'eslint-plugin-hydrogen', 'prettier', '@shopify/prettier-config']\n await addNPMDependenciesWithoutVersionIfNeeded(requiredDependencies, {\n packageManager: app.packageManager,\n type: 'prod',\n directory: app.directory,\n stderr: new stream.Writable({\n write(chunk, encoding, next) {\n task.output = chunk.toString()\n next()\n },\n }),\n stdout: new stream.Writable({\n write(chunk, encoding, next) {\n task.output = chunk.toString()\n next()\n },\n }),\n })\n task.title = 'Dependencies installed'\n },\n },\n\n {\n title: 'Adding ESLint configuration',\n task: async (_, task) => {\n const eslintConfigPath = joinPath(app.directory, genericConfigurationFileNames.eslint)\n\n if (await fileExists(eslintConfigPath)) {\n if (force) {\n await removeFile(eslintConfigPath)\n } else {\n throw new AbortError('ESLint config already exists.', 'Use --force to override existing config.')\n }\n }\n\n const extended = [`'plugin:hydrogen/recommended'`]\n\n if (app.language === 'TypeScript') {\n extended.push(`'plugin:hydrogen/typescript'`)\n }\n\n const eslintConfig = await fileContentPrettyFormat(\n ['module.exports = {', 'extends: [', `${extended.join(',')}`, ' ],', ' };'].join('\\n'),\n {path: genericConfigurationFileNames.eslint},\n )\n\n await writeFile(eslintConfigPath, eslintConfig)\n\n task.title = 'ESLint configuration added'\n },\n },\n {\n title: 'Updating package.json',\n task: async (_, task) => {\n const packageJSON = (await findUpAndReadPackageJson(app.directory)).content\n packageJSON.scripts = packageJSON.scripts || {}\n packageJSON.scripts.lint = `eslint --ext .js,.ts,.jsx,.tsx src/`\n\n packageJSON.prettier = '@shopify/prettier-config'\n\n await writePackageJSON(app.directory, packageJSON)\n\n task.title = 'Package.json updated'\n },\n },\n {\n title: 'Adding editor plugin recommendations',\n skip: async () => !(await isVSCode(app.directory)),\n task: async (_, task) => {\n await addRecommendedExtensions(app.directory, ['dbaeumer.vscode-eslint'])\n task.title = 'Editor plugin recommendations added'\n },\n },\n ],\n {rendererSilent: isUnitTest()},\n )\n await list.run()\n}\n"]}
|