create-moost 0.2.32 → 0.2.33
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/package.json +4 -3
- package/templates/cli/bin.js +2 -0
- package/templates/cli/src/controllers/app.controller.ts +10 -0
- package/templates/cli/src/main.ts +29 -0
- package/templates/common/.eslintrc.json +52 -0
- package/templates/common/.prettierignore +4 -0
- package/templates/common/.prettierrc +8 -0
- package/templates/common/README.md +20 -0
- package/templates/common/package.json +78 -0
- package/templates/common/rollup.config.js +23 -0
- package/templates/common/tsconfig.json +15 -0
- package/templates/http/src/controllers/app.controller.ts +10 -0
- package/templates/http/src/main.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-moost",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.33",
|
|
4
4
|
"description": "create-moost",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
|
+
"templates",
|
|
13
14
|
"bin.js"
|
|
14
15
|
],
|
|
15
16
|
"repository": {
|
|
@@ -32,10 +33,10 @@
|
|
|
32
33
|
},
|
|
33
34
|
"homepage": "https://github.com/moostjs/moostjs/tree/main/packages/create-moost#readme",
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@moostjs/event-cli": "0.2.
|
|
36
|
+
"@moostjs/event-cli": "0.2.33",
|
|
36
37
|
"@wooksjs/event-cli": "^0.3.3",
|
|
37
38
|
"@prostojs/rewrite": "^0.0.4",
|
|
38
|
-
"moost": "0.2.
|
|
39
|
+
"moost": "0.2.33",
|
|
39
40
|
"prompts": "^2.4.2"
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MoostCli, cliHelpInterceptor } from '@moostjs/event-cli'
|
|
2
|
+
import { Moost } from 'moost'
|
|
3
|
+
import { AppController } from './controllers/app.controller'
|
|
4
|
+
|
|
5
|
+
function cli() {
|
|
6
|
+
const app = new Moost()
|
|
7
|
+
|
|
8
|
+
app.applyGlobalInterceptors(
|
|
9
|
+
cliHelpInterceptor({
|
|
10
|
+
colors: true,
|
|
11
|
+
lookupLevel: 3,
|
|
12
|
+
})
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
app.registerControllers(AppController)
|
|
16
|
+
app.adapter(new MoostCli({
|
|
17
|
+
debug: false,
|
|
18
|
+
wooksCli: {
|
|
19
|
+
cliHelp: { name: '{{ packageName }}' },
|
|
20
|
+
},
|
|
21
|
+
globalCliOptions: [
|
|
22
|
+
{ keys: ['help'], description: 'Display instructions for the command.' },
|
|
23
|
+
],
|
|
24
|
+
}))
|
|
25
|
+
|
|
26
|
+
void app.init()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
cli()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
|
+
"parserOptions": {
|
|
4
|
+
"project": ["./tsconfig.json"],
|
|
5
|
+
"tsconfigRootDir": "./",
|
|
6
|
+
"sourceType": "module"
|
|
7
|
+
},
|
|
8
|
+
"ignorePatterns": [
|
|
9
|
+
//=IF (bundler === 'rollup')
|
|
10
|
+
"rollup.config.js",
|
|
11
|
+
//=END IF
|
|
12
|
+
//=IF (type === 'cli')
|
|
13
|
+
"bin.js",
|
|
14
|
+
//=END IF
|
|
15
|
+
".eslintrc.js",
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"plugins": ["@typescript-eslint/eslint-plugin"],
|
|
19
|
+
"extends": [
|
|
20
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
21
|
+
"plugin:@typescript-eslint/recommended",
|
|
22
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
23
|
+
//=IF (prettier)
|
|
24
|
+
"prettier"
|
|
25
|
+
//=END IF
|
|
26
|
+
],
|
|
27
|
+
"root": true,
|
|
28
|
+
"env": {
|
|
29
|
+
"node": true,
|
|
30
|
+
"jest": true
|
|
31
|
+
},
|
|
32
|
+
"rules": {
|
|
33
|
+
"indent": ["error", 4, { "SwitchCase": 1 }],
|
|
34
|
+
"comma-dangle": ["error", "always-multiline"],
|
|
35
|
+
"no-multiple-empty-lines": ["error", { "max": 1 }],
|
|
36
|
+
"lines-between-class-members": ["error", "always"],
|
|
37
|
+
"padded-blocks": ["error", "never"],
|
|
38
|
+
"eol-last": ["error", "always"],
|
|
39
|
+
"quotes": ["error", "single"],
|
|
40
|
+
"semi": ["error", "never"],
|
|
41
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
42
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
43
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
44
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
45
|
+
"@typescript-eslint/no-inferrable-types": "off",
|
|
46
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
47
|
+
"@typescript-eslint/no-implied-eval": "off",
|
|
48
|
+
|
|
49
|
+
"@typescript-eslint/no-this-alias": "warn",
|
|
50
|
+
"no-debugger": "error"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{ packageName }}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/main.js",
|
|
6
|
+
//=IF (type === 'cli')
|
|
7
|
+
"bin": {
|
|
8
|
+
"{{ packageName }}": "./bin.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"bin.js"
|
|
13
|
+
],
|
|
14
|
+
//=END IF
|
|
15
|
+
"scripts": {
|
|
16
|
+
//=IF (bundler === 'rollup')
|
|
17
|
+
//=IF (type === 'http')
|
|
18
|
+
"dev": "NODE_OPTIONS=--enable-source-maps rollup -c=./rollup.config.js --watch",
|
|
19
|
+
//=END IF
|
|
20
|
+
//=IF (type === 'cli')
|
|
21
|
+
"dev": "npm run build && ./bin.js",
|
|
22
|
+
//=END IF
|
|
23
|
+
"build": "rollup -c=./rollup.config.js",
|
|
24
|
+
//=END IF
|
|
25
|
+
//=IF (bundler === 'esbuild')
|
|
26
|
+
//=IF (type === 'http')
|
|
27
|
+
"dev": "npm-run-all --parallel build:watch nodemon",
|
|
28
|
+
//=END IF
|
|
29
|
+
//=IF (type === 'cli')
|
|
30
|
+
"dev": "npm run build && ./bin.js",
|
|
31
|
+
//=END IF
|
|
32
|
+
"nodemon": "NODE_OPTIONS=--enable-source-maps nodemon ./dist/main",
|
|
33
|
+
"build": "esbuild ./src/main.ts --bundle --outdir=dist --platform=node --packages=external",
|
|
34
|
+
"build:watch": "esbuild ./src/main.ts --bundle --outdir=dist --watch --platform=node --packages=external --sourcemap",
|
|
35
|
+
//=END IF
|
|
36
|
+
//=IF (prettier)
|
|
37
|
+
"prettify": "prettier . --write && lint --fix",
|
|
38
|
+
//=END IF
|
|
39
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
40
|
+
},
|
|
41
|
+
"author": "",
|
|
42
|
+
"license": "ISC",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
//=IF (type === 'http')
|
|
45
|
+
"@moostjs/event-http": "^{{ version }}",
|
|
46
|
+
//=END IF
|
|
47
|
+
//=IF (type === 'cli')
|
|
48
|
+
"@moostjs/event-cli": "^{{ version }}",
|
|
49
|
+
//=END IF
|
|
50
|
+
"moost": "^{{ version }}"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
//=IF (bundler === 'rollup')
|
|
54
|
+
//=IF (type === 'http')
|
|
55
|
+
"@rollup/plugin-run": "^3.0.1",
|
|
56
|
+
//=END IF
|
|
57
|
+
"@rollup/plugin-typescript": "^11.1.1",
|
|
58
|
+
"rollup": "^3.23.0",
|
|
59
|
+
"tslib": "^2.5.2",
|
|
60
|
+
//=END IF
|
|
61
|
+
//=IF (bundler === 'esbuild')
|
|
62
|
+
"esbuild": "^0.17.19",
|
|
63
|
+
//=IF (type === 'http')
|
|
64
|
+
"nodemon": "^2.0.22",
|
|
65
|
+
"npm-run-all": "^4.1.5",
|
|
66
|
+
//=END IF
|
|
67
|
+
//=END IF
|
|
68
|
+
//=IF (eslint)
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
70
|
+
"eslint": "^8.41.0",
|
|
71
|
+
"eslint-config-prettier": "^8.8.0",
|
|
72
|
+
//=END IF
|
|
73
|
+
//=IF (prettier)
|
|
74
|
+
"prettier": "^2.8.8",
|
|
75
|
+
//=END IF
|
|
76
|
+
"typescript": "^5.0.4"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//=IF (type === 'http')
|
|
2
|
+
const run = require('@rollup/plugin-run')
|
|
3
|
+
//=END IF
|
|
4
|
+
const ts = require('@rollup/plugin-typescript')
|
|
5
|
+
//=IF (type === 'http')
|
|
6
|
+
const dev = process.env.NODE_OPTIONS === '--enable-source-maps'
|
|
7
|
+
//=END IF
|
|
8
|
+
module.exports = {
|
|
9
|
+
input: './src/main.ts',
|
|
10
|
+
output: {
|
|
11
|
+
file: 'dist/main.js',
|
|
12
|
+
format: 'cjs',
|
|
13
|
+
//=IF (type === 'http')
|
|
14
|
+
sourcemap: dev,
|
|
15
|
+
//=END IF
|
|
16
|
+
},
|
|
17
|
+
plugins: [
|
|
18
|
+
ts(),
|
|
19
|
+
//=IF (type === 'http')
|
|
20
|
+
dev && run() || null,
|
|
21
|
+
//=END IF
|
|
22
|
+
],
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "dist",
|
|
4
|
+
"emitDecoratorMetadata": true,
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"lib": ["esnext"],
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"downlevelIteration": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"skipLibCheck": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MoostHttp } from '@moostjs/event-http'
|
|
2
|
+
import { Moost } from 'moost'
|
|
3
|
+
import { AppController } from './controllers/app.controller'
|
|
4
|
+
|
|
5
|
+
const app = new Moost()
|
|
6
|
+
|
|
7
|
+
void app.adapter(new MoostHttp()).listen(3000, () => {
|
|
8
|
+
app.getLogger('{{ projectName }}').info('Up on port 3000')
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
void app
|
|
12
|
+
.registerControllers(
|
|
13
|
+
AppController
|
|
14
|
+
// Add more controllers here...
|
|
15
|
+
)
|
|
16
|
+
.init()
|