Skip to content

Commit

Permalink
⬆️ Upgrade to Circle CI 2 (#176)
Browse files Browse the repository at this point in the history
* 🚚 Move jest config to config/

* 🚚 Move publish-docs.sh to misc/

* 🚚 Move JSDoc config and fix some JSDoc

* 🔧 fix generate flow and coverage config

* 🔧 Use ~ instead of ^ for dependecies versions

* 🔧 Circle 2 without cache

* 🔧 fix prescripts

* 🔧 remove build from workflow

* 🔧 Circle 2 add dependencies cache

* ⚡ Test build speed

* ⬆️ Upgrade eslint
  • Loading branch information
nlepage committed Dec 22, 2017
1 parent f383dd7 commit 6bac9dd
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 106 deletions.
61 changes: 61 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: 2

jobs:

lint:
docker:
- image: circleci/node:9
steps:
- checkout
- restore_cache:
key: node_modules-{{ checksum "yarn.lock" }}
- run: yarn
- save_cache:
key: node_modules-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: yarn lint

test:
docker:
- image: circleci/node:9
steps:
- checkout
- restore_cache:
key: node_modules-{{ checksum "yarn.lock" }}
- run: yarn
- save_cache:
key: node_modules-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: yarn run greenkeeper-lockfile-update
- run: yarn test:coverage
- run: yarn run greenkeeper-lockfile-upload

build:
docker:
- image: circleci/node:9
steps:
- checkout
- restore_cache:
key: node_modules-{{ checksum "yarn.lock" }}
- run: yarn
- save_cache:
key: node_modules-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: yarn build

workflows:
version: 2
validate:
jobs:
- lint
- test

# deployment:
# release:
# tag: /\d+\.\d+\.\d+/
# commands:
# - npm publish
# - ./publish-docs.sh
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ lerna-debug.log
package-lock.json
yarn-error.log
**/*.js
!jest.config.js
!/config/**/.js
!/misc/**/*.js
!/packages/*/src/**/*.js
34 changes: 0 additions & 34 deletions circle.yml

This file was deleted.

13 changes: 13 additions & 0 deletions config/jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { resolve } = require('path')

const rootDir = process.cwd()

const coverageDirectory = resolve(rootDir, 'coverage')
const setupTestFrameworkScriptFile = resolve(__dirname, 'test.setup.js')

module.exports = {
coverageDirectory,
coverageReporters: ['lcov'],
rootDir,
setupTestFrameworkScriptFile,
}
2 changes: 1 addition & 1 deletion jsdoc.json → config/jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"../../misc/jsdoc-flow-plugin.js"
],
"opts": {
"template": "node_modules/hotdoc/template",
"template": "../node_modules/hotdoc/template",
"destination": "../../docs",
"recurse": true
},
Expand Down
File renamed without changes.
14 changes: 0 additions & 14 deletions jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion misc/generate-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const generateFlow = async () => {
await ensureDir(seqDir)

const items = await jsdoc.explain({
configure: path.resolve(rootDir, 'jsdoc.json'),
configure: path.resolve(rootDir, 'config/jsdoc.json'),
files: path.resolve(packageDir, 'src'), // Workaround while this hasn't been merged : https://github.com/jsdoc2md/jsdoc-api/pull/9
})

Expand Down
File renamed without changes.
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
"docs:private": "lerna run --stream docs:private"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^8.0.2",
"babel-plugin-module-resolver": "^3.0.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.24.1",
"codecov": "^3.0.0",
"cross-env": "^5.1.1",
"eslint": "^4.10.0",
"fs-extra": "^5.0.0",
"hotdoc": "^0.7.2",
"jest": "^21.2.1",
"jsdoc": "^3.5.5",
"jsdoc-api": "^4.0.0",
"lerna": "^2.5.1",
"lodash": "^4.17.4"
"babel-cli": "~6.26.0",
"babel-eslint": "~8.0.2",
"babel-plugin-module-resolver": "~3.0.0",
"babel-preset-env": "~1.6.1",
"babel-preset-stage-2": "~6.24.1",
"codecov": "~3.0.0",
"cross-env": "~5.1.1",
"eslint": "~4.13.1",
"fs-extra": "~5.0.0",
"greenkeeper-lockfile": "1",
"hotdoc": "~0.7.2",
"jest": "~21.2.1",
"jsdoc": "~3.5.5",
"jsdoc-api": "~4.0.0",
"lerna": "~2.5.1",
"lodash": "~4.17.4"
},
"workspaces": [
"packages/*"
Expand Down
26 changes: 14 additions & 12 deletions packages/immutadot-lodash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,29 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"immutadot": "^0.3.2",
"lodash": "^4.17.4"
"immutadot": "~0.3.2",
"lodash": "~4.17.4"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"cross-env": "^5.1.1",
"eslint": "^4.11.0",
"jest": "^21.2.1",
"jsdoc": "^3.5.5",
"lerna": "^2.5.1"
"babel-cli": "~6.26.0",
"cross-env": "~5.1.1",
"eslint": "~4.13.1",
"jest": "~21.2.1",
"jsdoc": "~3.5.5",
"lerna": "~2.5.1"
},
"peerDependencies": {},
"scripts": {
"generate:flow": "node ../../misc/generate-flow.js",
"prebuild": "yarn generate:flow",
"build": "cross-env BABEL_ENV=production babel src generated -d .",
"prelint": "yarn generate:flow",
"lint": "eslint src generated",
"pretest": "lerna run --scope immutadot build && yarn generate:flow",
"test": "jest -c ../../jest.config.js",
"test:coverage": "jest -c ../../jest.config.js --maxWorkers=2 --coverage",
"docs": "jsdoc -c ../../jsdoc.json",
"docs:private": "jsdoc -c ../../jsdoc.json -p"
"test": "jest -c ../../config/jest.js",
"pretest:coverage": "lerna run --scope immutadot build && yarn generate:flow",
"test:coverage": "jest -c ../../config/jest.js --maxWorkers=2 --coverage",
"docs": "jsdoc -c ../../config/jsdoc.json",
"docs:private": "jsdoc -c ../../config/jsdoc.json -p"
}
}
21 changes: 11 additions & 10 deletions packages/immutadot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@
],
"main": "index.js",
"devDependencies": {
"babel-cli": "^6.26.0",
"cross-env": "^5.1.1",
"eslint": "^4.11.0",
"jest": "^21.2.1",
"jsdoc": "^3.5.5"
"babel-cli": "~6.26.0",
"cross-env": "~5.1.1",
"eslint": "~4.13.1",
"jest": "~21.2.1",
"jsdoc": "~3.5.5"
},
"dependencies": {},
"scripts": {
"generate:flow": "node ../../misc/generate-flow.js",
"prebuild": "yarn generate:flow",
"build": "cross-env BABEL_ENV=production babel src generated -d .",
"prelint": "yarn generate:flow",
"lint": "eslint src generated",
"pretest": "yarn generate:flow",
"test": "jest -c ../../jest.config.js",
"test:coverage": "jest -c ../../jest.config.js --maxWorkers=2 --coverage",
"docs": "jsdoc -c ../../jsdoc.json",
"docs:private": "jsdoc -c ../../jsdoc.json -p"
"test": "jest -c ../../config/jest.js",
"pretest:coverage": "yarn generate:flow",
"test:coverage": "jest -c ../../config/jest.js --maxWorkers=2 --coverage",
"docs": "jsdoc -c ../../config/jsdoc.json",
"docs:private": "jsdoc -c ../../config/jsdoc.json -p"
},
"runkitExample": "require('lodash')\nconst immutadot = require('immutadot')\n\nimmutadot.push({ nested: { prop: [1, 2] } }, 'nested.prop', 3, 4)\n// → { nested: { prop: [1, 2, 3, 4] } }\n\nimmutadot.pickBy({ nested: [{ a: 1, b: 2, c: 3, d: 4 }, { e: 6 }] }, 'nested.0', v => v < 3)\n// → { nested: [{ a: 1, b: 2 }, { e: 6 }] }"
}
4 changes: 3 additions & 1 deletion packages/immutadot/src/core/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { unsafeToPath } from 'path/toPath'
* @example get({ nested: { prop: 'val' } }, 'nested.unknown', 'default') // => 'default'
* @since 1.0.0
*/
export function get(obj, path, defaultValue) {
function get(obj, path, defaultValue) {
function walkPath(curObj, remPath) {
if (remPath.length === 0) return curObj === undefined ? defaultValue : curObj
if (isNil(curObj)) return defaultValue
Expand All @@ -28,3 +28,5 @@ export function get(obj, path, defaultValue) {
throw TypeError('get supports only properties and array indexes in path')
return walkPath(obj, parsedPath)
}

export { get }
4 changes: 3 additions & 1 deletion packages/immutadot/src/flow/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { flatten } from 'util/array'
* @returns {flow.flowFunction} A function successively calling <code>fns</code>
* @since 1.0.0
*/
export function flow(...args) {
function flow(...args) {
const fns = flatten(args)
return pObj => {
const [result] = fns.reduce(
Expand All @@ -30,3 +30,5 @@ export function flow(...args) {
return result
}
}

export { flow }

0 comments on commit 6bac9dd

Please sign in to comment.