mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
chore: Update yarn, refactor packages setup (#4085)
* Update yarn, refactor packages setup * Rename some jobs in lib-check.yml * Update website/yarn.lock * Revert build-type-and-test job name change
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
import childProcess from 'node:child_process'
|
||||
import fs from 'node:fs/promises'
|
||||
import { argv } from 'node:process'
|
||||
import { execSync } from 'node:child_process'
|
||||
import { readFile, writeFile } from 'node:fs/promises'
|
||||
|
||||
const packageName = argv[2]
|
||||
const packageName = process.argv[2]
|
||||
|
||||
if (!packageName) {
|
||||
throw new Error('No package name specified')
|
||||
}
|
||||
|
||||
const commitHash = childProcess.execSync('git rev-parse HEAD').toString().trim().slice(0, 7)
|
||||
const commitHash = execSync('git rev-parse HEAD').toString().slice(0, 7)
|
||||
|
||||
const file = JSON.parse(await fs.readFile(`packages/${packageName}/package.json`, 'utf-8'))
|
||||
const file = JSON.parse(await readFile(`packages/${packageName}/package.json`, 'utf-8'))
|
||||
|
||||
const oldVersion = file.version
|
||||
file.version = `${oldVersion.split('-')[0]}-next.${commitHash}`
|
||||
file.version = `${file.version.split('-')[0]}-next.${commitHash}`
|
||||
|
||||
if (file.dependencies) {
|
||||
Object.keys(file.dependencies).forEach((dependency) => {
|
||||
@@ -21,6 +19,6 @@ if (file.dependencies) {
|
||||
})
|
||||
}
|
||||
|
||||
await fs.writeFile(`packages/${packageName}/package.json`, JSON.stringify(file, null, 2))
|
||||
await writeFile(`packages/${packageName}/package.json`, JSON.stringify(file, null, 2))
|
||||
|
||||
console.log(`Bumped ${packageName} to ${file.version.split('-')[0]}-next.${commitHash}`)
|
||||
|
||||
Reference in New Issue
Block a user