@factiii/stack 0.1.177 → 0.1.182
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/LICENSE +21 -21
- package/README.md +441 -441
- package/bin/stack +300 -300
- package/dist/cli/dev-sync.js +16 -16
- package/dist/plugins/addons/auth/index.js +7 -7
- package/dist/plugins/addons/vercel/index.js +9 -9
- package/dist/plugins/addons/vercel/scanfix/config.js +10 -10
- package/dist/plugins/addons/vercel/scanfix/token.js +15 -15
- package/dist/plugins/approved.json +13 -13
- package/dist/plugins/pipelines/aws/index.js +12 -12
- package/dist/plugins/pipelines/aws/policies/bootstrap-policy.json +135 -135
- package/dist/plugins/pipelines/aws/prod.js +1 -1
- package/dist/plugins/pipelines/aws/scanfix/iam.d.ts.map +1 -1
- package/dist/plugins/pipelines/aws/scanfix/iam.js +40 -29
- package/dist/plugins/pipelines/aws/scanfix/iam.js.map +1 -1
- package/dist/plugins/pipelines/aws/utils/aws-helpers.d.ts +3 -1
- package/dist/plugins/pipelines/aws/utils/aws-helpers.d.ts.map +1 -1
- package/dist/plugins/pipelines/aws/utils/aws-helpers.js +31 -2
- package/dist/plugins/pipelines/aws/utils/aws-helpers.js.map +1 -1
- package/dist/plugins/pipelines/factiii/prod.js +21 -21
- package/dist/plugins/pipelines/factiii/scanfix/env-files.d.ts.map +1 -1
- package/dist/plugins/pipelines/factiii/scanfix/env-files.js +59 -0
- package/dist/plugins/pipelines/factiii/scanfix/env-files.js.map +1 -1
- package/dist/plugins/pipelines/factiii/staging.js +23 -23
- package/dist/plugins/pipelines/factiii/workflows/stack-ci.yml +75 -75
- package/dist/plugins/pipelines/factiii/workflows/stack-cicd-prod.yml +73 -73
- package/dist/plugins/servers/amazon-linux/index.js +16 -16
- package/dist/plugins/servers/mac/index.js +12 -12
- package/dist/plugins/servers/mac/staging.js +2 -2
- package/dist/plugins/servers/ubuntu/index.js +23 -23
- package/dist/plugins/servers/windows/index.js +15 -15
- package/dist/scripts/generate-all.js +73 -73
- package/dist/utils/deployment-report.js +2 -2
- package/dist/utils/secret-prompts.js +34 -34
- package/dist/utils/ssh-helper.d.ts.map +1 -1
- package/dist/utils/ssh-helper.js +31 -1
- package/dist/utils/ssh-helper.js.map +1 -1
- package/dist/utils/template-generator.js +74 -74
- package/package.json +93 -100
|
@@ -51,50 +51,50 @@ const env_validator_js_1 = require("./env-validator.js");
|
|
|
51
51
|
*/
|
|
52
52
|
function generateEnvExampleTemplate(config) {
|
|
53
53
|
const repoName = config.name ?? 'myapp';
|
|
54
|
-
const template = `# .env.example - Environment variable template
|
|
55
|
-
# This file defines all required environment variables across environments.
|
|
56
|
-
# Values are descriptive examples - replace with real values in .env.staging and .env.prod
|
|
57
|
-
# This file is committed to git as a template.
|
|
58
|
-
|
|
59
|
-
# === Application Settings ===
|
|
60
|
-
NODE_ENV=development
|
|
61
|
-
# Slot number (1-5). Client=3000+PORT, Server=5000+PORT
|
|
62
|
-
# Example: PORT=1 → client:3001, server:5001
|
|
63
|
-
PORT=1
|
|
64
|
-
|
|
65
|
-
# === Database ===
|
|
66
|
-
# PostgreSQL connection string format
|
|
67
|
-
DATABASE_URL=postgresql://EXAMPLE_user:EXAMPLE_password@localhost:5432/EXAMPLE_${repoName}-dev
|
|
68
|
-
|
|
69
|
-
# === Authentication ===
|
|
70
|
-
# 256-bit secret key for JWT signing
|
|
71
|
-
JWT_SECRET=EXAMPLE_your-256-bit-secret-key-here
|
|
72
|
-
JWT_EXPIRES_IN=7d
|
|
73
|
-
|
|
74
|
-
# === External APIs (if needed) ===
|
|
75
|
-
# OPENAI_API_KEY=EXAMPLE_sk-proj-abc123xyz789
|
|
76
|
-
# STRIPE_SECRET_KEY=EXAMPLE_sk_test_51ABC123xyz
|
|
77
|
-
# STRIPE_PUBLISHABLE_KEY=EXAMPLE_pk_test_51ABC123xyz
|
|
78
|
-
|
|
79
|
-
# === AWS Configuration (if using S3, SES, etc) ===
|
|
80
|
-
# AWS_ACCESS_KEY_ID=EXAMPLE_AKIAIOSFODNN7EXAMPLE
|
|
81
|
-
# AWS_SECRET_ACCESS_KEY=EXAMPLE_wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
82
|
-
# AWS_REGION=EXAMPLE_us-east-1
|
|
83
|
-
# AWS_BUCKET_NAME=EXAMPLE_${repoName}-assets
|
|
84
|
-
|
|
85
|
-
# === Email Configuration (if using SMTP) ===
|
|
86
|
-
# SMTP_HOST=EXAMPLE_smtp.gmail.com
|
|
87
|
-
# SMTP_PORT=587
|
|
88
|
-
# SMTP_USER=EXAMPLE_noreply@yourdomain.com
|
|
89
|
-
# SMTP_PASSWORD=EXAMPLE_your-app-password
|
|
90
|
-
|
|
91
|
-
# === Application URLs ===
|
|
92
|
-
# Replace YOUR_IP with your local network IP (start.sh does this automatically)
|
|
93
|
-
# FRONTEND_URL=http://YOUR_IP:3001
|
|
94
|
-
# API_URL=http://YOUR_IP:5001
|
|
95
|
-
|
|
96
|
-
# === Application-specific settings ===
|
|
97
|
-
# Add your custom environment variables below
|
|
54
|
+
const template = `# .env.example - Environment variable template
|
|
55
|
+
# This file defines all required environment variables across environments.
|
|
56
|
+
# Values are descriptive examples - replace with real values in .env.staging and .env.prod
|
|
57
|
+
# This file is committed to git as a template.
|
|
58
|
+
|
|
59
|
+
# === Application Settings ===
|
|
60
|
+
NODE_ENV=development
|
|
61
|
+
# Slot number (1-5). Client=3000+PORT, Server=5000+PORT
|
|
62
|
+
# Example: PORT=1 → client:3001, server:5001
|
|
63
|
+
PORT=1
|
|
64
|
+
|
|
65
|
+
# === Database ===
|
|
66
|
+
# PostgreSQL connection string format
|
|
67
|
+
DATABASE_URL=postgresql://EXAMPLE_user:EXAMPLE_password@localhost:5432/EXAMPLE_${repoName}-dev
|
|
68
|
+
|
|
69
|
+
# === Authentication ===
|
|
70
|
+
# 256-bit secret key for JWT signing
|
|
71
|
+
JWT_SECRET=EXAMPLE_your-256-bit-secret-key-here
|
|
72
|
+
JWT_EXPIRES_IN=7d
|
|
73
|
+
|
|
74
|
+
# === External APIs (if needed) ===
|
|
75
|
+
# OPENAI_API_KEY=EXAMPLE_sk-proj-abc123xyz789
|
|
76
|
+
# STRIPE_SECRET_KEY=EXAMPLE_sk_test_51ABC123xyz
|
|
77
|
+
# STRIPE_PUBLISHABLE_KEY=EXAMPLE_pk_test_51ABC123xyz
|
|
78
|
+
|
|
79
|
+
# === AWS Configuration (if using S3, SES, etc) ===
|
|
80
|
+
# AWS_ACCESS_KEY_ID=EXAMPLE_AKIAIOSFODNN7EXAMPLE
|
|
81
|
+
# AWS_SECRET_ACCESS_KEY=EXAMPLE_wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
82
|
+
# AWS_REGION=EXAMPLE_us-east-1
|
|
83
|
+
# AWS_BUCKET_NAME=EXAMPLE_${repoName}-assets
|
|
84
|
+
|
|
85
|
+
# === Email Configuration (if using SMTP) ===
|
|
86
|
+
# SMTP_HOST=EXAMPLE_smtp.gmail.com
|
|
87
|
+
# SMTP_PORT=587
|
|
88
|
+
# SMTP_USER=EXAMPLE_noreply@yourdomain.com
|
|
89
|
+
# SMTP_PASSWORD=EXAMPLE_your-app-password
|
|
90
|
+
|
|
91
|
+
# === Application URLs ===
|
|
92
|
+
# Replace YOUR_IP with your local network IP (start.sh does this automatically)
|
|
93
|
+
# FRONTEND_URL=http://YOUR_IP:3001
|
|
94
|
+
# API_URL=http://YOUR_IP:5001
|
|
95
|
+
|
|
96
|
+
# === Application-specific settings ===
|
|
97
|
+
# Add your custom environment variables below
|
|
98
98
|
`;
|
|
99
99
|
return template;
|
|
100
100
|
}
|
|
@@ -106,10 +106,10 @@ JWT_EXPIRES_IN=7d
|
|
|
106
106
|
*/
|
|
107
107
|
function generateEnvTemplate(environment, devEnv) {
|
|
108
108
|
const envUpper = environment.toUpperCase();
|
|
109
|
-
let template = `# .env.${environment} - ${envUpper} environment variables
|
|
110
|
-
# Fill in all values below. Keys must match .env.example
|
|
111
|
-
# This file should ${environment === 'prod' ? 'ALWAYS' : 'optionally'} be in .gitignore
|
|
112
|
-
|
|
109
|
+
let template = `# .env.${environment} - ${envUpper} environment variables
|
|
110
|
+
# Fill in all values below. Keys must match .env.example
|
|
111
|
+
# This file should ${environment === 'prod' ? 'ALWAYS' : 'optionally'} be in .gitignore
|
|
112
|
+
|
|
113
113
|
`;
|
|
114
114
|
// Copy keys from .env.example with placeholder values
|
|
115
115
|
for (const key of Object.keys(devEnv)) {
|
|
@@ -123,11 +123,11 @@ function generateEnvTemplate(environment, devEnv) {
|
|
|
123
123
|
template += `${key}=<FILL_IN>\n`;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
template += `
|
|
127
|
-
# Instructions:
|
|
128
|
-
# 1. Replace all <FILL_IN> values with real ${environment} values
|
|
129
|
-
# 2. Ensure all keys match .env.example
|
|
130
|
-
# 3. Run: npx stack (to validate)
|
|
126
|
+
template += `
|
|
127
|
+
# Instructions:
|
|
128
|
+
# 1. Replace all <FILL_IN> values with real ${environment} values
|
|
129
|
+
# 2. Ensure all keys match .env.example
|
|
130
|
+
# 3. Run: npx stack (to validate)
|
|
131
131
|
`;
|
|
132
132
|
return template;
|
|
133
133
|
}
|
|
@@ -200,27 +200,27 @@ function createEnvTemplates(rootDir, config) {
|
|
|
200
200
|
* Generate secrets checklist for display
|
|
201
201
|
*/
|
|
202
202
|
function generateSecretsChecklist() {
|
|
203
|
-
return `
|
|
204
|
-
REQUIRED GitHub Secrets (minimal):
|
|
205
|
-
───────────────────────────────────────────────────────
|
|
206
|
-
□ STAGING_SSH - SSH private key for staging
|
|
207
|
-
□ PROD_SSH - SSH private key for production
|
|
208
|
-
□ AWS_SECRET_ACCESS_KEY - AWS secret key (only secret AWS value)
|
|
209
|
-
|
|
210
|
-
OPTIONAL GitHub Secrets:
|
|
211
|
-
───────────────────────────────────────────────────────
|
|
212
|
-
□ STAGING_ENVS - Environment vars from .env.staging
|
|
213
|
-
□ PROD_ENVS - Environment vars from .env.prod
|
|
214
|
-
|
|
215
|
-
NOT SECRETS (in stack.yml):
|
|
216
|
-
───────────────────────────────────────────────────────
|
|
217
|
-
✓ environments.{env}.host - Server IP/hostname
|
|
218
|
-
✓ aws.access_key_id - AWS access key ID
|
|
219
|
-
✓ aws.region - AWS region (e.g., us-east-1)
|
|
220
|
-
|
|
221
|
-
NOT SECRETS (in factiiiAuto.yml):
|
|
222
|
-
───────────────────────────────────────────────────────
|
|
223
|
-
✓ ssh_user - Defaults to ubuntu
|
|
203
|
+
return `
|
|
204
|
+
REQUIRED GitHub Secrets (minimal):
|
|
205
|
+
───────────────────────────────────────────────────────
|
|
206
|
+
□ STAGING_SSH - SSH private key for staging
|
|
207
|
+
□ PROD_SSH - SSH private key for production
|
|
208
|
+
□ AWS_SECRET_ACCESS_KEY - AWS secret key (only secret AWS value)
|
|
209
|
+
|
|
210
|
+
OPTIONAL GitHub Secrets:
|
|
211
|
+
───────────────────────────────────────────────────────
|
|
212
|
+
□ STAGING_ENVS - Environment vars from .env.staging
|
|
213
|
+
□ PROD_ENVS - Environment vars from .env.prod
|
|
214
|
+
|
|
215
|
+
NOT SECRETS (in stack.yml):
|
|
216
|
+
───────────────────────────────────────────────────────
|
|
217
|
+
✓ environments.{env}.host - Server IP/hostname
|
|
218
|
+
✓ aws.access_key_id - AWS access key ID
|
|
219
|
+
✓ aws.region - AWS region (e.g., us-east-1)
|
|
220
|
+
|
|
221
|
+
NOT SECRETS (in factiiiAuto.yml):
|
|
222
|
+
───────────────────────────────────────────────────────
|
|
223
|
+
✓ ssh_user - Defaults to ubuntu
|
|
224
224
|
`.trim();
|
|
225
225
|
}
|
|
226
226
|
//# sourceMappingURL=template-generator.js.map
|
package/package.json
CHANGED
|
@@ -1,100 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"pnpm": {
|
|
95
|
-
"overrides": {
|
|
96
|
-
"minimatch": ">=10.2.1",
|
|
97
|
-
"diff": ">=4.0.4"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@factiii/stack",
|
|
3
|
+
"version": "0.1.182",
|
|
4
|
+
"description": "Infrastructure management package for deploying services to servers",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"stack": "./bin/stack"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"dist/"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"infrastructure",
|
|
16
|
+
"deployment",
|
|
17
|
+
"docker",
|
|
18
|
+
"nginx"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/factiii/stack.git"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"registry": "https://registry.npmjs.org"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@aws-sdk/client-ec2": "^3.750.0",
|
|
31
|
+
"@aws-sdk/client-ec2-instance-connect": "^3.1001.0",
|
|
32
|
+
"@aws-sdk/client-ecr": "^3.750.0",
|
|
33
|
+
"@aws-sdk/client-iam": "^3.750.0",
|
|
34
|
+
"@aws-sdk/client-rds": "^3.750.0",
|
|
35
|
+
"@aws-sdk/client-route-53": "^3.1001.0",
|
|
36
|
+
"@aws-sdk/client-s3": "^3.750.0",
|
|
37
|
+
"@aws-sdk/client-ses": "^3.750.0",
|
|
38
|
+
"@aws-sdk/client-sts": "^3.750.0",
|
|
39
|
+
"@factiii/auth": "latest",
|
|
40
|
+
"@factiii/stack": "0.1.117",
|
|
41
|
+
"@octokit/rest": "^20.0.2",
|
|
42
|
+
"ansible-vault": "^1.3.0",
|
|
43
|
+
"commander": "^11.1.0",
|
|
44
|
+
"js-yaml": "^4.1.1",
|
|
45
|
+
"libsodium-wrappers": "^0.7.11"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/jest": "^30.0.0",
|
|
49
|
+
"@types/js-yaml": "^4.0.9",
|
|
50
|
+
"@types/node": "^25.0.3",
|
|
51
|
+
"jest": "^29.7.0",
|
|
52
|
+
"ts-jest": "^29.4.6",
|
|
53
|
+
"ts-node": "^10.9.2",
|
|
54
|
+
"typescript": "^5.9.3"
|
|
55
|
+
},
|
|
56
|
+
"jest": {
|
|
57
|
+
"preset": "ts-jest",
|
|
58
|
+
"testEnvironment": "node",
|
|
59
|
+
"testMatch": [
|
|
60
|
+
"**/test/**/*.test.ts"
|
|
61
|
+
],
|
|
62
|
+
"moduleNameMapper": {
|
|
63
|
+
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
64
|
+
},
|
|
65
|
+
"collectCoverageFrom": [
|
|
66
|
+
"src/**/*.ts",
|
|
67
|
+
"!**/node_modules/**"
|
|
68
|
+
],
|
|
69
|
+
"coverageThreshold": {
|
|
70
|
+
"global": {
|
|
71
|
+
"branches": 70,
|
|
72
|
+
"functions": 70,
|
|
73
|
+
"lines": 70,
|
|
74
|
+
"statements": 70
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=18.0.0"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"build": "tsc && npm run copy-assets",
|
|
83
|
+
"build:watch": "tsc --watch",
|
|
84
|
+
"clean": "node -e \"const fs=require('fs');if(fs.existsSync('dist'))fs.rmSync('dist',{recursive:true,force:true})\"",
|
|
85
|
+
"copy-assets": "node -e \"const fs=require('fs'),p=require('path');fs.cpSync('src/plugins/approved.json','dist/plugins/approved.json');const d='dist/plugins/pipelines/factiii/workflows';fs.mkdirSync(d,{recursive:true});for(const f of fs.readdirSync('src/plugins/pipelines/factiii/workflows').filter(f=>f.endsWith('.yml')))fs.cpSync(p.join('src/plugins/pipelines/factiii/workflows',f),p.join(d,f));const pd='dist/plugins/pipelines/aws/policies';fs.mkdirSync(pd,{recursive:true});for(const f of fs.readdirSync('src/plugins/pipelines/aws/policies').filter(f=>f.endsWith('.json')))fs.cpSync(p.join('src/plugins/pipelines/aws/policies',f),p.join(pd,f))\"",
|
|
86
|
+
"prebuild": "npm run clean",
|
|
87
|
+
"prepublish-check": "node -e \"const v=require('./package.json').version; if(v.includes('-d')){console.error('❌ Cannot publish dev version:',v); process.exit(1)}\"",
|
|
88
|
+
"test": "jest",
|
|
89
|
+
"test:watch": "jest --watch",
|
|
90
|
+
"test:coverage": "jest --coverage",
|
|
91
|
+
"typecheck": "tsc --noEmit"
|
|
92
|
+
}
|
|
93
|
+
}
|