@uniformdev/cli 19.48.1-alpha.8 → 19.49.1
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 +79 -36
- 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(
|
|
@@ -1610,7 +1641,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
1610
1641
|
const checkForFile = async () => {
|
|
1611
1642
|
const file = await options.fileClient.getFile({ id });
|
|
1612
1643
|
if (!file || file.state !== FILE_READY_STATE) {
|
|
1613
|
-
await new Promise((
|
|
1644
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
1614
1645
|
return checkForFile();
|
|
1615
1646
|
}
|
|
1616
1647
|
return file.url;
|
|
@@ -4698,7 +4729,7 @@ var makeSpinner = () => {
|
|
|
4698
4729
|
const spin = async (text) => {
|
|
4699
4730
|
const spinner = ora(text).start();
|
|
4700
4731
|
spinners.push(spinner);
|
|
4701
|
-
const minWait = new Promise((
|
|
4732
|
+
const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
4702
4733
|
return async () => {
|
|
4703
4734
|
await minWait;
|
|
4704
4735
|
spinner.stop();
|
|
@@ -4714,7 +4745,7 @@ import { PostHog } from "posthog-node";
|
|
|
4714
4745
|
// package.json
|
|
4715
4746
|
var package_default = {
|
|
4716
4747
|
name: "@uniformdev/cli",
|
|
4717
|
-
version: "19.
|
|
4748
|
+
version: "19.49.1",
|
|
4718
4749
|
description: "Uniform command line interface tool",
|
|
4719
4750
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
4720
4751
|
main: "./cli.js",
|
|
@@ -4840,7 +4871,7 @@ import jwt from "jsonwebtoken";
|
|
|
4840
4871
|
import open from "open";
|
|
4841
4872
|
|
|
4842
4873
|
// src/url.ts
|
|
4843
|
-
var makeUrl = (baseUrl,
|
|
4874
|
+
var makeUrl = (baseUrl, path5) => [baseUrl.trim().replace(/\/+$/, ""), path5.trim().replace(/^\/+/, "")].join("/");
|
|
4844
4875
|
|
|
4845
4876
|
// src/auth/getBearerToken.ts
|
|
4846
4877
|
async function getBearerToken(baseUrl) {
|
|
@@ -4912,7 +4943,9 @@ var WRITE_PERMISSIONS = [
|
|
|
4912
4943
|
"OPT_DELETE_TESTS",
|
|
4913
4944
|
"RDT_UPDATE",
|
|
4914
4945
|
"RDT_CREATE",
|
|
4915
|
-
"RDT_DELETE"
|
|
4946
|
+
"RDT_DELETE",
|
|
4947
|
+
"UPM_DATATYPE",
|
|
4948
|
+
"UPM_DATACONN"
|
|
4916
4949
|
];
|
|
4917
4950
|
var makeApiKey = (teamId, projectId, name, permissions) => ({
|
|
4918
4951
|
name,
|
|
@@ -4943,8 +4976,8 @@ var getLimitsSchema = z.object({
|
|
|
4943
4976
|
})
|
|
4944
4977
|
});
|
|
4945
4978
|
var createClient = (baseUrl, authToken) => {
|
|
4946
|
-
const request2 = async (
|
|
4947
|
-
const res = await fetch(makeUrl(baseUrl,
|
|
4979
|
+
const request2 = async (path5, opts, allowedNon2xxStatusCodes = []) => {
|
|
4980
|
+
const res = await fetch(makeUrl(baseUrl, path5), {
|
|
4948
4981
|
...opts,
|
|
4949
4982
|
headers: { Authorization: `Bearer ${authToken}` }
|
|
4950
4983
|
});
|
|
@@ -4952,18 +4985,18 @@ var createClient = (baseUrl, authToken) => {
|
|
|
4952
4985
|
return res;
|
|
4953
4986
|
} else {
|
|
4954
4987
|
throw new Error(
|
|
4955
|
-
`Non-2xx API response: ${opts.method} ${
|
|
4988
|
+
`Non-2xx API response: ${opts.method} ${path5} responded with ${res.status} ${res.statusText}`
|
|
4956
4989
|
);
|
|
4957
4990
|
}
|
|
4958
4991
|
};
|
|
4959
|
-
const requestJson = async (
|
|
4960
|
-
const res = await request2(
|
|
4992
|
+
const requestJson = async (path5, opts, schema2, allowedNon2xxStatusCodes = []) => {
|
|
4993
|
+
const res = await request2(path5, opts, allowedNon2xxStatusCodes);
|
|
4961
4994
|
const data = await res.json();
|
|
4962
4995
|
const parseResult = schema2.safeParse(data);
|
|
4963
4996
|
if (parseResult.success) {
|
|
4964
4997
|
return parseResult.data;
|
|
4965
4998
|
} else {
|
|
4966
|
-
throw new Error(`Invalid ${opts.method} ${
|
|
4999
|
+
throw new Error(`Invalid ${opts.method} ${path5} response: ${parseResult.error.message}`);
|
|
4967
5000
|
}
|
|
4968
5001
|
};
|
|
4969
5002
|
return {
|
|
@@ -5097,7 +5130,7 @@ import fsj2 from "fs-jetpack";
|
|
|
5097
5130
|
import * as git from "isomorphic-git";
|
|
5098
5131
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
5099
5132
|
import os from "os";
|
|
5100
|
-
import
|
|
5133
|
+
import path2 from "path";
|
|
5101
5134
|
async function cloneStarter({
|
|
5102
5135
|
spin,
|
|
5103
5136
|
githubPath,
|
|
@@ -5105,7 +5138,7 @@ async function cloneStarter({
|
|
|
5105
5138
|
dotEnvFile
|
|
5106
5139
|
}) {
|
|
5107
5140
|
const done = await spin("Fetching starter code...");
|
|
5108
|
-
const cloneDir =
|
|
5141
|
+
const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
5109
5142
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
5110
5143
|
try {
|
|
5111
5144
|
await git.clone({
|
|
@@ -5123,10 +5156,10 @@ async function cloneStarter({
|
|
|
5123
5156
|
if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
|
|
5124
5157
|
throw new Error(`"${targetDir}" is not empty`);
|
|
5125
5158
|
}
|
|
5126
|
-
const starterDir =
|
|
5159
|
+
const starterDir = path2.join(cloneDir, ...pathSegments);
|
|
5127
5160
|
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
5128
5161
|
if (dotEnvFile) {
|
|
5129
|
-
fs3.writeFileSync(
|
|
5162
|
+
fs3.writeFileSync(path2.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
5130
5163
|
}
|
|
5131
5164
|
console.log(`
|
|
5132
5165
|
Your project now lives in ${targetDir} \u2728`);
|
|
@@ -5142,9 +5175,9 @@ Installing project dependencies...
|
|
|
5142
5175
|
}
|
|
5143
5176
|
|
|
5144
5177
|
// src/projects/getOrCreateProject.ts
|
|
5145
|
-
import fs4, { existsSync as existsSync2, mkdirSync as
|
|
5178
|
+
import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
5146
5179
|
import inquirer2 from "inquirer";
|
|
5147
|
-
import
|
|
5180
|
+
import path3 from "path";
|
|
5148
5181
|
import slugify from "slugify";
|
|
5149
5182
|
var newProjectId = "$new";
|
|
5150
5183
|
async function getOrCreateProject({
|
|
@@ -5267,10 +5300,10 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
|
5267
5300
|
if (checkTargetDir) {
|
|
5268
5301
|
let targetDir = explicitTargetDir ?? process.cwd();
|
|
5269
5302
|
if (!existsSync2(targetDir)) {
|
|
5270
|
-
|
|
5303
|
+
mkdirSync3(targetDir, { recursive: true });
|
|
5271
5304
|
}
|
|
5272
5305
|
if (fs4.readdirSync(targetDir).length > 0) {
|
|
5273
|
-
targetDir =
|
|
5306
|
+
targetDir = path3.resolve(targetDir, projectNameSlug);
|
|
5274
5307
|
if (fs4.existsSync(targetDir)) {
|
|
5275
5308
|
throw new Error(`${targetDir} already exists, choose a different name.`);
|
|
5276
5309
|
}
|
|
@@ -5561,9 +5594,9 @@ npm run dev
|
|
|
5561
5594
|
}
|
|
5562
5595
|
|
|
5563
5596
|
// src/commands/new/commands/new-mesh-integration.ts
|
|
5564
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
5597
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync4, readdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
5565
5598
|
import inquirer5 from "inquirer";
|
|
5566
|
-
import
|
|
5599
|
+
import path4 from "path";
|
|
5567
5600
|
import slugify2 from "slugify";
|
|
5568
5601
|
async function newMeshIntegrationHandler({
|
|
5569
5602
|
spin,
|
|
@@ -5604,7 +5637,7 @@ async function newMeshIntegrationHandler({
|
|
|
5604
5637
|
targetDir
|
|
5605
5638
|
});
|
|
5606
5639
|
let done = await spin("Registering integration to team...");
|
|
5607
|
-
const pathToManifest =
|
|
5640
|
+
const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
|
|
5608
5641
|
if (!existsSync3(pathToManifest)) {
|
|
5609
5642
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
5610
5643
|
}
|
|
@@ -5613,7 +5646,7 @@ async function newMeshIntegrationHandler({
|
|
|
5613
5646
|
manifestJson.type = typeSlug;
|
|
5614
5647
|
manifestJson.displayName = name;
|
|
5615
5648
|
writeFileSync2(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
|
|
5616
|
-
const packageJsonPath =
|
|
5649
|
+
const packageJsonPath = path4.resolve(targetDir, "package.json");
|
|
5617
5650
|
const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
|
|
5618
5651
|
packageJson.name = typeSlug;
|
|
5619
5652
|
writeFileSync2(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
@@ -5660,10 +5693,10 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
|
|
|
5660
5693
|
}
|
|
5661
5694
|
let targetDir = explicitOutputPath ?? process.cwd();
|
|
5662
5695
|
if (!existsSync3(targetDir)) {
|
|
5663
|
-
|
|
5696
|
+
mkdirSync4(targetDir, { recursive: true });
|
|
5664
5697
|
}
|
|
5665
5698
|
if (readdirSync(targetDir).length > 0) {
|
|
5666
|
-
targetDir =
|
|
5699
|
+
targetDir = path4.resolve(targetDir, typeSlug);
|
|
5667
5700
|
if (existsSync3(targetDir)) {
|
|
5668
5701
|
throw new Error(`${targetDir} directory already exists, choose a different name.`);
|
|
5669
5702
|
}
|
|
@@ -6859,6 +6892,11 @@ var SyncPullModule = {
|
|
|
6859
6892
|
var _a, _b, _c, _d, _e, _f;
|
|
6860
6893
|
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
6894
|
});
|
|
6895
|
+
if (enabledEntities.length === 0) {
|
|
6896
|
+
throw new Error(
|
|
6897
|
+
"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."
|
|
6898
|
+
);
|
|
6899
|
+
}
|
|
6862
6900
|
for (const [entityType, module3] of enabledEntities) {
|
|
6863
6901
|
await module3.handler({
|
|
6864
6902
|
...otherParams,
|
|
@@ -6935,6 +6973,11 @@ var SyncPushModule = {
|
|
|
6935
6973
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
6936
6974
|
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
6975
|
});
|
|
6976
|
+
if (enabledEntities.length === 0) {
|
|
6977
|
+
throw new Error(
|
|
6978
|
+
"No entities were configured to be pushed. Please make sure you have configuration file and at least one entity type is enabled."
|
|
6979
|
+
);
|
|
6980
|
+
}
|
|
6938
6981
|
for (const [entityType, module3] of enabledEntities) {
|
|
6939
6982
|
await module3.handler({
|
|
6940
6983
|
...otherParams,
|
|
@@ -7032,14 +7075,14 @@ import { join as join3 } from "path";
|
|
|
7032
7075
|
|
|
7033
7076
|
// src/fs.ts
|
|
7034
7077
|
import { promises as fs5 } from "fs";
|
|
7035
|
-
async function readJSON(
|
|
7036
|
-
const fileContents = await fs5.readFile(
|
|
7078
|
+
async function readJSON(path5) {
|
|
7079
|
+
const fileContents = await fs5.readFile(path5, "utf-8");
|
|
7037
7080
|
return JSON.parse(fileContents);
|
|
7038
7081
|
}
|
|
7039
|
-
async function tryReadJSON(
|
|
7082
|
+
async function tryReadJSON(path5, missingValue = null) {
|
|
7040
7083
|
try {
|
|
7041
|
-
const stat = await fs5.stat(
|
|
7042
|
-
return stat.isFile() ? await readJSON(
|
|
7084
|
+
const stat = await fs5.stat(path5);
|
|
7085
|
+
return stat.isFile() ? await readJSON(path5) : missingValue;
|
|
7043
7086
|
} catch (e) {
|
|
7044
7087
|
return missingValue;
|
|
7045
7088
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.49.1",
|
|
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.49.1",
|
|
21
|
+
"@uniformdev/context": "19.49.1",
|
|
22
|
+
"@uniformdev/files": "19.49.1",
|
|
23
|
+
"@uniformdev/project-map": "19.49.1",
|
|
24
|
+
"@uniformdev/redirect": "19.49.1",
|
|
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": "a14b97601fb78b44be7f0849841b9828dec0ea96"
|
|
70
70
|
}
|