-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
2,869 additions
and
160,485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Update Browserslist | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: npx browserslist@latest --update-db | ||
- name: Commit changes | ||
uses: EndBug/add-and-commit@v7 | ||
with: | ||
author_name: ${{ github.actor }} | ||
author_email: ${{ github.actor }}@users.noreply.github.com | ||
message: 'Update Browserslist' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn dlx lint-staged | ||
yarn pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"*": [ | ||
"*.{js,html,md}": [ | ||
"yarn lint:fix" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { merge, mergeWithCustomize, customizeObject } from 'webpack-merge'; | ||
import nodeExternals from 'webpack-node-externals'; | ||
import baseConfig from './webpack.config.base'; | ||
|
||
export default (_env, args) => { | ||
switch (args.mode) { | ||
case 'development': | ||
return [ | ||
baseConfig, | ||
merge(baseConfig, { | ||
externals: [nodeExternals()], | ||
output: { | ||
filename: '[name].core.js', | ||
}, | ||
}), | ||
]; | ||
case 'production': | ||
return [ | ||
// umd | ||
merge(baseConfig, { | ||
output: { | ||
filename: '[name].min.js', | ||
}, | ||
}), | ||
// esm | ||
mergeWithCustomize({ | ||
customizeObject: customizeObject({ | ||
'output.library': 'replace', | ||
}), | ||
})(baseConfig, { | ||
experiments: { | ||
outputModule: true, | ||
}, | ||
output: { | ||
library: { | ||
type: 'module', | ||
}, | ||
filename: '[name].esm.min.mjs', | ||
}, | ||
}), | ||
]; | ||
default: | ||
throw new Error('No matching configuration was found!'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import path from 'path'; | ||
|
||
export const resolveRoot = (...relativePath) => path.resolve(__dirname, '..', ...relativePath); | ||
|
||
export default { | ||
amd: false, // https://github.com/lodash/lodash/issues/3052 | ||
target: 'web', | ||
entry: { | ||
mermaid: './src/mermaid.js', | ||
}, | ||
resolve: { | ||
extensions: ['.wasm', '.mjs', '.js', '.json', '.jison'], | ||
fallback: { | ||
fs: false, // jison generated code requires 'fs' | ||
path: require.resolve('path-browserify'), | ||
}, | ||
}, | ||
output: { | ||
path: resolveRoot('./dist'), | ||
filename: '[name].js', | ||
library: { | ||
name: 'mermaid', | ||
type: 'umd', | ||
export: 'default', | ||
}, | ||
globalObject: 'typeof self !== "undefined" ? self : this', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
include: [resolveRoot('./src'), resolveRoot('./node_modules/dagre-d3-renderer/lib')], | ||
use: { | ||
loader: 'babel-loader', | ||
}, | ||
}, | ||
{ | ||
// load scss to string | ||
test: /\.scss$/, | ||
use: ['css-to-string-loader', 'css-loader', 'sass-loader'], | ||
}, | ||
{ | ||
test: /\.jison$/, | ||
use: { | ||
loader: path.resolve(__dirname, './loaders/jison.js'), | ||
options: { | ||
'token-stack': true, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
devtool: 'source-map', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import baseConfig, { resolveRoot } from './webpack.config.base'; | ||
import { merge } from 'webpack-merge'; | ||
|
||
export default merge(baseConfig, { | ||
mode: 'development', | ||
entry: { | ||
mermaid: './src/mermaid.js', | ||
e2e: './cypress/platform/viewer.js', | ||
'bundle-test': './cypress/platform/bundle-test.js', | ||
}, | ||
output: { | ||
globalObject: 'window', | ||
}, | ||
devServer: { | ||
compress: true, | ||
port: 9000, | ||
static: [ | ||
{ directory: resolveRoot('cypress', 'platform') }, | ||
{ directory: resolveRoot('dist') }, | ||
{ directory: resolveRoot('demos') }, | ||
], | ||
}, | ||
externals: { | ||
mermaid: 'mermaid', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
}, | ||
}, | ||
], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.