Skip to content

Commit

Permalink
Add Babel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
gengjiawen authored and tabrindle committed Feb 11, 2019
1 parent f1784f4 commit fa12e28
Show file tree
Hide file tree
Showing 10 changed files with 1,173 additions and 56 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ aliases:
envinfo
jobs:
node6-test:
working_directory: ~/repo
docker:
- image: node:6
steps:
- checkout
- run: npm install
- run: npm run test
- run: *link-and-execute
ubuntu-test:
working_directory: ~/repo
docker:
Expand Down Expand Up @@ -61,6 +70,7 @@ workflows:
version: 2
build_and_test:
jobs:
- node6-test
- ubuntu-test
- debian-test
- centos-test
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
parser: 'babel-eslint',
env: {
node: true,
es6: true,
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
.DS_Store
.idea/
18 changes: 18 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

module.exports = {
presets: [
[
'@babel/preset-env',
{
debug: true,
modules: 'commonjs',
targets: {
node: '4.9.1',
},
useBuiltIns: 'usage',
},
],
],
plugins: ['@babel/plugin-proposal-optional-chaining'],
};
2 changes: 1 addition & 1 deletion dist/cli.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/envinfo.js

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"executable": "pkg package.json",
"format": "prettier --write src/*.js",
"lint": "eslint src",
"lint-fix": "eslint src --fix",
"preversion": "npm run test && webpack && git add .",
"postversion": "npm run executable && npm run compress && npm run release",
"release": "github-release upload --owner=tabrindle --repo=envinfo --tag=${npm_package_version} 'envinfo-linux.tar.gz' 'envinfo-macos.tar.gz' 'envinfo-win.zip'",
Expand Down Expand Up @@ -53,10 +54,17 @@
},
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.1",
"all-contributors-cli": "^4.11.1",
"array-includes": "^3.0.3",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "23.6.0",
"babel-loader": "^8.0.5",
"clipboardy": "^1.2.2",
"eslint": "^4.10.0",
"eslint": "^5.13.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-config-prettier": "^2.7.0",
"eslint-plugin-import": "^2.8.0",
Expand All @@ -65,8 +73,6 @@
"glob": "^7.1.2",
"jest": "^22.4.3",
"minimist": "^1.2.0",
"object.entries": "^1.0.4",
"object.values": "^1.0.4",
"os-name": "^2.0.1",
"pkg": "^4.3.4",
"prettier-eslint-cli": "^4.1.1",
Expand Down
7 changes: 0 additions & 7 deletions src/envinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ const helpers = require('./helpers');
const formatters = require('./formatters');
const presets = require('./presets');
const utils = require('./utils');
const arrayIncludes = require('array-includes');
const objectEntries = require('object.entries');
const objectValues = require('object.values');

if (!Array.prototype.includes) arrayIncludes.shim();
if (!Object.entries) objectEntries.shim();
if (!Object.values) objectValues.shim();

function format(data, options) {
// set the default formatter (yaml is default, similar to old table)
Expand Down
9 changes: 9 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ module.exports = {
filename: '[name].js',
path: path.join(__dirname, '/dist'),
},
module: {
rules: [
{
use: 'babel-loader',
exclude: /(node_modules)/,
test: /\.js$/,
},
],
},
plugins: [
new webpack.BannerPlugin({
banner: `#!/usr/bin/env node
Expand Down
Loading

0 comments on commit fa12e28

Please sign in to comment.