@zuplo/cli 1.119.0 → 1.121.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.
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="42cac298-fcf2-5562-897a-c038f723b42f")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="be0ac435-2dd7-5dd2-8b70-531169e83b20")}catch(e){}}();
3
3
  export {};
4
4
  //# sourceMappingURL=lib.js.map
5
- //# debugId=42cac298-fcf2-5562-897a-c038f723b42f
5
+ //# debugId=be0ac435-2dd7-5dd2-8b70-531169e83b20
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="73d10b24-273b-5673-84fb-1a5d0cf42473")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="925b9d73-a4de-58c0-8f9c-d757c8155db7")}catch(e){}}();
3
3
  import dotenv from "dotenv";
4
4
  import { cpSync, existsSync, readFileSync } from "node:fs";
5
5
  import { join, relative, resolve } from "node:path";
@@ -37,10 +37,11 @@ export async function compile(argv) {
37
37
  ZUPLO_PROJECT_NAME: envZuplo.ZUPLO_PROJECT_NAME,
38
38
  ZUPLO_ENVIRONMENT_TYPE: envZuplo.ZUPLO_ENVIRONMENT_TYPE,
39
39
  }
40
- : {},
40
+ :
41
+ undefined,
41
42
  });
42
43
  printDiagnosticsToConsole("📦 Compiled a self-contained zup binary");
43
44
  printDiagnosticsToConsole(`The binary is available at ${sourceDirectory}/dist/${argv["binary-name"]}`);
44
45
  }
45
46
  //# sourceMappingURL=handler.js.map
46
- //# debugId=73d10b24-273b-5673-84fb-1a5d0cf42473
47
+ //# debugId=925b9d73-a4de-58c0-8f9c-d757c8155db7
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5bca5e0a-7dea-5646-b573-80529e630b6e")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="249e5ca0-cf2e-5cef-a5c8-0d053825f965")}catch(e){}}();
3
3
  import dotenv from "dotenv";
4
4
  import { cpSync, existsSync, readFileSync } from "node:fs";
5
5
  import { join, relative, resolve } from "node:path";
@@ -23,7 +23,7 @@ export async function dev(argv) {
23
23
  if (existsSync(envFile)) {
24
24
  loadedEnvFiles.push(".env");
25
25
  }
26
- let envZuplo = {};
26
+ let envZuplo;
27
27
  const envZuploFile = join(sourceDirectory, ".env.zuplo");
28
28
  if (existsSync(envZuploFile)) {
29
29
  const contents = readFileSync(envZuploFile);
@@ -34,6 +34,7 @@ export async function dev(argv) {
34
34
  build_assets_url: pathToFileURL(sourceDirectory),
35
35
  };
36
36
  process.env.__ZUPLO_CONFIG = btoa(JSON.stringify(config));
37
+ process.env.ZUPLO_IS_LOCAL_DEVELOPMENT = "true";
37
38
  const core = await import("@zuplo/core");
38
39
  const zupPort = argv.port;
39
40
  const zupEditorPort = argv.editorPort;
@@ -62,7 +63,8 @@ export async function dev(argv) {
62
63
  ZUPLO_PROJECT_NAME: envZuplo.ZUPLO_PROJECT_NAME,
63
64
  ZUPLO_ENVIRONMENT_TYPE: envZuplo.ZUPLO_ENVIRONMENT_TYPE,
64
65
  }
65
- : {},
66
+ :
67
+ undefined,
66
68
  });
67
69
  let editor;
68
70
  if (argv["start-editor"]) {
@@ -100,4 +102,4 @@ export async function dev(argv) {
100
102
  });
101
103
  }
102
104
  //# sourceMappingURL=handler.js.map
103
- //# debugId=5bca5e0a-7dea-5646-b573-80529e630b6e
105
+ //# debugId=249e5ca0-cf2e-5cef-a5c8-0d053825f965
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ad2554cf-74a8-5032-b89f-1ffefcd558f0")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ed7a03fb-41e9-565b-95ab-4e4d54930128")}catch(e){}}();
3
3
  import { select } from "@inquirer/prompts";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import { join } from "node:path";
@@ -9,10 +9,26 @@ import { printCriticalFailureToConsoleAndExit, printResultToConsoleAndExitGracef
9
9
  import settings from "../common/settings.js";
10
10
  import { ZUPLO_XDG_STATE_HOME } from "../common/xdg/lib.js";
11
11
  import { pullSystemConfig, safeMergeConfig } from "./populate.js";
12
+ function prettyPrintEnvironmentPrompt(env) {
13
+ const name = env.name;
14
+ let environmentType = env.environmentType.toLowerCase();
15
+ let branchName = env.branchName;
16
+ switch (environmentType) {
17
+ case "working-copy":
18
+ case "working_copy":
19
+ environmentType = "development";
20
+ branchName = "(via portal.zuplo.com)";
21
+ break;
22
+ }
23
+ return `${env.name} (${environmentType}, ${branchName})`;
24
+ }
12
25
  export async function link(argv) {
13
- const rawAuth = await readFile(join(ZUPLO_XDG_STATE_HOME, ZUPLO_AUTH_FILE_NAME), "utf-8");
14
- const authJson = JSON.parse(rawAuth);
15
26
  let environment = argv.environment;
27
+ let authJson = undefined;
28
+ if (!environment) {
29
+ const rawAuth = await readFile(join(ZUPLO_XDG_STATE_HOME, ZUPLO_AUTH_FILE_NAME), "utf-8");
30
+ authJson = JSON.parse(rawAuth);
31
+ }
16
32
  let account = argv.account;
17
33
  if (!environment && !account) {
18
34
  const accountResponse = await fetch(`${settings.ZUPLO_API_ENDPOINT}/v1/accounts`, {
@@ -88,17 +104,33 @@ export async function link(argv) {
88
104
  },
89
105
  });
90
106
  const environmentJsonFromDeveloperAPI = (await environmentResponseFromDeveloperAPI.json());
91
- const environments = Object.assign({}, environmentJsonFromZuploAPI.data.map((env) => env.name), environmentJsonFromDeveloperAPI.data.map((env) => env.name));
92
- if (environments.length === 1) {
93
- environment = environments[0];
107
+ const environments = Object.assign({}, environmentJsonFromZuploAPI.data
108
+ .map((env) => {
109
+ return {
110
+ [prettyPrintEnvironmentPrompt(env)]: env.name,
111
+ };
112
+ })
113
+ .reduce((acc, curr) => {
114
+ return { ...acc, ...curr };
115
+ }), environmentJsonFromDeveloperAPI.data
116
+ .map((env) => {
117
+ return {
118
+ [prettyPrintEnvironmentPrompt(env)]: env.name,
119
+ };
120
+ })
121
+ .reduce((acc, curr) => {
122
+ return { ...acc, ...curr };
123
+ }));
124
+ if (Object.values(environments).length === 1) {
125
+ environment = Object.values(environments)[0];
94
126
  }
95
127
  else {
96
128
  environment = await select({
97
129
  message: "Select the environment to work with",
98
- choices: Object.values(environments).map((env) => {
130
+ choices: Object.entries(environments).map(([key, value]) => {
99
131
  return {
100
- name: env,
101
- value: env,
132
+ name: key,
133
+ value,
102
134
  };
103
135
  }),
104
136
  });
@@ -114,4 +146,4 @@ Successfully linked your local directory to the ${project} project in the ${acco
114
146
  .env.zuplo and zuplo.jsonc have been updated with the new values.`);
115
147
  }
116
148
  //# sourceMappingURL=handler.js.map
117
- //# debugId=ad2554cf-74a8-5032-b89f-1ffefcd558f0
149
+ //# debugId=ed7a03fb-41e9-565b-95ab-4e4d54930128
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="da90a012-8772-5d2a-9ae1-fcaa66577120")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6b8807e2-ae71-5c69-b1b0-2b87dae3cfdb")}catch(e){}}();
3
3
  import { applyEdits, modify } from "jsonc-parser";
4
4
  import { existsSync } from "node:fs";
5
5
  import { readFile, writeFile } from "node:fs/promises";
@@ -64,9 +64,9 @@ export async function pullSystemConfig(argv) {
64
64
  ZUPLO_ACCOUNT_NAME=${payload.accountName}
65
65
  ZUPLO_PROJECT_NAME=${payload.projectName}
66
66
  ZUPLO_ENVIRONMENT_TYPE=${payload.environmentType}
67
- SYSTEM_CONFIGURATIONS=${payload["systemConfigurations"]}
67
+ ZUPLO_SYSTEM_CONFIGURATIONS=${payload["systemConfigurations"]}
68
68
  `;
69
69
  await writeFile(zuploPreferredConfigFile, content);
70
70
  }
71
71
  //# sourceMappingURL=populate.js.map
72
- //# debugId=da90a012-8772-5d2a-9ae1-fcaa66577120
72
+ //# debugId=6b8807e2-ae71-5c69-b1b0-2b87dae3cfdb
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "1.119.0",
3
+ "version": "1.121.0",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/cli",
6
6
  "description": "The command-line interface for Zuplo",
@@ -64,10 +64,10 @@
64
64
  "@opentelemetry/api": "^1.8.0",
65
65
  "@sentry/node": "7.69.0",
66
66
  "@swc/core": "1.3.78",
67
- "@zuplo/core": "5.2249.0",
67
+ "@zuplo/core": "5.2251.0",
68
68
  "@zuplo/deno-bin": "1.37.1",
69
69
  "@zuplo/pino-pretty-configurations": "^1.5.0",
70
- "@zuplo/runtime": "5.2249.0",
70
+ "@zuplo/runtime": "5.2251.0",
71
71
  "chalk": "^5.1.2",
72
72
  "chokidar": "^3.5.3",
73
73
  "dotenv": "^16.3.1",