@gadmin2n/cli 0.0.137 → 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.
|
@@ -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
|
*
|