Closed akudev closed 4 months ago
@petermuessig Now I remember why I wrote the imports like I did:
import { writeFile } from "fs-extra";
^^^^^^^^^
SyntaxError: Named export 'writeFile' not found. The requested module 'fs-extra' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'fs-extra';
const { writeFile } = pkg;
I just re-checked: even though "@ui5/dts-generator": "dist/index.js",
in the binaries section of package.json gives a warning and the binary (symlink in .bin) is not named like this, only with this entry, users can continue to write npx @ui5/dts-generator
, hence I leave it in.
This change consists of these major areas:
ui5-metadata.js
from the test to dts-generator and converting it to an ES module (plus moving dependencies)Regarding the binary: Formerly it was not named, so the package name was supposedly the binary name(??). But in fact, the "@ui5" prefix was ignored when the symlink was created. So unintentionally, the binary is simply "dts-generator". Hence the new main binary is named explicitly "ui5-dts-generator" and the new util: "ui5-download-apijson". The old "@ui5/dts-generator" is added for compatibility. Not 100% sure about that.