feat: init category module
This commit is contained in:
36
bin/patch.js
Normal file
36
bin/patch.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// @ts-check
|
||||
const inquirer = require('inquirer')
|
||||
const chalk = require('chalk')
|
||||
const prompt = inquirer.createPromptModule()
|
||||
const package = require('../package.json')
|
||||
const { execSync } = require('child_process')
|
||||
const { resolve } = require('path')
|
||||
const { readdirSync } = require('fs')
|
||||
const PATCH_DIR = resolve(process.cwd(), './patch')
|
||||
|
||||
async function bootstarp() {
|
||||
console.log(chalk.yellowBright('mx-space server patch center'))
|
||||
|
||||
console.log(chalk.yellow(`current version: ${package.version}`))
|
||||
|
||||
const patchFiles = readdirSync(PATCH_DIR).filter(
|
||||
(file) => file.startsWith('v') && file.endsWith('.ts'),
|
||||
)
|
||||
|
||||
prompt({
|
||||
type: 'list',
|
||||
name: 'version',
|
||||
message: 'Select version you want to patch.',
|
||||
choices: patchFiles.map((f) => f.replace(/\.ts$/, '')),
|
||||
}).then(({ version }) => {
|
||||
execSync('yarn run build', {
|
||||
encoding: 'utf-8',
|
||||
})
|
||||
|
||||
const patchPath = resolve('dist/patch/', version + '.js')
|
||||
console.log(chalk.green('starting patch... ' + patchPath))
|
||||
execSync(`node ${patchPath}`, { encoding: 'utf8' })
|
||||
})
|
||||
}
|
||||
|
||||
bootstarp()
|
||||
Reference in New Issue
Block a user