Skip to content

Commit

Permalink
feat(manifest): add support for bumping deno.json and jsr.json
Browse files Browse the repository at this point in the history
  • Loading branch information
TillaTheHun0 committed Oct 9, 2024
1 parent 573b88f commit c9dd43c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
42 changes: 26 additions & 16 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
import { join } from 'node:path'

const SUPPORTED_RUNTIMES = ['node', 'deno', 'javascript']
const DENO_MANIFEST = 'egg.json'
const DENO_MANIFEST = 'deno.json'
const JSR_MANIFEST = 'jsr.json'
const NEST_MANIFEST = 'egg.json'
const NODE_MANIFEST = 'package.json'

/** @type {const('standard-version').Options} */
const COMMON_DEFAULTS = {
noVerify: true,
// No package files means version always pulled from git tag
packageFiles: [],
// overwritten via runtime deno or node defaults
bumpFiles: [],
skip: {
bump: false,
changelog: true, // skip changelog generation
commit: false,
tag: false
}
}

/** @type {const('standard-version').Options} */
const JS_DEFAULTS = {
bumpFiles: [
{
filename: DENO_MANIFEST,
type: 'json'
},
{
filename: JSR_MANIFEST,
type: 'json'
},
{
filename: NEST_MANIFEST,
type: 'json'
},
{
filename: NODE_MANIFEST,
type: 'json'
Expand All @@ -37,6 +32,21 @@ const JS_DEFAULTS = {
]
}

/** @type {const('standard-version').Options} */
const COMMON_DEFAULTS = {
noVerify: true,
// No package files means version always pulled from git tag
packageFiles: [],
// overwritten via runtime defaults
bumpFiles: [],
skip: {
bump: false,
changelog: true, // skip changelog generation
commit: false,
tag: false
}
}

/**
*
* @param {*} param0
Expand Down
4 changes: 2 additions & 2 deletions test/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe('main', () => {
const { getRuntimeDefaults } = lib()
let res = getRuntimeDefaults('node')

expect(res.bumpFiles.length).toBe(3)
expect(res.bumpFiles.length).toBeGreaterThan(0)

res = getRuntimeDefaults('deno')

expect(res.bumpFiles.length).toBe(3)
expect(res.bumpFiles.length).toBeGreaterThan(0)
expect(() => getRuntimeDefaults('foo_runtime')).toThrow()
})
})
Expand Down

0 comments on commit c9dd43c

Please sign in to comment.