@weavix/cli 0.7.2 → 1.0.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/build/index.js +126 -70
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -519,7 +519,10 @@ formData=present
|
|
|
519
519
|
errorJson.message && (errorMessage = errorJson.message);
|
|
520
520
|
} catch {
|
|
521
521
|
}
|
|
522
|
-
throw new
|
|
522
|
+
throw new PlatformApiError(
|
|
523
|
+
response.status,
|
|
524
|
+
`HTTP ${response.status} ${response.statusText}: ${errorMessage}`
|
|
525
|
+
);
|
|
523
526
|
}
|
|
524
527
|
return parseResponse(response);
|
|
525
528
|
} catch (error2) {
|
|
@@ -539,7 +542,7 @@ formData=present
|
|
|
539
542
|
clearTimeout(timeout);
|
|
540
543
|
}
|
|
541
544
|
}
|
|
542
|
-
var import_node_fetch, PLATFORM_API_TIMEOUT_MS, platformIamToken, init_platformApiRequest = __esm({
|
|
545
|
+
var import_node_fetch, PlatformApiError, PLATFORM_API_TIMEOUT_MS, platformIamToken, init_platformApiRequest = __esm({
|
|
543
546
|
"src/api/platformApiRequest.ts"() {
|
|
544
547
|
"use strict";
|
|
545
548
|
import_node_fetch = __toESM(require("node-fetch"));
|
|
@@ -549,7 +552,11 @@ var import_node_fetch, PLATFORM_API_TIMEOUT_MS, platformIamToken, init_platformA
|
|
|
549
552
|
init_verbose();
|
|
550
553
|
init_constants();
|
|
551
554
|
init_requestDebug();
|
|
552
|
-
|
|
555
|
+
PlatformApiError = class extends Error {
|
|
556
|
+
constructor(status, message) {
|
|
557
|
+
super(message), this.status = status, this.name = "PlatformApiError";
|
|
558
|
+
}
|
|
559
|
+
}, PLATFORM_API_TIMEOUT_MS = Number(process.env.TRACKER_CLI_PLATFORM_TIMEOUT_MS || 3e4);
|
|
553
560
|
}
|
|
554
561
|
});
|
|
555
562
|
|
|
@@ -2564,22 +2571,6 @@ async function updatePluginArchive(pluginId, archiveBuffer, archiveName) {
|
|
|
2564
2571
|
formData
|
|
2565
2572
|
});
|
|
2566
2573
|
}
|
|
2567
|
-
async function updateCatalogEntry(pluginId, catalogData) {
|
|
2568
|
-
return platformApiRequest(`/plugins/${pluginId}/catalog-entry`, {
|
|
2569
|
-
method: "PUT",
|
|
2570
|
-
body: catalogData
|
|
2571
|
-
});
|
|
2572
|
-
}
|
|
2573
|
-
async function updateCatalogImage(pluginId, imageBuffer, imageName) {
|
|
2574
|
-
let formData = new import_form_data.default();
|
|
2575
|
-
return formData.append("image", imageBuffer, {
|
|
2576
|
-
filename: imageName,
|
|
2577
|
-
contentType: "image/jpeg"
|
|
2578
|
-
}), platformApiRequest(`/plugins/${pluginId}/catalog-image`, {
|
|
2579
|
-
method: "PUT",
|
|
2580
|
-
formData
|
|
2581
|
-
});
|
|
2582
|
-
}
|
|
2583
2574
|
async function submitPlugin(pluginId, version) {
|
|
2584
2575
|
return platformApiRequest(`/plugins/${pluginId}/submit`, {
|
|
2585
2576
|
method: "POST",
|
|
@@ -2593,6 +2584,16 @@ async function getPluginInfo(pluginId) {
|
|
|
2593
2584
|
method: "GET"
|
|
2594
2585
|
});
|
|
2595
2586
|
}
|
|
2587
|
+
async function getPluginVersions(pluginId) {
|
|
2588
|
+
return platformApiRequest(`/plugins/${pluginId}/versions`, {
|
|
2589
|
+
method: "GET"
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
async function withdrawPluginVersion(pluginId, versionId) {
|
|
2593
|
+
return platformApiRequest(`/plugins/${pluginId}/versions/${versionId}/withdraw`, {
|
|
2594
|
+
method: "POST"
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2596
2597
|
async function getMyPlugins() {
|
|
2597
2598
|
return platformApiRequest("/plugins/my", {
|
|
2598
2599
|
method: "GET"
|
|
@@ -2662,7 +2663,10 @@ function showPluginList(plugins) {
|
|
|
2662
2663
|
function showPluginCreated(data) {
|
|
2663
2664
|
printSuccessHeader("\u2705 Plugin Created"), logger_default.newLine(), printPluginId(data.id);
|
|
2664
2665
|
}
|
|
2665
|
-
|
|
2666
|
+
function showPluginWithdrawn(data) {
|
|
2667
|
+
printSuccessHeader("\u{1F6AB} Plugin Version Withdrawn"), logger_default.newLine(), printPluginId(data.pluginId), printVersionId(data.versionId), printField("Version", import_picocolors2.default.white(data.version));
|
|
2668
|
+
}
|
|
2669
|
+
var import_picocolors2, printHeader, printSuccessHeader, getStatusBadgeByLabel, formatDate, printField, printPluginId, printVersionId, printCreated, printUpdated, init_pluginDisplay = __esm({
|
|
2666
2670
|
"src/utils/pluginDisplay.ts"() {
|
|
2667
2671
|
"use strict";
|
|
2668
2672
|
import_picocolors2 = __toESM(require("picocolors"));
|
|
@@ -2684,6 +2688,8 @@ var import_picocolors2, printHeader, printSuccessHeader, getStatusBadgeByLabel,
|
|
|
2684
2688
|
console.info(` ${import_picocolors2.default.dim(label.padEnd(minWidth))} ${value}`);
|
|
2685
2689
|
}, printPluginId = (pluginId) => {
|
|
2686
2690
|
printField("Plugin ID", import_picocolors2.default.cyan(pluginId));
|
|
2691
|
+
}, printVersionId = (versionId) => {
|
|
2692
|
+
printField("Version ID", import_picocolors2.default.cyan(versionId));
|
|
2687
2693
|
}, printCreated = (createdAt) => {
|
|
2688
2694
|
printField("Created", import_picocolors2.default.white(formatDate(createdAt)));
|
|
2689
2695
|
}, printUpdated = (updatedAt) => {
|
|
@@ -2801,30 +2807,6 @@ function validateArchiveSources() {
|
|
|
2801
2807
|
"Source folder not found. Add ./src before publishing."
|
|
2802
2808
|
), ensurePathExists(import_path9.default.resolve(MANIFEST_FILE2), "manifest.json not found in plugin root."), validateMarketplaceAssets();
|
|
2803
2809
|
}
|
|
2804
|
-
async function getMarketplaceCatalogEntry() {
|
|
2805
|
-
let indexPath = import_path9.default.resolve(MARKETPLACE_DIR, MARKETPLACE_INDEX_FILE);
|
|
2806
|
-
ensurePathExists(
|
|
2807
|
-
indexPath,
|
|
2808
|
-
"Marketplace description not found. Add ./marketplace/index.md before uploading."
|
|
2809
|
-
), await validateManifestPublishingFields();
|
|
2810
|
-
let longDescription = import_fs9.default.readFileSync(indexPath, "utf-8").trim(), manifest = await manifestManager.load();
|
|
2811
|
-
return {
|
|
2812
|
-
name: manifest.name.ru,
|
|
2813
|
-
description: manifest.description.ru,
|
|
2814
|
-
longDescription,
|
|
2815
|
-
tags: manifest.keywords ?? []
|
|
2816
|
-
};
|
|
2817
|
-
}
|
|
2818
|
-
function getMarketplaceHeaderImage() {
|
|
2819
|
-
let imagePath = import_path9.default.resolve(MARKETPLACE_DIR, MARKETPLACE_HEADER_IMAGE_FILE);
|
|
2820
|
-
return ensurePathExists(
|
|
2821
|
-
imagePath,
|
|
2822
|
-
"Marketplace header image not found. Add ./marketplace/header-image.jpg before uploading."
|
|
2823
|
-
), {
|
|
2824
|
-
buffer: import_fs9.default.readFileSync(imagePath),
|
|
2825
|
-
filename: MARKETPLACE_HEADER_IMAGE_FILE
|
|
2826
|
-
};
|
|
2827
|
-
}
|
|
2828
2810
|
var import_fs9, import_path9, MARKETPLACE_DIR, MARKETPLACE_INDEX_FILE, MARKETPLACE_HEADER_IMAGE_FILE, PUBLIC_DIR, PUBLIC_LOGO_FILE, MANIFEST_FILE2, DIST_DIR, SRC_DIR, DOCS_DIR, DOCS_INDEX_FILE, DOCS_GUIDE_URL, ensurePathExists, ensureManifestCatalogFields, validateManifestPublishingFields, marketplacePaths, init_marketplace = __esm({
|
|
2829
2811
|
"src/utils/marketplace.ts"() {
|
|
2830
2812
|
"use strict";
|
|
@@ -2866,9 +2848,11 @@ async function buildArchive() {
|
|
|
2866
2848
|
logger_default.info(`[platform-api-debug] Saved archive copy to ${debugPath}`);
|
|
2867
2849
|
}
|
|
2868
2850
|
resolve2(buffer);
|
|
2869
|
-
}), archive.on("error", reject)
|
|
2851
|
+
}), archive.on("error", reject);
|
|
2852
|
+
let ignore = isInternal ? ["node_modules/**", "dist/**"] : ["node_modules/**", "dist/**", "src/**"];
|
|
2853
|
+
archive.glob("**/*", {
|
|
2870
2854
|
cwd: process.cwd(),
|
|
2871
|
-
ignore
|
|
2855
|
+
ignore,
|
|
2872
2856
|
dot: !1
|
|
2873
2857
|
});
|
|
2874
2858
|
for (let dotfile of [".npmrc", ".nvmrc"]) {
|
|
@@ -2885,15 +2869,17 @@ async function buildArchive() {
|
|
|
2885
2869
|
), archive.finalize();
|
|
2886
2870
|
});
|
|
2887
2871
|
}
|
|
2888
|
-
var import_fs10, import_path10, import_archiver, init_buildArchive = __esm({
|
|
2872
|
+
var import_fs10, import_path10, import_archiver, isInternal, init_buildArchive = __esm({
|
|
2889
2873
|
"src/utils/buildArchive.ts"() {
|
|
2890
2874
|
"use strict";
|
|
2891
2875
|
import_fs10 = __toESM(require("fs")), import_path10 = __toESM(require("path")), import_archiver = __toESM(require("archiver"));
|
|
2892
2876
|
init_manifestManager();
|
|
2877
|
+
init_flag();
|
|
2893
2878
|
init_meta2();
|
|
2894
2879
|
init_logger();
|
|
2895
2880
|
init_marketplace();
|
|
2896
2881
|
init_verbose();
|
|
2882
|
+
isInternal = !1;
|
|
2897
2883
|
}
|
|
2898
2884
|
});
|
|
2899
2885
|
|
|
@@ -2993,18 +2979,6 @@ var import_path11, import_cli, init_buildDocs = __esm({
|
|
|
2993
2979
|
}
|
|
2994
2980
|
});
|
|
2995
2981
|
|
|
2996
|
-
// src/commands/submit/legalNotice.ts
|
|
2997
|
-
function showSubmitLegalNotice() {
|
|
2998
|
-
logger_default.separator(), logger_default.info("Legal notice / \u042E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0435 \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u0435"), logger_default.info(SUBMIT_LEGAL_NOTICE_RU), logger_default.info(SUBMIT_LEGAL_NOTICE_EN), logger_default.separator();
|
|
2999
|
-
}
|
|
3000
|
-
var SUBMIT_LEGAL_NOTICE_RU, SUBMIT_LEGAL_NOTICE_EN, init_legalNotice = __esm({
|
|
3001
|
-
"src/commands/submit/legalNotice.ts"() {
|
|
3002
|
-
"use strict";
|
|
3003
|
-
init_logger();
|
|
3004
|
-
SUBMIT_LEGAL_NOTICE_RU = "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044F \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0438 \u0438 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u044F \u041F\u043B\u0430\u0433\u0438\u043D \u043D\u0430 \u041C\u043E\u0434\u0435\u0440\u0430\u0446\u0438\u044E \u0434\u043B\u044F \u0446\u0435\u043B\u0435\u0439 \u0440\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u0438\u044F \u0432 \u041A\u0430\u0442\u0430\u043B\u043E\u0433\u0435 \u041F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 \u0432\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0435, \u0447\u0442\u043E \u043E\u0437\u043D\u0430\u043A\u043E\u043C\u043B\u0435\u043D\u044B \u0438 \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u044B \u0441\u043E \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u043C\u0438 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u043C\u0438: \u0423\u0441\u043B\u043E\u0432\u0438\u044F \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 \u0434\u043B\u044F \u0421\u0435\u0440\u0432\u0438\u0441\u043E\u0432 \u042F\u043D\u0434\u0435\u043A\u0441 360 (https://yandex.ru/legal/360_plugin_termsofuse), \u0421\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A\u043E\u043C \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 (\u043F\u0430\u0431\u043B\u0438\u0448\u0435\u0440\u043E\u043C) \u0434\u043B\u044F \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 \u0421\u0435\u0440\u0432\u0438\u0441\u043E\u0432 \u042F\u043D\u0434\u0435\u043A\u0441 360 (https://yandex.ru/legal/360_plugin_dev_agreement).", SUBMIT_LEGAL_NOTICE_EN = "By using the development tool and submitting the Plugin for Moderation for the purpose of placement in the Plugin Catalog, you acknowledge that you have read and agree to the following documents: Terms of Use of the Plugin Catalog for Yandex 360 Services ( https://yandex.ru/legal/360_plugin_termsofuse ), Plugin Developer (Publisher) Agreement for the Plugin Catalog of Yandex 360 Services ( https://yandex.ru/legal/360_plugin_dev_agreement ).";
|
|
3005
|
-
}
|
|
3006
|
-
});
|
|
3007
|
-
|
|
3008
2982
|
// src/utils/urlGuards.ts
|
|
3009
2983
|
var isLocalDocsUrl, isExternalDocsUrl, init_urlGuards = __esm({
|
|
3010
2984
|
"src/utils/urlGuards.ts"() {
|
|
@@ -3128,10 +3102,7 @@ async function submitPlatform(options = {}) {
|
|
|
3128
3102
|
let createdPlugin = await createPlugin(archiveBuffer, archiveName);
|
|
3129
3103
|
showPluginCreated(createdPlugin), pluginId = createdPlugin.id, await manifestManager.update({ id: pluginId });
|
|
3130
3104
|
}
|
|
3131
|
-
|
|
3132
|
-
logger_default.info("\u{1F4DD} Updating catalog entry from ./marketplace/index.md..."), await updateCatalogEntry(pluginId, catalogEntry);
|
|
3133
|
-
let headerImage = getMarketplaceHeaderImage();
|
|
3134
|
-
logger_default.info("\u{1F5BC}\uFE0F Uploading catalog image from ./marketplace/header-image.jpg..."), await updateCatalogImage(pluginId, headerImage.buffer, headerImage.filename), showSubmitLegalNotice(), await submitPlugin(pluginId, manifest.version), logger_default.success("Plugin submitted for review!"), logger_default.info(` Version : ${manifest.version}`), logger_default.newLine();
|
|
3105
|
+
await submitPlugin(pluginId, manifest.version), logger_default.success("Plugin submitted for review!"), logger_default.info(` Version : ${manifest.version}`), logger_default.newLine();
|
|
3135
3106
|
}
|
|
3136
3107
|
var init_platform4 = __esm({
|
|
3137
3108
|
"src/commands/submit/platform.ts"() {
|
|
@@ -3146,13 +3117,68 @@ var init_platform4 = __esm({
|
|
|
3146
3117
|
init_build();
|
|
3147
3118
|
init_platformAuth();
|
|
3148
3119
|
init_buildDocs();
|
|
3149
|
-
init_legalNotice();
|
|
3150
3120
|
init_resolveBuildDocsDecision();
|
|
3151
3121
|
init_runSubmitPrechecks();
|
|
3152
3122
|
init_validateSlug();
|
|
3153
3123
|
}
|
|
3154
3124
|
});
|
|
3155
3125
|
|
|
3126
|
+
// src/commands/withdraw/index.ts
|
|
3127
|
+
async function getVersionArg(version) {
|
|
3128
|
+
if (version)
|
|
3129
|
+
return version;
|
|
3130
|
+
try {
|
|
3131
|
+
return (await manifestManager.load()).version;
|
|
3132
|
+
} catch {
|
|
3133
|
+
throw new Error("Version must be provided as argument or present in manifest.json");
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
async function withdraw(pluginId, version) {
|
|
3137
|
+
let actualPluginId = await getPluginId(pluginId), actualVersion = await getVersionArg(version);
|
|
3138
|
+
logger_default.info(`\u23F3 Fetching versions for plugin ID: ${actualPluginId}...`);
|
|
3139
|
+
let pluginVersions;
|
|
3140
|
+
try {
|
|
3141
|
+
pluginVersions = await getPluginVersions(actualPluginId);
|
|
3142
|
+
} catch (error2) {
|
|
3143
|
+
throw error2 instanceof PlatformApiError && error2.status === 404 && (logger_default.error(`Plugin not found: ${actualPluginId}`), process.exit(1)), error2;
|
|
3144
|
+
}
|
|
3145
|
+
let target = pluginVersions.find((candidate) => candidate.version === actualVersion);
|
|
3146
|
+
target || (logger_default.error(`Version ${actualVersion} not found for plugin ${actualPluginId}.`), process.exit(1)), logger_default.info(`\u{1F6AB} Withdrawing version ${target.version} (current status: ${target.status})...`);
|
|
3147
|
+
try {
|
|
3148
|
+
await withdrawPluginVersion(actualPluginId, target.versionId);
|
|
3149
|
+
} catch (error2) {
|
|
3150
|
+
if (error2 instanceof PlatformApiError && error2.status === 400) {
|
|
3151
|
+
let hints = [
|
|
3152
|
+
`Version ${target.version} cannot be withdrawn: current status is ${target.status}.`,
|
|
3153
|
+
"Developer withdraw is only available while a version is IN_REVIEW."
|
|
3154
|
+
];
|
|
3155
|
+
target.status.toUpperCase() === "CHECKING" && hints.push(
|
|
3156
|
+
"A version stuck in CHECKING cannot be withdrawn manually \u2014 it will move to CHECK_FAILED automatically via the recovery job."
|
|
3157
|
+
), logger_default.error(hints.join(`
|
|
3158
|
+
`)), process.exit(1);
|
|
3159
|
+
}
|
|
3160
|
+
throw error2 instanceof PlatformApiError && error2.status === 404 && (logger_default.error(`Plugin or version not found: ${actualPluginId} / ${target.versionId}`), process.exit(1)), error2;
|
|
3161
|
+
}
|
|
3162
|
+
showPluginWithdrawn({
|
|
3163
|
+
pluginId: actualPluginId,
|
|
3164
|
+
versionId: target.versionId,
|
|
3165
|
+
version: target.version
|
|
3166
|
+
}), logger_default.info(
|
|
3167
|
+
"Closing the related Startrek ticket (if any) is handled by the backend on a best-effort basis."
|
|
3168
|
+
);
|
|
3169
|
+
}
|
|
3170
|
+
var init_withdraw = __esm({
|
|
3171
|
+
"src/commands/withdraw/index.ts"() {
|
|
3172
|
+
"use strict";
|
|
3173
|
+
init_platform();
|
|
3174
|
+
init_platformApiRequest();
|
|
3175
|
+
init_manifestManager();
|
|
3176
|
+
init_getPluginId();
|
|
3177
|
+
init_logger();
|
|
3178
|
+
init_pluginDisplay();
|
|
3179
|
+
}
|
|
3180
|
+
});
|
|
3181
|
+
|
|
3156
3182
|
// src/utils/withErrorHandling.ts
|
|
3157
3183
|
function withErrorHandling(fn) {
|
|
3158
3184
|
return async (...args) => {
|
|
@@ -3241,7 +3267,9 @@ function registerDistributionCommands(program) {
|
|
|
3241
3267
|
withErrorHandling(async () => {
|
|
3242
3268
|
logoutExternal();
|
|
3243
3269
|
})
|
|
3244
|
-
), program.command("submit").description("build plugin and submit it to the platform for review").addOption(skipChecksOption).addOption(iamTokenOption).action(withErrorHandling(submitPlatform)), program.command("doctor").description("validate local plugin project and auth").option("--network", "verify OAuth token against the Platform API", !1).option("--publish", "treat publish-readiness checks as failures", !1).option("--json", "machine-readable output", !1).action((options) => withErrorHandling(doctor)(options)), program.command("list").description("list all your plugins and their moderation status").addOption(iamTokenOption).action(withErrorHandling(listPlatform)), program.command("info [plugin-id]").description("show plugin status (uses plugin id from manifest if not provided)").addOption(iamTokenOption).action(withErrorHandling(infoPlatform))
|
|
3270
|
+
), program.command("submit").description("build plugin and submit it to the platform for review").addOption(skipChecksOption).addOption(iamTokenOption).action(withErrorHandling(submitPlatform)), program.command("doctor").description("validate local plugin project and auth").option("--network", "verify OAuth token against the Platform API", !1).option("--publish", "treat publish-readiness checks as failures", !1).option("--json", "machine-readable output", !1).action((options) => withErrorHandling(doctor)(options)), program.command("list").description("list all your plugins and their moderation status").addOption(iamTokenOption).action(withErrorHandling(listPlatform)), program.command("info [plugin-id]").description("show plugin status (uses plugin id from manifest if not provided)").addOption(iamTokenOption).action(withErrorHandling(infoPlatform)), program.command("withdraw [plugin-id] [version]").description(
|
|
3271
|
+
"withdraw a submitted version from review (uses manifest.id/version if not provided)"
|
|
3272
|
+
).action(withErrorHandling(withdraw));
|
|
3245
3273
|
}
|
|
3246
3274
|
var init_registerCommands = __esm({
|
|
3247
3275
|
"src/distributions/external/registerCommands.ts"() {
|
|
@@ -3252,6 +3280,7 @@ var init_registerCommands = __esm({
|
|
|
3252
3280
|
init_platformAuth();
|
|
3253
3281
|
init_options();
|
|
3254
3282
|
init_platform4();
|
|
3283
|
+
init_withdraw();
|
|
3255
3284
|
init_withErrorHandling();
|
|
3256
3285
|
init_login();
|
|
3257
3286
|
}
|
|
@@ -3421,11 +3450,11 @@ var fs15 = __toESM(require("fs")), path19 = __toESM(require("path"));
|
|
|
3421
3450
|
|
|
3422
3451
|
// src/distribution/templateSubstitution.ts
|
|
3423
3452
|
init_flag();
|
|
3424
|
-
var
|
|
3453
|
+
var isInternal2 = !1, templateDeps = [
|
|
3425
3454
|
"@weavix/tracker-plugin-sdk",
|
|
3426
3455
|
"@weavix/tracker-plugin-sdk-react",
|
|
3427
3456
|
"@weavix/tracker-api-types"
|
|
3428
|
-
], overlayDirName =
|
|
3457
|
+
], overlayDirName = isInternal2 ? "_internal" : "_external";
|
|
3429
3458
|
|
|
3430
3459
|
// src/utils/copyDirectory.ts
|
|
3431
3460
|
var fs13 = __toESM(require("fs")), import_path14 = __toESM(require("path")), import_tinyglobby2 = require("tinyglobby"), resolveTargetFileName = (file) => file.endsWith(".template") ? "." + file.replace(".template", "") : file, copyDirectory = async (sourceDir, targetDir) => {
|
|
@@ -3765,6 +3794,30 @@ async function up() {
|
|
|
3765
3794
|
generateManifestSchema(categoriesResponse, process.cwd()), await updatePackageDependencies(templateDeps), shouldCleanNpmCache && await execCommand("npm cache clean --force"), await execCommand("npm i");
|
|
3766
3795
|
}
|
|
3767
3796
|
|
|
3797
|
+
// src/core/legalAgreement/ensureLegalAgreementAccepted.ts
|
|
3798
|
+
var import_prompts3 = require("@inquirer/prompts");
|
|
3799
|
+
init_manager();
|
|
3800
|
+
init_logger();
|
|
3801
|
+
|
|
3802
|
+
// src/core/legalAgreement/legalAgreementText.ts
|
|
3803
|
+
var LEGAL_NOTICE_RU = "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044F \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0438 \u0434\u043B\u044F \u0446\u0435\u043B\u0435\u0439 \u0440\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u0438\u044F \u041F\u043B\u0430\u0433\u0438\u043D\u0430 \u0432 \u041A\u0430\u0442\u0430\u043B\u043E\u0433\u0435 \u041F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 \u0432\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0435, \u0447\u0442\u043E \u043E\u0437\u043D\u0430\u043A\u043E\u043C\u043B\u0435\u043D\u044B \u0438 \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u044B \u0441\u043E \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u043C\u0438 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u043C\u0438: \u0423\u0441\u043B\u043E\u0432\u0438\u044F \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 \u0434\u043B\u044F \u0421\u0435\u0440\u0432\u0438\u0441\u043E\u0432 \u042F\u043D\u0434\u0435\u043A\u0441 360 (https://yandex.ru/legal/360_plugin_termsofuse), \u0421\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A\u043E\u043C \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 (\u043F\u0430\u0431\u043B\u0438\u0448\u0435\u0440\u043E\u043C) \u0434\u043B\u044F \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432 \u0421\u0435\u0440\u0432\u0438\u0441\u043E\u0432 \u042F\u043D\u0434\u0435\u043A\u0441 360 (https://yandex.ru/legal/360_plugin_dev_agreement).", LEGAL_NOTICE_EN = "By using the development tool for the purpose of placement of the Plugin in the Plugin Catalog, you acknowledge that you have read and agree to the following documents: Terms of Use of the Plugin Catalog for Yandex 360 Services ( https://yandex.ru/legal/360_plugin_termsofuse ), Plugin Developer (Publisher) Agreement for the Plugin Catalog of Yandex 360 Services ( https://yandex.ru/legal/360_plugin_dev_agreement ).";
|
|
3804
|
+
|
|
3805
|
+
// src/core/legalAgreement/ensureLegalAgreementAccepted.ts
|
|
3806
|
+
async function ensureLegalAgreementAccepted() {
|
|
3807
|
+
if (readConfig()?.legal?.acceptedAt)
|
|
3808
|
+
return;
|
|
3809
|
+
if (logger_default.separator(), logger_default.info("Legal notice / \u042E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0435 \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u0435"), logger_default.info(LEGAL_NOTICE_RU), logger_default.info(LEGAL_NOTICE_EN), logger_default.separator(), !await (0, import_prompts3.confirm)({
|
|
3810
|
+
message: "\u0412\u044B \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u044B \u0441 \u0443\u0441\u043B\u043E\u0432\u0438\u044F\u043C\u0438 \u0432\u044B\u0448\u0435? / Do you agree to the terms above?",
|
|
3811
|
+
default: !1
|
|
3812
|
+
})) {
|
|
3813
|
+
logger_default.error(
|
|
3814
|
+
"\u0420\u0430\u0431\u043E\u0442\u0430 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430: \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0441\u043E\u0433\u043B\u0430\u0441\u0438\u0435 \u0441 \u0443\u0441\u043B\u043E\u0432\u0438\u044F\u043C\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F. / Stopped: you must accept the terms to continue."
|
|
3815
|
+
), process.exit(1);
|
|
3816
|
+
return;
|
|
3817
|
+
}
|
|
3818
|
+
writeConfig({ ...readConfig() ?? {}, legal: { acceptedAt: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3768
3821
|
// src/utils/getVersion.ts
|
|
3769
3822
|
var import_fs19 = require("fs"), import_path20 = require("path"), UNKNOWN_VERSION = "unknown", CANDIDATES = ["..", "../.."], findVersionInPackageJson = (startDir) => {
|
|
3770
3823
|
for (let rel of CANDIDATES) {
|
|
@@ -3784,9 +3837,12 @@ init_verbose();
|
|
|
3784
3837
|
init_withErrorHandling();
|
|
3785
3838
|
async function main() {
|
|
3786
3839
|
let program = new import_commander3.Command(), version = getVersion();
|
|
3787
|
-
shouldRunUpdateCheck(process.argv.slice(2)) && await checkUpdate(version), program.name(CLI_NAME2).description(CLI_DESCRIPTION2).version(version).option("--verbose", "enable verbose output"), CLI_HELP_TEXT2 && program.addHelpText("before", CLI_HELP_TEXT2), program.hook(
|
|
3788
|
-
|
|
3789
|
-
|
|
3840
|
+
shouldRunUpdateCheck(process.argv.slice(2)) && await checkUpdate(version), program.name(CLI_NAME2).description(CLI_DESCRIPTION2).version(version).option("--verbose", "enable verbose output"), CLI_HELP_TEXT2 && program.addHelpText("before", CLI_HELP_TEXT2), program.hook(
|
|
3841
|
+
"preAction",
|
|
3842
|
+
withErrorHandling(async (thisCommand) => {
|
|
3843
|
+
setVerboseEnabled(!!thisCommand.opts().verbose), await ensureLegalAgreementAccepted();
|
|
3844
|
+
})
|
|
3845
|
+
), program.command("create").description("create your app").action(withErrorHandling(create)), program.command("up").description("update plugin from old template to latest version").action(withErrorHandling(up)), program.command("build").description("build your app").action(withErrorHandling(build)), program.command("build-docs").description("build diplodoc docs").action(withErrorHandling(buildDocs2)), program.command("debug").description(
|
|
3790
3846
|
"start a tunnel to connect your local code with the app running in the development environment"
|
|
3791
3847
|
).option("--no-lint", "skip lint validation").action((options) => withErrorHandling(debug)(options)), program.command("lint").description("run TypeScript and ESLint checks").action(withErrorHandling(lint)), registerDistributionCommands2(program), await program.parseAsync(), process.exit(typeof process.exitCode == "number" ? process.exitCode : 0);
|
|
3792
3848
|
}
|