Skip to content

Commit

Permalink
build(babel): adds build stage with babel
Browse files Browse the repository at this point in the history
  • Loading branch information
sharvit committed Dec 28, 2018
1 parent d1eca51 commit fccbdb2
Show file tree
Hide file tree
Showing 33 changed files with 952 additions and 21 deletions.
21 changes: 21 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": { "node": 8 }
}
]
],
"plugins": ["add-module-exports"],
"env": {
"production": {
"ignore": [
"node_modules",
"**/templates/**/**",
"**/__mocks__/**/**",
"**/*.test.js"
],
}
}
}
6 changes: 2 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
app/templates/**/*.js
app/templates/**/*.json
app/templates/**/*.md
src/app/templates
./app/
coverage/
dist/
package-lock.json
package.json
yarn.lock
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"parser": "babel-eslint",
"extends": [
"standard",
"prettier",
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Compiled
app
!src/app

# Logs
logs
*.log
Expand Down
61 changes: 61 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Source
src

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
language: node_js
notifications:
email: false
node_js: 10
node_js:
- 8
- 10
script:
- yarn lint:commit-travis
- yarn lint
- yarn test
- yarn build
after_success: yarn coveralls
jobs:
include:
Expand Down
19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@
"url": "https://sharvit.github.io"
},
"engines": {
"node": ">=10"
"node": ">=6"
},
"scripts": {
"build": "yarn build:babel && yarn build:templates",
"build:babel": "BABEL_ENV=production babel src --out-dir .",
"build:templates": "ncp ./src/app/templates ./app/templates",
"test": "jest --coverage",
"test:watch": "jest --watch",
"lint": "eslint ./app ./lib",
"lint": "eslint ./src",
"lint:commit": "commitlint -e",
"lint:commit-travis": "commitlint-travis",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"commit": "git-cz",
"semantic-release": "semantic-release"
},
"files": [
"app",
"lib"
"app"
],
"dependencies": {
"@octokit/rest": "^16.3.0",
Expand All @@ -40,9 +42,16 @@
"yeoman-generator": "^3.1.1"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"@commitlint/cli": "^7.2.1",
"@commitlint/config-conventional": "^7.1.2",
"@commitlint/travis-cli": "^7.2.1",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-plugin-add-module-exports": "^1.0.0",
"commitlint-config-cz": "^0.11.0",
"coveralls": "^3.0.2",
"cz-conventional-changelog": "2.1.0",
Expand All @@ -55,7 +64,9 @@
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"jest": "^23.6.0",
"ncp": "^2.0.0",
"prettier": "^1.15.3",
"rimraf": "^2.6.2",
"semantic-release": "^15.13.1",
"yeoman-assert": "^3.1.0",
"yeoman-test": "^2.0.0"
Expand Down
4 changes: 2 additions & 2 deletions app/index.js → src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const commandExists = require('command-exists');
const findUp = require('find-up');
const makeDir = require('make-dir');

const github = require('../lib/github');
const npm = require('../lib/npm');
const github = require('./lib/github');
const npm = require('./lib/npm');

module.exports = class extends Generator {
/*
Expand Down
6 changes: 3 additions & 3 deletions app/index.test.js → src/app/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const path = require('path');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');

const github = require('../lib/github');
const github = require('./lib/github');

jest.mock('../lib/github');
jest.mock('../lib/npm');
jest.mock('./lib/github');
jest.mock('./lib/npm');

const runAppGenerator = () => helpers.run(path.join(__dirname, './index.js'));

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit fccbdb2

Please sign in to comment.