fix: add env SERVER_TSCONFIG_PATH

This commit is contained in:
chenos 2023-09-13 12:21:29 +08:00
parent 4c1d186c12
commit 22bf23b59e
5 changed files with 11 additions and 9 deletions

View File

@ -20,6 +20,7 @@ const env = {
NODE_MODULES_PATH: resolve(process.cwd(), 'node_modules'), NODE_MODULES_PATH: resolve(process.cwd(), 'node_modules'),
PM2_HOME: resolve(process.cwd(), './storage/.pm2'), PM2_HOME: resolve(process.cwd(), './storage/.pm2'),
PLUGIN_PACKAGE_PREFIX: '@nocobase/plugin-,@nocobase/plugin-sample-,@nocobase/preset-', PLUGIN_PACKAGE_PREFIX: '@nocobase/plugin-,@nocobase/plugin-sample-,@nocobase/preset-',
SERVER_TSCONFIG_PATH: './tsconfig.server.json',
}; };
if (!process.env.APP_ENV_PATH && process.argv[2] && process.argv[2] === 'test') { if (!process.env.APP_ENV_PATH && process.argv[2] && process.argv[2] === 'test') {

View File

@ -18,12 +18,13 @@ module.exports = (cli) => {
.allowUnknownOption() .allowUnknownOption()
.action(async (opts) => { .action(async (opts) => {
promptForTs(); promptForTs();
const { SERVER_TSCONFIG_PATH } = process.env;
process.env.IS_DEV_CMD = true; process.env.IS_DEV_CMD = true;
if (process.argv.includes('-h') || process.argv.includes('--help')) { if (process.argv.includes('-h') || process.argv.includes('--help')) {
run('ts-node', [ run('ts-node', [
'-P', '-P',
'./tsconfig.server.json', SERVER_TSCONFIG_PATH,
'-r', '-r',
'tsconfig-paths/register', 'tsconfig-paths/register',
`${APP_PACKAGE_ROOT}/src/index.ts`, `${APP_PACKAGE_ROOT}/src/index.ts`,
@ -62,7 +63,7 @@ module.exports = (cli) => {
'watch', 'watch',
'--ignore=./storage/plugins/**', '--ignore=./storage/plugins/**',
'--tsconfig', '--tsconfig',
'./tsconfig.server.json', SERVER_TSCONFIG_PATH,
'-r', '-r',
'tsconfig-paths/register', 'tsconfig-paths/register',
`${APP_PACKAGE_ROOT}/src/index.ts`, `${APP_PACKAGE_ROOT}/src/index.ts`,

View File

@ -6,7 +6,7 @@ const { run, isDev, isProd, promptForTs } = require('../util');
* @param {Command} cli * @param {Command} cli
*/ */
module.exports = (cli) => { module.exports = (cli) => {
const { APP_PACKAGE_ROOT } = process.env; const { APP_PACKAGE_ROOT, SERVER_TSCONFIG_PATH } = process.env;
cli cli
.allowUnknownOption() .allowUnknownOption()
.option('-h, --help') .option('-h, --help')
@ -16,7 +16,7 @@ module.exports = (cli) => {
promptForTs(); promptForTs();
run('tsx', [ run('tsx', [
'--tsconfig', '--tsconfig',
'./tsconfig.server.json', SERVER_TSCONFIG_PATH,
'-r', '-r',
'tsconfig-paths/register', 'tsconfig-paths/register',
`${APP_PACKAGE_ROOT}/src/index.ts`, `${APP_PACKAGE_ROOT}/src/index.ts`,

View File

@ -25,7 +25,7 @@ module.exports = (cli) => {
promptForTs(); promptForTs();
run('ts-node', [ run('ts-node', [
'-P', '-P',
'./tsconfig.server.json', process.env.SERVER_TSCONFIG_PATH,
'-r', '-r',
'tsconfig-paths/register', 'tsconfig-paths/register',
`${APP_PACKAGE_ROOT}/src/index.ts`, `${APP_PACKAGE_ROOT}/src/index.ts`,

View File

@ -102,12 +102,12 @@ exports.postCheck = async (opts) => {
}; };
exports.runInstall = async () => { exports.runInstall = async () => {
const { APP_PACKAGE_ROOT } = process.env; const { APP_PACKAGE_ROOT, SERVER_TSCONFIG_PATH } = process.env;
if (exports.isDev()) { if (exports.isDev()) {
const argv = [ const argv = [
'--tsconfig', '--tsconfig',
'./tsconfig.server.json', SERVER_TSCONFIG_PATH,
'-r', '-r',
'tsconfig-paths/register', 'tsconfig-paths/register',
`${APP_PACKAGE_ROOT}/src/index.ts`, `${APP_PACKAGE_ROOT}/src/index.ts`,
@ -123,12 +123,12 @@ exports.runInstall = async () => {
}; };
exports.runAppCommand = async (command, args = []) => { exports.runAppCommand = async (command, args = []) => {
const { APP_PACKAGE_ROOT } = process.env; const { APP_PACKAGE_ROOT, SERVER_TSCONFIG_PATH } = process.env;
if (exports.isDev()) { if (exports.isDev()) {
const argv = [ const argv = [
'--tsconfig', '--tsconfig',
'./tsconfig.server.json', SERVER_TSCONFIG_PATH,
'-r', '-r',
'tsconfig-paths/register', 'tsconfig-paths/register',
`${APP_PACKAGE_ROOT}/src/index.ts`, `${APP_PACKAGE_ROOT}/src/index.ts`,