mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
Esbuild with types
This commit is contained in:
@@ -5,9 +5,10 @@ const handler = (e) => {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
};
|
};
|
||||||
|
const watch = process.argv.includes('--watch');
|
||||||
|
|
||||||
build(esmBuild({ minify: false })).catch(handler);
|
build(umdBuild({ minify: false, watch })).catch(handler);
|
||||||
build(umdBuild({ minify: false })).catch(handler);
|
build(esmBuild({ minify: false, watch })).catch(handler);
|
||||||
|
|
||||||
build(esmBuild()).catch(handler);
|
build(esmBuild()).catch(handler);
|
||||||
build(umdBuild()).catch(handler);
|
build(umdBuild()).catch(handler);
|
||||||
|
@@ -22,16 +22,27 @@ const buildOptions = (override = {}) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.esmBuild = ({ minify = true } = {}) => {
|
/**
|
||||||
|
* @param {Options} override
|
||||||
|
* @returns {Options}
|
||||||
|
*/
|
||||||
|
exports.esmBuild = (override = { minify: true }) => {
|
||||||
return buildOptions({
|
return buildOptions({
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
outfile: `dist/mermaid.esm${minify ? '.min' : ''}.mjs`,
|
outfile: `dist/mermaid.esm${override.minify ? '.min' : ''}.mjs`,
|
||||||
minify,
|
...override,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.umdBuild = ({ minify = true } = {}) => {
|
/**
|
||||||
return buildOptions({ outfile: `dist/mermaid${minify ? '.min' : ''}.js`, minify });
|
* @param {Options} override
|
||||||
|
* @returns {Options}
|
||||||
|
*/
|
||||||
|
exports.umdBuild = (override = { minify: true }) => {
|
||||||
|
return buildOptions({
|
||||||
|
outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`,
|
||||||
|
...override,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const jisonPlugin = {
|
const jisonPlugin = {
|
||||||
|
11
package.json
11
package.json
@@ -23,12 +23,12 @@
|
|||||||
"git graph"
|
"git graph"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:fast": "rm -rf dist; node .esbuild/esbuild.cjs; tsc --emitDeclarationOnly",
|
"clean": "rimraf dist",
|
||||||
"build:dev": "webpack --mode development --progress --color",
|
"build:code": "node .esbuild/esbuild.cjs",
|
||||||
"build:prod": "webpack --mode production --progress --color",
|
"build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly",
|
||||||
"build": "concurrently \"yarn build:dev\" \"yarn build:prod\"",
|
"build": "yarn clean; concurrently \"yarn build:code\" \"yarn build:types\"",
|
||||||
"postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > docs/Setup.md",
|
"postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > docs/Setup.md",
|
||||||
"build:watch": "yarn build:dev --watch",
|
"build:watch": "yarn build:code --watch",
|
||||||
"release": "yarn build",
|
"release": "yarn build",
|
||||||
"lint": "eslint --cache ./ --ext .js,.json,.html,.md",
|
"lint": "eslint --cache ./ --ext .js,.json,.html,.md",
|
||||||
"lint:fix": "yarn lint --fix",
|
"lint:fix": "yarn lint --fix",
|
||||||
@@ -114,6 +114,7 @@
|
|||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
"prettier-plugin-jsdoc": "^0.3.30",
|
"prettier-plugin-jsdoc": "^0.3.30",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
"start-server-and-test": "^1.12.6",
|
"start-server-and-test": "^1.12.6",
|
||||||
"terser-webpack-plugin": "^5.3.6",
|
"terser-webpack-plugin": "^5.3.6",
|
||||||
"ts-jest": "^28.0.8",
|
"ts-jest": "^28.0.8",
|
||||||
|
@@ -271,7 +271,7 @@ document
|
|||||||
{ $$ = [];}
|
{ $$ = [];}
|
||||||
| document line
|
| document line
|
||||||
{
|
{
|
||||||
if($2 !== []){
|
if(Array.isArray($2) && $2.length > 0){
|
||||||
$1.push($2);
|
$1.push($2);
|
||||||
}
|
}
|
||||||
$$=$1;}
|
$$=$1;}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||||
|
|
||||||
/* Projects */
|
/* Projects */
|
||||||
"incremental": true /* Enable incremental compilation */,
|
// "incremental": true /* Enable incremental compilation */,
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
// "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": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
||||||
|
Reference in New Issue
Block a user