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

Separate internal APIs from public ones #568

Merged

Conversation

puzpuzpuz
Copy link
Contributor

@puzpuzpuz puzpuzpuz commented Aug 10, 2020

Closes: #557
Closes: #555
Closes: #537

  • Marks internal modules and class members with @internal tag which is supported by both tsc and typedoc
  • Fixes typedoc flags, so that it now ignores internal stuff
    • Had to mark modules that contain only internals with /** @ignore *//** */. It's a known workaround for typedoc
  • Excludes internal modules and members from tsc output
  • Excludes source maps from tsc output
  • Moves typings for long and bluebird into non-dev dependencies, as TS users need them (see Include TS typings into client artifact #537)
  • Adds test for declarations produced by tsc. Previously we had no way to verify correctness (and completeness) of the declarations. That becomes important now as with stripInternal option there is a chance that, for instance, the declarations include an internal class and tsc will fail to compile user code because of that
    • Important note: I've added npm run validate-user-code step to the Jenkins PR builder
  • Also includes some code improvements, like reformat, interface extraction, etc.

Client protocol counterpart PR: hazelcast/hazelcast-client-protocol#335

Results

As the result, ./lib dir's size went down from 3MB to 1.4MB. API documentation also got a lot smaller and now includes public API only.

Additional context

Ideally, we could ask typedoc to generate documentation only for modules reachable from the entry point (./src/index.ts). This way we would need much less @internal tags and no /** @ignore *//** */ hacks. There is a pending PR for typedoc that implements such logic, yet it's experimental and not available in stable builds. So, that's why I have decided not to go with this road.

Also includes the following:
* Fix typedoc flags
* Exclude internal modules and members from tsc output
* Exclude source maps from tsc output
@puzpuzpuz puzpuzpuz changed the title [WIP] Separate internal APIs from public ones Separate internal APIs from public ones Aug 11, 2020
Copy link
Contributor

@mdumandag mdumandag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I have some minor comments

src/HazelcastClient.ts Outdated Show resolved Hide resolved
tsconfig.json Show resolved Hide resolved
package.json Show resolved Hide resolved
src/serialization/portable/ClassDefinition.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
@puzpuzpuz
Copy link
Contributor Author

@mdumandag it seems that I have addresses/replied to all pending comments. Could you take another look?

@puzpuzpuz puzpuzpuz merged commit c7d063a into hazelcast:master Aug 14, 2020
@puzpuzpuz puzpuzpuz deleted the v4.0/enhancement/separate-public-apis branch August 14, 2020 07:37
harunalpak pushed a commit to harunalpak/hazelcast-nodejs-client that referenced this pull request Dec 8, 2022
Includes the following:
* Marks internal modules and class members with @internal tag which is supported by both tsc and typedoc
* Fixes typedoc flags, so that it now ignores internal stuff
* Excludes internal modules and members from tsc output
* Excludes source maps from tsc output
* Moves typings for long and bluebird into non-dev dependencies, as TS users need them (see hazelcast#537)
* Adds test for declarations produced by tsc
* Also includes some code improvements, like reformatting, interface extraction, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment