deploy-stack 0.17.1 → 0.17.2
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.
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Headless Mode & Automation Guide
|
|
2
|
+
|
|
3
|
+
The `deploy-stack` CLI is designed to be fully automatable for CI/CD pipelines, custom scripts, and framework plugins (like `vite-plugin-deploy-stack`).
|
|
4
|
+
|
|
5
|
+
By passing the `--headless` flag, you bypass all interactive terminal prompts.
|
|
6
|
+
|
|
7
|
+
## Required Flags
|
|
8
|
+
To use headless mode, simply include the `--headless` flag.
|
|
9
|
+
|
|
10
|
+
If `deploy-stack` cannot auto-detect your framework, you should also provide the `--framework` flag to ensure the correct infrastructure is generated.
|
|
11
|
+
|
|
12
|
+
* **Valid `--framework` options:** `node`, `nextjs`, `nuxt`, `python`, `django`, `rails`, `go`, `static`
|
|
13
|
+
|
|
14
|
+
## Optional Configuration Flags
|
|
15
|
+
|
|
16
|
+
You can append any of these flags to customize the generated architecture. These map exactly to the options available in the interactive setup:
|
|
17
|
+
|
|
18
|
+
| Flag | Description | Default |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `--region=<region>` | The AWS region to deploy to (e.g., `us-east-1`, `eu-west-1`). | `us-east-2` |
|
|
21
|
+
| `--size=<size>` | The Fargate compute size (`micro` or `small`). | `micro` |
|
|
22
|
+
| `--port=<number>` | The internal port your container exposes. | Framework dependent (`3000`, `8080`, `8000`) |
|
|
23
|
+
| `--healthCheckPath=<path>`| The ALB health check endpoint path. | `/` |
|
|
24
|
+
| `--desiredCount=<number>` | Number of container replicas to run (`1` or `2`). | `1` |
|
|
25
|
+
| `--branch=<name>` | The primary Git deployment branch for CI/CD. | `main` |
|
|
26
|
+
| `--dir=<path>` | The directory to generate files into (use `.` for current).| `.` |
|
|
27
|
+
| `--enablePrPreviews` | Generates workflows for Ephemeral PR Previews. | `false` |
|
|
28
|
+
| `--yes` | Automatically bypasses confirmation prompts during apply/destroy. | `false` |
|
|
29
|
+
| `--no-telemetry` | Disables anonymous usage analytics. | `false` |
|
|
30
|
+
|
|
31
|
+
## Example Usage
|
|
32
|
+
|
|
33
|
+
**Standard Static Site Automation (e.g., Vite/React):**
|
|
34
|
+
```bash
|
|
35
|
+
npx deploy-stack --headless --framework=static --region=eu-west-1 --size=micro
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Next.js High-Availability CI/CD Generation:**
|
|
39
|
+
```bash
|
|
40
|
+
npx deploy-stack --headless --framework=nextjs --size=small --desiredCount=2 --yes
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Node.js Backend with PR Previews:**
|
|
44
|
+
```bash
|
|
45
|
+
npx deploy-stack --headless --framework=node --port=4000 --enablePrPreviews
|
|
46
|
+
```
|
package/package.json
CHANGED
package/src/utils/detector.js
CHANGED
|
@@ -21,6 +21,9 @@ export function detectFramework(targetDir) {
|
|
|
21
21
|
if (deps['nuxt']) return { id: 'nuxt', name: 'Nuxt 3 (SSR)' };
|
|
22
22
|
if (deps['express']) return { id: 'node', name: 'Node.js / Express' };
|
|
23
23
|
|
|
24
|
+
// Explicit SvelteKit SSR Detection
|
|
25
|
+
if (deps['@sveltejs/kit']) return { id: 'svelte', name: 'SvelteKit SSR', buildDir: 'build' };
|
|
26
|
+
|
|
24
27
|
// Static Site Generators & SPAs (with precise build directories)
|
|
25
28
|
if (deps['@sveltejs/kit']) return { id: 'static', name: 'SvelteKit', buildDir: 'build' };
|
|
26
29
|
if (deps['react-scripts']) return { id: 'static', name: 'Create React App', buildDir: 'build' };
|
package/src/utils/prompts.js
CHANGED
|
@@ -60,6 +60,7 @@ export async function getProjectConfig(isHeadless, headlessOptions, targetDir, d
|
|
|
60
60
|
{ value: 'node', label: 'Node.js / Express' },
|
|
61
61
|
{ value: 'nextjs', label: 'Next.js (Standalone)' },
|
|
62
62
|
{ value: 'nuxt', label: 'Nuxt 3 (SSR)' },
|
|
63
|
+
{ value: 'svelte', label: 'SvelteKit (SSR)' },
|
|
63
64
|
{ value: 'python', label: 'Python FastAPI' },
|
|
64
65
|
{ value: 'django', label: 'Django (Python)' },
|
|
65
66
|
{ value: 'rails', label: 'Ruby on Rails' },
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
FROM node:22-alpine
|
|
2
|
+
|
|
3
|
+
# 1. DevSecOps: Patch underlying Alpine OS vulnerabilities
|
|
4
|
+
RUN apk update && apk upgrade --no-cache
|
|
5
|
+
|
|
6
|
+
# 2. Set production environment
|
|
7
|
+
ENV NODE_ENV=production
|
|
8
|
+
WORKDIR /app
|
|
9
|
+
|
|
10
|
+
# 3. Copy manifests and install ONLY production dependencies
|
|
11
|
+
COPY --chown=node:node package*.json ./
|
|
12
|
+
RUN npm ci --omit=dev && npm cache clean --force
|
|
13
|
+
|
|
14
|
+
# 4. Copy the compiled SvelteKit server generated by adapter-node
|
|
15
|
+
COPY --chown=node:node build/ ./build/
|
|
16
|
+
COPY --chown=node:node package.json ./
|
|
17
|
+
|
|
18
|
+
# 5. DevSecOps: Remove NPM to eliminate Trivy vulnerabilities
|
|
19
|
+
RUN rm -rf /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx
|
|
20
|
+
|
|
21
|
+
USER node
|
|
22
|
+
EXPOSE {{PORT}}
|
|
23
|
+
|
|
24
|
+
# 6. Execute the raw Node server directly (Bypassing NPM)
|
|
25
|
+
CMD ["node", "build/index.js"]
|