@superblocksteam/cli 2.0.3-next.162 → 2.0.3-next.164
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/README.md +1 -1
- package/dist/{api-CNGTM444.js → api-CHKMPXFE.js} +1 -1
- package/dist/{chunk-LHELDOWV.js → chunk-JOXVTBHC.js} +165 -532
- package/dist/index.js +113 -102
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9,12 +9,11 @@ import {
|
|
|
9
9
|
isEqual_default,
|
|
10
10
|
isObject_default,
|
|
11
11
|
isString_default,
|
|
12
|
-
pickBy_default,
|
|
13
12
|
require_constants,
|
|
14
13
|
require_dist,
|
|
15
14
|
require_lib,
|
|
16
15
|
require_slugify
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JOXVTBHC.js";
|
|
18
17
|
import {
|
|
19
18
|
__commonJS,
|
|
20
19
|
__esm,
|
|
@@ -96096,11 +96095,11 @@ var require_api_files = __commonJS({
|
|
|
96096
96095
|
exports2.writeApiFiles = writeApiFiles3;
|
|
96097
96096
|
exports2.readAppApiYamlFile = readAppApiYamlFile4;
|
|
96098
96097
|
async function writeApiFiles3(...args) {
|
|
96099
|
-
const esmFunction = await import("./api-
|
|
96098
|
+
const esmFunction = await import("./api-CHKMPXFE.js");
|
|
96100
96099
|
return esmFunction.writeApiFiles(...args);
|
|
96101
96100
|
}
|
|
96102
96101
|
async function readAppApiYamlFile4(...args) {
|
|
96103
|
-
const esmFunction = await import("./api-
|
|
96102
|
+
const esmFunction = await import("./api-CHKMPXFE.js");
|
|
96104
96103
|
return esmFunction.readAppApiYamlFile(...args);
|
|
96105
96104
|
}
|
|
96106
96105
|
}
|
|
@@ -331437,7 +331436,7 @@ var import_dd_trace = __toESM(require_dd_trace2(), 1);
|
|
|
331437
331436
|
// ../sdk/package.json
|
|
331438
331437
|
var package_default = {
|
|
331439
331438
|
name: "@superblocksteam/sdk",
|
|
331440
|
-
version: "2.0.3-next.
|
|
331439
|
+
version: "2.0.3-next.164",
|
|
331441
331440
|
type: "module",
|
|
331442
331441
|
description: "Superblocks JS SDK",
|
|
331443
331442
|
homepage: "https://www.superblocks.com",
|
|
@@ -331467,8 +331466,8 @@ var package_default = {
|
|
|
331467
331466
|
"@rollup/wasm-node": "^4.35.0",
|
|
331468
331467
|
"@superblocksteam/bucketeer-sdk": "0.4.1",
|
|
331469
331468
|
"@superblocksteam/shared": "0.9120.0",
|
|
331470
|
-
"@superblocksteam/util": "2.0.3-next.
|
|
331471
|
-
"@superblocksteam/vite-plugin-file-sync": "2.0.3-next.
|
|
331469
|
+
"@superblocksteam/util": "2.0.3-next.164",
|
|
331470
|
+
"@superblocksteam/vite-plugin-file-sync": "2.0.3-next.164",
|
|
331472
331471
|
"@vitejs/plugin-react": "^4.3.4",
|
|
331473
331472
|
axios: "^1.4.0",
|
|
331474
331473
|
chokidar: "^4.0.3",
|
|
@@ -376169,7 +376168,7 @@ async function startVite({ app, httpServer: httpServer2, root: root2, mode, port
|
|
|
376169
376168
|
};
|
|
376170
376169
|
const isCustomBuildEnabled2 = await isCustomComponentsEnabled();
|
|
376171
376170
|
const customFolder = path21.join(root2, "custom");
|
|
376172
|
-
const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.
|
|
376171
|
+
const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.164";
|
|
376173
376172
|
const env3 = loadEnv(mode, root2, "");
|
|
376174
376173
|
const hmrPort = await getFreePort();
|
|
376175
376174
|
const hmrOptions = {
|
|
@@ -392093,7 +392092,6 @@ async function readPackage({ cwd, normalize: normalize3 = true } = {}) {
|
|
|
392093
392092
|
|
|
392094
392093
|
// ../sdk/dist/cli-replacement/automatic-upgrades.js
|
|
392095
392094
|
init_cjs_shims();
|
|
392096
|
-
init_lodash();
|
|
392097
392095
|
import * as child_process from "node:child_process";
|
|
392098
392096
|
import { promisify } from "node:util";
|
|
392099
392097
|
import { isNativeError } from "node:util/types";
|
|
@@ -392101,14 +392099,12 @@ var import_gt = __toESM(require_gt(), 1);
|
|
|
392101
392099
|
var import_valid = __toESM(require_valid(), 1);
|
|
392102
392100
|
var exec3 = promisify(child_process.exec);
|
|
392103
392101
|
var logger2 = getLogger2();
|
|
392104
|
-
async function
|
|
392102
|
+
async function getRemoteVersions(config2) {
|
|
392105
392103
|
const { token: token2, superblocksBaseUrl, id: id2 } = config2;
|
|
392106
392104
|
try {
|
|
392107
392105
|
const response = await fetch(new URL(`api/v3/applications/${id2}/cli-library-versions`, superblocksBaseUrl), {
|
|
392108
392106
|
method: "GET",
|
|
392109
|
-
headers: {
|
|
392110
|
-
Authorization: `Bearer ${token2}`
|
|
392111
|
-
}
|
|
392107
|
+
headers: { Authorization: `Bearer ${token2}` }
|
|
392112
392108
|
});
|
|
392113
392109
|
if (response.ok) {
|
|
392114
392110
|
const data = await response.json();
|
|
@@ -392125,38 +392121,15 @@ async function getRemoteCliLibraryVersions(config2) {
|
|
|
392125
392121
|
}
|
|
392126
392122
|
}
|
|
392127
392123
|
}
|
|
392128
|
-
async function
|
|
392129
|
-
const installCommand = resolveCommand(pm.agent, "install", Object.entries(versions).map(([pkg, version2]) => `@superblocksteam/${pkg}@${version2}`));
|
|
392130
|
-
if (!installCommand) {
|
|
392131
|
-
console.error("We could not determine how to upgrade your Superblocks packages.");
|
|
392132
|
-
return;
|
|
392133
|
-
}
|
|
392134
|
-
const { command, args } = installCommand;
|
|
392135
|
-
return await exec3(`${command} ${args.join(" ")}`);
|
|
392136
|
-
}
|
|
392137
|
-
async function findSuperblocksExecutable() {
|
|
392124
|
+
async function getCurrentCliVersion() {
|
|
392138
392125
|
try {
|
|
392139
392126
|
const command = process.platform === "win32" ? "where" : "which";
|
|
392140
392127
|
const { stdout } = await exec3(`${command} superblocks`);
|
|
392141
|
-
|
|
392142
|
-
|
|
392143
|
-
return void 0;
|
|
392144
|
-
}
|
|
392145
|
-
}
|
|
392146
|
-
async function getLocalCliLibraryVersions(pm) {
|
|
392147
|
-
return {
|
|
392148
|
-
cli: await getLocalCliVersion(),
|
|
392149
|
-
library: await getLocalPackageVersion(pm, "library")
|
|
392150
|
-
};
|
|
392151
|
-
}
|
|
392152
|
-
async function getLocalCliVersion() {
|
|
392153
|
-
try {
|
|
392154
|
-
const superblocksPath = await findSuperblocksExecutable();
|
|
392155
|
-
if (!superblocksPath) {
|
|
392128
|
+
const superblocksPath = stdout.trim();
|
|
392129
|
+
if (!superblocksPath)
|
|
392156
392130
|
return void 0;
|
|
392157
|
-
}
|
|
392158
|
-
const
|
|
392159
|
-
const json2 = JSON.parse(stdout);
|
|
392131
|
+
const { stdout: versionOutput } = await exec3(`${superblocksPath} version --json`);
|
|
392132
|
+
const json2 = JSON.parse(versionOutput);
|
|
392160
392133
|
return json2.cliVersion?.replace(/@superblocksteam\/cli(-ephemeral)?\//, "");
|
|
392161
392134
|
} catch (error) {
|
|
392162
392135
|
if (isNativeError(error)) {
|
|
@@ -392165,46 +392138,99 @@ async function getLocalCliVersion() {
|
|
|
392165
392138
|
return void 0;
|
|
392166
392139
|
}
|
|
392167
392140
|
}
|
|
392168
|
-
async function
|
|
392141
|
+
async function getCurrentLibraryVersion(pm) {
|
|
392169
392142
|
try {
|
|
392170
392143
|
switch (pm.agent) {
|
|
392171
|
-
case "npm":
|
|
392172
|
-
|
|
392173
|
-
|
|
392174
|
-
|
|
392175
|
-
const parsed = JSON.parse(stdout);
|
|
392176
|
-
return parsed.dependencies?.[`@superblocksteam/${pkg}`]?.version ?? parsed.devDependencies?.[`@superblocksteam/${pkg}`]?.version;
|
|
392177
|
-
}
|
|
392178
|
-
case "pnpm": {
|
|
392179
|
-
const { stdout } = await exec3(`pnpm list ${global2 ? "--global" : ""} @superblocksteam/${pkg} --json`, { cwd: process.cwd() });
|
|
392180
|
-
const parsed = JSON.parse(stdout);
|
|
392181
|
-
return parsed[0]?.dependencies?.[`@superblocksteam/${pkg}`]?.version ?? parsed[0]?.devDependencies?.[`@superblocksteam/${pkg}`]?.version;
|
|
392182
|
-
}
|
|
392144
|
+
case "npm":
|
|
392145
|
+
return await getNpmLibraryVersion();
|
|
392146
|
+
case "pnpm":
|
|
392147
|
+
return await getPnpmLibraryVersion();
|
|
392183
392148
|
default:
|
|
392184
|
-
console.error(`${pm.agent} is currently not supported
|
|
392185
|
-
return;
|
|
392149
|
+
console.error(`${pm.agent} is currently not supported for automatic upgrades.`);
|
|
392150
|
+
return void 0;
|
|
392186
392151
|
}
|
|
392187
|
-
} catch (
|
|
392188
|
-
console.error("
|
|
392189
|
-
console.error(
|
|
392190
|
-
return;
|
|
392152
|
+
} catch (error) {
|
|
392153
|
+
console.error("Could not resolve current library version. Skipping automatic upgrade.");
|
|
392154
|
+
console.error(error);
|
|
392155
|
+
return void 0;
|
|
392191
392156
|
}
|
|
392192
392157
|
}
|
|
392193
|
-
async function
|
|
392158
|
+
async function getNpmLibraryVersion() {
|
|
392159
|
+
const { stdout } = await exec3("npm list @superblocksteam/library --json", {
|
|
392160
|
+
cwd: process.cwd()
|
|
392161
|
+
});
|
|
392162
|
+
const parsed = JSON.parse(stdout);
|
|
392163
|
+
const packageData = parsed.dependencies?.["@superblocksteam/library"] ?? parsed.devDependencies?.["@superblocksteam/library"];
|
|
392164
|
+
if (!packageData?.version)
|
|
392165
|
+
return void 0;
|
|
392166
|
+
const resolved = packageData.resolved;
|
|
392167
|
+
if (resolved && resolved.includes("@superblocksteam/")) {
|
|
392168
|
+
const aliasMatch = resolved.match(/@superblocksteam\/([^\/]+)/);
|
|
392169
|
+
if (aliasMatch && aliasMatch[1] !== "library") {
|
|
392170
|
+
return {
|
|
392171
|
+
version: packageData.version,
|
|
392172
|
+
alias: `@superblocksteam/${aliasMatch[1]}`
|
|
392173
|
+
};
|
|
392174
|
+
}
|
|
392175
|
+
}
|
|
392176
|
+
return { version: packageData.version };
|
|
392177
|
+
}
|
|
392178
|
+
async function getPnpmLibraryVersion() {
|
|
392179
|
+
let packageData;
|
|
392194
392180
|
try {
|
|
392195
|
-
const
|
|
392196
|
-
|
|
392197
|
-
|
|
392181
|
+
const result = await exec3("pnpm list @superblocksteam/library --json", {
|
|
392182
|
+
cwd: process.cwd()
|
|
392183
|
+
});
|
|
392184
|
+
const parsed = JSON.parse(result.stdout);
|
|
392185
|
+
packageData = parsed[0]?.dependencies?.["@superblocksteam/library"] ?? parsed[0]?.devDependencies?.["@superblocksteam/library"];
|
|
392186
|
+
} catch {
|
|
392187
|
+
}
|
|
392188
|
+
if (!packageData?.version) {
|
|
392189
|
+
try {
|
|
392190
|
+
const aliasResult = await exec3("pnpm list @superblocksteam/library-ephemeral --json", { cwd: process.cwd() });
|
|
392191
|
+
const aliasParsed = JSON.parse(aliasResult.stdout);
|
|
392192
|
+
packageData = aliasParsed[0]?.dependencies?.["@superblocksteam/library"] ?? aliasParsed[0]?.devDependencies?.["@superblocksteam/library"];
|
|
392193
|
+
} catch {
|
|
392194
|
+
return void 0;
|
|
392198
392195
|
}
|
|
392199
|
-
|
|
392200
|
-
|
|
392196
|
+
}
|
|
392197
|
+
if (!packageData?.version)
|
|
392198
|
+
return void 0;
|
|
392199
|
+
const from = packageData.from;
|
|
392200
|
+
if (from && from !== "@superblocksteam/library") {
|
|
392201
|
+
return {
|
|
392202
|
+
version: packageData.version,
|
|
392203
|
+
alias: from
|
|
392204
|
+
};
|
|
392205
|
+
}
|
|
392206
|
+
return { version: packageData.version };
|
|
392207
|
+
}
|
|
392208
|
+
async function upgradeCliWithOclif(targetVersion) {
|
|
392209
|
+
try {
|
|
392210
|
+
const command = process.platform === "win32" ? "where" : "which";
|
|
392211
|
+
const { stdout } = await exec3(`${command} superblocks`);
|
|
392212
|
+
const superblocksPath = stdout.trim();
|
|
392213
|
+
if (!superblocksPath)
|
|
392214
|
+
return false;
|
|
392215
|
+
const { stdout: updateOutput } = await exec3(`${superblocksPath} update --version=${targetVersion}`);
|
|
392216
|
+
return !updateOutput.includes("not updatable");
|
|
392201
392217
|
} catch (error) {
|
|
392202
392218
|
if (isNativeError(error)) {
|
|
392203
|
-
logger2.error(`Error checking updatability: ${error.message}`);
|
|
392219
|
+
logger2.error(`Error checking CLI updatability: ${error.message}`);
|
|
392204
392220
|
}
|
|
392205
392221
|
return false;
|
|
392206
392222
|
}
|
|
392207
392223
|
}
|
|
392224
|
+
async function upgradePackageWithPackageManager(pm, packageName, targetVersion, alias) {
|
|
392225
|
+
const packageSpec = alias ? `@superblocksteam/${packageName}@npm:${alias}@${targetVersion}` : `@superblocksteam/${packageName}@${targetVersion}`;
|
|
392226
|
+
const installCommand = resolveCommand(pm.agent, "install", [packageSpec]);
|
|
392227
|
+
if (!installCommand) {
|
|
392228
|
+
console.error("Could not determine how to upgrade Superblocks packages.");
|
|
392229
|
+
return;
|
|
392230
|
+
}
|
|
392231
|
+
const { command, args } = installCommand;
|
|
392232
|
+
await exec3(`${command} ${args.join(" ")}`);
|
|
392233
|
+
}
|
|
392208
392234
|
async function restartCli() {
|
|
392209
392235
|
const args = process.argv.slice(1);
|
|
392210
392236
|
const child = child_process.spawn(process.execPath, [...args], {
|
|
@@ -392225,49 +392251,32 @@ async function checkVersionsAndUpgrade(lockService, config2) {
|
|
|
392225
392251
|
],
|
|
392226
392252
|
cwd: process.cwd()
|
|
392227
392253
|
});
|
|
392228
|
-
if (!pm)
|
|
392229
|
-
return;
|
|
392230
|
-
if (!config2?.id)
|
|
392254
|
+
if (!pm || !config2?.id)
|
|
392231
392255
|
return;
|
|
392232
|
-
const
|
|
392233
|
-
|
|
392234
|
-
|
|
392235
|
-
Object.values(localVersions).some((x) => !x || !(0, import_valid.default)(x) || x.startsWith("file:") || x.startsWith("link:"))
|
|
392236
|
-
) {
|
|
392256
|
+
const currentCliVersion = await getCurrentCliVersion();
|
|
392257
|
+
const currentLibraryInfo = await getCurrentLibraryVersion(pm);
|
|
392258
|
+
if (!currentCliVersion || !(0, import_valid.default)(currentCliVersion) || currentCliVersion.startsWith("file:") || currentCliVersion.startsWith("link:") || !currentLibraryInfo || !(0, import_valid.default)(currentLibraryInfo.version) || currentLibraryInfo.version.startsWith("file:") || currentLibraryInfo.version.startsWith("link:")) {
|
|
392237
392259
|
return;
|
|
392238
392260
|
}
|
|
392239
|
-
const
|
|
392240
|
-
if (
|
|
392241
|
-
// server versions could not be fetched, or
|
|
392242
|
-
!serverVersions || // we have a different # of libraries in server/local
|
|
392243
|
-
Object.keys(localVersions).length !== Object.keys(serverVersions).length
|
|
392244
|
-
) {
|
|
392261
|
+
const targetVersions = await getRemoteVersions(config2);
|
|
392262
|
+
if (!targetVersions)
|
|
392245
392263
|
return;
|
|
392246
|
-
|
|
392247
|
-
const
|
|
392248
|
-
if (
|
|
392249
|
-
return;
|
|
392250
|
-
const packagesToUpdate = pickBy_default(localVersions, (_, key2) => {
|
|
392251
|
-
try {
|
|
392252
|
-
return (0, import_gt.default)(serverVersions[key2], localVersions[key2]);
|
|
392253
|
-
} catch {
|
|
392254
|
-
return false;
|
|
392255
|
-
}
|
|
392256
|
-
});
|
|
392257
|
-
if (Object.keys(packagesToUpdate).length === 0) {
|
|
392264
|
+
const cliNeedsUpgrade = targetVersions.cli && (0, import_gt.default)(targetVersions.cli, currentCliVersion);
|
|
392265
|
+
const libraryNeedsUpgrade = targetVersions.library && (0, import_gt.default)(targetVersions.library, currentLibraryInfo.version);
|
|
392266
|
+
if (!cliNeedsUpgrade && !libraryNeedsUpgrade) {
|
|
392258
392267
|
return;
|
|
392259
392268
|
}
|
|
392260
392269
|
let cliUpdated = false;
|
|
392261
392270
|
let libraryUpdated = false;
|
|
392262
|
-
if (
|
|
392263
|
-
const
|
|
392264
|
-
if (!
|
|
392265
|
-
await
|
|
392271
|
+
if (cliNeedsUpgrade) {
|
|
392272
|
+
const oclifUpgradeSucceeded = await upgradeCliWithOclif(targetVersions.cli);
|
|
392273
|
+
if (!oclifUpgradeSucceeded) {
|
|
392274
|
+
await upgradePackageWithPackageManager(pm, "cli", targetVersions.cli);
|
|
392266
392275
|
cliUpdated = true;
|
|
392267
392276
|
}
|
|
392268
392277
|
}
|
|
392269
|
-
if (
|
|
392270
|
-
await
|
|
392278
|
+
if (libraryNeedsUpgrade) {
|
|
392279
|
+
await upgradePackageWithPackageManager(pm, "library", targetVersions.library, currentLibraryInfo.alias);
|
|
392271
392280
|
libraryUpdated = true;
|
|
392272
392281
|
}
|
|
392273
392282
|
if (cliUpdated && libraryUpdated) {
|
|
@@ -392277,9 +392286,11 @@ async function checkVersionsAndUpgrade(lockService, config2) {
|
|
|
392277
392286
|
} else if (libraryUpdated) {
|
|
392278
392287
|
logger2.info("@superblocksteam/library has been updated.");
|
|
392279
392288
|
}
|
|
392280
|
-
|
|
392281
|
-
|
|
392282
|
-
|
|
392289
|
+
if (cliUpdated || libraryUpdated) {
|
|
392290
|
+
logger2.info("Restarting the CLI\u2026");
|
|
392291
|
+
await lockService.releaseLock();
|
|
392292
|
+
await restartCli();
|
|
392293
|
+
}
|
|
392283
392294
|
}
|
|
392284
392295
|
|
|
392285
392296
|
// ../sdk/dist/cli-replacement/dev.mjs
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/cli",
|
|
3
|
-
"version": "2.0.3-next.
|
|
3
|
+
"version": "2.0.3-next.164",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official Superblocks CLI",
|
|
6
6
|
"homepage": "https://www.superblocks.com",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@eslint/js": "^9.16.0",
|
|
44
44
|
"@oclif/test": "^4.1.11",
|
|
45
|
-
"@superblocksteam/sdk": "2.0.3-next.
|
|
45
|
+
"@superblocksteam/sdk": "2.0.3-next.164",
|
|
46
46
|
"@superblocksteam/shared": "0.9120.0",
|
|
47
|
-
"@superblocksteam/util": "2.0.3-next.
|
|
47
|
+
"@superblocksteam/util": "2.0.3-next.164",
|
|
48
48
|
"@types/babel__core": "^7.20.0",
|
|
49
49
|
"@types/chai": "^4",
|
|
50
50
|
"@types/fs-extra": "^11.0.1",
|