@cloud411716/fancy-webnovel 0.1.22 → 0.1.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "type": "module",
5
5
  "main": "plugins/fancy-bootstrap/index.js",
6
6
  "exports": {
@@ -29,9 +29,10 @@ function isValidPath(p) {
29
29
  }
30
30
 
31
31
  function runBootstrapScript(projectRoot) {
32
- return new Promise((resolve) => {
32
+ return new Promise(async (resolve) => {
33
33
  const initScript = join(BOOTSTRAP_SCRIPTS_DIR, 'init.js');
34
- const proc = require('child_process').spawn(
34
+ const { spawn } = await import('child_process');
35
+ const proc = spawn(
35
36
  'node', [initScript, projectRoot],
36
37
  { timeout: 30000, stdio: ['ignore', 'pipe', 'pipe'] }
37
38
  );
@@ -157,9 +158,10 @@ function notifyScan(session, text) {
157
158
  }
158
159
 
159
160
  function runScanScript(projectRoot, platform, length) {
160
- return new Promise((resolve) => {
161
+ return new Promise(async (resolve) => {
161
162
  const scriptPath = join(SCAN_SCRIPTS_DIR, 'run-scan.js');
162
- const proc = require('child_process').spawn(
163
+ const { spawn } = await import('child_process');
164
+ const proc = spawn(
163
165
  'node', [scriptPath, '--project-root', projectRoot, '--platform', platform, '--length', length],
164
166
  { timeout: 120000, stdio: ['ignore', 'pipe', 'pipe'] }
165
167
  );
@@ -291,6 +293,12 @@ async function applyScan(ctx) {
291
293
  export const inject = ['commands', 'userQuestions'];
292
294
 
293
295
  export async function apply(ctx) {
294
- await applyBootstrap(ctx);
295
- await applyScan(ctx);
296
+ try {
297
+ await applyBootstrap(ctx);
298
+ await applyScan(ctx);
299
+ } catch (e) {
300
+ const { writeFileSync } = await import('fs');
301
+ writeFileSync('/tmp/dsh-apply-error.txt', String(e) + '\n' + e.stack, 'utf-8');
302
+ throw e;
303
+ }
296
304
  }