deploy-stack 0.2.8 → 0.2.10
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/package.json +1 -1
- package/src/utils/generator.js +65 -4
- package/templates/_gitignore +0 -19
package/package.json
CHANGED
package/src/utils/generator.js
CHANGED
|
@@ -41,16 +41,77 @@ export async function generateTemplates(targetDir, config) {
|
|
|
41
41
|
// 4. Create empty secrets file
|
|
42
42
|
await fs.writeFile(path.join(targetDir, 'terraform', 'secret_keys.json'), "[]");
|
|
43
43
|
|
|
44
|
-
// 5. Handle .gitignore
|
|
44
|
+
// 5. Handle .gitignore dynamically based on framework
|
|
45
45
|
const targetGitignore = path.join(targetDir, '.gitignore');
|
|
46
|
-
const gitignoreContent = await fs.readFile(path.join(templatesDir, '_gitignore'), 'utf-8');
|
|
47
46
|
|
|
48
47
|
if (!fsSync.existsSync(targetGitignore)) {
|
|
49
|
-
await fs.writeFile(targetGitignore,
|
|
48
|
+
await fs.writeFile(targetGitignore, getGitignoreContent(config.finalFramework));
|
|
50
49
|
} else {
|
|
51
50
|
const existingGitignore = await fs.readFile(targetGitignore, 'utf-8');
|
|
52
51
|
if (!existingGitignore.includes('terraform/.terraform/')) {
|
|
53
|
-
|
|
52
|
+
const appendIgnore = '\n# Added by deploy-stack (Terraform)\nterraform/.terraform/\nterraform/*.tfstate\nterraform/*.tfstate.backup\nterraform/.terraform.lock.hcl\nterraform/secret_keys.json\nterraform/.terraform.*\n.env\n';
|
|
53
|
+
await fs.appendFile(targetGitignore, appendIgnore);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getGitignoreContent(framework) {
|
|
59
|
+
const baseIgnore = `
|
|
60
|
+
# Infrastructure (deploy-stack)
|
|
61
|
+
terraform/.terraform/
|
|
62
|
+
terraform/*.tfstate
|
|
63
|
+
terraform/*.tfstate.backup
|
|
64
|
+
terraform/.terraform.lock.hcl
|
|
65
|
+
terraform/secret_keys.json
|
|
66
|
+
terraform/.terraform.*
|
|
67
|
+
.env
|
|
68
|
+
|
|
69
|
+
# OS
|
|
70
|
+
.DS_Store
|
|
71
|
+
Thumbs.db
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const nodeIgnore = `
|
|
75
|
+
# Node.js
|
|
76
|
+
node_modules/
|
|
77
|
+
npm-debug.log
|
|
78
|
+
yarn-error.log
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
const nextjsIgnore = `
|
|
82
|
+
# Next.js
|
|
83
|
+
node_modules/
|
|
84
|
+
.next/
|
|
85
|
+
out/
|
|
86
|
+
build/
|
|
87
|
+
next-env.d.ts
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const pythonIgnore = `
|
|
91
|
+
# Python
|
|
92
|
+
__pycache__/
|
|
93
|
+
*.py[cod]
|
|
94
|
+
*$py.class
|
|
95
|
+
venv/
|
|
96
|
+
env/
|
|
97
|
+
.venv/
|
|
98
|
+
.pytest_cache/
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const staticIgnore = `
|
|
102
|
+
# Static Sites
|
|
103
|
+
node_modules/
|
|
104
|
+
dist/
|
|
105
|
+
build/
|
|
106
|
+
.cache/
|
|
107
|
+
public/
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
let frameworkIgnore = '';
|
|
111
|
+
if (framework === 'node') frameworkIgnore = nodeIgnore;
|
|
112
|
+
if (framework === 'nextjs') frameworkIgnore = nextjsIgnore;
|
|
113
|
+
if (framework === 'python') frameworkIgnore = pythonIgnore;
|
|
114
|
+
if (framework === 'static') frameworkIgnore = staticIgnore;
|
|
115
|
+
|
|
116
|
+
return (baseIgnore + frameworkIgnore).trim();
|
|
56
117
|
}
|
package/templates/_gitignore
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Terraform
|
|
2
|
-
terraform/.terraform/
|
|
3
|
-
terraform/*.tfstate
|
|
4
|
-
terraform/*.tfstate.backup
|
|
5
|
-
terraform/.terraform.lock.hcl
|
|
6
|
-
terraform/secret_keys.json
|
|
7
|
-
terraform/.terraform.*
|
|
8
|
-
|
|
9
|
-
# Node & Next.js
|
|
10
|
-
node_modules/
|
|
11
|
-
.next/
|
|
12
|
-
.env
|
|
13
|
-
.env.*
|
|
14
|
-
!.env.example
|
|
15
|
-
|
|
16
|
-
# Python
|
|
17
|
-
__pycache__/
|
|
18
|
-
*.pyc
|
|
19
|
-
venv/
|