@uniformdev/cli 18.21.1-alpha.4 → 18.23.1-alpha.25

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 +32 -11
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -88,6 +88,15 @@ import { existsSync, mkdirSync } from "fs";
88
88
  import { readdir, unlink } from "fs/promises";
89
89
  import { extname as extname2, join } from "path";
90
90
 
91
+ // src/util.ts
92
+ var omit = (object, keys) => {
93
+ const result = keys.reduce((current, key) => {
94
+ const { [key]: _, ...rest } = current;
95
+ return rest;
96
+ }, object);
97
+ return result;
98
+ };
99
+
91
100
  // src/sync/util.ts
92
101
  import { readFileSync, writeFileSync } from "fs";
93
102
  import httpsProxyAgent from "https-proxy-agent";
@@ -189,6 +198,10 @@ function emitWithFormat(object, format, filename) {
189
198
  break;
190
199
  case "yaml":
191
200
  content = dump(object);
201
+ if ("$schema" in object) {
202
+ content = `# yaml-language-server: $schema=<${object["$schema"]}>
203
+ ${content}`;
204
+ }
192
205
  break;
193
206
  default:
194
207
  throw new Error(`Unsupported format: ${format}`);
@@ -222,7 +235,8 @@ async function createFileSyncEngineDataSource({
222
235
  format = "yaml",
223
236
  selectIdentifier: selectIdentifier11,
224
237
  selectDisplayName: selectDisplayName11 = selectIdentifier11,
225
- selectFilename: selectFilename2
238
+ selectFilename: selectFilename2,
239
+ selectSchemaUrl: selectSchemaUrl2
226
240
  }) {
227
241
  const dirExists = existsSync(directory);
228
242
  if (!dirExists) {
@@ -245,7 +259,7 @@ async function createFileSyncEngineDataSource({
245
259
  id: selectIdentifier11(contents),
246
260
  displayName: selectDisplayName11(contents),
247
261
  providerId: fullFilename,
248
- object: contents
262
+ object: omit(contents, ["$schema"])
249
263
  };
250
264
  yield object;
251
265
  } catch (e) {
@@ -261,11 +275,15 @@ ${e == null ? void 0 : e.message}`));
261
275
  await unlink(providerId);
262
276
  },
263
277
  writeObject: async (object) => {
264
- if (selectFilename2) {
265
- emitWithFormat(object.object, format, join(directory, `${selectFilename2(object.object)}.${format}`));
266
- } else {
267
- emitWithFormat(object.object, format, getFullFilename(object.id));
278
+ const filename = selectFilename2 ? join(directory, `${selectFilename2(object.object)}.${format}`) : getFullFilename(object.id);
279
+ let contents = object.object;
280
+ if (selectSchemaUrl2) {
281
+ contents = {
282
+ $schema: selectSchemaUrl2(object.object),
283
+ ...object.object
284
+ };
268
285
  }
286
+ emitWithFormat(contents, format, filename);
269
287
  }
270
288
  };
271
289
  }
@@ -494,6 +512,7 @@ import { UncachedCanvasClient as UncachedCanvasClient3 } from "@uniformdev/canva
494
512
  // src/commands/canvas/commands/component/_util.ts
495
513
  var selectIdentifier = (component) => component.id;
496
514
  var selectDisplayName = (component) => `${component.name} (pid: ${component.id})`;
515
+ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
497
516
 
498
517
  // src/commands/canvas/componentDefinitionEngineDataSource.ts
499
518
  function createComponentDefinitionEngineDataSource({
@@ -740,6 +759,7 @@ var ComponentPullModule = {
740
759
  directory,
741
760
  selectIdentifier,
742
761
  selectDisplayName,
762
+ selectSchemaUrl: () => new URL(selectSchemaUrl(), apiHost).toString(),
743
763
  format
744
764
  });
745
765
  }
@@ -804,7 +824,8 @@ var ComponentPushModule = {
804
824
  source = await createFileSyncEngineDataSource({
805
825
  directory,
806
826
  selectIdentifier,
807
- selectDisplayName
827
+ selectDisplayName,
828
+ selectSchemaUrl
808
829
  });
809
830
  }
810
831
  const target = createComponentDefinitionEngineDataSource({ client });
@@ -3162,7 +3183,7 @@ import { PostHog } from "posthog-node";
3162
3183
  // package.json
3163
3184
  var package_default = {
3164
3185
  name: "@uniformdev/cli",
3165
- version: "18.21.0",
3186
+ version: "18.23.0",
3166
3187
  description: "Uniform command line interface tool",
3167
3188
  license: "SEE LICENSE IN LICENSE.txt",
3168
3189
  main: "./cli.js",
@@ -3189,7 +3210,7 @@ var package_default = {
3189
3210
  graphql: "16.6.0",
3190
3211
  "graphql-request": "5.1.0",
3191
3212
  "https-proxy-agent": "^5.0.1",
3192
- inquirer: "8.2.5",
3213
+ inquirer: "9.1.4",
3193
3214
  "isomorphic-git": "1.21.0",
3194
3215
  "isomorphic-unfetch": "^3.1.0",
3195
3216
  "js-yaml": "^4.1.0",
@@ -3200,7 +3221,7 @@ var package_default = {
3200
3221
  "posthog-node": "2.5.3",
3201
3222
  slugify: "1.6.5",
3202
3223
  yargs: "^17.6.2",
3203
- zod: "3.21.0"
3224
+ zod: "3.21.4"
3204
3225
  },
3205
3226
  devDependencies: {
3206
3227
  "@types/diff": "5.0.2",
@@ -3208,7 +3229,7 @@ var package_default = {
3208
3229
  "@types/js-yaml": "4.0.5",
3209
3230
  "@types/jsonwebtoken": "9.0.1",
3210
3231
  "@types/lodash.isequalwith": "4.4.7",
3211
- "@types/node": "18.14.6",
3232
+ "@types/node": "18.15.0",
3212
3233
  "@types/yargs": "17.0.22",
3213
3234
  "p-limit": "4.0.0"
3214
3235
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "18.21.1-alpha.4+677936e4a",
3
+ "version": "18.23.1-alpha.25+6ae528b11",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -16,9 +16,9 @@
16
16
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
17
17
  },
18
18
  "dependencies": {
19
- "@uniformdev/canvas": "18.21.1-alpha.4+677936e4a",
20
- "@uniformdev/context": "18.21.1-alpha.4+677936e4a",
21
- "@uniformdev/project-map": "18.21.1-alpha.4+677936e4a",
19
+ "@uniformdev/canvas": "18.23.1-alpha.25+6ae528b11",
20
+ "@uniformdev/context": "18.23.1-alpha.25+6ae528b11",
21
+ "@uniformdev/project-map": "18.23.1-alpha.25+6ae528b11",
22
22
  "chalk": "^5.2.0",
23
23
  "diff": "^5.0.0",
24
24
  "dotenv": "^16.0.3",
@@ -27,7 +27,7 @@
27
27
  "graphql": "16.6.0",
28
28
  "graphql-request": "5.1.0",
29
29
  "https-proxy-agent": "^5.0.1",
30
- "inquirer": "8.2.5",
30
+ "inquirer": "9.1.4",
31
31
  "isomorphic-git": "1.21.0",
32
32
  "isomorphic-unfetch": "^3.1.0",
33
33
  "js-yaml": "^4.1.0",
@@ -38,7 +38,7 @@
38
38
  "posthog-node": "2.5.3",
39
39
  "slugify": "1.6.5",
40
40
  "yargs": "^17.6.2",
41
- "zod": "3.21.0"
41
+ "zod": "3.21.4"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/diff": "5.0.2",
@@ -46,7 +46,7 @@
46
46
  "@types/js-yaml": "4.0.5",
47
47
  "@types/jsonwebtoken": "9.0.1",
48
48
  "@types/lodash.isequalwith": "4.4.7",
49
- "@types/node": "18.14.6",
49
+ "@types/node": "18.15.0",
50
50
  "@types/yargs": "17.0.22",
51
51
  "p-limit": "4.0.0"
52
52
  },
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "677936e4a7af7c7c738893d83a2afa8cddbb7bbc"
62
+ "gitHead": "6ae528b111d6948dbc768a06f57f349d95b69b96"
63
63
  }