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 cb71cba..c2cf888 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 --require @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,34 +42,23 @@ "dotenv-defaults": "^2.0.0" }, "devDependencies": { - "@babel/cli": "^7.10.4", - "@babel/core": "^7.10.4", - "@babel/preset-env": "^7.10.4", - "@babel/register": "^7.10.4", "chai": "^4.1.2", "esdoc": "^1.0.4", "esdoc-standard-plugin": "^1.0.0", "husky": "^4.2.5", "mocha": "^6.2.3", "nyc": "^15.1.0", - "rimraf": "^3.0.0", "sinon": "^9.0.2", "standard": "^14.0.0", "webpack": "^4.6.0" }, "files": [ - "dist" + "src" ], "browser": "browser.js", - "babel": { - "presets": [ - "@babel/preset-env" - ] - }, "nyc": { "include": [ - "src/**/*.js", - "dist/**/*.js" + "src/**/*.js" ] } } diff --git a/src/index.js b/src/index.js index b9fd0be..5bed285 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) => { @@ -166,4 +166,4 @@ class Dotenv { } } -export default Dotenv +module.exports = Dotenv diff --git a/test/main.spec.js b/test/main.spec.js index 76a1ca1..b87174d 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') @@ -105,8 +105,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 }