perf: optimized build config

This commit is contained in:
arthurfiorette 2022-03-11 16:31:03 -03:00
parent 6fd42b2358
commit 3a800d78ea
No known key found for this signature in database
GPG Key ID: 9D190CD53C53C555
7 changed files with 29 additions and 16 deletions

View File

@ -32,7 +32,7 @@ jobs:
run: yarn build
- name: ESCheck
run: yarn check
run: yarn run check
- name: Publish to Codecov
uses: codecov/codecov-action@v2.1.0

View File

@ -1,6 +1,6 @@
// https://github.com/arthurfiorette/prettier-config
module.exports = require('@arthurfiorette/prettier-config')({
tsdoc: true
// plugins: ['prettier-plugin-organize-imports', 'prettier-plugin-jsdoc']
tsdoc: true,
plugins: ['prettier-plugin-organize-imports', 'prettier-plugin-jsdoc']
});

View File

@ -14,7 +14,8 @@ webpack --config build/webpack.config.js &
tsc -p build/tsconfig.types.json &
# Add a simple index.d.ts file to type all dev builds
echo "export * from '../dist/index.d.ts';" | tee dev/index.d.ts > /dev/null &
echo "export * from '../dist/index';" | tee dev/index.d.ts > /dev/null &
echo "export * from './index';" | tee dist/index.umd.d.ts > /dev/null &
wait

View File

@ -3,16 +3,22 @@
# This script is used to check the umd's ecmascript compatibility.
# It is intended to be run from the project's root directory.
echo "\nStarting checking...\n"
yarn es-check es2017 dist/index.cjs dev/index.cjs dev/index.umd.js
es-check es2015 umd/es5.js &
if [ $? -eq 1 ]; then
exit 1
fi
es-check es2017 umd/index.js cjs/index.js &
es-check es2017 esm/index.js --module &
yarn es-check es2017 dist/index.mjs dev/index.mjs --module
es-check es2020 dev/index.umd.js dev/index.cjs &
es-check es2020 dev/index.mjs --module &
if [ $? -eq 1 ]; then
exit 1
fi
wait
yarn es-check es5 dist/index.umd.js
echo "\nCheck done!"
if [ $? -eq 1 ]; then
exit 1
fi
# :)

View File

@ -1,7 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "ESNext", // webpack converts to UMD
// webpack converts to UMD or CJS if needed
"module": "ESNext",
"target": "ESNext",
// Emits all import helpers as an import to tslib
@ -10,7 +11,10 @@
// No declaration
"declaration": false,
"declarationMap": false
"declarationMap": false,
// This allow us to import javascript files from node_modules.
"allowJs": true
},
"include": ["../src"]
}

View File

@ -5,6 +5,7 @@ const path = require('path');
const TerserWebpackPlugin = require('terser-webpack-plugin');
const { DefinePlugin } = require('webpack');
/** @type {(...args: string[]) => string} */
const root = (...p) => path.resolve(__dirname, '..', ...p);
/**
@ -60,6 +61,7 @@ const config = ({
module: {
rules: [
{
// Include node_modules to parse all javascript files imported
include: /src|node_modules/,
test: /\.(ts|js)$/,
loader: 'ts-loader',

View File

@ -5,7 +5,7 @@
/* Projects */
"incremental": true /* Enable incremental compilation */,
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
"tsBuildInfoFile": "./node_modules/ts-info.json", /* Specify the folder for .tsbuildinfo incremental compilation files. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
@ -97,5 +97,5 @@
"skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"include": ["src", "test", "examples", "docs"]
"include": ["src", "test", "examples", "docs", "build"]
}