@pipelab/cli 2.0.0-beta.19 → 2.0.0-beta.21
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/index.mjs +32 -14
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -68357,11 +68357,15 @@ const registerAuthHandlers = (context) => {
|
|
|
68357
68357
|
const registerSystemHandlers = (options) => {
|
|
68358
68358
|
const { handle } = useAPI();
|
|
68359
68359
|
handle("agent:version:get", async (_, { send }) => {
|
|
68360
|
+
const isStable = options.context.userDataPath.endsWith("app") || !options.context.userDataPath.includes("app-beta");
|
|
68360
68361
|
send({
|
|
68361
68362
|
type: "end",
|
|
68362
68363
|
data: {
|
|
68363
68364
|
type: "success",
|
|
68364
|
-
result: {
|
|
68365
|
+
result: {
|
|
68366
|
+
version: options.version,
|
|
68367
|
+
channel: isStable ? "stable" : "beta"
|
|
68368
|
+
}
|
|
68365
68369
|
}
|
|
68366
68370
|
});
|
|
68367
68371
|
});
|
|
@@ -68618,11 +68622,13 @@ const registerMigrationHandlers = (context) => {
|
|
|
68618
68622
|
return sourceVer <= targetVer;
|
|
68619
68623
|
}
|
|
68620
68624
|
};
|
|
68621
|
-
handle("migration:scan-stable", async (_, { send }) => {
|
|
68625
|
+
handle("migration:scan-stable", async (_, { send, value }) => {
|
|
68622
68626
|
logger().info("[Migration] Scanning other channel database...");
|
|
68623
68627
|
try {
|
|
68624
|
-
|
|
68625
|
-
|
|
68628
|
+
let sourceEnv = "prod";
|
|
68629
|
+
if (value?.sourceChannel === "stable") sourceEnv = "prod";
|
|
68630
|
+
else if (value?.sourceChannel === "beta") sourceEnv = "beta";
|
|
68631
|
+
else sourceEnv = context.userDataPath.endsWith("app") || !context.userDataPath.includes("app-beta") ? "beta" : "prod";
|
|
68626
68632
|
const sourcePath = getDefaultUserDataPath$1(sourceEnv);
|
|
68627
68633
|
if (sourcePath === context.userDataPath) {
|
|
68628
68634
|
logger().info("[Migration] Running in same channel. Disabling migration scan.");
|
|
@@ -68631,8 +68637,8 @@ const registerMigrationHandlers = (context) => {
|
|
|
68631
68637
|
data: {
|
|
68632
68638
|
type: "success",
|
|
68633
68639
|
result: {
|
|
68634
|
-
sourceChannel:
|
|
68635
|
-
targetChannel:
|
|
68640
|
+
sourceChannel: sourceEnv === "prod" ? "Stable" : "Beta",
|
|
68641
|
+
targetChannel: context.userDataPath.endsWith("app") || !context.userDataPath.includes("app-beta") ? "Stable" : "Beta",
|
|
68636
68642
|
settingsExists: false,
|
|
68637
68643
|
settingsVersion: null,
|
|
68638
68644
|
settingsVersionTarget: null,
|
|
@@ -68731,7 +68737,8 @@ const registerMigrationHandlers = (context) => {
|
|
|
68731
68737
|
try {
|
|
68732
68738
|
if (existsSync(sourcePipeFile)) {
|
|
68733
68739
|
const pipeContent = await fs$1.readFile(sourcePipeFile, "utf8");
|
|
68734
|
-
const
|
|
68740
|
+
const rawJson = JSON.parse(pipeContent);
|
|
68741
|
+
const pipeJson = await savedFileMigrator.migrate(rawJson);
|
|
68735
68742
|
pipeName = pipeJson.name || pipeName;
|
|
68736
68743
|
pipeDesc = pipeJson.description || pipeDesc;
|
|
68737
68744
|
}
|
|
@@ -68764,8 +68771,8 @@ const registerMigrationHandlers = (context) => {
|
|
|
68764
68771
|
data: {
|
|
68765
68772
|
type: "success",
|
|
68766
68773
|
result: {
|
|
68767
|
-
sourceChannel:
|
|
68768
|
-
targetChannel:
|
|
68774
|
+
sourceChannel: sourceEnv === "prod" ? "Stable" : "Beta",
|
|
68775
|
+
targetChannel: context.userDataPath.endsWith("app") || !context.userDataPath.includes("app-beta") ? "Stable" : "Beta",
|
|
68769
68776
|
settingsExists,
|
|
68770
68777
|
settingsVersion,
|
|
68771
68778
|
settingsVersionTarget: targetSettingsMeta.version,
|
|
@@ -68803,8 +68810,11 @@ const registerMigrationHandlers = (context) => {
|
|
|
68803
68810
|
handle("migration:perform", async (_, { send, value }) => {
|
|
68804
68811
|
logger().info("[Migration] Performing migration...");
|
|
68805
68812
|
try {
|
|
68806
|
-
const { migrateSettings, migrateConnections, selectedProjects, selectedPipelines } = value;
|
|
68807
|
-
|
|
68813
|
+
const { migrateSettings, migrateConnections, selectedProjects, selectedPipelines, sourceChannel } = value;
|
|
68814
|
+
let sourceEnv = "prod";
|
|
68815
|
+
if (sourceChannel === "stable") sourceEnv = "prod";
|
|
68816
|
+
else if (sourceChannel === "beta") sourceEnv = "beta";
|
|
68817
|
+
else sourceEnv = context.userDataPath.endsWith("app") || !context.userDataPath.includes("app-beta") ? "beta" : "prod";
|
|
68808
68818
|
const sourcePath = getDefaultUserDataPath$1(sourceEnv);
|
|
68809
68819
|
const sourceContext = new PipelabContext({
|
|
68810
68820
|
userDataPath: sourcePath,
|
|
@@ -69007,8 +69017,16 @@ const registerMigrationHandlers = (context) => {
|
|
|
69007
69017
|
const betaPipeFile = context.getConfigPath(`${stablePipe.configName}.json`);
|
|
69008
69018
|
if (existsSync(stablePipeFile)) {
|
|
69009
69019
|
await fs$1.mkdir(dirname(betaPipeFile), { recursive: true });
|
|
69010
|
-
|
|
69011
|
-
|
|
69020
|
+
try {
|
|
69021
|
+
const pipeContent = await fs$1.readFile(stablePipeFile, "utf8");
|
|
69022
|
+
const rawJson = JSON.parse(pipeContent);
|
|
69023
|
+
const migratedJson = await savedFileMigrator.migrate(rawJson);
|
|
69024
|
+
await fs$1.writeFile(betaPipeFile, JSON.stringify(migratedJson, null, 2));
|
|
69025
|
+
logger().info(`[Migration] Migrated and copied pipeline file: ${stablePipe.configName}`);
|
|
69026
|
+
} catch (err) {
|
|
69027
|
+
await fs$1.copyFile(stablePipeFile, betaPipeFile);
|
|
69028
|
+
logger().error(`[Migration] Error migrating during copy of ${stablePipe.configName}, fallback to direct copy:`, err);
|
|
69029
|
+
}
|
|
69012
69030
|
}
|
|
69013
69031
|
}
|
|
69014
69032
|
const updatedPipe = { ...stablePipe };
|
|
@@ -69153,7 +69171,7 @@ async function runPipelineCommand(file, options, version) {
|
|
|
69153
69171
|
}
|
|
69154
69172
|
//#endregion
|
|
69155
69173
|
//#region package.json
|
|
69156
|
-
var version$2 = "2.0.0-beta.
|
|
69174
|
+
var version$2 = "2.0.0-beta.21";
|
|
69157
69175
|
//#endregion
|
|
69158
69176
|
//#region src/paths.ts
|
|
69159
69177
|
const getDefaultUserDataPath = () => {
|