ckeditor / ckeditor5-package-generator

A tool for creating a new package for CKEditor 5.
Other
6 stars 8 forks source link

DLLs: Allow normal package names #139

Closed tony closed 1 year ago

tony commented 1 year ago

📝 Provide detailed reproduction steps (if any)

In the community package ckeditor5-math (github), the package name errors on ckeditor5-package-tools dll:build

This happened in a recent PR: https://github.com/isaul32/ckeditor5-math/pull/83/files#r1134754172

✔️ Expected result

The package should correctly build a DLL package, but errors

❌ Actual result

yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
$ yarn run dll:build
yarn run v1.22.19
$ ckeditor5-package-tools dll:build
ckeditor5-math/node_modules/@ckeditor/ckeditor5-package-tools/lib/utils/get-webpack-config-dll.js:23
        const dllName = packageJson.name.split( '/' )[ 1 ].replace( /^ckeditor5-/, '' );
                                                          ^

TypeError: Cannot read properties of undefined (reading 'replace')
    at module.exports (ckeditor5-math/node_modules/@ckeditor/ckeditor5-package-tools/lib/utils/get-webpack-config-dll.js:23:52)
    at module.exports (ckeditor5-math/node_modules/@ckeditor/ckeditor5-package-tools/lib/tasks/dll-build.js:12:24)
    at dll:build (ckeditor5-math/node_modules/@ckeditor/ckeditor5-package-tools/lib/index.js:18:45)
    at Object.<anonymous> (ckeditor5-math/node_modules/@ckeditor/ckeditor5-package-tools/bin/index.js:18:32)
    at Module._compile (node:internal/modules/cjs/loader:1246:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
    at Module.load (node:internal/modules/cjs/loader:1103:32)
    at Module._load (node:internal/modules/cjs/loader:942:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

❓ Possible solution

Make the split('/')[1] optional here if there's no org prefix:

https://github.com/ckeditor/ckeditor5-package-generator/blob/1512d155527635a2c5fca31cb5ec9be84d0d4251/packages/ckeditor5-package-tools/lib/utils/get-webpack-config-dll.js#L23

📃 Other details


If you'd like to see this fixed sooner, add a 👍 reaction to this post.