Skip to content

Conversation

@antfu
Copy link
Member

@antfu antfu commented Dec 20, 2019

This is a proposal, not yet finished.

I have opened this for discussing whether we should distribute it as npm packages.

Here are the advantages I think could be helpful for distributing as packages.

  • Better version control (people got easier to install and update to the new features and fixes)
  • Continue development (no need to build manually anymore)
  • Global install (npm i -g can make the executable exposed to the user environments, no more os-specific build required)
  • Different packages for different purposes of distributing. e.g. we can have packages like @wenyan-lang/parser(for ast and syntax highlight) @wenyan-lang/cli(command line) @wenyan-lang/core(for browser or API calls)

In order to archive this, we may need to do the following things:

  • A npm account
  • Build and package tools (e.g. Webpack, rollup, etc)
  • Github Actions scripts
  • Separate code by features

I would like to know what do you think about this before I dig into it. Thanks!

@LingDong-
Copy link
Member

Sounds very promising. I'm wondering if this would be a painless transition? If not, I think we might need to take this one easy, since there're still many features being added to the language, and there's the testing framework I need to learn, and bugs to fix. I don't want too many things to break at the same time :P
Or do you think this move will be very beneficial that we should do it as soon as possible?
Thanks for bringing this up!

@antfu
Copy link
Member Author

antfu commented Dec 20, 2019

I'm wondering if this would be a painless transition?

Yes. It can be. Basically It will only change the building scripts and nothing affects the compiler. I would also keep 3rd-party tools as minimum as possible. Anyway, you can hold this PR until you feel good about it.

Or do you think this move will be very beneficial that we should do it as soon as possible?

IMHO, Yes. Besides the benefits I listed above (which I think it's rather important). As I am developing the extension I have embedded the compiler into to extension to make users work out of the box. Every update or fix I need to manually copy and paste the file into my vendor directory. It's kinda less effective. I believe users won't do this procedure very often.

Also, exporting the parser or the programmable API would help others to build the ecosystem easily. It's also kinda important as the rapid growth stage of this project is, from my point of view.

@LingDong-
Copy link
Member

I see! Feel free to go ahead then! Let me know what I can do to help. Thanks again.

@antfu
Copy link
Member Author

antfu commented Dec 20, 2019

I think I have done the building and package publishing scripts.

The package name will be wenyan-lang since it's already set.

You need to do some secret token set up in order to make it work.
image

When you got the npm token, paste it into secrets of this repo named NPM_TOKEN
image

Please refer to this article: https://sergiodxa.com/articles/github-actions-npm-publish/


After that, you can create a new Github Release. Github Actions will publish the package every time you create a release.

When you need to bump the version, you can run

$ npm run release

@antfu antfu marked this pull request as ready for review December 20, 2019 06:51
@LingDong- LingDong- merged commit d0a15a2 into wenyan-lang:master Dec 20, 2019
@LingDong-
Copy link
Member

LingDong- commented Dec 20, 2019

Hi @antfu,
There seems to be a problem: I merged your pull request, created a token on npmjs.org using my account, added the token to this repo on Github, and tried to publish the package by making a Release using the GUI on Github webpage. However, when I search for wenyan-lang on npm, it seems that although there is a package of that name, it is empty.
What have I done wrong?
Thanks!

EDIT: I checked Github Actions and it seems to be complaining about the lack of package-lock.json, which I've put in .gitignore. I'm now un-ignoring the file and trying again...

@LingDong-
Copy link
Member

image

@antfu
Copy link
Member Author

antfu commented Dec 20, 2019

@LingDong- Oh I am sorry. Seems the name is occupied by someone else just now. https://www.npmjs.com/package/wenyan-lang

I am not too sure how to deal with this circumstance. Maybe we can contact him/her to transfer the ownership or we just change the name and try again.

@antfu
Copy link
Member Author

antfu commented Dec 20, 2019

image

I think it's been maliciously robbed. I should register the name first, sorry for that.

@LingDong-
Copy link
Member

Yes, I just figured that too, all these related names are squatted by this same person. Yet I couldn't find this person's contact information. Not sure what he wants.
Sorry I saw your pull request last night, but it was late so I thought it's ok to get some sleep first...
Does npm allow Chinese? Maybe we can simply use 文言.
If so, I hope that person is not reading this discussion. :P

@antfu
Copy link
Member Author

antfu commented Dec 20, 2019

@LingDong- Have just sent you an email. I think it's better to discuss privately.

@LingDong-
Copy link
Member

@antfu I saw your email and replied to it. Thanks!

This was referenced Dec 21, 2019
LingDong- added a commit that referenced this pull request Jan 20, 2020
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.

2 participants