Skip to content
Snippets Groups Projects
Commit 617b16cb authored by Shachar Itzhaky's avatar Shachar Itzhaky
Browse files

[dev] Support easy testing of addons for wacoq as well.

The script has been renamed `adopt-addons`, because "consume"
sounds a bit harsh.
parent fb4d3d62
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env node
/**
* Useful for development: installs or links addons from a given directory.
* Useful for development: creates links to addons from a given directory.
*/
......@@ -10,15 +10,15 @@ const fs = require('fs'),
glob = require('glob'),
mkdirp = require('mkdirp');
const DEFAULT_CONTEXT = 'jscoq+64bit';
const DEFAULT_CONTEXT = 'jscoq+64bit', DEFAULT_SCOPE = '@jscoq';
const opts = require('commander')
//.option('-l, --link', 'create symbolic links instead of copying')
.option('-c,--build-context <switch>', 'Dune context to look in for build artifacts', DEFAULT_CONTEXT)
.option('-s,--scope <name>', 'NPM scope for packages', DEFAULT_SCOPE)
.parse();
const pkgDir = './node_modules',
pkgPrefix = '@jscoq/',
pkgPrefix = opts.scope.replace(/^([^@])/, '@$1').replace(/([^/])$/, '$1/'),
buildRel = `_build/${opts.buildContext}`;
function consumeFromDirectory(dir) {
......@@ -33,7 +33,7 @@ function consumeFromDirectory(dir) {
}
if (manifest.name.startsWith(pkgPrefix)) {
var source = path.join(buildRel, pkgDir, manifest.name),
var source = path.join(cd_maybe('.', buildRel), pkgDir, manifest.name),
target = path.join(dir, path.dirname(fn));
console.log(`${manifest.name} --> ${target}`);
mkdirp.sync(path.dirname(source));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment