diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 54% rename from .eslintrc.js rename to .eslintrc.cjs index 96255cb44..d39acda4f 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -5,12 +5,28 @@ module.exports = { extends: 'ckeditor5', root: true, + ignorePatterns: [ + // Ignore the entire `build/` (the DLL build). + 'build/**', + // Ignore the entire `dist/`. + 'dist/**' + ], rules: { // This rule disallows importing core DLL packages directly. Imports should be done using the `ckeditor5` package. // Also, importing non-DLL packages is not allowed. If the package requires other features to work, they should be // specified as soft-requirements. // Read more: https://ckeditor.com/docs/ckeditor5/latest/builds/guides/migration/migration-to-26.html#soft-requirements. - 'ckeditor5-rules/ckeditor-imports': 'error' + 'ckeditor5-rules/ckeditor-imports': 'error', + // This rule disallows importing from any path other than the package main entrypoint. + 'ckeditor5-rules/allow-imports-only-from-main-package-entry-point': 'error', + // As required by the ECMAScript (ESM) standard, all imports must include a file extension. + // If the import does not include it, this rule will try to automatically detect the correct file extension. + 'ckeditor5-rules/require-file-extensions-in-imports': [ + 'error', + { + extensions: [ '.ts', '.js', '.json' ] + } + ] }, overrides: [ { diff --git a/.gitignore b/.gitignore index 249e13209..c9c1cc85e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ .nyc_output/ coverage/ +dist/ node_modules/ yarn.lock tmp/ build/ -yarn.error \ No newline at end of file +yarn.error diff --git a/package.json b/package.json index cdd584bb2..1babb1ed1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ckeditor/ckeditor5-mermaid", - "version": "0.0.2", + "version": "0.0.3", "description": "Mermaid widget for CKEditor 5.", "private": true, "keywords": [ @@ -11,16 +11,18 @@ "ckeditor5-plugin", "ckeditor5-mermaid" ], + "type": "module", "main": "src/index.js", "license": "SEE LICENSE IN LICENSE.md", "author": "CKSource (https://cksource.com/)", "homepage": "https://github.com/ckeditor/ckeditor5-mermaid", "bugs": "https://github.com/ckeditor/ckeditor5-mermaid/issues", "engines": { - "node": ">=14.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ + "dist", "lang", "src", "theme", @@ -28,47 +30,34 @@ "ckeditor5-metadata.json" ], "dependencies": { - "mermaid": "9.1.7", + "mermaid": "^9.1.4", "lodash-es": "^4.17.15" }, - "peerDependencies": { - "ckeditor5": "*" - }, "devDependencies": { - "@ckeditor/ckeditor5-basic-styles": "^35.0.1", - "@ckeditor/ckeditor5-clipboard": "^35.0.1", - "@ckeditor/ckeditor5-code-block": "^35.0.1", - "@ckeditor/ckeditor5-editor-classic": "^35.0.1", - "@ckeditor/ckeditor5-engine": "^35.0.1", - "@ckeditor/ckeditor5-enter": "^35.0.1", - "@ckeditor/ckeditor5-essentials": "^35.0.1", - "@ckeditor/ckeditor5-heading": "^35.0.1", + "@ckeditor/ckeditor5-dev-build-tools": "^40.2.0", "@ckeditor/ckeditor5-inspector": "^4.0.0", - "@ckeditor/ckeditor5-link": "^35.0.1", - "@ckeditor/ckeditor5-markdown-gfm": "^35.0.1", - "@ckeditor/ckeditor5-paragraph": "^35.0.1", - "@ckeditor/ckeditor5-typing": "^35.0.1", - "@ckeditor/ckeditor5-undo": "^35.0.1", - "@ckeditor/ckeditor5-widget": "^35.0.1", - "@ckeditor/ckeditor5-package-tools": "^1.0.0-beta.4", - "@ckeditor/ckeditor5-theme-lark": "^35.0.1", + "@ckeditor/ckeditor5-package-tools": "^2.0.0", + "ckeditor5": "latest", "eslint": "^7.32.0", - "eslint-config-ckeditor5": ">=3.1.1", + "eslint-config-ckeditor5": "^6.0.0", "http-server": "^14.1.0", "husky": "^4.2.5", "lint-staged": "^10.2.6", "stylelint": "^13.13.1", "stylelint-config-ckeditor5": ">=2.0.1" }, - + "peerDependencies": { + "ckeditor5": ">=42.0.0 || ^0.0.0-nightly" + }, "scripts": { "dll:build": "ckeditor5-package-tools dll:build", - "dll:serve": "http-server ./ -o sample/dll.html", + "dll:serve": "http-server ./ -o sample/index.html", + "build:dist": "node ./scripts/build-dist.mjs", "lint": "eslint \"**/*.js\" --quiet --ignore-pattern \"build/\"", "start": "ckeditor5-package-tools start", "stylelint": "stylelint --quiet --allow-empty-input 'theme/*.css'", "test": "ckeditor5-package-tools test", - "prepare": "yarn run dll:build", + "prepare": "yarn run dll:build && yarn run build:dist", "prepublishOnly": "yarn run dll:build", "translations:collect": "ckeditor5-package-tools translations:collect", "translations:download": "ckeditor5-package-tools translations:download", diff --git a/sample/ckeditor.js b/sample/ckeditor.js index 288d3229b..623196c31 100644 --- a/sample/ckeditor.js +++ b/sample/ckeditor.js @@ -5,19 +5,19 @@ /* globals console, window, document */ -import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; -import Typing from '@ckeditor/ckeditor5-typing/src/typing'; -import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; -import Undo from '@ckeditor/ckeditor5-undo/src/undo'; -import Enter from '@ckeditor/ckeditor5-enter/src/enter'; -import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; -import Link from '@ckeditor/ckeditor5-link/src/link'; -import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'; -import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'; +import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic'; +import { Typing } from '@ckeditor/ckeditor5-typing'; +import { Paragraph } from '@ckeditor/ckeditor5-paragraph'; +import { Undo } from '@ckeditor/ckeditor5-undo'; +import { Enter } from '@ckeditor/ckeditor5-enter'; +import { Clipboard } from '@ckeditor/ckeditor5-clipboard'; +import { Link } from '@ckeditor/ckeditor5-link'; +import { Bold, Italic } from '@ckeditor/ckeditor5-basic-styles'; +import { CodeBlock } from '@ckeditor/ckeditor5-code-block'; + import CKEditorInspector from '@ckeditor/ckeditor5-inspector'; -import CodeBlock from '@ckeditor/ckeditor5-code-block/src/codeblock'; -import Mermaid from '../src/mermaid'; +import Mermaid from '../src/mermaid.js'; ClassicEditor .create( document.querySelector( '#editor' ), { diff --git a/sample/index.html b/sample/index.html index e48cbba5c..7b8ac8fd3 100644 --- a/sample/index.html +++ b/sample/index.html @@ -17,6 +17,103 @@