Skip to content
Merged

Deps #173

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: 2 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ module.exports = Object.assign({}, prettierConfig, {
// to prevent additional conflicts with update kcd-scripts, making
// backmerging a little easier.
printWidth: 80,
semi: false,
bracketSpacing: false,
})
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Or, for `babel`, a `.babelrc` with:
Or, for `jest`:

```js
const { jest: jestConfig } = require('cod-scripts/config');
const {jest: jestConfig} = require('cod-scripts/config')

module.exports = Object.assign(jestConfig, {
// your overrides here
Expand All @@ -96,22 +96,22 @@ module.exports = Object.assign(jestConfig, {
transform: {
'\\.(ts|tsx)$': '<rootDir>/node_modules/ts-jest/preprocessor.js',
},
});
})
```

Or, for `commitlint`, a `commitlint.config.js` file or `commitlint` prop in
package.json:

```js
// commitlint.config.js or .commitlintrc.js
const { commitlint: commitlintConfig } = require('cod-scripts/commitlint');
const {commitlint: commitlintConfig} = require('cod-scripts/commitlint')

module.exports = {
...commitlintConfig,
rules: {
// overrides here
},
};
}
```

```json
Expand Down
2 changes: 1 addition & 1 deletion babel.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/config/babelrc');
module.exports = require('./dist/config/babelrc')
2 changes: 1 addition & 1 deletion commitlint.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/config/commitlint.config');
module.exports = require('./dist/config/commitlint.config')
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/config');
module.exports = require('./dist/config')
2 changes: 1 addition & 1 deletion eslint.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/config/eslintrc');
module.exports = require('./dist/config/eslintrc')
2 changes: 1 addition & 1 deletion husky.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/config/huskyrc');
module.exports = require('./dist/config/huskyrc')
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { jest: jestConfig } = require('./src/config');
const {jest: jestConfig} = require('./src/config')

module.exports = Object.assign(jestConfig, {
coverageThreshold: null,
testPathIgnorePatterns: [
...jestConfig.testPathIgnorePatterns,
'./src/scripts/test.js',
],
});
})
2 changes: 1 addition & 1 deletion jest.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/config/jest.config');
module.exports = require('./dist/config/jest.config')
59 changes: 32 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,71 +35,76 @@
"author": "Chris O'Donnell <[email protected]> (http://codfish.io/)",
"license": "MIT",
"dependencies": {
"@babel/cli": "^7.12.8",
"@babel/core": "^7.12.9",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.7",
"@babel/preset-react": "^7.12.7",
"@babel/preset-typescript": "^7.12.7",
"@babel/runtime": "^7.12.5",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-commonjs": "^17.0.0",
"@babel/cli": "^7.13.0",
"@babel/core": "^7.13.1",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-transform-modules-commonjs": "^7.13.0",
"@babel/plugin-transform-runtime": "^7.13.7",
"@babel/preset-env": "^7.13.5",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime": "^7.13.7",
"@commitlint/cli": "^12.0.0",
"@commitlint/config-conventional": "^12.0.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-replace": "^2.3.4",
"@types/jest": "^26.0.17",
"@rollup/plugin-node-resolve": "^11.2.0",
"@rollup/plugin-replace": "^2.4.1",
"@types/jest": "^26.0.20",
"arrify": "^2.0.1",
"babel-jest": "^26.6.3",
"babel-plugin-macros": "^3.0.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"browserslist": "^4.14.7",
"browserslist": "^4.16.3",
"builtin-modules": "^3.2.0",
"chalk": "^4.1.0",
"concurrently": "^5.3.0",
"concurrently": "^6.0.0",
"cosmiconfig": "^7.0.0",
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.3",
"doctoc": "^2.0.0",
"eslint": "^7.15.0",
"eslint-config-codfish": "^8.2.0",
"eslint-config-prettier": "^7.0.0",
"eslint": "^7.20.0",
"eslint-config-codfish": "^8.3.0",
"eslint-config-prettier": "^8.1.0",
"glob": "^7.1.5",
"husky": "^4.3.5",
"is-ci": "^2.0.0",
"husky": "^5.1.1",
"is-ci": "^3.0.0",
"jest": "^26.6.1",
"jest-serializer-path": "^0.1.15",
"jest-watch-typeahead": "^0.6.1",
"lint-staged": "^10.5.3",
"lint-staged": "^10.5.4",
"lodash.camelcase": "^4.3.0",
"lodash.has": "^4.5.2",
"lodash.omit": "^4.5.0",
"mkdirp": "^1.0.4",
"prettier": "2.2.1",
"react-app-polyfill": "^2.0.0",
"read-pkg-up": "^7.0.1",
"resolve": "^1.19.0",
"resolve": "^1.20.0",
"rimraf": "^3.0.2",
"rollup": "^2.34.2",
"rollup": "^2.39.1",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-size-snapshot": "^0.12.0",
"rollup-plugin-terser": "^7.0.2",
"semver": "^7.3.4",
"which": "^2.0.2",
"yargs-parser": "^20.2.4"
"yargs-parser": "^20.2.6"
},
"eslintConfig": {
"extends": [
"./src/config/eslintrc.js"
],
"rules": {
"no-console": "off",
"semi": "off",
"babel/semi": "off",
"object-curly-spacing": "off",
"babel/object-curly-spacing": "off",
"no-process-exit": "off",
"global-require": "off",
"no-prototype-builtins": "off",
Expand Down
2 changes: 1 addition & 1 deletion prettier.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/config/prettierrc');
module.exports = require('./dist/config/prettierrc')
4 changes: 2 additions & 2 deletions src/__mocks__/cross-spawn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
sync: jest.fn(() => ({ status: 0 })),
};
sync: jest.fn(() => ({status: 0})),
}
66 changes: 33 additions & 33 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
import path from 'path';
import slash from 'slash';
import cases from 'jest-in-case';
import { unquoteSerializer } from '../scripts/__tests__/helpers/serializers';
import path from 'path'
import slash from 'slash'
import cases from 'jest-in-case'
import {unquoteSerializer} from '../scripts/__tests__/helpers/serializers'

const projectRoot = path.join(__dirname, '../../');
const projectRoot = path.join(__dirname, '../../')

expect.addSnapshotSerializer(unquoteSerializer);
expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer({
print: val => slash(val.replace(projectRoot, '<PROJECT_ROOT>/')),
test: val => typeof val === 'string' && val.includes(projectRoot),
});
})

cases(
'format',
({ snapshotLog = false, throws = false, signal = false, args = [] }) => {
({snapshotLog = false, throws = false, signal = false, args = []}) => {
// beforeEach
const { sync: crossSpawnSyncMock } = require('cross-spawn');
const originalExit = process.exit;
const originalArgv = process.argv;
const originalLog = console.log;
process.exit = jest.fn();
console.log = jest.fn();
const {sync: crossSpawnSyncMock} = require('cross-spawn')
const originalExit = process.exit
const originalArgv = process.argv
const originalLog = console.log
process.exit = jest.fn()
console.log = jest.fn()
try {
// tests
process.argv = ['node', '../', ...args];
crossSpawnSyncMock.mockClear();
process.argv = ['node', '../', ...args]
crossSpawnSyncMock.mockClear()
if (signal) {
crossSpawnSyncMock.mockReturnValueOnce({ result: 1, signal });
crossSpawnSyncMock.mockReturnValueOnce({result: 1, signal})
}
require('..');
require('..')
if (snapshotLog) {
expect(console.log.mock.calls).toMatchSnapshot();
expect(console.log.mock.calls).toMatchSnapshot()
} else if (signal) {
expect(process.exit).toHaveBeenCalledTimes(1);
expect(process.exit).toHaveBeenCalledWith(1);
expect(console.log.mock.calls).toMatchSnapshot();
expect(process.exit).toHaveBeenCalledTimes(1)
expect(process.exit).toHaveBeenCalledWith(1)
expect(console.log.mock.calls).toMatchSnapshot()
} else {
expect(crossSpawnSyncMock).toHaveBeenCalledTimes(1);
const [firstCall] = crossSpawnSyncMock.mock.calls;
const [script, calledArgs] = firstCall;
expect([script, ...calledArgs].join(' ')).toMatchSnapshot();
expect(crossSpawnSyncMock).toHaveBeenCalledTimes(1)
const [firstCall] = crossSpawnSyncMock.mock.calls
const [script, calledArgs] = firstCall
expect([script, ...calledArgs].join(' ')).toMatchSnapshot()
}
} catch (error) {
if (throws) {
expect(error.message).toMatchSnapshot();
expect(error.message).toMatchSnapshot()
} else {
throw error;
throw error
}
} finally {
// afterEach
process.exit = originalExit;
process.argv = originalArgv;
console.log = originalLog;
jest.resetModules();
process.exit = originalExit
process.argv = originalArgv
console.log = originalLog
jest.resetModules()
}
},
{
Expand Down Expand Up @@ -82,6 +82,6 @@ cases(
signal: 'SIGBREAK',
},
},
);
)

/* eslint complexity:0 */
Loading