create-moost 0.2.36 → 0.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/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
  {
@@ -233,6 +233,9 @@ function scaffold(data) {
233
233
  if (data.bundler !== 'rollup') {
234
234
  excludeCommon.push('rollup.config.js');
235
235
  }
236
+ if (data.bundler !== 'esbuild') {
237
+ excludeCommon.push('build.js');
238
+ }
236
239
  yield rw.rewriteDir({
237
240
  baseDir: templatePath,
238
241
  output: projectDir,
@@ -328,13 +331,13 @@ function run() {
328
331
  app.adapter(new eventCli.MoostCli({
329
332
  globalCliOptions: [
330
333
  // { 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' },
334
+ { keys: ['http'], description: 'Use Moost HTTP', type: Boolean },
335
+ { keys: ['cli'], description: 'Use Moost CLI', type: Boolean },
336
+ { keys: ['eslint'], description: 'Add ESLint', type: Boolean },
337
+ { keys: ['prettier'], description: 'Add Prettier', type: Boolean },
338
+ { keys: ['force'], description: 'Force Overwrite', type: Boolean },
339
+ { keys: ['esbuild'], description: 'Use esbuild for builds', type: Boolean },
340
+ { keys: ['rollup'], description: 'Use rollup for builds', type: Boolean },
338
341
  ],
339
342
  }));
340
343
  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
  {
@@ -231,6 +231,9 @@ function scaffold(data) {
231
231
  if (data.bundler !== 'rollup') {
232
232
  excludeCommon.push('rollup.config.js');
233
233
  }
234
+ if (data.bundler !== 'esbuild') {
235
+ excludeCommon.push('build.js');
236
+ }
234
237
  yield rw.rewriteDir({
235
238
  baseDir: templatePath,
236
239
  output: projectDir,
@@ -326,13 +329,13 @@ function run() {
326
329
  app.adapter(new MoostCli({
327
330
  globalCliOptions: [
328
331
  // { 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' },
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 },
336
339
  ],
337
340
  }));
338
341
  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.1",
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.1",
45
+ "@wooksjs/event-cli": "^0.4.1",
46
46
  "@prostojs/rewrite": "^0.0.4",
47
- "moost": "0.2.36",
47
+ "moost": "0.3.1",
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)