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'),
PM2_HOME: resolve(process.cwd(), './storage/.pm2'),
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') {

View File

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

View File

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

View File

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

View File

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