create-moost 0.2.36 → 0.3.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/dist/index.cjs CHANGED
@@ -125,8 +125,8 @@ function getPrompts(inputs) {
125
125
  },
126
126
  message: 'Bundler:',
127
127
  choices: [
128
- { title: 'ESBuild (with nodemon for dev)', value: 'esbuild' },
129
- { title: 'Rollup', value: 'rollup' },
128
+ { title: 'Rollup (recommended)', value: 'rollup' },
129
+ { title: 'ESBuild', value: 'esbuild' },
130
130
  ],
131
131
  },
132
132
  {
@@ -225,6 +225,7 @@ function scaffold(data) {
225
225
  const excludeCommon = [];
226
226
  if (!data.eslint) {
227
227
  excludeCommon.push('.eslintrc.json');
228
+ excludeCommon.push('build.js');
228
229
  }
229
230
  if (!data.prettier) {
230
231
  excludeCommon.push('.prettierignore');
@@ -328,13 +329,13 @@ function run() {
328
329
  app.adapter(new eventCli.MoostCli({
329
330
  globalCliOptions: [
330
331
  // { keys: ['ts'], description: '' },
331
- { keys: ['http'], description: 'Use Moost HTTP' },
332
- { keys: ['cli'], description: 'Use Moost CLI' },
333
- { keys: ['eslint'], description: 'Add ESLint' },
334
- { keys: ['prettier'], description: 'Add Prettier' },
335
- { keys: ['force'], description: 'Force Overwrite' },
336
- { keys: ['esbuild'], description: 'Use esbuild for builds' },
337
- { keys: ['rollup'], description: 'Use rollup for builds' },
332
+ { keys: ['http'], description: 'Use Moost HTTP', type: Boolean },
333
+ { keys: ['cli'], description: 'Use Moost CLI', type: Boolean },
334
+ { keys: ['eslint'], description: 'Add ESLint', type: Boolean },
335
+ { keys: ['prettier'], description: 'Add Prettier', type: Boolean },
336
+ { keys: ['force'], description: 'Force Overwrite', type: Boolean },
337
+ { keys: ['esbuild'], description: 'Use esbuild for builds', type: Boolean },
338
+ { keys: ['rollup'], description: 'Use rollup for builds', type: Boolean },
338
339
  ],
339
340
  }));
340
341
  void app.init();
package/dist/index.mjs CHANGED
@@ -123,8 +123,8 @@ function getPrompts(inputs) {
123
123
  },
124
124
  message: 'Bundler:',
125
125
  choices: [
126
- { title: 'ESBuild (with nodemon for dev)', value: 'esbuild' },
127
- { title: 'Rollup', value: 'rollup' },
126
+ { title: 'Rollup (recommended)', value: 'rollup' },
127
+ { title: 'ESBuild', value: 'esbuild' },
128
128
  ],
129
129
  },
130
130
  {
@@ -223,6 +223,7 @@ function scaffold(data) {
223
223
  const excludeCommon = [];
224
224
  if (!data.eslint) {
225
225
  excludeCommon.push('.eslintrc.json');
226
+ excludeCommon.push('build.js');
226
227
  }
227
228
  if (!data.prettier) {
228
229
  excludeCommon.push('.prettierignore');
@@ -326,13 +327,13 @@ function run() {
326
327
  app.adapter(new MoostCli({
327
328
  globalCliOptions: [
328
329
  // { keys: ['ts'], description: '' },
329
- { keys: ['http'], description: 'Use Moost HTTP' },
330
- { keys: ['cli'], description: 'Use Moost CLI' },
331
- { keys: ['eslint'], description: 'Add ESLint' },
332
- { keys: ['prettier'], description: 'Add Prettier' },
333
- { keys: ['force'], description: 'Force Overwrite' },
334
- { keys: ['esbuild'], description: 'Use esbuild for builds' },
335
- { keys: ['rollup'], description: 'Use rollup for builds' },
330
+ { keys: ['http'], description: 'Use Moost HTTP', type: Boolean },
331
+ { keys: ['cli'], description: 'Use Moost CLI', type: Boolean },
332
+ { keys: ['eslint'], description: 'Add ESLint', type: Boolean },
333
+ { keys: ['prettier'], description: 'Add Prettier', type: Boolean },
334
+ { keys: ['force'], description: 'Force Overwrite', type: Boolean },
335
+ { keys: ['esbuild'], description: 'Use esbuild for builds', type: Boolean },
336
+ { keys: ['rollup'], description: 'Use rollup for builds', type: Boolean },
336
337
  ],
337
338
  }));
338
339
  void app.init();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-moost",
3
- "version": "0.2.36",
3
+ "version": "0.3.0",
4
4
  "description": "create-moost",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -41,10 +41,10 @@
41
41
  },
42
42
  "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/create-moost#readme",
43
43
  "dependencies": {
44
- "@moostjs/event-cli": "0.2.36",
45
- "@wooksjs/event-cli": "^0.3.12",
44
+ "@moostjs/event-cli": "0.3.0",
45
+ "@wooksjs/event-cli": "^0.4.1",
46
46
  "@prostojs/rewrite": "^0.0.4",
47
- "moost": "0.2.36",
47
+ "moost": "0.3.0",
48
48
  "prompts": "^2.4.2"
49
49
  }
50
50
  }
@@ -19,7 +19,7 @@ function cli() {
19
19
  cliHelp: { name: '{{ packageName }}' },
20
20
  },
21
21
  globalCliOptions: [
22
- { keys: ['help'], description: 'Display instructions for the command.' },
22
+ { keys: ['help'], description: 'Display instructions for the command.', type: Boolean },
23
23
  ],
24
24
  }))
25
25
 
@@ -0,0 +1,28 @@
1
+ const esbuild = require('esbuild')
2
+ const esbuildPluginTsc = require('esbuild-plugin-tsc')
3
+ //=IF (type === 'http')
4
+ const { spawn } = require('child_process')
5
+ //=END IF
6
+
7
+ const watch = process.argv[2] === 'watch'
8
+
9
+ esbuild[watch ? 'context' : 'build']({
10
+ entryPoints: [
11
+ './src/main.ts',
12
+ ],
13
+ logLevel: 'info',
14
+ bundle: true,
15
+ outdir: './dist',
16
+ platform: 'node',
17
+ packages: 'external',
18
+ sourcemap: watch,
19
+ plugins: [esbuildPluginTsc()],
20
+ }).then(async ctx => {
21
+ if (watch) {
22
+ //=IF (type === 'http')
23
+ const nodemon = spawn('nodemon', { stdio: 'inherit' })
24
+ process.on('SIGTERM', async () => { nodemon.kill(); await ctx.dispose() })
25
+ //=END IF
26
+ await ctx.watch()
27
+ }
28
+ })
@@ -24,14 +24,14 @@
24
24
  //=END IF
25
25
  //=IF (bundler === 'esbuild')
26
26
  //=IF (type === 'http')
27
- "dev": "npm-run-all --parallel build:watch nodemon",
27
+ "dev": "npm run build:watch",
28
+ "nodemon": "NODE_OPTIONS=--enable-source-maps nodemon ./dist/main",
28
29
  //=END IF
29
30
  //=IF (type === 'cli')
30
31
  "dev": "npm run build && ./bin.js",
31
32
  //=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",
33
+ "build": "node ./build",
34
+ "build:watch": "node ./build watch",
35
35
  //=END IF
36
36
  //=IF (prettier)
37
37
  "prettify": "prettier . --write && lint --fix",
@@ -59,10 +59,10 @@
59
59
  "tslib": "^2.5.2",
60
60
  //=END IF
61
61
  //=IF (bundler === 'esbuild')
62
- "esbuild": "^0.17.19",
62
+ "esbuild": "^0.18.17",
63
+ "esbuild-plugin-tsc": "^0.4.0",
63
64
  //=IF (type === 'http')
64
65
  "nodemon": "^2.0.22",
65
- "npm-run-all": "^4.1.5",
66
66
  //=END IF
67
67
  //=END IF
68
68
  //=IF (eslint)