-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kent C. Dodds
committed
Sep 4, 2017
1 parent
5ac721f
commit 3172c72
Showing
25 changed files
with
302 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "4.5" | ||
} | ||
}] | ||
], | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-object-rest-spread" | ||
] | ||
"presets": ["./src/config/babelrc"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/config/babelrc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/config') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/config/eslintrc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('./src/config/jest.config') | ||
const {jest: jestConfig} = require('./src/config') | ||
|
||
module.exports = Object.assign(jestConfig, { | ||
coverageThreshold: null, | ||
coveragePathIgnorePatterns: jestConfig.coveragePathIgnorePatterns.concat( | ||
'/scripts/', | ||
), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,51 +12,51 @@ | |
"scripts": { | ||
"start": "nps", | ||
"test": "node src test", | ||
"precommit": | ||
"lint-staged && opt --in pre-commit --exec \"npm start validate\"" | ||
"test:update": "node src test --updateSnapshot", | ||
"build": "node src build", | ||
"lint": "node src lint", | ||
"validate": "node src validate", | ||
"install": "node src install", | ||
"uninstall": "node src uninstall", | ||
"precommit": "node src precommit" | ||
}, | ||
"files": ["dist"], | ||
"files": ["dist", "babel", "eslint", "config"], | ||
"keywords": [], | ||
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"all-contributors-cli": "^4.3.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-env": "^1.6.0", | ||
"arrify": "^1.0.1", | ||
"babel-cli": "^6.26.0", | ||
"babel-jest": "^20.0.3", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-plugin-transform-inline-environment-variables": "^0.2.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-react-jsx": "^6.24.1", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.8", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-react": "^6.24.1", | ||
"concurrently": "^3.5.0", | ||
"cross-spawn": "^5.1.0", | ||
"eslint-config-kentcdodds": "^12.4.1", | ||
"eslint": "^4.2.0", | ||
"eslint-config-kentcdodds": "^12.4.1", | ||
"eslint-config-prettier": "^2.4.0", | ||
"husky": "^0.14.3", | ||
"jest": "^20.0.4", | ||
"lint-staged": "^4.0.1", | ||
"lodash": "^4.17.4", | ||
"lodash.merge": "^4.6.0", | ||
"opt-cli": "^1.5.1", | ||
"prettier": "^1.6.1", | ||
"read-pkg-up": "^2.0.0", | ||
"resolve": "^1.4.0", | ||
"resolve-bin": "^0.4.0", | ||
"rimraf": "^2.6.1" | ||
}, | ||
"devDependencies": { | ||
"nps": "^5.4.0", | ||
"nps-utils": "^1.2.0" | ||
}, | ||
"lint-staged": { | ||
"*.+(js|json)": ["prettier --write", "git add"] | ||
}, | ||
"prettier": { | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"bracketSpacing": false, | ||
"jsxBraketSameLine": false | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kentcdodds/kcd-scripts.git" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const babelJest = require('babel-jest') | ||
|
||
module.exports = babelJest.createTransformer({ | ||
presets: [require.resolve('./babelrc')], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const {ifAnyDep} = require('../utils') | ||
|
||
const isTest = process.env.NODE_ENV === 'test' | ||
const isPreact = process.env.LIBRARY === 'preact' | ||
const isRollup = Boolean(JSON.parse(process.env.ROLLUP_BUILD || '"false"')) | ||
const isWebpack = Boolean(JSON.parse(process.env.WEBPACK_BUILD || '"false"')) | ||
const treeshake = isRollup || isWebpack | ||
|
||
module.exports = { | ||
presets: [ | ||
['env', treeshake ? {modules: false} : {}], | ||
ifAnyDep('react'), | ||
].filter(Boolean), | ||
plugins: [ | ||
isRollup ? 'external-helpers' : null, | ||
// we're actually not using JSX at all, but I'm leaving this | ||
// in here just in case we ever do (this would be easy to miss). | ||
isPreact ? ['transform-react-jsx', {pragma: 'h'}] : null, | ||
isPreact | ||
? ['transform-react-remove-prop-types', {removeImport: true}] | ||
: null, | ||
isTest || isRollup ? 'transform-inline-environment-variables' : null, | ||
'transform-class-properties', | ||
'transform-object-rest-spread', | ||
].filter(Boolean), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
babel: require('./babelrc'), | ||
eslint: require('./eslintrc'), | ||
jest: require('./jest.config'), | ||
lintStaged: require('./lintstagedrc'), | ||
prettier: require('./prettierrc'), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const [executor] = process.argv | ||
|
||
module.exports = { | ||
linters: { | ||
'**/*.+(js|json|less|css|ts)': [ | ||
`${executor} ${require.resolve('../')} format`, | ||
'git add', | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules/ | ||
coverage/ | ||
dist/ | ||
build/ | ||
out/ | ||
.next/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,10 @@ | ||
const {applyOverrides} = require('../utils') | ||
|
||
const config = applyOverrides({ | ||
type: 'prettier', | ||
config: { | ||
printWidth: 80, | ||
tabWidth: 2, | ||
useTabs: false, | ||
semi: false, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
bracketSpacing: false, | ||
jsxBraketSameLine: false, | ||
}, | ||
}) | ||
|
||
module.exports = config | ||
module.exports = { | ||
printWidth: 80, | ||
tabWidth: 2, | ||
useTabs: false, | ||
semi: false, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
bracketSpacing: false, | ||
jsxBraketSameLine: false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const resolveBin = require('resolve-bin') | ||
const spawn = require('cross-spawn') | ||
const {fromRoot} = require('../paths') | ||
const {hasPkgProp} = require('../utils') | ||
|
||
const argv = process.argv.slice(2) | ||
const args = process.argv.slice(2) | ||
|
||
const here = p => path.join(__dirname, p) | ||
|
||
const useBuiltinConfig = | ||
!args.includes('--config') && | ||
!fs.existsSync(fromRoot('.prettierrc')) && | ||
!hasPkgProp('prettierrc') | ||
const config = useBuiltinConfig | ||
? ['--config', here('../config/prettierrc.js')] | ||
: [] | ||
|
||
const useBuiltinIgnore = | ||
!args.includes('--ignore-path') && !fs.existsSync(fromRoot('.prettierignore')) | ||
const ignore = useBuiltinIgnore | ||
? ['--ignore-path', here('../config/prettierignore')] | ||
: [] | ||
|
||
const write = args.includes('--no-write') ? [] : ['--write'] | ||
|
||
const result = spawn.sync( | ||
resolveBin.sync('prettier'), | ||
// prettier-ignore | ||
[ | ||
'--write', | ||
'--config', here('../config/prettierrc.js'), | ||
'--ignore-path', here('../config/eslintignore'), | ||
].concat(argv), | ||
{stdio: 'inherit'} | ||
[...config, ...ignore, ...write].concat(args), | ||
{stdio: 'inherit'}, | ||
) | ||
|
||
process.exit(result) | ||
process.exit(result.status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require('husky/bin/install') |
Oops, something went wrong.