@uniformdev/cli 19.8.0 → 19.9.2-alpha.3

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 (2) hide show
  1. package/dist/index.mjs +35 -30
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -68,7 +68,7 @@ async function createArraySyncEngineDataSource({
68
68
  }
69
69
 
70
70
  // src/sync/fileSyncEngineDataSource.ts
71
- import chalk from "chalk";
71
+ import ansicolors from "ansi-colors";
72
72
  import { existsSync, mkdirSync } from "fs";
73
73
  import { readdir, unlink } from "fs/promises";
74
74
  import { extname as extname2, join } from "path";
@@ -215,6 +215,7 @@ async function* paginateAsync(fetchPage, options) {
215
215
  }
216
216
 
217
217
  // src/sync/fileSyncEngineDataSource.ts
218
+ var { red } = ansicolors;
218
219
  async function createFileSyncEngineDataSource({
219
220
  directory,
220
221
  format = "yaml",
@@ -248,7 +249,7 @@ async function createFileSyncEngineDataSource({
248
249
  };
249
250
  yield object;
250
251
  } catch (e) {
251
- console.error(chalk.red(`Failed to read ${fullFilename}, data is likely invalid.
252
+ console.error(red(`Failed to read ${fullFilename}, data is likely invalid.
252
253
  ${e == null ? void 0 : e.message}`));
253
254
  throw e;
254
255
  }
@@ -434,36 +435,37 @@ ${innerError}`
434
435
  };
435
436
 
436
437
  // src/sync/syncEngineConsoleLogger.ts
437
- import chalk2 from "chalk";
438
+ import ansicolors2 from "ansi-colors";
439
+ var { gray, green, red: red2, white, yellow } = ansicolors2;
438
440
  function createSyncEngineConsoleLogger(options) {
439
441
  const { diffMode = "off", indent, prefix } = options ?? {};
440
442
  return function syncEngineConsoleLogger({ action, displayName, whatIf, diff }) {
441
443
  let actionTag = "";
442
444
  switch (action) {
443
445
  case "create":
444
- actionTag = chalk2.green("[A]");
446
+ actionTag = green("[A]");
445
447
  break;
446
448
  case "update":
447
- actionTag = chalk2.white("[U]");
449
+ actionTag = white("[U]");
448
450
  break;
449
451
  case "delete":
450
- actionTag = chalk2.yellow("[D]");
452
+ actionTag = yellow("[D]");
451
453
  break;
452
454
  }
453
455
  let diffString = "";
454
456
  if (diffMode === "on" || diffMode === "update" && action === "update") {
455
457
  diffString = "\n" + diff.map((change) => {
456
458
  if (change.added) {
457
- return chalk2.green(change.value);
459
+ return green(change.value);
458
460
  }
459
461
  if (change.removed) {
460
- return chalk2.red(change.value);
462
+ return red2(change.value);
461
463
  }
462
464
  return change.value;
463
465
  }).join("");
464
466
  }
465
467
  console.log(
466
- `${indent ?? ""}${whatIf ? chalk2.gray("[WHATIF]") : ""}${actionTag}${prefix ?? ""} ${displayName}${diffString}`
468
+ `${indent ?? ""}${whatIf ? gray("[WHATIF]") : ""}${actionTag}${prefix ?? ""} ${displayName}${diffString}`
467
469
  );
468
470
  };
469
471
  }
@@ -2146,9 +2148,10 @@ import yargs7 from "yargs";
2146
2148
 
2147
2149
  // src/commands/context/commands/manifest/get.ts
2148
2150
  import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
2149
- import chalk3 from "chalk";
2151
+ import ansicolors3 from "ansi-colors";
2150
2152
  import { writeFile } from "fs";
2151
2153
  import { exit } from "process";
2154
+ var { gray: gray2, green: green2, red: red3 } = ansicolors3;
2152
2155
  var ManifestGetModule = {
2153
2156
  command: "get [output]",
2154
2157
  aliases: ["dl", "download"],
@@ -2187,7 +2190,7 @@ var ManifestGetModule = {
2187
2190
  `, error);
2188
2191
  exit(1);
2189
2192
  }
2190
- console.log(chalk3.green(`\u2705 ${output} has been updated from ${apiHost}`));
2193
+ console.log(green2(`\u2705 ${output} has been updated from ${apiHost}`));
2191
2194
  });
2192
2195
  } else {
2193
2196
  console.log(text);
@@ -2202,8 +2205,8 @@ var ManifestGetModule = {
2202
2205
  } else {
2203
2206
  message = e.toString();
2204
2207
  }
2205
- console.error(chalk3.red(`\u26A0 Error fetching Context manifest`));
2206
- console.error(chalk3.gray(` \u2757 ${message}`));
2208
+ console.error(red3(`\u26A0 Error fetching Context manifest`));
2209
+ console.error(gray2(` \u2757 ${message}`));
2207
2210
  exit(1);
2208
2211
  }
2209
2212
  }
@@ -2211,8 +2214,9 @@ var ManifestGetModule = {
2211
2214
 
2212
2215
  // src/commands/context/commands/manifest/publish.ts
2213
2216
  import { ApiClientError as ApiClientError2, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
2214
- import chalk4 from "chalk";
2217
+ import ansicolors4 from "ansi-colors";
2215
2218
  import { exit as exit2 } from "process";
2219
+ var { gray: gray3, red: red4 } = ansicolors4;
2216
2220
  var ManifestPublishModule = {
2217
2221
  command: "publish",
2218
2222
  describe: "Publish the Uniform Context manifest for a project",
@@ -2237,8 +2241,8 @@ var ManifestPublishModule = {
2237
2241
  } else {
2238
2242
  message = e.toString();
2239
2243
  }
2240
- console.error(chalk4.red(`\u26A0 Error publishing Context manifest`));
2241
- console.error(chalk4.gray(` \u2757 ${message}`));
2244
+ console.error(red4(`\u26A0 Error publishing Context manifest`));
2245
+ console.error(gray3(` \u2757 ${message}`));
2242
2246
  exit2(1);
2243
2247
  }
2244
2248
  }
@@ -3095,7 +3099,7 @@ import { PostHog } from "posthog-node";
3095
3099
  // package.json
3096
3100
  var package_default = {
3097
3101
  name: "@uniformdev/cli",
3098
- version: "19.8.0",
3102
+ version: "19.9.1",
3099
3103
  description: "Uniform command line interface tool",
3100
3104
  license: "SEE LICENSE IN LICENSE.txt",
3101
3105
  main: "./cli.js",
@@ -3115,7 +3119,7 @@ var package_default = {
3115
3119
  "@uniformdev/context": "workspace:*",
3116
3120
  "@uniformdev/project-map": "workspace:*",
3117
3121
  "@uniformdev/redirect": "workspace:*",
3118
- chalk: "^5.2.0",
3122
+ "ansi-colors": "^4.1.3",
3119
3123
  diff: "^5.0.0",
3120
3124
  dotenv: "^16.0.3",
3121
3125
  execa: "5.1.1",
@@ -3142,7 +3146,7 @@ var package_default = {
3142
3146
  "@types/js-yaml": "4.0.5",
3143
3147
  "@types/jsonwebtoken": "9.0.2",
3144
3148
  "@types/lodash.isequalwith": "4.4.7",
3145
- "@types/node": "18.16.4",
3149
+ "@types/node": "18.16.8",
3146
3150
  "@types/yargs": "17.0.24"
3147
3151
  },
3148
3152
  bin: {
@@ -4124,7 +4128,7 @@ import yargs13 from "yargs";
4124
4128
  import yargs12 from "yargs";
4125
4129
 
4126
4130
  // src/commands/optimize/manifest/download.ts
4127
- import chalk5 from "chalk";
4131
+ import ansicolors5 from "ansi-colors";
4128
4132
  import { writeFile as writeFile2 } from "fs";
4129
4133
  import fetch2 from "isomorphic-unfetch";
4130
4134
  import { exit as exit3 } from "process";
@@ -4133,6 +4137,7 @@ import { exit as exit3 } from "process";
4133
4137
  var UniformBaseUrl = "https://uniform.app";
4134
4138
 
4135
4139
  // src/commands/optimize/manifest/download.ts
4140
+ var { gray: gray4, green: green3, red: red5, yellow: yellow2 } = ansicolors5;
4136
4141
  var module = {
4137
4142
  command: "download [output]",
4138
4143
  describe: "Download intent manifest",
@@ -4164,12 +4169,12 @@ var module = {
4164
4169
  );
4165
4170
  if (isLegacyApiKey) {
4166
4171
  console.error(
4167
- chalk5.yellow(
4172
+ yellow2(
4168
4173
  "WARNING: you appear to be using a deprecated type of API key. Keys like this will stop working soon; please create new keys on uniform.app."
4169
4174
  )
4170
4175
  );
4171
4176
  } else if (!project) {
4172
- console.error(chalk5.red("You must specify the project ID"));
4177
+ console.error(red5("You must specify the project ID"));
4173
4178
  exit3(1);
4174
4179
  }
4175
4180
  const baseUrl = resolveBaseUrl();
@@ -4195,16 +4200,16 @@ var module = {
4195
4200
  throw `${fetchResponse.status} ${fetchResponse.statusText}, content ${await fetchResponse.text()}`;
4196
4201
  }
4197
4202
  } catch (e) {
4198
- console.error(chalk5.red(`\u26A0 Error fetching intent manifest ${manifestUrl}`));
4199
- console.error(chalk5.gray(` \u2757 ${e}`));
4203
+ console.error(red5(`\u26A0 Error fetching intent manifest ${manifestUrl}`));
4204
+ console.error(gray4(` \u2757 ${e}`));
4200
4205
  exit3(1);
4201
4206
  }
4202
4207
  let json;
4203
4208
  try {
4204
4209
  json = await fetchResponse.json();
4205
4210
  } catch (e) {
4206
- console.error(chalk5.red(chalk5.red(`\u26A0 Error parsing intent manifest ${manifestUrl}`)));
4207
- console.error(chalk5.gray(` \u2757 ${e}`));
4211
+ console.error(red5(`\u26A0 Error parsing intent manifest ${manifestUrl}`));
4212
+ console.error(gray4(` \u2757 ${e}`));
4208
4213
  console.error(`Response: ${await fetchResponse.text()}`);
4209
4214
  exit3(1);
4210
4215
  }
@@ -4216,7 +4221,7 @@ var module = {
4216
4221
  `, error);
4217
4222
  exit3(1);
4218
4223
  }
4219
- console.log(chalk5.green(`\u2705 ${output} has been updated from ${manifestUrl}`));
4224
+ console.log(green3(`\u2705 ${output} has been updated from ${manifestUrl}`));
4220
4225
  });
4221
4226
  } else {
4222
4227
  console.log(text);
@@ -4867,8 +4872,8 @@ var RedirectDefinitionGetModule = {
4867
4872
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
4868
4873
  const fetch3 = nodeFetchProxy(proxy);
4869
4874
  const client = new UncachedRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
4870
- const res = await client.getRedirect(id);
4871
- if (res) {
4875
+ const res = await client.getRedirect({ id });
4876
+ if (!res) {
4872
4877
  console.error("Redirect does not exist");
4873
4878
  process.exit(1);
4874
4879
  } else {
@@ -5118,7 +5123,7 @@ var RedirectDefinitionUpdateModule = {
5118
5123
  const fetch3 = nodeFetchProxy(proxy);
5119
5124
  const client = new UncachedRedirectClient6({ apiKey, apiHost, fetch: fetch3, projectId });
5120
5125
  const file = readFileToObject(filename);
5121
- await client.upsertRedirect(file);
5126
+ await client.upsertRedirect(file.redirect);
5122
5127
  }
5123
5128
  };
5124
5129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.8.0",
3
+ "version": "19.9.2-alpha.3+547c8b11d",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -16,11 +16,11 @@
16
16
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
17
17
  },
18
18
  "dependencies": {
19
- "@uniformdev/canvas": "19.8.0",
20
- "@uniformdev/context": "19.8.0",
21
- "@uniformdev/project-map": "19.8.0",
22
- "@uniformdev/redirect": "19.8.0",
23
- "chalk": "^5.2.0",
19
+ "@uniformdev/canvas": "19.9.2-alpha.3+547c8b11d",
20
+ "@uniformdev/context": "19.9.2-alpha.3+547c8b11d",
21
+ "@uniformdev/project-map": "19.9.2-alpha.3+547c8b11d",
22
+ "@uniformdev/redirect": "19.9.2-alpha.3+547c8b11d",
23
+ "ansi-colors": "^4.1.3",
24
24
  "diff": "^5.0.0",
25
25
  "dotenv": "^16.0.3",
26
26
  "execa": "5.1.1",
@@ -47,7 +47,7 @@
47
47
  "@types/js-yaml": "4.0.5",
48
48
  "@types/jsonwebtoken": "9.0.2",
49
49
  "@types/lodash.isequalwith": "4.4.7",
50
- "@types/node": "18.16.4",
50
+ "@types/node": "18.16.8",
51
51
  "@types/yargs": "17.0.24"
52
52
  },
53
53
  "bin": {
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "70eb9277bbfaee5f9245e1b26b4e77caede22944"
62
+ "gitHead": "547c8b11d4655b34250c2fbe3f016c9bc12c3905"
63
63
  }