@gadmin2n/cli 0.0.136 → 0.0.138
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/actions/update.action.js
CHANGED
|
@@ -998,6 +998,7 @@ class UpdateAction extends abstract_action_1.AbstractAction {
|
|
|
998
998
|
let preflight = null;
|
|
999
999
|
let baseHandle = null;
|
|
1000
1000
|
let theirsHandle = null;
|
|
1001
|
+
let changesApplied = false;
|
|
1001
1002
|
try {
|
|
1002
1003
|
if (templateEnabled) {
|
|
1003
1004
|
try {
|
|
@@ -1084,6 +1085,7 @@ class UpdateAction extends abstract_action_1.AbstractAction {
|
|
|
1084
1085
|
// Pre-apply preview + confirm (skipped under --yes).
|
|
1085
1086
|
const applyAndReport = () => {
|
|
1086
1087
|
const conflicts = applyPlan(plan, baseRoot, instanceDir, theirsRoot, mergeOpts);
|
|
1088
|
+
changesApplied = true;
|
|
1087
1089
|
// Always advance meta to new version, even when conflicts present (invariant #2).
|
|
1088
1090
|
(0, base_store_1.writeMeta)(instanceDir, {
|
|
1089
1091
|
schematicsVersion,
|
|
@@ -1152,6 +1154,19 @@ class UpdateAction extends abstract_action_1.AbstractAction {
|
|
|
1152
1154
|
if (pkgSnapshots) {
|
|
1153
1155
|
yield maybeInstallChangedDeps(pkgSnapshots, dryRun);
|
|
1154
1156
|
}
|
|
1157
|
+
// Final: remind the user to commit the changes.
|
|
1158
|
+
if (changesApplied && !dryRun) {
|
|
1159
|
+
console.info(chalk.bold('\n═══════════════════════════════════════════════════'));
|
|
1160
|
+
console.info(chalk.bold(' Next step'));
|
|
1161
|
+
console.info(chalk.bold('═══════════════════════════════════════════════════\n'));
|
|
1162
|
+
console.info(chalk.cyan('📝 Template files have been updated. Commit the changes:'));
|
|
1163
|
+
console.info();
|
|
1164
|
+
console.info(chalk.white(' git add .'));
|
|
1165
|
+
console.info(chalk.white(' git commit -m "chore: upgrade gadmin2 template"'));
|
|
1166
|
+
console.info();
|
|
1167
|
+
console.info(chalk.gray(' Tip: review the diff first with `git diff --staged` before committing.'));
|
|
1168
|
+
console.info();
|
|
1169
|
+
}
|
|
1155
1170
|
}
|
|
1156
1171
|
finally {
|
|
1157
1172
|
if (baseHandle)
|
|
@@ -33,6 +33,7 @@ function materializeFromLocalRegistry(registryDir, version, templateName) {
|
|
|
33
33
|
}
|
|
34
34
|
const dst = fs.mkdtempSync(path.join(os.tmpdir(), 'gadmin2-base-'));
|
|
35
35
|
copyTreeRecursive(src, dst);
|
|
36
|
+
restoreGitignoreNames(dst);
|
|
36
37
|
let cleaned = false;
|
|
37
38
|
const cleanup = () => {
|
|
38
39
|
if (cleaned)
|
|
@@ -88,6 +89,7 @@ function materializeFromNpm(version, templateName) {
|
|
|
88
89
|
const candidates = templateNameCandidates(templateName).map((n) => path.join(tmp, 'package/dist/lib/application/files', n));
|
|
89
90
|
for (const c of candidates) {
|
|
90
91
|
if (fs.existsSync(c)) {
|
|
92
|
+
restoreGitignoreNames(c);
|
|
91
93
|
return { dir: c, cleanup };
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -127,6 +129,26 @@ function copyTreeRecursive(src, dst) {
|
|
|
127
129
|
// symlinks / sockets: skip
|
|
128
130
|
}
|
|
129
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Rename all `gitignore` files back to `.gitignore` in the materialized
|
|
134
|
+
* template directory. The schematics prebuild script renames `.gitignore` →
|
|
135
|
+
* `gitignore` before `npm pack` because npm strips dotfiles named `.gitignore`
|
|
136
|
+
* from tarballs. After extraction we must restore the canonical name so that
|
|
137
|
+
* the 3-way merge compares `base/.gitignore` vs `ours/.gitignore` vs
|
|
138
|
+
* `theirs/.gitignore` — without this, the merge misidentifies the file as
|
|
139
|
+
* deleted by the instance and added by the instance under a different name.
|
|
140
|
+
*/
|
|
141
|
+
function restoreGitignoreNames(dir) {
|
|
142
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
143
|
+
const abs = path.join(dir, entry.name);
|
|
144
|
+
if (entry.isDirectory()) {
|
|
145
|
+
restoreGitignoreNames(abs);
|
|
146
|
+
}
|
|
147
|
+
else if (entry.isFile() && entry.name === 'gitignore') {
|
|
148
|
+
fs.renameSync(abs, path.join(dir, '.gitignore'));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
130
152
|
/**
|
|
131
153
|
* Resolve the latest published version of `@gadmin2n/schematics`.
|
|
132
154
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadmin2n/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.138",
|
|
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.109",
|
|
51
51
|
"abc": "^0.6.1",
|
|
52
52
|
"chalk": "3.0.0",
|
|
53
53
|
"chokidar": "3.5.3",
|