@uniformdev/cli 19.9.2-alpha.3 → 19.10.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.
Files changed (2) hide show
  1. package/dist/index.mjs +31 -33
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -68,7 +68,7 @@ async function createArraySyncEngineDataSource({
68
68
  }
69
69
 
70
70
  // src/sync/fileSyncEngineDataSource.ts
71
- import ansicolors from "ansi-colors";
71
+ import chalk from "chalk";
72
72
  import { existsSync, mkdirSync } from "fs";
73
73
  import { readdir, unlink } from "fs/promises";
74
74
  import { extname as extname2, join } from "path";
@@ -81,6 +81,9 @@ var omit = (object, keys) => {
81
81
  }, object);
82
82
  return result;
83
83
  };
84
+ var cleanFileName = (proposedFileName) => {
85
+ return proposedFileName.replace(/[/<>$+%>!`&*'|{}?"=:\\@]/g, "-");
86
+ };
84
87
 
85
88
  // src/sync/util.ts
86
89
  import { readFileSync, writeFileSync } from "fs";
@@ -215,7 +218,6 @@ async function* paginateAsync(fetchPage, options) {
215
218
  }
216
219
 
217
220
  // src/sync/fileSyncEngineDataSource.ts
218
- var { red } = ansicolors;
219
221
  async function createFileSyncEngineDataSource({
220
222
  directory,
221
223
  format = "yaml",
@@ -249,7 +251,7 @@ async function createFileSyncEngineDataSource({
249
251
  };
250
252
  yield object;
251
253
  } catch (e) {
252
- console.error(red(`Failed to read ${fullFilename}, data is likely invalid.
254
+ console.error(chalk.red(`Failed to read ${fullFilename}, data is likely invalid.
253
255
  ${e == null ? void 0 : e.message}`));
254
256
  throw e;
255
257
  }
@@ -435,37 +437,36 @@ ${innerError}`
435
437
  };
436
438
 
437
439
  // src/sync/syncEngineConsoleLogger.ts
438
- import ansicolors2 from "ansi-colors";
439
- var { gray, green, red: red2, white, yellow } = ansicolors2;
440
+ import chalk2 from "chalk";
440
441
  function createSyncEngineConsoleLogger(options) {
441
442
  const { diffMode = "off", indent, prefix } = options ?? {};
442
443
  return function syncEngineConsoleLogger({ action, displayName, whatIf, diff }) {
443
444
  let actionTag = "";
444
445
  switch (action) {
445
446
  case "create":
446
- actionTag = green("[A]");
447
+ actionTag = chalk2.green("[A]");
447
448
  break;
448
449
  case "update":
449
- actionTag = white("[U]");
450
+ actionTag = chalk2.white("[U]");
450
451
  break;
451
452
  case "delete":
452
- actionTag = yellow("[D]");
453
+ actionTag = chalk2.yellow("[D]");
453
454
  break;
454
455
  }
455
456
  let diffString = "";
456
457
  if (diffMode === "on" || diffMode === "update" && action === "update") {
457
458
  diffString = "\n" + diff.map((change) => {
458
459
  if (change.added) {
459
- return green(change.value);
460
+ return chalk2.green(change.value);
460
461
  }
461
462
  if (change.removed) {
462
- return red2(change.value);
463
+ return chalk2.red(change.value);
463
464
  }
464
465
  return change.value;
465
466
  }).join("");
466
467
  }
467
468
  console.log(
468
- `${indent ?? ""}${whatIf ? gray("[WHATIF]") : ""}${actionTag}${prefix ?? ""} ${displayName}${diffString}`
469
+ `${indent ?? ""}${whatIf ? chalk2.gray("[WHATIF]") : ""}${actionTag}${prefix ?? ""} ${displayName}${diffString}`
469
470
  );
470
471
  };
471
472
  }
@@ -2148,10 +2149,9 @@ import yargs7 from "yargs";
2148
2149
 
2149
2150
  // src/commands/context/commands/manifest/get.ts
2150
2151
  import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
2151
- import ansicolors3 from "ansi-colors";
2152
+ import chalk3 from "chalk";
2152
2153
  import { writeFile } from "fs";
2153
2154
  import { exit } from "process";
2154
- var { gray: gray2, green: green2, red: red3 } = ansicolors3;
2155
2155
  var ManifestGetModule = {
2156
2156
  command: "get [output]",
2157
2157
  aliases: ["dl", "download"],
@@ -2190,7 +2190,7 @@ var ManifestGetModule = {
2190
2190
  `, error);
2191
2191
  exit(1);
2192
2192
  }
2193
- console.log(green2(`\u2705 ${output} has been updated from ${apiHost}`));
2193
+ console.log(chalk3.green(`\u2705 ${output} has been updated from ${apiHost}`));
2194
2194
  });
2195
2195
  } else {
2196
2196
  console.log(text);
@@ -2205,8 +2205,8 @@ var ManifestGetModule = {
2205
2205
  } else {
2206
2206
  message = e.toString();
2207
2207
  }
2208
- console.error(red3(`\u26A0 Error fetching Context manifest`));
2209
- console.error(gray2(` \u2757 ${message}`));
2208
+ console.error(chalk3.red(`\u26A0 Error fetching Context manifest`));
2209
+ console.error(chalk3.gray(` \u2757 ${message}`));
2210
2210
  exit(1);
2211
2211
  }
2212
2212
  }
@@ -2214,9 +2214,8 @@ var ManifestGetModule = {
2214
2214
 
2215
2215
  // src/commands/context/commands/manifest/publish.ts
2216
2216
  import { ApiClientError as ApiClientError2, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
2217
- import ansicolors4 from "ansi-colors";
2217
+ import chalk4 from "chalk";
2218
2218
  import { exit as exit2 } from "process";
2219
- var { gray: gray3, red: red4 } = ansicolors4;
2220
2219
  var ManifestPublishModule = {
2221
2220
  command: "publish",
2222
2221
  describe: "Publish the Uniform Context manifest for a project",
@@ -2241,8 +2240,8 @@ var ManifestPublishModule = {
2241
2240
  } else {
2242
2241
  message = e.toString();
2243
2242
  }
2244
- console.error(red4(`\u26A0 Error publishing Context manifest`));
2245
- console.error(gray3(` \u2757 ${message}`));
2243
+ console.error(chalk4.red(`\u26A0 Error publishing Context manifest`));
2244
+ console.error(chalk4.gray(` \u2757 ${message}`));
2246
2245
  exit2(1);
2247
2246
  }
2248
2247
  }
@@ -3099,7 +3098,7 @@ import { PostHog } from "posthog-node";
3099
3098
  // package.json
3100
3099
  var package_default = {
3101
3100
  name: "@uniformdev/cli",
3102
- version: "19.9.1",
3101
+ version: "19.10.0",
3103
3102
  description: "Uniform command line interface tool",
3104
3103
  license: "SEE LICENSE IN LICENSE.txt",
3105
3104
  main: "./cli.js",
@@ -3119,7 +3118,7 @@ var package_default = {
3119
3118
  "@uniformdev/context": "workspace:*",
3120
3119
  "@uniformdev/project-map": "workspace:*",
3121
3120
  "@uniformdev/redirect": "workspace:*",
3122
- "ansi-colors": "^4.1.3",
3121
+ chalk: "^5.2.0",
3123
3122
  diff: "^5.0.0",
3124
3123
  dotenv: "^16.0.3",
3125
3124
  execa: "5.1.1",
@@ -4128,7 +4127,7 @@ import yargs13 from "yargs";
4128
4127
  import yargs12 from "yargs";
4129
4128
 
4130
4129
  // src/commands/optimize/manifest/download.ts
4131
- import ansicolors5 from "ansi-colors";
4130
+ import chalk5 from "chalk";
4132
4131
  import { writeFile as writeFile2 } from "fs";
4133
4132
  import fetch2 from "isomorphic-unfetch";
4134
4133
  import { exit as exit3 } from "process";
@@ -4137,7 +4136,6 @@ import { exit as exit3 } from "process";
4137
4136
  var UniformBaseUrl = "https://uniform.app";
4138
4137
 
4139
4138
  // src/commands/optimize/manifest/download.ts
4140
- var { gray: gray4, green: green3, red: red5, yellow: yellow2 } = ansicolors5;
4141
4139
  var module = {
4142
4140
  command: "download [output]",
4143
4141
  describe: "Download intent manifest",
@@ -4169,12 +4167,12 @@ var module = {
4169
4167
  );
4170
4168
  if (isLegacyApiKey) {
4171
4169
  console.error(
4172
- yellow2(
4170
+ chalk5.yellow(
4173
4171
  "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."
4174
4172
  )
4175
4173
  );
4176
4174
  } else if (!project) {
4177
- console.error(red5("You must specify the project ID"));
4175
+ console.error(chalk5.red("You must specify the project ID"));
4178
4176
  exit3(1);
4179
4177
  }
4180
4178
  const baseUrl = resolveBaseUrl();
@@ -4200,16 +4198,16 @@ var module = {
4200
4198
  throw `${fetchResponse.status} ${fetchResponse.statusText}, content ${await fetchResponse.text()}`;
4201
4199
  }
4202
4200
  } catch (e) {
4203
- console.error(red5(`\u26A0 Error fetching intent manifest ${manifestUrl}`));
4204
- console.error(gray4(` \u2757 ${e}`));
4201
+ console.error(chalk5.red(`\u26A0 Error fetching intent manifest ${manifestUrl}`));
4202
+ console.error(chalk5.gray(` \u2757 ${e}`));
4205
4203
  exit3(1);
4206
4204
  }
4207
4205
  let json;
4208
4206
  try {
4209
4207
  json = await fetchResponse.json();
4210
4208
  } catch (e) {
4211
- console.error(red5(`\u26A0 Error parsing intent manifest ${manifestUrl}`));
4212
- console.error(gray4(` \u2757 ${e}`));
4209
+ console.error(chalk5.red(chalk5.red(`\u26A0 Error parsing intent manifest ${manifestUrl}`)));
4210
+ console.error(chalk5.gray(` \u2757 ${e}`));
4213
4211
  console.error(`Response: ${await fetchResponse.text()}`);
4214
4212
  exit3(1);
4215
4213
  }
@@ -4221,7 +4219,7 @@ var module = {
4221
4219
  `, error);
4222
4220
  exit3(1);
4223
4221
  }
4224
- console.log(green3(`\u2705 ${output} has been updated from ${manifestUrl}`));
4222
+ console.log(chalk5.green(`\u2705 ${output} has been updated from ${manifestUrl}`));
4225
4223
  });
4226
4224
  } else {
4227
4225
  console.log(text);
@@ -4598,7 +4596,7 @@ var selectIdentifier10 = (source, projectId) => [
4598
4596
  projectId + source.projectMapId + source.id,
4599
4597
  projectId + source.projectMapId + source.path
4600
4598
  ];
4601
- var selectFilename = (source) => `${source.pathSegment}_${source.id}`;
4599
+ var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
4602
4600
  var selectDisplayName10 = (source) => `${source.name} (pid: ${source.id})`;
4603
4601
 
4604
4602
  // src/commands/project-map/ProjectMapNodeEngineDataSource.ts
@@ -4912,7 +4910,7 @@ function writeContextPackage3(filename, packageContents) {
4912
4910
  var selectIdentifier11 = (source) => source.redirect.id;
4913
4911
  var selectFilename2 = (source) => {
4914
4912
  const index = source.redirect.sourceUrl.lastIndexOf("/");
4915
- return source.redirect.sourceUrl.substring(index + 1).replace(/[/<>$+%>!`&*'|{}?"=:\\@]/g, "-") + `_${source.redirect.id}`;
4913
+ return cleanFileName(source.redirect.sourceUrl.substring(index + 1)) + `_${source.redirect.id}`;
4916
4914
  };
4917
4915
  var selectDisplayName11 = (source) => {
4918
4916
  let pathName = source.redirect.sourceUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.9.2-alpha.3+547c8b11d",
3
+ "version": "19.10.0",
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.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",
19
+ "@uniformdev/canvas": "19.10.0",
20
+ "@uniformdev/context": "19.10.0",
21
+ "@uniformdev/project-map": "19.10.0",
22
+ "@uniformdev/redirect": "19.10.0",
23
+ "chalk": "^5.2.0",
24
24
  "diff": "^5.0.0",
25
25
  "dotenv": "^16.0.3",
26
26
  "execa": "5.1.1",
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "547c8b11d4655b34250c2fbe3f016c9bc12c3905"
62
+ "gitHead": "149f942da715ed802545850283f9b99291829a04"
63
63
  }