@uniformdev/cli 19.49.0 → 19.50.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/dist/index.mjs +146 -89
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// ../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.28_ts-node@10.9.1_typescript@5.1.6/node_modules/tsup/assets/esm_shims.js
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import path from "path";
|
|
6
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
7
|
+
var getDirname = () => path.dirname(getFilename());
|
|
8
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
|
+
|
|
3
10
|
// src/index.ts
|
|
4
11
|
import * as dotenv from "dotenv";
|
|
5
12
|
import yargs24 from "yargs";
|
|
@@ -70,7 +77,7 @@ async function createArraySyncEngineDataSource({
|
|
|
70
77
|
|
|
71
78
|
// src/sync/fileSyncEngineDataSource.ts
|
|
72
79
|
import { red } from "colorette";
|
|
73
|
-
import { existsSync, mkdirSync } from "fs";
|
|
80
|
+
import { existsSync, mkdirSync as mkdirSync2 } from "fs";
|
|
74
81
|
import { readdir, unlink } from "fs/promises";
|
|
75
82
|
import { extname as extname2, join } from "path";
|
|
76
83
|
|
|
@@ -114,11 +121,11 @@ var loadConfig = (configPath) => {
|
|
|
114
121
|
};
|
|
115
122
|
|
|
116
123
|
// src/sync/util.ts
|
|
117
|
-
import { readFileSync, writeFileSync } from "fs";
|
|
124
|
+
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
118
125
|
import httpsProxyAgent from "https-proxy-agent";
|
|
119
126
|
import unfetch from "isomorphic-unfetch";
|
|
120
127
|
import { dump, load } from "js-yaml";
|
|
121
|
-
import { extname } from "path";
|
|
128
|
+
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
122
129
|
function withConfiguration(yargs25) {
|
|
123
130
|
return yargs25.option("serialization", {
|
|
124
131
|
skipValidation: true,
|
|
@@ -198,8 +205,8 @@ function withDiffOptions(yargs25) {
|
|
|
198
205
|
alias: ["d"]
|
|
199
206
|
});
|
|
200
207
|
}
|
|
201
|
-
function isPathAPackageFile(
|
|
202
|
-
const extension = extname(
|
|
208
|
+
function isPathAPackageFile(path5) {
|
|
209
|
+
const extension = extname(path5);
|
|
203
210
|
return extension === ".yaml" || extension === ".yml" || extension === ".json";
|
|
204
211
|
}
|
|
205
212
|
function emitWithFormat(object, format, filename) {
|
|
@@ -229,11 +236,35 @@ ${content}`;
|
|
|
229
236
|
throw new Error(`Unsupported format: ${format}`);
|
|
230
237
|
}
|
|
231
238
|
if (filename) {
|
|
239
|
+
const directory = dirname(filename);
|
|
240
|
+
mkDirByPathSync(directory);
|
|
232
241
|
writeFileSync(filename, content, "utf8");
|
|
233
242
|
} else {
|
|
234
243
|
console.log(content);
|
|
235
244
|
}
|
|
236
245
|
}
|
|
246
|
+
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
|
|
247
|
+
const initDir = isAbsolute(targetDir) ? sep : "";
|
|
248
|
+
const baseDir = isRelativeToScript ? __dirname : ".";
|
|
249
|
+
return targetDir.split(sep).reduce((parentDir, childDir) => {
|
|
250
|
+
const curDir = resolve(baseDir, parentDir, childDir);
|
|
251
|
+
try {
|
|
252
|
+
mkdirSync(curDir);
|
|
253
|
+
} catch (err) {
|
|
254
|
+
if (err.code === "EEXIST") {
|
|
255
|
+
return curDir;
|
|
256
|
+
}
|
|
257
|
+
if (err.code === "ENOENT") {
|
|
258
|
+
throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
|
|
259
|
+
}
|
|
260
|
+
const caughtErr = ["EACCES", "EPERM", "EISDIR"].indexOf(err.code) > -1;
|
|
261
|
+
if (!caughtErr || caughtErr && curDir === resolve(targetDir)) {
|
|
262
|
+
throw err;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return curDir;
|
|
266
|
+
}, initDir);
|
|
267
|
+
}
|
|
237
268
|
function readFileToObject(filename) {
|
|
238
269
|
const file = readFileSync(filename, "utf8");
|
|
239
270
|
return load(file, { filename, json: true });
|
|
@@ -328,7 +359,7 @@ async function createFileSyncEngineDataSource({
|
|
|
328
359
|
}) {
|
|
329
360
|
const dirExists = existsSync(directory);
|
|
330
361
|
if (!dirExists) {
|
|
331
|
-
|
|
362
|
+
mkdirSync2(directory, { recursive: true });
|
|
332
363
|
}
|
|
333
364
|
const rawFilenames = await readdir(directory, "utf-8");
|
|
334
365
|
const filenames = new Set(
|
|
@@ -1172,7 +1203,10 @@ import yargs3 from "yargs";
|
|
|
1172
1203
|
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1173
1204
|
|
|
1174
1205
|
// src/commands/canvas/util.ts
|
|
1175
|
-
import {
|
|
1206
|
+
import {
|
|
1207
|
+
CANVAS_DRAFT_STATE,
|
|
1208
|
+
CANVAS_PUBLISHED_STATE
|
|
1209
|
+
} from "@uniformdev/canvas";
|
|
1176
1210
|
function prepCompositionForDisk(composition) {
|
|
1177
1211
|
const prepped = {
|
|
1178
1212
|
...composition
|
|
@@ -1610,7 +1644,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
1610
1644
|
const checkForFile = async () => {
|
|
1611
1645
|
const file = await options.fileClient.getFile({ id });
|
|
1612
1646
|
if (!file || file.state !== FILE_READY_STATE) {
|
|
1613
|
-
await new Promise((
|
|
1647
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
1614
1648
|
return checkForFile();
|
|
1615
1649
|
}
|
|
1616
1650
|
return file.url;
|
|
@@ -2627,7 +2661,10 @@ var EntryListModule = {
|
|
|
2627
2661
|
};
|
|
2628
2662
|
|
|
2629
2663
|
// src/commands/canvas/commands/entry/pull.ts
|
|
2630
|
-
import { ContentClient as
|
|
2664
|
+
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
2665
|
+
|
|
2666
|
+
// src/commands/canvas/entryEngineDataSource.ts
|
|
2667
|
+
import { convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
2631
2668
|
|
|
2632
2669
|
// src/commands/canvas/commands/entry/_util.ts
|
|
2633
2670
|
var selectEntryIdentifier = (e) => e.entry._id;
|
|
@@ -2635,16 +2672,18 @@ var selectEntryDisplayName = (e) => `${e.entry._name ?? "Untitled"} (pid: ${e.en
|
|
|
2635
2672
|
|
|
2636
2673
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
2637
2674
|
function createEntryEngineDataSource({
|
|
2638
|
-
client
|
|
2675
|
+
client,
|
|
2676
|
+
state
|
|
2639
2677
|
}) {
|
|
2678
|
+
const stateId = convertCompositionState(state);
|
|
2640
2679
|
async function* getObjects() {
|
|
2641
|
-
const { entries } = await client.getEntries({ offset: 0, limit: 1e3 });
|
|
2680
|
+
const { entries } = await client.getEntries({ offset: 0, limit: 1e3, skipDataResolution: true });
|
|
2642
2681
|
for await (const e of entries) {
|
|
2643
2682
|
const result = {
|
|
2644
2683
|
id: selectEntryIdentifier(e),
|
|
2645
2684
|
displayName: selectEntryDisplayName(e),
|
|
2646
2685
|
providerId: e.entry._id,
|
|
2647
|
-
object: e
|
|
2686
|
+
object: prepCompositionForDisk(e)
|
|
2648
2687
|
};
|
|
2649
2688
|
yield result;
|
|
2650
2689
|
}
|
|
@@ -2655,7 +2694,7 @@ function createEntryEngineDataSource({
|
|
|
2655
2694
|
await client.deleteEntry({ entryId: providerId });
|
|
2656
2695
|
},
|
|
2657
2696
|
writeObject: async ({ object }) => {
|
|
2658
|
-
await client.upsertEntry(object);
|
|
2697
|
+
await client.upsertEntry({ ...convertEntryToPutEntry(object), state: stateId });
|
|
2659
2698
|
}
|
|
2660
2699
|
};
|
|
2661
2700
|
}
|
|
@@ -2667,28 +2706,30 @@ var EntryPullModule = {
|
|
|
2667
2706
|
builder: (yargs25) => withConfiguration(
|
|
2668
2707
|
withApiOptions(
|
|
2669
2708
|
withProjectOptions(
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2709
|
+
withStateOptions(
|
|
2710
|
+
withDiffOptions(
|
|
2711
|
+
yargs25.positional("directory", {
|
|
2712
|
+
describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2713
|
+
type: "string"
|
|
2714
|
+
}).option("format", {
|
|
2715
|
+
alias: ["f"],
|
|
2716
|
+
describe: "Output format",
|
|
2717
|
+
default: "yaml",
|
|
2718
|
+
choices: ["yaml", "json"],
|
|
2719
|
+
type: "string"
|
|
2720
|
+
}).option("what-if", {
|
|
2721
|
+
alias: ["w"],
|
|
2722
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2723
|
+
default: false,
|
|
2724
|
+
type: "boolean"
|
|
2725
|
+
}).option("mode", {
|
|
2726
|
+
alias: ["m"],
|
|
2727
|
+
describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
|
|
2728
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2729
|
+
default: "mirror",
|
|
2730
|
+
type: "string"
|
|
2731
|
+
})
|
|
2732
|
+
)
|
|
2692
2733
|
)
|
|
2693
2734
|
)
|
|
2694
2735
|
)
|
|
@@ -2701,18 +2742,19 @@ var EntryPullModule = {
|
|
|
2701
2742
|
format,
|
|
2702
2743
|
mode,
|
|
2703
2744
|
whatIf,
|
|
2745
|
+
state,
|
|
2704
2746
|
project: projectId,
|
|
2705
2747
|
diff: diffMode
|
|
2706
2748
|
}) => {
|
|
2707
2749
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2708
|
-
const client = new
|
|
2750
|
+
const client = new ContentClient10({
|
|
2709
2751
|
apiKey,
|
|
2710
2752
|
apiHost,
|
|
2711
2753
|
fetch: fetch3,
|
|
2712
2754
|
projectId,
|
|
2713
2755
|
bypassCache: true
|
|
2714
2756
|
});
|
|
2715
|
-
const source = createEntryEngineDataSource({ client });
|
|
2757
|
+
const source = createEntryEngineDataSource({ client, state });
|
|
2716
2758
|
let target;
|
|
2717
2759
|
const isPackage = isPathAPackageFile(directory);
|
|
2718
2760
|
if (isPackage) {
|
|
@@ -2745,29 +2787,31 @@ var EntryPullModule = {
|
|
|
2745
2787
|
};
|
|
2746
2788
|
|
|
2747
2789
|
// src/commands/canvas/commands/entry/push.ts
|
|
2748
|
-
import { ContentClient as
|
|
2790
|
+
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
2749
2791
|
var EntryPushModule = {
|
|
2750
2792
|
command: "push <directory>",
|
|
2751
2793
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
2752
2794
|
builder: (yargs25) => withConfiguration(
|
|
2753
2795
|
withApiOptions(
|
|
2754
2796
|
withProjectOptions(
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2797
|
+
withStateOptions(
|
|
2798
|
+
withDiffOptions(
|
|
2799
|
+
yargs25.positional("directory", {
|
|
2800
|
+
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
2801
|
+
type: "string"
|
|
2802
|
+
}).option("what-if", {
|
|
2803
|
+
alias: ["w"],
|
|
2804
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2805
|
+
default: false,
|
|
2806
|
+
type: "boolean"
|
|
2807
|
+
}).option("mode", {
|
|
2808
|
+
alias: ["m"],
|
|
2809
|
+
describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
|
|
2810
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2811
|
+
default: "mirror",
|
|
2812
|
+
type: "string"
|
|
2813
|
+
})
|
|
2814
|
+
)
|
|
2771
2815
|
)
|
|
2772
2816
|
)
|
|
2773
2817
|
)
|
|
@@ -2779,11 +2823,12 @@ var EntryPushModule = {
|
|
|
2779
2823
|
directory,
|
|
2780
2824
|
mode,
|
|
2781
2825
|
whatIf,
|
|
2826
|
+
state,
|
|
2782
2827
|
project: projectId,
|
|
2783
2828
|
diff: diffMode
|
|
2784
2829
|
}) => {
|
|
2785
2830
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2786
|
-
const client = new
|
|
2831
|
+
const client = new ContentClient11({
|
|
2787
2832
|
apiKey,
|
|
2788
2833
|
apiHost,
|
|
2789
2834
|
fetch: fetch3,
|
|
@@ -2806,7 +2851,7 @@ var EntryPushModule = {
|
|
|
2806
2851
|
selectDisplayName: selectEntryDisplayName
|
|
2807
2852
|
});
|
|
2808
2853
|
}
|
|
2809
|
-
const target = createEntryEngineDataSource({ client });
|
|
2854
|
+
const target = createEntryEngineDataSource({ client, state });
|
|
2810
2855
|
await syncEngine({
|
|
2811
2856
|
source,
|
|
2812
2857
|
target,
|
|
@@ -2818,7 +2863,7 @@ var EntryPushModule = {
|
|
|
2818
2863
|
};
|
|
2819
2864
|
|
|
2820
2865
|
// src/commands/canvas/commands/entry/remove.ts
|
|
2821
|
-
import { ContentClient as
|
|
2866
|
+
import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
|
|
2822
2867
|
var EntryRemoveModule = {
|
|
2823
2868
|
command: "remove <id>",
|
|
2824
2869
|
aliases: ["delete", "rm"],
|
|
@@ -2832,13 +2877,13 @@ var EntryRemoveModule = {
|
|
|
2832
2877
|
),
|
|
2833
2878
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
2834
2879
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2835
|
-
const client = new
|
|
2880
|
+
const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2836
2881
|
await client.deleteEntry({ entryId: id });
|
|
2837
2882
|
}
|
|
2838
2883
|
};
|
|
2839
2884
|
|
|
2840
2885
|
// src/commands/canvas/commands/entry/update.ts
|
|
2841
|
-
import { ContentClient as
|
|
2886
|
+
import { ContentClient as ContentClient13 } from "@uniformdev/canvas";
|
|
2842
2887
|
var EntryUpdateModule = {
|
|
2843
2888
|
command: "update <filename>",
|
|
2844
2889
|
aliases: ["put"],
|
|
@@ -2852,7 +2897,7 @@ var EntryUpdateModule = {
|
|
|
2852
2897
|
),
|
|
2853
2898
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2854
2899
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2855
|
-
const client = new
|
|
2900
|
+
const client = new ContentClient13({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2856
2901
|
const file = readFileToObject(filename);
|
|
2857
2902
|
await client.upsertEntry(file);
|
|
2858
2903
|
}
|
|
@@ -4698,7 +4743,7 @@ var makeSpinner = () => {
|
|
|
4698
4743
|
const spin = async (text) => {
|
|
4699
4744
|
const spinner = ora(text).start();
|
|
4700
4745
|
spinners.push(spinner);
|
|
4701
|
-
const minWait = new Promise((
|
|
4746
|
+
const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
4702
4747
|
return async () => {
|
|
4703
4748
|
await minWait;
|
|
4704
4749
|
spinner.stop();
|
|
@@ -4714,7 +4759,7 @@ import { PostHog } from "posthog-node";
|
|
|
4714
4759
|
// package.json
|
|
4715
4760
|
var package_default = {
|
|
4716
4761
|
name: "@uniformdev/cli",
|
|
4717
|
-
version: "19.
|
|
4762
|
+
version: "19.50.0",
|
|
4718
4763
|
description: "Uniform command line interface tool",
|
|
4719
4764
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
4720
4765
|
main: "./cli.js",
|
|
@@ -4840,7 +4885,7 @@ import jwt from "jsonwebtoken";
|
|
|
4840
4885
|
import open from "open";
|
|
4841
4886
|
|
|
4842
4887
|
// src/url.ts
|
|
4843
|
-
var makeUrl = (baseUrl,
|
|
4888
|
+
var makeUrl = (baseUrl, path5) => [baseUrl.trim().replace(/\/+$/, ""), path5.trim().replace(/^\/+/, "")].join("/");
|
|
4844
4889
|
|
|
4845
4890
|
// src/auth/getBearerToken.ts
|
|
4846
4891
|
async function getBearerToken(baseUrl) {
|
|
@@ -4912,7 +4957,9 @@ var WRITE_PERMISSIONS = [
|
|
|
4912
4957
|
"OPT_DELETE_TESTS",
|
|
4913
4958
|
"RDT_UPDATE",
|
|
4914
4959
|
"RDT_CREATE",
|
|
4915
|
-
"RDT_DELETE"
|
|
4960
|
+
"RDT_DELETE",
|
|
4961
|
+
"UPM_DATATYPE",
|
|
4962
|
+
"UPM_DATACONN"
|
|
4916
4963
|
];
|
|
4917
4964
|
var makeApiKey = (teamId, projectId, name, permissions) => ({
|
|
4918
4965
|
name,
|
|
@@ -4943,8 +4990,8 @@ var getLimitsSchema = z.object({
|
|
|
4943
4990
|
})
|
|
4944
4991
|
});
|
|
4945
4992
|
var createClient = (baseUrl, authToken) => {
|
|
4946
|
-
const request2 = async (
|
|
4947
|
-
const res = await fetch(makeUrl(baseUrl,
|
|
4993
|
+
const request2 = async (path5, opts, allowedNon2xxStatusCodes = []) => {
|
|
4994
|
+
const res = await fetch(makeUrl(baseUrl, path5), {
|
|
4948
4995
|
...opts,
|
|
4949
4996
|
headers: { Authorization: `Bearer ${authToken}` }
|
|
4950
4997
|
});
|
|
@@ -4952,18 +4999,18 @@ var createClient = (baseUrl, authToken) => {
|
|
|
4952
4999
|
return res;
|
|
4953
5000
|
} else {
|
|
4954
5001
|
throw new Error(
|
|
4955
|
-
`Non-2xx API response: ${opts.method} ${
|
|
5002
|
+
`Non-2xx API response: ${opts.method} ${path5} responded with ${res.status} ${res.statusText}`
|
|
4956
5003
|
);
|
|
4957
5004
|
}
|
|
4958
5005
|
};
|
|
4959
|
-
const requestJson = async (
|
|
4960
|
-
const res = await request2(
|
|
5006
|
+
const requestJson = async (path5, opts, schema2, allowedNon2xxStatusCodes = []) => {
|
|
5007
|
+
const res = await request2(path5, opts, allowedNon2xxStatusCodes);
|
|
4961
5008
|
const data = await res.json();
|
|
4962
5009
|
const parseResult = schema2.safeParse(data);
|
|
4963
5010
|
if (parseResult.success) {
|
|
4964
5011
|
return parseResult.data;
|
|
4965
5012
|
} else {
|
|
4966
|
-
throw new Error(`Invalid ${opts.method} ${
|
|
5013
|
+
throw new Error(`Invalid ${opts.method} ${path5} response: ${parseResult.error.message}`);
|
|
4967
5014
|
}
|
|
4968
5015
|
};
|
|
4969
5016
|
return {
|
|
@@ -5097,7 +5144,7 @@ import fsj2 from "fs-jetpack";
|
|
|
5097
5144
|
import * as git from "isomorphic-git";
|
|
5098
5145
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
5099
5146
|
import os from "os";
|
|
5100
|
-
import
|
|
5147
|
+
import path2 from "path";
|
|
5101
5148
|
async function cloneStarter({
|
|
5102
5149
|
spin,
|
|
5103
5150
|
githubPath,
|
|
@@ -5105,7 +5152,7 @@ async function cloneStarter({
|
|
|
5105
5152
|
dotEnvFile
|
|
5106
5153
|
}) {
|
|
5107
5154
|
const done = await spin("Fetching starter code...");
|
|
5108
|
-
const cloneDir =
|
|
5155
|
+
const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
5109
5156
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
5110
5157
|
try {
|
|
5111
5158
|
await git.clone({
|
|
@@ -5123,10 +5170,10 @@ async function cloneStarter({
|
|
|
5123
5170
|
if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
|
|
5124
5171
|
throw new Error(`"${targetDir}" is not empty`);
|
|
5125
5172
|
}
|
|
5126
|
-
const starterDir =
|
|
5173
|
+
const starterDir = path2.join(cloneDir, ...pathSegments);
|
|
5127
5174
|
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
5128
5175
|
if (dotEnvFile) {
|
|
5129
|
-
fs3.writeFileSync(
|
|
5176
|
+
fs3.writeFileSync(path2.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
5130
5177
|
}
|
|
5131
5178
|
console.log(`
|
|
5132
5179
|
Your project now lives in ${targetDir} \u2728`);
|
|
@@ -5142,9 +5189,9 @@ Installing project dependencies...
|
|
|
5142
5189
|
}
|
|
5143
5190
|
|
|
5144
5191
|
// src/projects/getOrCreateProject.ts
|
|
5145
|
-
import fs4, { existsSync as existsSync2, mkdirSync as
|
|
5192
|
+
import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
5146
5193
|
import inquirer2 from "inquirer";
|
|
5147
|
-
import
|
|
5194
|
+
import path3 from "path";
|
|
5148
5195
|
import slugify from "slugify";
|
|
5149
5196
|
var newProjectId = "$new";
|
|
5150
5197
|
async function getOrCreateProject({
|
|
@@ -5267,10 +5314,10 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
|
5267
5314
|
if (checkTargetDir) {
|
|
5268
5315
|
let targetDir = explicitTargetDir ?? process.cwd();
|
|
5269
5316
|
if (!existsSync2(targetDir)) {
|
|
5270
|
-
|
|
5317
|
+
mkdirSync3(targetDir, { recursive: true });
|
|
5271
5318
|
}
|
|
5272
5319
|
if (fs4.readdirSync(targetDir).length > 0) {
|
|
5273
|
-
targetDir =
|
|
5320
|
+
targetDir = path3.resolve(targetDir, projectNameSlug);
|
|
5274
5321
|
if (fs4.existsSync(targetDir)) {
|
|
5275
5322
|
throw new Error(`${targetDir} already exists, choose a different name.`);
|
|
5276
5323
|
}
|
|
@@ -5561,9 +5608,9 @@ npm run dev
|
|
|
5561
5608
|
}
|
|
5562
5609
|
|
|
5563
5610
|
// src/commands/new/commands/new-mesh-integration.ts
|
|
5564
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
5611
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync4, readdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
5565
5612
|
import inquirer5 from "inquirer";
|
|
5566
|
-
import
|
|
5613
|
+
import path4 from "path";
|
|
5567
5614
|
import slugify2 from "slugify";
|
|
5568
5615
|
async function newMeshIntegrationHandler({
|
|
5569
5616
|
spin,
|
|
@@ -5604,7 +5651,7 @@ async function newMeshIntegrationHandler({
|
|
|
5604
5651
|
targetDir
|
|
5605
5652
|
});
|
|
5606
5653
|
let done = await spin("Registering integration to team...");
|
|
5607
|
-
const pathToManifest =
|
|
5654
|
+
const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
|
|
5608
5655
|
if (!existsSync3(pathToManifest)) {
|
|
5609
5656
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
5610
5657
|
}
|
|
@@ -5613,7 +5660,7 @@ async function newMeshIntegrationHandler({
|
|
|
5613
5660
|
manifestJson.type = typeSlug;
|
|
5614
5661
|
manifestJson.displayName = name;
|
|
5615
5662
|
writeFileSync2(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
|
|
5616
|
-
const packageJsonPath =
|
|
5663
|
+
const packageJsonPath = path4.resolve(targetDir, "package.json");
|
|
5617
5664
|
const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
|
|
5618
5665
|
packageJson.name = typeSlug;
|
|
5619
5666
|
writeFileSync2(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
@@ -5660,10 +5707,10 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
|
|
|
5660
5707
|
}
|
|
5661
5708
|
let targetDir = explicitOutputPath ?? process.cwd();
|
|
5662
5709
|
if (!existsSync3(targetDir)) {
|
|
5663
|
-
|
|
5710
|
+
mkdirSync4(targetDir, { recursive: true });
|
|
5664
5711
|
}
|
|
5665
5712
|
if (readdirSync(targetDir).length > 0) {
|
|
5666
|
-
targetDir =
|
|
5713
|
+
targetDir = path4.resolve(targetDir, typeSlug);
|
|
5667
5714
|
if (existsSync3(targetDir)) {
|
|
5668
5715
|
throw new Error(`${targetDir} directory already exists, choose a different name.`);
|
|
5669
5716
|
}
|
|
@@ -6859,6 +6906,11 @@ var SyncPullModule = {
|
|
|
6859
6906
|
var _a, _b, _c, _d, _e, _f;
|
|
6860
6907
|
return Boolean((_a = config2.entitiesConfig) == null ? void 0 : _a[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
|
|
6861
6908
|
});
|
|
6909
|
+
if (enabledEntities.length === 0) {
|
|
6910
|
+
throw new Error(
|
|
6911
|
+
"No entity types were configured to be pulled. Please make sure you have configuration file (e.g. uniform.config.ts) and at least one entity type is enabled."
|
|
6912
|
+
);
|
|
6913
|
+
}
|
|
6862
6914
|
for (const [entityType, module3] of enabledEntities) {
|
|
6863
6915
|
await module3.handler({
|
|
6864
6916
|
...otherParams,
|
|
@@ -6935,6 +6987,11 @@ var SyncPushModule = {
|
|
|
6935
6987
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
6936
6988
|
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
|
|
6937
6989
|
});
|
|
6990
|
+
if (enabledEntities.length === 0) {
|
|
6991
|
+
throw new Error(
|
|
6992
|
+
"No entities were configured to be pushed. Please make sure you have configuration file and at least one entity type is enabled."
|
|
6993
|
+
);
|
|
6994
|
+
}
|
|
6938
6995
|
for (const [entityType, module3] of enabledEntities) {
|
|
6939
6996
|
await module3.handler({
|
|
6940
6997
|
...otherParams,
|
|
@@ -7032,14 +7089,14 @@ import { join as join3 } from "path";
|
|
|
7032
7089
|
|
|
7033
7090
|
// src/fs.ts
|
|
7034
7091
|
import { promises as fs5 } from "fs";
|
|
7035
|
-
async function readJSON(
|
|
7036
|
-
const fileContents = await fs5.readFile(
|
|
7092
|
+
async function readJSON(path5) {
|
|
7093
|
+
const fileContents = await fs5.readFile(path5, "utf-8");
|
|
7037
7094
|
return JSON.parse(fileContents);
|
|
7038
7095
|
}
|
|
7039
|
-
async function tryReadJSON(
|
|
7096
|
+
async function tryReadJSON(path5, missingValue = null) {
|
|
7040
7097
|
try {
|
|
7041
|
-
const stat = await fs5.stat(
|
|
7042
|
-
return stat.isFile() ? await readJSON(
|
|
7098
|
+
const stat = await fs5.stat(path5);
|
|
7099
|
+
return stat.isFile() ? await readJSON(path5) : missingValue;
|
|
7043
7100
|
} catch (e) {
|
|
7044
7101
|
return missingValue;
|
|
7045
7102
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.50.0",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@thi.ng/mime": "^2.2.23",
|
|
20
|
-
"@uniformdev/canvas": "19.
|
|
21
|
-
"@uniformdev/context": "19.
|
|
22
|
-
"@uniformdev/files": "19.
|
|
23
|
-
"@uniformdev/project-map": "19.
|
|
24
|
-
"@uniformdev/redirect": "19.
|
|
20
|
+
"@uniformdev/canvas": "19.50.0",
|
|
21
|
+
"@uniformdev/context": "19.50.0",
|
|
22
|
+
"@uniformdev/files": "19.50.0",
|
|
23
|
+
"@uniformdev/project-map": "19.50.0",
|
|
24
|
+
"@uniformdev/redirect": "19.50.0",
|
|
25
25
|
"colorette": "2.0.20",
|
|
26
26
|
"cosmiconfig": "8.2.0",
|
|
27
27
|
"cosmiconfig-typescript-loader": "5.0.0",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "b5591b7986196c3917e9cababafaeeef1871cd47"
|
|
70
70
|
}
|