create-my-app-template 1.6.0 → 1.7.0
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.js +27 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -20,20 +20,37 @@ const templateDir = path.join(__dirname, "template");
|
|
|
20
20
|
const projectDir = path.join(targetDir, response.projectName)
|
|
21
21
|
|
|
22
22
|
await fs.copy(templateDir, projectDir);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
await fixGitignore(projectDir)
|
|
24
|
+
|
|
25
|
+
async function fixGitignore(projectPath) {
|
|
26
|
+
// Use resolve to get the absolute path (e.g., /Users/you/project/my-app)
|
|
27
|
+
const absolutePath = path.resolve(projectPath);
|
|
28
|
+
const oldPath = path.join(absolutePath, '_gitignore');
|
|
29
|
+
const newPath = path.join(absolutePath, '.gitignore');
|
|
30
|
+
|
|
31
|
+
// Let's see exactly what the OS sees in that folder right now
|
|
32
|
+
const files = await fs.readdir(absolutePath);
|
|
33
|
+
|
|
34
|
+
if (files.includes('_gitignore')) {
|
|
32
35
|
await fs.rename(oldPath, newPath);
|
|
33
|
-
console.log('Successfully
|
|
36
|
+
console.log(' ✔ Successfully renamed _gitignore to .gitignore');
|
|
37
|
+
} else {
|
|
38
|
+
console.log(' ✖ Could not find _gitignore.');
|
|
39
|
+
console.log(' Files actually present:', files);
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
|
|
43
|
+
// async function fixGitignore(projectPath) { console.log(100, projectPath)
|
|
44
|
+
// const oldPath = path.join(projectPath, '_gitignore');
|
|
45
|
+
// const newPath = path.join(projectPath, '.gitignore');
|
|
46
|
+
// console.log(200, oldPath, newPath)
|
|
47
|
+
// if (await fs.pathExists(oldPath)) { console.log(300)
|
|
48
|
+
// // This renames 'gitignore' to '.gitignore'
|
|
49
|
+
// await fs.rename(oldPath, newPath);
|
|
50
|
+
// console.log('Successfully created .gitignore');
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
|
|
37
54
|
console.log("✔ Project created successfully!");
|
|
38
55
|
console.log(`cd ${response.projectName}`);
|
|
39
56
|
console.log("npm install");
|