create-skweb 3.3.0 → 3.3.1
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/.rollup.cache/Users/stayknight/projects/skweb-mono/tools/create-skweb/dist/index.js +7 -38
- package/.rollup.cache/Users/stayknight/projects/skweb-mono/tools/create-skweb/tsconfig.tsbuildinfo +1 -1
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +6 -0
- package/dist/cli.js +7 -38
- package/dist/index.js +7 -38
- package/package.json +1 -1
- package/src/index.ts +8 -39
- package/templates/cjs/src/cron-app.js +3 -3
- package/templates/mjs/src/cron-app.js +3 -3
- package/templates/ts/src/cron-app.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
package/dist/cli.js
CHANGED
|
@@ -36,10 +36,6 @@ async function createProject(options) {
|
|
|
36
36
|
if (/\.auth-(static|jwks)(\.[^.]+)?$/.test(fileName)) {
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
|
-
// 跳过无 auth 后缀的 .env.example(改用条件模板)
|
|
40
|
-
if (fileName === '.env.example' || fileName.endsWith('/.env.example')) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
39
|
const outputName = fileName;
|
|
44
40
|
let content = await fs.readFile(srcPath, 'utf-8');
|
|
45
41
|
// 处理条件块:{{#if_eq auth "static"}}...{{else}}...{{/if_eq}}
|
|
@@ -50,6 +46,8 @@ async function createProject(options) {
|
|
|
50
46
|
.replace(/\{\{name\}\}/g, name)
|
|
51
47
|
.replace(/\{\{description\}\}/g, description)
|
|
52
48
|
.replace(/\{\{auth\}\}/g, auth);
|
|
49
|
+
// 移除 ts-nocheck 标记
|
|
50
|
+
content = content.replace(/^\/\/ @ts-nocheck\s*\n/gm, '');
|
|
53
51
|
const destPath = path.join(targetDir, outputName);
|
|
54
52
|
await fs.writeFile(destPath, content);
|
|
55
53
|
}
|
|
@@ -83,44 +81,15 @@ function printBanner() {
|
|
|
83
81
|
function printSuccess(name, dest) {
|
|
84
82
|
const projectPath = path.join(path.resolve(dest), name);
|
|
85
83
|
console.log(`
|
|
86
|
-
|
|
87
|
-
║ 项目创建成功! ║
|
|
88
|
-
╚════════════════════════════════════════════════════════════════════╝
|
|
89
|
-
|
|
90
|
-
项目名称: ${name}
|
|
91
|
-
项目路径: ${projectPath}
|
|
84
|
+
项目创建成功!
|
|
92
85
|
|
|
93
|
-
|
|
86
|
+
名称: ${name}
|
|
87
|
+
路径: ${projectPath}
|
|
94
88
|
|
|
89
|
+
接下来执行:
|
|
95
90
|
cd ${name}
|
|
96
|
-
|
|
97
|
-
# 复制环境变量模板并按需修改
|
|
98
91
|
cp .env.example .env
|
|
99
|
-
|
|
100
|
-
# 开发模式运行
|
|
101
|
-
npm run start:dev
|
|
102
|
-
|
|
103
|
-
# 生产模式运行 (需要先构建)
|
|
104
|
-
npm run build
|
|
105
|
-
npm run start
|
|
106
|
-
|
|
107
|
-
# 查看日志
|
|
108
|
-
npm run logs
|
|
109
|
-
|
|
110
|
-
# 停止服务
|
|
111
|
-
npm run stop
|
|
112
|
-
|
|
113
|
-
# 重启服务
|
|
114
|
-
npm run restart
|
|
115
|
-
|
|
116
|
-
项目特性:
|
|
117
|
-
✅ TypeScript/MJS/CJS 支持
|
|
118
|
-
✅ @dotenvx/dotenvx 环境变量管理
|
|
119
|
-
✅ PM2 进程管理
|
|
120
|
-
✅ SKWeb Express 集成
|
|
121
|
-
✅ Keycloak/JWKS 鉴权 (可选)
|
|
122
|
-
✅ ESLint 代码检查
|
|
123
|
-
✅ Mocha 测试框架
|
|
92
|
+
npm run web:dev
|
|
124
93
|
`);
|
|
125
94
|
}
|
|
126
95
|
|
package/dist/index.js
CHANGED
|
@@ -31,10 +31,6 @@ async function createProject(options) {
|
|
|
31
31
|
if (/\.auth-(static|jwks)(\.[^.]+)?$/.test(fileName)) {
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
|
-
// 跳过无 auth 后缀的 .env.example(改用条件模板)
|
|
35
|
-
if (fileName === '.env.example' || fileName.endsWith('/.env.example')) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
34
|
const outputName = fileName;
|
|
39
35
|
let content = await fs.readFile(srcPath, 'utf-8');
|
|
40
36
|
// 处理条件块:{{#if_eq auth "static"}}...{{else}}...{{/if_eq}}
|
|
@@ -45,6 +41,8 @@ async function createProject(options) {
|
|
|
45
41
|
.replace(/\{\{name\}\}/g, name)
|
|
46
42
|
.replace(/\{\{description\}\}/g, description)
|
|
47
43
|
.replace(/\{\{auth\}\}/g, auth);
|
|
44
|
+
// 移除 ts-nocheck 标记
|
|
45
|
+
content = content.replace(/^\/\/ @ts-nocheck\s*\n/gm, '');
|
|
48
46
|
const destPath = path.join(targetDir, outputName);
|
|
49
47
|
await fs.writeFile(destPath, content);
|
|
50
48
|
}
|
|
@@ -78,44 +76,15 @@ function printBanner() {
|
|
|
78
76
|
function printSuccess(name, dest) {
|
|
79
77
|
const projectPath = path.join(path.resolve(dest), name);
|
|
80
78
|
console.log(`
|
|
81
|
-
|
|
82
|
-
║ 项目创建成功! ║
|
|
83
|
-
╚════════════════════════════════════════════════════════════════════╝
|
|
84
|
-
|
|
85
|
-
项目名称: ${name}
|
|
86
|
-
项目路径: ${projectPath}
|
|
79
|
+
项目创建成功!
|
|
87
80
|
|
|
88
|
-
|
|
81
|
+
名称: ${name}
|
|
82
|
+
路径: ${projectPath}
|
|
89
83
|
|
|
84
|
+
接下来执行:
|
|
90
85
|
cd ${name}
|
|
91
|
-
|
|
92
|
-
# 复制环境变量模板并按需修改
|
|
93
86
|
cp .env.example .env
|
|
94
|
-
|
|
95
|
-
# 开发模式运行
|
|
96
|
-
npm run start:dev
|
|
97
|
-
|
|
98
|
-
# 生产模式运行 (需要先构建)
|
|
99
|
-
npm run build
|
|
100
|
-
npm run start
|
|
101
|
-
|
|
102
|
-
# 查看日志
|
|
103
|
-
npm run logs
|
|
104
|
-
|
|
105
|
-
# 停止服务
|
|
106
|
-
npm run stop
|
|
107
|
-
|
|
108
|
-
# 重启服务
|
|
109
|
-
npm run restart
|
|
110
|
-
|
|
111
|
-
项目特性:
|
|
112
|
-
✅ TypeScript/MJS/CJS 支持
|
|
113
|
-
✅ @dotenvx/dotenvx 环境变量管理
|
|
114
|
-
✅ PM2 进程管理
|
|
115
|
-
✅ SKWeb Express 集成
|
|
116
|
-
✅ Keycloak/JWKS 鉴权 (可选)
|
|
117
|
-
✅ ESLint 代码检查
|
|
118
|
-
✅ Mocha 测试框架
|
|
87
|
+
npm run web:dev
|
|
119
88
|
`);
|
|
120
89
|
}
|
|
121
90
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -47,11 +47,6 @@ export async function createProject(options: CreateOptions): Promise<void> {
|
|
|
47
47
|
continue
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// 跳过无 auth 后缀的 .env.example(改用条件模板)
|
|
51
|
-
if (fileName === '.env.example' || fileName.endsWith('/.env.example')) {
|
|
52
|
-
continue
|
|
53
|
-
}
|
|
54
|
-
|
|
55
50
|
const outputName = fileName
|
|
56
51
|
|
|
57
52
|
let content = await fs.readFile(srcPath, 'utf-8')
|
|
@@ -69,6 +64,9 @@ export async function createProject(options: CreateOptions): Promise<void> {
|
|
|
69
64
|
.replace(/\{\{description\}\}/g, description)
|
|
70
65
|
.replace(/\{\{auth\}\}/g, auth)
|
|
71
66
|
|
|
67
|
+
// 移除 ts-nocheck 标记
|
|
68
|
+
content = content.replace(/^\/\/ @ts-nocheck\s*\n/gm, '')
|
|
69
|
+
|
|
72
70
|
const destPath = path.join(targetDir, outputName)
|
|
73
71
|
await fs.writeFile(destPath, content)
|
|
74
72
|
}
|
|
@@ -110,43 +108,14 @@ export function printBanner(): void {
|
|
|
110
108
|
export function printSuccess(name: string, dest: string): void {
|
|
111
109
|
const projectPath = path.join(path.resolve(dest), name)
|
|
112
110
|
console.log(`
|
|
113
|
-
|
|
114
|
-
║ 项目创建成功! ║
|
|
115
|
-
╚════════════════════════════════════════════════════════════════════╝
|
|
116
|
-
|
|
117
|
-
项目名称: ${name}
|
|
118
|
-
项目路径: ${projectPath}
|
|
111
|
+
项目创建成功!
|
|
119
112
|
|
|
120
|
-
|
|
113
|
+
名称: ${name}
|
|
114
|
+
路径: ${projectPath}
|
|
121
115
|
|
|
116
|
+
接下来执行:
|
|
122
117
|
cd ${name}
|
|
123
|
-
|
|
124
|
-
# 复制环境变量模板并按需修改
|
|
125
118
|
cp .env.example .env
|
|
126
|
-
|
|
127
|
-
# 开发模式运行
|
|
128
|
-
npm run start:dev
|
|
129
|
-
|
|
130
|
-
# 生产模式运行 (需要先构建)
|
|
131
|
-
npm run build
|
|
132
|
-
npm run start
|
|
133
|
-
|
|
134
|
-
# 查看日志
|
|
135
|
-
npm run logs
|
|
136
|
-
|
|
137
|
-
# 停止服务
|
|
138
|
-
npm run stop
|
|
139
|
-
|
|
140
|
-
# 重启服务
|
|
141
|
-
npm run restart
|
|
142
|
-
|
|
143
|
-
项目特性:
|
|
144
|
-
✅ TypeScript/MJS/CJS 支持
|
|
145
|
-
✅ @dotenvx/dotenvx 环境变量管理
|
|
146
|
-
✅ PM2 进程管理
|
|
147
|
-
✅ SKWeb Express 集成
|
|
148
|
-
✅ Keycloak/JWKS 鉴权 (可选)
|
|
149
|
-
✅ ESLint 代码检查
|
|
150
|
-
✅ Mocha 测试框架
|
|
119
|
+
npm run web:dev
|
|
151
120
|
`)
|
|
152
121
|
}
|
|
@@ -5,7 +5,7 @@ const { framework } = require('./cron-framework.js')
|
|
|
5
5
|
const { logger } = require('./utils/logger.js')
|
|
6
6
|
const { checkRequiredEnv } = require('./utils/config.js')
|
|
7
7
|
|
|
8
|
-
async function
|
|
8
|
+
async function bootstrap() {
|
|
9
9
|
logger.info('[cron-worker] Starting cron worker process...')
|
|
10
10
|
|
|
11
11
|
if (!checkRequiredEnv()) {
|
|
@@ -31,10 +31,10 @@ async function startCronWorker() {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (require.main === module) {
|
|
34
|
-
|
|
34
|
+
bootstrap().catch((err) => {
|
|
35
35
|
logger.error('[cron-worker] Fatal error:', err)
|
|
36
36
|
process.exit(1)
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
module.exports = {
|
|
40
|
+
module.exports = { bootstrap }
|
|
@@ -9,7 +9,7 @@ import { checkRequiredEnv } from './utils/config.js'
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url)
|
|
10
10
|
const __dirname = path.dirname(__filename)
|
|
11
11
|
|
|
12
|
-
async function
|
|
12
|
+
async function bootstrap() {
|
|
13
13
|
logger.info('[cron-worker] Starting cron worker process...')
|
|
14
14
|
|
|
15
15
|
if (!checkRequiredEnv()) {
|
|
@@ -36,10 +36,10 @@ async function startCronWorker() {
|
|
|
36
36
|
|
|
37
37
|
const isMainModule = import.meta.url === `file://${process.argv[1]}`
|
|
38
38
|
if (isMainModule) {
|
|
39
|
-
|
|
39
|
+
bootstrap().catch((err) => {
|
|
40
40
|
logger.error('[cron-worker] Fatal error:', err)
|
|
41
41
|
process.exit(1)
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export {
|
|
45
|
+
export { bootstrap }
|
|
@@ -9,7 +9,7 @@ import { checkRequiredEnv } from './utils/config.js'
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url)
|
|
10
10
|
const __dirname = path.dirname(__filename)
|
|
11
11
|
|
|
12
|
-
async function
|
|
12
|
+
async function bootstrap(): Promise<void> {
|
|
13
13
|
logger.info('[cron-worker] Starting cron worker process...')
|
|
14
14
|
|
|
15
15
|
if (!checkRequiredEnv()) {
|
|
@@ -36,10 +36,10 @@ async function startCronWorker(): Promise<void> {
|
|
|
36
36
|
|
|
37
37
|
const isMainModule = import.meta.url === `file://${process.argv[1]}`
|
|
38
38
|
if (isMainModule) {
|
|
39
|
-
|
|
39
|
+
bootstrap().catch((err) => {
|
|
40
40
|
logger.error('[cron-worker] Fatal error:', err)
|
|
41
41
|
process.exit(1)
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export {
|
|
45
|
+
export { bootstrap }
|