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

chore: removing babel #161

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var plugin = require('./dist').default
var plugin = require('./src')

module.exports = plugin
11 changes: 3 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 3 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
]
}
}
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down Expand Up @@ -166,4 +166,4 @@ class Dotenv {
}
}

export default Dotenv
module.exports = Dotenv
12 changes: 6 additions & 6 deletions test/main.spec.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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
}

Expand Down