@gadmin2n/cli 0.0.114 → 0.0.116
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.
|
@@ -5,6 +5,7 @@ export interface ClassifyInput {
|
|
|
5
5
|
theirsExists: boolean;
|
|
6
6
|
oursEqBase?: () => boolean;
|
|
7
7
|
oursEqTheirs?: () => boolean;
|
|
8
|
+
baseEqTheirs?: () => boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare function classifyFile(input: ClassifyInput): ClassifyResult;
|
|
10
11
|
export declare function classifyAll(baseDir: string, oursDir: string, theirsDir: string, userExcludes: string[]): ClassifiedPlan;
|
|
@@ -6,7 +6,7 @@ const fs = require("fs");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const excludes_1 = require("./excludes");
|
|
8
8
|
function classifyFile(input) {
|
|
9
|
-
var _a, _b, _c;
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
10
|
const { baseExists, oursExists, theirsExists } = input;
|
|
11
11
|
if (!baseExists && !oursExists && !theirsExists) {
|
|
12
12
|
throw new Error('classifyFile: impossible state — file in none of the three sides');
|
|
@@ -25,8 +25,19 @@ function classifyFile(input) {
|
|
|
25
25
|
if (baseExists && oursExists && !theirsExists) {
|
|
26
26
|
return ((_b = input.oursEqBase) === null || _b === void 0 ? void 0 : _b.call(input)) ? 'delete' : 'modifyDeleteConflict';
|
|
27
27
|
}
|
|
28
|
-
// ✓✓✓ — all three sides exist.
|
|
29
|
-
|
|
28
|
+
// ✓✓✓ — all three sides exist.
|
|
29
|
+
// Fast path 1: ours already equals theirs → no merge needed.
|
|
30
|
+
if ((_c = input.oursEqTheirs) === null || _c === void 0 ? void 0 : _c.call(input))
|
|
31
|
+
return 'keep';
|
|
32
|
+
// Fast path 2: base equals theirs → template hasn't changed for this file
|
|
33
|
+
// since the recorded base. A 3-way merge would produce ours unchanged
|
|
34
|
+
// (since theirs == base contributes no diff), so we skip the rewrite to
|
|
35
|
+
// avoid spurious "Updated" entries on every run when the instance has
|
|
36
|
+
// legitimately diverged from the template — rendered placeholders in
|
|
37
|
+
// init.sql, regenerated yarn.lock files, user-edited .env, etc.
|
|
38
|
+
if ((_d = input.baseEqTheirs) === null || _d === void 0 ? void 0 : _d.call(input))
|
|
39
|
+
return 'keep';
|
|
40
|
+
return 'update';
|
|
30
41
|
}
|
|
31
42
|
exports.classifyFile = classifyFile;
|
|
32
43
|
function fileBytesEqual(p, q) {
|
|
@@ -53,6 +64,7 @@ function classifyAll(baseDir, oursDir, theirsDir, userExcludes) {
|
|
|
53
64
|
theirsExists,
|
|
54
65
|
oursEqBase: () => baseExists && oursExists && fileBytesEqual(path.join(baseDir, rel), path.join(oursDir, rel)),
|
|
55
66
|
oursEqTheirs: () => oursExists && theirsExists && fileBytesEqual(path.join(oursDir, rel), path.join(theirsDir, rel)),
|
|
67
|
+
baseEqTheirs: () => baseExists && theirsExists && fileBytesEqual(path.join(baseDir, rel), path.join(theirsDir, rel)),
|
|
56
68
|
});
|
|
57
69
|
plan[result].push(rel);
|
|
58
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadmin2n/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.116",
|
|
4
4
|
"description": "Gadmin - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@angular-devkit/core": "13.3.2",
|
|
48
48
|
"@angular-devkit/schematics": "13.3.2",
|
|
49
49
|
"@angular-devkit/schematics-cli": "13.3.2",
|
|
50
|
-
"@gadmin2n/schematics": "^0.0.
|
|
50
|
+
"@gadmin2n/schematics": "^0.0.91",
|
|
51
51
|
"abc": "^0.6.1",
|
|
52
52
|
"chalk": "3.0.0",
|
|
53
53
|
"chokidar": "3.5.3",
|