@erudit-js/cli 4.0.0-dev.5 → 4.0.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/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # 📟 Erudit CLI
2
-
3
- Command Line Interface for [Erudit](https://github.com/erudit-js/erudit).
4
-
5
- CLI is accessible via `erudit` command **only** through installed `erudit` package!
6
-
7
- ## Commands
8
-
9
- - `play` - starts an Erudit project in full dev mode
10
- - `build` - compiles Erudit project
11
- - `launch` - launches compiled Erudit project
12
- - `generate` - generates a fully static production-ready site from Erudit project
13
- - `preview` - previews generated static site
1
+ # 📟 Erudit CLI
2
+
3
+ Command Line Interface for [Erudit](https://github.com/erudit-js/erudit).
4
+
5
+ CLI is accessible via `erudit` command **only** through installed `erudit` package!
6
+
7
+ ## Commands
8
+
9
+ - `play` - starts an Erudit project in full dev mode
10
+ - `build` - compiles Erudit project
11
+ - `launch` - launches compiled Erudit project
12
+ - `generate` - generates a fully static production-ready site from Erudit project
13
+ - `preview` - previews generated static site
package/dist/inject.js CHANGED
@@ -1 +1 @@
1
- export const version = '4.0.0-dev.5';
1
+ export const version = '4.0.1';
@@ -1,91 +1,36 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  export async function spawnNuxt(config) {
3
- const onClose = (exitCode) => {
4
- switch (exitCode) {
5
- case 0:
6
- console.log('Nuxt process exited successfully!');
7
- return;
8
- case 1337:
9
- console.warn('Nuxt full restart is requested!');
10
- _spawnNuxt();
11
- return;
12
- default:
13
- console.error(`Nuxt process exited with code ${exitCode}!`);
14
- return;
15
- }
16
- };
17
- const _spawnNuxt = () => {
18
- const restArgs = Array.isArray(config.restArgs)
19
- ? config.restArgs.join(' ')
20
- : config.restArgs || '';
21
- const nuxtProcess = spawn(`nuxt ${config.command} ${config.absProjectPath}/.erudit/nuxt ${restArgs}`, {
22
- shell: true,
23
- stdio: 'inherit',
24
- env: {
25
- ...process.env,
26
- ...config.env,
27
- },
28
- });
29
- nuxtProcess.on('close', onClose);
30
- };
31
- _spawnNuxt();
3
+ return new Promise((resolve, reject) => {
4
+ const onClose = (exitCode) => {
5
+ switch (exitCode) {
6
+ case 0:
7
+ console.log('Nuxt process exited successfully!');
8
+ resolve();
9
+ return;
10
+ case 1337:
11
+ console.warn('Nuxt full restart is requested!');
12
+ _spawnNuxt();
13
+ return;
14
+ default:
15
+ console.error(`Nuxt process exited with code ${exitCode}!`);
16
+ reject();
17
+ return;
18
+ }
19
+ };
20
+ const _spawnNuxt = () => {
21
+ const restArgs = Array.isArray(config.restArgs)
22
+ ? config.restArgs.join(' ')
23
+ : config.restArgs || '';
24
+ const nuxtProcess = spawn(`nuxt ${config.command} ${config.absProjectPath}/.erudit/nuxt ${restArgs}`, {
25
+ shell: true,
26
+ stdio: 'inherit',
27
+ env: {
28
+ ...process.env,
29
+ ...config.env,
30
+ },
31
+ });
32
+ nuxtProcess.on('close', onClose);
33
+ };
34
+ _spawnNuxt();
35
+ });
32
36
  }
33
- // type NuxtCommand = 'dev' | 'build' | 'generate' | 'prepare';
34
- // export async function spawnNuxt(
35
- // command: NuxtCommand,
36
- // projectPath: string,
37
- // restParams?: string,
38
- // ) {
39
- // return new Promise<void>((resolve) => {
40
- // const onClose = (exitCode: number) => {
41
- // if (exitCode === 0) {
42
- // console.log('Nuxt process exited successfully!');
43
- // return resolve();
44
- // }
45
- // if (exitCode === 1) {
46
- // console.error('Nuxt process exited with an error!');
47
- // return resolve();
48
- // }
49
- // if (exitCode === 1337) {
50
- // console.warn('Nuxt full restart is requested!');
51
- // _spawnNuxt();
52
- // return;
53
- // }
54
- // if (command === 'dev') {
55
- // console.error(
56
- // `Nuxt process exited with an error code ${exitCode} in development mode!\nRespawning...`,
57
- // );
58
- // _spawnNuxt();
59
- // return;
60
- // }
61
- // };
62
- // const _spawnNuxt = () => {
63
- // const mode: EruditMode | undefined = (() => {
64
- // switch (command) {
65
- // case 'dev':
66
- // case 'prepare':
67
- // return 'dev';
68
- // case 'build':
69
- // return 'write';
70
- // case 'generate':
71
- // return 'static';
72
- // }
73
- // })();
74
- // const nuxtProcess = spawn(
75
- // `nuxt ${command} ${projectPath}/.erudit/nuxt ${restParams || ''}`,
76
- // {
77
- // shell: true,
78
- // stdio: 'inherit',
79
- // env: {
80
- // ...process.env,
81
- // ERUDIT_PROJECT_DIR: projectPath,
82
- // ERUDIT_COMMAND: command,
83
- // ERUDIT_MODE: mode,
84
- // },
85
- // },
86
- // );
87
- // nuxtProcess.on('close', onClose);
88
- // };
89
- // _spawnNuxt();
90
- // });
91
- // }
@@ -38,11 +38,11 @@ export async function prepareProject({ absProjectPath, }) {
38
38
  ],
39
39
  }, null, 2));
40
40
  }
41
- writeFileSync(`${nuxtLayerPath}/nuxt.config.ts`, `
42
- export default {
43
- compatibilityDate: '2026-01-01',
44
- extends: ['${CONFIG.ERUDIT_PATH}'],
45
- }
41
+ writeFileSync(`${nuxtLayerPath}/nuxt.config.ts`, `
42
+ export default {
43
+ compatibilityDate: '2026-01-01',
44
+ extends: ['${CONFIG.ERUDIT_PATH}'],
45
+ }
46
46
  `);
47
47
  ['app', 'server', 'shared', 'node'].forEach((name) => {
48
48
  writeFileSync(`${eruditBuildPath}/tsconfig.nuxt.${name}.json`, JSON.stringify({ extends: [`./nuxt/.nuxt/tsconfig.${name}.json`] }, null, 4));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erudit-js/cli",
3
- "version": "4.0.0-dev.5",
3
+ "version": "4.0.1",
4
4
  "type": "module",
5
5
  "description": "📟 Command Line Interface for Erudit",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@erudit-js/core": "4.0.0-dev.5",
33
+ "@erudit-js/core": "4.0.1",
34
34
  "http-server": "^14.1.1",
35
35
  "chalk": "^5.6.2",
36
36
  "citty": "^0.2.0",