suthep 1.0.0
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/.editorconfig +17 -0
- package/.github/workflows/publish.yml +42 -0
- package/.prettierignore +6 -0
- package/.prettierrc +7 -0
- package/.scannerwork/.sonar_lock +0 -0
- package/.scannerwork/report-task.txt +6 -0
- package/.vscode/settings.json +19 -0
- package/LICENSE +21 -0
- package/README.md +317 -0
- package/dist/commands/deploy.js +371 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/down.js +179 -0
- package/dist/commands/down.js.map +1 -0
- package/dist/commands/init.js +188 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/setup.js +90 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/up.js +213 -0
- package/dist/commands/up.js.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/certbot.js +64 -0
- package/dist/utils/certbot.js.map +1 -0
- package/dist/utils/config-loader.js +127 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/deployment.js +85 -0
- package/dist/utils/deployment.js.map +1 -0
- package/dist/utils/docker.js +425 -0
- package/dist/utils/docker.js.map +1 -0
- package/dist/utils/env-loader.js +53 -0
- package/dist/utils/env-loader.js.map +1 -0
- package/dist/utils/nginx.js +378 -0
- package/dist/utils/nginx.js.map +1 -0
- package/docs/README.md +38 -0
- package/docs/english/01-introduction.md +84 -0
- package/docs/english/02-installation.md +200 -0
- package/docs/english/03-quick-start.md +258 -0
- package/docs/english/04-configuration.md +433 -0
- package/docs/english/05-commands.md +336 -0
- package/docs/english/06-examples.md +456 -0
- package/docs/english/07-troubleshooting.md +417 -0
- package/docs/english/08-advanced.md +411 -0
- package/docs/english/README.md +48 -0
- package/docs/thai/01-introduction.md +84 -0
- package/docs/thai/02-installation.md +200 -0
- package/docs/thai/03-quick-start.md +258 -0
- package/docs/thai/04-configuration.md +433 -0
- package/docs/thai/05-commands.md +336 -0
- package/docs/thai/06-examples.md +456 -0
- package/docs/thai/07-troubleshooting.md +417 -0
- package/docs/thai/08-advanced.md +411 -0
- package/docs/thai/README.md +48 -0
- package/example/suthep-complete.yml +103 -0
- package/example/suthep-docker-only.yml +71 -0
- package/example/suthep-env-example.yml +113 -0
- package/example/suthep-no-docker.yml +51 -0
- package/example/suthep-path-routing.yml +62 -0
- package/example/suthep.example.yml +88 -0
- package/package.json +51 -0
- package/src/commands/deploy.ts +488 -0
- package/src/commands/down.ts +240 -0
- package/src/commands/init.ts +214 -0
- package/src/commands/setup.ts +112 -0
- package/src/commands/up.ts +271 -0
- package/src/index.ts +109 -0
- package/src/types/config.ts +52 -0
- package/src/utils/__tests__/certbot.test.ts +222 -0
- package/src/utils/__tests__/config-loader.test.ts +419 -0
- package/src/utils/__tests__/deployment.test.ts +243 -0
- package/src/utils/__tests__/nginx.test.ts +412 -0
- package/src/utils/certbot.ts +144 -0
- package/src/utils/config-loader.ts +184 -0
- package/src/utils/deployment.ts +157 -0
- package/src/utils/docker.ts +768 -0
- package/src/utils/env-loader.ts +135 -0
- package/src/utils/nginx.ts +443 -0
- package/suthep-1.0.0.tgz +0 -0
- package/suthep.example.yml +98 -0
- package/suthep.yml +39 -0
- package/todo.md +6 -0
- package/tsconfig.json +26 -0
- package/vite.config.ts +46 -0
- package/vitest.config.ts +21 -0
package/suthep.yml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
project:
|
|
2
|
+
name: small-production-app
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
|
|
5
|
+
services:
|
|
6
|
+
# Simple API service for small production deployment
|
|
7
|
+
# - name: muacle-api-dev
|
|
8
|
+
# port: 3003
|
|
9
|
+
# path: /api
|
|
10
|
+
# domains:
|
|
11
|
+
# - dev.muacle.com
|
|
12
|
+
# docker:
|
|
13
|
+
# image: muacle-api:dev
|
|
14
|
+
# container: api-container-dev
|
|
15
|
+
# port: 3001
|
|
16
|
+
# healthCheck:
|
|
17
|
+
# path: /health
|
|
18
|
+
# interval: 30
|
|
19
|
+
# environment:
|
|
20
|
+
# NODE_ENV: production
|
|
21
|
+
|
|
22
|
+
# UI service on root path
|
|
23
|
+
- name: muacle-ui-dev
|
|
24
|
+
port: 3002
|
|
25
|
+
path: /
|
|
26
|
+
domains:
|
|
27
|
+
- localhost
|
|
28
|
+
docker:
|
|
29
|
+
image: frontend-api:latest
|
|
30
|
+
container: ui-container-dev
|
|
31
|
+
port: 3000
|
|
32
|
+
# healthCheck:
|
|
33
|
+
# path: /
|
|
34
|
+
# interval: 30
|
|
35
|
+
|
|
36
|
+
deployment:
|
|
37
|
+
strategy: rolling
|
|
38
|
+
healthCheckTimeout: 30000
|
|
39
|
+
|
package/todo.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
build tool deploy and run project in yml service config service port to nginx multiple domain name or sub domain and can connect docker port
|
|
2
|
+
✔ Automatic Nginx reverse proxy setup
|
|
3
|
+
✔ Automatic HTTPS with Certbot
|
|
4
|
+
✔ Zero-downtime deploy
|
|
5
|
+
make it in cli https://www.npmjs.com/package/commander typescript to build create project and setup by yml nginx
|
|
6
|
+
in save cost in run vm
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
7
|
+
"types": ["vite/client"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["src"]
|
|
26
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { resolve } from 'path'
|
|
2
|
+
import type { Plugin } from 'vite'
|
|
3
|
+
import { defineConfig } from 'vite'
|
|
4
|
+
|
|
5
|
+
const addShebangPlugin = (): Plugin => ({
|
|
6
|
+
name: 'add-shebang',
|
|
7
|
+
generateBundle(_options, bundle) {
|
|
8
|
+
if (bundle['index.js']) {
|
|
9
|
+
const chunk = bundle['index.js']
|
|
10
|
+
if (chunk.type === 'chunk') {
|
|
11
|
+
chunk.code = '#!/usr/bin/env node\n' + chunk.code
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
plugins: [addShebangPlugin()],
|
|
19
|
+
build: {
|
|
20
|
+
outDir: 'dist',
|
|
21
|
+
lib: {
|
|
22
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
23
|
+
formats: ['es'],
|
|
24
|
+
fileName: 'index',
|
|
25
|
+
},
|
|
26
|
+
rollupOptions: {
|
|
27
|
+
external: (id) => {
|
|
28
|
+
// Externalize all node_modules and Node.js built-ins
|
|
29
|
+
return (
|
|
30
|
+
!id.startsWith('.') &&
|
|
31
|
+
!id.startsWith('/') &&
|
|
32
|
+
!resolve(__dirname, id).startsWith(__dirname + '/src')
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
output: {
|
|
36
|
+
format: 'es',
|
|
37
|
+
entryFileNames: '[name].js',
|
|
38
|
+
preserveModules: true,
|
|
39
|
+
preserveModulesRoot: 'src',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
target: 'node18',
|
|
43
|
+
minify: false,
|
|
44
|
+
sourcemap: true,
|
|
45
|
+
},
|
|
46
|
+
})
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globals: true,
|
|
6
|
+
environment: 'node',
|
|
7
|
+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
8
|
+
coverage: {
|
|
9
|
+
provider: 'v8',
|
|
10
|
+
reporter: ['text', 'json', 'html'],
|
|
11
|
+
exclude: [
|
|
12
|
+
'node_modules/',
|
|
13
|
+
'dist/',
|
|
14
|
+
'**/*.config.ts',
|
|
15
|
+
'**/*.test.ts',
|
|
16
|
+
'**/*.spec.ts',
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|