Working seshat building on Windows
This commit is contained in:
@@ -20,7 +20,7 @@ const rimraf = require('rimraf');
|
||||
|
||||
async function clean(hakEnv, moduleInfo) {
|
||||
await new Promise((resolve, reject) => {
|
||||
rimraf(moduleInfo.moduleHakDir, (err) => {
|
||||
rimraf(moduleInfo.moduleDotHakDir, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
|
||||
@@ -62,10 +62,10 @@ async function fetch(hakEnv, moduleInfo) {
|
||||
|
||||
const tarballUrl = versions[orderedVersions[0]]['dist.tarball'];
|
||||
|
||||
await mkdirp(moduleInfo.moduleHakDir);
|
||||
await mkdirp(moduleInfo.moduleDotHakDir);
|
||||
|
||||
const parsedUrl = url.parse(tarballUrl);
|
||||
const tarballFile = path.join(moduleInfo.moduleHakDir, path.basename(parsedUrl.path));
|
||||
const tarballFile = path.join(moduleInfo.moduleDotHakDir, path.basename(parsedUrl.path));
|
||||
|
||||
let haveTarball;
|
||||
try {
|
||||
@@ -89,9 +89,10 @@ async function fetch(hakEnv, moduleInfo) {
|
||||
strip: 1,
|
||||
});
|
||||
|
||||
console.log("Running yarn install in " + moduleInfo.moduleBuildDir);
|
||||
await new Promise((resolve, reject) => {
|
||||
const proc = child_process.spawn(
|
||||
'yarn',
|
||||
hakEnv.isWin() ? 'yarn.cmd' : 'yarn',
|
||||
['install', '--ignore-scripts'],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
|
||||
@@ -14,7 +14,10 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const mkdirp = require('mkdirp');
|
||||
|
||||
async function fetchDeps(hakEnv, moduleInfo) {
|
||||
await mkdirp(moduleInfo.moduleDotHakDir);
|
||||
if (moduleInfo.scripts.fetchDeps) {
|
||||
await moduleInfo.scripts.fetchDeps(hakEnv, moduleInfo);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,8 @@ async function main() {
|
||||
name: dep,
|
||||
version: hakDepsCfg[dep],
|
||||
cfg: hakJson,
|
||||
moduleHakDir: path.join(hakEnv.dotHakDir, dep),
|
||||
moduleHakDir: path.join(prefix, 'hak', dep),
|
||||
moduleDotHakDir: path.join(hakEnv.dotHakDir, dep),
|
||||
moduleBuildDir: path.join(hakEnv.dotHakDir, dep, 'build'),
|
||||
moduleOutDir: path.join(hakEnv.dotHakDir, dep, 'out'),
|
||||
nodeModuleBinDir: path.join(hakEnv.dotHakDir, dep, 'build', 'node_modules', '.bin'),
|
||||
|
||||
@@ -32,12 +32,22 @@ async function link(hakEnv, moduleInfo) {
|
||||
} catch (e) {
|
||||
await fsProm.writeFile(
|
||||
yarnrc,
|
||||
'--link-folder ' + path.join(hakEnv.dotHakDir, 'links') + os.EOL,
|
||||
// XXX: 1. This must be absolute, as yarn will resolve link directories
|
||||
// relative to the closest project root, which means when we run it
|
||||
// in the dependency project, it will put the link directory in its
|
||||
// own project folder rather than the main project.
|
||||
// 2. We put a colon on the end of the key, which is not what yarn's
|
||||
// stringifier does and not really the format of the file, but it happens
|
||||
// to work and also work around the bug where the parser breaks on values
|
||||
// with a colon in them (which absolute windows paths do).
|
||||
'--link-folder: ' + path.join(hakEnv.dotHakDir, 'links') + os.EOL,
|
||||
);
|
||||
}
|
||||
|
||||
const yarnCmd = 'yarn' + (hakEnv.isWin() ? '.cmd' : '');
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const proc = child_process.spawn('yarn', ['link'], {
|
||||
const proc = child_process.spawn(yarnCmd, ['link'], {
|
||||
cwd: moduleInfo.moduleOutDir,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
@@ -47,7 +57,7 @@ async function link(hakEnv, moduleInfo) {
|
||||
});
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const proc = child_process.spawn('yarn', ['link', moduleInfo.name], {
|
||||
const proc = child_process.spawn(yarnCmd, ['link', moduleInfo.name], {
|
||||
cwd: hakEnv.projectRoot,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user