Prevent default export in order to provide typings

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2022-03-04 16:55:16 +01:00 committed by Convly
parent 710633dfb1
commit 52231a3eba
10 changed files with 131 additions and 121 deletions

View File

@ -0,0 +1,9 @@
const config = {
locales: ['fr'],
};
const bootstrap = () => {};
export default {
config,
bootstrap,
};

View File

@ -1,6 +0,0 @@
export default {
config: {
locales: ['fr'],
},
bootstrap() {},
};

View File

@ -1,17 +0,0 @@
{
"compilerOptions": {
"noImplicitAny": false,
"module": "es6",
"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"]
}

View File

@ -1,8 +1,9 @@
import theme from './extensions/theme' import theme from './extensions/theme';
const config = { const config = {
auth: { auth: {
logo: 'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80' logo:
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
}, },
head: { head: {
favicon: favicon:
@ -26,11 +27,13 @@ const config = {
}, },
tutorials: false, tutorials: false,
notifications: { release: false }, notifications: { release: false },
} };
const bootstrap = (app) => {} const bootstrap = (app: any) => {
console.log(app);
};
export default { export default {
config, config,
bootstrap bootstrap,
}; };

View File

@ -1,47 +0,0 @@
const theme = {
colors: {
alternative100: '#f6ecfc',
alternative200: '#e0c1f4',
alternative500: '#ac73e6',
alternative600: '#9736e8',
alternative700: '#8312d1',
danger100: '#fcecea',
danger200: '#f5c0b8',
danger500: '#ee5e52',
danger600: '#d02b20',
danger700: '#b72b1a',
neutral0: 'black',
neutral100: '#f6f6f9',
neutral150: '#eaeaef',
neutral200: '#dcdce4',
neutral300: '#c0c0cf',
neutral400: '#a5a5ba',
neutral500: '#8e8ea9',
neutral600: '#666687',
neutral700: '#4a4a6a',
neutral800: '#32324d',
neutral900: '#212134',
primary100: '#f0f0ff',
primary200: '#d9d8ff',
primary500: '#7b79ff',
primary600: '#4945ff',
primary700: '#271fe0',
secondary100: '#eaf5ff',
secondary200: '#b8e1ff',
secondary500: '#66b7f1',
secondary600: '#0c75af',
secondary700: '#006096',
success100: '#eafbe7',
success200: '#c6f0c2',
success500: '#5cb176',
success600: '#328048',
success700: '#2f6846',
warning100: '#fdf4dc',
warning200: '#fae7b9',
warning500: '#f29d41',
warning600: '#d9822f',
warning700: '#be5d01',
},
};
export default theme;

View File

@ -0,0 +1,48 @@
const colors: object = {
alternative100: '#f6ecfc',
alternative200: '#e0c1f4',
alternative500: '#ac73e6',
alternative600: '#9736e8',
alternative700: '#8312d1',
danger100: '#fcecea',
danger200: '#f5c0b8',
danger500: '#ee5e52',
danger600: '#d02b20',
danger700: '#b72b1a',
neutral0: 'black',
neutral100: '#f6f6f9',
neutral150: '#eaeaef',
neutral200: '#dcdce4',
neutral300: '#c0c0cf',
neutral400: '#a5a5ba',
neutral500: '#8e8ea9',
neutral600: '#666687',
neutral700: '#4a4a6a',
neutral800: '#32324d',
neutral900: '#212134',
primary100: '#f0f0ff',
primary200: '#d9d8ff',
primary500: '#7b79ff',
primary600: '#4945ff',
primary700: '#271fe0',
secondary100: '#eaf5ff',
secondary200: '#b8e1ff',
secondary500: '#66b7f1',
secondary600: '#0c75af',
secondary700: '#006096',
success100: '#eafbe7',
success200: '#c6f0c2',
success500: '#5cb176',
success600: '#328048',
success700: '#2f6846',
warning100: '#fdf4dc',
warning200: '#fae7b9',
warning500: '#f29d41',
warning600: '#d9822f',
warning700: '#be5d01',
};
const theme = {
colors,
};
export default theme;

View File

@ -1,6 +1,9 @@
export default { const config = {
config: { locales: ['fr'],
locales: ['fr'], };
}, const bootstrap = () => {};
bootstrap() {},
export default {
config,
bootstrap,
}; };

View File

@ -79,6 +79,7 @@ async function build({ plugins, dir, env, options, optimize, forceBuild, useType
options, options,
optimize, optimize,
roots, roots,
useTypeScript,
}); });
const compiler = webpack(config); const compiler = webpack(config);
@ -253,6 +254,7 @@ async function watchAdmin({ plugins, dir, host, port, browser, options, useTypeS
port, port,
options, options,
roots, roots,
useTypeScript,
devServer: { devServer: {
port, port,
client: { client: {

View File

@ -27,6 +27,7 @@ module.exports = ({
eeRoot: './ee/admin', eeRoot: './ee/admin',
ceRoot: './admin/src', ceRoot: './admin/src',
}, },
useTypeScript,
}) => { }) => {
const isProduction = env === 'production'; const isProduction = env === 'production';
@ -47,6 +48,20 @@ module.exports = ({
] ]
: []; : [];
// webpack is quite slow to compile so it is best not to use the ts loader when
// it is not needed in javascript apps.
// Users can still add it by using the custom webpack config.
const typescriptRules = useTypeScript
? [
{
test: /\.tsx?$/,
use: require.resolve('ts-loader'),
include: [cacheDir, ...pluginsPath],
exclude: /node_modules/,
},
]
: [];
return { return {
mode: isProduction ? 'production' : 'development', mode: isProduction ? 'production' : 'development',
bail: isProduction ? true : false, bail: isProduction ? true : false,
@ -134,12 +149,7 @@ module.exports = ({
}, },
}, },
}, },
{
test: /\.tsx?$/,
use: require.resolve('ts-loader'),
include: [cacheDir, ...pluginsPath],
exclude: /node_modules/,
},
{ {
test: /\.css$/i, test: /\.css$/i,
use: ['style-loader', 'css-loader'], use: ['style-loader', 'css-loader'],
@ -171,6 +181,7 @@ module.exports = ({
}, },
}, },
}, },
...typescriptRules,
], ],
}, },
resolve: { resolve: {

View File

@ -1,35 +1,39 @@
export default { const config = {
config: { locales: [
locales: [ // 'ar',
// 'ar', // 'fr',
// 'fr', // 'cs',
// 'cs', // 'de',
// 'de', // 'dk',
// 'dk', // 'es',
// 'es', // 'he',
// 'he', // 'id',
// 'id', // 'it',
// 'it', // 'ja',
// 'ja', // 'ko',
// 'ko', // 'ms',
// 'ms', // 'nl',
// 'nl', // 'no',
// 'no', // 'pl',
// 'pl', // 'pt-BR',
// 'pt-BR', // 'pt',
// 'pt', // 'ru',
// 'ru', // 'sk',
// 'sk', // 'sv',
// 'sv', // 'th',
// 'th', // 'tr',
// 'tr', // 'uk',
// 'uk', // 'vi',
// 'vi', // 'zh-Hans',
// 'zh-Hans', // 'zh',
// 'zh', ],
], };
},
bootstrap(app) { const bootstrap = app => {
console.log(app); console.log(app);
}, };
export default {
config,
bootstrap,
}; };