create-moost 0.2.32 → 0.2.34
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 +36 -1
- package/package.json +13 -4
- 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/README.md
CHANGED
|
@@ -1 +1,36 @@
|
|
|
1
|
-
# create-moost
|
|
1
|
+
# create-moost
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="../../moost-logo.png" width="450px"><br>
|
|
5
|
+
<a href="https://github.com/moostjs/moostjs/blob/main/LICENSE">
|
|
6
|
+
<img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" />
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
`create-moost` is an npm initializer module that allows you to quickly set up new Moost applications. It provides a simple command-line interface to create Moost applications, either as a HTTP app or a CLI app.
|
|
11
|
+
|
|
12
|
+
## Getting Started
|
|
13
|
+
|
|
14
|
+
To use `create-moost`, make sure you have Node.js (version 14 or above) and npm (Node Package Manager) installed on your machine. Then, follow the steps below to create your Moost application.
|
|
15
|
+
|
|
16
|
+
### Creating a HTTP App
|
|
17
|
+
|
|
18
|
+
To create a Moost HTTP app, use the following command in your terminal:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm create moost -- --http
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This command will initiate the creation of a new Moost HTTP app. It will prompt you with a series of questions to configure your app, such as enabling eslint and prettier, and choosing between the esbuild and rollup bundlers.
|
|
25
|
+
|
|
26
|
+
### Creating a CLI App
|
|
27
|
+
|
|
28
|
+
To create a Moost CLI app, use the following command in your terminal:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm create moost -- --cli
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This command will start the creation process for a new Moost CLI app. It will ask you questions to customize your app, including eslint and prettier preferences, as well as the choice between the esbuild and rollup bundlers.
|
|
35
|
+
|
|
36
|
+
## [Official Documentation](https://moost.org/)
|
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-moost",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "create-moost",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
8
16
|
"bin": {
|
|
9
17
|
"create-moost": "./bin.js"
|
|
10
18
|
},
|
|
11
19
|
"files": [
|
|
12
20
|
"dist",
|
|
21
|
+
"templates",
|
|
13
22
|
"bin.js"
|
|
14
23
|
],
|
|
15
24
|
"repository": {
|
|
@@ -32,10 +41,10 @@
|
|
|
32
41
|
},
|
|
33
42
|
"homepage": "https://github.com/moostjs/moostjs/tree/main/packages/create-moost#readme",
|
|
34
43
|
"dependencies": {
|
|
35
|
-
"@moostjs/event-cli": "0.2.
|
|
36
|
-
"@wooksjs/event-cli": "^0.3.
|
|
44
|
+
"@moostjs/event-cli": "0.2.34",
|
|
45
|
+
"@wooksjs/event-cli": "^0.3.11",
|
|
37
46
|
"@prostojs/rewrite": "^0.0.4",
|
|
38
|
-
"moost": "0.2.
|
|
47
|
+
"moost": "0.2.34",
|
|
39
48
|
"prompts": "^2.4.2"
|
|
40
49
|
}
|
|
41
50
|
}
|
|
@@ -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()
|