Open seriousme opened 3 weeks ago
I think it would be a bit confusing for it to use the version from the package.json file. Would https://github.com/denoland/deno/issues/22663 solve this?
It looks like #22663 would fit the bill as long as I do not have to have a dummy version in deno.json. If I do need to keep the dummy version than it will be more confusing I think.
Another alternative could be a 'deno' section in the package.json which would contain the contents of deno.json. This way it all stays together in a single file and as I understand deno already checks the package.json if deno.json does not exist.
Kind regards, Hans
I think it would be a bit confusing for it to use the version from the package.json file. Would #22663 solve this?
Btw: the idea was to remove the version from deno.json and only if no version is present in deno.json it would look at package.json. Else it would indeed be confusion!
I toyed around with jq
to extract deno.json from package.json and this works:
Package.json:
"name": "@seriousme/opifex",
"version": "1.2.1",
...
"bin": {
"mqtt": "dist/bin/mqtt.js",
"demoServer": "dist/bin/demoServer.js"
},
"exports": {
"./server": "./dist/server/mod.js",
"./client": "./dist/client/mod.js"
},
"deno": {
"exports": {
"./server": "./server/mod.ts",
"./client": "./client/mod.ts"
},
"exclude": [
"dist"
]
},
...
}
then:
"jq '( { name:.name , version:.version} + .deno)' package.json > deno.json"
results in deno.json:
{
"name": "@seriousme/opifex",
"version": "1.2.1",
"exports": {
"./server": "./server/mod.ts",
"./client": "./client/mod.ts"
},
"exclude": [
"dist"
]
}
The downside of this approach is that the version tag applied by npm version
now sits on the commit before the commit to update of deno.json. The script can't be run before npm version
because package.json will still have the original version and not the new one.
It all feels to me like it would be much more convenient and less confusing if Deno could read name
, version
and the deno
section directly from package.json in the absence of a deno.json.
What do you think?
Kind regards, Hans
I built a package that acts like npm version
: https://jsr.io/@krlwlfrt/version
It updates deno.json(c)
and package.json
, runs Deno tasks as lifecycle hooks and commits and tags the changes.
Hi,
I have a package (https://jsr.io/@seriousme/opifex) that I publish on JSR , denoland and on NPM. Since NPM requires the package.json and NodeJS requires JS instead of TS the exports in my package.json differ from the exports in my deno.json. I also do not want deno tools to comment/fail on my generate code in the /dist folder. So as I understand it I need both the package.json and the deno.json.
When publishing a new version I now need to update the version in both package.json as well as deno.json. I could write my own script to update deno.json on an npm version update but it would be nice if
deno publish
could do withoutversion
in deno.json if it finds a version in package.json, or if there would be some other easy way to keep them both in sync.Kind regards, Hans