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!: remove unsupported specs from NodeJS export #248

Merged
merged 9 commits into from
Oct 21, 2022

Conversation

magicmatatjahu
Copy link
Member

@magicmatatjahu magicmatatjahu commented Sep 9, 2022

Description

  • remove unsupported specs from NodeJS export
  • update Readme.md

Related issue(s)
Resolves #238

supported.d.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,18 @@
import type { JSONSchema7 } from 'json-schema';

declare module '@asyncapi/specs' {
Copy link
Member

Choose a reason for hiding this comment

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

Are we gonna remove index.js in favor of this?

Copy link
Member Author

Choose a reason for hiding this comment

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

but then we need transpilation TS -> JS process.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, otherwise we manually maintain both versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can be done, lets wait for others opinion.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I definitely prefer we generate index.js as it doesn't make sense to manually duplicate

Copy link
Member

Choose a reason for hiding this comment

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

Are we gonna do this in this PR or in another one right after merging this one?

Copy link
Member

Choose a reason for hiding this comment

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

Due to the fact this PR blocks #264 (See here), I suggest we first merge this one, we then enable TS transpilation asap in another PR

README.md Show resolved Hide resolved
@magicmatatjahu magicmatatjahu changed the title feat: add "treeshakable" module feat!: remove unsupported specs from export Sep 30, 2022
@magicmatatjahu magicmatatjahu changed the title feat!: remove unsupported specs from export feat!: remove unsupported specs from NodeJS export Sep 30, 2022
@@ -8342,4 +8342,4 @@
"dev": true
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

it is strange that you added new dependency, but this is the only change in package-lock 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed - I think at least @types/json-schema should've been added here

README.md Outdated
@@ -1,18 +1,25 @@
![npm](https://img.shields.io/npm/v/@asyncapi/specs?style=for-the-badge) ![npm](https://img.shields.io/npm/dt/@asyncapi/specs?style=for-the-badge)

> If you are currently using version 2, check out [migration guideline to version 3](./migrations/Migrate%20to%20version%203.md). You might be able to update it without any change.
Copy link
Member

Choose a reason for hiding this comment

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

we need to update this part a bit.
we talk about migration from 2 ->3 but then there is v4, so might be confusing

maybe we need dedicated section, like Migrations, where we list path from 2 -> 3 and explain that 3 -> 4 means that we no longer support versions prior 2.0 which means migration path is to switch to 2.x version of the spec

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

left some comments, sorry for being late here

@@ -8342,4 +8342,4 @@
"dev": true
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed - I think at least @types/json-schema should've been added here

index.d.ts Outdated
import type { JSONSchema7 } from 'json-schema';

declare module '@asyncapi/specs' {
declare const specs: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we have the declare here?

when I tried opening this, I got an error:

A 'declare' modifier cannot be used in an already ambient context.ts(1038)

I've not created typescript declarations before, so I'm not really sure what the implications of this are - but removing the inner declare made the IDE error go away. 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, strange. I wasn't getting that error, but I removed that keyword declare before const. On the stackoverflow people write that since some version of TS the word declare is not needed when we declare it inside a module.

Thanks!

@fmvilas
Copy link
Member

fmvilas commented Oct 13, 2022

FYI, this PR is blocking #264. See Lukasz' comment.

@derberg
Copy link
Member

derberg commented Oct 18, 2022

@magicmatatjahu pingy pongy

@magicmatatjahu
Copy link
Member Author

@derberg Done :)

Copy link
Member

@smoya smoya left a comment

Choose a reason for hiding this comment

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

Due to the fact this PR blocks #264 (See #264 (comment)), I suggest we first merge this one, we then enable TS transpilation asap in another PR

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@fmvilas
Copy link
Member

fmvilas commented Oct 21, 2022

@magicmatatjahu wanna do the honors? 😄

@magicmatatjahu
Copy link
Member Author

@fmvilas Sure! :)

@magicmatatjahu
Copy link
Member Author

/rtm

@asyncapi-bot asyncapi-bot merged commit f55917d into asyncapi:master Oct 21, 2022
@magicmatatjahu magicmatatjahu deleted the treeshakable-imports branch October 21, 2022 13:56
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drop asyncapi json schemas prior 2.0 and release 4.0
6 participants