@naseej/blox 1.3.2 → 1.3.3
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/run.js +41 -38
- package/package.json +1 -1
package/dist/run.js
CHANGED
|
@@ -31,7 +31,7 @@ var option = (flags, description) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "1.3.
|
|
34
|
+
var version = "1.3.3";
|
|
35
35
|
|
|
36
36
|
// src/commands/add/index.ts
|
|
37
37
|
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
@@ -253,7 +253,7 @@ var createPatch = async (fromCommit, toCommit, outputPath, ignore2 = []) => {
|
|
|
253
253
|
">",
|
|
254
254
|
outputPath,
|
|
255
255
|
"--",
|
|
256
|
-
...ignore2.map((file) => `
|
|
256
|
+
...ignore2.map((file) => `":(exclude)${file}"`)
|
|
257
257
|
]);
|
|
258
258
|
};
|
|
259
259
|
var getChangesLog = async (fromCommit, toCommit) => {
|
|
@@ -1049,7 +1049,8 @@ async function updateFromRemote({ name, source = "", ignore: ignore2 = [], dir =
|
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
const patchFilePath = import_node_path9.default.join(dir, "diff.patch");
|
|
1052
|
-
|
|
1052
|
+
const remoteIgnore = remoteBloxFile.definition?.ignore || [];
|
|
1053
|
+
ignore2.push(...remoteIgnore, ".blox", "**/.blox");
|
|
1053
1054
|
await git.createPatch(fromCommit, toCommit, patchFilePath, ignore2);
|
|
1054
1055
|
const deletePatchFile = async () => {
|
|
1055
1056
|
if (!isDebugMode()) {
|
|
@@ -1067,24 +1068,12 @@ async function updateFromRemote({ name, source = "", ignore: ignore2 = [], dir =
|
|
|
1067
1068
|
console.log(errorMessage.replace("error:", fmt.red("error:")));
|
|
1068
1069
|
if (errorMessage.includes("does not exist in index")) {
|
|
1069
1070
|
logWarningSection(
|
|
1070
|
-
"
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
/error: (.*): does not exist in index/g
|
|
1077
|
-
)
|
|
1078
|
-
].map((m) => m[1]),
|
|
1079
|
-
null,
|
|
1080
|
-
2
|
|
1081
|
-
)
|
|
1082
|
-
),
|
|
1083
|
-
"Try to",
|
|
1084
|
-
`1- temporarily to .blox ignore property for ${name}`,
|
|
1085
|
-
"2- commit it and try again",
|
|
1086
|
-
"3- remove it after update"
|
|
1087
|
-
].join("\n\n")
|
|
1071
|
+
"Some files has changes in remote but were deleted, \n if you want to skip them pass this arg to update command:",
|
|
1072
|
+
fmt.cyan(
|
|
1073
|
+
`--ignore ${[
|
|
1074
|
+
...errorMessage.matchAll(/error: (.*): does not exist in index/g)
|
|
1075
|
+
].map((m) => `"${name}:${m[1]}"`).join(",")}`
|
|
1076
|
+
)
|
|
1088
1077
|
);
|
|
1089
1078
|
}
|
|
1090
1079
|
throw new Error("Failed to apply changes.");
|
|
@@ -1113,7 +1102,8 @@ async function updateApp({
|
|
|
1113
1102
|
templateDef,
|
|
1114
1103
|
templates,
|
|
1115
1104
|
usedBlocks,
|
|
1116
|
-
availableBlocks
|
|
1105
|
+
availableBlocks,
|
|
1106
|
+
ignore: ignore2
|
|
1117
1107
|
}) {
|
|
1118
1108
|
await runTask({ start: "Update App", end: "Updated App" }, async () => {
|
|
1119
1109
|
const template = templates[templateDef.name];
|
|
@@ -1124,7 +1114,7 @@ async function updateApp({
|
|
|
1124
1114
|
const toAppCommit = await updateFromRemote({
|
|
1125
1115
|
name: templateDef.name,
|
|
1126
1116
|
source: template.source,
|
|
1127
|
-
ignore:
|
|
1117
|
+
ignore: ignore2
|
|
1128
1118
|
});
|
|
1129
1119
|
if (!toAppCommit) return;
|
|
1130
1120
|
if (!templateDef.bases?.length) return;
|
|
@@ -1148,7 +1138,7 @@ async function updateApp({
|
|
|
1148
1138
|
}
|
|
1149
1139
|
});
|
|
1150
1140
|
}
|
|
1151
|
-
async function updateAppBases(templateDef, templates) {
|
|
1141
|
+
async function updateAppBases(templateDef, templates, ignore2) {
|
|
1152
1142
|
for (const base of templateDef.bases || []) {
|
|
1153
1143
|
await runTask(
|
|
1154
1144
|
{ start: `Update App base: ${base.name}`, end: `Updated App base: ${base.name}` },
|
|
@@ -1158,19 +1148,14 @@ async function updateAppBases(templateDef, templates) {
|
|
|
1158
1148
|
error("Selected template not available in registries");
|
|
1159
1149
|
return;
|
|
1160
1150
|
}
|
|
1161
|
-
await updateFromRemote({
|
|
1162
|
-
name: base.name,
|
|
1163
|
-
source: template.source,
|
|
1164
|
-
ignore: templateDef.ignore
|
|
1165
|
-
});
|
|
1151
|
+
await updateFromRemote({ name: base.name, source: template.source, ignore: ignore2 });
|
|
1166
1152
|
}
|
|
1167
1153
|
);
|
|
1168
1154
|
}
|
|
1169
1155
|
}
|
|
1170
|
-
async function updateBlock(block, blocks) {
|
|
1156
|
+
async function updateBlock(block, blocks, ignore2) {
|
|
1171
1157
|
const blockRegistryData = blocks[block];
|
|
1172
1158
|
const blockPath = import_node_path10.default.join(blocksDir, block);
|
|
1173
|
-
const blockDef = getBlockDef(blockPath);
|
|
1174
1159
|
await runTask({ start: `Update block: ${block}`, end: `Updated block: ${block}` }, async () => {
|
|
1175
1160
|
if (!blockRegistryData) {
|
|
1176
1161
|
error(`Selected block: ${block} not available in registries`, false);
|
|
@@ -1179,8 +1164,8 @@ async function updateBlock(block, blocks) {
|
|
|
1179
1164
|
await updateFromRemote({
|
|
1180
1165
|
name: block,
|
|
1181
1166
|
source: blockRegistryData.source,
|
|
1182
|
-
|
|
1183
|
-
|
|
1167
|
+
dir: blockPath,
|
|
1168
|
+
ignore: ignore2
|
|
1184
1169
|
});
|
|
1185
1170
|
});
|
|
1186
1171
|
}
|
|
@@ -1222,7 +1207,7 @@ ${fmt.gray("-".repeat(82))}
|
|
|
1222
1207
|
// src/commands/update/index.ts
|
|
1223
1208
|
var update2 = command("update").description("Update app/block").alias("u").addOption(
|
|
1224
1209
|
option("-s, --scope <scope>", "Scope of update").default("all").choices(["app", "bases", "block", "all"])
|
|
1225
|
-
).option("-b, --block <name>", "Block to update, valid only with scope block").action(async (args) => {
|
|
1210
|
+
).option("--ignore <list...>", 'Files ignore list scoped by name i.e "repo:file"').option("-b, --block <name>", "Block to update, valid only with scope block").action(async (args) => {
|
|
1226
1211
|
if (await git.hasUncommittedChanges()) {
|
|
1227
1212
|
import_prompts15.log.warn(fmt.yellow("Make sure to commit any changes first"));
|
|
1228
1213
|
return;
|
|
@@ -1234,16 +1219,34 @@ var update2 = command("update").description("Update app/block").alias("u").addOp
|
|
|
1234
1219
|
const availableBlocks = await getAvailableBlocks(templateDef);
|
|
1235
1220
|
const templates = await getAvailableTemplates();
|
|
1236
1221
|
const usedBlocks = getUsedBlocksDef();
|
|
1222
|
+
const ignoresByName = {};
|
|
1223
|
+
for (const ignore2 of args.ignore || []) {
|
|
1224
|
+
const [repo, pattern] = ignore2.split(":");
|
|
1225
|
+
if (!repo || !pattern) {
|
|
1226
|
+
error("Invalid ignore pattern");
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
if (!ignoresByName[repo]) {
|
|
1230
|
+
ignoresByName[repo] = [];
|
|
1231
|
+
}
|
|
1232
|
+
ignoresByName[repo].push(pattern);
|
|
1233
|
+
}
|
|
1237
1234
|
try {
|
|
1238
1235
|
if (["app", "all"].includes(args.scope)) {
|
|
1239
|
-
await updateApp({
|
|
1236
|
+
await updateApp({
|
|
1237
|
+
templateDef,
|
|
1238
|
+
templates,
|
|
1239
|
+
usedBlocks,
|
|
1240
|
+
availableBlocks,
|
|
1241
|
+
ignore: ignoresByName[templateDef.name]
|
|
1242
|
+
});
|
|
1240
1243
|
}
|
|
1241
1244
|
if (["bases", "all"].includes(args.scope)) {
|
|
1242
|
-
await updateAppBases(templateDef, templates);
|
|
1245
|
+
await updateAppBases(templateDef, templates, ignoresByName[templateDef.name]);
|
|
1243
1246
|
}
|
|
1244
1247
|
if (args.scope === "all") {
|
|
1245
1248
|
for (const block of usedBlocks) {
|
|
1246
|
-
await updateBlock(block.name, availableBlocks);
|
|
1249
|
+
await updateBlock(block.name, availableBlocks, ignoresByName[block.name]);
|
|
1247
1250
|
}
|
|
1248
1251
|
}
|
|
1249
1252
|
if (args.scope === "block") {
|
|
@@ -1261,7 +1264,7 @@ var update2 = command("update").description("Update app/block").alias("u").addOp
|
|
|
1261
1264
|
error("Selected block not used in app");
|
|
1262
1265
|
return;
|
|
1263
1266
|
}
|
|
1264
|
-
await updateBlock(blockDef.name, availableBlocks);
|
|
1267
|
+
await updateBlock(blockDef.name, availableBlocks, ignoresByName[blockDef.name]);
|
|
1265
1268
|
}
|
|
1266
1269
|
await checkVersionsCompatibility();
|
|
1267
1270
|
const endCheckpoints = await getCurrentCheckpoints();
|