@uniformdev/cli 19.51.1-alpha.10 → 19.51.1-alpha.22
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.d.mts +1 -1
- package/dist/index.mjs +131 -69
- package/package.json +14 -14
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
type SyncMode = 'mirror' | 'createOrUpdate' | 'create';
|
|
3
|
-
type EntityTypes = 'category' | 'dataType' | 'quirk' | 'test' | 'signal' | 'enrichment' | 'aggregate' | 'component' | 'composition' | 'pattern' | 'projectMapDefinition' | 'projectMapNode' | 'redirect';
|
|
3
|
+
type EntityTypes = 'category' | 'dataType' | 'quirk' | 'test' | 'signal' | 'enrichment' | 'aggregate' | 'component' | 'composition' | 'pattern' | 'projectMapDefinition' | 'projectMapNode' | 'redirect' | 'entry' | 'contentType';
|
|
4
4
|
type SyncFileFormat = 'yaml' | 'json';
|
|
5
5
|
type EntityConfiguration = {
|
|
6
6
|
mode?: SyncMode;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.
|
|
3
|
+
// ../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.28_ts-node@10.9.1_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import path from "path";
|
|
6
6
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -605,6 +605,13 @@ function createSyncEngineConsoleLogger(options) {
|
|
|
605
605
|
);
|
|
606
606
|
};
|
|
607
607
|
}
|
|
608
|
+
function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
609
|
+
const { indent, prefix, status } = options ?? {};
|
|
610
|
+
return function syncEngineConsoleLogger({ displayName, whatIf }) {
|
|
611
|
+
const actionTag = status === "publish" ? green("[P]") : yellow("[U]");
|
|
612
|
+
console.log(`${indent ?? ""}${whatIf ? gray("[WHATIF]") : ""}${actionTag}${prefix ?? ""} ${displayName}`);
|
|
613
|
+
};
|
|
614
|
+
}
|
|
608
615
|
|
|
609
616
|
// src/commands/canvas/commands/category/get.ts
|
|
610
617
|
var CategoryGetModule = {
|
|
@@ -765,6 +772,7 @@ var CategoryPullModule = {
|
|
|
765
772
|
target,
|
|
766
773
|
mode,
|
|
767
774
|
whatIf,
|
|
775
|
+
allowEmptySource: true,
|
|
768
776
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
769
777
|
});
|
|
770
778
|
}
|
|
@@ -1071,6 +1079,7 @@ var ComponentPullModule = {
|
|
|
1071
1079
|
target,
|
|
1072
1080
|
mode,
|
|
1073
1081
|
whatIf,
|
|
1082
|
+
allowEmptySource: true,
|
|
1074
1083
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1075
1084
|
});
|
|
1076
1085
|
}
|
|
@@ -1482,7 +1491,6 @@ var CompositionPublishModule = {
|
|
|
1482
1491
|
all,
|
|
1483
1492
|
whatIf,
|
|
1484
1493
|
project: projectId,
|
|
1485
|
-
diff: diffMode,
|
|
1486
1494
|
onlyCompositions,
|
|
1487
1495
|
onlyPatterns
|
|
1488
1496
|
}) => {
|
|
@@ -1513,7 +1521,7 @@ var CompositionPublishModule = {
|
|
|
1513
1521
|
// Publishing is one-direction operation, so no need to support automatic un-publishing
|
|
1514
1522
|
mode: "createOrUpdate",
|
|
1515
1523
|
whatIf,
|
|
1516
|
-
log:
|
|
1524
|
+
log: createPublishStatusSyncEngineConsoleLogger({ status: "publish" })
|
|
1517
1525
|
});
|
|
1518
1526
|
}
|
|
1519
1527
|
};
|
|
@@ -1591,8 +1599,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
1591
1599
|
fileUploadQueue.add(async () => {
|
|
1592
1600
|
try {
|
|
1593
1601
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
1594
|
-
options.fileClient.
|
|
1595
|
-
options.fileClient.
|
|
1602
|
+
options.fileClient.get({ url }).catch(() => null),
|
|
1603
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
1596
1604
|
]);
|
|
1597
1605
|
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
1598
1606
|
return;
|
|
@@ -1624,13 +1632,12 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
1624
1632
|
};
|
|
1625
1633
|
}
|
|
1626
1634
|
})();
|
|
1627
|
-
const { id, method, uploadUrl } = await options.fileClient.
|
|
1635
|
+
const { id, method, uploadUrl } = await options.fileClient.insert({
|
|
1628
1636
|
name: fileName,
|
|
1629
1637
|
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
1630
1638
|
size: fileBuffer.length,
|
|
1631
1639
|
width,
|
|
1632
1640
|
height,
|
|
1633
|
-
projectId: options.projectId,
|
|
1634
1641
|
sourceId: hash
|
|
1635
1642
|
});
|
|
1636
1643
|
const uploadResponse = await fetch(uploadUrl, {
|
|
@@ -1642,8 +1649,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
1642
1649
|
return;
|
|
1643
1650
|
}
|
|
1644
1651
|
const checkForFile = async () => {
|
|
1645
|
-
const file = await options.fileClient.
|
|
1646
|
-
if (!file || file.state !== FILE_READY_STATE) {
|
|
1652
|
+
const file = await options.fileClient.get({ id });
|
|
1653
|
+
if (!file || file.state !== FILE_READY_STATE || !file.url) {
|
|
1647
1654
|
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
1648
1655
|
return checkForFile();
|
|
1649
1656
|
}
|
|
@@ -1677,8 +1684,8 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
1677
1684
|
fileUrlReplacementQueue.add(async () => {
|
|
1678
1685
|
try {
|
|
1679
1686
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
1680
|
-
options.fileClient.
|
|
1681
|
-
options.fileClient.
|
|
1687
|
+
options.fileClient.get({ url }).catch(() => null),
|
|
1688
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
1682
1689
|
]);
|
|
1683
1690
|
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
1684
1691
|
if (!file) {
|
|
@@ -1781,6 +1788,7 @@ var CompositionPullModule = {
|
|
|
1781
1788
|
target,
|
|
1782
1789
|
mode,
|
|
1783
1790
|
whatIf,
|
|
1791
|
+
allowEmptySource: true,
|
|
1784
1792
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1785
1793
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1786
1794
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
@@ -1951,7 +1959,6 @@ var CompositionUnpublishModule = {
|
|
|
1951
1959
|
onlyCompositions,
|
|
1952
1960
|
onlyPatterns,
|
|
1953
1961
|
project: projectId,
|
|
1954
|
-
diff,
|
|
1955
1962
|
whatIf
|
|
1956
1963
|
}) => {
|
|
1957
1964
|
if (!all && !ids || all && ids) {
|
|
@@ -1977,7 +1984,7 @@ var CompositionUnpublishModule = {
|
|
|
1977
1984
|
onlyPatterns
|
|
1978
1985
|
});
|
|
1979
1986
|
const actions = [];
|
|
1980
|
-
const log =
|
|
1987
|
+
const log = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
1981
1988
|
for await (const obj of target.objects) {
|
|
1982
1989
|
if (Array.isArray(obj.id)) {
|
|
1983
1990
|
obj.id.forEach((o) => targetItems.set(o, obj));
|
|
@@ -2196,6 +2203,7 @@ var ContentTypePullModule = {
|
|
|
2196
2203
|
target,
|
|
2197
2204
|
mode,
|
|
2198
2205
|
whatIf,
|
|
2206
|
+
allowEmptySource: true,
|
|
2199
2207
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2200
2208
|
});
|
|
2201
2209
|
}
|
|
@@ -2384,8 +2392,12 @@ function createDataTypeEngineDataSource({
|
|
|
2384
2392
|
client
|
|
2385
2393
|
}) {
|
|
2386
2394
|
async function* getObjects() {
|
|
2395
|
+
var _a;
|
|
2387
2396
|
const dataTypes = (await client.get()).results;
|
|
2388
2397
|
for await (const dataType of dataTypes) {
|
|
2398
|
+
if (((_a = dataType.custom) == null ? void 0 : _a.uniformAutogenerated) === true) {
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
2389
2401
|
const result = {
|
|
2390
2402
|
id: selectIdentifier4(dataType),
|
|
2391
2403
|
displayName: selectDisplayName4(dataType),
|
|
@@ -2487,6 +2499,7 @@ var DataTypePullModule = {
|
|
|
2487
2499
|
target,
|
|
2488
2500
|
mode,
|
|
2489
2501
|
whatIf,
|
|
2502
|
+
allowEmptySource: true,
|
|
2490
2503
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2491
2504
|
});
|
|
2492
2505
|
}
|
|
@@ -2677,7 +2690,12 @@ function createEntryEngineDataSource({
|
|
|
2677
2690
|
}) {
|
|
2678
2691
|
const stateId = convertCompositionState(state);
|
|
2679
2692
|
async function* getObjects() {
|
|
2680
|
-
const { entries } = await client.getEntries({
|
|
2693
|
+
const { entries } = await client.getEntries({
|
|
2694
|
+
offset: 0,
|
|
2695
|
+
limit: 1e3,
|
|
2696
|
+
skipDataResolution: true,
|
|
2697
|
+
state: stateId
|
|
2698
|
+
});
|
|
2681
2699
|
for await (const e of entries) {
|
|
2682
2700
|
const result = {
|
|
2683
2701
|
id: selectEntryIdentifier(e),
|
|
@@ -2781,6 +2799,7 @@ var EntryPullModule = {
|
|
|
2781
2799
|
target,
|
|
2782
2800
|
mode,
|
|
2783
2801
|
whatIf,
|
|
2802
|
+
allowEmptySource: true,
|
|
2784
2803
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2785
2804
|
});
|
|
2786
2805
|
}
|
|
@@ -4740,7 +4759,7 @@ import ora from "ora";
|
|
|
4740
4759
|
var makeSpinner = () => {
|
|
4741
4760
|
const spinners = [];
|
|
4742
4761
|
const stopAllSpinners = () => spinners.forEach((spinner) => spinner.stop());
|
|
4743
|
-
const
|
|
4762
|
+
const spin2 = async (text) => {
|
|
4744
4763
|
const spinner = ora(text).start();
|
|
4745
4764
|
spinners.push(spinner);
|
|
4746
4765
|
const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
@@ -4749,7 +4768,7 @@ var makeSpinner = () => {
|
|
|
4749
4768
|
spinner.stop();
|
|
4750
4769
|
};
|
|
4751
4770
|
};
|
|
4752
|
-
return { stopAllSpinners, spin };
|
|
4771
|
+
return { stopAllSpinners, spin: spin2 };
|
|
4753
4772
|
};
|
|
4754
4773
|
|
|
4755
4774
|
// src/telemetry/telemetry.ts
|
|
@@ -4759,7 +4778,7 @@ import { PostHog } from "posthog-node";
|
|
|
4759
4778
|
// package.json
|
|
4760
4779
|
var package_default = {
|
|
4761
4780
|
name: "@uniformdev/cli",
|
|
4762
|
-
version: "19.
|
|
4781
|
+
version: "19.57.0",
|
|
4763
4782
|
description: "Uniform command line interface tool",
|
|
4764
4783
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
4765
4784
|
main: "./cli.js",
|
|
@@ -4782,17 +4801,17 @@ var package_default = {
|
|
|
4782
4801
|
"@uniformdev/project-map": "workspace:*",
|
|
4783
4802
|
"@uniformdev/redirect": "workspace:*",
|
|
4784
4803
|
colorette: "2.0.20",
|
|
4785
|
-
cosmiconfig: "8.
|
|
4804
|
+
cosmiconfig: "8.3.6",
|
|
4786
4805
|
"cosmiconfig-typescript-loader": "5.0.0",
|
|
4787
4806
|
diff: "^5.0.0",
|
|
4788
4807
|
dotenv: "^16.0.3",
|
|
4789
4808
|
execa: "5.1.1",
|
|
4790
4809
|
"fs-jetpack": "5.1.0",
|
|
4791
|
-
graphql: "16.8.
|
|
4810
|
+
graphql: "16.8.1",
|
|
4792
4811
|
"graphql-request": "6.1.0",
|
|
4793
4812
|
"https-proxy-agent": "^7.0.0",
|
|
4794
4813
|
"image-size": "^1.0.2",
|
|
4795
|
-
inquirer: "9.2.
|
|
4814
|
+
inquirer: "9.2.11",
|
|
4796
4815
|
"isomorphic-git": "1.24.5",
|
|
4797
4816
|
"isomorphic-unfetch": "^3.1.0",
|
|
4798
4817
|
"js-yaml": "^4.1.0",
|
|
@@ -4808,12 +4827,12 @@ var package_default = {
|
|
|
4808
4827
|
zod: "3.21.4"
|
|
4809
4828
|
},
|
|
4810
4829
|
devDependencies: {
|
|
4811
|
-
"@types/diff": "5.0.
|
|
4830
|
+
"@types/diff": "5.0.4",
|
|
4812
4831
|
"@types/inquirer": "9.0.3",
|
|
4813
|
-
"@types/js-yaml": "4.0.
|
|
4814
|
-
"@types/jsonwebtoken": "9.0.
|
|
4832
|
+
"@types/js-yaml": "4.0.6",
|
|
4833
|
+
"@types/jsonwebtoken": "9.0.3",
|
|
4815
4834
|
"@types/lodash.isequalwith": "4.4.7",
|
|
4816
|
-
"@types/node": "18.17.
|
|
4835
|
+
"@types/node": "18.17.17",
|
|
4817
4836
|
"@types/yargs": "17.0.24"
|
|
4818
4837
|
},
|
|
4819
4838
|
bin: {
|
|
@@ -5146,12 +5165,12 @@ import * as http from "isomorphic-git/http/node/index.js";
|
|
|
5146
5165
|
import os from "os";
|
|
5147
5166
|
import path2 from "path";
|
|
5148
5167
|
async function cloneStarter({
|
|
5149
|
-
spin,
|
|
5168
|
+
spin: spin2,
|
|
5150
5169
|
githubPath,
|
|
5151
5170
|
targetDir,
|
|
5152
5171
|
dotEnvFile
|
|
5153
5172
|
}) {
|
|
5154
|
-
const done = await
|
|
5173
|
+
const done = await spin2("Fetching starter code...");
|
|
5155
5174
|
const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
5156
5175
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
5157
5176
|
try {
|
|
@@ -5201,7 +5220,7 @@ async function getOrCreateProject({
|
|
|
5201
5220
|
user,
|
|
5202
5221
|
explicitName,
|
|
5203
5222
|
client,
|
|
5204
|
-
spin,
|
|
5223
|
+
spin: spin2,
|
|
5205
5224
|
checkTargetDir,
|
|
5206
5225
|
explicitTargetDir,
|
|
5207
5226
|
previewUrl,
|
|
@@ -5231,7 +5250,7 @@ async function getOrCreateProject({
|
|
|
5231
5250
|
checkTargetDir,
|
|
5232
5251
|
explicitTargetDir
|
|
5233
5252
|
});
|
|
5234
|
-
const projectId = await createProject({ client, projectName, spin, teamId, previewUrl });
|
|
5253
|
+
const projectId = await createProject({ client, projectName, spin: spin2, teamId, previewUrl });
|
|
5235
5254
|
telemetry.send("project created", { projectId, targetDir });
|
|
5236
5255
|
return {
|
|
5237
5256
|
projectId,
|
|
@@ -5272,11 +5291,11 @@ async function getNewProjectName({
|
|
|
5272
5291
|
async function createProject({
|
|
5273
5292
|
projectName,
|
|
5274
5293
|
teamId,
|
|
5275
|
-
spin,
|
|
5294
|
+
spin: spin2,
|
|
5276
5295
|
client,
|
|
5277
5296
|
previewUrl
|
|
5278
5297
|
}) {
|
|
5279
|
-
const done = await
|
|
5298
|
+
const done = await spin2("Creating your new project...");
|
|
5280
5299
|
const projectId = await client.createProject(teamId, projectName, previewUrl);
|
|
5281
5300
|
await done();
|
|
5282
5301
|
return projectId;
|
|
@@ -5405,11 +5424,11 @@ var getUserInfo = async (baseUrl, authToken, subject) => {
|
|
|
5405
5424
|
async function fetchUserAndEnsureFirstTeamExists({
|
|
5406
5425
|
baseUrl,
|
|
5407
5426
|
auth: { authToken, decoded },
|
|
5408
|
-
spin,
|
|
5427
|
+
spin: spin2,
|
|
5409
5428
|
telemetry
|
|
5410
5429
|
}) {
|
|
5411
5430
|
const uniformClient = createClient(baseUrl, authToken);
|
|
5412
|
-
const done = await
|
|
5431
|
+
const done = await spin2("Fetching user information...");
|
|
5413
5432
|
let user = await getUserInfo(baseUrl, authToken, decoded.sub);
|
|
5414
5433
|
if (user.teams.length < 1) {
|
|
5415
5434
|
await uniformClient.createTeam(`${user.name}'s team`);
|
|
@@ -5422,7 +5441,7 @@ async function fetchUserAndEnsureFirstTeamExists({
|
|
|
5422
5441
|
|
|
5423
5442
|
// src/commands/new/commands/new.ts
|
|
5424
5443
|
async function newHandler({
|
|
5425
|
-
spin,
|
|
5444
|
+
spin: spin2,
|
|
5426
5445
|
projectName,
|
|
5427
5446
|
apiHost,
|
|
5428
5447
|
outputPath,
|
|
@@ -5434,7 +5453,7 @@ async function newHandler({
|
|
|
5434
5453
|
const auth = await getBearerToken(apiHost);
|
|
5435
5454
|
const { authToken } = auth;
|
|
5436
5455
|
const uniformClient = createClient(apiHost, authToken);
|
|
5437
|
-
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
|
|
5456
|
+
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin: spin2, telemetry });
|
|
5438
5457
|
const { teamId } = await chooseTeam(
|
|
5439
5458
|
user,
|
|
5440
5459
|
`Hey ${user.name}! Choose a Uniform team for your new project`,
|
|
@@ -5533,7 +5552,7 @@ async function newHandler({
|
|
|
5533
5552
|
client: uniformClient,
|
|
5534
5553
|
createNew: true,
|
|
5535
5554
|
chooseExisting: false,
|
|
5536
|
-
spin,
|
|
5555
|
+
spin: spin2,
|
|
5537
5556
|
teamId,
|
|
5538
5557
|
user,
|
|
5539
5558
|
explicitName: projectName,
|
|
@@ -5542,7 +5561,7 @@ async function newHandler({
|
|
|
5542
5561
|
previewUrl: serverUrl + previewPath,
|
|
5543
5562
|
telemetry
|
|
5544
5563
|
});
|
|
5545
|
-
let done = await
|
|
5564
|
+
let done = await spin2("Generating API keys...");
|
|
5546
5565
|
const { readApiKey, writeApiKey } = await uniformClient.createApiKeys(teamId, projectId);
|
|
5547
5566
|
await done();
|
|
5548
5567
|
const dotEnvFile = [
|
|
@@ -5560,7 +5579,7 @@ async function newHandler({
|
|
|
5560
5579
|
if (githubUri.endsWith("commerce-starter")) {
|
|
5561
5580
|
const stableFakecommerceId = "fakecommerce-d04dcf12-f811-401d-add8-1fb81cfdb8a5";
|
|
5562
5581
|
const canaryFakecommerceId = "fakecommerce-f94cf199-7ea4-46ce-ae8b-825668bb79bc";
|
|
5563
|
-
done = await
|
|
5582
|
+
done = await spin2("Installing Fake Commerce...");
|
|
5564
5583
|
await uniformClient.installIntegration({
|
|
5565
5584
|
projectId,
|
|
5566
5585
|
type: apiHost.includes("canary") ? canaryFakecommerceId : stableFakecommerceId
|
|
@@ -5570,7 +5589,7 @@ async function newHandler({
|
|
|
5570
5589
|
const cloneStartTimestamp = Date.now();
|
|
5571
5590
|
const { runNpmInstall } = await cloneStarter({
|
|
5572
5591
|
githubPath: githubUri,
|
|
5573
|
-
spin,
|
|
5592
|
+
spin: spin2,
|
|
5574
5593
|
targetDir,
|
|
5575
5594
|
dotEnvFile
|
|
5576
5595
|
});
|
|
@@ -5578,7 +5597,7 @@ async function newHandler({
|
|
|
5578
5597
|
const installStartTimestamp = Date.now();
|
|
5579
5598
|
await runNpmInstall();
|
|
5580
5599
|
telemetry.send("deps installed", { duration: Date.now() - installStartTimestamp });
|
|
5581
|
-
done = await
|
|
5600
|
+
done = await spin2("Creating components and compositions");
|
|
5582
5601
|
await runNpm(targetDir, ["run", "uniform:push"]);
|
|
5583
5602
|
await runNpm(targetDir, ["run", "uniform:publish"]);
|
|
5584
5603
|
await done();
|
|
@@ -5613,7 +5632,7 @@ import inquirer5 from "inquirer";
|
|
|
5613
5632
|
import path4 from "path";
|
|
5614
5633
|
import slugify2 from "slugify";
|
|
5615
5634
|
async function newMeshIntegrationHandler({
|
|
5616
|
-
spin,
|
|
5635
|
+
spin: spin2,
|
|
5617
5636
|
apiHost,
|
|
5618
5637
|
outputPath,
|
|
5619
5638
|
telemetry
|
|
@@ -5622,7 +5641,7 @@ async function newMeshIntegrationHandler({
|
|
|
5622
5641
|
const auth = await getBearerToken(apiHost);
|
|
5623
5642
|
const { authToken } = auth;
|
|
5624
5643
|
const uniformClient = createClient(apiHost, authToken);
|
|
5625
|
-
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
|
|
5644
|
+
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin: spin2, telemetry });
|
|
5626
5645
|
const { teamId } = await chooseTeam(
|
|
5627
5646
|
user,
|
|
5628
5647
|
`Hey ${user.name}! Choose a Uniform team to register your integration`,
|
|
@@ -5647,10 +5666,10 @@ async function newMeshIntegrationHandler({
|
|
|
5647
5666
|
const { targetDir, typeSlug } = validateIntegrationName(answer.name, outputPath);
|
|
5648
5667
|
const { runNpmInstall } = await cloneStarter({
|
|
5649
5668
|
githubPath: `uniformdev/examples/examples/mesh-integration`,
|
|
5650
|
-
spin,
|
|
5669
|
+
spin: spin2,
|
|
5651
5670
|
targetDir
|
|
5652
5671
|
});
|
|
5653
|
-
let done = await
|
|
5672
|
+
let done = await spin2("Registering integration to team...");
|
|
5654
5673
|
const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
|
|
5655
5674
|
if (!existsSync3(pathToManifest)) {
|
|
5656
5675
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
@@ -5672,13 +5691,13 @@ async function newMeshIntegrationHandler({
|
|
|
5672
5691
|
client: uniformClient,
|
|
5673
5692
|
createNew: true,
|
|
5674
5693
|
chooseExisting: true,
|
|
5675
|
-
spin,
|
|
5694
|
+
spin: spin2,
|
|
5676
5695
|
teamId,
|
|
5677
5696
|
user,
|
|
5678
5697
|
checkTargetDir: false,
|
|
5679
5698
|
telemetry
|
|
5680
5699
|
});
|
|
5681
|
-
done = await
|
|
5700
|
+
done = await spin2("Installing integration to project...");
|
|
5682
5701
|
await uniformClient.installIntegration({ projectId, type: typeSlug });
|
|
5683
5702
|
await done();
|
|
5684
5703
|
console.log(`
|
|
@@ -5748,10 +5767,10 @@ var NewCmd = {
|
|
|
5748
5767
|
),
|
|
5749
5768
|
describe: "Start a new Uniform project",
|
|
5750
5769
|
handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
|
|
5751
|
-
const { stopAllSpinners, spin } = makeSpinner();
|
|
5770
|
+
const { stopAllSpinners, spin: spin2 } = makeSpinner();
|
|
5752
5771
|
const telemetry = new Telemetry("cli new", disableTelemetry || apiHost !== stableApiHost);
|
|
5753
5772
|
try {
|
|
5754
|
-
await newHandler({ spin, projectName: name, apiHost, outputPath, telemetry });
|
|
5773
|
+
await newHandler({ spin: spin2, projectName: name, apiHost, outputPath, telemetry });
|
|
5755
5774
|
stopAllSpinners();
|
|
5756
5775
|
process.exit(0);
|
|
5757
5776
|
} catch (err) {
|
|
@@ -5785,10 +5804,10 @@ var NewMeshCmd = {
|
|
|
5785
5804
|
),
|
|
5786
5805
|
describe: "Start a new Uniform project",
|
|
5787
5806
|
handler: async function({ apiHost, outputPath, disableTelemetry }) {
|
|
5788
|
-
const { stopAllSpinners, spin } = makeSpinner();
|
|
5807
|
+
const { stopAllSpinners, spin: spin2 } = makeSpinner();
|
|
5789
5808
|
const telemetry = new Telemetry("cli new mesh", disableTelemetry || apiHost !== stableApiHost);
|
|
5790
5809
|
try {
|
|
5791
|
-
await newMeshIntegrationHandler({ spin, apiHost, outputPath, telemetry });
|
|
5810
|
+
await newMeshIntegrationHandler({ spin: spin2, apiHost, outputPath, telemetry });
|
|
5792
5811
|
stopAllSpinners();
|
|
5793
5812
|
process.exit(0);
|
|
5794
5813
|
} catch (err) {
|
|
@@ -6868,6 +6887,31 @@ var RedirectCommand = {
|
|
|
6868
6887
|
// src/commands/sync/index.ts
|
|
6869
6888
|
import yargs23 from "yargs";
|
|
6870
6889
|
|
|
6890
|
+
// src/commands/sync/commands/util.ts
|
|
6891
|
+
import ora2 from "ora";
|
|
6892
|
+
function spin(entityType) {
|
|
6893
|
+
const spinner = ora2(entityType).start();
|
|
6894
|
+
const consoleLog = console.log;
|
|
6895
|
+
console.log = (...text) => {
|
|
6896
|
+
if (text.length === 1 && typeof text[0] === "string") {
|
|
6897
|
+
spinner.text += "\n" + text;
|
|
6898
|
+
} else {
|
|
6899
|
+
consoleLog(...text);
|
|
6900
|
+
}
|
|
6901
|
+
};
|
|
6902
|
+
return {
|
|
6903
|
+
...spinner,
|
|
6904
|
+
stop: () => {
|
|
6905
|
+
spinner.stop();
|
|
6906
|
+
console.log = consoleLog;
|
|
6907
|
+
},
|
|
6908
|
+
succeed() {
|
|
6909
|
+
spinner.succeed();
|
|
6910
|
+
console.log = consoleLog;
|
|
6911
|
+
}
|
|
6912
|
+
};
|
|
6913
|
+
}
|
|
6914
|
+
|
|
6871
6915
|
// src/commands/sync/commands/pull.ts
|
|
6872
6916
|
var SyncPullModule = {
|
|
6873
6917
|
command: "pull",
|
|
@@ -6901,7 +6945,9 @@ var SyncPullModule = {
|
|
|
6901
6945
|
composition: CompositionPullModule,
|
|
6902
6946
|
projectMapDefinition: ProjectMapDefinitionPullModule,
|
|
6903
6947
|
projectMapNode: ProjectMapNodePullModule,
|
|
6904
|
-
redirect: RedirectDefinitionPullModule
|
|
6948
|
+
redirect: RedirectDefinitionPullModule,
|
|
6949
|
+
entry: EntryPullModule,
|
|
6950
|
+
contentType: ContentTypePullModule
|
|
6905
6951
|
}).filter(([entityType]) => {
|
|
6906
6952
|
var _a, _b, _c, _d, _e, _f;
|
|
6907
6953
|
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;
|
|
@@ -6912,15 +6958,22 @@ var SyncPullModule = {
|
|
|
6912
6958
|
);
|
|
6913
6959
|
}
|
|
6914
6960
|
for (const [entityType, module3] of enabledEntities) {
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6961
|
+
const spinner = spin(entityType);
|
|
6962
|
+
try {
|
|
6963
|
+
await module3.handler({
|
|
6964
|
+
...otherParams,
|
|
6965
|
+
state: 0,
|
|
6966
|
+
format: getFormat(entityType, config2),
|
|
6967
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
6968
|
+
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
6969
|
+
mode: getPullMode(entityType, config2),
|
|
6970
|
+
directory: getPullFilename(entityType, config2)
|
|
6971
|
+
});
|
|
6972
|
+
spinner.succeed();
|
|
6973
|
+
} catch (e) {
|
|
6974
|
+
spinner.stop();
|
|
6975
|
+
throw e;
|
|
6976
|
+
}
|
|
6924
6977
|
}
|
|
6925
6978
|
}
|
|
6926
6979
|
};
|
|
@@ -6982,7 +7035,9 @@ var SyncPushModule = {
|
|
|
6982
7035
|
composition: CompositionPushModule,
|
|
6983
7036
|
projectMapDefinition: ProjectMapDefinitionPushModule,
|
|
6984
7037
|
projectMapNode: ProjectMapNodePushModule,
|
|
6985
|
-
redirect: RedirectDefinitionPushModule
|
|
7038
|
+
redirect: RedirectDefinitionPushModule,
|
|
7039
|
+
contentType: ContentTypePushModule,
|
|
7040
|
+
entry: EntryPushModule
|
|
6986
7041
|
}).filter(([entityType]) => {
|
|
6987
7042
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
6988
7043
|
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;
|
|
@@ -6993,15 +7048,22 @@ var SyncPushModule = {
|
|
|
6993
7048
|
);
|
|
6994
7049
|
}
|
|
6995
7050
|
for (const [entityType, module3] of enabledEntities) {
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7051
|
+
const spinner = spin(entityType);
|
|
7052
|
+
try {
|
|
7053
|
+
await module3.handler({
|
|
7054
|
+
...otherParams,
|
|
7055
|
+
state: 0,
|
|
7056
|
+
format: getFormat2(entityType, config2),
|
|
7057
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
7058
|
+
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
7059
|
+
mode: getPushMode(entityType, config2),
|
|
7060
|
+
directory: getPushFilename(entityType, config2)
|
|
7061
|
+
});
|
|
7062
|
+
spinner.succeed();
|
|
7063
|
+
} catch (e) {
|
|
7064
|
+
spinner.stop();
|
|
7065
|
+
throw e;
|
|
7066
|
+
}
|
|
7005
7067
|
}
|
|
7006
7068
|
if (((_a = config2.entitiesConfig) == null ? void 0 : _a.pattern) && ((_d = (_c = (_b = config2.entitiesConfig) == null ? void 0 : _b.pattern) == null ? void 0 : _c.push) == null ? void 0 : _d.disabled) !== true && ((_f = (_e = config2.entitiesConfig) == null ? void 0 : _e.pattern) == null ? void 0 : _f.publish)) {
|
|
7007
7069
|
await PatternPublishModule.handler({ ...otherParams, all: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "19.51.1-alpha.
|
|
3
|
+
"version": "19.51.1-alpha.22+ee274f045",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@thi.ng/mime": "^2.2.23",
|
|
20
|
-
"@uniformdev/canvas": "19.51.1-alpha.
|
|
21
|
-
"@uniformdev/context": "19.51.1-alpha.
|
|
22
|
-
"@uniformdev/files": "19.51.1-alpha.
|
|
23
|
-
"@uniformdev/project-map": "19.51.1-alpha.
|
|
24
|
-
"@uniformdev/redirect": "19.51.1-alpha.
|
|
20
|
+
"@uniformdev/canvas": "19.51.1-alpha.22+ee274f045",
|
|
21
|
+
"@uniformdev/context": "19.51.1-alpha.22+ee274f045",
|
|
22
|
+
"@uniformdev/files": "19.51.1-alpha.22+ee274f045",
|
|
23
|
+
"@uniformdev/project-map": "19.51.1-alpha.22+ee274f045",
|
|
24
|
+
"@uniformdev/redirect": "19.51.1-alpha.22+ee274f045",
|
|
25
25
|
"colorette": "2.0.20",
|
|
26
|
-
"cosmiconfig": "8.
|
|
26
|
+
"cosmiconfig": "8.3.6",
|
|
27
27
|
"cosmiconfig-typescript-loader": "5.0.0",
|
|
28
28
|
"diff": "^5.0.0",
|
|
29
29
|
"dotenv": "^16.0.3",
|
|
30
30
|
"execa": "5.1.1",
|
|
31
31
|
"fs-jetpack": "5.1.0",
|
|
32
|
-
"graphql": "16.8.
|
|
32
|
+
"graphql": "16.8.1",
|
|
33
33
|
"graphql-request": "6.1.0",
|
|
34
34
|
"https-proxy-agent": "^7.0.0",
|
|
35
35
|
"image-size": "^1.0.2",
|
|
36
|
-
"inquirer": "9.2.
|
|
36
|
+
"inquirer": "9.2.11",
|
|
37
37
|
"isomorphic-git": "1.24.5",
|
|
38
38
|
"isomorphic-unfetch": "^3.1.0",
|
|
39
39
|
"js-yaml": "^4.1.0",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"zod": "3.21.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/diff": "5.0.
|
|
52
|
+
"@types/diff": "5.0.4",
|
|
53
53
|
"@types/inquirer": "9.0.3",
|
|
54
|
-
"@types/js-yaml": "4.0.
|
|
55
|
-
"@types/jsonwebtoken": "9.0.
|
|
54
|
+
"@types/js-yaml": "4.0.6",
|
|
55
|
+
"@types/jsonwebtoken": "9.0.3",
|
|
56
56
|
"@types/lodash.isequalwith": "4.4.7",
|
|
57
|
-
"@types/node": "18.17.
|
|
57
|
+
"@types/node": "18.17.17",
|
|
58
58
|
"@types/yargs": "17.0.24"
|
|
59
59
|
},
|
|
60
60
|
"bin": {
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "ee274f04521c4024826b21fee01d50fcc1e414a1"
|
|
70
70
|
}
|