1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-23 05:03:36 +03:00
tabby/scripts/prepackage-plugins.js

36 lines
962 B
JavaScript
Raw Normal View History

2017-05-01 01:01:12 +03: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-10 01:29:16 +03:00
const log = require('npmlog')
2017-05-01 01:01:12 +03: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 => {
2021-06-30 00:57:04 +03:00
if (plugin === 'tabby-web') {
2021-05-24 22:15:08 +03:00
return
}
2017-06-10 01:29:16 +03:00
log.info('install', plugin)
sh.cp('-r', path.join('..', plugin), '.')
sh.rm('-rf', path.join(plugin, 'node_modules'))
sh.cd(plugin)
2020-12-24 16:03:14 +03:00
sh.exec(`yarn install --force --production`)
2017-06-10 01:29:16 +03:00
log.info('rebuild', 'native')
if (fs.existsSync('node_modules')) {
2020-12-24 16:03:14 +03:00
rebuild({
buildPath: path.resolve('.'),
electronVersion: vars.electronVersion,
arch: process.env.ARCH ?? process.arch,
force: true,
})
2017-06-10 01:29:16 +03:00
}
sh.cd('..')
2017-05-01 01:01:12 +03:00
})
2017-07-01 01:54:55 +03:00
fs.unlinkSync(path.join(target, 'package.json'), '{}')