From 434da35020035687d6cfd85a9c007c48d46edcc0 Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Tue, 26 Feb 2019 15:09:10 -0500 Subject: [PATCH] Fixed babel compilation in `perspective-d3fc-plugin` package --- packages/perspective-viewer-d3fc/babel.config.js | 15 +++++++-------- packages/perspective-viewer-d3fc/package.json | 9 ++++++--- .../src/config/d3fc.plugin.config.js | 2 +- .../src/js/plugin/template.js | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/perspective-viewer-d3fc/babel.config.js b/packages/perspective-viewer-d3fc/babel.config.js index 30713c0043..d67e68af15 100644 --- a/packages/perspective-viewer-d3fc/babel.config.js +++ b/packages/perspective-viewer-d3fc/babel.config.js @@ -1,22 +1,21 @@ module.exports = { - "presets": [ + presets: [ [ "@babel/preset-env", { - "useBuiltIns": "usage" + useBuiltIns: "usage" } ] ], - "sourceType": "unambiguous", - "plugins": [ - ["@babel/plugin-proposal-decorators", {"legacy": true}], + sourceType: "unambiguous", + plugins: [ + ["@babel/plugin-proposal-decorators", {legacy: true}], "transform-custom-element-classes", - "@babel/plugin-transform-runtime", [ "@babel/plugin-transform-for-of", { - "loose": true + loose: true } ] ] -}; \ No newline at end of file +}; diff --git a/packages/perspective-viewer-d3fc/package.json b/packages/perspective-viewer-d3fc/package.json index dfe92a7943..160bfbba37 100644 --- a/packages/perspective-viewer-d3fc/package.json +++ b/packages/perspective-viewer-d3fc/package.json @@ -2,17 +2,20 @@ "name": "@jpmorganchase/perspective-viewer-d3fc", "version": "0.2.10", "description": "Perspective.js", - "main": "src/js/plugin/plugin.js", + "main": "cjs/js/plugin/plugin.js", "files": [ "build/**/*", - "src/**/*", + "cjs/**/*", "babel.config.js" ], "scripts": { "bench": "npm-run-all bench:build bench:run", "bench:build": "echo \"No Benchmarks\"", "bench:run": "echo \"No Benchmarks\"", - "build": "webpack --color --config src/config/d3fc.plugin.config.js", + "prebuild": "mkdir -p cjs", + "build:babel": "cp -r src/* cjs && babel src/js --source-maps --out-dir cjs/js", + "build:webpack": "webpack --color --config src/config/d3fc.plugin.config.js", + "build": "npm-run-all build:babel build:webpack", "test:build": "cp test/html/* build", "watch": "webpack --color --watch --config src/config/d3fc.plugin.config.js", "test:run": "jest --silent --color 2>&1", diff --git a/packages/perspective-viewer-d3fc/src/config/d3fc.plugin.config.js b/packages/perspective-viewer-d3fc/src/config/d3fc.plugin.config.js index 0b6a5f393e..9469b4da19 100644 --- a/packages/perspective-viewer-d3fc/src/config/d3fc.plugin.config.js +++ b/packages/perspective-viewer-d3fc/src/config/d3fc.plugin.config.js @@ -2,7 +2,7 @@ const path = require("path"); const common = require("@jpmorganchase/perspective/src/config/common.config.js"); module.exports = Object.assign({}, common(), { - entry: "./src/js/plugin/plugin.js", + entry: "./cjs/js/plugin/plugin.js", output: { filename: "d3fc.plugin.js", library: "perspective-view-d3fc", diff --git a/packages/perspective-viewer-d3fc/src/js/plugin/template.js b/packages/perspective-viewer-d3fc/src/js/plugin/template.js index 5ad5297d94..dcea127bdc 100644 --- a/packages/perspective-viewer-d3fc/src/js/plugin/template.js +++ b/packages/perspective-viewer-d3fc/src/js/plugin/template.js @@ -13,7 +13,7 @@ import perspectiveStyle from "../../less/perspective-view.less"; import template from "../../html/d3fc-chart.html"; import {areArraysEqualSimple} from "../utils/utils"; -import {bindTemplate} from "@jpmorganchase/perspective-viewer/src/js/utils"; +import {bindTemplate} from "@jpmorganchase/perspective-viewer/cjs/js/utils"; const styleWithD3FC = `${style}${getD3FCStyles()}`;