Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration reflected from ckeditor5-package-generator to support only NIM. #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ module.exports = {
'ckeditor5-rules/ckeditor-imports': 'off'
}
}
],
ignorePatterns: [
'dist/**'
]
};
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ coverage/
node_modules/
yarn.lock
tmp/
build/
yarn.error
dist/
yarn.error
50 changes: 20 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,39 @@
"ckeditor5-plugin",
"ckeditor5-mermaid"
],
"main": "src/index.js",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js"
},
"./translations/*.js": {
"import": "./dist/translations/*.js"
},
"./*.css": "./dist/*.css",
"./package.json": "./package.json"
},
"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": [
"lang",
"src",
"theme",
"build",
"ckeditor5-metadata.json"
"dist"
],
"dependencies": {
"mermaid": "9.1.7",
"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.0.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": "^1.1.0",
"ckeditor5": "nightly",
"eslint": "^7.32.0",
"eslint-config-ckeditor5": ">=3.1.1",
"http-server": "^14.1.0",
Expand All @@ -62,14 +54,12 @@
},

"scripts": {
"dll:build": "ckeditor5-package-tools dll:build",
"dll:serve": "http-server ./ -o sample/dll.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",
"prepublishOnly": "yarn run dll:build",
"prepare": "yarn run build:dist",
"translations:collect": "ckeditor5-package-tools translations:collect",
"translations:download": "ckeditor5-package-tools translations:download",
"translations:upload": "ckeditor5-package-tools translations:upload"
Expand Down
27 changes: 16 additions & 11 deletions sample/ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@

/* 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,
Typing,
Undo,
Enter,
Clipboard,
Link,
Bold,
Italic,
Paragraph,
CodeBlock
} from 'ckeditor5';

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';

import 'ckeditor5/index.css';

ClassicEditor
.create( document.querySelector( '#editor' ), {
Expand Down
61 changes: 61 additions & 0 deletions scripts/build-dist.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env node

/**
* @license Copyright (c) 2020-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/

/* eslint-env node */

import { createRequire } from 'module';
import upath from 'upath';
import chalk from 'chalk';
import { build } from '@ckeditor/ckeditor5-dev-build-tools';

function dist( path ) {
return upath.join( 'dist', path );
}

( async () => {
/**
* Step 1
*/
console.log( chalk.cyan( '1/2: Generating NPM build...' ) );

const require = createRequire( import.meta.url );
const pkg = require( upath.resolve( process.cwd(), './package.json' ) );

await build( {
input: 'src/index.js',
output: dist( './index.js' ),
external: [
'ckeditor5',
'ckeditor5-premium-features',
...Object.keys( {
...pkg.dependencies,
...pkg.peerDependencies
} )
],
clean: true,
sourceMap: true,
translations: '**/*.po'
} );

/**
* Step 2
*/
console.log( chalk.cyan( '2/2: Generating browser build...' ) );

await build( {
input: 'src/index.js',
output: dist( 'browser/index.js' ),
sourceMap: true,
minify: true,
browser: true,
name: '@ckeditor/ckeditor5-mermaid',
external: [
'ckeditor5',
'ckeditor5-premium-features'
]
} );
} )();
2 changes: 1 addition & 1 deletion src/commands/insertMermaidCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @module mermaid/insertmermaidcommand
*/

import { Command } from 'ckeditor5/src/core';
import { Command } from 'ckeditor5';

const MOCK_MERMAID_MARKUP = `flowchart TB
A --> B
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mermaidPreviewCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @module mermaid/mermaidpreviewcommand
*/

import { Command } from 'ckeditor5/src/core';
import { Command } from 'ckeditor5';

import { checkIsOn } from '../utils';
import { checkIsOn } from '../utils.js';

/**
* The mermaid preview command.
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mermaidSourceViewCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @module mermaid/mermaidsourceviewcommand
*/

import { Command } from 'ckeditor5/src/core';
import { Command } from 'ckeditor5';

import { checkIsOn } from '../utils';
import { checkIsOn } from '../utils.js';

/**
* The mermaid source view command.
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mermaidSplitViewCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @module mermaid/mermaidsplitviewcommand
*/

import { Command } from 'ckeditor5/src/core';
import { Command } from 'ckeditor5';

import { checkIsOn } from '../utils';
import { checkIsOn } from '../utils.js';

/**
* The mermaid split view command.
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import previewModeIcon from './../theme/icons/preview-mode.svg';
import splitModeIcon from './../theme/icons/split-mode.svg';
import sourceModeIcon from './../theme/icons/source-mode.svg';

export { default as Mermaid } from './mermaid';
export { default as Mermaid } from './mermaid.js';

export const icons = {
infoIcon,
Expand Down
8 changes: 4 additions & 4 deletions src/mermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* @module mermaid/mermaid
*/

import { Plugin } from 'ckeditor5/src/core';
import { Plugin } from 'ckeditor5';

import MermaidEditing from './mermaidediting';
import MermaidToolbar from './mermaidtoolbar';
import MermaidUI from './mermaidui';
import MermaidEditing from './mermaidediting.js';
import MermaidToolbar from './mermaidtoolbar.js';
import MermaidUI from './mermaidui.js';

import '../theme/mermaid.css';

Expand Down
13 changes: 6 additions & 7 deletions src/mermaidediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
* @module mermaid/mermaidediting
*/

import { Plugin } from 'ckeditor5/src/core';
import { toWidget } from 'ckeditor5/src/widget';
import { Plugin, toWidget } from 'ckeditor5';

import mermaid from 'mermaid/dist/mermaid';
import mermaid from 'mermaid/dist/mermaid.js';

import { debounce } from 'lodash-es';

import MermaidPreviewCommand from './commands/mermaidPreviewCommand';
import MermaidSourceViewCommand from './commands/mermaidSourceViewCommand';
import MermaidSplitViewCommand from './commands/mermaidSplitViewCommand';
import InsertMermaidCommand from './commands/insertMermaidCommand';
import MermaidPreviewCommand from './commands/mermaidPreviewCommand.js';
import MermaidSourceViewCommand from './commands/mermaidSourceViewCommand.js';
import MermaidSplitViewCommand from './commands/mermaidSplitViewCommand.js';
import InsertMermaidCommand from './commands/insertMermaidCommand.js';

// Time in milliseconds.
const DEBOUNCE_TIME = 300;
Expand Down
3 changes: 1 addition & 2 deletions src/mermaidtoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* @module mermaid/mermaidtoolbar
*/

import { Plugin } from 'ckeditor5/src/core';
import { WidgetToolbarRepository } from 'ckeditor5/src/widget';
import { Plugin, WidgetToolbarRepository } from 'ckeditor5';

export default class MermaidToolbar extends Plugin {
/**
Expand Down
3 changes: 1 addition & 2 deletions src/mermaidui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* @module mermaid/mermaidui
*/

import { Plugin } from 'ckeditor5/src/core';
import { ButtonView } from 'ckeditor5/src/ui';
import { ButtonView, Plugin } from 'ckeditor5';

import insertMermaidIcon from '../theme/icons/insert.svg';
import previewModeIcon from '../theme/icons/preview-mode.svg';
Expand Down
15 changes: 9 additions & 6 deletions tests/commands/insertMermaidCommand.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { Paragraph } from '@ckeditor/ckeditor5-paragraph';

import InsertMermaidCommand from '../../src/commands/insertMermaidCommand';
import MermaidEditing from '../../src/mermaidediting';
import {
ClassicEditor,
Paragraph,
_setModelData as setModelData,
_getModelData as getModelData
} from 'ckeditor5';

import InsertMermaidCommand from '../../src/commands/insertMermaidCommand.js';
import MermaidEditing from '../../src/mermaidediting.js';

/* global document */

Expand Down
15 changes: 9 additions & 6 deletions tests/commands/mermaidPreviewCommand.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { Paragraph } from '@ckeditor/ckeditor5-paragraph';

import MermaidPreviewCommand from '../../src/commands/mermaidPreviewCommand';
import MermaidEditing from '../../src/mermaidediting';
import {
ClassicEditor,
Paragraph,
_setModelData as setModelData,
_getModelData as getModelData
} from 'ckeditor5';

import MermaidPreviewCommand from '../../src/commands/mermaidPreviewCommand.js';
import MermaidEditing from '../../src/mermaidediting.js';

/* global document */

Expand Down
15 changes: 9 additions & 6 deletions tests/commands/mermaidSourceViewCommand.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { Paragraph } from '@ckeditor/ckeditor5-paragraph';

import MermaidSourceViewCommand from '../../src/commands/mermaidSourceViewCommand';
import MermaidEditing from '../../src/mermaidediting';
import {
ClassicEditor,
Paragraph,
_setModelData as setModelData,
_getModelData as getModelData
} from 'ckeditor5';

import MermaidSourceViewCommand from '../../src/commands/mermaidSourceViewCommand.js';
import MermaidEditing from '../../src/mermaidediting.js';

/* global document */

Expand Down
15 changes: 9 additions & 6 deletions tests/commands/mermaidSplitViewCommand.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { Paragraph } from '@ckeditor/ckeditor5-paragraph';

import MermaidSplitViewCommand from '../../src/commands/mermaidSplitViewCommand';
import MermaidEditing from '../../src/mermaidediting';
import {
ClassicEditor,
Paragraph,
_setModelData as setModelData,
_getModelData as getModelData
} from 'ckeditor5';

import MermaidSplitViewCommand from '../../src/commands/mermaidSplitViewCommand.js';
import MermaidEditing from '../../src/mermaidediting.js';

/* global document */

Expand Down
4 changes: 2 additions & 2 deletions tests/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Mermaid as MermaidDll, icons } from '../src';
import Mermaid from '../src/mermaid';
import { Mermaid as MermaidDll, icons } from '../src/index.js';
import Mermaid from '../src/mermaid.js';

import infoIcon from './../theme/icons/info.svg';
import insertMermaidIcon from './../theme/icons/insert.svg';
Expand Down
Loading