-
Notifications
You must be signed in to change notification settings - Fork 34
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
Investigate using @n-api npm tag #229
Comments
It will be also useful to understand what might be the workflow of older Node.js versions which will get N-API later on. |
And don't confuse tags with npm scopes, which also use a |
@jasongin I tried to build iotivity-node against node-api and I found that the headers are a bit behind - for example, |
@gabrielschulhof The |
@jasongin I think you may have grabbed an older version of the header/source code when you added support for pre-N-API Node.js: https://github.com/nodejs/node-api/blob/master/src/node_api.h#L97 |
I'm trying to build on Node.js version 4.0.0 BTW. |
Oh, yes that copy of the code hasn't been updated in a while. I was waiting for things to settle before I updated it again. You can manually copy the |
I know, but I want to eventually publish to npm.
|
But OK, I'll make a fork and depend on that for now.
…On Fri, Apr 14, 2017 at 10:51 PM, Schulhof, Gabriel ***@***.***> wrote:
I know, but I want to eventually publish to npm.
|
I have just published iotivity-node version 1.2.0-3 to the "n-api" tag. When you type So, I think the way tags work is like this:
So, in terms of semver, I think packages can take advantage of the dash-field. npm accepts it just fine. So, for example, version on the latest tag can take the traditional form of major.minor.patch, whereas packages on the n-api tag can take the same form, except with a -0 attached. |
I guess in terms of developers' workflow, how they maintain their bindings (branch/prepublish script/etc.) is up to them, but basically, to publish is as simple as
for V8, and
for N-API. |
It looks like only one version can be tagged in a certain way. This means that when a later version is tagged as either { name: 'npm-test-p4ck4g3',
'dist-tags': { latest: '1.0.1', sometag: '1.0.1-sometag' },
versions: [ '1.0.0-sometag', '1.0.0', '1.0.1-sometag', '1.0.1' ],
maintainers: [ 'gabrielschulhof <[email protected]>' ],
time:
{ modified: '2017-04-27T19:25:28.770Z',
created: '2017-04-27T19:23:29.321Z',
'1.0.0': '2017-04-27T19:23:29.321Z',
'1.0.0-sometag': '2017-04-27T19:24:52.541Z',
'1.0.1': '2017-04-27T19:25:11.315Z',
'1.0.1-sometag': '2017-04-27T19:25:28.770Z' },
license: 'ISC',
readmeFilename: '',
version: '1.0.1',
description: '',
main: 'index.js',
scripts: { test: 'echo "Error: no test specified" && exit 1' },
author: '',
dist:
{ shasum: 'a61f936d507bafd1ae5608c95625bd74a7cf06a0',
tarball: 'https://registry.npmjs.org/npm-test-p4ck4g3/-/npm-test-p4ck4g3-1.0.1.tgz' },
directories: {} } |
Dependents can write ...
"dependencies": {
"npm-test-p4ck4g3": "sometag"
}
... and they will receive the latest version published under the tag |
We should ask ourselves: are we going to be experimental for so long that dependents of modules will want to refer to a range of N-API-enabled versions? Being able to tag a single version as N-API-enabled and then moving that forward should be enough to get us through the experimental period. |
Even if N-API is not experimental for more than a few months, package authors may consider their N-API port to be experimental for far longer, if they feel they need more time to stabilize after a port that touched a lot of code in a complex package. |
That's fair. Still, would those depending on such a module ever need to refer to a range of past tagged versions, given that all such versions are experimental? And let's remember that all we're losing is the (in?)convenience of receiving the latest package that matches your specified range. Your choice is instead limited to either the latest (if you put "n-api" as your desired version) or a specific version which is known to be N-API-enabled (if you put that specific version as your desired version). |
I say (in?) because receiving a newer version is sometimes undesirable because it introduces churn. That's what shrinkwrap is all about. However, when you're in experimental territory anyway, I would argue that the more tools you have to keep the parts from moving, the better. So, perhaps the inability to specify carets or tildes is actually quite desirable. |
Command line experience |
To publish an N-API version of your package alongside your non-N-API versionThe following steps are illustrated using the package
Tagging the release with To introduce a dependency on an N-API version of a packageFor example, to add the N-API version of "dependencies": {
"iotivity-node": "n-api"
} Note that, unlike regular versions, tagged versions cannot be addressed by version ranges such as "dependencies": {
"iotivity-node": "1.2.0-3"
} |
What is the maintainers' workflow for publishing?
What is the workflow for depending on vs. depending on the mainstream V8 version? (package.json)
The text was updated successfully, but these errors were encountered: