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

feat(dts-generator): huge update to the currently used generator, plus update dependencies #438

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

akudev
Copy link
Contributor

@akudev akudev commented Apr 22, 2024

No description provided.

akudev added 2 commits April 22, 2024 21:50
This updates the dts-generator in this repository from the vastly
outdated version from years ago to the one developed and used internally
over the past years in the build-up to officially releasing
production-ready type definitions for UI5. The new dts-generator is
based on the old version developed here, but has undergone huge changes
and extensions.

Changes to the dts-generator package itself include:
- Conversion of the implementation to TypeScript
- Creation of type definitions declaring ES modules instead of globals
(globals still supported as alternative output, though)
- Completely new API
- Loads of adaptations to generate better type definitions, partly
depending on changes in the UI5 codebase, so this new version might not
run with older versions of UI5 like 1.90 or even before
- MUCH more... in general you are better off considering this a new
project, although at the core of it quite some parts of the old
implementation and overall structure are still there

Other changes to the repository include:
- Upgrade TypeScript and Prettier and sync the versions across the
repository
- Update other dependencies like husky
- Update documentation to the new reality
- Update test code to work with the new dts-generator API
- Update test content/snapshots
- Delete all demos, as they are outdated (using types with globals)

Changes to the ts-interface-generator are NOT done in this commit to not
cause a major version increase. Those changes are basically just
dependency updates and handled in a separate commit. This may mean that
both commits should be regarded as parts of ONE change and may not work
without each other (as e.g. both affect yarn.lock, but this file is only
touched in this commit).

BREAKING CHANGE: the API and behavior and generation results of the
dts-generator have completely changed. To migrate, basically re-write
the usage of it.
This is a pure dependency update, but also an adaptation to the overall
repo dependency update, where a new major version of prettier was
applied, which causes lots of formatting changes (mostly adding trailing
commas) in this change.
Also, TypeScript was brought in sync to the other parts of the repo.

// Matches the end of error messages where a large number of mismatching properties are enumerated.
// These are likely to change for independent reasons and we still want the ignore check to find the match.
const LIST_REGEX = /: ([\w0-9_]+, )+and \d+ more.$/;

Check warning

Code scanning / CodeQL

Overly permissive regular expression range Medium

Suspicious character range that overlaps with \w in the same character class.
const NAMESPACE_PATTERN = /^\s+namespace ([^\s]+) {/;
const CLASS_PATTERN =
/^\s*(?:export(?: default)?)?\s+class ([^\s]+)( [\{\w].*)?$/;
const FUNCTION_PATTERN = /^\s+[\w0-9]+\(/;

Check warning

Code scanning / CodeQL

Overly permissive regular expression range Medium

Suspicious character range that overlaps with \w in the same character class.
const CLASS_PATTERN =
/^\s*(?:export(?: default)?)?\s+class ([^\s]+)( [\{\w].*)?$/;
const FUNCTION_PATTERN = /^\s+[\w0-9]+\(/;
const OBJECT_PATTERN = /^\s+[\w0-9]+: \{/;

Check warning

Code scanning / CodeQL

Overly permissive regular expression range Medium

Suspicious character range that overlaps with \w in the same character class.
const NAMESPACE_PATTERN = /^\s+namespace ([^\s]+) {/;
const CLASS_PATTERN =
/^\s*(?:export(?: default)?)?\s+class ([^\s]+)( [\{\w].*)?$/;
const FUNCTION_PATTERN = /^\s+[\w0-9]+\(/;

Check warning

Code scanning / CodeQL

Overly permissive regular expression range Medium

Suspicious character range that overlaps with \w in the same character class.
const CLASS_PATTERN =
/^\s*(?:export(?: default)?)?\s+class ([^\s]+)( [\{\w].*)?$/;
const FUNCTION_PATTERN = /^\s+[\w0-9]+\(/;
const OBJECT_PATTERN = /^\s+[\w0-9]+: \{/;

Check warning

Code scanning / CodeQL

Overly permissive regular expression range Medium

Suspicious character range that overlaps with \w in the same character class.
packages/dts-generator/src/checkDtslint/check-dtslint.ts Dismissed Show dismissed Hide dismissed
packages/dts-generator/src/checkDtslint/check-dtslint.ts Dismissed Show dismissed Hide dismissed
packages/dts-generator/src/phases/json-to-ast.ts Dismissed Show dismissed Hide dismissed
packages/dts-generator/src/utils/type-parser.ts Dismissed Show dismissed Hide dismissed
packages/dts-generator/src/checkCompile/diagnostic-analysis.ts Dismissed Show dismissed Hide dismissed
@akudev akudev merged commit 1e5fad6 into main Apr 23, 2024
7 checks passed
@akudev akudev deleted the main-update-huge branch April 23, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant