tabby/scripts/prepackage-plugins.js

36 lines
1 KiB
JavaScript
Raw Normal View History

2017-04-30 22:01:12 +00:00
#!/usr/bin/env node
const rebuild = require('electron-rebuild').default
const sh = require('shelljs')
const path = require('path')
const fs = require('fs')
const vars = require('./vars')
2017-06-09 22:29:16 +00:00
const log = require('npmlog')
2017-04-30 22:01:12 +00:00
let target = path.resolve(__dirname, '../builtin-plugins')
sh.mkdir('-p', target)
fs.writeFileSync(path.join(target, 'package.json'), '{}')
sh.cd(target)
vars.builtinPlugins.forEach(plugin => {
2022-01-16 18:41:01 +00:00
if (plugin === 'tabby-web') {
return
}
log.info('install', plugin)
sh.cp('-r', path.join('..', plugin), '.')
sh.rm('-rf', path.join(plugin, 'node_modules'))
sh.cd(plugin)
sh.exec(`yarn install --force --production`, { fatal: true })
2020-12-24 13:03:14 +00:00
2022-01-16 18:41:01 +00:00
log.info('rebuild', 'native')
if (fs.existsSync('node_modules')) {
rebuild({
buildPath: path.resolve('.'),
electronVersion: vars.electronVersion,
arch: process.env.ARCH ?? process.arch,
force: true,
})
}
sh.cd('..')
2017-04-30 22:01:12 +00:00
})
2017-06-30 22:54:55 +00:00
fs.unlinkSync(path.join(target, 'package.json'), '{}')