Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Add lerna and split project #138

Merged
merged 22 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
926c3bf
:truck: Move project into a yarn workspace and add lerna
nlepage Nov 16, 2017
fb0dfc6
:wrench: Promote scripts at top level
nlepage Nov 16, 2017
f6e4492
:truck: Move lodash functions to immutadot-lodash
nlepage Nov 16, 2017
e3144aa
:white_check_mark: fix immutadot-lodash tests
nlepage Nov 17, 2017
09dd2e3
:wrench: Add lodash in dev dependencies
nlepage Nov 17, 2017
9d55b5c
:wrench: Split codecov conf to fix paths
nlepage Nov 27, 2017
905009f
:wrench: Extract jest config and move codecov config back to top level
nlepage Nov 27, 2017
6358759
:wrench: fix jest config and add codecov flags
nlepage Nov 27, 2017
6d9ee80
:wrench: fix codecov ignores
nlepage Nov 27, 2017
539fd7c
:wrench: fix codecov ignores
nlepage Nov 27, 2017
364f358
:arrow_up: Upgrade eslint to 4.12
nlepage Nov 27, 2017
f03bd84
:wrench: fix codecov ignores
nlepage Nov 27, 2017
6682674
:wrench: fix codecov ignores
nlepage Nov 27, 2017
6112bc9
:wrench: Use jest coverage ignores...
nlepage Nov 27, 2017
34f545c
:wrench: Codecov flags...
nlepage Nov 27, 2017
f2c0e10
:wrench: Retry codecov at package level in order to fix flags
nlepage Nov 28, 2017
a374be1
:rewind: Revert to codecov at top level with valid YAML !
nlepage Nov 28, 2017
8e6afa9
:wrench: Flags...
nlepage Nov 28, 2017
d3134be
:wrench: codecov...
nlepage Nov 28, 2017
ed93ecf
:wrench: codecov...
nlepage Nov 28, 2017
a54b3b5
:wrench: Just forget about codecov flags...
nlepage Nov 28, 2017
b318f6e
:wrench: Add immutadot's build in immutadot-lodash's pretest
nlepage Nov 28, 2017
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
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
}],
["stage-2"],
],
"plugins": [
["module-resolver", {
"root": ["./src"]
}]
],
"env": {
"production": {
"ignore": ".spec.js"
},
"test": {
"plugins": [
["module-resolver", {
"root": ["./src", "./misc", "./generated"]
"root": ["./src", "../../misc", "./generated"]
}]
]
}
Expand Down
2 changes: 0 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
coverage:
range: "100..100"
ignore:
- misc
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/coverage/
/node_modules/
coverage/
node_modules/
lerna-debug.log
package-lock.json
yarn-error.log
**/*.js
!jest.config.js
!/misc/**/*.js
!/src/**/*.js
!/packages/*/src/**/*.js
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { resolve } = require('path')

const coverageDirectory = resolve(process.cwd(), 'coverage')
const coveragePathIgnorePatterns = ['<rootDir>/misc/', '/node_modules/']
const roots = [process.cwd()]
const setupTestFrameworkScriptFile = resolve(__dirname, 'misc/test.setup.js')

module.exports = {
coverageDirectory,
coveragePathIgnorePatterns,
coverageReporters: ['lcov'],
roots,
setupTestFrameworkScriptFile,
}
8 changes: 4 additions & 4 deletions jsdoc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"source": {
"include": ["src", "package.json", "README.md"]
"include": ["src", "package.json", "../../README.md"]
},
"plugins": [
"misc/jsdoc-flow-plugin.js"
"../../misc/jsdoc-flow-plugin.js"
],
"opts": {
"template": "node_modules/hotdoc/template",
"destination": "docs",
"destination": "../../docs",
"recurse": true
},
"hotdoc": {
"github": "https://github.com/Zenika/immutadot",
"home": "immutad●t",
"customOverrides": "docs/hotdoc-overrides.scss"
"customOverrides": "../../docs/hotdoc-overrides.scss"
}
}
9 changes: 9 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"lerna": "2.5.1",
"npmClient": "yarn",
"packages": [
"packages/*"
],
"useWorkspaces": true,
"version": "1.0.0"
}
7 changes: 4 additions & 3 deletions misc/generate-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ const writeFile = util.promisify(fs.writeFile)

const generateFlow = async () => {
try {
const rootDir = path.resolve(__dirname, '..')
const generatedDir = path.resolve(rootDir, 'generated')
const packageDir = process.cwd()
const rootDir = path.resolve(packageDir, '../..')
const generatedDir = path.resolve(packageDir, 'generated')
const flowDir = path.resolve(generatedDir, 'flow')
await remove(generatedDir)
await ensureDir(flowDir)

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

const itemsByNamespace = _.chain(items)
Expand Down
54 changes: 15 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
{
"name": "immutadot",
"version": "0.3.2",
"description": "immutad●t (pronounced immutadot) is a set of immutable functions using dot notation.",
"keywords": [
"immutable",
"dot-notation",
"nested-structures",
"react",
"redux",
"lodash"
],
"version": "1.0.0",
"license": "MIT",
"homepage": "https://github.com/Zenika/immutadot",
"bugs": "https://github.com/Zenika/immutadot/issues",
"repository": "github:Zenika/immutadot",
"author": "Nicolas Lepage (https://github.com/nlepage)",
"contributors": [
"Yvonnick FRIN (https://github.com/frinyvonnick)",
"Valentin COCAUD (https://github.com/EmrysMyrddin)",
"Hugo WOOD (https://github.com/hgwood)"
],
"main": "index.js",
"private": true,
"scripts": {
"build": "lerna run --stream build",
"lint": "lerna run --stream lint",
"test": "lerna run --stream test",
"test:coverage": "lerna run --stream test:coverage && codecov --disable=gcov ",
"docs": "lerna run --stream docs",
"docs:private": "lerna run --stream docs:private"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^8.0.2",
Expand All @@ -34,25 +24,11 @@
"hotdoc": "^0.7.2",
"jest": "^21.2.1",
"jsdoc": "^3.5.5",
"jsdoc-api": "^4.0.0"
},
"dependencies": {},
"peerDependencies": {
"jsdoc-api": "^4.0.0",
"lerna": "^2.5.1",
"lodash": "^4.17.4"
},
"scripts": {
"generate:flow": "node misc/generate-flow.js",
"prebuild": "yarn generate:flow",
"build": "cross-env BABEL_ENV=production babel src generated -d .",
"lint": "eslint src misc generated",
"pretest": "yarn generate:flow",
"test": "jest",
"test:coverage": "jest --maxWorkers=2 --coverage && codecov",
"docs": "jsdoc -c jsdoc.json",
"docs:private": "jsdoc -c 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 }] }",
"jest": {
"setupTestFrameworkScriptFile": "./misc/test.setup.js"
}
"workspaces": [
"packages/*"
]
}
30 changes: 30 additions & 0 deletions packages/immutadot-lodash/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "immutadot-lodash",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"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"
},
"peerDependencies": {},
"scripts": {
"generate:flow": "node ../../misc/generate-flow.js",
"prebuild": "yarn generate:flow",
"build": "cross-env BABEL_ENV=production babel src generated -d .",
"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"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _difference from 'lodash/difference'
import { convert } from 'core/convert'
import { convert } from 'immutadot/core/convert'

/**
* Replaces an array removing values in the other given arrays from the former array.
Expand All @@ -11,7 +11,7 @@ import { convert } from 'core/convert'
* @return {Object} Returns the updated object.
* @example difference({ nested: { prop: [1, 2] } }, 'nested.prop', [2, 3]) // => { nested: { prop: [1] } }
* @see {@link https://lodash.com/docs#difference|lodash.difference} for more information.
* @since 0.2.0
* @since 1.0.0
* @flow
*/
const difference = convert(_difference)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _differenceBy from 'lodash/differenceBy'
import { convert } from 'core/convert'
import { convert } from 'immutadot/core/convert'

/**
* This method is like {@link array.difference} except that it uses <code>iteratee</code> to generate the value to be compared for each element.
Expand All @@ -12,7 +12,7 @@ import { convert } from 'core/convert'
* @return {Object} Returns the updated object.
* @example differenceBy({ nested: { prop: [1.2, 3.4, 5.6] } }, 'nested.prop', [5.4, 2.1], Math.floor) // => { nested: { prop: [1.2, 3.4] } }
* @see {@link https://lodash.com/docs#differenceBy|lodash.differenceBy} for more information.
* @since 0.3.0
* @since 1.0.0
* @flow
*/
const differenceBy = convert(_differenceBy)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _differenceWith from 'lodash/differenceWith'
import { convert } from 'core/convert'
import { convert } from 'immutadot/core/convert'

/**
* This method is like {@link array.difference} except that it uses <code>comparator</code> to compare elements of the former array to <code>values</code>.
Expand All @@ -12,7 +12,7 @@ import { convert } from 'core/convert'
* @return {Object} Returns the updated object.
* @example differenceWith({ nested: { prop: [{ x: 1 }, { x: 2 }] } }, 'nested.prop', [{ x: 2 }, { x: 3 }], (a, b) => a.x === b.x) // => { nested: { prop: [{ x: 1 }] } }
* @see {@link https://lodash.com/docs#differenceWith|lodash.differenceWith} for more information.
* @since 0.3.0
* @since 1.0.0
* @flow
*/
const differenceWith = convert(_differenceWith)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _drop from 'lodash/drop'
import { convert } from 'core/convert'
import { convert } from 'immutadot/core/convert'

/**
* Replaces an array dropping one or several elements at the start of the former array.
Expand All @@ -11,7 +11,7 @@ import { convert } from 'core/convert'
* @return {Object} Returns the updated object.
* @example drop({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', 2) // => { nested: { prop: [3, 4] } }
* @see {@link https://lodash.com/docs#drop|lodash.drop} for more information.
* @since 0.2.0
* @since 1.0.0
* @flow
*/
const drop = convert(_drop)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _dropRight from 'lodash/dropRight'
import { convert } from 'core/convert'
import { convert } from 'immutadot/core/convert'

/**
* Replaces an array dropping one or several elements at the end of the former array.
Expand All @@ -11,7 +11,7 @@ import { convert } from 'core/convert'
* @return {Object} Returns the updated object.
* @example dropRight({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', 2) // => { nested: { prop: [1, 2] } }
* @see {@link https://lodash.com/docs#dropRight|lodash.dropRight} for more information.
* @since 0.3.0
* @since 1.0.0
* @flow
*/
const dropRight = convert(_dropRight)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _dropRightWhile from 'lodash/dropRightWhile'
import { convert } from 'core/convert'
import { convert } from 'immutadot/core/convert'

/**
* Replaces an array excluding elements dropped from the end. Elements are dropped until <code>predicate</code> returns falsey.
Expand All @@ -11,7 +11,7 @@ import { convert } from 'core/convert'
* @return {Object} Returns the updated object.
* @example dropRightWhile({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', v => v > 2) // => { nested: { prop: [1, 2] } }
* @see {@link https://lodash.com/docs#dropRightWhile|lodash.dropRightWhile} for more information.
* @since 0.3.0
* @since 1.0.0
* @flow
*/
const dropRightWhile = convert(_dropRightWhile)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _dropWhile from 'lodash/dropWhile'
import { convert } from 'core/convert'
import { convert } from 'immutadot/core/convert'

/**
* Replaces an array excluding elements dropped from the beginning. Elements are dropped until <code>predicate</code> returns falsey.
Expand All @@ -11,7 +11,7 @@ import { convert } from 'core/convert'
* @return {Object} Returns the updated object.
* @example dropWhile({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', v => v < 3) // => { nested: { prop: [3, 4] } }
* @see {@link https://lodash.com/docs#dropWhile|lodash.dropWhile} for more information.
* @since 0.3.0
* @since 1.0.0
* @flow
*/
const dropWhile = convert(_dropWhile)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { concat } from './concat'
import { difference } from './difference'
import { differenceBy } from './differenceBy'
import { differenceWith } from './differenceWith'
import { drop } from './drop'
import { dropRight } from './dropRight'
import { dropRightWhile } from './dropRightWhile'
import { dropWhile } from './dropWhile'
import { fill } from './fill'
import { intersection } from './intersection'
import { intersectionBy } from './intersectionBy'
import { intersectionWith } from './intersectionWith'
Expand All @@ -15,19 +13,14 @@ import { pullAll } from './pullAll'
import { pullAllBy } from './pullAllBy'
import { pullAllWith } from './pullAllWith'
import { pullAt } from './pullAt'
import { push } from './push'
import { remove } from './remove'
import { reverse } from './reverse'
import { slice } from './slice'
import { splice } from './splice'
import { take } from './take'
import { takeRight } from './takeRight'
import { takeRightWhile } from './takeRightWhile'
import { takeWhile } from './takeWhile'
import { union } from './union'
import { unionBy } from './unionBy'
import { unionWith } from './unionWith'
import { unshift } from './unshift'
import { without } from './without'
import { xor } from './xor'
import { xorBy } from './xorBy'
Expand All @@ -36,18 +29,16 @@ import { xorWith } from './xorWith'
/**
* Array functions.
* @namespace array
* @since 0.1.6
* @since 1.0.0
*/
export {
concat,
difference,
differenceBy,
differenceWith,
drop,
dropRight,
dropRightWhile,
dropWhile,
fill,
intersection,
intersectionBy,
intersectionWith,
Expand All @@ -56,19 +47,14 @@ export {
pullAllBy,
pullAllWith,
pullAt,
push,
remove,
reverse,
slice,
splice,
take,
takeRight,
takeRightWhile,
takeWhile,
union,
unionBy,
unionWith,
unshift,
without,
xor,
xorBy,
Expand Down
Loading