sakura/scripts/mdc-upgrade.mjs

24 lines
512 B
JavaScript
Raw Permalink Normal View History

2021-07-09 18:28:29 +08:00
'use strict'
import { exec } from 'child_process'
import { readFileSync } from 'fs'
const json = JSON.parse(readFileSync('package.json'))
const dependencies = json.dependencies
let deps = ''
Object.keys(dependencies).forEach((key) => {
if (/@material\//.test(key)) deps += ` ${key}@canary `
})
const command = `yarn upgrade ${deps}`
console.log(command)
exec(command, (error, stdout, stderr) => {
if (error) console.error(error)
if (stderr) console.warn(stderr)
if (stdout) console.log(stdout)
})