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

Create and publish typescript package #62

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mart3323
Copy link

@mart3323 mart3323 commented Jul 21, 2022

From #todo/jsmacros/14

  1. if someone wants to figure out the best way to repackage the typescript docs for NPM publishing, that'd be great 🙂

Changes

For the npm package

  1. Added README.md and package.json for the npm package
  2. Removed version number from JsMacros.d.ts filename (for the npm package only)
  3. Added new job in betabuild.yml to publish 0.0.0-sha (f.ex. 0.0.0-d3adb33)
  4. Added new job in release.yml to publish a.b.c (f.ex. 1.7.0)

Unrelated

  1. Fixed typing of Java.from()

Note on compatibility with main-1.19

The current 1.19 branch reports errors for basic scripts such as Chat.log("string") not because the packaging is wrong, but because the generated .d.ts file now contains the type _javatypes.java.lang.Object in a bunch of places.
For testing i put these changes directly on the 1.7.0 release and the packages produced from that version worked fine

@mart3323

This comment was marked as outdated.

@wagyourtail
Copy link
Collaborator

wagyourtail commented Jul 25, 2022

Publishing a package on npm permanently reserves that name+version combination, so i don't feel comfortable doing test deployments there

test publishing to @yourusername/JsMacrosTypes or something, and then I can change it when merging

@mart3323
Copy link
Author

npm package names must be lowercase. Would /jsmacros-types be acceptable then?

…typescript

+ autoformat Graal.d.ts because i couldn't block the IDE from doing it
@mart3323
Copy link
Author

mart3323 commented Jul 26, 2022

Updated branch typescript-package to latest main-1.19 (as of about half an hour ago)
Switched deployment to npm registry (buildrelease.yml tagged as latest by default, buildbeta.yml tagged as beta)
Currently published test versions are

@mart3323/jsmacros-types on npm
@mart3323/jsmacros-types@latest This branch, based on latest 1.19, bad types
@mart3323/jsmacros-types@beta This branch rebased onto 1.7.0, good types

mart3323 added a commit to mart3323/JsMacros that referenced this pull request Nov 1, 2022
per wagyourtail's comment in JsMacros#62, beta builds should not deploy to npm.
@@ -0,0 +1,33 @@
{
"name": "@mart3323/jsmacros-types",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have grabbed the @jsmacros org. want me to add you to it?

Copy link
Author

Choose a reason for hiding this comment

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

Up to you - though keep in mind that as soon as we switch to the final package name, anything published (including from this unmerged MR) will become locked in. NPM does not allow editing/republishing to the same combination of package name and version number
source: https://docs.npmjs.com/policies/unpublish

@mart3323
Copy link
Author

If/When this is otherwise ready to merge, i would like to clean up the history with a quick interactive rebase first

@wagyourtail
Copy link
Collaborator

wagyourtail commented Nov 18, 2022

yeah. I think the requested changes are wrapping up, feel free to add back the beta actually...
maybe peek at #72 and see if it's doing something better.

I haven't really done too much with npm, but I should've invited you to the org.

@wagyourtail wagyourtail added the enhancement New feature or request label Nov 18, 2022
Removed comments that merely explain the syntax (likely leftovers from an example file)
I assume they were not left in intentionally because none of the other CI files have them
@mart3323
Copy link
Author

mart3323 commented Nov 18, 2022

Rebase complete. publish for beta reincluded

Added one final extra change - I noticed a comment in the build script was outdated

# This workflow contains a single job called "build"

so i deleted that.
Then i saw all the other comments also seem like they're just from an example file.

Since none of the other .yml files had comments like those, i figured i'd remove them from betabuild.yml as well to declutter it

@mart3323
Copy link
Author

in #72, the only feature i spotted that is missing here is building a .tgz artifact. It feels unnecessary here, since
a) You can download the package from npm
b) If you're not using npm and just want to drop in the types, the tsconfig + header files work perfectly

but i also don't have experience with tgz files so I might just not be thinking of the right use cases
@Johannes7k75 If we publish to npm anyway, would there still be a reason to create a tgz for the artifacts as well?

@Johannes7k75
Copy link
Contributor

The reason i include the package in the artifact is that i dont have to get the sha of the beta build.

@wagyourtail wagyourtail changed the base branch from old-backports/1.19.2 to main September 10, 2023 05:01
@Johannes7k75
Copy link
Contributor

But other than downloading the types as a .tgz and downloading the Mod at the same time, there is no other benefit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants