Skip to content

Commit ac187e6

Browse files
committed
chore: convert bump script to mjs
1 parent bb8381c commit ac187e6

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"lint": "eslint --ext .ts --ext .vue .",
2222
"prepack": "yarn build",
2323
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
24-
"release:bump-edge": "jiti ./scripts/bump-edge",
2524
"test": "yarn lint"
2625
},
2726
"dependencies": {
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { globby } from 'globby'
55

66
// Temporary forked from nuxt/framework
77

8-
async function loadPackage (dir: string) {
8+
async function loadPackage (dir) {
99
const pkgPath = resolve(dir, 'package.json')
1010
const data = JSON.parse(await fsp.readFile(pkgPath, 'utf-8').catch(() => '{}'))
1111
const save = () => fsp.writeFile(pkgPath, JSON.stringify(data, null, 2) + '\n')
1212

13-
const updateDeps = (reviver: Function) => {
13+
const updateDeps = (reviver) => {
1414
for (const type of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
1515
if (!data[type]) { continue }
1616
for (const e of Object.entries(data[type])) {
@@ -31,30 +31,27 @@ async function loadPackage (dir: string) {
3131
}
3232
}
3333

34-
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T
35-
type Package = ThenArg<ReturnType<typeof loadPackage>>
36-
37-
async function loadWorkspace (dir: string) {
34+
async function loadWorkspace (dir) {
3835
const workspacePkg = await loadPackage(dir)
3936
const pkgDirs = await globby(workspacePkg.data.workspaces || [], { onlyDirectories: true })
4037

41-
const packages: Package[] = [workspacePkg]
38+
const packages= [workspacePkg]
4239

4340
for (const pkgDir of pkgDirs) {
4441
const pkg = await loadPackage(pkgDir)
4542
if (!pkg.data.name) { continue }
4643
packages.push(pkg)
4744
}
4845

49-
const find = (name: string) => {
46+
const find = (name) => {
5047
const pkg = packages.find(pkg => pkg.data.name === name)
5148
if (!pkg) {
5249
throw new Error('Workspace package not found: ' + name)
5350
}
5451
return pkg
5552
}
5653

57-
const rename = (from: string, to: string) => {
54+
const rename = (from, to) => {
5855
find(from).data.name = to
5956
for (const pkg of packages) {
6057
pkg.updateDeps((dep) => {
@@ -65,7 +62,7 @@ async function loadWorkspace (dir: string) {
6562
}
6663
}
6764

68-
const setVersion = (name: string, newVersion: string) => {
65+
const setVersion = (name, newVersion) => {
6966
find(name).data.version = newVersion
7067
for (const pkg of packages) {
7168
pkg.updateDeps((dep) => {

scripts/release-edge.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set -xe
66

77
# Bump versions to edge
8-
yarn release:bump-edge
8+
node ./scripts/bump-edge.mjs
99

1010
# Update token
1111
if [[ ! -z ${NODE_AUTH_TOKEN} ]] ; then

0 commit comments

Comments
 (0)