Skip to content

Commit

Permalink
feat(tweaks): remove build step, add @std/esm, etc stuff
Browse files Browse the repository at this point in the history
TAG: latest
  • Loading branch information
tunnckoCore committed Oct 20, 2017
1 parent fbe5f8e commit bfb8933
Show file tree
Hide file tree
Showing 20 changed files with 493 additions and 1,692 deletions.
20 changes: 0 additions & 20 deletions .codeclimate.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .eslintignore
Expand Up @@ -22,9 +22,6 @@ package-lock.json
# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Packages #
# ##########
*.7z
Expand Down Expand Up @@ -90,5 +87,8 @@ pids
# Yarn Integrity file
.yarn-integrity

# The `@std/esm` package cache
.esm-cache

# dotenv environment variables file
.env
1 change: 1 addition & 0 deletions .eslintrc
@@ -0,0 +1 @@
extends: standard-tunnckocore
7 changes: 1 addition & 6 deletions .eslintrc.json
@@ -1,8 +1,3 @@
{
"extends": [
"standard-tunnckocore"
],
"rules": {
"react/react-in-jsx-scope": "off"
}
"extends": "standard-tunnckocore"
}
6 changes: 3 additions & 3 deletions .gitignore
Expand Up @@ -22,9 +22,6 @@ package-lock.json
# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Packages #
# ##########
*.7z
Expand Down Expand Up @@ -90,5 +87,8 @@ pids
# Yarn Integrity file
.yarn-integrity

# The `@std/esm` package cache
.esm-cache

# dotenv environment variables file
.env
22 changes: 22 additions & 0 deletions .helarc
@@ -0,0 +1,22 @@
tasks:
format: prettier-eslint --write ./{test,src}/**/*.{mjs,js} --config ./.prettierrc

lint: eslint ./{test,src}/**/*.{mjs,js} --config ./.eslintrc --format codeframe --fix

test:
- yarn start format
- yarn start lint
- node -r @std/esm test

precommit:
- git status --porcelain
- yarn start test
- git add --all

commit:
- ./node_modules/.bin/simple-commit-message

release:
- semantic-release pre
- npm publish
- semantic-release post
12 changes: 0 additions & 12 deletions .helarc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .npmrc
@@ -1,4 +1,4 @@
registry=http://registry.npmjs.org/
save-exact=true
save=true
username=tunnckocore
username=olstenlarck
20 changes: 9 additions & 11 deletions .prettierrc
@@ -1,11 +1,9 @@
{
"tabWidth": 2,
"printWidth": 80,
"semi": false,
"useTabs": false,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"parser": "babylon"
}
tabWidth: 2
printWidth: 80
semi: true
useTabs: false
singleQuote: true
trailingComma: "all"
bracketSpacing: true
jsxBracketSameLine: true
parser: "flow"
9 changes: 2 additions & 7 deletions .travis.yml
Expand Up @@ -9,23 +9,18 @@ cache:
directories:
- node_modules

os: linux
node_js:
- '8'
- '6'

os: linux

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

before_script: yarn hela

script: yarn test

after_success:
- yarn start release
- bash <(curl -s https://codecov.io/bash)
- yarn start release

branches:
except:
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `open.source.charlike@gmail.com` mail address. All
reported by contacting the project team at `olsten.larck@gmail.com` mail address. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
31 changes: 16 additions & 15 deletions package.json
Expand Up @@ -3,48 +3,49 @@
"version": "0.0.0-semantic-release",
"description": "Powerful & flexible task runner framework in 80 lines, based on execa. Supports presets, a la ESLint but for tasks & npm scripts",
"repository": "tunnckoCore/hela",
"author": "Charlike Mike Reagent <@tunnckoCore> (https://i.am.charlike.online)",
"author": "Charlike Mike Reagent (https://i.am.charlike.online)",
"nspId": "6e5fb0cd-6807-4709-b6f2-37f194887691",
"src": "src/**/*.js",
"main": "dist/index.js",
"module": "dist/index.es.js",
"main": "./src/index.js",
"module": "./src/index.mjs",
"scripts": {
"start": "./dist/cli.js",
"start": "./src/cli.js",
"test": "yarn start test",
"precommit": "yarn start precommit",
"commit": "yarn start commit",
"hela": "yarn build:cli",
"build:cli": "rollup -i src/cli.js -o dist/cli.js -f cjs --banner '#!/usr/bin/env node'",
"postbuild:cli": "chmod +x dist/cli.js"
"hela": "chmod +x ./src/cli.js"
},
"license": "MIT",
"license": "Apache-2.0",
"licenseStart": 2017,
"engines": {
"node": ">=6",
"npm": ">=5",
"yarn": ">=1"
},
"files": [
"dist/"
"src/"
],
"bin": {
"hela": "./dist/cli.js"
"hela": "./src/cli.js"
},
"dependencies": {
"@std/esm": "0.12.0",
"@tunnckocore/pretty-config": "0.2.1",
"arrify": "1.0.1",
"execa": "0.8.0",
"js-yaml": "3.10.0",
"mri": "1.1.0",
"p-map-series": "1.0.0",
"pify": "3.0.0",
"resolve-plugins-sync": "1.1.2"
},
"devDependencies": {
"eslint": "4.9.0",
"eslint-config-standard-tunnckocore": "1.0.10",
"hela-preset-tunnckocore": "0.5.19",
"husky": "0.14.3",
"mukla": "0.4.9",
"semantic-release": "7.0.2"
"prettier": "1.7.4",
"prettier-eslint": "8.2.1",
"prettier-eslint-cli": "4.4.0",
"semantic-release": "7.0.2",
"simple-commit-message": "3.3.2"
},
"keywords": [
"automation",
Expand Down
39 changes: 5 additions & 34 deletions src/cli.js 100644 → 100755
@@ -1,37 +1,8 @@
#!/usr/bin/env node

/**
* @author Charlike Mike Reagent <open.source.charlike@gmail.com>
* @copyright 2017 tunnckoCore and other contributors
* @license MIT
* @copyright 2017-present, Charlike Mike Reagent <olsten.larck@gmail.com>
* @license Apache-2.0
*/

import parser from 'mri'
import { hela, exec, shell } from './index.js'

const options = { cwd: process.cwd(), hela, helaExec: exec, helaShell: shell }

options.parse = (opts) => parser(process.argv.slice(2), opts)
options.argv = options.parse()
options.taskName = options.argv._[0]

if (!options.argv._.length) {
console.log('Usage: hela <taskName>')
process.exit(1)
}

const onerror = (er) => {
// Don't show stack/message
// if it is `nyc check-coverage` command,
// because it is already show that threshold is not meet
const isNyc = er.message.indexOf('nyc') > 0
const isCov = er.message.indexOf('check-coverage') > 0
if (!isNyc && !isCov) {
console.error('ERR!', er.stack || er.message)
throw er
}
}

hela(options)
.then((tasks) => tasks[options.taskName]())
.then(() => process.exit(0))
.catch(onerror)
.catch(() => process.exit(1))
module.exports = require('./esm-require.js')('./cli.mjs')
41 changes: 41 additions & 0 deletions src/cli.mjs
@@ -0,0 +1,41 @@
/**
* @copyright 2017-present, Charlike Mike Reagent <olsten.larck@gmail.com>
* @license Apache-2.0
*/

import parser from 'mri'
import { hela, exec, shell } from './index.mjs'

const options = {
cwd: process.cwd(),
hela,
helaExec: exec,
helaShell: shell,
}

options.parse = (opts) => parser(process.argv.slice(2), opts)
options.argv = options.parse()
options.taskName = options.argv._[0]

if (!options.argv._.length) {
console.log('Usage: hela <taskName>')
process.exit(1)
}

const onerror = (er) => {
// Don't show stack/message
// if it is `nyc check-coverage` command,
// because it is already show that threshold is not meet
const isNyc = er.message.indexOf('nyc') > 0
const isCov = er.message.indexOf('check-coverage') > 0
if (!isNyc && !isCov) {
console.error('ERR!', er.stack || er.message)
throw er
}
}

hela(options)
.then((tasks) => tasks[options.taskName]())
.then(() => process.exit(0))
.catch(onerror)
.catch(() => process.exit(1))
15 changes: 15 additions & 0 deletions src/esm-require.js
@@ -0,0 +1,15 @@
/**
* @copyright 2017-present, Charlike Mike Reagent <olsten.larck@gmail.com>
* @license Apache-2.0
*/

function isObject (val) {
return val && typeof val === 'object' && !Array.isArray(val)
}

function esmInteropRequire (id, opts) {
const ex = require('@std/esm')(module, opts)(id)
return isObject(ex) && 'default' in ex ? ex.default : ex
}

module.exports = esmInteropRequire

0 comments on commit bfb8933

Please sign in to comment.