From 9aa22631021cc9f01b9bf05453e24b41a5e73f0e Mon Sep 17 00:00:00 2001 From: slaveeks Date: Fri, 5 May 2023 15:16:23 +0300 Subject: [PATCH 1/4] Removed ability to install packages from npm, using cdn by default --- dev-stand/src/templates/stand-template.js | 2 +- package.json | 8 +- setup/Stand/Stand.ts | 57 ++++- setup/index.ts | 29 +-- setup/types/config.ts | 5 +- setup/types/editorjs/Core.ts | 5 +- setup/types/editorjs/InstallableTool.ts | 84 +++++--- setup/types/editorjs/Plugin.ts | 8 +- setup/utils/FileData.ts | 24 +++ setup/utils/PackageInstaller.ts | 91 -------- yarn.lock | 251 +++++++++++++++++++--- 11 files changed, 375 insertions(+), 189 deletions(-) delete mode 100644 setup/utils/PackageInstaller.ts diff --git a/dev-stand/src/templates/stand-template.js b/dev-stand/src/templates/stand-template.js index 952a5d5..a4ce343 100644 --- a/dev-stand/src/templates/stand-template.js +++ b/dev-stand/src/templates/stand-template.js @@ -1,6 +1,6 @@ import config from '../editorjs.config'; import StandAPI from './src/StandAPI/StandAPI'; -import StandCreator from "./src/StandCreator/StandCreator"; +import StandCreator from './src/StandCreator/StandCreator'; // {{{ Tools }}} diff --git a/package.json b/package.json index 46f8a96..ec77b87 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,19 @@ "build" ], "scripts": { - "build": "tsc", + "copy-styles": "copyfiles -u 1 dev-stand/stand.css ./build/dev-stand/", + "copy-templates": "copyfiles -u 1 dev-stand/src/templates/* ./build/dev-stand/", + "build": "tsc && yon copy-styles && yon copy-templates", "start-stand": "vite build && vite preview", "start": "node ./build/setup/index.js && yon start-stand", + "dev-stand": "yon build && yon start", "lint": "eslint ." }, "packageManager": "yarn@3.4.1", "devDependencies": { + "@editorjs/editorjs": "2.26.5", "@types/node": "^18.15.1", + "copyfiles": "^2.4.1", "eslint": "^8.34.0", "eslint-config-codex": "^1.7.2", "typescript": "^4.9.5", @@ -22,7 +27,6 @@ }, "dependencies": { "@codexteam/icons": "^0.3.0", - "@editorjs/editorjs": "2.26.5", "esbuild": "^0.17.16", "vite": "^4.2.1", "zod": "^3.20.6" diff --git a/setup/Stand/Stand.ts b/setup/Stand/Stand.ts index 991f588..05d29e0 100644 --- a/setup/Stand/Stand.ts +++ b/setup/Stand/Stand.ts @@ -5,8 +5,8 @@ import { Plugin } from '../types/editorjs/Plugin.js'; import FileData from '../utils/FileData.js'; // Templates for html and script files -const STAND_TEMPLATE = path.resolve('./dev-stand/src/templates/stand-template.html'); -const STAND_SCRIPT_TEMPLATE = path.resolve('./dev-stand/src/templates/stand-template.js'); +const STAND_TEMPLATE = path.resolve('./build/dev-stand/src/templates/stand-template.html'); +const STAND_SCRIPT_TEMPLATE = path.resolve('./build/dev-stand/src/templates/stand-template.js'); /** * Stand is the environment for testing editor.js and its plugins @@ -62,10 +62,21 @@ export default class Stand { /** * Add plugins imports to script */ - for (let i = 0; i < plugins.length; i++) { - const toolClassName = `Tool${i}`; + for (const [index, plugin] of plugins.entries()) { - this.addImportToScript(plugins[i], toolClassName); + /** + * Check if plugin is from CDN + */ + if (plugin.sourceType === SourceType.CDN && plugin.path) { + /** + * Add plugin script to index.html + */ + this.addScript(plugin.path, false); + } else { + const toolClassName = `Tool${index}`; + + this.addImportToScript(plugin, toolClassName); + } } this.addPluginsToEditorConfig(); @@ -97,9 +108,10 @@ export default class Stand { * Add script to index.html file * * @param {string} scriptPath - script path + * @param {boolean} isModule - is script has type module */ - private addScript(scriptPath: string): void { - const script =``; + private addScript(scriptPath: string, isModule = true): void { + const script =``; this.HTMLFileData.insert(script, ''); } @@ -117,7 +129,19 @@ export default class Stand { * Set import source to tool name if source type is registry */ if (tool.sourceType === SourceType.Registry) { - importSource = tool.packageName; + /** + * Set version to latest if it is not set + */ + const version = tool.version ? `${tool.version}` : 'latest'; + + importSource = `https://cdn.skypack.dev/${tool.packageName}@${version}`; + } + + /** + * Make named import if tool has export name + */ + if (tool.exportName != 'default') { + className = `{ ${className} }`; } const str = `import ${className} from '${importSource}'`; @@ -138,16 +162,27 @@ export default class Stand { /** * Add plugins to tools object */ - for (let i = 0; i < this.plugins.length; i++) { + for (const [index, plugin] of this.plugins.entries()) { /** * Get tool key */ - const toolName = this.plugins[i].name; + const toolName = plugin.name; + + let className: string; + + /** + * Set class name to plugin export name if it is not default + */ + if (plugin.exportName != 'default') { + className = plugin.exportName; + } else { + className = `Tool${index}`; + } /** * Add tool to tools object in editorConfig */ - const data = `tools.push({ key: '${toolName}', class: Tool${i} });`; + const data = `tools.push({ key: '${toolName}', class: ${className} });`; this.JSData.insert(data, '// {{{ Tools configuration }}}'); } diff --git a/setup/index.ts b/setup/index.ts index 354ef11..59d92ba 100644 --- a/setup/index.ts +++ b/setup/index.ts @@ -1,5 +1,4 @@ import { Config } from './types/config.js'; -import { PackageInstaller } from './utils/PackageInstaller.js'; import { z } from 'zod'; import { Plugin } from './types/editorjs/Plugin.js'; import { Core } from './types/editorjs/Core.js'; @@ -14,7 +13,6 @@ class DevTools { * Development stand */ public stand: Stand; - /** * Editor.js core */ @@ -27,12 +25,6 @@ class DevTools { * Parsed 'editorjs.config.ts' */ private readonly parsedConfig: z.infer; - /** - * Util for installing packages - * - * @private - */ - private readonly installer: PackageInstaller; /** * Initiate editor.js dev tools @@ -41,32 +33,20 @@ class DevTools { */ constructor(configData: unknown) { this.parsedConfig = Config.parse(configData); - this.installer = new PackageInstaller(this.parsedConfig.setup.packageManager); this.plugins = []; /** - * Get core path, version and package name from config + * Get core path, version, package name and export name from config */ const corePath = this.parsedConfig.setup.core.path; const coreVersion = this.parsedConfig.setup.core.version; const corePackageName = this.parsedConfig.setup.core.name; + const coreExportName = this.parsedConfig.setup.core.exportName; - this.core = new Core('core', corePackageName, corePath, coreVersion); + this.core = new Core('core', coreExportName, corePackageName, corePath, coreVersion); this.addTools(); - /** - * Install core - */ - this.core.install(this.installer); - - /** - * Install all tools - */ - for (const plugin of this.plugins) { - plugin.install(this.installer); - } - this.stand = new Stand(this.core, this.plugins); } @@ -97,6 +77,7 @@ class DevTools { tool = new Plugin({ name: toolName, path: sourceConfig.path, + exportName: sourceConfig.exportName, }); } else { /** @@ -106,6 +87,7 @@ class DevTools { name: toolName, packageName: sourceConfig.name, version: sourceConfig.version, + exportName: sourceConfig.exportName, }); } } else { @@ -114,6 +96,7 @@ class DevTools { */ tool = new Plugin({ name: toolName, packageName: sourceConfig, + exportName: 'default', }); } this.plugins.push(tool); diff --git a/setup/types/config.ts b/setup/types/config.ts index 263b7b7..95e404e 100644 --- a/setup/types/config.ts +++ b/setup/types/config.ts @@ -1,5 +1,4 @@ import { z } from 'zod'; -import { PackageManager } from '../utils/packageInstaller.js'; /** * Regex for string as version @@ -12,6 +11,7 @@ const versionRegex = /(^|~)*\d+\.\d+\.\d+$/; const ToolFromRegistry = z.object({ name: z.string(), version: z.optional(z.string().regex(versionRegex)), + exportName: z.string().default('default'), }); /** @@ -19,6 +19,7 @@ const ToolFromRegistry = z.object({ */ const ToolFromPath = z.object({ path: z.string(), + exportName: z.string().default('default'), }); /** @@ -28,6 +29,7 @@ const Core = z.object({ name: z.string().default('@editorjs/editorjs'), version: z.optional(z.string().regex(versionRegex)), path: z.optional(z.string()), + exportName: z.string().default('default'), }); /** @@ -35,7 +37,6 @@ const Core = z.object({ */ const Setup = z.object({ core: Core, - packageManager: z.optional(z.nativeEnum(PackageManager)), tools: z.optional(z.record(z.string(), z.union([ToolFromRegistry, z.string(), ToolFromPath]))), }); diff --git a/setup/types/editorjs/Core.ts b/setup/types/editorjs/Core.ts index c465489..4244dd2 100644 --- a/setup/types/editorjs/Core.ts +++ b/setup/types/editorjs/Core.ts @@ -8,11 +8,12 @@ export class Core extends InstallableTool { * Initiate editor.js core * * @param {string} name - core name. + * @param {string} exportName - core export class name. * @param {string} packageName - core package name. * @param {string} path - core local or CDN path. * @param {string} version - core version in registry. */ - constructor(name: string, packageName: string, path?: string, version?: string) { - super(name, packageName, path, version); + constructor(name: string, exportName: string, packageName: string, path?: string, version?: string) { + super(name, exportName, packageName, path, version); } } \ No newline at end of file diff --git a/setup/types/editorjs/InstallableTool.ts b/setup/types/editorjs/InstallableTool.ts index ad0a354..e5f9cd9 100644 --- a/setup/types/editorjs/InstallableTool.ts +++ b/setup/types/editorjs/InstallableTool.ts @@ -1,15 +1,11 @@ -import { PackageInstaller } from '../../utils/PackageInstaller.js'; import { execSync } from 'child_process'; import * as path from 'path'; +import FileData from '../../utils/FileData.js'; /** * Enum for source type of tool */ export enum SourceType { - /** - * Tool installs from registry - */ - Registry = 'registry', /** * Get tool by local path */ @@ -17,7 +13,12 @@ export enum SourceType { /** * Get tool by CDN link */ - CDN = 'cdn' + CDN = 'cdn', + + /** + * Get tool by registry + */ + Registry = 'registry', } /** @@ -28,6 +29,9 @@ export class InstallableTool { * Tool name */ public readonly name: string; + /** + * Tool package name + */ public readonly packageName: string | undefined; /** * Tool version in registry @@ -42,25 +46,33 @@ export class InstallableTool { */ public path?: string; + /** + * Tool export name + */ + public exportName: string; + /** * Initiate installable tool * * @param {string} name - tool name. + * @param {string} exportName - tool export class name. * @param {string} packageName - tool package name. * @param {string} toolPath - tool local or CDN path. * @param {string} version - tool version in registry. + * @param {string} exportName - tool export name. */ - constructor(name: string, packageName?: string, toolPath?: string, version?: string) { + constructor(name: string, exportName: string, packageName?: string, toolPath?: string, version?: string) { this.name = name; this.packageName = packageName; + this.exportName = exportName; this.sourceType = InstallableTool.getSourceType(toolPath); /** - * Check if source type is path and resolve path + * Check if source type is path and convert bundle to esm */ if (this.sourceType === SourceType.Path && toolPath) { - this.path = path.resolve(toolPath); + this.path = InstallableTool.convertBundleToESM(path.resolve(toolPath), name); } else { this.path = toolPath; } @@ -68,6 +80,32 @@ export class InstallableTool { this.version = version; } + /** + * Convert bundle to esm + * + * @param {string} bundlePath - bundle path + * @param {string} toolName - tool name + * @returns {string} - path to esm bundle + */ + public static convertBundleToESM(bundlePath: string, toolName: string): string { + /** + * Create tmp folder for esm bundles + */ + const folderPath = FileData.createFolder('./tmp'); + + /** + * Path for esm bundle + */ + const ESMBundlePath = `${folderPath}/${toolName}.js`; + + /** + * Build esm bundle + */ + execSync(`esbuild ${bundlePath} --format=esm --outfile=${ESMBundlePath} --allow-overwrite`); + + return bundlePath; + } + /** * Get source type of tool * @@ -80,33 +118,17 @@ export class InstallableTool { */ const urlRegex = /^https?:\/\//; + /** + * Check if tool path is url or local path + */ if (toolPath) { - if (urlRegex.test(toolPath)) { - return SourceType.CDN; + if (!urlRegex.test(toolPath)) { + return SourceType.Path; } - return SourceType.Path; + return SourceType.CDN; } return SourceType.Registry; } - - /** - * Install tool package - * - * @param packageInstaller - installer for packages - */ - public install(packageInstaller: PackageInstaller): void { - /** - * Check if source type is registry and install from it - */ - if (this.sourceType === SourceType.Registry && this.packageName) { - this.path = packageInstaller.installPackage(this.packageName, this.version); - } else if (this.sourceType === SourceType.Path) { - /** - * Build esm bundle - */ - execSync(`esbuild ${this.path} --format=esm --outfile=${this.path} --allow-overwrite`); - } - } } \ No newline at end of file diff --git a/setup/types/editorjs/Plugin.ts b/setup/types/editorjs/Plugin.ts index cfe7e1b..27c819c 100644 --- a/setup/types/editorjs/Plugin.ts +++ b/setup/types/editorjs/Plugin.ts @@ -20,6 +20,10 @@ interface Options { * Plugin version in registry */ version?: string; + /** + * Plugin export class name + */ + exportName: string; } /** @@ -31,7 +35,7 @@ export class Plugin extends InstallableTool { * * @param {Options} options - plugin options. */ - constructor({ name, packageName, path, version }: Options) { - super(name, packageName, path, version); + constructor({ name, packageName, path, version, exportName }: Options) { + super(name, exportName, packageName, path, version); } } \ No newline at end of file diff --git a/setup/utils/FileData.ts b/setup/utils/FileData.ts index 9cfe36e..c8bbec0 100644 --- a/setup/utils/FileData.ts +++ b/setup/utils/FileData.ts @@ -19,6 +19,30 @@ export default class FileData { this.fileData = fs.readFileSync(filePath, 'utf-8'); } + /** + * Create folder if it doesn't exist + * + * @param pathToFolder - path to folder + * @returns {string} - path to folder + */ + public static createFolder(pathToFolder: string): string { + const resolvedPath = path.resolve(pathToFolder); + + /** + * Check if folder exists + */ + if (fs.existsSync(resolvedPath)) { + return resolvedPath; + } + + /** + * Create folder + */ + fs.mkdirSync(resolvedPath); + + return resolvedPath; + } + /** * Insert data to file * diff --git a/setup/utils/PackageInstaller.ts b/setup/utils/PackageInstaller.ts deleted file mode 100644 index e388018..0000000 --- a/setup/utils/PackageInstaller.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { execSync } from 'child_process'; -import * as path from 'path'; -import * as fs from 'fs'; - -/** - * Enum for package managers - */ -export enum PackageManager { - NPM = 'npm', - YARN = 'yarn' -} - -/** - * Class for npm packages installation - */ -export class PackageInstaller { - /** - * Type of package manager - * - * @private - */ - private readonly packageManager: PackageManager; - - /** - * Initiate package installer - * - * @param {PackageManager} packageManager - package manager for installation (default is npm). - */ - constructor(packageManager?: PackageManager) { - if (packageManager) { - this.packageManager = packageManager; - } else { - this.packageManager = PackageManager.NPM; - } - } - - /** - * Initiate package installer - * - * @param {string} name - package name. - * @param {string} version - package version - * @returns {string | undefined} - package bundle path, undefined, when there were some problems with reading bundle file path - */ - public installPackage(name: string, version?: string): string | undefined { - let packageString; - - /** - * Check if version exists - */ - if (version) { - packageString = `${name}@${version}`; - } else { - /** - * Latest version of package - */ - packageString = name; - } - /** - * Check what package manager uses - */ - switch (this.packageManager) { - case PackageManager.NPM: - execSync(`npm install -E ${packageString}`, { stdio: 'inherit' }); - break; - case PackageManager.YARN: - execSync(`yarn add ${packageString}`, { stdio: 'inherit' }); - } - - /** - * Get installed package path - */ - const packagePath = `./node_modules/${name}/`; - - try { - /** - * Read package.json file of package - */ - const packageJson = fs.readFileSync(`./node_modules/${name}/package.json`, 'utf-8'); - const packageJsonObject = JSON.parse(packageJson); - - /** - * Get bundle path - */ - return path.join(packagePath, packageJsonObject['main']); - } catch (err) { - console.log(err); - - return; - } - } -} diff --git a/yarn.lock b/yarn.lock index 2df0933..d85b89c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,6 +19,24 @@ __metadata: languageName: node linkType: hard +"@editorjs/dev-tools@workspace:.": + version: 0.0.0-use.local + resolution: "@editorjs/dev-tools@workspace:." + dependencies: + "@codexteam/icons": ^0.3.0 + "@editorjs/editorjs": 2.26.5 + "@types/node": ^18.15.1 + copyfiles: ^2.4.1 + esbuild: ^0.17.16 + eslint: ^8.34.0 + eslint-config-codex: ^1.7.2 + typescript: ^4.9.5 + vite: ^4.2.1 + yarn-or-npm: ^3.0.1 + zod: ^3.20.6 + languageName: unknown + linkType: soft + "@editorjs/editorjs@npm:2.26.5": version: 2.26.5 resolution: "@editorjs/editorjs@npm:2.26.5" @@ -548,7 +566,7 @@ __metadata: languageName: node linkType: hard -"ansi-styles@npm:^4.1.0": +"ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": version: 4.3.0 resolution: "ansi-styles@npm:4.3.0" dependencies: @@ -741,6 +759,17 @@ __metadata: languageName: node linkType: hard +"cliui@npm:^7.0.2": + version: 7.0.4 + resolution: "cliui@npm:7.0.4" + dependencies: + string-width: ^4.2.0 + strip-ansi: ^6.0.0 + wrap-ansi: ^7.0.0 + checksum: ce2e8f578a4813806788ac399b9e866297740eecd4ad1823c27fd344d78b22c5f8597d548adbcc46f0573e43e21e751f39446c5a5e804a12aace402b7a315d7f + languageName: node + linkType: hard + "codex-notifier@npm:^1.1.2": version: 1.1.2 resolution: "codex-notifier@npm:1.1.2" @@ -801,6 +830,31 @@ __metadata: languageName: node linkType: hard +"copyfiles@npm:^2.4.1": + version: 2.4.1 + resolution: "copyfiles@npm:2.4.1" + dependencies: + glob: ^7.0.5 + minimatch: ^3.0.3 + mkdirp: ^1.0.4 + noms: 0.0.0 + through2: ^2.0.1 + untildify: ^4.0.0 + yargs: ^16.1.0 + bin: + copyfiles: copyfiles + copyup: copyfiles + checksum: aea69873bb99cc5f553967660cbfb70e4eeda198f572a36fb0f748b36877ff2c90fd906c58b1d540adbad8afa8ee82820172f1c18e69736f7ab52792c12745a7 + languageName: node + linkType: hard + +"core-util-is@npm:~1.0.0": + version: 1.0.3 + resolution: "core-util-is@npm:1.0.3" + checksum: 9de8597363a8e9b9952491ebe18167e3b36e7707569eed0ebf14f8bba773611376466ae34575bca8cfe3c767890c859c74056084738f09d4e4a6f902b2ad7d99 + languageName: node + linkType: hard + "cross-spawn@npm:^6.0.5": version: 6.0.5 resolution: "cross-spawn@npm:6.0.5" @@ -886,23 +940,6 @@ __metadata: languageName: node linkType: hard -"dev-tools@workspace:.": - version: 0.0.0-use.local - resolution: "dev-tools@workspace:." - dependencies: - "@codexteam/icons": ^0.3.0 - "@editorjs/editorjs": 2.26.5 - "@types/node": ^18.15.1 - esbuild: ^0.17.16 - eslint: ^8.34.0 - eslint-config-codex: ^1.7.2 - typescript: ^4.9.5 - vite: ^4.2.1 - yarn-or-npm: ^3.0.1 - zod: ^3.20.6 - languageName: unknown - linkType: soft - "dir-glob@npm:^3.0.1": version: 3.0.1 resolution: "dir-glob@npm:3.0.1" @@ -1110,6 +1147,13 @@ __metadata: languageName: node linkType: hard +"escalade@npm:^3.1.1": + version: 3.1.1 + resolution: "escalade@npm:3.1.1" + checksum: a3e2a99f07acb74b3ad4989c48ca0c3140f69f923e56d0cba0526240ee470b91010f9d39001f2a4a313841d237ede70a729e92125191ba5d21e74b106800b133 + languageName: node + linkType: hard + "escape-string-regexp@npm:^4.0.0": version: 4.0.0 resolution: "escape-string-regexp@npm:4.0.0" @@ -1603,6 +1647,13 @@ __metadata: languageName: node linkType: hard +"get-caller-file@npm:^2.0.5": + version: 2.0.5 + resolution: "get-caller-file@npm:2.0.5" + checksum: b9769a836d2a98c3ee734a88ba712e62703f1df31b94b784762c433c27a386dd6029ff55c2a920c392e33657d80191edbf18c61487e198844844516f843496b9 + languageName: node + linkType: hard + "get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.0": version: 1.2.0 resolution: "get-intrinsic@npm:1.2.0" @@ -1642,7 +1693,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.1.3, glob@npm:^7.1.4": +"glob@npm:^7.0.5, glob@npm:^7.1.3, glob@npm:^7.1.4": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -1887,7 +1938,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:^2.0.3": +"inherits@npm:2, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:~2.0.1, inherits@npm:~2.0.3": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 @@ -2086,6 +2137,20 @@ __metadata: languageName: node linkType: hard +"isarray@npm:0.0.1": + version: 0.0.1 + resolution: "isarray@npm:0.0.1" + checksum: 49191f1425681df4a18c2f0f93db3adb85573bcdd6a4482539d98eac9e705d8961317b01175627e860516a2fc45f8f9302db26e5a380a97a520e272e2a40a8d4 + languageName: node + linkType: hard + +"isarray@npm:~1.0.0": + version: 1.0.0 + resolution: "isarray@npm:1.0.0" + checksum: f032df8e02dce8ec565cf2eb605ea939bdccea528dbcf565cdf92bfa2da9110461159d86a537388ef1acef8815a330642d7885b29010e8f7eac967c9993b65ab + languageName: node + linkType: hard + "isexe@npm:^2.0.0": version: 2.0.0 resolution: "isexe@npm:2.0.0" @@ -2235,7 +2300,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": +"minimatch@npm:^3.0.3, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" dependencies: @@ -2424,6 +2489,16 @@ __metadata: languageName: node linkType: hard +"noms@npm:0.0.0": + version: 0.0.0 + resolution: "noms@npm:0.0.0" + dependencies: + inherits: ^2.0.1 + readable-stream: ~1.0.31 + checksum: a05f056dabf764c86472b6b5aad10455f3adcb6971f366cdf36a72b559b29310a940e316bca30802f2804fdd41707941366224f4cba80c4f53071512245bf200 + languageName: node + linkType: hard + "nopt@npm:^6.0.0": version: 6.0.0 resolution: "nopt@npm:6.0.0" @@ -2651,6 +2726,13 @@ __metadata: languageName: node linkType: hard +"process-nextick-args@npm:~2.0.0": + version: 2.0.1 + resolution: "process-nextick-args@npm:2.0.1" + checksum: 1d38588e520dab7cea67cbbe2efdd86a10cc7a074c09657635e34f035277b59fbb57d09d8638346bf7090f8e8ebc070c96fa5fd183b777fff4f5edff5e9466cf + languageName: node + linkType: hard + "promise-inflight@npm:^1.0.1": version: 1.0.1 resolution: "promise-inflight@npm:1.0.1" @@ -2693,6 +2775,33 @@ __metadata: languageName: node linkType: hard +"readable-stream@npm:~1.0.31": + version: 1.0.34 + resolution: "readable-stream@npm:1.0.34" + dependencies: + core-util-is: ~1.0.0 + inherits: ~2.0.1 + isarray: 0.0.1 + string_decoder: ~0.10.x + checksum: 85042c537e4f067daa1448a7e257a201070bfec3dd2706abdbd8ebc7f3418eb4d3ed4b8e5af63e2544d69f88ab09c28d5da3c0b77dc76185fddd189a59863b60 + languageName: node + linkType: hard + +"readable-stream@npm:~2.3.6": + version: 2.3.8 + resolution: "readable-stream@npm:2.3.8" + dependencies: + core-util-is: ~1.0.0 + inherits: ~2.0.3 + isarray: ~1.0.0 + process-nextick-args: ~2.0.0 + safe-buffer: ~5.1.1 + string_decoder: ~1.1.1 + util-deprecate: ~1.0.1 + checksum: 65645467038704f0c8aaf026a72fbb588a9e2ef7a75cd57a01702ee9db1c4a1e4b03aaad36861a6a0926546a74d174149c8c207527963e0c2d3eee2f37678a42 + languageName: node + linkType: hard + "regexp.prototype.flags@npm:^1.4.3": version: 1.5.0 resolution: "regexp.prototype.flags@npm:1.5.0" @@ -2711,6 +2820,13 @@ __metadata: languageName: node linkType: hard +"require-directory@npm:^2.1.1": + version: 2.1.1 + resolution: "require-directory@npm:2.1.1" + checksum: fb47e70bf0001fdeabdc0429d431863e9475e7e43ea5f94ad86503d918423c1543361cc5166d713eaa7029dd7a3d34775af04764bebff99ef413111a5af18c80 + languageName: node + linkType: hard + "resolve-from@npm:^4.0.0": version: 4.0.0 resolution: "resolve-from@npm:4.0.0" @@ -2792,6 +2908,13 @@ __metadata: languageName: node linkType: hard +"safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1": + version: 5.1.2 + resolution: "safe-buffer@npm:5.1.2" + checksum: f2f1f7943ca44a594893a852894055cf619c1fbcb611237fc39e461ae751187e7baf4dc391a72125e0ac4fb2d8c5c0b3c71529622e6a58f46b960211e704903c + languageName: node + linkType: hard + "safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" @@ -2969,7 +3092,7 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.2.3": +"string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" dependencies: @@ -3022,7 +3145,23 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:^6.0.1": +"string_decoder@npm:~0.10.x": + version: 0.10.31 + resolution: "string_decoder@npm:0.10.31" + checksum: fe00f8e303647e5db919948ccb5ce0da7dea209ab54702894dd0c664edd98e5d4df4b80d6fabf7b9e92b237359d21136c95bf068b2f7760b772ca974ba970202 + languageName: node + linkType: hard + +"string_decoder@npm:~1.1.1": + version: 1.1.1 + resolution: "string_decoder@npm:1.1.1" + dependencies: + safe-buffer: ~5.1.0 + checksum: 9ab7e56f9d60a28f2be697419917c50cac19f3e8e6c28ef26ed5f4852289fe0de5d6997d29becf59028556f2c62983790c1d9ba1e2a3cc401768ca12d5183a5b + languageName: node + linkType: hard + +"strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": version: 6.0.1 resolution: "strip-ansi@npm:6.0.1" dependencies: @@ -3082,6 +3221,16 @@ __metadata: languageName: node linkType: hard +"through2@npm:^2.0.1": + version: 2.0.5 + resolution: "through2@npm:2.0.5" + dependencies: + readable-stream: ~2.3.6 + xtend: ~4.0.1 + checksum: beb0f338aa2931e5660ec7bf3ad949e6d2e068c31f4737b9525e5201b824ac40cac6a337224856b56bd1ddd866334bbfb92a9f57cd6f66bc3f18d3d86fc0fe50 + languageName: node + linkType: hard + "to-regex-range@npm:^5.0.1": version: 5.0.1 resolution: "to-regex-range@npm:5.0.1" @@ -3198,6 +3347,13 @@ __metadata: languageName: node linkType: hard +"untildify@npm:^4.0.0": + version: 4.0.0 + resolution: "untildify@npm:4.0.0" + checksum: 39ced9c418a74f73f0a56e1ba4634b4d959422dff61f4c72a8e39f60b99380c1b45ed776fbaa0a4101b157e4310d873ad7d114e8534ca02609b4916bb4187fb9 + languageName: node + linkType: hard + "uri-js@npm:^4.2.2": version: 4.4.1 resolution: "uri-js@npm:4.4.1" @@ -3207,7 +3363,7 @@ __metadata: languageName: node linkType: hard -"util-deprecate@npm:^1.0.1": +"util-deprecate@npm:^1.0.1, util-deprecate@npm:~1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" checksum: 474acf1146cb2701fe3b074892217553dfcf9a031280919ba1b8d651a068c9b15d863b7303cb15bd00a862b498e6cf4ad7b4a08fb134edd5a6f7641681cb54a2 @@ -3316,6 +3472,17 @@ __metadata: languageName: node linkType: hard +"wrap-ansi@npm:^7.0.0": + version: 7.0.0 + resolution: "wrap-ansi@npm:7.0.0" + dependencies: + ansi-styles: ^4.0.0 + string-width: ^4.1.0 + strip-ansi: ^6.0.0 + checksum: a790b846fd4505de962ba728a21aaeda189b8ee1c7568ca5e817d85930e06ef8d1689d49dbf0e881e8ef84436af3a88bc49115c2e2788d841ff1b8b5b51a608b + languageName: node + linkType: hard + "wrappy@npm:1": version: 1.0.2 resolution: "wrappy@npm:1.0.2" @@ -3323,6 +3490,20 @@ __metadata: languageName: node linkType: hard +"xtend@npm:~4.0.1": + version: 4.0.2 + resolution: "xtend@npm:4.0.2" + checksum: ac5dfa738b21f6e7f0dd6e65e1b3155036d68104e67e5d5d1bde74892e327d7e5636a076f625599dc394330a731861e87343ff184b0047fef1360a7ec0a5a36a + languageName: node + linkType: hard + +"y18n@npm:^5.0.5": + version: 5.0.8 + resolution: "y18n@npm:5.0.8" + checksum: 54f0fb95621ee60898a38c572c515659e51cc9d9f787fb109cef6fde4befbe1c4602dc999d30110feee37456ad0f1660fa2edcfde6a9a740f86a290999550d30 + languageName: node + linkType: hard + "yallist@npm:^4.0.0": version: 4.0.0 resolution: "yallist@npm:4.0.0" @@ -3330,6 +3511,28 @@ __metadata: languageName: node linkType: hard +"yargs-parser@npm:^20.2.2": + version: 20.2.9 + resolution: "yargs-parser@npm:20.2.9" + checksum: 8bb69015f2b0ff9e17b2c8e6bfe224ab463dd00ca211eece72a4cd8a906224d2703fb8a326d36fdd0e68701e201b2a60ed7cf81ce0fd9b3799f9fe7745977ae3 + languageName: node + linkType: hard + +"yargs@npm:^16.1.0": + version: 16.2.0 + resolution: "yargs@npm:16.2.0" + dependencies: + cliui: ^7.0.2 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.0 + y18n: ^5.0.5 + yargs-parser: ^20.2.2 + checksum: b14afbb51e3251a204d81937c86a7e9d4bdbf9a2bcee38226c900d00f522969ab675703bee2a6f99f8e20103f608382936034e64d921b74df82b63c07c5e8f59 + languageName: node + linkType: hard + "yarn-or-npm@npm:^3.0.1": version: 3.0.1 resolution: "yarn-or-npm@npm:3.0.1" From a0647405ca5b1b4af254199976085452cc175d51 Mon Sep 17 00:00:00 2001 From: slaveeks Date: Fri, 5 May 2023 15:20:48 +0300 Subject: [PATCH 2/4] Fixed code style --- setup/Stand/Stand.ts | 1 - setup/types/editorjs/InstallableTool.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/setup/Stand/Stand.ts b/setup/Stand/Stand.ts index 05d29e0..ef4c72d 100644 --- a/setup/Stand/Stand.ts +++ b/setup/Stand/Stand.ts @@ -63,7 +63,6 @@ export default class Stand { * Add plugins imports to script */ for (const [index, plugin] of plugins.entries()) { - /** * Check if plugin is from CDN */ diff --git a/setup/types/editorjs/InstallableTool.ts b/setup/types/editorjs/InstallableTool.ts index e5f9cd9..de16a35 100644 --- a/setup/types/editorjs/InstallableTool.ts +++ b/setup/types/editorjs/InstallableTool.ts @@ -59,7 +59,6 @@ export class InstallableTool { * @param {string} packageName - tool package name. * @param {string} toolPath - tool local or CDN path. * @param {string} version - tool version in registry. - * @param {string} exportName - tool export name. */ constructor(name: string, exportName: string, packageName?: string, toolPath?: string, version?: string) { this.name = name; From a653de39cfef21379efdde5aa742ccacc55f1e47 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 5 May 2023 12:20:58 +0000 Subject: [PATCH 3/4] Bump version up to 0.0.1-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec77b87..9b4e611 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/dev-tools", - "version": "0.0.1-rc.0", + "version": "0.0.1-rc.1", "type": "module", "main": "./build/setup/index.js", "files": [ From 4031122bec860841570d73e10f98e416a9582a40 Mon Sep 17 00:00:00 2001 From: slaveeks Date: Fri, 5 May 2023 15:22:21 +0300 Subject: [PATCH 4/4] Updated config sample --- editorjs.config.sample.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editorjs.config.sample.ts b/editorjs.config.sample.ts index 6417f26..f7c29d0 100644 --- a/editorjs.config.sample.ts +++ b/editorjs.config.sample.ts @@ -22,7 +22,11 @@ export default function config(): unknown { quote: '@editorjs/quote', header: '@editorjs/header', checklist: { - path: './checklist/dist/bundle.js', + path: 'https://cdn.jsdelivr.net/npm/@editorjs/checklist@latest', + exportName: 'Checklist', + }, + image: { + path: './simple-image/dist/bundle.js', }, }, },