Commit e7b957c
Changed files (4)
scripts/build-jsr.mjs
@@ -21,7 +21,7 @@ const pkgJson = JSON.parse(
)
fs.writeFileSync(
- path.resolve(cwd, 'jsr.json'),
+ path.resolve(root, 'jsr.json'),
JSON.stringify(
{
name: '@zx/zx',
test/it/build-jsr.test.js
@@ -17,39 +17,36 @@ import { describe, before, after, it } from 'node:test'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
const root = path.resolve(__dirname, '../../')
-const pkgJson = JSON.parse(
- fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8')
-)
-describe('jsr artefact', () => {
+describe('jsr artifact', () => {
let tmp
let t$
before(async () => {
tmp = tempdir()
t$ = $({ cwd: tmp, quiet: true })
- path.resolve(tmp, 'node_modules/zx')
- await fs.outputJSON(path.resolve(tmp, 'package.json'), pkgJson)
-
- await t$`npm i`
// copy all for jsr publish
await Promise.all(
- ['src/', 'tsconfig.json', 'LICENSE', 'scripts/build-jsr.mjs'].map(
- async (filepath) => {
- return await fs.copy(
- path.resolve(path.join(root, filepath)),
- path.resolve(path.join(tmp, filepath))
- )
- }
+ [
+ 'src/',
+ 'tsconfig.json',
+ 'LICENSE',
+ 'scripts/build-jsr.mjs',
+ 'package.json',
+ ].map((filepath) =>
+ fs.copy(
+ path.resolve(path.join(root, filepath)),
+ path.resolve(path.join(tmp, filepath))
+ )
)
)
+ await t$`ln -s ${path.resolve(root, 'node_modules')} ${path.resolve(tmp, 'node_modules')}`
})
-
after(() => fs.remove(tmp))
it('publish --dry-run --allow-dirty`', async () => {
await t$`node scripts/build-jsr.mjs`
- await t$`npx jsr publish --dry-run --allow-dirty`
+ await t$({ quiet: false })`jsr publish --dry-run --allow-dirty`
})
})
package-lock.json
@@ -34,6 +34,7 @@
"esbuild-plugin-utils": "^0.1.0",
"fs-extra": "^11.2.0",
"globby": "^14.0.2",
+ "jsr": "^0.13.2",
"madge": "^8.0.0",
"minimist": "^1.2.8",
"node-fetch-native": "^1.6.4",
@@ -3131,6 +3132,21 @@
"graceful-fs": "^4.1.6"
}
},
+ "node_modules/jsr": {
+ "version": "0.13.2",
+ "resolved": "https://registry.npmjs.org/jsr/-/jsr-0.13.2.tgz",
+ "integrity": "sha512-c4ir0ql2Xgpg9mSOSPKBANS9oTvlV8fSzpesCsHP04VAOJ3pBm7YygY2LVkHC0jz9G36JBGh1oiEZTWO4UyctA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kolorist": "^1.8.0",
+ "node-stream-zip": "^1.15.0",
+ "semiver": "^1.1.0"
+ },
+ "bin": {
+ "jsr": "dist/bin.js"
+ }
+ },
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -3141,6 +3157,13 @@
"node": ">=0.10.0"
}
},
+ "node_modules/kolorist": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.8.0.tgz",
+ "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/lilconfig": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz",
@@ -3580,9 +3603,9 @@
"license": "MIT"
},
"node_modules/nanoid": {
- "version": "3.3.7",
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
- "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
+ "version": "3.3.8",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
+ "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
"dev": true,
"funding": [
{
@@ -3628,6 +3651,20 @@
"node": ">=18"
}
},
+ "node_modules/node-stream-zip": {
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/node-stream-zip/-/node-stream-zip-1.15.0.tgz",
+ "integrity": "sha512-LN4fydt9TqhZhThkZIVQnF9cwjU3qmUH9h78Mx/K7d3VvfRqqwthLwJEUOEL0QPZ0XQmNN7be5Ggit5+4dq3Bw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/antelle"
+ }
+ },
"node_modules/normalize-package-data": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz",
@@ -4495,6 +4532,16 @@
"node": ">=18"
}
},
+ "node_modules/semiver": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz",
+ "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
package.json
@@ -115,6 +115,7 @@
"esbuild-plugin-utils": "^0.1.0",
"fs-extra": "^11.2.0",
"globby": "^14.0.2",
+ "jsr": "^0.13.2",
"madge": "^8.0.0",
"minimist": "^1.2.8",
"node-fetch-native": "^1.6.4",