mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Update tsconfig templates files
This commit is contained in:
parent
54fefcf5d2
commit
b25ac466ac
@ -81,16 +81,19 @@ module.exports = async function createProject(scope, { client, connection, depen
|
||||
|
||||
if (useTypescript) {
|
||||
const tsJSONDir = join(__dirname, 'resources', 'json', 'ts');
|
||||
const files = ['tsconfig-admin.json.js', 'tsconfig-server.json.js'];
|
||||
const filesMap = {
|
||||
'tsconfig-admin.json.js': 'src/admin',
|
||||
'tsconfig-server.json.js': '.',
|
||||
};
|
||||
|
||||
files.forEach(file => {
|
||||
const srcPath = join(tsJSONDir, file);
|
||||
const destPath = join(rootPath, `${file.slice(0, -3)}`);
|
||||
for (const [fileName, path] of Object.entries(filesMap)) {
|
||||
const srcPath = join(tsJSONDir, fileName);
|
||||
const destPath = join(rootPath, path, 'tsconfig.json');
|
||||
|
||||
const json = require(srcPath)();
|
||||
|
||||
fse.writeJSONSync(destPath, json);
|
||||
});
|
||||
await fse.writeJSON(destPath, JSON.stringify(json, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
// ensure node_modules is created
|
||||
|
||||
@ -1,20 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = () => ({
|
||||
compilerOptions: {
|
||||
lib: ['es2019', 'es2020.promise', 'es2020.bigint', 'es2020.string', 'DOM'],
|
||||
noImplicitAny: false,
|
||||
module: 'es2020',
|
||||
target: 'es5',
|
||||
jsx: 'react',
|
||||
allowJs: true,
|
||||
moduleResolution: 'node',
|
||||
skipLibCheck: true,
|
||||
esModuleInterop: true,
|
||||
allowSyntheticDefaultImports: true,
|
||||
resolveJsonModule: true,
|
||||
noEmit: false,
|
||||
incremental: true,
|
||||
},
|
||||
exclude: ['node_modules', '**/*.test.js', '*.js'],
|
||||
extends: '@strapi/typescript-utils/lib/configs/admin',
|
||||
|
||||
exclude: ['node_modules/', 'build/', 'dist/', '**/*.test.ts'],
|
||||
});
|
||||
|
||||
@ -1,23 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = () => ({
|
||||
compilerOptions: {
|
||||
lib: ['es2019', 'es2020.promise', 'es2020.bigint', 'es2020.string', 'DOM'],
|
||||
module: 'commonjs',
|
||||
target: 'es2019',
|
||||
strict: false,
|
||||
jsx: 'react',
|
||||
noImplicitAny: false,
|
||||
esModuleInterop: true,
|
||||
skipLibCheck: true,
|
||||
forceConsistentCasingInFileNames: true,
|
||||
allowJs: true,
|
||||
outDir: 'dist',
|
||||
rootDir: '.',
|
||||
noEmitOnError: true,
|
||||
resolveJsonModule: true,
|
||||
},
|
||||
extends: '@strapi/typescript-utils/lib/configs/server',
|
||||
|
||||
include: ['src/**/*.json', './'],
|
||||
exclude: ['node_modules/', 'build/', 'dist/', 'src/admin', '.cache/', '.tmp/'],
|
||||
include: [
|
||||
// Include the root directory
|
||||
'./',
|
||||
// Force the JSON files in the src folder to be included
|
||||
'src/**/*.json',
|
||||
],
|
||||
|
||||
exclude: [
|
||||
'node_modules/',
|
||||
'build/',
|
||||
'dist/',
|
||||
'.cache/',
|
||||
'.tmp/',
|
||||
|
||||
// Do not include admin files in the server compilation
|
||||
'src/admin/',
|
||||
// Do not include test files
|
||||
'**/*.test.ts',
|
||||
// Do not include plugins in the server compilation
|
||||
'src/plugins/**',
|
||||
],
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user