mirror of
https://github.com/coder/code-server.git
synced 2024-12-20 08:11:32 +03:00
0c2c957312
* Fix readdir for root path * Fix merge of webpack conf * Fix travis.yml to deploy on master * Remove windows platform from travis.yml * Enable caching * mkdirpSync * Fix build script
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
const fs = require("fs");
|
|
const fse = require("fs-extra");
|
|
const os = require("os");
|
|
const path = require("path");
|
|
|
|
const nexePath = require.resolve("nexe");
|
|
const shimPath = path.join(path.dirname(nexePath), "lib/steps/shim.js");
|
|
let shimContent = fs.readFileSync(shimPath).toString();
|
|
const replaceString = `global.nativeFs = { readdir: originalReaddir, readdirSync: originalReaddirSync };`;
|
|
shimContent = shimContent.replace(/compiler\.options\.resources\.length[\s\S]*wrap\("(.*\\n)"/g, (om, a) => {
|
|
return om.replace(a, `${a}${replaceString}`);
|
|
});
|
|
fs.writeFileSync(shimPath, shimContent);
|
|
|
|
const nexe = require("nexe");
|
|
|
|
nexe.compile({
|
|
debugBundle: true,
|
|
input: path.join(__dirname, "../out/cli.js"),
|
|
output: `cli-${process.env.TRAVIS_OS_NAME || os.platform()}`,
|
|
targets: [os.platform()],
|
|
/**
|
|
* To include native extensions, do NOT install node_modules for each one. They
|
|
* are not required as each extension is built using webpack.
|
|
*/
|
|
resources: [
|
|
path.join(__dirname, "../package.json"),
|
|
path.join(__dirname, "../build/**/*"),
|
|
],
|
|
});
|