@shopify/oxygen-cli 1.0.2 → 1.2.0

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/README.md CHANGED
@@ -41,6 +41,7 @@ oxygen:deploy [options]
41
41
  - -a, --assetsFolder <assetsFolder>: Assets folder (default: `dist/client/`).
42
42
  - -o, --workerOnly: Worker only deployment.
43
43
  - -s, --skipBuild: Skip running build command.
44
+ - -p, --publicDeployment: set the deployment to be publicly accessible.
44
45
  - -b, --buildCommand <buildCommand>: Build command (default: `yarn build`).
45
46
  - --metadataUrl <metadataUrl>: URL that links to the deployment.
46
47
  - --metadataUser <metadataUser>: User that initiated the deployment.
@@ -14,6 +14,7 @@ declare class Deploy extends Command {
14
14
  workerOnly: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
15
15
  skipBuild: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
16
16
  buildCommand: _oclif_core_lib_interfaces_parser_js.OptionFlag<string, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
17
+ publicDeployment: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
17
18
  metadataUrl: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
18
19
  metadataUser: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
19
20
  metadataVersion: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
@@ -59,6 +59,13 @@ class Deploy extends Command {
59
59
  return Promise.resolve(input);
60
60
  }
61
61
  }),
62
+ publicDeployment: Flags.boolean({
63
+ char: "p",
64
+ env: "OXYGEN_PUBLIC_DEPLOYMENT",
65
+ description: "Marks a preview deployment as publicly accessible.",
66
+ required: false,
67
+ default: false
68
+ }),
62
69
  metadataUrl: Flags.string({
63
70
  description: "URL that links to the deployment",
64
71
  required: false,
@@ -94,6 +101,7 @@ class Deploy extends Command {
94
101
  user: flags.metadataUser,
95
102
  version: flags.metadataVersion
96
103
  },
104
+ publicDeployment: flags.publicDeployment,
97
105
  rootPath: normalizePath(flags.rootPath),
98
106
  skipBuild: flags.skipBuild,
99
107
  workerDir: normalizePath(flags.workerFolder),
@@ -9,7 +9,8 @@ async function deploymentInitiate(config, input) {
9
9
  buildId: input.buildId,
10
10
  environment: input.environment,
11
11
  files: input.manifest,
12
- labels: input.labels
12
+ labels: input.labels,
13
+ isPrivate: !config.publicDeployment
13
14
  };
14
15
  try {
15
16
  const response = await graphqlRequest({
@@ -1,6 +1,6 @@
1
1
  import { OxygenError } from '../types.js';
2
2
 
3
- declare const DeploymentInitiateQuery = "\n mutation DeploymentInitiate($buildId: ID, $environment: EnvironmentSelectorInput, $labels: [String!], $files: [FileInput!]!) {\n deploymentInitiate(buildId: $buildId, environment: $environment, labels: $labels, files: $files) {\n deployment {\n id\n status\n }\n deploymentTargets {\n filePath\n fileSize\n uploadUrl\n fileType\n parameters {\n name\n value\n }\n }\n userErrors {\n message\n }\n }\n }\n";
3
+ declare const DeploymentInitiateQuery = "\n mutation DeploymentInitiate($buildId: ID, $environment: EnvironmentSelectorInput, $labels: [String!], $files: [FileInput!]!, $isPrivate: Boolean) {\n deploymentInitiate(buildId: $buildId, environment: $environment, labels: $labels, files: $files, isPrivate: $isPrivate) {\n deployment {\n id\n status\n }\n deploymentTargets {\n filePath\n fileSize\n uploadUrl\n fileType\n parameters {\n name\n value\n }\n }\n userErrors {\n message\n }\n }\n }\n";
4
4
  interface DeploymentInitiateQueryData {
5
5
  deploymentInitiate: DeploymentInitiateResponse;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  const DeploymentInitiateQuery = `
2
- mutation DeploymentInitiate($buildId: ID, $environment: EnvironmentSelectorInput, $labels: [String!], $files: [FileInput!]!) {
3
- deploymentInitiate(buildId: $buildId, environment: $environment, labels: $labels, files: $files) {
2
+ mutation DeploymentInitiate($buildId: ID, $environment: EnvironmentSelectorInput, $labels: [String!], $files: [FileInput!]!, $isPrivate: Boolean) {
3
+ deploymentInitiate(buildId: $buildId, environment: $environment, labels: $labels, files: $files, isPrivate: $isPrivate) {
4
4
  deployment {
5
5
  id
6
6
  status
@@ -40,8 +40,10 @@ async function createDeploy(config) {
40
40
  config,
41
41
  deployment.deployment.id
42
42
  );
43
+ const urlMessage = config.publicDeployment ? "Public" : "Private";
43
44
  outputSuccess(
44
- `Deployment complete: ${deploymentCompleteOp.deployment.url}`
45
+ `Deployment complete.
46
+ ${urlMessage} preview URL: ${deploymentCompleteOp.deployment.url}`
45
47
  );
46
48
  } catch (error) {
47
49
  if (!(error instanceof Error)) {
@@ -16,6 +16,7 @@ interface DeployConfig {
16
16
  version?: string;
17
17
  url?: string;
18
18
  };
19
+ publicDeployment: boolean;
19
20
  rootPath?: string;
20
21
  skipBuild: boolean;
21
22
  workerDir?: string;
@@ -18,6 +18,7 @@ function createTestConfig(rootFolder) {
18
18
  deploymentUrl: "https://localhost:3000",
19
19
  metadata: {},
20
20
  rootPath: rootFolder,
21
+ publicDeployment: false,
21
22
  skipBuild: false,
22
23
  workerDir: "/worker/",
23
24
  workerOnly: false
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.2",
2
+ "version": "1.2.0",
3
3
  "commands": {
4
4
  "oxygen:deploy": {
5
5
  "id": "oxygen:deploy",
@@ -79,6 +79,14 @@
79
79
  "multiple": false,
80
80
  "default": "yarn build"
81
81
  },
82
+ "publicDeployment": {
83
+ "name": "publicDeployment",
84
+ "type": "boolean",
85
+ "char": "p",
86
+ "description": "Marks a preview deployment as publicly accessible.",
87
+ "required": false,
88
+ "allowNo": false
89
+ },
82
90
  "metadataUrl": {
83
91
  "name": "metadataUrl",
84
92
  "type": "option",
package/package.json CHANGED
@@ -5,10 +5,11 @@
5
5
  "@shopify:registry": "https://registry.npmjs.org"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "1.0.2",
8
+ "version": "1.2.0",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "build": "tsup --clean --config ./tsup.config.ts && oclif manifest",
12
+ "changesets:check": "changeset status",
12
13
  "dev": "tsup --watch --config ./tsup.config.ts",
13
14
  "typecheck": "tsc --noEmit",
14
15
  "lint": "eslint --ext .js,.ts --max-warnings 0 src",