-
Notifications
You must be signed in to change notification settings - Fork 9
How are we going to import @node-core/ui-components
?
#236
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
Comments
Why not publish ui-components ? |
That's an option, but I feel like we are going to be constantly updating that package, so it might be easier to keep it imported from the repository. |
With a CD it's just a git tag to create no needed to create a changelog |
Personally, I'm in favor of adopting support for pnpm "@node-core/ui-components": "github:nodejs/nodejs.org#main&path:packages/ui-components" However, I think we should get more opinions before making any decision. |
Would that interfere with us using |
No, we'd just change the npm installation step to a pnpm installation step, but let's cross that bridge if we get to it.
|
it's mean we will need pnpm in node core ? |
We wouldn't need to depend on it, we would just have to assume the user has it installed, which isn't ideal, but every one of our options has a drawback.
|
I think we should publish the package, but not necessarily npm. It can be as an GitHub artifact. https://docs.github.com/en/packages/quickstart |
That could work. Once the I'm gonna leave this issue open until then, just in case anything changes. |
Are you merging the PR today? |
Yes, I don't think anyone else is going to object in the next hour, so I'm merge it now, but I'm going to add a workflow in a second PR, in case it needs a revert, we don't need to revert the entire UI package |
We need to verify that Node.js can publish to the Edit: We do not control the We have a few options:
|
Of those options you gave, the best and simplest one is just renaming the package to |
cc @nodejs/tsc and @nodejs/build looking for guidance here |
|
Thanks for chiming in, Ruy! |
Thanks! Sorry about my outdated information, I'll check and PR the npm documentation to make this more clear. |
@ruyadorno I just attempted to do that, and it appears to import the entire repository: npm i "nodejs/nodejs.org#path:packages/ui-components" Produces:
|
Can you try again using the exact same specifier I provided in my example:
|
It's the same result.
"node_modules/nodejs-website": {
"resolved": "git+ssh://git@github.com/nodejs/nodejs.org.git#663fad95788c9e0b398423c86b608f3410c998d8",
"license": "MIT",
"dependencies": {
"husky": "9.1.7",
"lint-staged": "15.5.1",
"turbo": "2.5.2"
},
"engines": {
"node": "v22"
}
}, |
:-/ Looks like we need to go back to deciding what to do. |
👀 If we go down the GitHub Packages path, just want to flag that GitHub Packages requires auth always, even to read. For GitHub Actions consumption specifically, within the same org, you can pass the As an example, https://github.com/alveusgg/data#installation + https://github.com/alveusgg/alveusgg/blob/0fb6b2efd001c6861c0c391dc37c311f3270f77e/.github/workflows/pull-request.yml#L23-L24 |
I do very much like the idea of just being able to do a git subpath import though, and it sounds like pnpm would support this. That'd mean anyone installing this package would also need to use pnpm though to resolve that sub-dependency correctly, unless... we change approach slightly with how api-docs-tooling is distributed and instead ship a bundled script with no sub-dependencies (or even just the ui-components bundled), similar to how Next.js ships itself via npm with a bunch of vendored/bundled packages. |
Sorry for the confusion folks, I finally had some time to take a look at the example today and it seems that although we did the work to parse git subdirectories from specifiers back in the day, it was never really integrated to the rest of the cli install 😢 💔 |
Shoo; Sadgers. Can this get somehow done on npm? Although relying on a new version wouldn't necessarily be a good idea, IDK. |
Honestly, at this point, the simplest solution IMO is to use a package manager that already supports this functionality. While npm might support it in the future, that doesn’t help us during active development right now. Regardless of whether we decide to bundle this or not (like @MattIPv4 suggested above, and on Slack), pnpm offers the capabilities we need to keep development moving on this repository in the short-term. If something comes up in the long-term (i.e. npm supporting this functionality), we can always switch back. That said, I think we should hold off until the tooling lands in Node core—we don’t want any changes to this repo to interfere with that process. |
I mean, we're reaching the point we already need node-core/ui-components. Another temporary solution for the time being would be Git Submodules. I'm also fine publishing to GitHub Package Registry, so it is org-specifc and not on NPM registry. |
#236 (comment) may make it difficult for contributors to get started if they don't have the proper
That'll work for development, but like you said, it's temporary, and (IIRC) |
We can include the .npmrc within the repository, no? |
No, it would require users to initialize the submodule. It could be a preinstall script within the api-docs-tooling repo tbh. But just shooting random ideas here. |
No, the configuration file needs to have a GitHub PAT token. |
I'm working on a postinstall/preinstall script similar to that which'll install the dependencies. Once I finish it (today?), I'll use it in the JSX generator for importing |
What? But an org-wide registry can be public, doesn't need a token. |
|
Currently, in #273, I'm using a package I made for us to import |
We've explored a variety of ideas, but are now at the point where a decision is necessary, since upcoming generators depend on this functionality. Below is a summary of the final options based on previous discussions. If you are a member of one of the following teams, please vote by reacting:
Only votes from these teams will be counted. Voting Options(feel free to vote for multiple options) 👍 Option 1: Stick with npm; publish Please cast your vote using the appropriate emoji reaction. Thank you! Note: The option "Switch to pnpm and require Footnotes
|
Uh oh!
There was an error while loading. Please reload this page.
npm does not support importing packages from subdirectories of git repositories.
According to npm/npm#2974 (comment):
There are third-party solutions like GitPkg that allow this functionality in npm, but I'm not sure we should rely on a third-party tool to handle imports–lest something bad happen.
However, both Yarn (although, yarn requires the website to also use yarn) and pnpm do support this, so we could convert this repository to use one of them instead.
This would also require any project that runs
api-docs-tooling
use the same package manager (i.e.pnpm dlx
instead ofnpx
for execution).Reference: nodejs/nodejs.org#7401 (comment)
The text was updated successfully, but these errors were encountered: