@expressots/cli 3.0.0 → 4.0.0-preview.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.
- package/README.md +41 -95
- package/bin/cicd/cli.d.ts +6 -0
- package/bin/cicd/cli.js +126 -0
- package/bin/cicd/form.d.ts +29 -0
- package/bin/cicd/form.js +345 -0
- package/bin/cicd/generators/azure-devops.d.ts +2 -0
- package/bin/cicd/generators/azure-devops.js +370 -0
- package/bin/cicd/generators/bitbucket.d.ts +2 -0
- package/bin/cicd/generators/bitbucket.js +217 -0
- package/bin/cicd/generators/circleci.d.ts +2 -0
- package/bin/cicd/generators/circleci.js +274 -0
- package/bin/cicd/generators/github-actions.d.ts +14 -0
- package/bin/cicd/generators/github-actions.js +426 -0
- package/bin/cicd/generators/gitlab-ci.d.ts +2 -0
- package/bin/cicd/generators/gitlab-ci.js +237 -0
- package/bin/cicd/generators/index.d.ts +6 -0
- package/bin/cicd/generators/index.js +15 -0
- package/bin/cicd/generators/jenkins.d.ts +2 -0
- package/bin/cicd/generators/jenkins.js +248 -0
- package/bin/cicd/generators/template-loader.d.ts +17 -0
- package/bin/cicd/generators/template-loader.js +128 -0
- package/bin/cicd/index.d.ts +1 -0
- package/bin/cicd/index.js +5 -0
- package/bin/cli.d.ts +1 -1
- package/bin/cli.js +18 -3
- package/bin/commands/project.commands.d.ts +19 -6
- package/bin/commands/project.commands.js +390 -61
- package/bin/config/index.d.ts +5 -0
- package/bin/config/index.js +10 -0
- package/bin/config/manager.d.ts +98 -0
- package/bin/config/manager.js +222 -0
- package/bin/containerize/analyzers/bootstrap-analyzer.d.ts +46 -0
- package/bin/containerize/analyzers/bootstrap-analyzer.js +187 -0
- package/bin/containerize/analyzers/project-analyzer.d.ts +20 -0
- package/bin/containerize/analyzers/project-analyzer.js +150 -0
- package/bin/containerize/cli.d.ts +4 -0
- package/bin/containerize/cli.js +113 -0
- package/bin/containerize/form.d.ts +15 -0
- package/bin/containerize/form.js +154 -0
- package/bin/containerize/generators/ci-generator.d.ts +31 -0
- package/bin/containerize/generators/ci-generator.js +936 -0
- package/bin/containerize/generators/docker-compose-generator.d.ts +8 -0
- package/bin/containerize/generators/docker-compose-generator.js +186 -0
- package/bin/containerize/generators/dockerfile-generator.d.ts +8 -0
- package/bin/containerize/generators/dockerfile-generator.js +635 -0
- package/bin/containerize/generators/kubernetes-generator.d.ts +8 -0
- package/bin/containerize/generators/kubernetes-generator.js +133 -0
- package/bin/containerize/generators/template-loader.d.ts +36 -0
- package/bin/containerize/generators/template-loader.js +129 -0
- package/bin/containerize/index.d.ts +4 -0
- package/bin/containerize/index.js +13 -0
- package/bin/containerize/presets/preset-registry.d.ts +20 -0
- package/bin/containerize/presets/preset-registry.js +102 -0
- package/bin/costs/cli.d.ts +5 -0
- package/bin/costs/cli.js +183 -0
- package/bin/costs/form.d.ts +44 -0
- package/bin/costs/form.js +412 -0
- package/bin/costs/index.d.ts +4 -0
- package/bin/costs/index.js +25 -0
- package/bin/costs/pricing-manager.d.ts +84 -0
- package/bin/costs/pricing-manager.js +342 -0
- package/bin/costs/providers/index.d.ts +32 -0
- package/bin/costs/providers/index.js +153 -0
- package/bin/costs/sources/api-source.d.ts +10 -0
- package/bin/costs/sources/api-source.js +32 -0
- package/bin/costs/sources/index.d.ts +6 -0
- package/bin/costs/sources/index.js +15 -0
- package/bin/costs/sources/local-json-source.d.ts +23 -0
- package/bin/costs/sources/local-json-source.js +59 -0
- package/bin/costs/sources/remote-json-source.d.ts +11 -0
- package/bin/costs/sources/remote-json-source.js +53 -0
- package/bin/costs/types.d.ts +53 -0
- package/bin/costs/types.js +5 -0
- package/bin/dev/cli.d.ts +4 -0
- package/bin/dev/cli.js +134 -0
- package/bin/dev/form.d.ts +36 -0
- package/bin/dev/form.js +254 -0
- package/bin/dev/index.d.ts +1 -0
- package/bin/dev/index.js +5 -0
- package/bin/generate/cli.js +29 -2
- package/bin/generate/form.d.ts +5 -1
- package/bin/generate/form.js +3 -3
- package/bin/generate/templates/nonopinionated/config.tpl +12 -0
- package/bin/generate/templates/nonopinionated/event.tpl +10 -0
- package/bin/generate/templates/nonopinionated/guard.tpl +18 -0
- package/bin/generate/templates/nonopinionated/handler.tpl +12 -0
- package/bin/generate/templates/nonopinionated/interceptor.tpl +27 -0
- package/bin/generate/templates/opinionated/config.tpl +47 -0
- package/bin/generate/templates/opinionated/entity.tpl +1 -8
- package/bin/generate/templates/opinionated/event.tpl +15 -0
- package/bin/generate/templates/opinionated/guard.tpl +41 -0
- package/bin/generate/templates/opinionated/handler.tpl +23 -0
- package/bin/generate/templates/opinionated/interceptor.tpl +50 -0
- package/bin/generate/utils/command-utils.d.ts +7 -3
- package/bin/generate/utils/command-utils.js +95 -31
- package/bin/generate/utils/nonopininated-cmd.d.ts +10 -1
- package/bin/generate/utils/nonopininated-cmd.js +100 -1
- package/bin/generate/utils/opinionated-cmd.d.ts +10 -1
- package/bin/generate/utils/opinionated-cmd.js +112 -7
- package/bin/generate/utils/string-utils.d.ts +6 -0
- package/bin/generate/utils/string-utils.js +13 -1
- package/bin/help/form.js +11 -3
- package/bin/migrate/analyzers/platform-detector.d.ts +14 -0
- package/bin/migrate/analyzers/platform-detector.js +116 -0
- package/bin/migrate/cli.d.ts +6 -0
- package/bin/migrate/cli.js +96 -0
- package/bin/migrate/form.d.ts +25 -0
- package/bin/migrate/form.js +347 -0
- package/bin/migrate/generators/compose-to-k8s.d.ts +2 -0
- package/bin/migrate/generators/compose-to-k8s.js +324 -0
- package/bin/migrate/generators/compose-to-railway.d.ts +2 -0
- package/bin/migrate/generators/compose-to-railway.js +138 -0
- package/bin/migrate/generators/compose-to-render.d.ts +2 -0
- package/bin/migrate/generators/compose-to-render.js +148 -0
- package/bin/migrate/generators/generic-migration.d.ts +9 -0
- package/bin/migrate/generators/generic-migration.js +221 -0
- package/bin/migrate/generators/heroku-to-fly.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-fly.js +291 -0
- package/bin/migrate/generators/heroku-to-railway.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-railway.js +283 -0
- package/bin/migrate/generators/heroku-to-render.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-render.js +148 -0
- package/bin/migrate/generators/index.d.ts +7 -0
- package/bin/migrate/generators/index.js +17 -0
- package/bin/migrate/generators/template-loader.d.ts +21 -0
- package/bin/migrate/generators/template-loader.js +59 -0
- package/bin/migrate/index.d.ts +1 -0
- package/bin/migrate/index.js +5 -0
- package/bin/new/cli.js +21 -6
- package/bin/new/form.d.ts +25 -4
- package/bin/new/form.js +285 -70
- package/bin/profile/analyzers/dockerfile-analyzer.d.ts +27 -0
- package/bin/profile/analyzers/dockerfile-analyzer.js +122 -0
- package/bin/profile/analyzers/image-analyzer.d.ts +19 -0
- package/bin/profile/analyzers/image-analyzer.js +85 -0
- package/bin/profile/cli.d.ts +4 -0
- package/bin/profile/cli.js +92 -0
- package/bin/profile/form.d.ts +56 -0
- package/bin/profile/form.js +400 -0
- package/bin/profile/index.d.ts +1 -0
- package/bin/profile/index.js +5 -0
- package/bin/profile/optimizers/index.d.ts +19 -0
- package/bin/profile/optimizers/index.js +137 -0
- package/bin/providers/add/form.d.ts +1 -1
- package/bin/providers/add/form.js +27 -6
- package/bin/providers/create/form.js +2 -1
- package/bin/scripts/form.js +27 -5
- package/bin/studio/cli.d.ts +15 -0
- package/bin/studio/cli.js +166 -0
- package/bin/studio/index.d.ts +5 -0
- package/bin/studio/index.js +9 -0
- package/bin/templates/cache.d.ts +54 -0
- package/bin/templates/cache.js +180 -0
- package/bin/templates/cli.d.ts +8 -0
- package/bin/templates/cli.js +292 -0
- package/bin/templates/fetcher.d.ts +49 -0
- package/bin/templates/fetcher.js +208 -0
- package/bin/templates/index.d.ts +11 -0
- package/bin/templates/index.js +37 -0
- package/bin/templates/manager.d.ts +116 -0
- package/bin/templates/manager.js +323 -0
- package/bin/templates/renderer.d.ts +49 -0
- package/bin/templates/renderer.js +204 -0
- package/bin/templates/types.d.ts +51 -0
- package/bin/templates/types.js +5 -0
- package/bin/utils/add-module-to-container.d.ts +2 -2
- package/bin/utils/add-module-to-container.js +15 -5
- package/bin/utils/cli-ui.d.ts +30 -3
- package/bin/utils/cli-ui.js +95 -13
- package/bin/utils/index.d.ts +4 -0
- package/bin/utils/index.js +4 -0
- package/bin/utils/input-validation.d.ts +50 -0
- package/bin/utils/input-validation.js +143 -0
- package/bin/utils/package-manager-commands.d.ts +24 -0
- package/bin/utils/package-manager-commands.js +50 -0
- package/bin/utils/safe-spawn.d.ts +35 -0
- package/bin/utils/safe-spawn.js +51 -0
- package/bin/utils/update-tsconfig-paths.d.ts +35 -0
- package/bin/utils/update-tsconfig-paths.js +286 -0
- package/package.json +154 -154
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateHerokuToRender = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const template_loader_1 = require("./template-loader");
|
|
11
|
+
async function generateHerokuToRender(outputDir, options) {
|
|
12
|
+
console.log(chalk_1.default.yellow(" Generating Heroku → Render migration..."));
|
|
13
|
+
const vars = (0, template_loader_1.buildMigrationVars)(options);
|
|
14
|
+
// Generate render.yaml
|
|
15
|
+
const renderConfig = `# Render Blueprint
|
|
16
|
+
# Generated by ExpressoTS CLI
|
|
17
|
+
|
|
18
|
+
services:
|
|
19
|
+
- type: web
|
|
20
|
+
name: expressots-app
|
|
21
|
+
env: node
|
|
22
|
+
region: oregon
|
|
23
|
+
plan: starter
|
|
24
|
+
buildCommand: npm install && npm run build
|
|
25
|
+
startCommand: npm start
|
|
26
|
+
healthCheckPath: /health
|
|
27
|
+
envVars:
|
|
28
|
+
- key: NODE_ENV
|
|
29
|
+
value: production
|
|
30
|
+
- key: PORT
|
|
31
|
+
value: 3000
|
|
32
|
+
# Add your environment variables below
|
|
33
|
+
# - key: DATABASE_URL
|
|
34
|
+
# fromDatabase:
|
|
35
|
+
# name: expressots-db
|
|
36
|
+
# property: connectionString
|
|
37
|
+
|
|
38
|
+
# Uncomment to add a PostgreSQL database
|
|
39
|
+
# databases:
|
|
40
|
+
# - name: expressots-db
|
|
41
|
+
# plan: starter
|
|
42
|
+
# databaseName: expressots
|
|
43
|
+
# user: expressots
|
|
44
|
+
`;
|
|
45
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "render.yaml"), renderConfig, "utf-8");
|
|
46
|
+
console.log(chalk_1.default.green(" ✓ Created render.yaml"));
|
|
47
|
+
// Generate migration checklist
|
|
48
|
+
const checklist = generateRenderChecklist();
|
|
49
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "MIGRATION_CHECKLIST.md"), checklist, "utf-8");
|
|
50
|
+
console.log(chalk_1.default.green(" ✓ Created MIGRATION_CHECKLIST.md"));
|
|
51
|
+
// Generate environment mapping
|
|
52
|
+
if (options.includeSecrets) {
|
|
53
|
+
const envMapping = generateRenderEnvMapping();
|
|
54
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "env-mapping.md"), envMapping, "utf-8");
|
|
55
|
+
console.log(chalk_1.default.green(" ✓ Created env-mapping.md"));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.generateHerokuToRender = generateHerokuToRender;
|
|
59
|
+
function generateRenderChecklist() {
|
|
60
|
+
return `# Migration Checklist: Heroku → Render
|
|
61
|
+
|
|
62
|
+
## Pre-Migration
|
|
63
|
+
|
|
64
|
+
- [ ] Export Heroku environment variables
|
|
65
|
+
- [ ] Backup database
|
|
66
|
+
- [ ] Document Heroku add-ons
|
|
67
|
+
|
|
68
|
+
## Render Setup
|
|
69
|
+
|
|
70
|
+
- [ ] Create Render account at https://render.com
|
|
71
|
+
- [ ] Copy \`render.yaml\` to project root
|
|
72
|
+
- [ ] Connect GitHub/GitLab repository
|
|
73
|
+
|
|
74
|
+
## Deployment Options
|
|
75
|
+
|
|
76
|
+
### Option 1: Blueprint (Recommended)
|
|
77
|
+
- [ ] Push \`render.yaml\` to repository
|
|
78
|
+
- [ ] In Render dashboard, click "New" → "Blueprint"
|
|
79
|
+
- [ ] Select your repository
|
|
80
|
+
- [ ] Render will create all services defined in render.yaml
|
|
81
|
+
|
|
82
|
+
### Option 2: Manual Setup
|
|
83
|
+
- [ ] Create Web Service in Render dashboard
|
|
84
|
+
- [ ] Connect repository
|
|
85
|
+
- [ ] Configure build and start commands
|
|
86
|
+
- [ ] Set environment variables
|
|
87
|
+
|
|
88
|
+
## Database Migration
|
|
89
|
+
|
|
90
|
+
- [ ] Create PostgreSQL in Render
|
|
91
|
+
- [ ] Export Heroku database: \`heroku pg:backups:capture\`
|
|
92
|
+
- [ ] Download backup: \`heroku pg:backups:download\`
|
|
93
|
+
- [ ] Import to Render PostgreSQL
|
|
94
|
+
|
|
95
|
+
## Environment Variables
|
|
96
|
+
|
|
97
|
+
- [ ] Set all required environment variables in Render dashboard
|
|
98
|
+
- [ ] Configure \`DATABASE_URL\` from Render PostgreSQL
|
|
99
|
+
|
|
100
|
+
## Custom Domain
|
|
101
|
+
|
|
102
|
+
- [ ] Add custom domain in Render
|
|
103
|
+
- [ ] Update DNS records (CNAME to *.onrender.com)
|
|
104
|
+
- [ ] Wait for SSL certificate provisioning
|
|
105
|
+
|
|
106
|
+
## Post-Migration
|
|
107
|
+
|
|
108
|
+
- [ ] Verify all endpoints work
|
|
109
|
+
- [ ] Monitor logs in Render dashboard
|
|
110
|
+
- [ ] Disable Heroku app after verification
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
function generateRenderEnvMapping() {
|
|
114
|
+
return `# Environment Variable Mapping: Heroku → Render
|
|
115
|
+
|
|
116
|
+
## Automatic Variables
|
|
117
|
+
|
|
118
|
+
| Heroku | Render | Notes |
|
|
119
|
+
|--------|--------|-------|
|
|
120
|
+
| \`PORT\` | \`PORT\` | Render sets this automatically |
|
|
121
|
+
| \`DATABASE_URL\` | \`DATABASE_URL\` | Use fromDatabase in render.yaml |
|
|
122
|
+
|
|
123
|
+
## Manual Configuration
|
|
124
|
+
|
|
125
|
+
Set these in Render dashboard or render.yaml:
|
|
126
|
+
|
|
127
|
+
\`\`\`yaml
|
|
128
|
+
envVars:
|
|
129
|
+
- key: NODE_ENV
|
|
130
|
+
value: production
|
|
131
|
+
- key: API_KEY
|
|
132
|
+
sync: false # Prompt during deploy
|
|
133
|
+
- key: DATABASE_URL
|
|
134
|
+
fromDatabase:
|
|
135
|
+
name: your-db
|
|
136
|
+
property: connectionString
|
|
137
|
+
\`\`\`
|
|
138
|
+
|
|
139
|
+
## Heroku Add-on Equivalents
|
|
140
|
+
|
|
141
|
+
| Heroku Add-on | Render Alternative |
|
|
142
|
+
|---------------|-------------------|
|
|
143
|
+
| Heroku Postgres | Render PostgreSQL |
|
|
144
|
+
| Heroku Redis | Render Redis |
|
|
145
|
+
| Papertrail | Render Logs (built-in) |
|
|
146
|
+
| SendGrid | External service |
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { generateHerokuToRailway } from "./heroku-to-railway";
|
|
2
|
+
export { generateHerokuToRender } from "./heroku-to-render";
|
|
3
|
+
export { generateHerokuToFly } from "./heroku-to-fly";
|
|
4
|
+
export { generateComposeToK8s } from "./compose-to-k8s";
|
|
5
|
+
export { generateComposeToRailway } from "./compose-to-railway";
|
|
6
|
+
export { generateComposeToRender } from "./compose-to-render";
|
|
7
|
+
export { generateGenericMigration } from "./generic-migration";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateGenericMigration = exports.generateComposeToRender = exports.generateComposeToRailway = exports.generateComposeToK8s = exports.generateHerokuToFly = exports.generateHerokuToRender = exports.generateHerokuToRailway = void 0;
|
|
4
|
+
var heroku_to_railway_1 = require("./heroku-to-railway");
|
|
5
|
+
Object.defineProperty(exports, "generateHerokuToRailway", { enumerable: true, get: function () { return heroku_to_railway_1.generateHerokuToRailway; } });
|
|
6
|
+
var heroku_to_render_1 = require("./heroku-to-render");
|
|
7
|
+
Object.defineProperty(exports, "generateHerokuToRender", { enumerable: true, get: function () { return heroku_to_render_1.generateHerokuToRender; } });
|
|
8
|
+
var heroku_to_fly_1 = require("./heroku-to-fly");
|
|
9
|
+
Object.defineProperty(exports, "generateHerokuToFly", { enumerable: true, get: function () { return heroku_to_fly_1.generateHerokuToFly; } });
|
|
10
|
+
var compose_to_k8s_1 = require("./compose-to-k8s");
|
|
11
|
+
Object.defineProperty(exports, "generateComposeToK8s", { enumerable: true, get: function () { return compose_to_k8s_1.generateComposeToK8s; } });
|
|
12
|
+
var compose_to_railway_1 = require("./compose-to-railway");
|
|
13
|
+
Object.defineProperty(exports, "generateComposeToRailway", { enumerable: true, get: function () { return compose_to_railway_1.generateComposeToRailway; } });
|
|
14
|
+
var compose_to_render_1 = require("./compose-to-render");
|
|
15
|
+
Object.defineProperty(exports, "generateComposeToRender", { enumerable: true, get: function () { return compose_to_render_1.generateComposeToRender; } });
|
|
16
|
+
var generic_migration_1 = require("./generic-migration");
|
|
17
|
+
Object.defineProperty(exports, "generateGenericMigration", { enumerable: true, get: function () { return generic_migration_1.generateGenericMigration; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template loader for migration generators
|
|
3
|
+
* Handles remote template fetching with fallback to embedded templates
|
|
4
|
+
*/
|
|
5
|
+
import type { MigrationOptions } from "../form";
|
|
6
|
+
export interface TemplateResult {
|
|
7
|
+
content: string;
|
|
8
|
+
source: "remote" | "embedded";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Load migration template with fallback
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadMigrationTemplate(from: string, to: string, file: string, variables: Record<string, unknown>, embeddedGenerator: () => string): Promise<TemplateResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Build migration template variables
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildMigrationVars(options: MigrationOptions): Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Log template source for debugging
|
|
20
|
+
*/
|
|
21
|
+
export declare function logTemplateSource(templateName: string, source: "remote" | "embedded"): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Template loader for migration generators
|
|
4
|
+
* Handles remote template fetching with fallback to embedded templates
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.logTemplateSource = exports.buildMigrationVars = exports.loadMigrationTemplate = void 0;
|
|
8
|
+
const templates_1 = require("../../templates");
|
|
9
|
+
/**
|
|
10
|
+
* Load migration template with fallback
|
|
11
|
+
*/
|
|
12
|
+
async function loadMigrationTemplate(from, to, file, variables, embeddedGenerator) {
|
|
13
|
+
const manager = (0, templates_1.getTemplateManager)();
|
|
14
|
+
try {
|
|
15
|
+
// Try to fetch from remote template repository
|
|
16
|
+
const result = await manager.fetchMigrationTemplate(from, to, file);
|
|
17
|
+
if (result.data) {
|
|
18
|
+
// Template found, render with variables
|
|
19
|
+
const renderOptions = {
|
|
20
|
+
variables: variables,
|
|
21
|
+
};
|
|
22
|
+
const rendered = manager.render(result.data, renderOptions);
|
|
23
|
+
return { content: rendered, source: "remote" };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// Remote fetch failed, fall back to embedded
|
|
28
|
+
}
|
|
29
|
+
// Fall back to embedded template generator
|
|
30
|
+
return {
|
|
31
|
+
content: embeddedGenerator(),
|
|
32
|
+
source: "embedded",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.loadMigrationTemplate = loadMigrationTemplate;
|
|
36
|
+
/**
|
|
37
|
+
* Build migration template variables
|
|
38
|
+
*/
|
|
39
|
+
function buildMigrationVars(options) {
|
|
40
|
+
return {
|
|
41
|
+
from: options.from,
|
|
42
|
+
to: options.to,
|
|
43
|
+
includeSecrets: options.includeSecrets,
|
|
44
|
+
includeData: options.includeData,
|
|
45
|
+
dryRun: options.dryRun,
|
|
46
|
+
outputDir: options.outputDir,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.buildMigrationVars = buildMigrationVars;
|
|
50
|
+
/**
|
|
51
|
+
* Log template source for debugging
|
|
52
|
+
*/
|
|
53
|
+
function logTemplateSource(templateName, source) {
|
|
54
|
+
if (process.env.EXPRESSOTS_DEBUG) {
|
|
55
|
+
const sourceLabel = source === "remote" ? "remote template" : "embedded template";
|
|
56
|
+
console.log(` [DEBUG] ${templateName}: Using ${sourceLabel}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.logTemplateSource = logTemplateSource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { migrateCommand } from "./cli";
|
package/bin/new/cli.js
CHANGED
|
@@ -14,6 +14,13 @@ const packageManagers = [
|
|
|
14
14
|
"pnpm",
|
|
15
15
|
...(process.platform !== "win32" ? ["bun"] : []),
|
|
16
16
|
];
|
|
17
|
+
const middlewarePresets = [
|
|
18
|
+
"api",
|
|
19
|
+
"web",
|
|
20
|
+
"graphql",
|
|
21
|
+
"microservice",
|
|
22
|
+
"minimal",
|
|
23
|
+
];
|
|
17
24
|
const commandOptions = (yargs) => {
|
|
18
25
|
return yargs
|
|
19
26
|
.positional("project-name", {
|
|
@@ -23,7 +30,7 @@ const commandOptions = (yargs) => {
|
|
|
23
30
|
.option("template", {
|
|
24
31
|
describe: "The project template to use",
|
|
25
32
|
type: "string",
|
|
26
|
-
choices: ["
|
|
33
|
+
choices: ["application", "micro"],
|
|
27
34
|
alias: "t",
|
|
28
35
|
})
|
|
29
36
|
.option("package-manager", {
|
|
@@ -31,6 +38,12 @@ const commandOptions = (yargs) => {
|
|
|
31
38
|
type: "string",
|
|
32
39
|
choices: packageManagers,
|
|
33
40
|
alias: "p",
|
|
41
|
+
})
|
|
42
|
+
.option("preset", {
|
|
43
|
+
describe: "Middleware preset for Application template",
|
|
44
|
+
type: "string",
|
|
45
|
+
choices: middlewarePresets,
|
|
46
|
+
alias: "s",
|
|
34
47
|
})
|
|
35
48
|
.option("directory", {
|
|
36
49
|
describe: "The directory for new project",
|
|
@@ -38,14 +51,15 @@ const commandOptions = (yargs) => {
|
|
|
38
51
|
alias: "d",
|
|
39
52
|
})
|
|
40
53
|
.implies("package-manager", "template")
|
|
41
|
-
.implies("template", "package-manager")
|
|
54
|
+
.implies("template", "package-manager")
|
|
55
|
+
.implies("preset", "template");
|
|
42
56
|
};
|
|
43
57
|
const checkNodeVersion = () => {
|
|
44
|
-
const minVersion = "
|
|
45
|
-
const maxVersion = "
|
|
58
|
+
const minVersion = "20.0.0";
|
|
59
|
+
const maxVersion = "24.0.0";
|
|
46
60
|
const currentVersion = process.version;
|
|
47
61
|
if (!semver_1.default.satisfies(currentVersion, `>=${minVersion} <=${maxVersion}`)) {
|
|
48
|
-
const msg = `Node.js version [${chalk_1.default.bold(chalk_1.default.white(currentVersion))}] is not tested.
|
|
62
|
+
const msg = `Node.js version [${chalk_1.default.bold(chalk_1.default.white(currentVersion))}] is not fully tested. Recommended: v20.x or v22.x LTS.`;
|
|
49
63
|
(0, cli_ui_1.printWarning)(msg);
|
|
50
64
|
}
|
|
51
65
|
};
|
|
@@ -54,12 +68,13 @@ const createProject = () => {
|
|
|
54
68
|
command: "new <project-name> [package-manager] [template] [directory]",
|
|
55
69
|
describe: "Create ExpressoTS application.",
|
|
56
70
|
builder: commandOptions,
|
|
57
|
-
handler: async ({ projectName, packageManager, template, directory, }) => {
|
|
71
|
+
handler: async ({ projectName, packageManager, template, directory, preset, }) => {
|
|
58
72
|
checkNodeVersion();
|
|
59
73
|
return await (0, form_1.projectForm)(projectName, [
|
|
60
74
|
packageManager,
|
|
61
75
|
template,
|
|
62
76
|
directory,
|
|
77
|
+
preset,
|
|
63
78
|
]);
|
|
64
79
|
},
|
|
65
80
|
};
|
package/bin/new/form.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template definitions for v4.0
|
|
3
|
+
*/
|
|
1
4
|
declare enum Template {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
micro = "Micro :: A minimalistic template for building micro api's."
|
|
5
|
+
application = "Application :: Full-featured ExpressoTS application. (Recommended)",
|
|
6
|
+
micro = "Micro :: A minimalistic template for building micro APIs and serverless functions."
|
|
5
7
|
}
|
|
6
8
|
declare const enum PackageManager {
|
|
7
9
|
npm = "npm",
|
|
@@ -9,7 +11,26 @@ declare const enum PackageManager {
|
|
|
9
11
|
pnpm = "pnpm",
|
|
10
12
|
bun = "bun"
|
|
11
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Middleware presets for Application template
|
|
16
|
+
*/
|
|
17
|
+
declare enum MiddlewarePreset {
|
|
18
|
+
api = "API :: REST API with security, compression, and auto-logging. (Recommended)",
|
|
19
|
+
web = "Web :: Full web app with cookies and session support.",
|
|
20
|
+
graphql = "GraphQL :: Optimized for GraphQL APIs.",
|
|
21
|
+
microservice = "Microservice :: Minimal setup for microservices.",
|
|
22
|
+
minimal = "Minimal :: Just request parsing, customize everything yourself."
|
|
23
|
+
}
|
|
12
24
|
type TemplateKeys = keyof typeof Template;
|
|
13
|
-
type
|
|
25
|
+
type MiddlewarePresetKeys = keyof typeof MiddlewarePreset;
|
|
26
|
+
type ProjectFormArgs = [
|
|
27
|
+
PackageManager,
|
|
28
|
+
TemplateKeys,
|
|
29
|
+
string,
|
|
30
|
+
MiddlewarePresetKeys
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Main project creation form
|
|
34
|
+
*/
|
|
14
35
|
declare const projectForm: (projectName: string, args: ProjectFormArgs) => Promise<void>;
|
|
15
36
|
export { projectForm };
|