Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: google/zx
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: antongolub/zx
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: test-jsr-optimize
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Dec 15, 2024

  1. test: optimize jsr artifact test

    antongolub committed Dec 15, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    ksperling-apple Karsten Sperling
    Copy the full SHA
    ab2edcf View commit details
Showing with 66 additions and 21 deletions.
  1. +50 −3 package-lock.json
  2. +1 −0 package.json
  3. +1 −1 scripts/build-jsr.mjs
  4. +14 −17 test/it/build-jsr.test.js
53 changes: 50 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
2 changes: 1 addition & 1 deletion scripts/build-jsr.mjs
Original file line number Diff line number Diff line change
@@ -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',
31 changes: 14 additions & 17 deletions test/it/build-jsr.test.js
Original file line number Diff line number Diff line change
@@ -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`
})
})