Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Babel build system to remove need for unsafe-eval in CSP #59

Merged
merged 4 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
{
"env": {
"test": {
"presets": [["@babel/preset-env"], "@babel/preset-react"]
}
},
"presets": [
["env", {
"modules": false
}],
"stage-0",
"react"
]
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": ["@babel/plugin-proposal-class-properties"],
"ignore": ["node_modules/**"]
}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: node_js
node_js:
- 9
- 8
- 11
- 10
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "revops-js",
"version": "1.0.0-beta22",
"version": "1.0.0-beta23",
"description": "Official RevOps Javascript Component Library",
"author": "RevOps",
"license": "MIT",
Expand All @@ -9,8 +9,7 @@
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
"node": ">=10"
},
"scripts": {
"test": "cross-env CI=1 react-scripts test --env=jsdom",
Expand All @@ -30,13 +29,10 @@
"react-dom": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-transform-runtime": "^7.8.3",
"@svgr/rollup": "^2.4.1",
"axios-mock-adapter": "^1.17.0",
"babel-core": "^6.26.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"chai": "^4.2.0",
"cross-env": "^5.2.1",
"enzyme": "^3.10.0",
Expand All @@ -49,11 +45,11 @@
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-standard": "^3.1.0",
"gh-pages": "^1.2.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "^3.0.1",
"rollup": "^0.64.1",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
Expand All @@ -68,6 +64,8 @@
"themes"
],
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/runtime": "^7.8.4",
"babel-plugin-transform-runtime": "^6.23.0",
"lodash": "^4.17.15",
"react-plaid-link": "^1.5.0"
Expand Down
30 changes: 15 additions & 15 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import svgr from '@svgr/rollup'
import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import external from "rollup-plugin-peer-deps-external";
import postcss from "rollup-plugin-postcss";
import resolve from "rollup-plugin-node-resolve";
import url from "rollup-plugin-url";
import svgr from "@svgr/rollup";

import pkg from './package.json'
import pkg from "./package.json";

export default {
input: 'src/index.js',
input: "src/index.js",
output: [
{
file: pkg.main,
format: 'cjs',
format: "cjs",
sourcemap: true
},
{
file: pkg.module,
format: 'es',
format: "es",
sourcemap: true
}
],
Expand All @@ -27,18 +27,18 @@ export default {
postcss({
modules: true,
extract: true,
extensions: ['.css']
extensions: [".css"]
}),
url(),
svgr(),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
plugins: ['external-helpers', 'transform-runtime']
exclude: "node_modules/**",
plugins: ["@babel/plugin-transform-runtime"]
}),
resolve({
browser: true
}),
commonjs()
]
}
};
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const configureVault = (
apiOptions = {
env: 'production',
},
onLoad: false,
onLoad
) => {
if (!!window !== true && !!document !== true) {
throw new Error("Illegal call. `configureVault` is being executed outside browser context.")
Expand Down
3 changes: 0 additions & 3 deletions src/models/EntityModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { EntityDate } from './index'

export class EntityModel {

dateUpdated: string
dateCreated: string

constructor(params = {}) {
this.id = params.id || this._generateUUID()
this.dateUpdated = params.dateUpdated || new EntityDate().toIsoString()
Expand Down