Skip to content

Commit

Permalink
Merge pull request #304 from jpmorganchase/package-fix
Browse files Browse the repository at this point in the history
Fixed package error which excluded perspective from it's own plugin
  • Loading branch information
texodus authored Nov 12, 2018
2 parents 0831d4f + 4b0d67c commit 506098d
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 18 deletions.
3 changes: 2 additions & 1 deletion packages/perspective-jupyterlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build/*.js.map",
"build/*.js",
"build/*.wasm",
"src/css/*.css"
"src/css/*.css",
"babel.config.js"
],
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion packages/perspective-viewer-highcharts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "src/js/highcharts.js",
"files": [
"build/**/*",
"src/**/*"
"src/**/*",
"babel.config.js"
],
"scripts": {
"bench": "npm-run-all bench:build bench:run",
Expand Down
3 changes: 2 additions & 1 deletion packages/perspective-viewer-hypergrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "src/js/hypergrid.js",
"files": [
"build/**/*",
"src/**/*"
"src/**/*",
"babel.config.js"
],
"scripts": {
"bench": "npm-run-all bench:build bench:run",
Expand Down
3 changes: 2 additions & 1 deletion packages/perspective-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "src/js/view.js",
"files": [
"build/**/*",
"src/**/*"
"src/**/*",
"babel.config.js"
],
"scripts": {
"bench": "npm-run-all bench:build bench:run",
Expand Down
3 changes: 2 additions & 1 deletion packages/perspective/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build/*",
"index.d.ts",
"src/**/*",
"webpack-plugin.js"
"webpack-plugin.js",
"babel.config.js"
],
"typings": "index.d.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective/src/js/psp.async.wasm.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import wasm from "../../obj/psp.async.wasm";
import wasm from "../../build/psp.async.wasm";
export default wasm;
2 changes: 1 addition & 1 deletion packages/perspective/src/js/psp.sync.wasm.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import wasm from "../../obj/psp.sync.wasm";
import wasm from "../../build/psp.sync.wasm";
export default wasm;
7 changes: 1 addition & 6 deletions packages/perspective/src/loader/cross_origin_file_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ exports.pitch = function pitch(request) {
validateOptions(schema, options, "Cross Origin File Loader");

var context = options.context || this.rootContext || (this.options && this.options.context);
var content = fs.readFileSync(
request
.replace("src/js", "obj")
.replace("build/es5", "build")
.replace("wasm.js", "wasm")
);
var content = fs.readFileSync(request.replace("src/js", "build").replace("wasm.js", "wasm"));
var url = loaderUtils.interpolateName(this, options.name, {
context,
content,
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective/webpack-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class PerspectiveWebpackPlugin {
rules.push({
test: /\.js$/,
include: load_path,
exclude: /node_modules\/(?!(\@apache|\@jupyterlab))|psp\.(asmjs|async|sync)\.js/,
exclude: /node_modules[/\\](?!\@jpmorganchase)|psp\.(asmjs|async|sync)\.js/,
loader: "babel-loader",
options: BABEL_CONFIG
});
Expand Down
9 changes: 5 additions & 4 deletions scripts/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const RUNTIMES = AVAILABLE_RUNTIMES.filter(runtime => runtime.build).length ? AV

// Directory of Emscripten output
const BASE_DIRECTORY = path.join(__dirname, "..", "obj", "build");
const getOuputDir = packageName => path.join(__dirname, "..", "packages", packageName, "obj");
const getOuputDir = packageName => path.join(__dirname, "..", "packages", packageName);

const templateSource = source => `
var window = window || {};
Expand All @@ -62,11 +62,12 @@ function compileRuntime({inputFile, inputWasmFile, format, packageName}) {

const OUTPUT_DIRECTORY = getOuputDir(packageName);

mkdirp.sync(OUTPUT_DIRECTORY);
mkdirp.sync(path.join(OUTPUT_DIRECTORY, "obj"));
mkdirp.sync(path.join(OUTPUT_DIRECTORY, "build"));

if (inputWasmFile) {
console.log("Copying WASM file %s", inputWasmFile);
fs.copyFileSync(path.join(BASE_DIRECTORY, inputWasmFile), path.join(OUTPUT_DIRECTORY, inputWasmFile));
fs.copyFileSync(path.join(BASE_DIRECTORY, inputWasmFile), path.join(path.join(OUTPUT_DIRECTORY, "build"), inputWasmFile));
}

console.debug("Creating wrapped js runtime");
Expand All @@ -86,7 +87,7 @@ function compileRuntime({inputFile, inputWasmFile, format, packageName}) {
});
}

fs.writeFileSync(path.join(OUTPUT_DIRECTORY, inputFile), source);
fs.writeFileSync(path.join(path.join(OUTPUT_DIRECTORY, "obj"), inputFile), source);
console.log("Completed runtime %s", inputFile);
}

Expand Down

0 comments on commit 506098d

Please sign in to comment.