Elian Doran 178903f6b2 Add '_regroup/ckeditor5-mermaid/' from commit 'c15257da7e57b6303fda9744ee4153d1c5311d6f'
git-subtree-dir: _regroup/ckeditor5-mermaid
git-subtree-mainline: 90c0f417131d254e86a4a4ab391122cad0930db7
git-subtree-split: c15257da7e57b6303fda9744ee4153d1c5311d6f
2025-05-04 15:23:12 +03:00

62 lines
1.2 KiB
JavaScript

#!/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'
]
} );
} )();