mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 19:02:23 +08:00
refactor(cli): use typescript (#2938)
This commit is contained in:
@@ -3,17 +3,21 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"bin": {
|
||||
"dev-web": "./src/dev.mjs"
|
||||
"dev-web": "./src/dev.mts"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node ./src/dev.mjs"
|
||||
"start": "ts-node-esm ./src/dev.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@clack/core": "^0.3.2",
|
||||
"@clack/prompts": "^0.6.3"
|
||||
"@clack/prompts": "^0.6.3",
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"dotenv": "^16.3.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ts-node": "*"
|
||||
},
|
||||
"version": "0.7.0-canary.24"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
#!/usr/bin/env ts-node-esm
|
||||
import { spawn } from 'node:child_process';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
@@ -28,10 +28,10 @@ const dev = await p.group(
|
||||
}
|
||||
);
|
||||
|
||||
const env = {
|
||||
PATH: process.env.PATH,
|
||||
const env: Record<string, string> = {
|
||||
PATH: process.env.PATH ?? '',
|
||||
NODE_ENV: 'development',
|
||||
PORT: 8080,
|
||||
PORT: '8080',
|
||||
};
|
||||
|
||||
if (dev.debugBlockSuite) {
|
||||
@@ -44,8 +44,11 @@ if (dev.debugBlockSuite) {
|
||||
message: 'local blocksuite PATH',
|
||||
initialValue: envLocal.error
|
||||
? undefined
|
||||
: envLocal.parsed.LOCAL_BLOCK_SUITE,
|
||||
: envLocal.parsed?.LOCAL_BLOCK_SUITE,
|
||||
});
|
||||
if (typeof localBlockSuite !== 'string') {
|
||||
throw new Error('local blocksuite PATH is required');
|
||||
}
|
||||
if (!fs.existsSync(localBlockSuite)) {
|
||||
throw new Error(`local blocksuite not found: ${localBlockSuite}`);
|
||||
}
|
||||
Reference in New Issue
Block a user