fix: #2096, allows custom ts paths with payload generate:types
This commit is contained in:
@@ -1,23 +1,38 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
import minimist from 'minimist';
|
||||
import swcRegister from '@swc/register';
|
||||
import { getTsconfig as getTSconfig } from 'get-tsconfig';
|
||||
import { generateTypes } from './generateTypes';
|
||||
import { generateGraphQLSchema } from './generateGraphQLSchema';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - bad @swc/register types
|
||||
swcRegister({
|
||||
const tsConfig = getTSconfig();
|
||||
|
||||
const swcOptions = {
|
||||
sourceMaps: 'inline',
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: true,
|
||||
},
|
||||
paths: undefined,
|
||||
baseUrl: undefined,
|
||||
},
|
||||
module: {
|
||||
type: 'commonjs',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (tsConfig?.config?.compilerOptions?.paths) {
|
||||
swcOptions.jsc.paths = tsConfig?.config?.compilerOptions?.paths;
|
||||
|
||||
if (tsConfig?.config?.compilerOptions?.baseUrl) {
|
||||
swcOptions.jsc.baseUrl = tsConfig?.config?.compilerOptions?.baseUrl;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - bad @swc/register types
|
||||
swcRegister(swcOptions);
|
||||
|
||||
const { build } = require('./build');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user