Skip to content

Commit

Permalink
[js] Stop using hardcoded paths in our release helper
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Oct 6, 2018
1 parent 512dbe6 commit a24c37b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/vm/js/make-release.js
Expand Up @@ -4,6 +4,8 @@ const path = require('path');
const releaseDir = 'release';

const version = process.argv[2];
const rakudoPath = process.argv[3];
const nqpInstallPath = process.argv[4];

if (!version) {
console.error('USAGE: node make-release.js VERSION');
Expand All @@ -16,17 +18,18 @@ try {
if (e.code !== 'EEXIST') throw e;
}

const precompiledPerl6 = '/home/pmurias/rakudo/node_modules';
const precompiledPerl6 = path.join(rakudoPath, 'node_modules');

function prepare(oldPath, newPath) {
console.log('generating', newPath);
let contents = fs.readFileSync(oldPath, 'utf8');

contents = contents.replace('var nqp = require("/home/pmurias/nqp/install/share/nqp/lib/nqp-js-on-js/node_modules/nqp-runtime");', 'var nqp = require("nqp-runtime");\n');
contents = contents.replace('var nqp = require("' + path.join(nqpInstallPath, "share/nqp/lib/nqp-js-on-js/node_modules/nqp-runtime") + '");', 'var nqp = require("nqp-runtime");\n');

contents = contents.replace('nqp.libpath(["/home/pmurias/rakudo/node_modules/","/home/pmurias/nqp/install/share/nqp/lib/nqp-js-on-js/"]);', 'nqp.libpath([{module: module, prefix:\'.\/\'}, {module: module, prefix:\'nqp-js-on-js/\'}]);\n');

contents = contents.replace('nqp.extraRuntime(\'perl6\', "/home/pmurias/rakudo/src/vm/js/perl6-runtime")', 'nqp.extraRuntime(\'perl6\', module);');
contents = contents.replace('nqp.libpath(["' + path.join(rakudoPath, "node_modules/") + '","' + path.join(nqpInstallPath, "share/nqp/lib/nqp-js-on-js/") + '"]);', 'nqp.libpath([{module: module, prefix:\'.\/\'}, {module: module, prefix:\'nqp-js-on-js/\'}]);\n');

contents = contents.replace('nqp.extraRuntime(\'perl6\', "' + path.join(rakudoPath, "src/vm/js/perl6-runtime") + '")', 'nqp.extraRuntime(\'perl6\', module);');
fs.writeFileSync(newPath, contents);
}

Expand Down

0 comments on commit a24c37b

Please sign in to comment.