From 52d47fb634f0a77a5e0b519014d8e5c1c877cffa Mon Sep 17 00:00:00 2001 From: mrsteele Date: Fri, 18 Jan 2019 00:16:15 -0500 Subject: [PATCH 1/2] chore: removing babel --- browser.js | 2 +- index.js | 11 +++-------- package.json | 24 +++--------------------- src/index.js | 8 ++++---- test/main.spec.js | 12 ++++++------ 5 files changed, 17 insertions(+), 40 deletions(-) diff --git a/browser.js b/browser.js index 90f2d24..df84dd3 100644 --- a/browser.js +++ b/browser.js @@ -1,3 +1,3 @@ -var plugin = require('./dist').default +var plugin = require('./src') module.exports = plugin diff --git a/index.js b/index.js index 0592337..2a31e73 100644 --- a/index.js +++ b/index.js @@ -2,15 +2,10 @@ let plugin try { - plugin = require('./dist').default + plugin = require('./src') } catch (err) { - if (err.code === 'MODULE_NOT_FOUND') { - require('babel-register') - plugin = require('./src').default - } else { - console.log(err) - process.exit(1) - } + console.log(err) + process.exit(1) } module.exports = plugin diff --git a/package.json b/package.json index d1f82a0..7dc8f17 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,8 @@ "lint": "standard", "predoc": "rimraf docs", "doc": "esdoc -c config/doc.json", - "pretest": "npm run build", - "test": "nyc _mocha --compilers js:babel-register", + "test": "nyc _mocha", "posttest": "nyc report --reporter=lcov", - "prebuild": "rimraf dist", - "build": "babel --copy-files --out-dir dist src", "travis": "npm run lint && npm t" }, "repository": { @@ -45,41 +42,26 @@ "dotenv-defaults": "^1.0.2" }, "devDependencies": { - "babel-cli": "^6.26.0", - "babel-eslint": "^10.0.1", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-preset-env": "^1.6.1", - "babel-register": "^6.26.0", "chai": "^4.1.2", "esdoc": "^1.0.4", "esdoc-standard-plugin": "^1.0.0", "husky": "^1.1.2", "mocha": "^5.0.1", "nyc": "^13.1.0", - "rimraf": "^2.6.2", "sinon": "^7.0.0", "standard": "^12.0.0", "webpack": "^4.6.0" }, "files": [ - "dist" + "src" ], "standard": { "parser": "babel-eslint" }, "browser": "browser.js", - "babel": { - "presets": [ - "env" - ], - "plugins": [ - "transform-object-assign" - ] - }, "nyc": { "include": [ - "src/**/*.js", - "dist/**/*.js" + "src/**/*.js" ] } } diff --git a/src/index.js b/src/index.js index 98443bf..1013ebe 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ -import dotenv from 'dotenv-defaults' -import fs from 'fs' -import { DefinePlugin } from 'webpack' +const dotenv = require('dotenv-defaults') +const fs = require('fs') +const { DefinePlugin } = require('webpack') // Mostly taken from here: https://github.com/motdotla/dotenv-expand/blob/master/lib/main.js#L4 const interpolate = (env, vars) => { @@ -162,4 +162,4 @@ class Dotenv { } } -export default Dotenv +module.exports = Dotenv diff --git a/test/main.spec.js b/test/main.spec.js index 4fcbad9..bc4fa99 100644 --- a/test/main.spec.js +++ b/test/main.spec.js @@ -1,12 +1,12 @@ /* global describe, it, beforeEach */ // Tests suite -import path from 'path' -import chai from 'chai' -import sinon from 'sinon' +const path = require('path') +const chai = require('chai') +const sinon = require('sinon') // The star of the show -import Src from '../src' +const Src = require('../src') chai.should() const envEmpty = path.resolve(__dirname, './envs/.empty') @@ -102,8 +102,8 @@ const envExpandedJson = buildExpectation({ const consoleSpy = sinon.spy(console, 'warn') -function runTests (Obj, name) { - function envTest (config) { +const runTests = (Obj, name) => { + const envTest = (config) => { return new Obj(config).definitions } From 8eb7f4f8760c86da694712e3c38094819636444e Mon Sep 17 00:00:00 2001 From: mrsteele Date: Fri, 18 Jan 2019 00:25:59 -0500 Subject: [PATCH 2/2] chore: resolving standard parser bug --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index 7dc8f17..4b455ae 100644 --- a/package.json +++ b/package.json @@ -55,9 +55,6 @@ "files": [ "src" ], - "standard": { - "parser": "babel-eslint" - }, "browser": "browser.js", "nyc": { "include": [