1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-22 20:55:03 +03:00
tabby/scripts/prepackage-plugins.mjs

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-05-01 01:01:12 +03:00
#!/usr/bin/env node
import { rebuild } from 'electron-rebuild'
import sh from 'shelljs'
import path from 'node:path'
import fs from 'node:fs'
import * as vars from './vars.mjs'
import log from 'npmlog'
import * as url from 'url'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
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 => {
2022-01-16 21:41:01 +03: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 16:03:14 +03:00
2022-01-16 21:41:01 +03: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,
2022-10-26 10:45:12 +03:00
useCache: false,
2022-01-16 21:41:01 +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'), '{}')