mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-04 12:54:08 +01:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			180dc7bdff
			...
			sidv/runCo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					84a2bf1b58 | ||
| 
						 | 
					ef28eb8be1 | ||
| 
						 | 
					c78573d9aa | ||
| 
						 | 
					1aeef62db1 | ||
| 
						 | 
					d639d5bdc9 | 
@@ -82,8 +82,8 @@ export function generateDefaults(mermaidConfigSchema: JSONSchemaType<MermaidConf
 | 
			
		||||
        `schema for subconfig ${key} does not have valid defaults! Errors were ${JSON.stringify(
 | 
			
		||||
          validate.errors,
 | 
			
		||||
          undefined,
 | 
			
		||||
          2
 | 
			
		||||
        )}`
 | 
			
		||||
          2,
 | 
			
		||||
        )}`,
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@@ -95,8 +95,8 @@ export function generateDefaults(mermaidConfigSchema: JSONSchemaType<MermaidConf
 | 
			
		||||
      `Mermaid config JSON Schema does not have valid defaults! Errors were ${JSON.stringify(
 | 
			
		||||
        validate.errors,
 | 
			
		||||
        undefined,
 | 
			
		||||
        2
 | 
			
		||||
      )}`
 | 
			
		||||
        2,
 | 
			
		||||
      )}`,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ const buildPackage = async (entryName: keyof typeof packageOptions) => {
 | 
			
		||||
      // mermaid.js
 | 
			
		||||
      { ...iifeOptions },
 | 
			
		||||
      // mermaid.min.js
 | 
			
		||||
      { ...iifeOptions, minify: true, metafile: shouldVisualize }
 | 
			
		||||
      { ...iifeOptions, minify: true, metafile: shouldVisualize },
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import { context } from 'esbuild';
 | 
			
		||||
import chokidar from 'chokidar';
 | 
			
		||||
 | 
			
		||||
const mermaidCtx = await context(
 | 
			
		||||
  getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid' })
 | 
			
		||||
  getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid' }),
 | 
			
		||||
);
 | 
			
		||||
const mermaidIIFECtx = await context(
 | 
			
		||||
  getBuildConfig({
 | 
			
		||||
@@ -15,7 +15,7 @@ const mermaidIIFECtx = await context(
 | 
			
		||||
    core: false,
 | 
			
		||||
    entryName: 'mermaid',
 | 
			
		||||
    format: 'iife',
 | 
			
		||||
  })
 | 
			
		||||
  }),
 | 
			
		||||
);
 | 
			
		||||
const externalCtx = await context(
 | 
			
		||||
  getBuildConfig({
 | 
			
		||||
@@ -23,10 +23,10 @@ const externalCtx = await context(
 | 
			
		||||
    minify: false,
 | 
			
		||||
    core: false,
 | 
			
		||||
    entryName: 'mermaid-example-diagram',
 | 
			
		||||
  })
 | 
			
		||||
  }),
 | 
			
		||||
);
 | 
			
		||||
const zenumlCtx = await context(
 | 
			
		||||
  getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid-zenuml' })
 | 
			
		||||
  getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid-zenuml' }),
 | 
			
		||||
);
 | 
			
		||||
const contexts = [mermaidCtx, mermaidIIFECtx, externalCtx, zenumlCtx];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
 | 
			
		||||
 | 
			
		||||
  if (core) {
 | 
			
		||||
    const { dependencies } = JSON.parse(
 | 
			
		||||
      readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8')
 | 
			
		||||
      readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8'),
 | 
			
		||||
    );
 | 
			
		||||
    // Core build is used to generate file without bundled dependencies.
 | 
			
		||||
    // This is used by downstream projects to bundle dependencies themselves.
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,8 @@ module.exports = {
 | 
			
		||||
    'no-prototype-builtins': 'off',
 | 
			
		||||
    'no-unused-vars': 'off',
 | 
			
		||||
    'cypress/no-async-tests': 'off',
 | 
			
		||||
    '@typescript-eslint/no-unused-vars': 'warn',
 | 
			
		||||
    '@typescript-eslint/no-explicit-any': 'warn',
 | 
			
		||||
    '@typescript-eslint/no-floating-promises': 'error',
 | 
			
		||||
    '@typescript-eslint/no-misused-promises': 'error',
 | 
			
		||||
    '@typescript-eslint/ban-ts-comment': [
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							@@ -30,7 +30,7 @@ jobs:
 | 
			
		||||
      # Install NPM dependencies, cache them correctly
 | 
			
		||||
      # and run all Cypress tests
 | 
			
		||||
      - name: Cypress run
 | 
			
		||||
        uses: cypress-io/github-action@v4
 | 
			
		||||
        uses: cypress-io/github-action@v6
 | 
			
		||||
        id: cypress
 | 
			
		||||
        # If CYPRESS_RECORD_KEY is set, run in parallel on all containers
 | 
			
		||||
        # Otherwise (e.g. if running from fork), we run on a single container only
 | 
			
		||||
@@ -44,14 +44,19 @@ jobs:
 | 
			
		||||
          parallel: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
 | 
			
		||||
        env:
 | 
			
		||||
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
 | 
			
		||||
          VITEST_COVERAGE: true
 | 
			
		||||
          VITE_COVERAGE: true
 | 
			
		||||
          CYPRESS_COVERAGE: true
 | 
			
		||||
          CYPRESS_COMMIT: ${{ github.sha }}
 | 
			
		||||
 | 
			
		||||
      - name: Check coverage files
 | 
			
		||||
        run: |
 | 
			
		||||
          ls -lh ./coverage
 | 
			
		||||
          ls -lh ./coverage/cypress
 | 
			
		||||
 | 
			
		||||
      - name: Upload Coverage to Codecov
 | 
			
		||||
        uses: codecov/codecov-action@v3
 | 
			
		||||
        # Run step only pushes to develop and pull_requests
 | 
			
		||||
        if: ${{ steps.cypress.conclusion == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/develop')}}
 | 
			
		||||
        with:
 | 
			
		||||
          files: coverage/cypress/lcov.info
 | 
			
		||||
          files: ./coverage/cypress/lcov.info
 | 
			
		||||
          flags: e2e
 | 
			
		||||
          name: mermaid-codecov
 | 
			
		||||
          fail_ci_if_error: false
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							@@ -43,8 +43,6 @@ jobs:
 | 
			
		||||
 | 
			
		||||
      - name: Upload Coverage to Codecov
 | 
			
		||||
        uses: codecov/codecov-action@v3
 | 
			
		||||
        # Run step only pushes to develop and pull_requests
 | 
			
		||||
        if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
 | 
			
		||||
        with:
 | 
			
		||||
          files: ./coverage/vitest/lcov.info
 | 
			
		||||
          flags: unit
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ const visualizerOptions = (packageName: string, core = false): PluginOption[] =>
 | 
			
		||||
        template: chartType as TemplateType,
 | 
			
		||||
        gzipSize: true,
 | 
			
		||||
        brotliSize: true,
 | 
			
		||||
      }) as PluginOption
 | 
			
		||||
      }) as PluginOption,
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html>
 | 
			
		||||
  <head>
 | 
			
		||||
    <meta charset="utf-8" />
 | 
			
		||||
 
 | 
			
		||||
@@ -139,6 +139,6 @@ if (typeof document !== 'undefined') {
 | 
			
		||||
        void contentLoaded().finally(markRendered);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    false
 | 
			
		||||
    false,
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <meta charset="utf-8" />
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								package.json
									
									
									
									
									
								
							@@ -60,37 +60,37 @@
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@applitools/eyes-cypress": "^3.33.1",
 | 
			
		||||
    "@applitools/eyes-cypress": "^3.37.0",
 | 
			
		||||
    "@commitlint/cli": "^17.6.1",
 | 
			
		||||
    "@commitlint/config-conventional": "^17.6.1",
 | 
			
		||||
    "@cspell/eslint-plugin": "^6.31.1",
 | 
			
		||||
    "@cypress/code-coverage": "^3.10.7",
 | 
			
		||||
    "@rollup/plugin-typescript": "^11.1.1",
 | 
			
		||||
    "@cspell/eslint-plugin": "^7.0.1",
 | 
			
		||||
    "@cypress/code-coverage": "^3.11.0",
 | 
			
		||||
    "@rollup/plugin-typescript": "^11.1.2",
 | 
			
		||||
    "@types/cors": "^2.8.13",
 | 
			
		||||
    "@types/eslint": "^8.37.0",
 | 
			
		||||
    "@types/eslint": "^8.44.2",
 | 
			
		||||
    "@types/express": "^4.17.17",
 | 
			
		||||
    "@types/js-yaml": "^4.0.5",
 | 
			
		||||
    "@types/jsdom": "^21.1.1",
 | 
			
		||||
    "@types/lodash": "^4.14.194",
 | 
			
		||||
    "@types/mdast": "^3.0.11",
 | 
			
		||||
    "@types/node": "^18.16.0",
 | 
			
		||||
    "@types/prettier": "^2.7.2",
 | 
			
		||||
    "@types/prettier": "^3.0.0",
 | 
			
		||||
    "@types/rollup-plugin-visualizer": "^4.2.1",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^5.59.0",
 | 
			
		||||
    "@typescript-eslint/parser": "^5.59.0",
 | 
			
		||||
    "@vitest/coverage-v8": "^0.34.0",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^6.4.1",
 | 
			
		||||
    "@typescript-eslint/parser": "^6.4.1",
 | 
			
		||||
    "@vitest/coverage-v8": "^0.34.2",
 | 
			
		||||
    "@vitest/spy": "^0.34.0",
 | 
			
		||||
    "@vitest/ui": "^0.34.0",
 | 
			
		||||
    "ajv": "^8.12.0",
 | 
			
		||||
    "chokidar": "^3.5.3",
 | 
			
		||||
    "concurrently": "^8.0.1",
 | 
			
		||||
    "cors": "^2.8.5",
 | 
			
		||||
    "cypress": "^12.10.0",
 | 
			
		||||
    "cypress": "^12.17.4",
 | 
			
		||||
    "cypress-image-snapshot": "^4.0.1",
 | 
			
		||||
    "esbuild": "^0.19.0",
 | 
			
		||||
    "eslint": "^8.39.0",
 | 
			
		||||
    "eslint-config-prettier": "^8.8.0",
 | 
			
		||||
    "eslint-plugin-cypress": "^2.13.2",
 | 
			
		||||
    "esbuild": "^0.19.2",
 | 
			
		||||
    "eslint": "^8.47.0",
 | 
			
		||||
    "eslint-config-prettier": "^9.0.0",
 | 
			
		||||
    "eslint-plugin-cypress": "^2.14.0",
 | 
			
		||||
    "eslint-plugin-html": "^7.1.0",
 | 
			
		||||
    "eslint-plugin-jest": "^27.2.1",
 | 
			
		||||
    "eslint-plugin-jsdoc": "^46.0.0",
 | 
			
		||||
@@ -111,16 +111,16 @@
 | 
			
		||||
    "nyc": "^15.1.0",
 | 
			
		||||
    "path-browserify": "^1.0.1",
 | 
			
		||||
    "pnpm": "^8.6.8",
 | 
			
		||||
    "prettier": "^2.8.8",
 | 
			
		||||
    "prettier": "^3.0.2",
 | 
			
		||||
    "prettier-plugin-jsdoc": "^0.4.2",
 | 
			
		||||
    "rimraf": "^5.0.0",
 | 
			
		||||
    "rollup-plugin-visualizer": "^5.9.2",
 | 
			
		||||
    "start-server-and-test": "^2.0.0",
 | 
			
		||||
    "ts-node": "^10.9.1",
 | 
			
		||||
    "typescript": "^5.1.3",
 | 
			
		||||
    "vite": "^4.3.9",
 | 
			
		||||
    "vite-plugin-istanbul": "^4.1.0",
 | 
			
		||||
    "vitest": "^0.34.0"
 | 
			
		||||
    "typescript": "^5.1.6",
 | 
			
		||||
    "vite": "^4.4.9",
 | 
			
		||||
    "vite-plugin-istanbul": "^5.0.0",
 | 
			
		||||
    "vitest": "^0.34.2"
 | 
			
		||||
  },
 | 
			
		||||
  "volta": {
 | 
			
		||||
    "node": "18.17.1"
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,7 @@ import _Ajv2019, { type JSONSchemaType } from 'ajv/dist/2019.js';
 | 
			
		||||
 | 
			
		||||
// Workaround for wrong AJV types, see
 | 
			
		||||
// https://github.com/ajv-validator/ajv/issues/2132#issuecomment-1290409907
 | 
			
		||||
// @ts-ignore Incorrect types
 | 
			
		||||
const Ajv2019 = _Ajv2019 as unknown as typeof _Ajv2019.default;
 | 
			
		||||
 | 
			
		||||
// !!! -- The config.type.js file is created by this script -- !!!
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1557
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1557
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -5,20 +5,24 @@
 | 
			
		||||
 * (i.e. the root of the Mermaid project).
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import { readFileSync, writeFileSync } from 'node:fs';
 | 
			
		||||
import { readFile, writeFile } from 'node:fs/promises';
 | 
			
		||||
import prettier from 'prettier';
 | 
			
		||||
 | 
			
		||||
const filepath = './cSpell.json';
 | 
			
		||||
const cSpell: { words: string[] } = JSON.parse(readFileSync(filepath, 'utf8'));
 | 
			
		||||
const main = async () => {
 | 
			
		||||
  const filepath = './cSpell.json';
 | 
			
		||||
  const cSpell: { words: string[] } = JSON.parse(await readFile(filepath, 'utf8'));
 | 
			
		||||
 | 
			
		||||
cSpell.words = [...new Set(cSpell.words.map((word) => word.toLowerCase()))];
 | 
			
		||||
cSpell.words.sort((a, b) => a.localeCompare(b));
 | 
			
		||||
  cSpell.words = [...new Set(cSpell.words.map((word) => word.toLowerCase()))];
 | 
			
		||||
  cSpell.words.sort((a, b) => a.localeCompare(b));
 | 
			
		||||
 | 
			
		||||
const prettierConfig = prettier.resolveConfig.sync(filepath) ?? {};
 | 
			
		||||
writeFileSync(
 | 
			
		||||
  filepath,
 | 
			
		||||
  prettier.format(JSON.stringify(cSpell), {
 | 
			
		||||
    ...prettierConfig,
 | 
			
		||||
  const prettierConfig = (await prettier.resolveConfig(filepath)) ?? {};
 | 
			
		||||
  await writeFile(
 | 
			
		||||
    filepath,
 | 
			
		||||
  })
 | 
			
		||||
);
 | 
			
		||||
    await prettier.format(JSON.stringify(cSpell), {
 | 
			
		||||
      ...prettierConfig,
 | 
			
		||||
      filepath,
 | 
			
		||||
    }),
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void main();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user