@erudit-js/cli 4.0.0-dev.5 → 4.0.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/inject.js CHANGED
@@ -1 +1 @@
1
- export const version = '4.0.0-dev.5';
1
+ export const version = '4.0.0';
@@ -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
- // }
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.0",
4
4
  "type": "module",
5
5
  "description": "📟 Command Line Interface for Erudit",
6
6
  "license": "MIT",