author
int64 4.98k
943k
| date
stringdate 2017-04-15 16:45:02
2022-02-25 15:32:15
| timezone
int64 -46,800
39.6k
| hash
stringlengths 40
40
| message
stringlengths 8
468
| mods
listlengths 1
16
| language
stringclasses 9
values | license
stringclasses 2
values | repo
stringclasses 119
values | original_message
stringlengths 12
491
| is_CCS
int64 1
1
| commit_type
stringclasses 129
values | commit_scope
stringlengths 1
44
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
679,913
|
02.02.2018 13:28:58
| 0
|
0f57ff904a459d667095356a9c1a4a0e2cff615f
|
docs(atom): update readme, add history example
|
[
{
"change_type": "MODIFY",
"diff": "## About\n-Clojure inspired mutable wrappers for (usually) immutable values, with support for watches.\n-\n-TODO\n+Clojure inspired mutable wrappers for (usually) immutable values, with support\n+for watches, cursors (direct access to nested values), undo/redo history.\n## Installation\n@@ -16,7 +15,9 @@ yarn add @thi.ng/atom\n## Usage examples\n-**More advanced & complete example projects can be found in the [/examples](https://github.com/thi-ng/umbrella/tree/master/examples) directory**\n+A complete minimal webapp example is in the [/examples/todo-list](https://github.com/thi-ng/umbrella/tree/master/examples/todo-list) directory.\n+\n+[Live demo here](http://demo.thi.ng/umbrella/hiccup-dom/todo-list/)\n### Atom\n@@ -74,6 +75,43 @@ main.deref()\n// { a: 24, b: 42 }\n```\n+### Undo history\n+\n+```typescript\n+// the History can be used with & behaves like an Atom or Cursor\n+// but creates snapshots of current state before applying new state\n+// by default history has length of 100 steps, but is configurable\n+db = new atom.History(new atom.Atom({a: 1}))\n+db.deref()\n+// {a: 1}\n+\n+db.reset({a: 2, b: 3})\n+db.reset({b: 4})\n+\n+db.undo()\n+// {a: 2, b: 3}\n+\n+db.undo()\n+// {a: 1}\n+\n+db.undo()\n+// undefined (no more undo possible)\n+db.canUndo()\n+// false\n+\n+db.redo()\n+// {a: 2, b: 3}\n+\n+db.redo()\n+// {b: 4}\n+\n+db.redo()\n+// undefined (no more redo possible)\n+\n+db.canRedo()\n+// false\n+```\n+\n## Authors\n- Karsten Schmidt\n",
"new_path": "packages/atom/README.md",
"old_path": "packages/atom/README.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
docs(atom): update readme, add history example
| 1
|
docs
|
atom
|
679,913
|
02.02.2018 15:26:29
| 0
|
110a9deb9dc67d63c803f78720bf8b6b65e23590
|
fix(api): update compare() & equiv()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -11,5 +11,8 @@ export function compare(a: any, b: any): number {\nif (typeof a.compare === \"function\") {\nreturn a.compare(b);\n}\n+ if (typeof b.compare === \"function\") {\n+ return -b.compare(a);\n+ }\nreturn a < b ? -1 : a > b ? 1 : 0;\n}\n",
"new_path": "packages/api/src/compare.ts",
"old_path": "packages/api/src/compare.ts"
},
{
"change_type": "MODIFY",
"diff": "import { isArrayLike } from \"@thi.ng/checks/is-arraylike\";\nimport { isPlainObject } from \"@thi.ng/checks/is-plain-object\";\n-import { isString } from \"@thi.ng/checks/is-string\";\nexport function equiv(a, b): boolean {\nif (a === b) {\n@@ -20,8 +19,8 @@ export function equiv(a, b): boolean {\n} else {\nreturn a == b;\n}\n- if (isString(a) || isString(b)) {\n- return a === b;\n+ if (typeof a === \"string\" || typeof b === \"string\") {\n+ return false;\n}\nif (isPlainObject(a) && isPlainObject(b)) {\nreturn equivObject(a, b);\n",
"new_path": "packages/api/src/equiv.ts",
"old_path": "packages/api/src/equiv.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(api): update compare() & equiv()
| 1
|
fix
|
api
|
679,913
|
02.02.2018 15:39:49
| 0
|
448e8396227cf5e1c082bde762679a44f01bc736
|
perf(diff): add fail fasts
|
[
{
"change_type": "MODIFY",
"diff": "@@ -20,6 +20,9 @@ export function diffArray(_a, _b) {\nconst: {},\nlinear: []\n};\n+ if (_a === _b) {\n+ return state;\n+ }\nconst reverse = _a.length >= _b.length,\nadds = state[reverse ? \"dels\" : \"adds\"],\ndels = state[reverse ? \"adds\" : \"dels\"],\n",
"new_path": "packages/diff/src/array.ts",
"old_path": "packages/diff/src/array.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -6,8 +6,11 @@ export function diffObject(a: any, b: any) {\nconst adds = [],\ndels = [],\nedits = [],\n- keys = new Set(Object.keys(a).concat(Object.keys(b)));\n- let distance = 0;\n+ keys = new Set(Object.keys(a).concat(Object.keys(b))),\n+ state = <ObjectDiff>{ distance: 0, adds, dels, edits };\n+ if (a === b) {\n+ return state;\n+ }\nfor (let k of keys) {\nconst va = a[k],\nvb = b[k],\n@@ -15,12 +18,12 @@ export function diffObject(a: any, b: any) {\nif (hasA && vb !== undefined) {\nif (!equiv(va, vb)) {\nedits.push([k, vb]);\n- distance++;\n+ state.distance++;\n}\n} else {\n(hasA ? dels : adds).push(k);\n- distance++;\n+ state.distance++;\n}\n}\n- return <ObjectDiff>{ distance, adds, dels, edits };\n+ return state;\n}\n",
"new_path": "packages/diff/src/object.ts",
"old_path": "packages/diff/src/object.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
perf(diff): add fail fasts
| 1
|
perf
|
diff
|
679,913
|
02.02.2018 15:52:22
| 0
|
324d2fa2426d7369afa744dacfe239b4f9e6e9e3
|
docs(examples): add benchmark docs
|
[
{
"change_type": "MODIFY",
"diff": "import { start } from \"@thi.ng/hiccup-dom\";\nimport { fromRAF } from \"@thi.ng/rstream/from/raf\";\n+import { Stream } from \"@thi.ng/rstream/stream\";\nimport * as tx from \"@thi.ng/transducers\";\n+// pre-defined hex formatters\nconst hex4 = tx.hex(4);\nconst hex6 = tx.hex(6);\n-const box = (x: number) => [\n- (x & 1) ? \"div\" : \"box\",\n- { style: { background: \"#\" + hex6((x & 0x1ff) << 15 | x << 10 | x) } },\n- hex4(x & 0xffff)\n+/**\n+ * Single box component. Uses given id to switch between using\n+ * `div` or `box` element types, compute color and body text.\n+ *\n+ * @param id\n+ */\n+const box = (id: number) => [\n+ (id & 1) ? \"div\" : \"box\",\n+ { style: { background: \"#\" + hex6((id & 0x1ff) << 15 | id << 10 | id) } },\n+ hex4(id & 0xffff)\n];\n-const dropdown = (change, items) =>\n+/**\n+ * Simple generic drop down component.\n+ *\n+ * @param change onchange listener\n+ * @param items drop down options `[value, label]`\n+ */\n+const dropdown = (change: (e: Event) => void, items: [any, any][]) =>\ntx.transduce(\n- tx.map<any, any>(([value, label]) => [\"option\", { value }, label]),\n+ tx.map(([value, label]) => <any>[\"option\", { value }, label]),\ntx.push(),\n[\"select\", { \"on-change\": change }],\nitems\n);\n-const fpsCounter = (src, width = 100, height = 30, period = 50, col = \"#09f\", txtCol = \"#000\") => {\n+/**\n+ * Re-usable FPS stats canvas component, displaying graph of\n+ * simple moving avarage of the past `period` frames.\n+ * If `stream` is given, uses the time interval between received\n+ * values. If not given, attaches itself to a RAF event stream.\n+ *\n+ * @param src\n+ * @param width\n+ * @param height\n+ * @param period\n+ * @param col\n+ * @param txtCol\n+ */\n+const fpsCounter = (src: Stream<any>, width = 100, height = 30, period = 50, col = \"#09f\", txtCol = \"#000\") => {\nlet ctx;\nlet scale = height / 60;\n- src.subscribe(\n+ (src || fromRAF()).subscribe(\n{\nnext(samples) {\nctx.clearRect(0, 0, width, height);\n@@ -38,6 +65,7 @@ const fpsCounter = (src, width = 100, height = 30, period = 50, col = \"#09f\", tx\nctx.fillText(`SMA(${period}): ${samples[width - 1].toFixed(1)} fps`, 2, height - 4);\n}\n},\n+ // stream transducer to compute the windowed moving avarage\ntx.comp(\ntx.benchmark(),\ntx.movingAverage(period),\n@@ -55,21 +83,24 @@ const fpsCounter = (src, width = 100, height = 30, period = 50, col = \"#09f\", tx\n}];\n};\n-let i = 0;\n-let num = 128;\n-\n-const fps = fpsCounter(fromRAF(), 100, 60);\n-\n+/**\n+ * Main app root component\n+ */\n+const app = () => {\n+ // initialize local state\n+ let i = 0, num = 128;\n+ const fps = fpsCounter(null, 100, 60);\nconst menu = dropdown(\n- (e) => { num = parseInt(e.target.value); },\n+ (e) => { num = parseInt((<HTMLInputElement>e.target).value); },\n[[128, 128], [192, 192], [256, 256], [384, 384], [512, 512]]\n);\n-const app = () => {\n+ return () => {\nlet j = (++i) & 0x1ff;\nreturn [\"div\",\n[\"div#stats\", fps, menu],\n- tx.transduce(tx.map<any, any>(box), tx.push(), [\"grid\"], tx.range(j, j + num))];\n+ tx.transduce(tx.map(box), tx.push(), <any>[\"grid\"], tx.range(j, j + num))];\n+ };\n};\n-start(document.getElementById(\"app\"), app);\n+start(document.getElementById(\"app\"), app());\n",
"new_path": "examples/hdom-benchmark/src/index.ts",
"old_path": "examples/hdom-benchmark/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
docs(examples): add benchmark docs
| 1
|
docs
|
examples
|
679,913
|
02.02.2018 15:58:59
| 0
|
d134d5b7ba7b2c37b09fd1d8ca38145830c1eec8
|
refactor(hiccup-dom): add interfaces (still unused)
|
[
{
"change_type": "MODIFY",
"diff": "+import { IObjectOf } from \"@thi.ng/api/api\";\n+\n+export interface ILifecycle {\n+ init(el: Element, ...args: any[]);\n+ render(...args: any[]): any;\n+ release(...args: any[]);\n+}\n+\n+export interface ComponentAttribs {\n+ class?: string;\n+ disabled?: boolean;\n+ href?: string;\n+ id?: string;\n+ key?: string;\n+ style?: string | IObjectOf<string | number>;\n+ [_: string]: any;\n+}\n+\nexport const DEBUG = false;\n",
"new_path": "packages/hiccup-dom/src/api.ts",
"old_path": "packages/hiccup-dom/src/api.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(hiccup-dom): add interfaces (still unused)
| 1
|
refactor
|
hiccup-dom
|
807,849
|
02.02.2018 18:31:09
| 28,800
|
513d81a62364c6182970dfd176742e6565da2195
|
refactor(PackageUtilities): use pkg.manifestLocation
|
[
{
"change_type": "MODIFY",
"diff": "@@ -267,7 +267,7 @@ function symlinkPackages(packages, packageGraph, logger, forceLocal, callback) {\nreturn (\nmatch &&\n- FileSystemUtilities.existsSync(path.join(match.package.location, \"package.json\")) &&\n+ FileSystemUtilities.existsSync(match.pkg.manifestLocation) &&\n(forceLocal || iteratedPackage.hasMatchingDependency(match.package))\n);\n});\n",
"new_path": "src/PackageUtilities.js",
"old_path": "src/PackageUtilities.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor(PackageUtilities): use pkg.manifestLocation
| 1
|
refactor
|
PackageUtilities
|
807,849
|
02.02.2018 18:41:02
| 28,800
|
9a108690969fc1931bf7e8e7ba967bd2c56629f7
|
refactor(Package): use Object.defineProperties for greater control
|
[
{
"change_type": "MODIFY",
"diff": "@@ -10,78 +10,91 @@ const dependencyIsSatisfied = require(\"./utils/dependencyIsSatisfied\");\nconst NpmUtilities = require(\"./NpmUtilities\");\nclass Package {\n- constructor(pkg, location) {\n- this._package = pkg;\n- this._location = location;\n- }\n-\n- get name() {\n- return this._package.name;\n- }\n-\n- get location() {\n- return this._location;\n- }\n-\n- get manifestLocation() {\n- return path.join(this._location, \"package.json\");\n- }\n-\n- get nodeModulesLocation() {\n- return path.join(this._location, \"node_modules\");\n- }\n-\n- get binLocation() {\n- return path.join(this.nodeModulesLocation, \".bin\");\n- }\n-\n- get version() {\n- return this._package.version;\n- }\n-\n- set version(version) {\n- this._package.version = version;\n- }\n-\n- get bin() {\n- return this._package.bin;\n- }\n-\n- get dependencies() {\n- return this._package.dependencies;\n- }\n-\n- get devDependencies() {\n- return this._package.devDependencies;\n- }\n-\n- get peerDependencies() {\n- return this._package.peerDependencies;\n- }\n-\n- get allDependencies() {\n- return Object.assign({}, this.devDependencies, this.dependencies);\n- }\n-\n- get scripts() {\n- return this._package.scripts || {};\n- }\n-\n- set versionSerializer(versionSerializer) {\n- this._versionSerializer = versionSerializer;\n-\n- if (versionSerializer) {\n- this._package = versionSerializer.deserialize(this._package);\n- }\n+ constructor(json, location) {\n+ let pkg = json;\n+ // TODO: less mutation by reference\n+\n+ Object.defineProperties(this, {\n+ // read-only\n+ name: {\n+ enumerable: true,\n+ value: pkg.name,\n+ },\n+ location: {\n+ value: location,\n+ },\n+ // mutable\n+ version: {\n+ get() {\n+ return pkg.version;\n+ },\n+ set(version) {\n+ pkg.version = version;\n+ },\n+ },\n+ // collections\n+ dependencies: {\n+ get() {\n+ return pkg.dependencies;\n+ },\n+ },\n+ devDependencies: {\n+ get() {\n+ return pkg.devDependencies;\n+ },\n+ },\n+ peerDependencies: {\n+ get() {\n+ return pkg.peerDependencies;\n+ },\n+ },\n+ allDependencies: {\n+ get() {\n+ return Object.assign({}, pkg.devDependencies, pkg.dependencies);\n+ },\n+ },\n+ // immutable\n+ bin: {\n+ value: pkg.bin,\n+ },\n+ scripts: {\n+ value: pkg.scripts || {},\n+ },\n+ manifestLocation: {\n+ value: path.join(location, \"package.json\"),\n+ },\n+ nodeModulesLocation: {\n+ value: path.join(location, \"node_modules\"),\n+ },\n+ binLocation: {\n+ value: path.join(location, \"node_modules\", \".bin\"),\n+ },\n+ // side-effects\n+ versionSerializer: {\n+ set(impl) {\n+ this.serialize = impl.serialize;\n+ pkg = impl.deserialize(pkg);\n+ },\n+ },\n+ serialize: {\n+ value: K => K,\n+ writable: true,\n+ },\n+ // \"private\"\n+ json: {\n+ get() {\n+ return pkg;\n+ },\n+ },\n+ });\n}\nisPrivate() {\n- return !!this._package.private;\n+ return !!this.json.private;\n}\ntoJSON() {\n- const pkg = _.cloneDeep(this._package);\n- return this._versionSerializer ? this._versionSerializer.serialize(pkg) : pkg;\n+ return this.serialize(_.cloneDeep(this.json));\n}\n/**\n",
"new_path": "src/Package.js",
"old_path": "src/Package.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -18,7 +18,6 @@ jest.mock(\"../src/NpmUtilities\");\nlog.level = \"silent\";\ndescribe(\"Package\", () => {\n- /* eslint no-underscore-dangle: [\"error\", { \"allow\": [\"_package\"] }] */\nlet pkg;\nbeforeEach(() => {\n@@ -55,7 +54,7 @@ describe(\"Package\", () => {\n});\ndescribe(\"set .version\", () => {\n- it(\"should return the version\", () => {\n+ it(\"should set the version\", () => {\npkg.version = \"2.0.0\";\nexpect(pkg.version).toBe(\"2.0.0\");\n});\n@@ -118,24 +117,24 @@ describe(\"Package\", () => {\npkg.versionSerializer = mockSerializer;\nexpect(mockSerializer.deserialize).toBeCalled();\n- expect(mockSerializer.deserialize).toBeCalledWith(pkg._package);\n+ expect(mockSerializer.deserialize).toBeCalledWith(pkg.json);\nexpect(mockSerializer.serialize).not.toBeCalled();\n});\n});\ndescribe(\".toJSON()\", () => {\nit(\"should return clone of internal package for serialization\", () => {\n- expect(pkg.toJSON()).not.toBe(pkg._package);\n- expect(pkg.toJSON()).toEqual(pkg._package);\n+ expect(pkg.toJSON()).not.toBe(pkg.json);\n+ expect(pkg.toJSON()).toEqual(pkg.json);\nconst implicit = JSON.stringify(pkg, null, 2);\n- const explicit = JSON.stringify(pkg._package, null, 2);\n+ const explicit = JSON.stringify(pkg.json, null, 2);\nexpect(implicit).toBe(explicit);\n});\nit(\"should not change internal package with versionSerializer\", () => {\n- pkg._package.state = \"serialized\";\n+ pkg.json.state = \"serialized\";\nconst mockSerializer = {\nserialize: jest.fn(obj => {\n@@ -148,15 +147,15 @@ describe(\"Package\", () => {\n}),\n};\n- const serializedPkg = Object.assign({}, pkg._package, { state: \"serialized\" });\n- const deserializedPkg = Object.assign({}, pkg._package, { state: \"deserialized\" });\n+ const serializedPkg = Object.assign({}, pkg.json, { state: \"serialized\" });\n+ const deserializedPkg = Object.assign({}, pkg.json, { state: \"deserialized\" });\npkg.versionSerializer = mockSerializer;\nexpect(mockSerializer.deserialize).toBeCalled();\n- expect(pkg._package).toEqual(deserializedPkg);\n+ expect(pkg.json).toEqual(deserializedPkg);\nconst serializedResult = pkg.toJSON();\n- expect(pkg._package).toEqual(deserializedPkg);\n+ expect(pkg.json).toEqual(deserializedPkg);\nexpect(serializedResult).toEqual(serializedPkg);\nexpect(mockSerializer.serialize).toBeCalled();\n@@ -170,11 +169,11 @@ describe(\"Package\", () => {\npkg.versionSerializer = mockSerializer;\n- expect(pkg.toJSON()).toEqual(pkg._package);\n+ expect(pkg.toJSON()).toEqual(pkg.json);\nexpect(mockSerializer.deserialize).toBeCalled();\nexpect(mockSerializer.serialize).toBeCalled();\n- expect(mockSerializer.serialize).toBeCalledWith(pkg._package);\n+ expect(mockSerializer.serialize).toBeCalledWith(pkg.json);\n});\n});\n",
"new_path": "test/Package.js",
"old_path": "test/Package.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor(Package): use Object.defineProperties for greater control
| 1
|
refactor
|
Package
|
807,849
|
02.02.2018 18:42:59
| 28,800
|
75e3a4aa3ad879e8f26695b85c52dc931e1f4eb8
|
refactor(Package): #isPrivate() -> #private
|
[
{
"change_type": "MODIFY",
"diff": "@@ -23,6 +23,9 @@ class Package {\nlocation: {\nvalue: location,\n},\n+ private: {\n+ value: Boolean(pkg.private),\n+ },\n// mutable\nversion: {\nget() {\n@@ -89,10 +92,6 @@ class Package {\n});\n}\n- isPrivate() {\n- return !!this.json.private;\n- }\n-\ntoJSON() {\nreturn this.serialize(_.cloneDeep(this.json));\n}\n",
"new_path": "src/Package.js",
"old_path": "src/Package.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -44,7 +44,7 @@ class LsCommand extends Command {\nconst formattedPackages = this.filteredPackages.map(pkg => ({\nname: pkg.name,\nversion: pkg.version,\n- private: pkg.isPrivate(),\n+ private: pkg.private,\n}));\nif (this.options.json) {\n",
"new_path": "src/commands/LsCommand.js",
"old_path": "src/commands/LsCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -220,7 +220,7 @@ class PublishCommand extends Command {\nthis.updates = new UpdatedPackagesCollector(this).getUpdates();\n- this.packagesToPublish = this.updates.map(update => update.package).filter(pkg => !pkg.isPrivate());\n+ this.packagesToPublish = this.updates.map(update => update.package).filter(pkg => !pkg.private);\nthis.packagesToPublishCount = this.packagesToPublish.length;\ntry {\n@@ -527,7 +527,7 @@ class PublishCommand extends Command {\nconst changes = this.updates.map(update => {\nconst pkg = update.package;\nlet line = ` - ${pkg.name}: ${pkg.version} => ${this.updatesVersions[pkg.name]}`;\n- if (pkg.isPrivate()) {\n+ if (pkg.private) {\nline += ` (${chalk.red(\"private\")})`;\n}\nreturn line;\n",
"new_path": "src/commands/PublishCommand.js",
"old_path": "src/commands/PublishCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -55,7 +55,7 @@ class UpdatedCommand extends Command {\nconst updatedPackages = this.updates.map(update => update.package).map(pkg => ({\nname: pkg.name,\nversion: pkg.version,\n- private: pkg.isPrivate(),\n+ private: pkg.private,\n}));\nthis.logger.info(\"result\");\n",
"new_path": "src/commands/UpdatedCommand.js",
"old_path": "src/commands/UpdatedCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -101,9 +101,9 @@ describe(\"Package\", () => {\n});\n});\n- describe(\".isPrivate()\", () => {\n- it(\"should return if the package is private\", () => {\n- expect(pkg.isPrivate()).toBe(false);\n+ describe(\"get .private\", () => {\n+ it(\"should indicate if the package is private\", () => {\n+ expect(pkg.private).toBe(false);\n});\n});\n",
"new_path": "test/Package.js",
"old_path": "test/Package.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor(Package): #isPrivate() -> #private
| 1
|
refactor
|
Package
|
815,746
|
02.02.2018 20:22:05
| -7,200
|
77d36ca98c05c256734a3c806599f5fda69b2c34
|
feat: Close dropdown on select by default
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -124,6 +124,7 @@ map: {\n| dropdownPosition | `bottom`,`top` | `bottom` | no | Set the dropdown position on open |\n| appendTo | string | null | no | Append drodown to body or any other element using css selector |\n| loading | boolean | `-` | no | you can set the loading state from the outside (e.g. async items loading) |\n+| closeOnSelect | boolean | true | no | whether to close the menu when a value is selected |\n| Output | Description |\n| ------------- | ------------- |\n",
"new_path": "README.md",
"old_path": "README.md"
},
{
"change_type": "MODIFY",
"diff": "import { NgOption } from './ng-select.types';\nimport * as searchHelper from './search-helper';\n+import { NgSelectComponent } from './ng-select.component';\nexport class ItemsList {\n- items: NgOption[] = [];\n- filteredItems: NgOption[] = [];\n-\n+ private _items: NgOption[] = [];\n+ private _filteredItems: NgOption[] = [];\nprivate _markedIndex = -1;\nprivate _selected: NgOption[] = [];\n- private _multiple = false;\n- private _bindLabel: string;\n+\n+ constructor(private _ngSelect: NgSelectComponent) {}\n+\n+ get items(): NgOption[] {\n+ return this._items;\n+ }\n+\n+ get filteredItems(): NgOption[] {\n+ return this._filteredItems;\n+ }\nget value(): NgOption[] {\nreturn this._selected;\n}\nget markedItem(): NgOption {\n- return this.filteredItems[this._markedIndex];\n+ return this._filteredItems[this._markedIndex];\n}\nget markedIndex(): number {\nreturn this._markedIndex;\n}\n- setItems(items: any[], bindLabel: string, simple: boolean = false) {\n- this._bindLabel = bindLabel;\n- this.items = items.map((item, index) => this.mapItem(item, simple, index));\n- this.filteredItems = [...this.items];\n- }\n-\n- setMultiple(multiple: boolean) {\n- this._multiple = multiple;\n- this.clearSelected();\n+ setItems(items: any[], simple = false) {\n+ this._items = items.map((item, index) => this.mapItem(item, simple, index));\n+ this._filteredItems = [...this._items];\n}\nselect(item: NgOption) {\nif (item.selected) {\nreturn;\n}\n- if (!this._multiple) {\n+ if (!this._ngSelect.multiple) {\nthis.clearSelected();\n}\nthis._selected.push(item);\nitem.selected = true;\n}\n- findItem(value: any, bindValue: string): NgOption {\n- if (bindValue) {\n- return this.items.find(item => item.value[bindValue] === value);\n+ findItem(value: any): NgOption {\n+ if (this._ngSelect.bindValue) {\n+ return this._items.find(item => item.value[this._ngSelect.bindValue] === value);\n}\n- const index = this.items.findIndex(x => x.value === value);\n- return index > -1 ? this.items[index] :\n- this.items.find(item => item.label && item.label === this.resolveNested(value, this._bindLabel));\n+ const index = this._items.findIndex(x => x.value === value);\n+ return index > -1 ? this._items[index] :\n+ this._items.find(item => item.label && item.label === this.resolveNested(value, this._ngSelect.bindLabel));\n}\nunselect(item: NgOption) {\n@@ -70,12 +72,12 @@ export class ItemsList {\naddItem(item: any) {\nconst option = {\n- index: this.items.length,\n- label: this.resolveNested(item, this._bindLabel),\n+ index: this._items.length,\n+ label: this.resolveNested(item, this._ngSelect.bindLabel),\nvalue: item\n}\n- this.items.push(option);\n- this.filteredItems.push(option);\n+ this._items.push(option);\n+ this._filteredItems.push(option);\nreturn option;\n}\n@@ -89,11 +91,11 @@ export class ItemsList {\nfilter(term: string) {\nconst filterFuncVal = this._getDefaultFilterFunc(term);\n- this.filteredItems = term ? this.items.filter(val => filterFuncVal(val)) : this.items;\n+ this._filteredItems = term ? this._items.filter(val => filterFuncVal(val)) : this._items;\n}\nclearFilter() {\n- this.filteredItems = [...this.items];\n+ this._filteredItems = [...this._items];\n}\nunmarkItem() {\n@@ -109,16 +111,16 @@ export class ItemsList {\n}\nmarkItem(item: NgOption) {\n- this._markedIndex = this.filteredItems.indexOf(item);\n+ this._markedIndex = this._filteredItems.indexOf(item);\n}\nmarkSelectedOrDefault(markDefault: boolean) {\n- if (this.filteredItems.length === 0) {\n+ if (this._filteredItems.length === 0) {\nreturn;\n}\nif (this._lastSelectedItem) {\n- this._markedIndex = this.filteredItems.indexOf(this._lastSelectedItem);\n+ this._markedIndex = this._filteredItems.indexOf(this._lastSelectedItem);\n} else {\nthis._markedIndex = markDefault ? 0 : -1;\n}\n@@ -147,7 +149,7 @@ export class ItemsList {\noption = item;\nlabel = item;\n} else {\n- label = this.resolveNested(option, this._bindLabel);\n+ label = this.resolveNested(option, this._ngSelect.bindLabel);\n}\nreturn {\nindex: index,\n@@ -159,13 +161,13 @@ export class ItemsList {\nprivate _getNextItemIndex(steps: number) {\nif (steps > 0) {\n- return (this._markedIndex === this.filteredItems.length - 1) ? 0 : (this._markedIndex + 1);\n+ return (this._markedIndex === this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);\n}\n- return (this._markedIndex <= 0) ? (this.filteredItems.length - 1) : (this._markedIndex - 1);\n+ return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);\n}\nprivate _stepToItem(steps: number) {\n- if (this.filteredItems.length === 0) {\n+ if (this._filteredItems.length === 0) {\nreturn;\n}\n",
"new_path": "src/ng-select/items-list.ts",
"old_path": "src/ng-select/items-list.ts"
},
{
"change_type": "MODIFY",
"diff": "<div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\">\n<ng-container [ngTemplateOutlet]=\"headerTemplate\"></ng-container>\n</div>\n- <virtual-scroll role=\"listbox\" class=\"ng-select-dropdown\" [disabled]=\"disableVirtualScroll\" [bufferAmount]=\"4\" [items]=\"itemsList.filteredItems\" (update)=\"viewPortItems = $event\">\n+ <ng-select-virtual-scroll class=\"ng-select-dropdown\" [disabled]=\"disableVirtualScroll\" [bufferAmount]=\"4\" [items]=\"itemsList.filteredItems\" (update)=\"viewPortItems = $event\">\n<div class=\"ng-option\" role=\"option\" (click)=\"toggleItem(item)\" (mousedown)=\"$event.preventDefault()\" (mouseover)=\"onItemHover(item)\"\n*ngFor=\"let item of viewPortItems\"\n[class.disabled]=\"item.disabled\"\n<div class=\"ng-option\" [class.marked]=\"!itemsList.markedItem\" (mouseover)=\"itemsList.unmarkItem()\" role=\"option\" (click)=\"selectTag()\" *ngIf=\"showAddTag()\">\n<span><span class=\"ng-tag-label\">{{addTagText}}</span>\"{{filterValue}}\"</span>\n</div>\n- </virtual-scroll>\n+ </ng-select-virtual-scroll>\n<div class=\"ng-select-dropdown\" *ngIf=\"showNoItemsFound() && !addTag\">\n<div class=\"ng-option disabled\">\n",
"new_path": "src/ng-select/ng-select.component.html",
"old_path": "src/ng-select/ng-select.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -455,6 +455,37 @@ describe('NgSelectComponent', function () {\n});\n});\n+ describe('Dropdown', () => {\n+ it('should close on option select by default', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectBasicTestCmp,\n+ `<ng-select [items]=\"cities\"\n+ bindLabel=\"name\"\n+ [(ngModel)]=\"city\">\n+ </ng-select>`);\n+\n+ selectOption(fixture, KeyCode.ArrowDown, 0);\n+ tickAndDetectChanges(fixture);\n+\n+ expect(fixture.componentInstance.select.isOpen).toBeFalsy();\n+ }));\n+\n+ it('should not close on option select when [closeOnSelect]=\"false\"', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectBasicTestCmp,\n+ `<ng-select [items]=\"cities\"\n+ bindLabel=\"name\"\n+ [closeOnSelect]=\"false\"\n+ [(ngModel)]=\"city\">\n+ </ng-select>`);\n+\n+ selectOption(fixture, KeyCode.ArrowDown, 0);\n+ tickAndDetectChanges(fixture);\n+\n+ expect(fixture.componentInstance.select.isOpen).toBeTruthy();\n+ }));\n+ });\n+\ndescribe('Keyboard events', () => {\nlet fixture: ComponentFixture<NgSelectBasicTestCmp>;\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -60,16 +60,6 @@ const NG_SELECT_VALUE_ACCESSOR = {\n})\nexport class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit, ControlValueAccessor {\n- @ContentChild(NgOptionTemplateDirective, { read: TemplateRef }) optionTemplate: TemplateRef<any>;\n- @ContentChild(NgLabelTemplateDirective, { read: TemplateRef }) labelTemplate: TemplateRef<any>;\n- @ContentChild(NgHeaderTemplateDirective, { read: TemplateRef }) headerTemplate: TemplateRef<any>;\n- @ContentChild(NgFooterTemplateDirective, { read: TemplateRef }) footerTemplate: TemplateRef<any>;\n-\n- @ViewChild(VirtualScrollComponent) dropdownList: VirtualScrollComponent;\n- @ViewChild('dropdownPanel') dropdownPanel: ElementRef;\n- @ContentChildren(NgOptionComponent, { descendants: true }) ngOptions: QueryList<NgOptionComponent>;\n- @ViewChild('filterInput') filterInput: ElementRef;\n-\n// inputs\n@Input() items: any[] = [];\n@Input() bindLabel: string;\n@@ -86,18 +76,11 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n@Input() dropdownPosition: 'bottom' | 'top' = 'bottom';\n@Input() appendTo: string;\n@Input() loading = false;\n-\n- @Input()\n- @HostBinding('class.typeahead') typeahead: Subject<string>;\n-\n- @Input()\n- @HostBinding('class.ng-multiple') multiple = false;\n-\n- @Input()\n- @HostBinding('class.taggable') addTag: boolean | ((term: string) => NgOption) = false;\n-\n- @Input()\n- @HostBinding('class.searchable') searchable = true;\n+ @Input() closeOnSelect = true;\n+ @Input() @HostBinding('class.typeahead') typeahead: Subject<string>;\n+ @Input() @HostBinding('class.ng-multiple') multiple = false;\n+ @Input() @HostBinding('class.taggable') addTag: boolean | ((term: string) => NgOption) = false;\n+ @Input() @HostBinding('class.searchable') searchable = true;\n// output events\n@Output('blur') blurEvent = new EventEmitter();\n@@ -110,6 +93,17 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n@Output('add') addEvent = new EventEmitter();\n@Output('remove') removeEvent = new EventEmitter();\n+ // custom templates\n+ @ContentChild(NgOptionTemplateDirective, { read: TemplateRef }) optionTemplate: TemplateRef<any>;\n+ @ContentChild(NgLabelTemplateDirective, { read: TemplateRef }) labelTemplate: TemplateRef<any>;\n+ @ContentChild(NgHeaderTemplateDirective, { read: TemplateRef }) headerTemplate: TemplateRef<any>;\n+ @ContentChild(NgFooterTemplateDirective, { read: TemplateRef }) footerTemplate: TemplateRef<any>;\n+\n+ @ViewChild(VirtualScrollComponent) dropdownList: VirtualScrollComponent;\n+ @ViewChild('dropdownPanel') dropdownPanel: ElementRef;\n+ @ContentChildren(NgOptionComponent, { descendants: true }) ngOptions: QueryList<NgOptionComponent>;\n+ @ViewChild('filterInput') filterInput: ElementRef;\n+\n@HostBinding('class.ng-single')\nget single() {\nreturn !this.multiple;\n@@ -120,12 +114,11 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n@HostBinding('class.disabled') isDisabled = false;\n@HostBinding('class.filtered') get filtered() { return !!this.filterValue };\n- itemsList = new ItemsList();\n+ itemsList = new ItemsList(this);\nviewPortItems: NgOption[] = [];\nfilterValue: string = null;\nprivate _ngModel: any = null;\n- private _simple = false;\nprivate _defaultLabel = 'label';\nprivate _defaultValue = 'value';\nprivate _typeaheadLoading = false;\n@@ -158,7 +151,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nngOnChanges(changes: SimpleChanges) {\nif (changes.multiple) {\n- this.itemsList.setMultiple(changes.multiple.currentValue);\n+ this.itemsList.clearSelected();\n}\nif (changes.items) {\nthis._setItems(changes.items.currentValue || []);\n@@ -319,7 +312,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nthis.addEvent.emit(item.value);\n}\n- if (this.single) {\n+ if (this.closeOnSelect) {\nthis.close();\n}\n}\n@@ -417,8 +410,8 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nprivate _setItems(items: any[]) {\nconst firstItem = items[0];\nthis.bindLabel = this.bindLabel || this._defaultLabel;\n- this._simple = firstItem && !(firstItem instanceof Object);\n- this.itemsList.setItems(items, this.bindLabel, this._simple);\n+ const simple = firstItem && !(firstItem instanceof Object);\n+ this.itemsList.setItems(items, simple);\nif (this._isDefined(this._ngModel) && items.length > 0) {\nthis.itemsList.clearSelected();\nthis._selectWriteValue(this._ngModel);\n@@ -438,7 +431,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nvalue: option.value,\nlabel: option.elementRef.nativeElement.innerHTML\n}));\n- this.itemsList.setItems(this.items, this.bindLabel);\n+ this.itemsList.setItems(this.items, false);\nif (this._isDefined(this._ngModel)) {\nthis.itemsList.clearSelected();\n@@ -544,7 +537,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n}\nconst select = (val: any) => {\n- const item = this.itemsList.findItem(val, this.bindValue);\n+ const item = this.itemsList.findItem(val);\nif (item) {\nthis.itemsList.select(item);\n} else {\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -11,11 +11,11 @@ describe('VirtualScrollComponent', () => {\nconst fixture = createTestingModule(\nBasicVirtualScrollTestCmp,\n`<div style=\"height: 100px; overflow-y: scroll; display: block;\">\n- <virtual-scroll style=\"height: 100px;\" [bufferAmount]=\"10\" [items]=\"items\" (update)=\"viewPortItems = $event\">\n+ <ng-select-virtual-scroll style=\"height: 100px;\" [bufferAmount]=\"10\" [items]=\"items\" (update)=\"viewPortItems = $event\">\n<div [attr.class]=\"'item'+item\" style=\"height: 20px;\" *ngFor=\"let item of viewPortItems\">\n{{item}}\n</div>\n- </virtual-scroll>\n+ </ng-select-virtual-scroll>\n<div>`);\ntick(100);\n",
"new_path": "src/ng-select/virtual-scroll.component.spec.ts",
"old_path": "src/ng-select/virtual-scroll.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -20,10 +20,10 @@ import {\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\n+import { NgOption } from './ng-select.types';\n@Component({\n- selector: 'virtual-scroll,[virtualScroll]',\n- exportAs: 'virtualScroll',\n+ selector: 'ng-select-virtual-scroll',\ntemplate: `\n<div *ngIf=\"enabled\" class=\"total-padding\" [style.height]=\"scrollHeight + 'px'\"></div>\n<div #content\n@@ -57,53 +57,34 @@ import { CommonModule } from '@angular/common';\n})\nexport class VirtualScrollComponent implements OnInit, OnChanges, OnDestroy {\n- @Input()\n- items: any[] = [];\n+ @Input() items: NgOption[] = [];\n+ @Input() bufferAmount = 0;\n+ @Input() disabled = false;\n- @Input()\n- scrollbarWidth: number;\n+ @Output() update = new EventEmitter<any[]>();\n- @Input()\n- scrollbarHeight: number;\n+ @ViewChild('content', { read: ElementRef }) contentElementRef: ElementRef;\n+ @ContentChild('container') containerElementRef: ElementRef;\n- @Input()\n- childWidth: number;\n-\n- @Input()\n- childHeight: number;\n-\n- @Input()\n- bufferAmount = 0;\n-\n- @Input()\n- disabled = false;\n-\n- @Output()\n- update: EventEmitter<any[]> = new EventEmitter<any[]>();\n-\n- @ViewChild('content', { read: ElementRef })\n- contentElementRef: ElementRef;\n-\n- @ContentChild('container')\n- containerElementRef: ElementRef;\n-\n- topPadding: number;\nscrollHeight: number;\n+ private _topPadding: number;\nprivate _previousStart: number;\nprivate _previousEnd: number;\nprivate _startupLoop = true;\n+ // min number of items for virtual scroll to be enabled\n+ private _minItems = 40;\nprivate _disposeScrollListener = () => { };\nconstructor(private element: ElementRef, private zone: NgZone, private renderer: Renderer2) {\n}\nget enabled() {\n- return !this.disabled && this.items && this.items.length > 20;\n+ return !this.disabled && this.items && this.items.length > this._minItems;\n}\nget transformStyle() {\n- return this.enabled ? 'translateY(' + this.topPadding + 'px)' : 'none'\n+ return this.enabled ? 'translateY(' + this._topPadding + 'px)' : 'none'\n}\nhandleScroll() {\n@@ -119,8 +100,6 @@ export class VirtualScrollComponent implements OnInit, OnChanges, OnDestroy {\nngOnInit() {\nthis.handleScroll();\n- this.scrollbarWidth = 0; // this.element.nativeElement.offsetWidth - this.element.nativeElement.clientWidth;\n- this.scrollbarHeight = 0; // this.element.nativeElement.offsetHeight - this.element.nativeElement.clientHeight;\n}\nngOnDestroy() {\n@@ -195,11 +174,10 @@ export class VirtualScrollComponent implements OnInit, OnChanges, OnDestroy {\nlet el: Element = this.element.nativeElement;\nlet items = this.items || [];\nlet itemCount = items.length;\n- let viewWidth = el.clientWidth - this.scrollbarWidth;\n- let viewHeight = el.clientHeight - this.scrollbarHeight;\n+ let viewWidth = el.clientWidth;\n+ let viewHeight = el.clientHeight;\nlet contentDimensions;\n- if (this.childWidth === undefined || this.childHeight === undefined) {\nlet content = this.contentElementRef.nativeElement;\nif (this.containerElementRef && this.containerElementRef.nativeElement) {\ncontent = this.containerElementRef.nativeElement;\n@@ -208,9 +186,8 @@ export class VirtualScrollComponent implements OnInit, OnChanges, OnDestroy {\nwidth: viewWidth,\nheight: viewHeight\n};\n- }\n- let childWidth = this.childWidth || contentDimensions.width;\n- let childHeight = this.childHeight || contentDimensions.height;\n+ let childWidth = contentDimensions.width;\n+ let childHeight = contentDimensions.height;\nlet itemsPerRow = Math.max(1, this._countItemsPerRow());\nlet itemsPerRowByCalc = Math.max(1, Math.floor(viewWidth / childWidth));\n@@ -256,7 +233,7 @@ export class VirtualScrollComponent implements OnInit, OnChanges, OnDestroy {\nlet maxStart = Math.max(0, maxStartEnd - d.itemsPerCol * d.itemsPerRow - d.itemsPerRow);\nlet start = Math.min(maxStart, Math.floor(indexByScrollTop) * d.itemsPerRow);\n- this.topPadding = d.childHeight * Math.ceil(start / d.itemsPerRow) - (d.childHeight * Math.min(start, this.bufferAmount));\n+ this._topPadding = d.childHeight * Math.ceil(start / d.itemsPerRow) - (d.childHeight * Math.min(start, this.bufferAmount));\nstart = !isNaN(start) ? start : -1;\nend = !isNaN(end) ? end : -1;\n",
"new_path": "src/ng-select/virtual-scroll.component.ts",
"old_path": "src/ng-select/virtual-scroll.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
feat: Close dropdown on select by default (#226)
closes #222
| 1
|
feat
| null |
815,746
|
02.02.2018 20:32:27
| -7,200
|
7c5748e6d7facfdcad9688a3943ff8bf125713a9
|
fix: add touched on dropdown open
fixes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -277,6 +277,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nthis.itemsList.markSelectedOrDefault(this.markFirst);\nthis._scrollToMarked();\nthis._focusSearchInput();\n+ this._onTouched();\nthis.openEvent.emit();\nif (this.appendTo) {\nthis._updateDropdownPosition();\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: add touched on dropdown open (#228)
fixes #225
| 1
|
fix
| null |
679,913
|
02.02.2018 21:35:14
| 0
|
38699b96a7c07b0033aa8ec25a0dcc6d52d395c4
|
docs(hiccup-dom): add diagram
|
[
{
"change_type": "MODIFY",
"diff": "@@ -42,6 +42,8 @@ difference between the old and new DOM trees (both nested JS arrays).\nComponents can be defined as static arrays, closures or objects with life cycle\nhooks (init, render, release).\n+\n+\nThe approach is inspired by Clojure's\n[Hiccup](https://github.com/weavejester/hiccup) and\n[Reagent](http://reagent-project.github.io/) projects, however the latter is a\n",
"new_path": "packages/hiccup-dom/README.md",
"old_path": "packages/hiccup-dom/README.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
docs(hiccup-dom): add diagram
| 1
|
docs
|
hiccup-dom
|
815,746
|
02.02.2018 21:41:51
| -7,200
|
3551917f33437361debacf87ef8d8e13431f8293
|
feat: add support for nested value bindings
fixes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -7,24 +7,24 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';\n<label>Bind to default <b>label</b>, <b>object</b> bindings</label>\n---html,true\n<ng-select [items]=\"defaultBindingsList\"\n- [(ngModel)]=\"selectedCity2\">\n+ [(ngModel)]=\"selectedCity\">\n</ng-select>\n---\n<p>\n- Selected city object: {{selectedCity2 | json}}\n+ Selected city object: {{selectedCity | json}}\n</p>\n<hr>\n<label>Bind label to nested custom property</label>\n---html,true\n<ng-select [items]=\"countries\"\n- bindLabel=\"description.name\"\n+ bindLabel=\"nested.name\"\n+ bindValue=\"nested.countryId\"\nplaceholder=\"Select value\"\n- [clearable]=\"false\"\n- [(ngModel)]=\"selectedCity\">\n+ [(ngModel)]=\"selectedCountryId\">\n</ng-select>\n---\n<p>\n- Selected city object: {{selectedCity | json}}\n+ Selected country ID: {{selectedCountryId}}\n</p>\n<hr>\n<label>Bind label and model to custom properties</label>\n@@ -32,11 +32,11 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';\n<ng-select [items]=\"cities\"\nbindLabel=\"name\"\nbindValue=\"id\"\n- [(ngModel)]=\"selectedCityId2\">\n+ [(ngModel)]=\"selectedCityId\">\n</ng-select>\n---\n<p>\n- Selected city ID: {{selectedCityId2 | json}}\n+ Selected city ID: {{selectedCityId | json}}\n</p>\n`\n})\n@@ -55,16 +55,19 @@ export class SelectBindingsComponent {\n];\ncountries = [\n- { id: 1, description: { name: 'Lithuania' } },\n- { id: 2, description: { name: 'USA' } },\n- { id: 3, description: { name: 'Australia' } }\n+ { id: 1, nested: { countryId: 'L', name: 'Lithuania' } },\n+ { id: 2, nested: { countryId: 'U', name: 'USA' } },\n+ { id: 3, nested: { countryId: 'A', name: 'Australia' } }\n];\n- selectedCity: any;\n- selectedCity2: number = null;\n- selectedCityId2: number = null;\n+ selectedCountryId: string = null;\n+ selectedCity = null;\n+ selectedCityId: number = null;\nngOnInit() {\n+ this.selectedCountryId = this.countries[0].nested.countryId;\n+ this.selectedCity = this.defaultBindingsList[0];\n+ this.selectedCityId = this.cities[0].id;\n}\n}\n",
"new_path": "demo/app/examples/bindings.component.ts",
"old_path": "demo/app/examples/bindings.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -49,7 +49,7 @@ export class ItemsList {\nfindItem(value: any): NgOption {\nif (this._ngSelect.bindValue) {\n- return this._items.find(item => item.value[this._ngSelect.bindValue] === value);\n+ return this._items.find(item => this.resolveNested(item.value, this._ngSelect.bindValue) === value);\n}\nconst index = this._items.findIndex(x => x.value === value);\nreturn index > -1 ? this._items[index] :\n",
"new_path": "src/ng-select/items-list.ts",
"old_path": "src/ng-select/items-list.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -263,7 +263,7 @@ describe('NgSelectComponent', function () {\nNgSelectCustomBindingsTestCmp,\n`<ng-select [items]=\"countries\"\nbindLabel=\"description.name\"\n- [(ngModel)]=\"country\">\n+ [(ngModel)]=\"selectedCountry\">\n</ng-select>`);\nselectOption(fixture, KeyCode.ArrowDown, 1);\n@@ -273,7 +273,7 @@ describe('NgSelectComponent', function () {\nvalue: fixture.componentInstance.countries[1]\n})]);\n- fixture.componentInstance.country = fixture.componentInstance.countries[0];\n+ fixture.componentInstance.selectedCountry = fixture.componentInstance.countries[0];\ntickAndDetectChanges(fixture);\nexpect(fixture.componentInstance.select.selectedItems).toEqual([jasmine.objectContaining({\nlabel: 'Lithuania',\n@@ -281,6 +281,31 @@ describe('NgSelectComponent', function () {\n})]);\n}));\n+ it('bind to nested value property', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectCustomBindingsTestCmp,\n+ `<ng-select [items]=\"countries\"\n+ bindLabel=\"description.name\"\n+ bindValue=\"description.id\"\n+ [(ngModel)]=\"selectedCountry\">\n+ </ng-select>`);\n+\n+ selectOption(fixture, KeyCode.ArrowDown, 1);\n+ tickAndDetectChanges(fixture);\n+ expect(fixture.componentInstance.selectedCountry).toEqual('b');\n+\n+ fixture.componentInstance.selectedCountry = fixture.componentInstance.countries[2].description.id;\n+ tickAndDetectChanges(fixture);\n+ expect(fixture.componentInstance.select.selectedItems).toEqual([jasmine.objectContaining({\n+ label: 'Australia',\n+ value: fixture.componentInstance.countries[2]\n+ })]);\n+\n+ selectOption(fixture, KeyCode.ArrowUp, 1);\n+ tickAndDetectChanges(fixture);\n+ expect(fixture.componentInstance.selectedCountry).toEqual('b');\n+ }));\n+\nit('bind to simple array', fakeAsync(() => {\nconst fixture = createTestingModule(\nNgSelectSimpleCmp,\n@@ -1516,16 +1541,16 @@ class NgSelectSelectedObjectByRefCmp {\nclass NgSelectCustomBindingsTestCmp {\n@ViewChild(NgSelectComponent) select: NgSelectComponent;\nselectedCityId: number;\n- country: any;\n+ selectedCountry: any;\ncities = [\n{ id: 1, name: 'Vilnius' },\n{ id: 2, name: 'Kaunas' },\n{ id: 3, name: 'Pabrade' }\n];\ncountries = [\n- { id: 1, description: { name: 'Lithuania' } },\n- { id: 2, description: { name: 'USA' } },\n- { id: 3, description: { name: 'Australia' } }\n+ { id: 1, description: { name: 'Lithuania', id: 'a' } },\n+ { id: 2, description: { name: 'USA', id: 'b' } },\n+ { id: 3, description: { name: 'Australia', id: 'c' } }\n];\n}\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -232,13 +232,12 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nthis.clearEvent.emit();\n}\n- // TODO: make private\nclearModel() {\nif (!this.clearable) {\nreturn;\n}\nthis.itemsList.clearSelected();\n- this._notifyModelChanged();\n+ this._updateNgModel();\n}\nwriteValue(value: any | any[]): void {\n@@ -309,7 +308,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nif (!item.selected) {\nthis.itemsList.select(item);\nthis._clearSearch();\n- this._updateModel();\n+ this._updateNgModel();\nthis.addEvent.emit(item.value);\n}\n@@ -320,7 +319,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nunselect(item: NgOption) {\nthis.itemsList.unselect(item);\n- this._updateModel();\n+ this._updateNgModel();\nthis.removeEvent.emit(item);\n}\n@@ -559,8 +558,22 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n}\n}\n- private _updateModel() {\n- this._notifyModelChanged();\n+ private _updateNgModel() {\n+ let ngModel = this._value;\n+ if (!this._isDefined(ngModel)) {\n+ this._onChange(null);\n+ } else if (this.bindValue) {\n+ if (Array.isArray(ngModel)) {\n+ ngModel = ngModel.map(option => this.itemsList.resolveNested(option, this.bindValue))\n+ } else {\n+ ngModel = this.itemsList.resolveNested(ngModel, this.bindValue);\n+ }\n+ this._onChange(ngModel);\n+ } else {\n+ this._onChange(ngModel);\n+ }\n+ this._ngModel = ngModel;\n+ this.changeEvent.emit(this._value);\nthis.changeDetectorRef.markForCheck();\n}\n@@ -646,28 +659,12 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nif (this.multiple) {\nthis.itemsList.unselectLast();\n- this._updateModel();\n+ this._updateNgModel();\n} else {\nthis.clearModel();\n}\n}\n- private _notifyModelChanged() {\n- let ngModel = this._value;\n- if (!this._isDefined(ngModel)) {\n- this._onChange(null);\n- } else if (this.bindValue) {\n- ngModel = Array.isArray(ngModel) ?\n- ngModel.map(option => option[this.bindValue]) :\n- ngModel[this.bindValue];\n- this._onChange(ngModel);\n- } else {\n- this._onChange(ngModel);\n- }\n- this._ngModel = ngModel;\n- this.changeEvent.emit(this._value);\n- }\n-\nprivate _getDropdownMenu() {\nif (!this.isOpen || !this.dropdownList) {\nreturn null;\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
feat: add support for nested value bindings (#229)
fixes #219
| 1
|
feat
| null |
815,746
|
02.02.2018 21:43:08
| -7,200
|
92b347dbdf926237102a73f48002a02b55adcedf
|
chore(release): 0.17.0
|
[
{
"change_type": "MODIFY",
"diff": "All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n+<a name=\"0.17.0\"></a>\n+# [0.17.0](https://github.com/ng-select/ng-select/compare/v0.16.0...v0.17.0) (2018-02-02)\n+\n+\n+### Bug Fixes\n+\n+* add touched on dropdown open ([#228](https://github.com/ng-select/ng-select/issues/228)) ([7c5748e](https://github.com/ng-select/ng-select/commit/7c5748e)), closes [#225](https://github.com/ng-select/ng-select/issues/225)\n+\n+\n+### Features\n+\n+* add support for nested value bindings ([#229](https://github.com/ng-select/ng-select/issues/229)) ([3551917](https://github.com/ng-select/ng-select/commit/3551917)), closes [#219](https://github.com/ng-select/ng-select/issues/219)\n+* Close dropdown on select by default ([#226](https://github.com/ng-select/ng-select/issues/226)) ([77d36ca](https://github.com/ng-select/ng-select/commit/77d36ca)), closes [#222](https://github.com/ng-select/ng-select/issues/222)\n+\n+\n+\n<a name=\"0.16.0\"></a>\n# [0.16.0](https://github.com/ng-select/ng-select/compare/v0.15.2...v0.16.0) (2018-01-29)\n",
"new_path": "CHANGELOG.md",
"old_path": "CHANGELOG.md"
},
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"@ng-select/ng-select\",\n- \"version\": \"0.16.0\",\n+ \"version\": \"0.17.0\",\n\"description\": \"Angular ng-select - All in One UI Select, Multiselect and Autocomplete\",\n\"author\": \"@ng-select/ng-select\",\n\"license\": \"MIT\",\n",
"new_path": "src/package.json",
"old_path": "src/package.json"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
chore(release): 0.17.0
| 1
|
chore
|
release
|
679,913
|
02.02.2018 22:45:25
| 0
|
7ae706eb57b7ffd55ca058f79af7c2f3b06078d5
|
feat(hiccup): skip fn exec for event attribs, update tests, readme
BREAKING CHANGE: event attribs w/ function values will be omitted, see readme for details/examples
|
[
{
"change_type": "MODIFY",
"diff": "@@ -117,6 +117,9 @@ If an attribute specifies a function as value, the function is called with the\nentire attribute object as argument. This allows for the dynamic generation of\nattribute values, based on existing ones. The result MUST be a string.\n+**BREAKING CHANGE since 1.0.0:** Function values for event attributes (any\n+attrib name starting with \"on\") WILL BE OMITTED from output.\n+\n```js\n[\"div#foo\", { bar: (attribs) => attribs.id + \"-bar\" }]\n```\n@@ -125,6 +128,22 @@ attribute values, based on existing ones. The result MUST be a string.\n<div id=\"foo\" bar=\"foo-bar\"></div>\n```\n+```js\n+[\"div#foo\", { onclick: () => alert(\"foo\") }, \"click me!\"]\n+```\n+\n+```html\n+<div id=\"foo\">click me!</div>\n+```\n+\n+```js\n+[\"div#foo\", { onclick: \"alert('foo')\" }, \"click me!\"]\n+```\n+\n+```html\n+<div id=\"foo\" onclick=\"alert('foo')\">click me!</div>\n+```\n+\n### Simple components\n```js\n",
"new_path": "packages/hiccup/README.md",
"old_path": "packages/hiccup/README.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -92,10 +92,11 @@ const _serialize = (tree: any, esc: boolean) => {\nres = `<${tag}`;\nfor (let a in attribs) {\nif (attribs.hasOwnProperty(a)) {\n- let v = attribs[a];\n+ let v = attribs[a],\n+ isEvent = /^on\\w+/.test(a);\nif (v != null) {\nif (isFunction(v)) {\n- if ((v = v(attribs)) == null) {\n+ if (isEvent || (v = v(attribs)) == null) {\ncontinue;\n}\n}\n",
"new_path": "packages/hiccup/src/serialize.ts",
"old_path": "packages/hiccup/src/serialize.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -12,6 +12,18 @@ function check(id, a, b) {\ndescribe(\"serialize\", () => {\n+ check(\n+ \"null\",\n+ null,\n+ \"\"\n+ );\n+\n+ check(\n+ \"empty tree\",\n+ [],\n+ \"\"\n+ );\n+\ncheck(\n\"simple div\",\n[\"div\", \"foo\"],\n@@ -100,6 +112,18 @@ describe(\"serialize\", () => {\n`<div></div>`\n);\n+ check(\n+ \"event attr fn\",\n+ [\"div\", { onclick: () => 1 }],\n+ `<div></div>`\n+ );\n+\n+ check(\n+ \"event attr (string)\",\n+ [\"div\", { onclick: \"1\" }],\n+ `<div onclick=\"1\"></div>`\n+ );\n+\ncheck(\n\"attr obj w/ toString()\",\n[\"div\", { foo: { toString: () => \"23\" } }],\n",
"new_path": "packages/hiccup/test/index.ts",
"old_path": "packages/hiccup/test/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(hiccup): skip fn exec for event attribs, update tests, readme
BREAKING CHANGE: event attribs w/ function values will be omitted, see readme for details/examples
| 1
|
feat
|
hiccup
|
679,913
|
02.02.2018 23:51:09
| 0
|
7cc5c93a9de5c8740340d2cf9054285ca950aac4
|
refactor(hiccup-dom): update event attrib naming convention, update readme
BREAKING CHANGE: event attributes now just use `on` prefix, previously `on-`
|
[
{
"change_type": "MODIFY",
"diff": "@@ -21,6 +21,7 @@ Benefits:\n- Only ~10KB minified\n```typescript\n+import { serialize } from \"@thi.ng/hiccup\";\nimport { start } from \"@thi.ng/hiccup-dom\";\n// stateless component w/ params\n@@ -29,7 +30,7 @@ const greeter = (name) => [\"h1.title\", \"hello \", name];\n// component w/ local state\nconst counter = () => {\nlet i = 0;\n- return () => [\"button\", { \"on-click\": () => (i++) }, `clicks: ${i}`];\n+ return () => [\"button\", { onclick: () => (i++) }, `clicks: ${i}`];\n};\nconst app = () => {\n@@ -39,8 +40,15 @@ const app = () => {\nreturn [\"div#app\", [greeter, \"world\"], ...counters];\n};\n+// browser only (see diagram below)\nstart(document.body, app());\n+\n+// browser or server side serialization\n+// (note: does not emit event attributes w/ functions as values)\n+serialize(app);\n+// <div id=\"app\"><h1 class=\"title\">hello world</h1><button>clicks: 0</button><button>clicks: 0</button></div>\n```\n+\n[Live demo](http://demo.thi.ng/umbrella/hiccup-dom/basics/) | [standalone example](../../examples/hdom-basics)\nNo template engine & no precompilation steps needed, just use the full\n",
"new_path": "packages/hiccup-dom/README.md",
"old_path": "packages/hiccup-dom/README.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -195,7 +195,7 @@ export function normalizeTree(el: any, path = [0], keys = true, span = true) {\nfunction hasChangedEvents(prev: any, curr: any) {\nfor (let k in curr) {\n- if (k.indexOf(\"on-\") === 0 && prev[k] !== curr[k]) {\n+ if (k.indexOf(\"on\") === 0 && prev[k] !== curr[k]) {\nreturn true;\n}\n}\n",
"new_path": "packages/hiccup-dom/src/diff.ts",
"old_path": "packages/hiccup-dom/src/diff.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -88,8 +88,8 @@ export function setAttrib(el: Element, k: string, v: any) {\nupdateValueAttrib(<HTMLInputElement>el, v);\nbreak;\ndefault:\n- if (k.indexOf(\"on-\") === 0) {\n- el.addEventListener(k.substr(3), v);\n+ if (k.indexOf(\"on\") === 0) {\n+ el.addEventListener(k.substr(2), v);\n} else {\nel.setAttribute(k, v);\n}\n",
"new_path": "packages/hiccup-dom/src/dom.ts",
"old_path": "packages/hiccup-dom/src/dom.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(hiccup-dom): update event attrib naming convention, update readme
BREAKING CHANGE: event attributes now just use `on` prefix, previously `on-`
| 1
|
refactor
|
hiccup-dom
|
679,913
|
02.02.2018 23:57:29
| 0
|
292677993c56f333b4b72316956edf73c709d118
|
refactor(examples): update event attribs
|
[
{
"change_type": "MODIFY",
"diff": "@@ -6,7 +6,7 @@ const greeter = (name) => [\"h1.title\", \"hello \", name];\n// component w/ local state\nconst counter = () => {\nlet i = 0;\n- return () => [\"button\", { \"on-click\": () => (i++) }, `clicks: ${i}`];\n+ return () => [\"button\", { onclick: () => (i++) }, `clicks: ${i}`];\n};\nconst app = () => {\n",
"new_path": "examples/hdom-basics/src/index.ts",
"old_path": "examples/hdom-basics/src/index.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -25,11 +25,11 @@ const box = (id: number) => [\n* @param change onchange listener\n* @param items drop down options `[value, label]`\n*/\n-const dropdown = (change: (e: Event) => void, items: [any, any][]) =>\n+const dropdown = (onchange: (e: Event) => void, items: [any, any][]) =>\ntx.transduce(\ntx.map(([value, label]) => <any>[\"option\", { value }, label]),\ntx.push(),\n- [\"select\", { \"on-change\": change }],\n+ [\"select\", { onchange }],\nitems\n);\n",
"new_path": "examples/hdom-benchmark/src/index.ts",
"old_path": "examples/hdom-benchmark/src/index.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -45,7 +45,7 @@ const taskItem = (id, task: Task) =>\n{\ntype: \"checkbox\",\nchecked: task.done,\n- \"on-click\": () => toggleTask(id),\n+ onclick: () => toggleTask(id),\n}],\n[{\ninit: (el) => !el.value && el.focus(),\n@@ -55,8 +55,8 @@ const taskItem = (id, task: Task) =>\ntype: \"text\",\nplaceholder: \"todo...\",\nvalue: task.body,\n- \"on-keydown\": (e) => e.key === \"Enter\" && e.target.blur(),\n- \"on-blur\": (e) => updateTask(id, (<HTMLInputElement>e.target).value)\n+ onkeydown: (e) => e.key === \"Enter\" && e.target.blur(),\n+ onblur: (e) => updateTask(id, (<HTMLInputElement>e.target).value)\n}]\n}]];\n@@ -71,9 +71,9 @@ const taskList = () => {\nconst toolbar = () =>\n[\"div#toolbar\",\n- [\"button\", { \"on-click\": () => addNewTask() }, \"+ Add\"],\n- [\"button\", { \"on-click\": () => tasks.undo(), disabled: !tasks.canUndo() }, \"Undo\"],\n- [\"button\", { \"on-click\": () => tasks.redo(), disabled: !tasks.canRedo() }, \"Redo\"]];\n+ [\"button\", { onclick: () => addNewTask() }, \"+ Add\"],\n+ [\"button\", { onclick: () => tasks.undo(), disabled: !tasks.canUndo() }, \"Undo\"],\n+ [\"button\", { onclick: () => tasks.redo(), disabled: !tasks.canRedo() }, \"Redo\"]];\n// static header component (simple array)\nconst header =\n",
"new_path": "examples/todo-list/src/index.ts",
"old_path": "examples/todo-list/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(examples): update event attribs
| 1
|
refactor
|
examples
|
679,913
|
02.02.2018 23:58:11
| 0
|
309c7d7c885e05a5003095c44d88044e2dce915a
|
build(examples): update example build commands
|
[
{
"change_type": "MODIFY",
"diff": "@@ -10,3 +10,5 @@ cd umbrella/examples/dashboard\nyarn install\nyarn dev\n```\n+\n+Once webpack has completed building, refresh your browser...\n",
"new_path": "examples/dashboard/README.md",
"old_path": "examples/dashboard/README.md"
},
{
"change_type": "MODIFY",
"diff": "\"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n\"license\": \"Apache-2.0\",\n\"scripts\": {\n- \"dev\": \"webpack -w\",\n- \"clean\": \"rm -rf bundle.*\"\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n},\n\"devDependencies\": {\n\"ts-loader\": \"^3.3.1\",\n",
"new_path": "examples/dashboard/package.json",
"old_path": "examples/dashboard/package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -9,4 +9,4 @@ yarn install\nyarn dev\n```\n-Then open `index.html` in your browser...\n\\ No newline at end of file\n+Once webpack has completed building, refresh your browser...\n\\ No newline at end of file\n",
"new_path": "examples/hdom-basics/README.md",
"old_path": "examples/hdom-basics/README.md"
},
{
"change_type": "MODIFY",
"diff": "\"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n\"license\": \"Apache-2.0\",\n\"scripts\": {\n- \"dev\": \"webpack -w\",\n- \"clean\": \"rm -rf bundle.*\"\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n},\n\"devDependencies\": {\n\"ts-loader\": \"^3.3.1\",\n",
"new_path": "examples/hdom-basics/package.json",
"old_path": "examples/hdom-basics/package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -8,3 +8,5 @@ cd umbrella/examples/hdom-benchmark\nyarn install\nyarn dev\n```\n+\n+Once webpack has completed building, refresh your browser...\n",
"new_path": "examples/hdom-benchmark/README.md",
"old_path": "examples/hdom-benchmark/README.md"
},
{
"change_type": "MODIFY",
"diff": "\"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n\"license\": \"Apache-2.0\",\n\"scripts\": {\n- \"dev\": \"webpack -w\",\n- \"clean\": \"rm -rf bundle.*\"\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n},\n\"devDependencies\": {\n\"ts-loader\": \"^3.3.1\",\n",
"new_path": "examples/hdom-benchmark/package.json",
"old_path": "examples/hdom-benchmark/package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -8,3 +8,5 @@ cd umbrella/examples/todo-list\nyarn install\nyarn dev\n```\n+\n+Once webpack has completed building, refresh your browser...\n",
"new_path": "examples/todo-list/README.md",
"old_path": "examples/todo-list/README.md"
},
{
"change_type": "MODIFY",
"diff": "\"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n\"license\": \"Apache-2.0\",\n\"scripts\": {\n- \"dev\": \"webpack -w\",\n- \"clean\": \"rm -rf bundle.*\"\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n},\n\"devDependencies\": {\n\"ts-loader\": \"^3.3.1\",\n",
"new_path": "examples/todo-list/package.json",
"old_path": "examples/todo-list/package.json"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
build(examples): update example build commands
| 1
|
build
|
examples
|
679,913
|
02.02.2018 23:58:53
| 0
|
8106d16f879c6843f50bb056904e3bae92ab7b54
|
build: update main package build commands, update make-example script, readme
|
[
{
"change_type": "MODIFY",
"diff": "@@ -53,6 +53,16 @@ cd umbrella\nyarn build\n```\n+### Building example projects\n+\n+```\n+# build all examples (from project root)\n+yarn examples\n+\n+# in example dir\n+yarn dev\n+```\n+\n### Testing\n(TODO not all packages have tests yet)\n@@ -65,19 +75,19 @@ lerna run test --scope @thi.ng/rstream\n### Coverage\n+The resulting reports will be saved under `/packages/*/coverage/lcov-report/`.\n+\n```\nyarn cover\n```\n-The resulting reports will be saved under `/packages/*/coverage/lcov-report/`.\n### Documentation\n+Autogenerated documentation (using\n+[TypeDoc](https://github.com/TypeStrong/typedoc)) will be saved under\n+`/packages/*/doc/` and is also available at [docs.thi.ng](http://docs.thi.ng).\n```\nyarn doc\n```\n-\n-The autogenerated documentation (using\n-[TypeDoc](https://github.com/TypeStrong/typedoc)) will be saved under\n-`/packages/*/doc/` and is also available at [docs.thi.ng](http://docs.thi.ng).\n\\ No newline at end of file\n",
"new_path": "README.md",
"old_path": "README.md"
},
{
"change_type": "MODIFY",
"diff": "\"cover\": \"lerna run cover\",\n\"depgraph\": \"scripts/depgraph && git add assets/deps.png && git commit -m 'docs: update dep graph' && git push\",\n\"doc\": \"lerna run doc\",\n+ \"examples\": \"ex=\\\"examples/*\\\"; for e in $ex; do (cd $e && yarn build); done\",\n\"pub\": \"lerna publish && yarn depgraph && yarn doc && scripts/upload-docs\",\n\"test\": \"yarn build && lerna run test\"\n}\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -20,8 +20,9 @@ cat << EOF > $MODULE/package.json\n\"author\": \"$AUTHOR <$EMAIL>\",\n\"license\": \"Apache-2.0\",\n\"scripts\": {\n- \"dev\": \"webpack -w\",\n- \"clean\": \"rm -rf bundle.*\"\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n},\n\"devDependencies\": {\n\"ts-loader\": \"^3.3.1\",\n@@ -102,4 +103,6 @@ cd umbrella/examples/$1\nyarn install\nyarn dev\n\\`\\`\\`\n+\n+Once webpack has completed building, refresh your browser...\nEOF\n",
"new_path": "scripts/make-example",
"old_path": "scripts/make-example"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
build: update main package build commands, update make-example script, readme
| 1
|
build
| null |
679,913
|
03.02.2018 07:49:46
| 0
|
aa48d3be188f6eada7ea37896d66cdc7807bc731
|
feat(examples): add svg particles demo
|
[
{
"change_type": "ADD",
"diff": "+# svg-particles\n+\n+[Live demo](http://demo.thi.ng/umbrella/hiccup-dom/svg-particles/)\n+\n+```\n+git clone https://github.com/thi-ng/umbrella.git\n+cd umbrella/examples/svg-particles\n+yarn install\n+yarn dev\n+```\n+\n+Once webpack has completed building, refresh your browser...\n",
"new_path": "examples/svg-particles/README.md",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"svg-particles\",\n+ \"version\": \"0.0.1\",\n+ \"repository\": \"https://github.com/thi-ng/umbrella\",\n+ \"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n+ \"license\": \"Apache-2.0\",\n+ \"scripts\": {\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n+ },\n+ \"devDependencies\": {\n+ \"ts-loader\": \"^3.3.1\",\n+ \"typescript\": \"^2.7.1\",\n+ \"webpack\": \"^3.10.0\"\n+ },\n+ \"dependencies\": {\n+ \"@thi.ng/api\": \"^2.0.0\",\n+ \"@thi.ng/hiccup-dom\": \"^0.1.1\",\n+ \"@thi.ng/rstream\": \"^0.9.1\",\n+ \"@thi.ng/transducers\": \"^1.0.6\"\n+ }\n+}\n",
"new_path": "examples/svg-particles/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { start } from \"@thi.ng/hiccup-dom\";\n+import { hex } from \"@thi.ng/transducers/func/hex\";\n+import { repeatedly } from \"@thi.ng/transducers/iter/repeatedly\";\n+\n+const width = window.innerWidth;\n+const height = window.innerHeight;\n+const hex6 = hex(6);\n+\n+const updateParticle = (p, v) => {\n+ let x = p.cx + v[0];\n+ let y = p.cy + v[1];\n+ (x < 0) && (x *= -1, v[0] *= -1);\n+ (y < 0) && (y *= -1, v[1] *= -1);\n+ (x > width) && (x = width - (x - width), v[0] *= -1);\n+ (y > height) && (y = height - (y - height), v[1] *= -1);\n+ p.cx = x | 0;\n+ p.cy = y | 0;\n+};\n+\n+const rand = (a, b) => (a + (b - a) * Math.random()) * (Math.random() < 0.5 ? 1 : -1);\n+\n+const randomParticle = () => {\n+ velocities.push([rand(1, 5), rand(1, 5)]);\n+ return [\"circle\",\n+ {\n+ cx: Math.random() * width,\n+ cy: Math.random() * height,\n+ r: (Math.random() * 6 + 3) | 0,\n+ fill: \"#\" + hex6((Math.random() * 0x1000000) | 0),\n+ }];\n+};\n+\n+const velocities = [null];\n+const particles: any[] = [\"g\", ...repeatedly(randomParticle, 100)];\n+\n+const app = () => {\n+ for (let i = particles.length - 1; i > 0; i--) {\n+ updateParticle(particles[i][1], velocities[i]);\n+ }\n+ return [\"svg\", { width, height }, particles];\n+};\n+\n+start(document.body, app);\n\\ No newline at end of file\n",
"new_path": "examples/svg-particles/src/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \".\"\n+ },\n+ \"include\": [\n+ \"./src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "examples/svg-particles/tsconfig.json",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(examples): add svg particles demo
| 1
|
feat
|
examples
|
679,913
|
03.02.2018 07:53:29
| 0
|
c09bb89d61bd3c9ce32fb2039cd0f089dfa5d966
|
docs(hiccup-dom): add svg example links
|
[
{
"change_type": "MODIFY",
"diff": "@@ -71,7 +71,7 @@ wrapper around React, whereas this library is standalone, more lowlevel &\nless opinionated.\nIf you're interested in using this, please also consider the\n-[@thi.ng/atom](https://github.com/thi-ng/umbrella/tree/master/packages/atom)\n+[@thi.ng/atom](https://github.com/thi-ng/umbrella/tree/master/packages/atom) and\n[@thi.ng/rstream](https://github.com/thi-ng/umbrella/tree/master/packages/rstream)\npackages to integrate app state handling, event streams & reactive value\nsubscriptions. More examples are forthcoming...\n@@ -100,6 +100,12 @@ A fully documented todo list app with undo / redo feature is here: [/examples/to\n[Live demo here](http://demo.thi.ng/umbrella/hiccup-dom/todo-list/)\n+### SVG particles\n+\n+[Source](https://github.com/thi-ng/umbrella/tree/master/examples/svg-particles)\n+\n+[Live demo](http://demo.thi.ng/umbrella/hiccup-dom/svg-particles/)\n+\n### Basic usage patterns\nThe code below is also available as standalone project in: [/examples/dashboard](https://github.com/thi-ng/umbrella/tree/master/examples/dashboard)\n",
"new_path": "packages/hiccup-dom/README.md",
"old_path": "packages/hiccup-dom/README.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
docs(hiccup-dom): add svg example links
| 1
|
docs
|
hiccup-dom
|
807,849
|
03.02.2018 15:47:40
| 28,800
|
2dffbb46e637ae0fc61a41ff48be406cc2581e4c
|
refactor(ConventionalCommits): cleanup API
just pass a type to encapsulated methods
stop passing fake callbacks
use pkg.manifestLocation
make tests more meaningful
|
[
{
"change_type": "MODIFY",
"diff": "@@ -19,78 +19,46 @@ const CHANGELOG_HEADER = dedent(`# Change Log\nconst RECOMMEND_CLI = require.resolve(\"conventional-recommended-bump/cli\");\nconst CHANGELOG_CLI = require.resolve(\"conventional-changelog-cli/cli\");\n-function recommendIndependentVersion(pkg, opts) {\n- // `-p` here is overridden because `conventional-recommended-bump`\n- // cannot accept custom preset.\n- const args = [RECOMMEND_CLI, \"-l\", pkg.name, \"--commit-path\", pkg.location, \"-p\", \"angular\"];\n- return exports.recommendVersion(pkg, opts, \"recommendIndependentVersion\", args);\n+function getChangelogLocation(pkg) {\n+ return path.join(pkg.location, CHANGELOG_NAME);\n}\n-function recommendFixedVersion(pkg, opts) {\n- // `-p` here is overridden because `conventional-recommended-bump`\n- // cannot accept custom preset.\n- const args = [RECOMMEND_CLI, \"--commit-path\", pkg.location, \"-p\", \"angular\"];\n- return exports.recommendVersion(pkg, opts, \"recommendFixedVersion\", args);\n+function getChangelogPreset(opts) {\n+ return opts && opts.changelogPreset ? opts.changelogPreset : \"angular\";\n}\n-function recommendVersion(pkg, opts, type, args) {\n+function recommendVersion(pkg, type, opts) {\nlog.silly(type, \"for %s at %s\", pkg.name, pkg.location);\n- const recommendedBump = ChildProcessUtilities.execSync(process.execPath, args, opts);\n-\n- log.verbose(type, \"increment %s by %s\", pkg.version, recommendedBump);\n- return semver.inc(pkg.version, recommendedBump);\n-}\n+ // `-p` here is overridden because `conventional-recommended-bump`\n+ // cannot accept custom preset.\n+ const args = [RECOMMEND_CLI, \"-p\", \"angular\", \"--commit-path\", pkg.location];\n-function updateIndependentChangelog(pkg, opts) {\n- const pkgJsonLocation = path.join(pkg.location, \"package.json\");\n- const args = [\n- CHANGELOG_CLI,\n- \"-l\",\n- pkg.name,\n- \"--commit-path\",\n- pkg.location,\n- \"--pkg\",\n- pkgJsonLocation,\n- \"-p\",\n- exports.changelogPreset(opts),\n- ];\n- exports.updateChangelog(pkg, opts, \"updateIndependentChangelog\", args);\n+ if (type === \"independent\") {\n+ args.push(\"-l\", pkg.name);\n}\n-function updateFixedChangelog(pkg, opts) {\n- const pkgJsonLocation = path.join(pkg.location, \"package.json\");\n- const args = [\n- CHANGELOG_CLI,\n- \"--commit-path\",\n- pkg.location,\n- \"--pkg\",\n- pkgJsonLocation,\n- \"-p\",\n- exports.changelogPreset(opts),\n- ];\n- exports.updateChangelog(pkg, opts, \"updateFixedChangelog\", args);\n-}\n+ const recommendedBump = ChildProcessUtilities.execSync(process.execPath, args, opts);\n-function updateFixedRootChangelog(pkg, opts) {\n- const args = [\n- CHANGELOG_CLI,\n- \"-p\",\n- exports.changelogPreset(opts),\n- \"--context\",\n- path.resolve(__dirname, \"ConventionalChangelogContext.js\"),\n- ];\n- exports.updateChangelog(pkg, opts, \"updateFixedRootChangelog\", args);\n+ log.verbose(type, \"increment %s by %s\", pkg.version, recommendedBump);\n+ return semver.inc(pkg.version, recommendedBump);\n}\n-function updateChangelog(pkg, opts, type, args) {\n+function updateChangelog(pkg, type, opts) {\nlog.silly(type, \"for %s at %s\", pkg.name, pkg.location);\n- const changelogFileLoc = exports.changelogLocation(pkg);\n+ const changelogFileLoc = getChangelogLocation(pkg);\n+ const args = [CHANGELOG_CLI, \"-p\", getChangelogPreset(opts)];\n- let changelogContents = \"\";\n- if (FileSystemUtilities.existsSync(changelogFileLoc)) {\n- changelogContents = FileSystemUtilities.readFileSync(changelogFileLoc);\n+ if (type === \"root\") {\n+ args.push(\"--context\", path.resolve(__dirname, \"ConventionalChangelogContext.js\"));\n+ } else {\n+ // \"fixed\" & \"independent\" both need --commit-path and --pkg\n+ args.push(\"--commit-path\", pkg.location, \"--pkg\", pkg.manifestLocation);\n+\n+ if (type === \"independent\") {\n+ args.push(\"-l\", pkg.name);\n+ }\n}\n// run conventional-changelog-cli to generate the markdown for the upcoming release.\n@@ -110,6 +78,11 @@ function updateChangelog(pkg, opts, type, args) {\nlog.silly(type, \"writing new entry: %j\", newEntry);\n+ let changelogContents = \"\";\n+ if (FileSystemUtilities.existsSync(changelogFileLoc)) {\n+ changelogContents = FileSystemUtilities.readFileSync(changelogFileLoc);\n+ }\n+\n// CHANGELOG entries start with <a name=, we remove\n// the header if it exists by starting at the first entry.\nif (changelogContents.indexOf(\"<a name=\") !== -1) {\n@@ -129,22 +102,8 @@ function updateChangelog(pkg, opts, type, args) {\n);\nlog.verbose(type, \"wrote\", changelogFileLoc);\n+ return changelogFileLoc;\n}\n-function changelogLocation(pkg) {\n- return path.join(pkg.location, CHANGELOG_NAME);\n-}\n-\n-function changelogPreset(opts) {\n- return opts && opts.changelogPreset ? opts.changelogPreset : \"angular\";\n-}\n-\n-exports.recommendIndependentVersion = recommendIndependentVersion;\n-exports.recommendFixedVersion = recommendFixedVersion;\nexports.recommendVersion = recommendVersion;\n-exports.updateIndependentChangelog = updateIndependentChangelog;\n-exports.updateFixedChangelog = updateFixedChangelog;\n-exports.updateFixedRootChangelog = updateFixedRootChangelog;\nexports.updateChangelog = updateChangelog;\n-exports.changelogLocation = changelogLocation;\n-exports.changelogPreset = changelogPreset;\n",
"new_path": "src/ConventionalCommitUtilities.js",
"old_path": "src/ConventionalCommitUtilities.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -364,15 +364,7 @@ class PublishCommand extends Command {\nif (conventionalCommits) {\nif (independentVersions) {\n// Independent Conventional-Commits Mode\n- const versions = {};\n-\n- this.recommendVersions(\n- this.updates,\n- ConventionalCommitUtilities.recommendIndependentVersion,\n- versionBump => {\n- versions[versionBump.pkg.name] = versionBump.recommendedVersion;\n- }\n- );\n+ const versions = this.recommendVersions(\"independent\");\nreturn callback(null, { versions });\n}\n@@ -392,10 +384,11 @@ class PublishCommand extends Command {\n});\nlet version = \"0.0.0\";\n+ const bumps = this.recommendVersions(\"fixed\");\n- this.recommendVersions(this.updates, ConventionalCommitUtilities.recommendFixedVersion, versionBump => {\n- if (semver.gt(versionBump.recommendedVersion, version)) {\n- version = versionBump.recommendedVersion;\n+ Object.keys(bumps).forEach(name => {\n+ if (semver.gt(bumps[name], version)) {\n+ version = bumps[name];\n}\n});\n@@ -434,17 +427,14 @@ class PublishCommand extends Command {\n}\n}\n- recommendVersions(updates, recommendVersionFn, callback) {\n- updates.forEach(update => {\n- const pkg = {\n- name: update.package.name,\n- version: update.package.version,\n- location: update.package.location,\n- };\n+ recommendVersions(type) {\n+ return this.updates.reduce((obj, update) => {\n+ const pkg = update.package;\n+ const version = ConventionalCommitUtilities.recommendVersion(pkg, type, this.changelogOpts);\n- const recommendedVersion = recommendVersionFn(pkg, this.changelogOpts);\n- callback({ pkg, recommendedVersion });\n- });\n+ obj[pkg.name] = version;\n+ return obj;\n+ }, {});\n}\ngetCanaryVersion(version, _preid) {\n@@ -608,13 +598,10 @@ class PublishCommand extends Command {\n// we can now generate the Changelog, based on the\n// the updated version that we're about to release.\nif (conventionalCommits) {\n- if (independentVersions) {\n- ConventionalCommitUtilities.updateIndependentChangelog(pkg, this.changelogOpts);\n- } else {\n- ConventionalCommitUtilities.updateFixedChangelog(pkg, this.changelogOpts);\n- }\n+ const type = independentVersions ? \"independent\" : \"fixed\";\n+ const changelogLocation = ConventionalCommitUtilities.updateChangelog(pkg, type, this.changelogOpts);\n- changedFiles.push(ConventionalCommitUtilities.changelogLocation(pkg));\n+ changedFiles.push(changelogLocation);\n}\n// push to be git committed\n@@ -623,20 +610,16 @@ class PublishCommand extends Command {\nif (conventionalCommits && !independentVersions) {\nconst rootPkg = this.repository.packageJson;\n-\n- ConventionalCommitUtilities.updateFixedRootChangelog(\n+ const changelogLocation = ConventionalCommitUtilities.updateChangelog(\n{\nname: rootPkg && rootPkg.name ? rootPkg.name : \"root\",\nlocation: this.repository.rootPath,\n},\n+ \"root\",\nthis.changelogOpts\n);\n- changedFiles.push(\n- ConventionalCommitUtilities.changelogLocation({\n- location: this.repository.rootPath,\n- })\n- );\n+ changedFiles.push(changelogLocation);\n}\n// exec version lifecycle in root (after all updates)\n",
"new_path": "src/commands/PublishCommand.js",
"old_path": "src/commands/PublishCommand.js"
},
{
"change_type": "MODIFY",
"diff": "const dedent = require(\"dedent\");\nconst path = require(\"path\");\n+const Package = require(\"../src/Package\");\n// mocked modules\nconst ChildProcessUtilities = require(\"../src/ChildProcessUtilities\");\n@@ -17,74 +18,68 @@ describe(\"ConventionalCommitUtilities\", () => {\nafterEach(() => jest.resetAllMocks());\ndescribe(\".recommendVersion()\", () => {\n- it(\"should invoke conventional-changelog-recommended bump to fetch next version\", () => {\n- ChildProcessUtilities.execSync = jest.fn(() => \"major\");\n+ it(\"invokes conventional-changelog-recommended bump to fetch next version\", () => {\n+ ChildProcessUtilities.execSync.mockReturnValueOnce(\"major\");\n- const opts = { cwd: \"test\" };\n+ const bumpedVersion = ConventionalCommitUtilities.recommendVersion(\n+ new Package({ name: \"bar\", version: \"1.0.0\" }, \"/foo/bar\"),\n+ \"fixed\",\n+ { cwd: \"test-fixed-bump\" }\n+ );\n+\n+ expect(bumpedVersion).toBe(\"2.0.0\");\n+ expect(ChildProcessUtilities.execSync).lastCalledWith(\n+ process.execPath,\n+ [require.resolve(\"conventional-recommended-bump/cli\"), \"-p\", \"angular\", \"--commit-path\", \"/foo/bar\"],\n+ { cwd: \"test-fixed-bump\" }\n+ );\n+ });\n+\n+ it(\"passes package-specific arguments in independent mode\", () => {\n+ ChildProcessUtilities.execSync.mockReturnValueOnce(\"minor\");\n- const args = [\n+ const bumpedVersion = ConventionalCommitUtilities.recommendVersion(\n+ new Package({ name: \"bar\", version: \"1.0.0\" }, \"/foo/bar\"),\n+ \"independent\",\n+ { cwd: \"test-independent-bump\" }\n+ );\n+\n+ expect(bumpedVersion).toBe(\"1.1.0\");\n+ expect(ChildProcessUtilities.execSync).lastCalledWith(\n+ process.execPath,\n+ [\nrequire.resolve(\"conventional-recommended-bump/cli\"),\n- \"-l\",\n- \"bar\",\n- \"--commit-path\",\n- \"/foo/bar\",\n\"-p\",\n\"angular\",\n- ];\n-\n- const recommendVersion = ConventionalCommitUtilities.recommendVersion(\n- {\n- name: \"bar\",\n- version: \"1.0.0\",\n- location: \"/foo/bar\",\n- },\n- opts,\n- \"\",\n- args\n+ \"--commit-path\",\n+ \"/foo/bar\",\n+ \"-l\",\n+ \"bar\",\n+ ],\n+ { cwd: \"test-independent-bump\" }\n);\n-\n- expect(recommendVersion).toBe(\"2.0.0\");\n- expect(ChildProcessUtilities.execSync).lastCalledWith(process.execPath, args, opts);\n});\n});\ndescribe(\".updateChangelog()\", () => {\n- it(\"should populate initial CHANGELOG.md if it does not exist\", () => {\n- FileSystemUtilities.existsSync = jest.fn(() => false);\n- ChildProcessUtilities.execSync = jest.fn(\n- () => dedent`<a name=\"1.0.0\"></a>\n+ beforeEach(() => {\n+ ChildProcessUtilities.execSync.mockReturnValue(\n+ dedent`<a name=\"1.0.0\"></a>\n### Features\n* feat: I should be placed in the CHANGELOG`\n);\n+ });\n- const opts = { cwd: \"test\" };\n-\n- const args = [\n- require.resolve(\"conventional-changelog-cli/cli\"),\n- \"-l\",\n- \"bar\",\n- \"--commit-path\",\n- \"/foo/bar\",\n- \"--pkg\",\n- path.normalize(\"/foo/bar/package.json\"),\n- \"-p\",\n- \"angular\",\n- ];\n-\n+ it(\"populates initial CHANGELOG.md if it does not exist\", () => {\n+ expect(\nConventionalCommitUtilities.updateChangelog(\n- {\n- name: \"bar\",\n- location: \"/foo/bar\",\n- },\n- opts,\n- \"\",\n- args\n- );\n+ new Package({ name: \"bar\", version: \"1.0.0\" }, \"/foo/bar\")\n+ )\n+ ).toBe(path.normalize(\"/foo/bar/CHANGELOG.md\"));\nexpect(FileSystemUtilities.existsSync).lastCalledWith(path.normalize(\"/foo/bar/CHANGELOG.md\"));\n- expect(ChildProcessUtilities.execSync).lastCalledWith(process.execPath, args, opts);\nexpect(FileSystemUtilities.writeFileSync).lastCalledWith(\npath.normalize(\"/foo/bar/CHANGELOG.md\"),\ndedent`\n@@ -101,10 +96,10 @@ describe(\"ConventionalCommitUtilities\", () => {\n);\n});\n- it(\"should insert into existing CHANGELOG.md\", () => {\n- FileSystemUtilities.existsSync = jest.fn(() => true);\n- ChildProcessUtilities.execSync = jest.fn(\n- () => dedent`<a name='change2' /></a>\n+ it(\"appends to existing CHANGELOG.md\", () => {\n+ FileSystemUtilities.existsSync.mockReturnValueOnce(true);\n+ ChildProcessUtilities.execSync.mockReturnValueOnce(\n+ dedent`<a name='change2' /></a>\n## 1.0.1 (2017-08-11)(/compare/v1.0.1...v1.0.0) (2017-08-09)\n@@ -113,8 +108,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n* fix: a second commit for our CHANGELOG`\n);\n- FileSystemUtilities.readFileSync = jest.fn(\n- () => dedent`\n+ FileSystemUtilities.readFileSync.mockReturnValueOnce(\n+ dedent`\n# Change Log\nAll notable changes to this project will be documented in this file.\n@@ -128,10 +123,7 @@ describe(\"ConventionalCommitUtilities\", () => {\n`\n);\n- ConventionalCommitUtilities.updateChangelog({\n- name: \"bar\",\n- location: \"/foo/bar/\",\n- });\n+ ConventionalCommitUtilities.updateChangelog(new Package({ name: \"bar\", version: \"1.0.0\" }, \"/foo/bar\"));\nexpect(FileSystemUtilities.writeFileSync).lastCalledWith(\npath.normalize(\"/foo/bar/CHANGELOG.md\"),\n@@ -158,14 +150,14 @@ describe(\"ConventionalCommitUtilities\", () => {\n);\n});\n- it(\"should insert version bump message if no commits have been recorded\", () => {\n- FileSystemUtilities.existsSync = jest.fn(() => true);\n- ChildProcessUtilities.execSync = jest.fn(\n- () => dedent`<a name=\"1.0.1\"></a>\n+ it(\"appends version bump message if no commits have been recorded\", () => {\n+ FileSystemUtilities.existsSync.mockReturnValueOnce(true);\n+ ChildProcessUtilities.execSync.mockReturnValueOnce(\n+ dedent`<a name=\"1.0.1\"></a>\n## 1.0.1 (2017-08-11)(/compare/v1.0.1...v1.0.0) (2017-08-09)`\n);\n- FileSystemUtilities.readFileSync = jest.fn(\n- () => dedent`\n+ FileSystemUtilities.readFileSync.mockReturnValueOnce(\n+ dedent`\n# Change Log\nAll notable changes to this project will be documented in this file.\n@@ -179,10 +171,7 @@ describe(\"ConventionalCommitUtilities\", () => {\n`\n);\n- ConventionalCommitUtilities.updateChangelog({\n- name: \"bar\",\n- location: \"/foo/bar/\",\n- });\n+ ConventionalCommitUtilities.updateChangelog(new Package({ name: \"bar\", version: \"1.0.0\" }, \"/foo/bar\"));\nexpect(FileSystemUtilities.writeFileSync).lastCalledWith(\npath.normalize(\"/foo/bar/CHANGELOG.md\"),\n@@ -206,93 +195,68 @@ describe(\"ConventionalCommitUtilities\", () => {\n);\n});\n- it(\"should pass package-specific arguments in independent mode\", () => {\n- ConventionalCommitUtilities.updateChangelog = jest.fn();\n+ it(\"passes package-specific arguments in independent mode\", () => {\n+ const pkg = new Package({ name: \"bar\", version: \"1.0.0\" }, \"/foo/bar\");\n- ConventionalCommitUtilities.updateIndependentChangelog(\n- {\n- name: \"bar\",\n- location: \"/foo/bar\",\n- },\n- null\n- );\n+ ConventionalCommitUtilities.updateChangelog(pkg, \"independent\", { cwd: \"test-independent\" });\n- expect(ConventionalCommitUtilities.updateChangelog).toBeCalledWith(\n- {\n- name: \"bar\",\n- location: \"/foo/bar\",\n- },\n- null,\n- \"updateIndependentChangelog\",\n+ expect(ChildProcessUtilities.execSync).lastCalledWith(\n+ process.execPath,\n[\nrequire.resolve(\"conventional-changelog-cli/cli\"),\n- \"-l\",\n- \"bar\",\n- \"--commit-path\",\n- \"/foo/bar\",\n- \"--pkg\",\n- path.normalize(\"/foo/bar/package.json\"),\n\"-p\",\n\"angular\",\n- ]\n+ \"--commit-path\",\n+ pkg.location,\n+ \"--pkg\",\n+ pkg.manifestLocation,\n+ \"-l\",\n+ pkg.name,\n+ ],\n+ { cwd: \"test-independent\" }\n);\n});\n- it(\"should pass package-specific arguments in fixed mode\", () => {\n- ConventionalCommitUtilities.updateChangelog = jest.fn();\n+ it(\"passes package-specific arguments in fixed mode\", () => {\n+ const pkg = new Package({ name: \"bar\", version: \"1.0.0\" }, \"/foo/bar\");\n- ConventionalCommitUtilities.updateFixedChangelog(\n- {\n- name: \"bar\",\n- location: \"/foo/bar\",\n- },\n- null\n- );\n+ ConventionalCommitUtilities.updateChangelog(pkg, \"fixed\", { cwd: \"test-fixed\" });\n- expect(ConventionalCommitUtilities.updateChangelog).toBeCalledWith(\n- {\n- name: \"bar\",\n- location: \"/foo/bar\",\n- },\n- null,\n- \"updateFixedChangelog\",\n+ expect(ChildProcessUtilities.execSync).lastCalledWith(\n+ process.execPath,\n[\nrequire.resolve(\"conventional-changelog-cli/cli\"),\n- \"--commit-path\",\n- \"/foo/bar\",\n- \"--pkg\",\n- path.normalize(\"/foo/bar/package.json\"),\n\"-p\",\n\"angular\",\n- ]\n+ \"--commit-path\",\n+ pkg.location,\n+ \"--pkg\",\n+ pkg.manifestLocation,\n+ ],\n+ { cwd: \"test-fixed\" }\n);\n});\n- it(\"should pass custom context in fixed root mode\", () => {\n- ConventionalCommitUtilities.updateChangelog = jest.fn();\n-\n- ConventionalCommitUtilities.updateFixedRootChangelog(\n+ it(\"passes custom context in fixed root mode\", () => {\n+ ConventionalCommitUtilities.updateChangelog(\n{\nname: \"bar\",\nlocation: \"/foo/bar\",\n},\n- null\n+ \"root\",\n+ { cwd: \"test-fixed-root\" }\n);\n- expect(ConventionalCommitUtilities.updateChangelog).toBeCalledWith(\n- {\n- name: \"bar\",\n- location: \"/foo/bar\",\n- },\n- null,\n- \"updateFixedRootChangelog\",\n+ expect(ChildProcessUtilities.execSync).lastCalledWith(\n+ process.execPath,\n[\nrequire.resolve(\"conventional-changelog-cli/cli\"),\n\"-p\",\n\"angular\",\n\"--context\",\npath.resolve(__dirname, \"..\", \"src\", \"ConventionalChangelogContext.js\"),\n- ]\n+ ],\n+ { cwd: \"test-fixed-root\" }\n);\n});\n});\n",
"new_path": "test/ConventionalCommitUtilities.js",
"old_path": "test/ConventionalCommitUtilities.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -30,6 +30,7 @@ jest.mock(\"write-pkg\");\njest.mock(\"../src/GitUtilities\");\njest.mock(\"../src/NpmUtilities\");\njest.mock(\"../src/PromptUtilities\");\n+jest.mock(\"../src/ConventionalCommitUtilities\");\njest.mock(\"../src/utils/output\");\n// silence logs\n@@ -691,19 +692,17 @@ describe(\"PublishCommand\", () => {\n* ======================================================================= */\ndescribe(\"--conventional-commits\", () => {\n- describe(\"independent mode\", () => {\n- const recommendIndependentVersionOriginal = ConventionalCommitUtilities.recommendIndependentVersion;\n- const updateIndependentChangelogOriginal = ConventionalCommitUtilities.updateIndependentChangelog;\n-\n- beforeEach(async () => {\n- const reccomendReplies = [\"1.0.1\", \"1.1.0\", \"2.0.0\", \"1.1.0\", \"5.1.1\"];\n- ConventionalCommitUtilities.recommendIndependentVersion = jest.fn(() => reccomendReplies.shift());\n- ConventionalCommitUtilities.updateIndependentChangelog = jest.fn();\n+ beforeEach(() => {\n+ ConventionalCommitUtilities.updateChangelog.mockImplementation(pkg =>\n+ path.join(pkg.location, \"CHANGELOG.md\")\n+ );\n});\n- afterEach(() => {\n- ConventionalCommitUtilities.recommendIndependentVersion = recommendIndependentVersionOriginal;\n- ConventionalCommitUtilities.updateIndependentChangelog = updateIndependentChangelogOriginal;\n+ describe(\"independent mode\", () => {\n+ const versionBumps = [\"1.0.1\", \"2.1.0\", \"4.0.0\", \"4.1.0\", \"5.0.1\"];\n+\n+ beforeEach(() => {\n+ versionBumps.forEach(bump => ConventionalCommitUtilities.recommendVersion.mockReturnValueOnce(bump));\n});\nit(\"should use conventional-commits utility to guess version bump and generate CHANGELOG\", async () => {\n@@ -714,21 +713,15 @@ describe(\"PublishCommand\", () => {\nexpect(gitAddedFiles(testDir)).toMatchSnapshot(\"git added files\");\nexpect(gitCommitMessage()).toMatchSnapshot(\"git commit message\");\n- [\n- [\"package-1\", \"1.0.0\"],\n- [\"package-2\", \"2.0.0\"],\n- [\"package-3\", \"3.0.0\"],\n- [\"package-4\", \"4.0.0\"],\n- [\"package-5\", \"5.0.0\"],\n- ].forEach(([name, version]) => {\n- const location = path.join(testDir, \"packages\", name);\n-\n- expect(ConventionalCommitUtilities.recommendIndependentVersion).toBeCalledWith(\n- expect.objectContaining({ name, version }),\n+ [\"package-1\", \"package-2\", \"package-3\", \"package-4\", \"package-5\"].forEach((name, idx) => {\n+ expect(ConventionalCommitUtilities.recommendVersion).toBeCalledWith(\n+ expect.objectContaining({ name }),\n+ \"independent\",\nexecOpts(testDir)\n);\n- expect(ConventionalCommitUtilities.updateIndependentChangelog).toBeCalledWith(\n- expect.objectContaining({ name, location }),\n+ expect(ConventionalCommitUtilities.updateChangelog).toBeCalledWith(\n+ expect.objectContaining({ name, version: versionBumps[idx] }),\n+ \"independent\",\nexecOpts(testDir)\n);\n});\n@@ -736,23 +729,20 @@ describe(\"PublishCommand\", () => {\nit(\"accepts --changelog-preset option\", async () => {\nconst testDir = await initFixture(\"PublishCommand/independent\");\n- const name = \"package-3\";\n- const version = \"3.0.0\";\n- const location = path.join(testDir, \"packages\", name);\nawait run(testDir)(\"--conventional-commits\", \"--changelog-preset\", \"foo-bar\");\n- expect(ConventionalCommitUtilities.recommendIndependentVersion).toBeCalledWith(\n- expect.objectContaining({ name, version }),\n+ expect(ConventionalCommitUtilities.recommendVersion).toBeCalledWith(\n+ expect.any(Object),\n+ \"independent\",\nexpect.objectContaining({\n- cwd: testDir,\nchangelogPreset: \"foo-bar\",\n})\n);\n- expect(ConventionalCommitUtilities.updateIndependentChangelog).toBeCalledWith(\n- expect.objectContaining({ name, location }),\n+ expect(ConventionalCommitUtilities.updateChangelog).toBeCalledWith(\n+ expect.any(Object),\n+ \"independent\",\nexpect.objectContaining({\n- cwd: testDir,\nchangelogPreset: \"foo-bar\",\n})\n);\n@@ -760,21 +750,13 @@ describe(\"PublishCommand\", () => {\n});\ndescribe(\"fixed mode\", () => {\n- const recommendFixedVersionOriginal = ConventionalCommitUtilities.recommendFixedVersion;\n- const updateFixedRootChangelogOriginal = ConventionalCommitUtilities.updateFixedRootChangelog;\n- const updateFixedChangelogOriginal = ConventionalCommitUtilities.updateFixedChangelog;\n-\n- beforeEach(async () => {\n- const reccomendReplies = [\"1.0.1\", \"1.1.0\", \"2.0.0\", \"1.1.0\", \"5.1.1\"];\n- ConventionalCommitUtilities.recommendFixedVersion = jest.fn(() => reccomendReplies.shift());\n- ConventionalCommitUtilities.updateFixedRootChangelog = jest.fn();\n- ConventionalCommitUtilities.updateFixedChangelog = jest.fn();\n- });\n-\n- afterEach(() => {\n- ConventionalCommitUtilities.recommendFixedVersion = recommendFixedVersionOriginal;\n- ConventionalCommitUtilities.updateFixedRootChangelog = updateFixedRootChangelogOriginal;\n- ConventionalCommitUtilities.updateFixedChangelog = updateFixedChangelogOriginal;\n+ beforeEach(() => {\n+ ConventionalCommitUtilities.recommendVersion\n+ .mockReturnValueOnce(\"1.0.1\")\n+ .mockReturnValueOnce(\"1.1.0\")\n+ .mockReturnValueOnce(\"2.0.0\")\n+ .mockReturnValueOnce(\"1.1.0\")\n+ .mockReturnValueOnce(\"1.0.0\");\n});\nit(\"should use conventional-commits utility to guess version bump and generate CHANGELOG\", async () => {\n@@ -785,54 +767,48 @@ describe(\"PublishCommand\", () => {\nexpect(gitAddedFiles(testDir)).toMatchSnapshot(\"git added files\");\nexpect(gitCommitMessage()).toMatchSnapshot(\"git commit message\");\n- [\n- [\"package-1\", \"1.0.0\"],\n- [\"package-2\", \"1.0.0\"],\n- [\"package-3\", \"1.0.0\"],\n- [\"package-4\", \"1.0.0\"],\n- [\"package-5\", \"1.0.0\"],\n- ].forEach(([name, version]) => {\n+ [\"package-1\", \"package-2\", \"package-3\", \"package-4\", \"package-5\"].forEach(name => {\nconst location = path.join(testDir, \"packages\", name);\n- expect(ConventionalCommitUtilities.recommendFixedVersion).toBeCalledWith(\n- expect.objectContaining({ name, version, location }),\n+ expect(ConventionalCommitUtilities.recommendVersion).toBeCalledWith(\n+ expect.objectContaining({ name, location }),\n+ \"fixed\",\nexecOpts(testDir)\n);\n- expect(ConventionalCommitUtilities.updateFixedChangelog).toBeCalledWith(\n- expect.objectContaining({ name, location }),\n+ expect(ConventionalCommitUtilities.updateChangelog).toBeCalledWith(\n+ expect.objectContaining({ name, version: \"2.0.0\" }),\n+ \"fixed\",\nexecOpts(testDir)\n);\n});\n- expect(ConventionalCommitUtilities.updateFixedRootChangelog).toBeCalledWith(\n+ expect(ConventionalCommitUtilities.updateChangelog).lastCalledWith(\nexpect.objectContaining({\nname: \"normal\",\nlocation: path.join(testDir),\n}),\n+ \"root\",\nexecOpts(testDir)\n);\n});\nit(\"accepts --changelog-preset option\", async () => {\nconst testDir = await initFixture(\"PublishCommand/normal\");\n- const name = \"package-5\";\n- const version = \"1.0.0\";\n- const location = path.join(testDir, \"packages\", name);\nawait run(testDir)(\"--conventional-commits\", \"--changelog-preset\", \"baz-qux\");\n- expect(ConventionalCommitUtilities.recommendFixedVersion).toBeCalledWith(\n- expect.objectContaining({ name, version, location }),\n+ expect(ConventionalCommitUtilities.recommendVersion).toBeCalledWith(\n+ expect.any(Object),\n+ \"fixed\",\nexpect.objectContaining({\n- cwd: testDir,\nchangelogPreset: \"baz-qux\",\n})\n);\n- expect(ConventionalCommitUtilities.updateFixedChangelog).toBeCalledWith(\n- expect.objectContaining({ name, location }),\n+ expect(ConventionalCommitUtilities.updateChangelog).toBeCalledWith(\n+ expect.any(Object),\n+ \"fixed\",\nexpect.objectContaining({\n- cwd: testDir,\nchangelogPreset: \"baz-qux\",\n})\n);\n",
"new_path": "test/PublishCommand.js",
"old_path": "test/PublishCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -27,7 +27,7 @@ Array [\n]\n`;\n-exports[`PublishCommand --conventional-commits fixed mode should use conventional-commits utility to guess version bump and generate CHANGELOG: git commit message 1`] = `\"v5.1.1\"`;\n+exports[`PublishCommand --conventional-commits fixed mode should use conventional-commits utility to guess version bump and generate CHANGELOG: git commit message 1`] = `\"v2.0.0\"`;\nexports[`PublishCommand --conventional-commits independent mode should use conventional-commits utility to guess version bump and generate CHANGELOG: git added files 1`] = `\nArray [\n@@ -48,10 +48,10 @@ exports[`PublishCommand --conventional-commits independent mode should use conve\n\"Publish\n- package-1@1.0.1\n- - package-2@1.1.0\n- - package-3@2.0.0\n- - package-4@1.1.0\n- - package-5@5.1.1\"\n+ - package-2@2.1.0\n+ - package-3@4.0.0\n+ - package-4@4.1.0\n+ - package-5@5.0.1\"\n`;\nexports[`PublishCommand indepdendent mode with --cd-version should bump to prerelease versions with --cd-version prerelease (no --preid): updated packages 1`] = `\n",
"new_path": "test/__snapshots__/PublishCommand.js.snap",
"old_path": "test/__snapshots__/PublishCommand.js.snap"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor(ConventionalCommits): cleanup API
- just pass a type to encapsulated methods
- stop passing fake callbacks
- use pkg.manifestLocation
- make tests more meaningful
| 1
|
refactor
|
ConventionalCommits
|
679,913
|
03.02.2018 16:47:59
| 0
|
2e4e51c50eca197cb2de0787f1f01625e81c19fa
|
feat(examples): add json component demo
|
[
{
"change_type": "ADD",
"diff": "+# json-components\n+\n+[Live demo](http://demo.thi.ng/umbrella/json-components/)\n+\n+```\n+git clone https://github.com/thi-ng/umbrella.git\n+cd umbrella/examples/json-components\n+yarn install\n+yarn dev\n+```\n+\n+Once webpack has completed building, refresh your browser...\n",
"new_path": "examples/json-components/README.md",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"json-components\",\n+ \"version\": \"0.0.1\",\n+ \"repository\": \"https://github.com/thi-ng/umbrella\",\n+ \"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n+ \"license\": \"Apache-2.0\",\n+ \"scripts\": {\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n+ },\n+ \"devDependencies\": {\n+ \"ts-loader\": \"^3.3.1\",\n+ \"typescript\": \"^2.7.1\",\n+ \"webpack\": \"^3.10.0\"\n+ },\n+ \"dependencies\": {\n+ \"@thi.ng/api\": \"^2.0.1\",\n+ \"@thi.ng/hiccup-dom\": \"^1.0.0\",\n+ \"@thi.ng/rstream\": \"^0.9.2\",\n+ \"@thi.ng/transducers\": \"^1.0.7\"\n+ }\n+}\n\\ No newline at end of file\n",
"new_path": "examples/json-components/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { isFunction } from \"@thi.ng/checks/is-function\";\n+import { start } from \"@thi.ng/hiccup-dom\";\n+\n+// some dummy JSON records\n+export const db = [\n+ {\n+ meta: {\n+ author: {\n+ name: \"Alice Bobbera\",\n+ email: \"a@b.it\"\n+ },\n+ created: \"2018-02-03T12:13:14Z\",\n+ tags: [\"drama\", \"queen\"]\n+ },\n+ title: \"'I love my books, all three of them'\",\n+ content: \"Sed doloribus molestias voluptatem ut delectus vitae quo eum. Ut praesentium sed omnis sequi rerum praesentium aperiam modi. Occaecati voluptatum quis vel facere quis quisquam.\"\n+ },\n+ {\n+ meta: {\n+ author: {\n+ name: \"Charlie Doran\",\n+ email: \"c@d.es\"\n+ },\n+ created: \"2018-02-02T01:23:45Z\",\n+ tags: [\"simplicity\", \"rules\"]\n+ },\n+ title: \"Look ma, so simple\",\n+ content: \"Ratione necessitatibus doloremque itaque. Nihil hic alias cumque beatae esse sapiente incidunt. Illum vel eveniet officia.\"\n+ }\n+];\n+\n+// component function for individual keys in the JSON objects\n+const summary = (item) => [\"div.item\", item.title, item.meta, item.content];\n+const meta = (meta) => [\"div.meta\", meta.author, meta.created, meta.tags];\n+const author = (author) => [\"div\", [\"strong\", \"author: \"], link(`mailto:${author.email}`, author.name)];\n+const date = (d) => [\"div\", [\"strong\", \"date: \"], new Date(Date.parse(d)).toLocaleString()];\n+const link = (href, body) => [\"a\", { href }, body];\n+const tag = (t) => [\"li\", link(\"#\", t)];\n+const tags = (tags) => [\"ul.tags\", ...tags.map(tag)];\n+const title = (title, level = 3) => [`h${level}`, title];\n+const content = (body) => [\"div\", body];\n+\n+// generic JSON object tree transformer\n+// called with a nested object spec reflecting the structure\n+// of the source data and returns composed component function\n+export const componentFromSpec = (spec) => {\n+ if (isFunction(spec)) {\n+ return spec;\n+ }\n+ const mapfns = Object.keys(spec[1]).reduce(\n+ (acc, k) => (acc[k] = componentFromSpec(spec[1][k]), acc),\n+ {}\n+ );\n+ return (x) => {\n+ const res = {};\n+ for (let k in mapfns) {\n+ res[k] = mapfns[k](x[k]);\n+ }\n+ return spec[0](res);\n+ };\n+};\n+\n+// build component function for the above JSON object format\n+// the spec is an array of this recursive structure: [mapfn, {optional chid key specs...}]\n+// for leaf keys only a function needs to be given, no need to wrap in array\n+// giving component functions the same name as their object keys\n+// makes this format very succinct\n+const item = componentFromSpec([\n+ summary,\n+ {\n+ meta: [meta, { author, tags, created: date }],\n+ title,\n+ content\n+ }\n+]);\n+\n+// start UI\n+start(document.getElementById(\"app\"), [\"div\", ...db.map(item)]);\n",
"new_path": "examples/json-components/src/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \".\"\n+ },\n+ \"include\": [\n+ \"./src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "examples/json-components/tsconfig.json",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(examples): add json component demo
| 1
|
feat
|
examples
|
679,913
|
03.02.2018 16:49:46
| 0
|
3156e8882bcd9228ba3001af9914d6e64d35e8d6
|
fix(examples): update deps
|
[
{
"change_type": "MODIFY",
"diff": "\"webpack\": \"^3.10.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.1\",\n- \"@thi.ng/hiccup-dom\": \"^1.0.0\",\n- \"@thi.ng/rstream\": \"^0.9.2\",\n- \"@thi.ng/transducers\": \"^1.0.7\"\n+ \"@thi.ng/checks\": \"^1.1.6\",\n+ \"@thi.ng/hiccup-dom\": \"^1.0.0\"\n}\n}\n\\ No newline at end of file\n",
"new_path": "examples/json-components/package.json",
"old_path": "examples/json-components/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"webpack\": \"^3.10.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.0\",\n- \"@thi.ng/hiccup-dom\": \"^0.1.1\",\n- \"@thi.ng/rstream\": \"^0.9.1\",\n- \"@thi.ng/transducers\": \"^1.0.6\"\n+ \"@thi.ng/hiccup-dom\": \"^1.0.0\",\n+ \"@thi.ng/transducers\": \"^1.0.7\"\n}\n}\n\\ No newline at end of file\n",
"new_path": "examples/svg-particles/package.json",
"old_path": "examples/svg-particles/package.json"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(examples): update deps
| 1
|
fix
|
examples
|
679,913
|
03.02.2018 17:03:50
| 0
|
5d8478e15ada1c40c478b5ae57b956d17c1acb45
|
fix(examples): add missing files
|
[
{
"change_type": "ADD",
"diff": "+<!DOCTYPE html>\n+<html>\n+\n+<head>\n+ <style>\n+ html {\n+ font: 14px/1.4 Helvetica, Arial, sans-serif;\n+ }\n+\n+ h3 {\n+ margin: 0;\n+ }\n+\n+ footer {\n+ margin-top: 2em;\n+ }\n+\n+ .item {\n+ display: inline-block;\n+ width: 25%;\n+ margin: 5px;\n+ padding: 10px;\n+ background: #eee;\n+ vertical-align: top;\n+ }\n+\n+ .meta {\n+ font-size: 10px;\n+ background: #999;\n+ margin: 10px -10px;\n+ padding: 10px 10px 5px 10px;\n+ color: #fff;\n+ }\n+\n+ ul.tags {\n+ list-style: none;\n+ padding: 0;\n+ }\n+\n+ ul.tags li {\n+ display: inline-block;\n+ background: #333;\n+ padding: 0px 6px 2px 6px;\n+ border-radius: 8px;\n+ margin-right: 2px;\n+ }\n+\n+ .meta a:link,\n+ .meta a:visited {\n+ color: #fff;\n+ text-decoration: none;\n+ }\n+ </style>\n+</head>\n+\n+<body>\n+ <div id=\"app\"></div>\n+ <footer>\n+ Made with\n+ <a href=\"https://github.com/thi-ng/umbrella/tree/master/packages/hiccup-dom\">@thi.ng/hiccup-dom</a>.\n+ </footer>\n+ <script type=\"text/javascript\" src=\"bundle.min.js\"></script>\n+</body>\n+\n+</html>\n\\ No newline at end of file\n",
"new_path": "examples/json-components/index.html",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+module.exports = {\n+ entry: \"./src/index.ts\",\n+ output: {\n+ path: __dirname,\n+ filename: \"bundle.js\"\n+ },\n+ resolve: {\n+ extensions: [\".ts\", \".js\"]\n+ },\n+ module: {\n+ loaders: [{ test: /\\.ts$/, loader: \"ts-loader\" }]\n+ },\n+ node: {\n+ process: false,\n+ setImmediate: false\n+ }\n+};\n",
"new_path": "examples/json-components/webpack.config.js",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(examples): add missing files
| 1
|
fix
|
examples
|
679,913
|
03.02.2018 17:18:04
| 0
|
d8fa4caeccde80bbc8f4e32668be4b0c39903eac
|
fix(examples): update index.html
|
[
{
"change_type": "MODIFY",
"diff": "Made with\n<a href=\"https://github.com/thi-ng/umbrella/tree/master/packages/hiccup-dom\">@thi.ng/hiccup-dom</a>.\n</footer>\n- <script type=\"text/javascript\" src=\"bundle.min.js\"></script>\n+ <script type=\"text/javascript\" src=\"bundle.js\"></script>\n</body>\n</html>\n\\ No newline at end of file\n",
"new_path": "examples/json-components/index.html",
"old_path": "examples/json-components/index.html"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(examples): update index.html
| 1
|
fix
|
examples
|
679,913
|
03.02.2018 17:54:57
| 0
|
944cbb3ba658134cb9c2a5a3ac5c55726380c2f7
|
fix(hiccup-dom): add NO_SPANS config
this avoids adding inner spans for <text> / <textfield> elements
|
[
{
"change_type": "MODIFY",
"diff": "@@ -127,6 +127,8 @@ function normalizeElement(spec: any[]) {\nreturn [tag, attribs, content.length > 0 ? content : undefined];\n}\n+const NO_SPANS = { text: 1, textarea: 1 };\n+\nexport function normalizeTree(el: any, path = [0], keys = true, span = true) {\nif (el == null) {\nreturn;\n@@ -161,7 +163,7 @@ export function normalizeTree(el: any, path = [0], keys = true, span = true) {\nconst children = norm[2].slice(),\nn = children.length;\nnorm.length = 2;\n- span = span && norm[0] !== \"text\";\n+ span = span && !NO_SPANS[norm[0]];\nfor (let i = 0, j = 2, k = 0; i < n; i++) {\nlet el = children[i];\nif (el != null) {\n",
"new_path": "packages/hiccup-dom/src/diff.ts",
"old_path": "packages/hiccup-dom/src/diff.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(hiccup-dom): add NO_SPANS config
- this avoids adding inner spans for <text> / <textfield> elements
| 1
|
fix
|
hiccup-dom
|
679,913
|
03.02.2018 17:55:33
| 0
|
10c119b2f623ba4ed95d0e46187dc676dc322682
|
refactor(hiccup-dom): minor update ILifeCycle
|
[
{
"change_type": "MODIFY",
"diff": "import { IObjectOf } from \"@thi.ng/api/api\";\nexport interface ILifecycle {\n- init(el: Element, ...args: any[]);\n+ init?(el: Element, ...args: any[]);\nrender(...args: any[]): any;\n- release(...args: any[]);\n+ release?(...args: any[]);\n}\nexport interface ComponentAttribs {\n",
"new_path": "packages/hiccup-dom/src/api.ts",
"old_path": "packages/hiccup-dom/src/api.ts"
},
{
"change_type": "MODIFY",
"diff": "+export * from \"./api\";\nexport * from \"./diff\";\nexport * from \"./dom\";\nexport * from \"./start\";\n",
"new_path": "packages/hiccup-dom/src/index.ts",
"old_path": "packages/hiccup-dom/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(hiccup-dom): minor update ILifeCycle
| 1
|
refactor
|
hiccup-dom
|
679,913
|
03.02.2018 17:56:15
| 0
|
b524145b280349b61f4983ad0c7bb41b7e86c00b
|
feat(examples): add reactive json editor component
|
[
{
"change_type": "MODIFY",
"diff": ".item {\ndisplay: inline-block;\n- width: 25%;\n+ width: 45%;\nmargin: 5px;\npadding: 10px;\nbackground: #eee;\ncolor: #fff;\ntext-decoration: none;\n}\n+\n+ #container {\n+ display: grid;\n+ grid-template-columns: 33% auto;\n+ grid-template-rows: auto;\n+ grid-column-gap: 20px;\n+ }\n+\n+ textarea {\n+ width: 100%;\n+ height: 100%;\n+ font: 12px/1.2 monospace;\n+ }\n</style>\n</head>\n",
"new_path": "examples/json-components/index.html",
"old_path": "examples/json-components/index.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -2,7 +2,7 @@ import { isFunction } from \"@thi.ng/checks/is-function\";\nimport { start } from \"@thi.ng/hiccup-dom\";\n// some dummy JSON records\n-export const db = [\n+let db = [\n{\nmeta: {\nauthor: {\n@@ -74,5 +74,24 @@ const item = componentFromSpec([\n}\n]);\n+// simple text area editor for our JSON data\n+const editor = (() => {\n+ let body = JSON.stringify(db, null, 2);\n+ return [\n+ \"textarea\",\n+ {\n+ oninput: (e) => {\n+ try {\n+ db = JSON.parse(e.target.value);\n+ } catch (_) { }\n+ }\n+ },\n+ body\n+ ];\n+})();\n+\n// start UI\n-start(document.getElementById(\"app\"), [\"div\", ...db.map(item)]);\n+start(\n+ document.getElementById(\"app\"),\n+ () => [\"div#container\", [\"div\", editor], [\"div\", ...db.map(item)]]\n+);\n",
"new_path": "examples/json-components/src/index.ts",
"old_path": "examples/json-components/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(examples): add reactive json editor component
| 1
|
feat
|
examples
|
679,913
|
03.02.2018 21:03:03
| 0
|
83cd1a210a30d4d3481d4204fbce851fd95e1b26
|
refactor(examples): minor update json-components
|
[
{
"change_type": "MODIFY",
"diff": "@@ -43,7 +43,7 @@ const content = (body) => [\"div\", body];\n// generic JSON object tree transformer\n// called with a nested object spec reflecting the structure\n// of the source data and returns composed component function\n-export const componentFromSpec = (spec) => {\n+const componentFromSpec = (spec) => {\nif (isFunction(spec)) {\nreturn spec;\n}\n@@ -54,7 +54,7 @@ export const componentFromSpec = (spec) => {\nreturn (x) => {\nconst res = {};\nfor (let k in mapfns) {\n- res[k] = mapfns[k](x[k]);\n+ res[k] = x[k] != null ? mapfns[k](x[k]) : undefined;\n}\nreturn spec[0](res);\n};\n@@ -68,7 +68,14 @@ export const componentFromSpec = (spec) => {\nconst item = componentFromSpec([\nsummary,\n{\n- meta: [meta, { author, tags, created: date }],\n+ meta: [\n+ meta,\n+ {\n+ author,\n+ tags,\n+ created: date\n+ }\n+ ],\ntitle,\ncontent\n}\n",
"new_path": "examples/json-components/src/index.ts",
"old_path": "examples/json-components/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(examples): minor update json-components
| 1
|
refactor
|
examples
|
679,913
|
03.02.2018 22:05:23
| 0
|
b6d95fbe4209de256204da1419b2dc0f36e6a4ba
|
feat(examples): add json demo theme support, update docs
|
[
{
"change_type": "ADD",
"diff": "Binary files /dev/null and b/examples/json-components/assets/editme.png differ\n",
"new_path": "examples/json-components/assets/editme.png",
"old_path": "examples/json-components/assets/editme.png"
},
{
"change_type": "MODIFY",
"diff": "margin-top: 2em;\n}\n+ .item.light {\n+ background: #eee;\n+ }\n+\n+ .item.dark {\n+ background: #333;\n+ color: #ccc;\n+ font-family: Inconsolata, Menlo, monospace;\n+ }\n+\n+ .item.light .meta {\n+ background: #999;\n+ color: #fff;\n+ }\n+\n+ .item.dark .meta {\n+ background: #555;\n+ color: #ee0;\n+ }\n+\n+ .item.light ul.tags li {\n+ background: #333;\n+ }\n+\n+ .item.dark ul.tags li {\n+ background: #ee0;\n+ }\n+\n+ .item.light .meta a:link,\n+ .item.light .meta a:visited {\n+ color: #fff;\n+ }\n+\n+ .item.dark .meta a:link,\n+ .item.dark .meta a:visited {\n+ color: #ee0;\n+ }\n+\n+ .item.dark ul.tags a:link,\n+ .item.dark ul.tags a:visited {\n+ color: #000;\n+ }\n+\n.item {\ndisplay: inline-block;\nwidth: 45%;\nmargin: 5px;\npadding: 10px;\n- background: #eee;\nvertical-align: top;\n}\n.meta {\nfont-size: 10px;\n- background: #999;\nmargin: 10px -10px;\npadding: 10px 10px 5px 10px;\n- color: #fff;\n}\nul.tags {\nul.tags li {\ndisplay: inline-block;\n- background: #333;\npadding: 0px 6px 2px 6px;\nborder-radius: 8px;\nmargin-right: 2px;\n.meta a:link,\n.meta a:visited {\n- color: #fff;\ntext-decoration: none;\n}\nwidth: 100%;\nheight: 100%;\nfont: 12px/1.2 monospace;\n+ background: url(assets/editme.png);\n+ background-size: contain;\n}\n</style>\n</head>\n<body>\n+ <h1>JSON driven components</h1>\n+ <p>The components on the right are a direct mapping of the JSON data below using a mapping function from JSON to\n+ <a href=\"https://github.com/thi-ng/umbrella/tree/master/packages/hiccup-dom\">hiccup component format</a>, then is used to reactively mutate the DOM (total JS file size: 11.8KB).</p>\n+ <p>Edit fields, or copy & paste complete items to add more. Any edits will be immediately reflected in both themed versions.</p>\n<div id=\"app\"></div>\n<footer>\nMade with\n",
"new_path": "examples/json-components/index.html",
"old_path": "examples/json-components/index.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -12,7 +12,7 @@ let db = [\ncreated: \"2018-02-03T12:13:14Z\",\ntags: [\"drama\", \"queen\"]\n},\n- title: \"'I love my books, all three of them'\",\n+ title: \"UI components for Dummies\",\ncontent: \"Sed doloribus molestias voluptatem ut delectus vitae quo eum. Ut praesentium sed omnis sequi rerum praesentium aperiam modi. Occaecati voluptatum quis vel facere quis quisquam.\"\n},\n{\n@@ -29,20 +29,24 @@ let db = [\n}\n];\n-// component function for individual keys in the JSON objects\n-const summary = (item) => [\"div.item\", item.title, item.meta, item.content];\n+// component functions for individual keys in the JSON objects\n+// the `item` function is the root component for each JSON object\n+// it's a higher-order function, since we will create different\n+// instances for theming purposes... see below\n+const item = (theme) => (item) => [`div.item.${theme}`, item.title, item.meta, item.content];\nconst meta = (meta) => [\"div.meta\", meta.author, meta.created, meta.tags];\nconst author = (author) => [\"div\", [\"strong\", \"author: \"], link(`mailto:${author.email}`, author.name)];\n-const date = (d) => [\"div\", [\"strong\", \"date: \"], new Date(Date.parse(d)).toLocaleString()];\n+const date = (iso) => [\"div\", [\"strong\", \"date: \"], new Date(Date.parse(iso)).toLocaleString()];\nconst link = (href, body) => [\"a\", { href }, body];\n-const tag = (t) => [\"li\", link(\"#\", t)];\n+const tag = (tag) => [\"li\", link(\"#\", tag)];\nconst tags = (tags) => [\"ul.tags\", ...tags.map(tag)];\nconst title = (title, level = 3) => [`h${level}`, title];\nconst content = (body) => [\"div\", body];\n// generic JSON object tree transformer\n// called with a nested object spec reflecting the structure\n-// of the source data and returns composed component function\n+// of the source data, returns composed component function,\n+// which calls all nested sub-components\nconst componentFromSpec = (spec) => {\nif (isFunction(spec)) {\nreturn spec;\n@@ -60,14 +64,17 @@ const componentFromSpec = (spec) => {\n};\n};\n-// build component function for the above JSON object format\n-// the spec is an array of this recursive structure: [mapfn, {optional chid key specs...}]\n+// now build themed component functions for the above JSON object format\n+// the spec below is is only partially complete and will be reused by\n+// the two themes below (this is only for demo purposes and of course\n+// one could supply completely different functions per theme, but KISS here... :)\n+\n+// the full spec is an array of this recursive structure:\n+// [mapfn, {optional chid key specs...}]\n// for leaf keys only a function needs to be given, no need to wrap in array\n// giving component functions the same name as their object keys\n// makes this format very succinct\n-const item = componentFromSpec([\n- summary,\n- {\n+const itemSpec = {\nmeta: [\nmeta,\n{\n@@ -78,10 +85,15 @@ const item = componentFromSpec([\n],\ntitle,\ncontent\n- }\n-]);\n+};\n+\n+// build themed component instances\n+const itemLight = componentFromSpec([item(\"light\"), itemSpec]);\n+const itemDark = componentFromSpec([item(\"dark\"), itemSpec]);\n// simple text area editor for our JSON data\n+// any change to the input should be immediately\n+// reflected in the rendering\nconst editor = (() => {\nlet body = JSON.stringify(db, null, 2);\nreturn [\n@@ -100,5 +112,10 @@ const editor = (() => {\n// start UI\nstart(\ndocument.getElementById(\"app\"),\n- () => [\"div#container\", [\"div\", editor], [\"div\", ...db.map(item)]]\n+ () =>\n+ [\"div#container\",\n+ [\"div\", editor],\n+ [\"div\",\n+ [\"div\", [\"h2\", \"Light theme\"], ...db.map(itemLight)],\n+ [\"div\", [\"h2\", \"Dark theme\"], ...db.map(itemDark)]]]\n);\n",
"new_path": "examples/json-components/src/index.ts",
"old_path": "examples/json-components/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(examples): add json demo theme support, update docs
| 1
|
feat
|
examples
|
679,913
|
03.02.2018 22:50:41
| 0
|
4edf45fc16d39bb3ee8d98e8586315bb259b8a5b
|
fix(hiccup-dom): fix update start() to be cancellable, add docs
|
[
{
"change_type": "MODIFY",
"diff": "import { diffElement, normalizeTree } from \"./diff\";\n-export function start(parent, tree: any) {\n+/**\n+ * Takes a parent DOM element (or ID) and hiccup tree\n+ * (array or function) and starts RAF update loop,\n+ * computing diff to previous frame's tree and applying\n+ * any changes to the real DOM.\n+ *\n+ * Important: The parent element given is assumed to have NO\n+ * children at the time when `start()` is called. Since\n+ * hiccup-dom does NOT track the real DOM, the resulting\n+ * changes will result in potentially undefined behavior.\n+ *\n+ * Returns a function, which when called, immediately\n+ * cancels the update loop.\n+ *\n+ * @param parent\n+ * @param tree\n+ */\n+export function start(parent: Element, tree: any) {\nlet prev = [];\n+ let isActive = true;\nfunction update() {\n+ if (isActive) {\ndiffElement(parent, prev, prev = normalizeTree(tree));\n- requestAnimationFrame(update);\n+ // check again in case one of the components called cancel\n+ isActive && requestAnimationFrame(update);\n+ }\n}\nrequestAnimationFrame(update);\n+ return () => (isActive = false);\n}\n",
"new_path": "packages/hiccup-dom/src/start.ts",
"old_path": "packages/hiccup-dom/src/start.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(hiccup-dom): fix #3, update start() to be cancellable, add docs
| 1
|
fix
|
hiccup-dom
|
679,913
|
04.02.2018 00:08:54
| 0
|
1f4f4b8c45a4a4f42f2c8213d002cadcd3a7d026
|
fix(hiccup-dom): support parent DOM ID as arg start()
|
[
{
"change_type": "MODIFY",
"diff": "+import { isString } from \"@thi.ng/checks/is-string\";\nimport { diffElement, normalizeTree } from \"./diff\";\n/**\n@@ -17,12 +18,15 @@ import { diffElement, normalizeTree } from \"./diff\";\n* @param parent\n* @param tree\n*/\n-export function start(parent: Element, tree: any) {\n+export function start(parent: Element | string, tree: any) {\nlet prev = [];\nlet isActive = true;\n+ parent = isString(parent) ?\n+ document.getElementById(parent) :\n+ parent;\nfunction update() {\nif (isActive) {\n- diffElement(parent, prev, prev = normalizeTree(tree));\n+ diffElement(<any>parent, prev, prev = normalizeTree(tree));\n// check again in case one of the components called cancel\nisActive && requestAnimationFrame(update);\n}\n",
"new_path": "packages/hiccup-dom/src/start.ts",
"old_path": "packages/hiccup-dom/src/start.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(hiccup-dom): support parent DOM ID as arg start()
| 1
|
fix
|
hiccup-dom
|
679,913
|
04.02.2018 01:30:15
| 0
|
855d8039095a2d8ebb9862811f339f7e6706bf5b
|
feat(transducers): add page() xform, update readme
|
[
{
"change_type": "MODIFY",
"diff": "@@ -128,6 +128,27 @@ tx.reduce(\n// }\n```\n+### Pagination\n+\n+```typescript\n+// extract only items for given page id & page length\n+[...tx.iterator(tx.page(0, 5), tx.range(12))]\n+// [ 0, 1, 2, 3, 4 ]\n+\n+// when composing with other transducers\n+// it's most efficient to place `page()` early on in the chain\n+// that way only the page items will be further processed\n+[...tx.iterator(tx.comp(tx.page(1, 5), tx.map(x => x * 10)), tx.range(12))]\n+// [ 50, 60, 70, 80, 90 ]\n+\n+// use `padLast()` to fill up missing values\n+[...tx.iterator(tx.comp(tx.page(2, 5), tx.padLast(5, \"n/a\")), tx.range(12))]\n+// [ 10, 11, 'n/a', 'n/a', 'n/a' ]\n+\n+[...tx.iterator(tx.page(3, 5), rtx.ange(12))]\n+// []\n+```\n+\n### Multiplexing / parallel transducer application\n`multiplex` and `multiplexObj` can be used to transform values in parallel\n",
"new_path": "packages/transducers/README.md",
"old_path": "packages/transducers/README.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -59,6 +59,7 @@ export * from \"./xform/multiplex\";\nexport * from \"./xform/multiplex-obj\";\nexport * from \"./xform/noop\";\nexport * from \"./xform/pad-last\";\n+export * from \"./xform/page\";\nexport * from \"./xform/partition-by\";\nexport * from \"./xform/partition-of\";\nexport * from \"./xform/partition-sort\";\n",
"new_path": "packages/transducers/src/index.ts",
"old_path": "packages/transducers/src/index.ts"
},
{
"change_type": "ADD",
"diff": "+import { Transducer } from \"../api\";\n+import { comp } from \"../func/comp\";\n+import { drop } from \"./drop\";\n+import { take } from \"./take\";\n+\n+/**\n+ * Pagination helper. Returns transducer which extracts\n+ * only items for given page number (and page length,\n+ * default 10). When composing with other transducers,\n+ * it's most efficient if `page()` is used prior to\n+ * any heavy processing steps.\n+ *\n+ * ```\n+ * [...iterator(page(0, 5), range(12))]\n+ * // [ 0, 1, 2, 3, 4 ]\n+ *\n+ * [...iterator(page(1, 5), range(12))]\n+ * // [ 5, 6, 7, 8, 9 ]\n+ *\n+ * [...iterator(page(2, 5), range(12))]\n+ * // [ 10, 11 ]\n+ *\n+ * [...iterator(page(3, 5), range(12))]\n+ * // []\n+ * ```\n+ *\n+ * @param page\n+ * @param pageLen\n+ */\n+export function page<T>(page: number, pageLen = 10): Transducer<T, T> {\n+ return comp(drop(page * pageLen), take(pageLen));\n+}\n",
"new_path": "packages/transducers/src/xform/page.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(transducers): add page() xform, update readme
| 1
|
feat
|
transducers
|
679,913
|
04.02.2018 22:03:00
| 0
|
3ee6755f16f983f473e6aca7994d9a644561811d
|
fix(examples): minor fixes index.html
|
[
{
"change_type": "MODIFY",
"diff": "<body>\n<h1>JSON driven components</h1>\n- <p>The components on the right are a direct mapping of the JSON data below using a mapping function from JSON to\n- <a href=\"https://github.com/thi-ng/umbrella/tree/master/packages/hiccup-dom\">hiccup component format</a>, then is used to reactively mutate the DOM (total JS file size: 11.8KB).</p>\n- <p>Edit fields, or copy & paste complete items to add more. Any edits will be immediately reflected in both themed versions.</p>\n+ <p>The components on the right are a direct mapping of the JSON data below, using a mapping function from JSON to\n+ <a href=\"https://github.com/thi-ng/umbrella/blob/master/examples/json-components/src/index.ts\">hiccup component format</a>, which then is used to reactively mutate the DOM (total JS file size: 12KB).</p>\n+ <p>Edit fields, or copy & paste complete items to add more. Any edits will be immediately reflected in both themed versions\n+ (provided they're valid - no error checking!).</p>\n<div id=\"app\"></div>\n<footer>\nMade with\n",
"new_path": "examples/json-components/index.html",
"old_path": "examples/json-components/index.html"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(examples): minor fixes index.html
| 1
|
fix
|
examples
|
679,913
|
04.02.2018 22:03:25
| 0
|
eb12a165bdc23e8a6f86b48ea5ac8d2bb2734f70
|
build: update upload-docs script
|
[
{
"change_type": "MODIFY",
"diff": "@@ -9,3 +9,5 @@ for m in $modules; do\necho \"syncing...\"\naws s3 sync $m/doc s3://docs.thi.ng/umbrella/$name --profile toxi-s3 --acl public-read\ndone\n+\n+aws s3 cp dev/docs.html s3://docs.thi.ng/index.html --profile toxi-s3 --acl public-read\n",
"new_path": "scripts/upload-docs",
"old_path": "scripts/upload-docs"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
build: update upload-docs script
| 1
|
build
| null |
808,010
|
05.02.2018 08:16:56
| -32,400
|
8e3ab1e8267e09dab9a7674d7b9989ee792fbeaa
|
fix: add other potential cause of git initialization failure
|
[
{
"change_type": "MODIFY",
"diff": "@@ -230,7 +230,7 @@ class Command {\nif (this.requiresGit && !GitUtilities.isInitialized(this.execOpts)) {\nthrow new ValidationError(\n\"ENOGIT\",\n- \"This is not a git repository, did you already run `git init` or `lerna init`?\"\n+ \"git binary missing, or this is not a git repository. Did you already run `git init` or `lerna init`?\"\n);\n}\n",
"new_path": "src/Command.js",
"old_path": "src/Command.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
fix: add other potential cause of git initialization failure (#1248)
| 1
|
fix
| null |
815,736
|
05.02.2018 09:32:35
| -10,800
|
fbd5f5c696be75bfd4e1ccb92833df2db91b905a
|
fix: Not found text is not used for custom tags
|
[
{
"change_type": "MODIFY",
"diff": "</div>\n</ng-select-virtual-scroll>\n- <div class=\"ng-select-dropdown\" *ngIf=\"showNoItemsFound() && !addTag\">\n+ <div class=\"ng-select-dropdown\" *ngIf=\"showNoItemsFound() && !showAddTag()\">\n<div class=\"ng-option disabled\">\n{{notFoundText}}\n</div>\n",
"new_path": "src/ng-select/ng-select.component.html",
"old_path": "src/ng-select/ng-select.component.html"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: Not found text is not used for custom tags #234 (#235)
| 1
|
fix
| null |
573,214
|
05.02.2018 09:48:43
| -3,600
|
bde8fda646a6f69b57fd72af1f00d6153fe056ec
|
fix(jsonBodyParser): fix percent sign causing server fail
|
[
{
"change_type": "MODIFY",
"diff": "@@ -38,7 +38,10 @@ function jsonBodyParser(options) {\nparams = JSON.parse(req.body, opts.reviver);\n} catch (e) {\nreturn next(\n- new errors.InvalidContentError('Invalid JSON: ' + e.message)\n+ new errors.InvalidContentError(\n+ '%s',\n+ 'Invalid JSON: ' + e.message\n+ )\n);\n}\n",
"new_path": "lib/plugins/jsonBodyParser.js",
"old_path": "lib/plugins/jsonBodyParser.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -464,4 +464,33 @@ describe('JSON body parser', function() {\nCLIENT.post('/body/foo', payload, done);\n});\n+\n+ it('should not throw uncaught \"too few args to sprintf\"', function(done) {\n+ // https://github.com/restify/node-restify/issues/1411\n+ SERVER.use(restify.plugins.bodyParser());\n+\n+ SERVER.post('/', function(req, res, next) {\n+ res.send();\n+ next();\n+ });\n+\n+ var opts = {\n+ hostname: '127.0.0.1',\n+ port: PORT,\n+ path: '/',\n+ method: 'POST',\n+ agent: false,\n+ headers: {\n+ accept: 'application/json',\n+ 'content-type': 'application/json'\n+ }\n+ };\n+ var client = http.request(opts, function(res) {\n+ assert.equal(res.statusCode, 400);\n+ res.once('end', done);\n+ res.resume();\n+ });\n+ client.write('{\"malformedJsonWithPercentSign\":30%}');\n+ client.end();\n+ });\n});\n",
"new_path": "test/plugins/jsonBodyParser.test.js",
"old_path": "test/plugins/jsonBodyParser.test.js"
}
] |
JavaScript
|
MIT License
|
restify/node-restify
|
fix(jsonBodyParser): fix percent sign causing server fail (#1411)
| 1
|
fix
|
jsonBodyParser
|
448,039
|
05.02.2018 12:28:47
| -3,600
|
2285971699d1244592d95740240482cf3947ae99
|
release: cut v2.0.0
|
[
{
"change_type": "MODIFY",
"diff": "All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n+<a name=\"2.0.0\"></a>\n+\n+# [2.0.0](https://github.com/dherges/ng-packagr/compare/v2.0.0-rc.13...v2.0.0) (2018-02-05)\n+\n+Version 2 of ng-packagr is targeting Angular 5 (and beyond).\n+Update your projects by:\n+\n+```bash\n+$ yarn add --dev ng-packagr@^2.0.0 @angular/compiler@^5.0.0 @angular/compiler-cli@^5.0.0 tsickle\n+```\n+\n+### Migrating from v1 (Breaking changes from v1.6.0 to v2.0.0)\n+\n+* Users now need to install `@angular/compiler`, `@angular/compiler-cli`, `typescript`, and `tsickle` to the `devDependency` section of their project (if not already installed). ng-packagr uses both the TypeScript and the Angular compiler version provided by the user workspace.\n+* The setting for external dependencies (`lib.externals`) has been removed in favour of `lib.umdModuleIds` which is now just used to provide the UMD module identifiers of external dependencies.\n+ By default, all dependencies are now treated as externals and thus are not embedded in the final bundle.\n+ If a dependency should be embedded in the distributables, it needs to be explicity added to `lib.embedded`.\n+ Please consult the updated README on migrating your package confguration from `lib.externals` to `lib.umdModuleIds` and `lib.embedded`.\n+* Discovery of primary and secondary entry points is changed to read from the following file sources. File locations are tried in this order:\n+ * `package.json` with `ngPackage` property\n+ * `ng-package.json` (requires a `package.json` as sibling)\n+ * `ng-package.js` (with a default export, requires a `package.json` as sibling)\n+* Setting `ngPackage.src` has no effect any more. The source directory (base path) is equivalent to the location of the (primary) `ng-package.json`, `package.json`, or `ng-package.js`.\n+* UMD Module IDs of packages have been changed: when you published a scoped npm package, e.g. `@sample/core`, the UMD module ID used to be `core` including only the second part of the npm package name. With this change, the UMD module ID is now `sample.core`. For secondary entrypoints, e.g. `@sample/core/testing`, the UMD module ID now also includes every part of the npm package name, e.g. `sample.core.testing`. Publishing your npm packages built with this version of ng-packagr causes a new UMD module ID to be generated. Users of your library need to update their configuration, e.g. when using SystemJS!\n+\n+An excerpt of each bug fix and feature is listed below for the respective release candidate version!\n+\n+### Bug Fixes\n+\n+* recognize aliased and namespace decorator imports ([#585](https://github.com/dherges/ng-packagr/issues/585)) ([8f88c5a](https://github.com/dherges/ng-packagr/commit/8f88c5a))\n+\n+### Features\n+\n+* comments cleanup and license header file ([#574](https://github.com/dherges/ng-packagr/issues/574)) ([0237f24](https://github.com/dherges/ng-packagr/commit/0237f24)), closes [#362](https://github.com/dherges/ng-packagr/issues/362)\n+* export and test public api surface ([#584](https://github.com/dherges/ng-packagr/issues/584)) ([6858e2e](https://github.com/dherges/ng-packagr/commit/6858e2e))\n+\n<a name=\"2.0.0-rc.13\"></a>\n# [2.0.0-rc.13](https://github.com/dherges/ng-packagr/compare/v2.0.0-rc.12...v2.0.0-rc.13) (2018-02-03)\n",
"new_path": "CHANGELOG.md",
"old_path": "CHANGELOG.md"
},
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"ng-packagr\",\n- \"version\": \"2.0.0-rc.13\",\n+ \"version\": \"2.0.0\",\n\"description\": \"Compile and package a TypeScript library to Angular Package Format\",\n\"keywords\": [\n\"angular\",\n",
"new_path": "package.json",
"old_path": "package.json"
}
] |
TypeScript
|
MIT License
|
ng-packagr/ng-packagr
|
release: cut v2.0.0
| 1
|
release
| null |
679,913
|
05.02.2018 12:48:27
| 0
|
5281d9a832a3fe84ef07fabc7574c474799714c6
|
feat(examples): add webgl example
|
[
{
"change_type": "ADD",
"diff": "+# webgl\n+\n+[Live demo](http://demo.thi.ng/umbrella/hiccup-dom/webgl/)\n+\n+```\n+git clone https://github.com/thi-ng/umbrella.git\n+cd umbrella/examples/webgl\n+yarn install\n+yarn dev\n+```\n+\n+Once webpack has completed building, refresh your browser...\n",
"new_path": "examples/webgl/README.md",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+<!DOCTYPE html>\n+<html>\n+\n+<head>\n+ <style>\n+ html {\n+ font: 100%/1.2 Helvetica, Arial, sans-serif;\n+ }\n+\n+ canvas {\n+ margin-right: 10px;\n+ }\n+ </style>\n+</head>\n+\n+<body>\n+ <div id=\"app\"></div>\n+ <script type=\"text/javascript\" src=\"bundle.js\"></script>\n+</body>\n+\n+</html>\n\\ No newline at end of file\n",
"new_path": "examples/webgl/index.html",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"webgl\",\n+ \"version\": \"0.0.1\",\n+ \"repository\": \"https://github.com/thi-ng/umbrella\",\n+ \"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n+ \"license\": \"Apache-2.0\",\n+ \"scripts\": {\n+ \"build\": \"yarn clean && webpack\",\n+ \"clean\": \"rm -rf bundle.*\",\n+ \"dev\": \"open index.html && webpack -w\"\n+ },\n+ \"devDependencies\": {\n+ \"ts-loader\": \"^3.3.1\",\n+ \"typescript\": \"^2.7.1\",\n+ \"webpack\": \"^3.10.0\"\n+ },\n+ \"dependencies\": {\n+ \"@thi.ng/hiccup-dom\": \"^0.1.1\"\n+ }\n+}\n\\ No newline at end of file\n",
"new_path": "examples/webgl/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { start } from \"@thi.ng/hiccup-dom\";\n+\n+let frame = 0;\n+\n+// reusable GL canvas component\n+const glcanvas = (init, update, attribs) => {\n+ let gl: WebGLRenderingContext;\n+ return [{\n+ init(el: HTMLCanvasElement) {\n+ gl = el.getContext(\"webgl\");\n+ init(gl);\n+ },\n+ render() {\n+ gl && update(gl);\n+ return [\"canvas\", attribs]\n+ }\n+ }];\n+};\n+\n+// canvas init hook\n+const initGL = (_: WebGLRenderingContext) => {\n+ // init here\n+};\n+\n+// canvas render hook\n+const updateGL = (offset) =>\n+ (gl: WebGLRenderingContext) => {\n+ frame++;\n+ const f = offset + frame * 0.01;\n+ const red = Math.sin(f) * 0.5 + 0.5;\n+ const green = Math.sin(f + Math.PI * 1 / 3) * 0.5 + 0.5;\n+ const blue = Math.sin(f + Math.PI * 2 / 3) * 0.5 + 0.5;\n+ gl.clearColor(red, green, blue, 1);\n+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n+ };\n+\n+start(\n+ document.getElementById(\"app\"),\n+ // instantiate multiple canvases\n+ [\"div\",\n+ glcanvas(initGL, updateGL(0), { width: 100, height: 100 }),\n+ glcanvas(initGL, updateGL(200), { width: 100, height: 100 }),\n+ glcanvas(initGL, updateGL(400), { width: 100, height: 100 })]\n+);\n",
"new_path": "examples/webgl/src/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \".\"\n+ },\n+ \"include\": [\n+ \"./src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "examples/webgl/tsconfig.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+module.exports = {\n+ entry: \"./src/index.ts\",\n+ output: {\n+ path: __dirname,\n+ filename: \"bundle.js\"\n+ },\n+ resolve: {\n+ extensions: [\".ts\", \".js\"]\n+ },\n+ module: {\n+ loaders: [{ test: /\\.ts$/, loader: \"ts-loader\" }]\n+ },\n+ node: {\n+ process: false,\n+ setImmediate: false\n+ }\n+};\n",
"new_path": "examples/webgl/webpack.config.js",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(examples): add webgl example
| 1
|
feat
|
examples
|
815,745
|
05.02.2018 13:21:01
| -7,200
|
5a0288328ef6ebcca07ca901f2b512ee4c724550
|
chore(release): 0.17.2
|
[
{
"change_type": "MODIFY",
"diff": "All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n+<a name=\"0.17.2\"></a>\n+## [0.17.2](https://github.com/ng-select/ng-select/compare/v0.17.1...v0.17.2) (2018-02-05)\n+\n+\n+### Bug Fixes\n+\n+* Not found text is not used for custom tags [#234](https://github.com/ng-select/ng-select/issues/234) ([#235](https://github.com/ng-select/ng-select/issues/235)) ([fbd5f5c](https://github.com/ng-select/ng-select/commit/fbd5f5c))\n+\n+\n+\n<a name=\"0.17.1\"></a>\n## [0.17.1](https://github.com/ng-select/ng-select/compare/v0.17.0...v0.17.1) (2018-02-04)\n",
"new_path": "CHANGELOG.md",
"old_path": "CHANGELOG.md"
},
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"@ng-select/ng-select\",\n- \"version\": \"0.17.1\",\n+ \"version\": \"0.17.2\",\n\"description\": \"Angular ng-select - All in One UI Select, Multiselect and Autocomplete\",\n\"author\": \"@ng-select/ng-select\",\n\"license\": \"MIT\",\n",
"new_path": "src/package.json",
"old_path": "src/package.json"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
chore(release): 0.17.2
| 1
|
chore
|
release
|
791,690
|
05.02.2018 16:10:01
| 28,800
|
717f90d720dc52236ee15adb5e3a31253e3c0cef
|
extension: change resolve current tab msg
|
[
{
"change_type": "MODIFY",
"diff": "@@ -132,7 +132,7 @@ class ExtensionConnection extends Connection {\nreturn reject(chrome.runtime.lastError);\n}\nif (tabs.length === 0) {\n- const message = 'Couldn\\'t resolve current tab. Please file a bug.';\n+ const message = 'Couldn\\'t resolve current tab. Check your URL, reload, and try again.';\nreturn reject(new Error(message));\n}\nif (tabs.length > 1) {\n",
"new_path": "lighthouse-core/gather/connections/extension.js",
"old_path": "lighthouse-core/gather/connections/extension.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
extension: change resolve current tab msg (#4407)
| 1
|
extension
| null |
791,723
|
05.02.2018 16:54:05
| 28,800
|
6bebd4c30a994359c64504b53ac0c83feb476e5b
|
core(a11y): aXe perf: only collect provided resultTypes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -25,6 +25,7 @@ function runA11yChecks() {\n'wcag2aa',\n],\n},\n+ resultTypes: ['violations', 'inapplicable'],\nrules: {\n'tabindex': {enabled: true},\n'table-fake-caption': {enabled: true},\n",
"new_path": "lighthouse-core/gather/gatherers/accessibility.js",
"old_path": "lighthouse-core/gather/gatherers/accessibility.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(a11y): aXe perf: only collect provided resultTypes (#4380)
| 1
|
core
|
a11y
|
815,810
|
06.02.2018 08:44:20
| -3,600
|
493c3493e3c680db37f25ec0def8c70c46f625ed
|
feat: highlight search term in labels in dropdown list
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -22,9 +22,9 @@ import { DataService } from '../shared/data.service';\n<label>Custom option</label>\n---html,true\n<ng-select [items]=\"cities2\" [(ngModel)]=\"selectedCity2\" bindLabel=\"name\" bindValue=\"name\">\n- <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\">\n+ <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n<img height=\"15\" width=\"15\" [src]=\"item.avatar\"/>\n- <b>{{item.name}}</b>\n+ <b [innerHTML]=\"item.name\" [ngOptionHighlight]=\"search\"></b>\n</ng-template>\n</ng-select>\n---\n@@ -40,9 +40,9 @@ import { DataService } from '../shared/data.service';\n<img height=\"15\" width=\"15\" [src]=\"item.avatar\"/>\n<b>{{item.name}}</b>\n</ng-template>\n- <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\">\n+ <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n<img height=\"15\" width=\"15\" [src]=\"item.avatar\"/>\n- <b>{{item.name}}</b>\n+ <b [innerHTML]=\"item.name\" [ngOptionHighlight]=\"search\"></b>\n</ng-template>\n</ng-select>\n---\n",
"new_path": "demo/app/examples/custom-templates.component.ts",
"old_path": "demo/app/examples/custom-templates.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -79,8 +79,8 @@ import { DataService } from '../shared/data.service';\nbindValue=\"id\"\nplaceholder=\"Select album\"\nformControlName=\"album\">\n- <ng-template ng-option-tmp let-item=\"item\">\n- <div>Title: {{item.title}}</div>\n+ <ng-template ng-option-tmp let-item=\"item\" let-search=\"searchTerm\">\n+ <div><span>Title: </span><span [innerHTML]=\"item.title\" [ngOptionHighlight]=\"search\"></span></div>\n<small><b>Id:</b> {{item.id}} | <b>UserId:</b> {{item.userId}}</small>\n</ng-template>\n</ng-select>\n@@ -103,9 +103,9 @@ import { DataService } from '../shared/data.service';\n<img height=\"15\" width=\"15\" [src]=\"item.thumbnailUrl\"/>\n<span >{{item.title}}</span>\n</ng-template>\n- <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\">\n+ <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n<img height=\"15\" width=\"15\" [src]=\"item.thumbnailUrl\"/>\n- <span>{{item.title}}</span>\n+ <span [innerHTML]=\"item.title\" [ngOptionHighlight]=\"search\"></span>\n</ng-template>\n</ng-select>\n<small class=\"form-text text-muted\">5000 items with virtual scroll</small>\n",
"new_path": "demo/app/examples/reactive-forms.component.ts",
"old_path": "demo/app/examples/reactive-forms.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -75,7 +75,7 @@ export class ItemsList {\nindex: this._items.length,\nlabel: this.resolveNested(item, this._ngSelect.bindLabel),\nvalue: item\n- }\n+ };\nthis._items.push(option);\nthis._filteredItems.push(option);\nreturn option;\n@@ -179,7 +179,7 @@ export class ItemsList {\nprivate _getDefaultFilterFunc(term: string) {\nreturn (option: NgOption) => {\n- return searchHelper.stripSpecialChars(option.label || '')\n+ return searchHelper.stripSpecialChars(option.label ? option.label.toString() : '')\n.toUpperCase()\n.indexOf(searchHelper.stripSpecialChars(term).toUpperCase()) > -1;\n};\n",
"new_path": "src/ng-select/items-list.ts",
"old_path": "src/ng-select/items-list.ts"
},
{
"change_type": "ADD",
"diff": "+import {Component} from '@angular/core';\n+import {ComponentFixture, TestBed} from '@angular/core/testing';\n+import {NgOptionHighlightDirective} from './ng-option-highlight.directive';\n+import {By} from '@angular/platform-browser';\n+\n+@Component({\n+ template: `\n+ <span id=\"test1\" [innerHTML]=\"'My text is highlighted'\" [ngOptionHighlight]=\"'is high'\"></span>\n+ <span id=\"test2\" [innerHTML]=\"'My text is not highlighted'\" [ngOptionHighlight]=\"'test'\"></span>\n+ <span id=\"test3\" [innerHTML]=\"'My text is rich'\"></span>\n+ `\n+})\n+class TestComponent {\n+}\n+\n+describe('NgOptionHighlightDirective', function () {\n+\n+ let fixture: ComponentFixture<TestComponent>;\n+\n+ beforeEach(() => {\n+ fixture = TestBed.configureTestingModule({\n+ declarations: [NgOptionHighlightDirective, TestComponent]\n+ })\n+ .createComponent(TestComponent);\n+\n+ fixture.detectChanges();\n+});\n+\n+ it('should have two elements with highlight directive', () => {\n+ let highlightDirectives = fixture.debugElement.queryAll(By.directive(NgOptionHighlightDirective));\n+ expect(highlightDirectives.length).toBe(2);\n+ });\n+\n+ it('should have one element with highlighted text when term matching', () => {\n+ let span1 = fixture.debugElement.query(By.css('#test1'));\n+ expect(span1.nativeElement.querySelector('.highlighted').innerHTML).toBe('is high');\n+ expect(span1.nativeElement.textContent).toBe('My text is highlighted');\n+ });\n+\n+ it('should have one element with no highlighted text when term not matching', () => {\n+ let span2 = fixture.debugElement.query(By.css('#test2'));\n+ expect(span2.nativeElement.querySelector('.highlighted')).toBeNull();\n+ expect(span2.nativeElement.innerHTML).toBe('My text is not highlighted');\n+ });\n+\n+ it('should have one element with no highlighted text when no highlight directive', () => {\n+ let span3 = fixture.debugElement.query(By.css('#test3'));\n+ expect(span3.nativeElement.querySelector('.highlighted')).toBeNull();\n+ expect(span3.nativeElement.innerHTML).toBe('My text is rich');\n+ });\n+});\n",
"new_path": "src/ng-select/ng-option-highlight.directive.spec.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import {Directive, ElementRef, Input, OnChanges, Renderer2} from '@angular/core';\n+import * as searchHelper from './search-helper';\n+\n+@Directive({\n+ selector: '[ngOptionHighlight]'\n+})\n+export class NgOptionHighlightDirective implements OnChanges {\n+\n+ @Input('ngOptionHighlight') term: string;\n+ @Input('innerHTML') label: any;\n+\n+ constructor(private elementRef: ElementRef, private renderer: Renderer2) {\n+ }\n+\n+ ngOnChanges(): void {\n+ this._highlightLabelWithSearchTerm();\n+ }\n+\n+ private _highlightLabelWithSearchTerm(): void {\n+ let label: string = this.label ? this.label.toString() : '';\n+ if (!label || !this.term) {\n+ this._setInnerHtml(label);\n+ return;\n+ }\n+ let indexOfTerm: number;\n+ indexOfTerm = searchHelper.stripSpecialChars(label)\n+ .toUpperCase()\n+ .indexOf(searchHelper.stripSpecialChars(this.term).toUpperCase());\n+ if (indexOfTerm > -1) {\n+ this._setInnerHtml(\n+ label.substring(0, indexOfTerm)\n+ + '<span class=\\'highlighted\\'>' + label.substr(indexOfTerm, this.term.length) + '</span>'\n+ + label.substring(indexOfTerm + this.term.length, label.length));\n+ } else {\n+ this._setInnerHtml(label);\n+ }\n+ }\n+\n+ private _setInnerHtml(html): void {\n+ this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', html);\n+ }\n+}\n",
"new_path": "src/ng-select/ng-option-highlight.directive.ts",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "[class.marked]=\"item === itemsList.markedItem\">\n<ng-template #defaultOptionTemplate>\n- <span class=\"ng-option-label\" [innerHTML]=\"item.label\"></span>\n+ <span class=\"ng-option-label\" [innerHTML]=\"item.label\" [ngOptionHighlight]=\"filterValue\"></span>\n</ng-template>\n<ng-template\n[ngTemplateOutlet]=\"optionTemplate || defaultOptionTemplate\"\n- [ngTemplateOutletContext]=\"{ item: item.value, index: item.index }\">\n+ [ngTemplateOutletContext]=\"{ item: item.value, index: item.index, searchTerm: filterValue }\">\n</ng-template>\n</div>\n",
"new_path": "src/ng-select/ng-select.component.html",
"old_path": "src/ng-select/ng-select.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -333,6 +333,10 @@ $color-selected: #f5faff;\ncursor: pointer;\ndisplay: block;\npadding: 8px 10px;\n+ .highlighted {\n+ font-weight: bold;\n+ text-decoration: underline;\n+ }\n&.selected {\nbackground-color: $color-selected;\ncolor: #333;\n",
"new_path": "src/ng-select/ng-select.component.scss",
"old_path": "src/ng-select/ng-select.component.scss"
},
{
"change_type": "MODIFY",
"diff": "@@ -10,11 +10,13 @@ import {\nimport { VirtualScrollModule } from './virtual-scroll.component';\nimport { SpinnerComponent } from './spinner.component';\nimport { NgOptionComponent } from './ng-option.component';\n+import { NgOptionHighlightDirective } from './ng-option-highlight.directive' ;\n@NgModule({\ndeclarations: [\nNgSelectComponent,\nNgOptionComponent,\n+ NgOptionHighlightDirective,\nNgOptionTemplateDirective,\nNgLabelTemplateDirective,\nNgHeaderTemplateDirective,\n@@ -28,6 +30,7 @@ import { NgOptionComponent } from './ng-option.component';\nexports: [\nNgSelectComponent,\nNgOptionComponent,\n+ NgOptionHighlightDirective,\nNgOptionTemplateDirective,\nNgLabelTemplateDirective,\nNgHeaderTemplateDirective,\n",
"new_path": "src/ng-select/ng-select.module.ts",
"old_path": "src/ng-select/ng-select.module.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
feat: highlight search term in labels in dropdown list (#233)
closes #152
| 1
|
feat
| null |
791,723
|
06.02.2018 14:04:09
| 28,800
|
1b965069929d3a88aa37137bceb3e6fdcba50a36
|
misc(package): scripts don't require "--" for options to be forwarded
|
[
{
"change_type": "MODIFY",
"diff": "@@ -7,7 +7,7 @@ sleep 0.5s\nconfig=\"lighthouse-cli/test/smokehouse/a11y/a11y-config.js\"\nexpectations=\"lighthouse-cli/test/smokehouse/a11y/expectations.js\"\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/a11y/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/a11y/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -7,7 +7,7 @@ sleep 0.5s\nconfig=\"lighthouse-cli/test/smokehouse/byte-config.js\"\nexpectations=\"lighthouse-cli/test/smokehouse/byte-efficiency/expectations.js\"\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/byte-efficiency/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/byte-efficiency/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -8,7 +8,7 @@ config=\"lighthouse-cli/test/smokehouse/dbw-config.js\"\nexpectations=\"lighthouse-cli/test/smokehouse/dobetterweb/dbw-expectations.js\"\n# run smoketest on DBW test page.\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/dobetterweb/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/dobetterweb/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -8,7 +8,7 @@ config=\"lighthouse-cli/test/smokehouse/offline-config.js\"\nexpectations=\"lighthouse-cli/test/smokehouse/offline-local/offline-expectations.js\"\n# run smoketest, expecting results found in offline-expectations\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/offline-local/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/offline-local/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -7,7 +7,7 @@ sleep 0.5s\nconfig=\"lighthouse-core/config/perf.json\"\nexpectations=\"lighthouse-cli/test/smokehouse/perf/expectations.js\"\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/perf/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/perf/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -8,7 +8,7 @@ config=\"lighthouse-cli/test/smokehouse/redirects-config.js\"\nexpectations=\"lighthouse-cli/test/smokehouse/redirects/expectations.js\"\n# run smoketest, expecting results found in offline-expectations\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/redirects/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/redirects/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -7,7 +7,7 @@ sleep 0.5s\nconfig=\"lighthouse-cli/test/smokehouse/seo-config.js\"\nexpectations=\"lighthouse-cli/test/smokehouse/seo/expectations.js\"\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/seo/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/seo/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -7,7 +7,7 @@ sleep 0.5s\nconfig=\"lighthouse-core/config/default.js\"\nexpectations=\"lighthouse-cli/test/smokehouse/tricky-ttci/expectations.js\"\n-yarn smokehouse -- --config-path=$config --expectations-path=$expectations\n+yarn smokehouse --config-path=$config --expectations-path=$expectations\nexit_code=$?\n# kill test servers\n",
"new_path": "lighthouse-cli/test/smokehouse/tricky-ttci/run-tests.sh",
"old_path": "lighthouse-cli/test/smokehouse/tricky-ttci/run-tests.sh"
},
{
"change_type": "MODIFY",
"diff": "@@ -42,7 +42,7 @@ cd \"$protocol_path\" && git reset --hard && git fetch origin master && git checko\ncd \"$lhroot_path\" || exit 1\n# copy renderer and lh backgrond into this devtools checkout\n-yarn devtools -- \"$frontend_path/front_end/\"\n+yarn devtools \"$frontend_path/front_end/\"\n#\n# monkeypatch the audits2 module.json to include any new files we're added that aren't present\n",
"new_path": "lighthouse-core/scripts/compile-against-devtools.sh",
"old_path": "lighthouse-core/scripts/compile-against-devtools.sh"
},
{
"change_type": "MODIFY",
"diff": "# yarn devtools\n# with a custom devtools front_end location:\n-# yarn devtools -- node_modules/temp-devtoolsfrontend/front_end/\n+# yarn devtools node_modules/temp-devtoolsfrontend/front_end/\nchromium_dir=\"$HOME/chromium/src\"\n",
"new_path": "lighthouse-core/scripts/roll-to-devtools.sh",
"old_path": "lighthouse-core/scripts/roll-to-devtools.sh"
},
{
"change_type": "MODIFY",
"diff": "\"compile-devtools\": \"bash lighthouse-core/scripts/compile-against-devtools.sh\",\n\"watch\": \"bash lighthouse-core/scripts/run-mocha.sh --watch\",\n\"chrome\": \"node chrome-launcher/manual-chrome-launcher.js\",\n- \"fast\": \"yarn start -- --disable-device-emulation --disable-cpu-throttling --disable-network-throttling\",\n+ \"fast\": \"yarn start --disable-device-emulation --disable-cpu-throttling --disable-network-throttling\",\n\"smokehouse\": \"node lighthouse-cli/test/smokehouse/smokehouse.js\",\n\"deploy-viewer\": \"cd lighthouse-viewer && gulp deploy\",\n\"bundlesize\": \"bundlesize\",\n",
"new_path": "package.json",
"old_path": "package.json"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
misc(package): scripts don't require "--" for options to be forwarded (#4437)
| 1
|
misc
|
package
|
679,913
|
07.02.2018 11:45:40
| 0
|
a10a487ccc0f1a6be05115269c9492a91a9870df
|
fix(csp): fix example in readme
|
[
{
"change_type": "MODIFY",
"diff": "@@ -119,7 +119,7 @@ Channel.merge([\nChannel.range(0, 3),\nChannel.range(10, 15),\nChannel.range(100, 110)\n-]).reduce(tx.push).then(console.log);\n+]).reduce(tx.push()).then(console.log);\n// [ 0, 100, 101, 102, 103, 1, 2, 104, 105, 10, 11, 12, 13, 106, 14, 107, 108, 109 ]\n",
"new_path": "packages/csp/README.md",
"old_path": "packages/csp/README.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(csp): fix #5, example in readme
| 1
|
fix
|
csp
|
679,913
|
07.02.2018 11:54:26
| 0
|
080c2ee51fc7a807237ae4b49e49e2962f6e05e4
|
fix(csp): fix more example fixes (rfn calls)
|
[
{
"change_type": "MODIFY",
"diff": "@@ -57,7 +57,7 @@ const results = new Mult(\"results\");\n// tap result channel and sum word counts\nconst counter = results\n.tap(tx.map(x => x[1]))\n- .reduce(tx.add);\n+ .reduce(tx.add());\n// 2nd output channel with streaming sort transducer\n// (using a sliding window size of 500 items) and dropping\n@@ -76,7 +76,7 @@ const sorted = results.tap(\n// into the `sorted` channel\n// (`freqs` is a JS Map and is iterable)\npaths.pipe(proc)\n- .reduce(tx.frequencies)\n+ .reduce(tx.frequencies())\n.then(freqs => results.channel().into(freqs));\n// start tracing sorted outputs and\n",
"new_path": "packages/csp/README.md",
"old_path": "packages/csp/README.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(csp): fix #5, more example fixes (rfn calls)
| 1
|
fix
|
csp
|
791,940
|
07.02.2018 14:03:34
| 28,800
|
0e7983fed43a079cb9d505a16eb2f2e6c33893d0
|
core(help-text-fix): Add link to docs for mixed-content audit
|
[
{
"change_type": "MODIFY",
"diff": "@@ -28,7 +28,7 @@ class MixedContent extends Audit {\nfailureDescription: 'Some insecure resources can be upgraded to HTTPS',\nhelpText: `Mixed content warnings can prevent you from upgrading to HTTPS.\nThis audit shows which insecure resources this page uses that can be\n- upgraded to HTTPS. [Learn more]`,\n+ upgraded to HTTPS. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/mixed-content)`,\nrequiredArtifacts: ['devtoolsLogs', 'MixedContent'],\n};\n}\n",
"new_path": "lighthouse-core/audits/mixed-content.js",
"old_path": "lighthouse-core/audits/mixed-content.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(help-text-fix): Add link to docs for mixed-content audit (#4444)
| 1
|
core
|
help-text-fix
|
815,796
|
07.02.2018 15:29:35
| -3,600
|
d4404f77484a55a1abec44891dde66099a85acf8
|
feat: determine dropdownPosition automatically
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -121,7 +121,7 @@ map: {\n| loadingText | string | `Loading...` | no | Set custom text when for loading items |\n| [typeahead] | Subject | `-` | no | Custom autocomplete or filter. |\n| [disableVirtualScroll] | boolean | false | no | Disable virtual scroll |\n-| dropdownPosition | `bottom`,`top` | `bottom` | no | Set the dropdown position on open |\n+| dropdownPosition | `bottom`,`top`,`auto` | `bottom` | no | Set the dropdown position on open |\n| appendTo | string | null | no | Append drodown to body or any other element using css selector |\n| loading | boolean | `-` | no | you can set the loading state from the outside (e.g. async items loading) |\n| closeOnSelect | boolean | true | no | whether to close the menu when a value is selected |\n",
"new_path": "README.md",
"old_path": "README.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -16,7 +16,7 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';\n</ng-select>\n---\n- <hr>\n+ <br>\n<label>\n<input [(ngModel)]=\"dropdownPosition\" type=\"radio\" [value]=\"'top'\">\n@@ -28,6 +28,19 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';\n<input [(ngModel)]=\"dropdownPosition\" type=\"radio\" [value]=\"'bottom'\">\nbottom\n</label>\n+\n+ <hr>\n+ <p>\n+ Using \"Auto\" it still defaults to bottom, but if the dropdown would be out of view,\n+ it will automatically change the dropdownPosition to top.\n+ </p>\n+\n+ ---html,true\n+ <ng-select [dropdownPosition]=\"'auto'\"\n+ [searchable]=\"false\"\n+ [items]=\"cities\">\n+ </ng-select>\n+ ---\n`\n})\nexport class DropdownPositionsComponent {\n",
"new_path": "demo/app/examples/dropdown-positions.component.ts",
"old_path": "demo/app/examples/dropdown-positions.component.ts"
},
{
"change_type": "MODIFY",
"diff": "</span>\n</div>\n-<div class=\"ng-select-dropdown-outer\" [class.top]=\"dropdownPosition === 'top'\" [class.bottom]=\"dropdownPosition === 'bottom'\" [ngStyle]=\"{'visibility': isOpen ? 'visible': 'hidden'}\" #dropdownPanel>\n+<div class=\"ng-select-dropdown-outer\" [class.top]=\"currentDropdownPosition === 'top'\" [class.bottom]=\"currentDropdownPosition === 'bottom'\" [ngStyle]=\"{'visibility': isOpen ? 'visible': 'hidden'}\" #dropdownPanel>\n<div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\">\n<ng-container [ngTemplateOutlet]=\"headerTemplate\"></ng-container>\n</div>\n",
"new_path": "src/ng-select/ng-select.component.html",
"old_path": "src/ng-select/ng-select.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -721,22 +721,22 @@ describe('NgSelectComponent', function () {\n});\ndescribe('Dropdown position', () => {\n- let fixture: ComponentFixture<NgSelectBasicTestCmp>\n-\n- beforeEach(() => {\n- fixture = createTestingModule(\n+ it('should be set to `bottom` by default', () => {\n+ const fixture = createTestingModule(\nNgSelectBasicTestCmp,\n`<ng-select id=\"select\"></ng-select>`);\n- });\n- it('should be set to `bottom` by default', () => {\nconst classes = fixture.debugElement.query(By.css('ng-select')).classes;\nexpect(classes.bottom).toBeTruthy();\nexpect(classes.top).toBeFalsy();\n});\nit('should allow changing dropdown position', () => {\n- fixture.componentInstance.select.dropdownPosition = 'top';\n+ const fixture = createTestingModule(\n+ NgSelectBasicTestCmp,\n+ `<ng-select id=\"select\" [dropdownPosition]=\"dropdownPosition\"></ng-select>`);\n+\n+ fixture.componentInstance.dropdownPosition = 'top';\nfixture.detectChanges();\nconst classes = fixture.debugElement.query(By.css('ng-select')).classes;\n@@ -1442,6 +1442,7 @@ class NgSelectBasicTestCmp {\n@ViewChild(NgSelectComponent) select: NgSelectComponent;\nselectedCity: { id: number; name: string };\nmultiple = false;\n+ dropdownPosition = 'bottom';\ncities = [\n{ id: 1, name: 'Vilnius' },\n{ id: 2, name: 'Kaunas' },\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -54,8 +54,8 @@ const NG_SELECT_VALUE_ACCESSOR = {\nhost: {\n'role': 'dropdown',\n'class': 'ng-select',\n- '[class.top]': 'dropdownPosition === \"top\"',\n- '[class.bottom]': 'dropdownPosition === \"bottom\"',\n+ '[class.top]': 'currentDropdownPosition === \"top\"',\n+ '[class.bottom]': 'currentDropdownPosition === \"bottom\"',\n}\n})\nexport class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit, ControlValueAccessor {\n@@ -73,7 +73,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n@Input() addTagText: string;\n@Input() loadingText: string;\n@Input() clearAllText: string;\n- @Input() dropdownPosition: 'bottom' | 'top' = 'bottom';\n+ @Input() dropdownPosition: 'bottom' | 'top' | 'auto';\n@Input() appendTo: string;\n@Input() loading = false;\n@Input() closeOnSelect = true;\n@@ -117,6 +117,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nitemsList = new ItemsList(this);\nviewPortItems: NgOption[] = [];\nfilterValue: string = null;\n+ currentDropdownPosition: 'bottom' | 'top' | 'auto' = 'bottom';\nprivate _ngModel: any = null;\nprivate _defaultLabel = 'label';\n@@ -156,6 +157,9 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nif (changes.items) {\nthis._setItems(changes.items.currentValue || []);\n}\n+ if (changes.dropdownPosition) {\n+ this.currentDropdownPosition = changes.dropdownPosition.currentValue;\n+ }\n}\nngOnInit() {\n@@ -277,6 +281,9 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nthis._scrollToMarked();\nthis._focusSearchInput();\nthis.openEvent.emit();\n+ if (this.dropdownPosition === 'auto') {\n+ this._autoPositionDropdown();\n+ }\nif (this.appendTo) {\nthis._updateDropdownPosition();\n}\n@@ -503,13 +510,27 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nconst selectRect = select.getBoundingClientRect();\nconst offsetTop = selectRect.top - bodyRect.top;\nconst offsetLeft = selectRect.left - bodyRect.left;\n- const topDelta = this.dropdownPosition === 'bottom' ? selectRect.height : -dropdownPanel.clientHeight;\n+ const topDelta = this.currentDropdownPosition === 'bottom' ? selectRect.height : -dropdownPanel.clientHeight;\ndropdownPanel.style.top = offsetTop + topDelta + 'px';\ndropdownPanel.style.bottom = 'auto';\ndropdownPanel.style.left = offsetLeft + 'px';\ndropdownPanel.style.width = selectRect.width + 'px';\n}\n+ private _autoPositionDropdown() {\n+ const selectRect = this.elementRef.nativeElement.getBoundingClientRect();\n+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n+ const offsetTop = selectRect.top + window.pageYOffset;\n+ const height = selectRect.height;\n+ const dropdownHeight = this.dropdownPanel.nativeElement.getBoundingClientRect().height;\n+\n+ if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {\n+ this.currentDropdownPosition = 'top';\n+ } else {\n+ this.currentDropdownPosition = 'bottom';\n+ }\n+ }\n+\nprivate _validateWriteValue(value: any) {\nif (!this._isDefined(value)) {\nreturn;\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
feat: determine dropdownPosition automatically (#238)
closes #237
| 1
|
feat
| null |
791,940
|
07.02.2018 16:13:33
| 28,800
|
278d1e7c1aae3bc6b0477ca1058c1188d858c9eb
|
cli: Add --mixed-content flag for triggering the mixed content audit
|
[
{
"change_type": "MODIFY",
"diff": "@@ -17,6 +17,8 @@ const log = require('lighthouse-logger');\n// @ts-ignore\nconst perfOnlyConfig = require('../lighthouse-core/config/perf.json');\n// @ts-ignore\n+const mixedContentConfig = require('../lighthouse-core/config/mixed-content.js');\n+// @ts-ignore\nconst pkg = require('../package.json');\nconst Sentry = require('../lighthouse-core/lib/sentry');\n@@ -56,6 +58,10 @@ if (cliFlags.configPath) {\nconfig = /** @type {!LH.Config} */ (require(cliFlags.configPath));\n} else if (cliFlags.perf) {\nconfig = /** @type {!LH.Config} */ (perfOnlyConfig);\n+} else if (cliFlags.mixedContent) {\n+ config = /** @type {!LH.Config} */ (mixedContentConfig);\n+ // The mixed-content audits require headless Chrome (https://crbug.com/764505).\n+ cliFlags.chromeFlags = `${cliFlags.chromeFlags} --headless`;\n}\n// set logging preferences\n",
"new_path": "lighthouse-cli/bin.js",
"old_path": "lighthouse-cli/bin.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -58,9 +58,9 @@ function getFlags(manualArgv) {\n.group(\n[\n- 'save-assets', 'list-all-audits', 'list-trace-categories',\n- 'additional-trace-categories', 'config-path', 'chrome-flags', 'perf', 'port',\n- 'hostname', 'max-wait-for-load', 'enable-error-reporting', 'gather-mode', 'audit-mode',\n+ 'save-assets', 'list-all-audits', 'list-trace-categories', 'additional-trace-categories',\n+ 'config-path', 'chrome-flags', 'perf', 'mixed-content', 'port', 'hostname',\n+ 'max-wait-for-load', 'enable-error-reporting', 'gather-mode', 'audit-mode',\n],\n'Configuration:')\n.describe({\n@@ -81,6 +81,7 @@ function getFlags(manualArgv) {\n'additional-trace-categories':\n'Additional categories to capture with the trace (comma-delimited).',\n'config-path': 'The path to the config JSON.',\n+ 'mixed-content': 'Use the mixed-content auditing configuration.',\n'chrome-flags':\n`Custom flags to pass to Chrome (space-delimited). For a full list of flags, see http://bit.ly/chrome-flags\nAdditionally, use the CHROME_PATH environment variable to use a specific Chrome binary. Requires Chromium version 54.0 or later. If omitted, any detected Chrome Canary or Chrome stable will be used.`,\n@@ -110,7 +111,7 @@ function getFlags(manualArgv) {\n'disable-storage-reset', 'disable-device-emulation', 'disable-cpu-throttling',\n'disable-network-throttling', 'save-assets', 'list-all-audits',\n'list-trace-categories', 'perf', 'view', 'verbose', 'quiet', 'help',\n- 'gather-mode', 'audit-mode',\n+ 'gather-mode', 'audit-mode', 'mixed-content',\n])\n.choices('output', printer.getValidOutputOptions())\n// force as an array\n",
"new_path": "lighthouse-cli/cli-flags.js",
"old_path": "lighthouse-cli/cli-flags.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -30,7 +30,7 @@ const _PROTOCOL_TIMEOUT_EXIT_CODE = 67;\n*/\nfunction parseChromeFlags(flags = '') {\nconst parsed = yargsParser(\n- flags, {configuration: {'camel-case-expansion': false, 'boolean-negation': false}});\n+ flags.trim(), {configuration: {'camel-case-expansion': false, 'boolean-negation': false}});\nreturn Object\n.keys(parsed)\n",
"new_path": "lighthouse-cli/run.js",
"old_path": "lighthouse-cli/run.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -41,7 +41,6 @@ function lighthouse(url, flags = {}, configJSON) {\n// Use ConfigParser to generate a valid config file\nconst config = new Config(configJSON, flags.configPath);\n-\nconst connection = new ChromeProtocol(flags.port, flags.hostname);\n// kick off a lighthouse run\n",
"new_path": "lighthouse-core/index.js",
"old_path": "lighthouse-core/index.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -26,6 +26,7 @@ export interface Flags {\ngatherMode: boolean;\nconfigPath?: string;\nperf: boolean;\n+ mixedContent: boolean;\nverbose: boolean;\nquiet: boolean;\n}\n",
"new_path": "typings/externs.d.ts",
"old_path": "typings/externs.d.ts"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
cli: Add --mixed-content flag for triggering the mixed content audit (#4441)
| 1
|
cli
| null |
791,723
|
07.02.2018 18:40:04
| 28,800
|
2a9283e68b173db432dfa4805886b3fd6b1f48f2
|
docs(releasing): update details around tagging
|
[
{
"change_type": "MODIFY",
"diff": "@@ -72,17 +72,25 @@ echo \"Test the lighthouse-viewer build\"\n# * Update changelog *\ngit fetch --tags\nyarn changelog\n-# add new contributors, e.g. from\n-# git shortlog -s -e -n v2.3.0..HEAD\n+# add new contributors, e.g. from git shortlog -s -e -n v2.3.0..HEAD\n+# and https://github.com/GoogleChrome/lighthouse/graphs/contributors\n+echo \"Edit the changelog for readability and brevity\"\n# * Put up the PR *\necho \"Branch and commit the version bump.\"\ngit checkout -b bumpv240\ngit commit -am \"2.4.0\"\n-git tag -a v2.4.0 -m \"v2.4.0\"\necho \"Generate a PR and get it merged.\"\n+echo \"Once it's merged, pull master and tag the (squashed) commit\"\n+git tag -a v2.4.0 -m \"v2.4.0\"\n+git push --tags\n+\n+\n# * Deploy-time *\n+echo \"Rebuild extension and viewer to get the latest, tagged master commit\"\n+yarn build-viewer; yarn build-extension;\n+\ncd lighthouse-extension; gulp package; cd ..\necho \"Go here: https://chrome.google.com/webstore/developer/edit/blipmdconlkpinefehnmjammfjpmpbjk \"\necho \"Upload the package zip to CWS dev dashboard\"\n",
"new_path": "docs/releasing.md",
"old_path": "docs/releasing.md"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
docs(releasing): update details around tagging
| 1
|
docs
|
releasing
|
135,503
|
07.02.2018 19:20:33
| 0
|
d063f653b858954e61ef926975277a50febd7229
|
docs(travis-cli): correct spelling of intented
|
[
{
"change_type": "MODIFY",
"diff": "@@ -98,7 +98,7 @@ async function stash() {\nfunction validate() {\nif (process.env.CI !== 'true' || process.env.TRAVIS !== 'true') {\nthrow new Error(\n- `@commitlint/travis-cli is inteded to be used on Travis CI`\n+ `@commitlint/travis-cli is intended to be used on Travis CI`\n);\n}\n",
"new_path": "@commitlint/travis-cli/src/cli.js",
"old_path": "@commitlint/travis-cli/src/cli.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -32,7 +32,7 @@ test('should throw when not on travis ci', async t => {\nawait t.throws(\nbin({env}),\n- /@commitlint\\/travis-cli is inteded to be used on Travis CI/\n+ /@commitlint\\/travis-cli is intended to be used on Travis CI/\n);\n});\n",
"new_path": "@commitlint/travis-cli/src/cli.test.js",
"old_path": "@commitlint/travis-cli/src/cli.test.js"
}
] |
TypeScript
|
MIT License
|
conventional-changelog/commitlint
|
docs(travis-cli): correct spelling of intented
Signed-off-by: Adam Moss <adam.moss@bcs.org.uk>
| 1
|
docs
|
travis-cli
|
791,809
|
08.02.2018 00:25:51
| -7,200
|
3131106fefbb572ecc890f5821b6069bab03f939
|
core(response-compression): Exclude binary files from auditing
|
[
{
"change_type": "MODIFY",
"diff": "@@ -14,6 +14,7 @@ const Gatherer = require('../gatherer');\nconst gzip = require('zlib').gzip;\nconst compressionTypes = ['gzip', 'br', 'deflate'];\n+const binaryMimeTypes = ['image', 'audio', 'video'];\nconst CHROME_EXTENSION_PROTOCOL = 'chrome-extension:';\nclass ResponseCompression extends Gatherer {\n@@ -25,7 +26,11 @@ class ResponseCompression extends Gatherer {\nconst unoptimizedResponses = [];\nnetworkRecords.forEach(record => {\n- const isTextBasedResource = record.resourceType() && record.resourceType().isTextType();\n+ const mimeType = record.mimeType;\n+ const resourceType = record.resourceType();\n+\n+ const isBinaryResource = mimeType && binaryMimeTypes.some(type => mimeType.startsWith(type));\n+ const isTextBasedResource = !isBinaryResource && resourceType && resourceType.isTextType();\nconst isChromeExtensionResource = record.url.startsWith(CHROME_EXTENSION_PROTOCOL);\nif (!isTextBasedResource || !record.resourceSize || !record.finished ||\n",
"new_path": "lighthouse-core/gather/gatherers/dobetterweb/response-compression.js",
"old_path": "lighthouse-core/gather/gatherers/dobetterweb/response-compression.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -65,7 +65,7 @@ const traceData = {\n_url: 'http://google.com/index.json',\n_statusCode: 304, // ignore for being a cache not modified response\n_mimeType: 'application/json',\n- _requestId: 2,\n+ _requestId: 22,\n_resourceSize: 7,\n_transferSize: 7,\n_resourceType: {\n@@ -79,7 +79,7 @@ const traceData = {\n_url: 'http://google.com/other.json',\n_statusCode: 200,\n_mimeType: 'application/json',\n- _requestId: 2,\n+ _requestId: 23,\n_resourceSize: 7,\n_transferSize: 8,\n_resourceType: {\n@@ -92,7 +92,7 @@ const traceData = {\n{\n_url: 'http://google.com/index.jpg',\n_statusCode: 200,\n- _mimeType: 'images/jpg',\n+ _mimeType: 'image/jpg',\n_requestId: 3,\n_resourceSize: 10,\n_transferSize: 10,\n@@ -103,6 +103,20 @@ const traceData = {\ncontent: 'aaaaaaaaaa',\nfinished: true,\n},\n+ {\n+ _url: 'http://google.com/helloworld.mp4',\n+ _statusCode: 200,\n+ _mimeType: 'video/mp4',\n+ _requestId: 4,\n+ _resourceSize: 100,\n+ _transferSize: 100,\n+ _resourceType: {\n+ _isTextType: false,\n+ },\n+ _responseHeaders: [],\n+ content: 'bbbbbbbb',\n+ finished: true,\n+ },\n],\n};\n",
"new_path": "lighthouse-core/test/gather/gatherers/dobetterweb/response-compression-test.js",
"old_path": "lighthouse-core/test/gather/gatherers/dobetterweb/response-compression-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(response-compression): Exclude binary files from auditing (#4144)
| 1
|
core
|
response-compression
|
679,913
|
08.02.2018 03:19:15
| 0
|
68f8fc23161e7bbcc8f848b24eeedaf0dd61944d
|
feat(checks): add new predicates, refactor existing
add: isBlob, isEven, isFile, isInRange, isOdd, isRegExp
add: hasMinLength, hasMaxLength
update: existsAndNotNull, isArray, isArrayLike
|
[
{
"change_type": "MODIFY",
"diff": "export function existsAndNotNull(x: any) {\n- return !(x === undefined || x === null);\n+ return x != null;\n}\n",
"new_path": "packages/checks/src/exists-not-null.ts",
"old_path": "packages/checks/src/exists-not-null.ts"
},
{
"change_type": "ADD",
"diff": "+export function hasMaxLength(len: number, x: ArrayLike<any>) {\n+ return x != null && x.length <= len;\n+}\n",
"new_path": "packages/checks/src/has-max-length.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export function hasMinLength(len: number, x: ArrayLike<any>) {\n+ return x != null && x.length >= len;\n+}\n",
"new_path": "packages/checks/src/has-min-length.ts",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "export * from \"./exists-not-null\";\nexport * from \"./exists\";\nexport * from \"./has-crypto\";\n+export * from \"./has-max-length\";\n+export * from \"./has-min-length\";\nexport * from \"./has-wasm\";\nexport * from \"./has-webgl\";\nexport * from \"./has-websocket\";\nexport * from \"./implements-function\";\nexport * from \"./is-array\";\nexport * from \"./is-arraylike\";\n+export * from \"./is-blob\";\nexport * from \"./is-boolean\";\nexport * from \"./is-chrome\";\n+export * from \"./is-even\";\nexport * from \"./is-false\";\n+export * from \"./is-file\";\nexport * from \"./is-firefox\";\nexport * from \"./is-function\";\nexport * from \"./is-ie\";\n+export * from \"./is-in-range\";\nexport * from \"./is-int32\";\nexport * from \"./is-iterable\";\nexport * from \"./is-mobile\";\n@@ -21,8 +27,10 @@ export * from \"./is-node\";\nexport * from \"./is-null\";\nexport * from \"./is-number\";\nexport * from \"./is-object\";\n+export * from \"./is-odd\";\nexport * from \"./is-plain-object\";\nexport * from \"./is-positive\";\n+export * from \"./is-regexp\";\nexport * from \"./is-safari\";\nexport * from \"./is-string\";\nexport * from \"./is-symbol\";\n",
"new_path": "packages/checks/src/index.ts",
"old_path": "packages/checks/src/index.ts"
},
{
"change_type": "MODIFY",
"diff": "-export function isArray(x: any): x is Array<any> {\n- return x != null && x.constructor === Array;\n-}\n+export const isArray = Array.isArray;\n",
"new_path": "packages/checks/src/is-array.ts",
"old_path": "packages/checks/src/is-array.ts"
},
{
"change_type": "MODIFY",
"diff": "export function isArrayLike(x: any): x is ArrayLike<any> {\n- return x != null && (x.constructor === Array || x.length !== undefined);\n+ return Array.isArray(x) || (x != null && x.length !== undefined);\n}\n",
"new_path": "packages/checks/src/is-arraylike.ts",
"old_path": "packages/checks/src/is-arraylike.ts"
},
{
"change_type": "ADD",
"diff": "+export function isBlob(x: any): x is Blob {\n+ return x instanceof Blob;\n+}\n",
"new_path": "packages/checks/src/is-blob.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export function isEven(x: number) {\n+ return (x % 2) === 0;\n+}\n",
"new_path": "packages/checks/src/is-even.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export function isFile(x: any): x is File {\n+ return x instanceof File;\n+}\n",
"new_path": "packages/checks/src/is-file.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export function isInRange(min: number, max: number, x: number) {\n+ return x >= min && x <= max;\n+}\n\\ No newline at end of file\n",
"new_path": "packages/checks/src/is-in-range.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export function isOdd(x: number) {\n+ return (x % 2) === 1;\n+}\n",
"new_path": "packages/checks/src/is-odd.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export function isRegExp(x: any): x is RegExp {\n+ return x instanceof RegExp;\n+}\n",
"new_path": "packages/checks/src/is-regexp.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(checks): add new predicates, refactor existing
- add: isBlob, isEven, isFile, isInRange, isOdd, isRegExp
- add: hasMinLength, hasMaxLength
- update: existsAndNotNull, isArray, isArrayLike
| 1
|
feat
|
checks
|
679,913
|
08.02.2018 03:20:56
| 0
|
445c857547117bd1238ed3b2f8707b878e98b303
|
refactor(transducers): re-use even/odd from
|
[
{
"change_type": "MODIFY",
"diff": "-export function even(x: number) {\n- return (x % 2) === 0;\n-}\n+export { isEven as even } from \"@thi.ng/checks/is-even\";\n",
"new_path": "packages/transducers/src/func/even.ts",
"old_path": "packages/transducers/src/func/even.ts"
},
{
"change_type": "MODIFY",
"diff": "-export function odd(x: number) {\n- return (x % 2) === 1;\n-}\n+export { isOdd as odd } from \"@thi.ng/checks/is-odd\";\n",
"new_path": "packages/transducers/src/func/odd.ts",
"old_path": "packages/transducers/src/func/odd.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(transducers): re-use even/odd from @thi.ng/checks
| 1
|
refactor
|
transducers
|
815,810
|
08.02.2018 07:29:18
| -3,600
|
f50065429248f3720d843e415a2d51bc0e04cc35
|
feat: allow to set max selected items using multiple
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -112,6 +112,7 @@ map: {\n| [markFirst] | boolean | `true` | no | Marks first item as focused when opening/filtering. Default `true`|\n| [searchable] | boolean | `true` | no | Allow to search for value. Default `true`|\n| multiple | boolean | `false` | no | Allows to select multiple items. |\n+| maxSelectedItems | number | none | no | When multiple = true, allows to set a limit number of selection. |\n| [addTag] | Function or boolean | `false` | no | Allows to create custom options. Using boolean simply adds tag with value as bindLabel. If you want custom properties add function which returns object. |\n| placeholder | string | `-` | no | Placeholder text. |\n| notFoundText | string | `No items found` | no | Set custom text when filter returns empty result |\n",
"new_path": "README.md",
"old_path": "README.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -23,14 +23,33 @@ import { DataService } from '../shared/data.service';\n</div>\n<hr/>\n- <label>Disabled multiple elements</label>\n+ <label>Select multiple elements with a limit number of selections (e.g 3)</label>\n---html,true\n<ng-select\n[items]=\"people$2 | async\"\n+ [multiple]=\"true\"\n+ [maxSelectedItems]=\"3\"\n+ bindLabel=\"name\"\n+ [(ngModel)]=\"selectedPeople2\">\n+ </ng-select>\n+ ---\n+ <div class=\"mt-3\">\n+ Selected value: <br />\n+ <ul>\n+ <li *ngFor=\"let item of selectedPeople1\">{{item.name}}</li>\n+ </ul>\n+ <button (click)=\"clearModel()\" class=\"btn btn-secondary btn-sm\">Clear model</button>\n+ </div>\n+ <hr/>\n+\n+ <label>Disabled multiple elements</label>\n+ ---html,true\n+ <ng-select\n+ [items]=\"people$3 | async\"\nbindLabel=\"name\"\n[multiple]=\"true\"\n[disabled]=\"disable\"\n- [(ngModel)]=\"selectedPeople2\">\n+ [(ngModel)]=\"selectedPeople3\">\n</ng-select>\n---\n<br>\n@@ -64,6 +83,9 @@ export class SelectMultiComponent {\npeople$2: Observable<any[]>;\nselectedPeople2 = [];\n+\n+ people$3: Observable<any[]>;\n+ selectedPeople3 = [];\ndisable = true;\ngithubUsers$: Observable<any[]>;\n@@ -74,18 +96,23 @@ export class SelectMultiComponent {\nngOnInit() {\nthis.people$1 = this.dataService.getPeople();\nthis.people$2 = this.dataService.getPeople();\n+ this.people$3 = this.dataService.getPeople();\nthis.githubUsers$ = this.dataService.getGithubAccounts('anjm');\n- this.selectedPeople2 = [\n+ this.selectedPeople3 = [\n{ id: '5a15b13c2340978ec3d2c0ea', name: 'Rochelle Estes' },\n{ id: '5a15b13c728cd3f43cc0fe8a', name: 'Marquez Nolan' }\n];\n}\n- clearModel() {\n+ clearModel1() {\nthis.selectedPeople1 = [];\n}\n+ clearModel2() {\n+ this.selectedPeople2 = [];\n+ }\n+\n}\n",
"new_path": "demo/app/examples/multi.component.ts",
"old_path": "demo/app/examples/multi.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -37,7 +37,7 @@ export class ItemsList {\n}\nselect(item: NgOption) {\n- if (item.selected) {\n+ if (item.selected || this.maxItemsSelected()) {\nreturn;\n}\nif (!this._ngSelect.multiple) {\n@@ -47,6 +47,10 @@ export class ItemsList {\nitem.selected = true;\n}\n+ maxItemsSelected(): boolean {\n+ return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this._selected.length;\n+ }\n+\nfindItem(value: any): NgOption {\nif (this._ngSelect.bindValue) {\nreturn this._items.find(item => this.resolveNested(item.value, this._ngSelect.bindValue) === value);\n",
"new_path": "src/ng-select/items-list.ts",
"old_path": "src/ng-select/items-list.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -887,6 +887,45 @@ describe('NgSelectComponent', function () {\n});\n});\n+ describe('Multiple with max limit of selection', () => {\n+ let fixture: ComponentFixture<NgSelectBasicTestCmp>;\n+ let arrowIcon: DebugElement = null;\n+\n+ beforeEach(() => {\n+ fixture = createTestingModule(\n+ NgSelectBasicTestCmp,\n+ `<ng-select [items]=\"cities\"\n+ bindLabel=\"name\"\n+ bindValue=\"this\"\n+ placeholder=\"select value\"\n+ [(ngModel)]=\"selectedCity\"\n+ [multiple]=\"true\"\n+ [maxSelectedItems]=\"2\">\n+ </ng-select>`);\n+ arrowIcon = fixture.debugElement.query(By.css('.ng-arrow-zone'));\n+ });\n+\n+ it('should be able to select only two elements', fakeAsync(() => {\n+ selectOption(fixture, KeyCode.ArrowDown, 0);\n+ selectOption(fixture, KeyCode.ArrowDown, 1);\n+ selectOption(fixture, KeyCode.ArrowDown, 1);\n+ tickAndDetectChanges(fixture);\n+ expect((<NgOption[]>fixture.componentInstance.select.selectedItems).length).toBe(2);\n+ }));\n+\n+ it('should click on arrow be disabled when maximum of items is reached', fakeAsync (() => {\n+ const clickArrow = () => arrowIcon.triggerEventHandler('click', { stopPropagation: () => { } });\n+ selectOption(fixture, KeyCode.ArrowDown, 0);\n+ selectOption(fixture, KeyCode.ArrowDown, 1);\n+ tickAndDetectChanges(fixture);\n+ // open\n+ clickArrow();\n+ tickAndDetectChanges(fixture);\n+ expect(fixture.componentInstance.select.isOpen).toBe(false);\n+ expect((<NgOption[]>fixture.componentInstance.select.selectedItems).length).toBe(2);\n+ }));\n+ });\n+\ndescribe('Tagging', () => {\nit('should select default tag', fakeAsync(() => {\nlet fixture = createTestingModule(\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -77,6 +77,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n@Input() appendTo: string;\n@Input() loading = false;\n@Input() closeOnSelect = true;\n+ @Input() maxSelectedItems: number;\n@Input() @HostBinding('class.typeahead') typeahead: Subject<string>;\n@Input() @HostBinding('class.ng-multiple') multiple = false;\n@Input() @HostBinding('class.taggable') addTag: boolean | ((term: string) => NgOption) = false;\n@@ -273,7 +274,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\n}\nopen() {\n- if (this.isDisabled || this.isOpen) {\n+ if (this.isDisabled || this.isOpen || this.itemsList.maxItemsSelected()) {\nreturn;\n}\nthis.isOpen = true;\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
feat: allow to set max selected items using multiple (#239)
closes #181
| 1
|
feat
| null |
791,690
|
08.02.2018 10:57:28
| 28,800
|
f9cdfc5d97eed400ccd59ffe0ed77baf5cd0c186
|
core(computed-artifact): use deep equality over strict
|
[
{
"change_type": "MODIFY",
"diff": "*/\n'use strict';\n+const ArbitraryEqualityMap = require('../../lib/arbitrary-equality-map');\n+\nclass ComputedArtifact {\n/**\n* @param {!ComputedArtifacts} allComputedArtifacts\n*/\nconstructor(allComputedArtifacts) {\n/** @private {!Map} */\n- this._cache = new Map();\n+ this._cache = new ArbitraryEqualityMap();\n+ this._cache.setEqualityFn(ArbitraryEqualityMap.deepEquals);\n/** @private {!ComputedArtifacts} */\nthis._allComputedArtifacts = allComputedArtifacts;\n@@ -35,74 +38,6 @@ class ComputedArtifact {\nthrow new Error('compute_() not implemented for computed artifact ' + this.name);\n}\n- /**\n- * This is a helper function for performing cache operations and is responsible for maintaing the\n- * internal cache structure. This function accepts a path of artifacts, used to find the correct\n- * nested cache object, and an operation to perform on that cache with the final key.\n- *\n- * The cache is structured with the first argument occupying the keys of the toplevel cache that point\n- * to the Map of keys for the second argument and so forth until the 2nd to last argument's Map points\n- * to result values rather than further nesting. In the simplest case of a single argument, there\n- * is no nesting and the keys point directly to result values.\n- *\n- * Map(\n- * argument1A -> Map(\n- * argument2A -> result1A2A\n- * argument2B -> result1A2B\n- * )\n- * argument1B -> Map(\n- * argument2A -> result1B2A\n- * )\n- * )\n- *\n- * @param {!Array<*>} artifacts\n- * @param {function(!Map, *)} cacheOperation\n- */\n- _performCacheOperation(artifacts, cacheOperation) {\n- artifacts = artifacts.slice();\n-\n- let cache = this._cache;\n- while (artifacts.length > 1) {\n- const nextKey = artifacts.shift();\n- if (cache.has(nextKey)) {\n- cache = cache.get(nextKey);\n- } else {\n- const nextCache = new Map();\n- cache.set(nextKey, nextCache);\n- cache = nextCache;\n- }\n- }\n-\n- return cacheOperation(cache, artifacts.shift());\n- }\n-\n- /**\n- * Performs a cache.has operation, see _performCacheOperation for more.\n- * @param {!Array<*>} artifacts\n- * @return {boolean}\n- */\n- _cacheHas(artifacts) {\n- return this._performCacheOperation(artifacts, (cache, key) => cache.has(key));\n- }\n-\n- /**\n- * Performs a cache.get operation, see _performCacheOperation for more.\n- * @param {!Array<*>} artifacts\n- * @return {*}\n- */\n- _cacheGet(artifacts) {\n- return this._performCacheOperation(artifacts, (cache, key) => cache.get(key));\n- }\n-\n- /**\n- * Performs a cache.set operation, see _performCacheOperation for more.\n- * @param {!Array<*>} artifacts\n- * @param {*} result\n- */\n- _cacheSet(artifacts, result) {\n- return this._performCacheOperation(artifacts, (cache, key) => cache.set(key, result));\n- }\n-\n/**\n* Asserts that the length of the array is the same as the number of inputs the class expects\n* @param {!Array<*>} artifacts\n@@ -125,13 +60,13 @@ class ComputedArtifact {\n*/\nrequest(...artifacts) {\nthis._assertCorrectNumberOfArtifacts(artifacts);\n- if (this._cacheHas(artifacts)) {\n- return Promise.resolve(this._cacheGet(artifacts));\n+ if (this._cache.has(artifacts)) {\n+ return Promise.resolve(this._cache.get(artifacts));\n}\nconst artifactPromise = Promise.resolve()\n.then(_ => this.compute_(...artifacts, this._allComputedArtifacts));\n- this._cacheSet(artifacts, artifactPromise);\n+ this._cache.set(artifacts, artifactPromise);\nreturn artifactPromise;\n}\n",
"new_path": "lighthouse-core/gather/computed/computed-artifact.js",
"old_path": "lighthouse-core/gather/computed/computed-artifact.js"
},
{
"change_type": "ADD",
"diff": "+/**\n+ * @license Copyright 2018 Google Inc. All Rights Reserved.\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n+ */\n+'use strict';\n+\n+const isEqual = require('lodash.isequal');\n+\n+/**\n+ * @fileoverview This class is designed to allow maps with arbitrary equality functions.\n+ * It is not meant to be performant and is well-suited to use cases where the number of entries is\n+ * likely to be small (like computed artifacts).\n+ */\n+module.exports = class ArbitraryEqualityMap {\n+ constructor() {\n+ this._equalsFn = (a, b) => a === b;\n+ this._entries = [];\n+ }\n+\n+ /**\n+ * @param {function():boolean} equalsFn\n+ */\n+ setEqualityFn(equalsFn) {\n+ this._equalsFn = equalsFn;\n+ }\n+\n+ has(key) {\n+ return this._findIndexOf(key) !== -1;\n+ }\n+\n+ get(key) {\n+ const entry = this._entries[this._findIndexOf(key)];\n+ return entry && entry.value;\n+ }\n+\n+ set(key, value) {\n+ let index = this._findIndexOf(key);\n+ if (index === -1) index = this._entries.length;\n+ this._entries[index] = {key, value};\n+ }\n+\n+ _findIndexOf(key) {\n+ for (let i = 0; i < this._entries.length; i++) {\n+ if (this._equalsFn(key, this._entries[i].key)) return i;\n+ }\n+\n+ return -1;\n+ }\n+\n+ /**\n+ * Determines whether two objects are deeply equal. Defers to lodash isEqual, but is kept here for\n+ * easy usage by consumers.\n+ * See https://lodash.com/docs/4.17.5#isEqual.\n+ * @param {*} objA\n+ * @param {*} objB\n+ * @return {boolean}\n+ */\n+ static deepEquals(objA, objB) {\n+ return isEqual(objA, objB);\n+ }\n+};\n",
"new_path": "lighthouse-core/lib/arbitrary-equality-map.js",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "@@ -47,20 +47,18 @@ describe('ComputedArtifact base class', () => {\n.then(_ => assert.throws(() => multiInputArtifact.request(1)));\n});\n- it('caches computed artifacts', () => {\n- const testComputedArtifact = new TestComputedArtifact();\n+ it('caches computed artifacts by strict equality', () => {\n+ const computedArtifact = new TestComputedArtifact();\n- const obj0 = {};\n- const obj1 = {};\n-\n- return testComputedArtifact.request(obj0).then(result => {\n+ return computedArtifact.request({x: 1}).then(result => {\nassert.equal(result, 0);\n- }).then(_ => testComputedArtifact.request(obj1)).then(result => {\n+ }).then(_ => computedArtifact.request({x: 2})).then(result => {\nassert.equal(result, 1);\n- }).then(_ => testComputedArtifact.request(obj0)).then(result => {\n+ }).then(_ => computedArtifact.request({x: 1})).then(result => {\nassert.equal(result, 0);\n- }).then(_ => testComputedArtifact.request(obj1)).then(result => {\n+ }).then(_ => computedArtifact.request({x: 2})).then(result => {\nassert.equal(result, 1);\n+ assert.equal(computedArtifact.computeCounter, 2);\n});\n});\n@@ -80,6 +78,7 @@ describe('ComputedArtifact base class', () => {\n.then(_ => assert.deepEqual(computedArtifact.lastArguments, [obj1, obj2, mockComputed]))\n.then(_ => computedArtifact.request(obj0, obj1))\n.then(result => assert.equal(result, 0))\n- .then(_ => assert.deepEqual(computedArtifact.lastArguments, [obj1, obj2, mockComputed]));\n+ .then(_ => assert.deepEqual(computedArtifact.lastArguments, [obj1, obj2, mockComputed]))\n+ .then(_ => assert.equal(computedArtifact.computeCounter, 2));\n});\n});\n",
"new_path": "lighthouse-core/test/gather/computed/computed-artifact-test.js",
"old_path": "lighthouse-core/test/gather/computed/computed-artifact-test.js"
},
{
"change_type": "ADD",
"diff": "+/**\n+ * @license Copyright 2018 Google Inc. All Rights Reserved.\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n+ */\n+'use strict';\n+\n+/* eslint-env mocha */\n+\n+const assert = require('assert');\n+const ArbitraryEqualityMap = require('../../lib/arbitrary-equality-map.js');\n+const trace = require('../fixtures/traces/progressive-app-m60.json');\n+\n+describe('ArbitraryEqualityMap', () => {\n+ it('creates a map', () => {\n+ const map = new ArbitraryEqualityMap();\n+ assert.equal(map.has(1), false);\n+ assert.equal(map.get(1), undefined);\n+ map.set(1, 2);\n+ assert.equal(map.has(1), true);\n+ assert.equal(map.get(1), 2);\n+ });\n+\n+ it('uses custom equality function', () => {\n+ // create a map which stores 1 value per type\n+ const map = new ArbitraryEqualityMap();\n+ map.setEqualityFn((a, b) => typeof a === typeof b);\n+ map.set(true, 1);\n+ map.set('foo', 2);\n+ map.set({}, 3);\n+ map.set('bar', 4);\n+\n+ assert.equal(map.has(1), false);\n+ assert.equal(map.has(false), true);\n+ assert.equal(map.has(''), true);\n+ assert.equal(map.has({x: 1}), true);\n+ assert.equal(map.get('foo'), 4);\n+ });\n+\n+ it('is not hella slow', () => {\n+ const map = new ArbitraryEqualityMap();\n+ map.setEqualityFn(ArbitraryEqualityMap.deepEquals);\n+ for (let i = 0; i < 100; i++) {\n+ map.set({i}, i);\n+ }\n+\n+ for (let j = 0; j < 1000; j++) {\n+ const i = j % 100;\n+ assert.equal(map.get({i}), i);\n+ }\n+ }).timeout(1000);\n+\n+ it('is fast for expected usage', () => {\n+ const map = new ArbitraryEqualityMap();\n+ map.setEqualityFn(ArbitraryEqualityMap.deepEquals);\n+ map.set([trace, {x: 0}], 'foo');\n+ map.set([trace, {x: 1}], 'bar');\n+\n+ for (let i = 0; i < 10000; i++) {\n+ assert.equal(map.get([trace, {x: i % 2}]), i % 2 ? 'bar' : 'foo');\n+ }\n+ }).timeout(1000);\n+});\n",
"new_path": "lighthouse-core/test/lib/arbitrary-equality-map-test.js",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "\"jpeg-js\": \"0.1.2\",\n\"js-library-detector\": \"^4.3.1\",\n\"lighthouse-logger\": \"^1.0.0\",\n+ \"lodash.isequal\": \"^4.5.0\",\n\"metaviewport-parser\": \"0.2.0\",\n\"mkdirp\": \"0.5.1\",\n\"opn\": \"4.0.2\",\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -2669,6 +2669,10 @@ lodash.isempty@^4.2.1:\nversion \"4.4.0\"\nresolved \"https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e\"\n+lodash.isequal@^4.5.0:\n+ version \"4.5.0\"\n+ resolved \"https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0\"\n+\nlodash.isplainobject@^4.0.4:\nversion \"4.0.6\"\nresolved \"https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb\"\n",
"new_path": "yarn.lock",
"old_path": "yarn.lock"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(computed-artifact): use deep equality over strict (#4409)
| 1
|
core
|
computed-artifact
|
791,699
|
08.02.2018 11:13:11
| -39,600
|
0f8b1a3541e044ef137a994837e8a9f41ad9aee8
|
core(assets): json stringify devtools log
|
[
{
"change_type": "MODIFY",
"diff": "@@ -286,7 +286,7 @@ function saveAssets(artifacts, audits, pathWithBasename) {\nfunction logAssets(artifacts, audits) {\nreturn prepareAssets(artifacts, audits).then(assets => {\nassets.map(data => {\n- log.log(`devtoolslog-${data.passName}.json`, data.devtoolsLog);\n+ log.log(`devtoolslog-${data.passName}.json`, JSON.stringify(data.devtoolsLog));\nconst traceIter = traceJsonGenerator(data.traceData);\nlet traceJson = '';\nfor (const trace of traceIter) {\n",
"new_path": "lighthouse-core/lib/asset-saver.js",
"old_path": "lighthouse-core/lib/asset-saver.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(assets): json stringify devtools log (#4457)
| 1
|
core
|
assets
|
791,690
|
08.02.2018 11:45:46
| 28,800
|
a517412528b2b491d5ae298843fd5bc0f97a6f03
|
core(tracing-processor): fix scheduleable task logic
|
[
{
"change_type": "MODIFY",
"diff": "@@ -79,7 +79,7 @@ class PageDependencyGraphArtifact extends ComputedArtifact {\n// Skip all trace events that aren't schedulable tasks with sizable duration\nif (\n- evt.name !== TracingProcessor.SCHEDULABLE_TASK_TITLE ||\n+ !TracingProcessor.isScheduleableTask(evt)||\n!evt.dur ||\nevt.dur < minimumEvtDur\n) {\n",
"new_path": "lighthouse-core/gather/computed/page-dependency-graph.js",
"old_path": "lighthouse-core/gather/computed/page-dependency-graph.js"
},
{
"change_type": "MODIFY",
"diff": "// first frame of the response.\nconst BASE_RESPONSE_LATENCY = 16;\nconst SCHEDULABLE_TASK_TITLE = 'TaskQueueManager::ProcessTaskFromWorkQueue';\n+const SCHEDULABLE_TASK_TITLE_ALT = 'ThreadControllerImpl::DoWork';\nclass TraceProcessor {\n/**\n@@ -153,7 +154,7 @@ class TraceProcessor {\nconst topLevelEvents = [];\n// note: mainThreadEvents is already sorted by event start\nfor (const event of tabTrace.mainThreadEvents) {\n- if (event.name !== SCHEDULABLE_TASK_TITLE || !event.dur) continue;\n+ if (!TraceProcessor.isScheduleableTask(event) || !event.dur) continue;\nconst start = (event.ts - tabTrace.navigationStartEvt.ts) / 1000;\nconst end = (event.ts + event.dur - tabTrace.navigationStartEvt.ts) / 1000;\n@@ -165,10 +166,19 @@ class TraceProcessor {\nduration: event.dur / 1000,\n});\n}\n- return topLevelEvents;\n+\n+ // There should *always* be at least one top level event, having 0 typically means something is\n+ // drastically wrong with the trace and would should just give up early and loudly.\n+ if (!topLevelEvents.length) {\n+ throw new Error('Could not find any top level events');\n}\n+\n+ return topLevelEvents;\n}\n-TraceProcessor.SCHEDULABLE_TASK_TITLE = SCHEDULABLE_TASK_TITLE;\n+ static isScheduleableTask(evt) {\n+ return evt.name === SCHEDULABLE_TASK_TITLE || evt.name === SCHEDULABLE_TASK_TITLE_ALT;\n+ }\n+}\nmodule.exports = TraceProcessor;\n",
"new_path": "lighthouse-core/lib/traces/tracing-processor.js",
"old_path": "lighthouse-core/lib/traces/tracing-processor.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(tracing-processor): fix scheduleable task logic (#4480)
| 1
|
core
|
tracing-processor
|
573,194
|
08.02.2018 16:17:46
| 28,800
|
35bd1c2b375ea70dc2b4a4549461ff59ff5e4ec4
|
fix: use `Buffer.isBuffer` instead of `util.isBuffer`.
|
[
{
"change_type": "MODIFY",
"diff": "var http = require('http');\nvar sprintf = require('util').format;\nvar url = require('url');\n-var util = require('util');\nvar assert = require('assert-plus');\nvar mime = require('mime');\n@@ -446,7 +445,7 @@ function patch(Response) {\n// Set Content-Type to application/json when\n// res.send is called with an Object instead of calling res.json\n- if (!type && typeof body === 'object' && !util.isBuffer(body)) {\n+ if (!type && typeof body === 'object' && !Buffer.isBuffer(body)) {\ntype = 'application/json';\n}\n",
"new_path": "lib/response.js",
"old_path": "lib/response.js"
}
] |
JavaScript
|
MIT License
|
restify/node-restify
|
fix: use `Buffer.isBuffer` instead of `util.isBuffer`. (#1593)
| 1
|
fix
| null |
573,207
|
08.02.2018 17:18:35
| 28,800
|
df04015439becae8e8c48a02cb6e1992d6040037
|
fix: Allow multiple unmerged set-cookie headers.
|
[
{
"change_type": "MODIFY",
"diff": "@@ -20,12 +20,10 @@ var InternalServerError = errors.InternalServerError;\n/**\n* @private\n* Headers that cannot be multi-values.\n- * @see #779, don't use comma separated values for set-cookie\n- * @see #986, don't use comma separated values for content-type\n- * @see http://tools.ietf.org/html/rfc6265#section-3\n+ * @see #779, multiple set-cookie values are allowed only as multiple headers.\n+ * @see #986, multiple content-type values / headers disallowed.\n*/\nvar HEADER_ARRAY_BLACKLIST = {\n- 'set-cookie': true,\n'content-type': true\n};\n@@ -188,7 +186,7 @@ function patch(Response) {\n* // => { 'x-foo': ['a', 'b'] }\n* @example\n* <caption>\n- * Note that certain headers like `set-cookie` and `content-type`\n+ * Note that certain headers like `content-type`\n* do not support multiple values, so calling `header()`\n* twice for those headers will\n* overwrite the existing value.\n",
"new_path": "lib/response.js",
"old_path": "lib/response.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -623,3 +623,16 @@ test('GH-1429: setting code with res.status not respected', function(t) {\nt.end();\n});\n});\n+\n+test('should support multiple set-cookie headers', function(t) {\n+ SERVER.get('/set-cookie', function(req, res, next) {\n+ res.header('Set-Cookie', 'a=1');\n+ res.header('Set-Cookie', 'b=2');\n+ res.send(null);\n+ });\n+\n+ CLIENT.get(join(LOCALHOST, '/set-cookie'), function(err, _, res) {\n+ t.equal(res.headers['set-cookie'].length, 2);\n+ t.end();\n+ });\n+});\n",
"new_path": "test/response.test.js",
"old_path": "test/response.test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -2088,11 +2088,14 @@ test('gh-779 set-cookie fields should never have commas', function(t) {\nCLIENT.get('/set-cookie', function(err, _, res) {\nt.ifError(err);\nt.equal(\n- res.headers['set-cookie'].length,\n- 1,\n- 'set-cookie header should only have 1 element'\n+ res.rawHeaders.filter(function(keyOrValue) {\n+ return keyOrValue === 'set-cookie';\n+ }).length,\n+ 2,\n+ 'multiple set-cookie headers should not be merged'\n);\n- t.equal(res.headers['set-cookie'], 'bar');\n+ t.equal(res.headers['set-cookie'][0], 'foo');\n+ t.equal(res.headers['set-cookie'][1], 'bar');\nt.end();\n});\n});\n",
"new_path": "test/server.test.js",
"old_path": "test/server.test.js"
}
] |
JavaScript
|
MIT License
|
restify/node-restify
|
fix: Allow multiple unmerged set-cookie headers. (#1570)
| 1
|
fix
| null |
573,184
|
08.02.2018 17:19:19
| 28,800
|
644c1980aa1a21b0c7fa9aa41e22df9af6eab31e
|
Fix: Return 444 status code for closed and aborted requests
|
[
{
"change_type": "MODIFY",
"diff": "@@ -47,12 +47,8 @@ function createMetrics(opts, callback) {\n// connection state can currently only have the following values:\n// 'close' | 'aborted' | undefined.\n//\n- // it is possible to get a 200 statusCode with a connectionState\n- // value of 'close' or 'aborted'. i.e., the client timed out,\n- // but restify thinks it \"sent\" a response. connectionState should\n- // always be the primary source of truth here, and check it first\n- // before consuming statusCode. otherwise, it may result in skewed\n- // metrics.\n+ // if the connection state is 'close' or 'aborted'\n+ // the status code will be set to 444\nconnectionState: req.connectionState && req.connectionState(),\nunfinishedRequests:\nopts.server.inflightRequests && opts.server.inflightRequests(),\n",
"new_path": "lib/plugins/metrics.js",
"old_path": "lib/plugins/metrics.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -826,7 +826,7 @@ function patch(Request) {\n* @memberof Request\n* @instance\n* @function connectionState\n- * @returns {String} connection state (`\"closed\"`, `\"aborted\"`)\n+ * @returns {String} connection state (`\"close\"`, `\"aborted\"`)\n*/\nRequest.prototype.connectionState = function connectionState() {\nvar self = this;\n",
"new_path": "lib/request.js",
"old_path": "lib/request.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -380,6 +380,14 @@ function patch(Response) {\n// Now lets try to derive values for optional arguments that we were not\n// provided, otherwise we choose sane defaults.\n+ // Request was aborted or closed. Override the status code\n+ if (\n+ self.req.connectionState() === 'close' ||\n+ self.req.connectionState() === 'aborted'\n+ ) {\n+ code = 444;\n+ }\n+\n// If the body is an error object and we were not given a status code,\n// try to derive it from the error object, otherwise default to 500\nif (!code && body instanceof Error) {\n",
"new_path": "lib/response.js",
"old_path": "lib/response.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -605,4 +605,74 @@ describe('audit logger', function() {\nassert.ifError(err);\n});\n});\n+\n+ it('should log 444 status code for aborted request', function(done) {\n+ SERVER.once(\n+ 'after',\n+ restify.plugins.auditLogger({\n+ log: bunyan.createLogger({\n+ name: 'audit',\n+ streams: [\n+ {\n+ level: 'info',\n+ stream: process.stdout\n+ }\n+ ]\n+ }),\n+ server: SERVER,\n+ event: 'after'\n+ })\n+ );\n+\n+ SERVER.once('audit', function(data) {\n+ assert.ok(data);\n+ assert.ok(data.req_id);\n+ assert.isNumber(data.latency);\n+ assert.equal(444, data.res.statusCode);\n+ done();\n+ });\n+\n+ SERVER.get('/audit', function(req, res, next) {\n+ req.emit('aborted');\n+ res.send();\n+ next();\n+ });\n+\n+ CLIENT.get('/audit', function(err, req, res) {});\n+ });\n+\n+ it('should log 444 for closed request', function(done) {\n+ SERVER.once(\n+ 'after',\n+ restify.plugins.auditLogger({\n+ log: bunyan.createLogger({\n+ name: 'audit',\n+ streams: [\n+ {\n+ level: 'info',\n+ stream: process.stdout\n+ }\n+ ]\n+ }),\n+ server: SERVER,\n+ event: 'after'\n+ })\n+ );\n+\n+ SERVER.once('audit', function(data) {\n+ assert.ok(data);\n+ assert.ok(data.req_id);\n+ assert.isNumber(data.latency);\n+ assert.equal(444, data.res.statusCode);\n+ done();\n+ });\n+\n+ SERVER.get('/audit', function(req, res, next) {\n+ req.emit('close');\n+ res.send();\n+ next();\n+ });\n+\n+ CLIENT.get('/audit', function(err, req, res) {});\n+ });\n});\n",
"new_path": "test/plugins/audit.test.js",
"old_path": "test/plugins/audit.test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -96,7 +96,7 @@ describe('request metrics plugin', function() {\nassert.equal(err.name, 'RequestCloseError');\nassert.isObject(metrics, 'metrics');\n- assert.equal(metrics.statusCode, 202);\n+ assert.equal(metrics.statusCode, 444);\nassert.isAtLeast(metrics.latency, 200);\nassert.equal(metrics.path, '/foo');\nassert.equal(metrics.method, 'GET');\n@@ -137,7 +137,7 @@ describe('request metrics plugin', function() {\nassert.equal(err.name, 'RequestAbortedError');\nassert.isObject(metrics, 'metrics');\n- assert.equal(metrics.statusCode, 202);\n+ assert.equal(metrics.statusCode, 444);\nassert.isAtLeast(metrics.latency, 200);\nassert.equal(metrics.path, '/foo');\nassert.equal(metrics.method, 'GET');\n@@ -155,7 +155,6 @@ describe('request metrics plugin', function() {\n});\nCLIENT.get('/foo?a=1', function(err, _, res) {\n- assert.ifError(err);\nreturn done();\n});\n});\n",
"new_path": "test/plugins/metrics.test.js",
"old_path": "test/plugins/metrics.test.js"
}
] |
JavaScript
|
MIT License
|
restify/node-restify
|
Fix: Return 444 status code for closed and aborted requests (#1579)
| 1
|
fix
| null |
791,723
|
08.02.2018 17:26:51
| 28,800
|
d8daeb3510cdc806ecf2361cd8807d3eea8ae3cd
|
tests(smokehouse): improve smokehouse failure output
|
[
{
"change_type": "MODIFY",
"diff": "@@ -209,23 +209,34 @@ function collateResults(actual, expected) {\n* @param {{category: string, equal: boolean, diff: ?Object, actual: boolean, expected: boolean}} assertion\n*/\nfunction reportAssertion(assertion) {\n+ const _toJSON = RegExp.prototype.toJSON;\n+ // eslint-disable-next-line no-extend-native\n+ RegExp.prototype.toJSON = RegExp.prototype.toString;\n+\nif (assertion.equal) {\nconsole.log(` ${log.greenify(log.tick)} ${assertion.category}: ` +\nlog.greenify(assertion.actual));\n} else {\nif (assertion.diff) {\nconst diff = assertion.diff;\n- let msg = ` ${log.redify(log.cross)} difference at ${diff.path}: `;\n- msg += log.redify(`found ${diff.actual}, expected ${diff.expected}\\n`);\n-\nconst fullActual = JSON.stringify(assertion.actual, null, 2).replace(/\\n/g, '\\n ');\n- msg += log.redify(' full found result: ' + fullActual);\n+ const msg = `\n+ ${log.redify(log.cross)} difference at ${log.bold}${diff.path}${log.reset}\n+ expected: ${JSON.stringify(diff.expected)}\n+ found: ${JSON.stringify(diff.actual)}\n+ found result: ${log.redify(fullActual)}\n+`;\nconsole.log(msg);\n} else {\n- console.log(` ${log.redify(log.cross)} ${assertion.category}: ` +\n- log.redify(`found ${assertion.actual}, expected ${assertion.expected}`));\n+ console.log(` ${log.redify(log.cross)} ${assertion.category}:\n+ expected: ${JSON.stringify(assertion.expected)}\n+ found: ${JSON.stringify(assertion.actual)}\n+`);\n}\n}\n+\n+ // eslint-disable-next-line no-extend-native\n+ RegExp.prototype.toJSON = _toJSON;\n}\n/**\n",
"new_path": "lighthouse-cli/test/smokehouse/smokehouse.js",
"old_path": "lighthouse-cli/test/smokehouse/smokehouse.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
tests(smokehouse): improve smokehouse failure output (#4482)
| 1
|
tests
|
smokehouse
|
815,746
|
08.02.2018 18:12:34
| -7,200
|
e264a15cffc9a091b1f9c5a242ba66e3c0329eaa
|
fix: focus only if filter value is not set
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -280,13 +280,15 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nthis.isOpen = true;\nthis.itemsList.markSelectedOrDefault(this.markFirst);\nthis._scrollToMarked();\n- this._focusSearchInput();\nthis.openEvent.emit();\n+ if (!this.filterValue) {\n+ this._focusSearchInput();\n+ }\nif (this.dropdownPosition === 'auto') {\nthis._autoPositionDropdown();\n}\nif (this.appendTo) {\n- this._updateDropdownPosition();\n+ this._updateAppendedDropdownPosition();\n}\n}\n@@ -377,8 +379,8 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nif (!this.searchable) {\nreturn;\n}\n- this.open();\nthis.filterValue = term;\n+ this.open();\nif (this._isTypeahead) {\nthis._typeaheadLoading = true;\n@@ -483,7 +485,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nprivate _handleDocumentResize() {\nconst handler = () => {\nif (this.appendTo && this.isOpen) {\n- this._updateDropdownPosition();\n+ this._updateAppendedDropdownPosition();\n}\n};\n@@ -501,10 +503,10 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nparent.appendChild(this.dropdownPanel.nativeElement);\n}\nthis._handleDocumentResize();\n- this._updateDropdownPosition();\n+ this._updateAppendedDropdownPosition();\n}\n- private _updateDropdownPosition() {\n+ private _updateAppendedDropdownPosition() {\nconst select: HTMLElement = this.elementRef.nativeElement;\nconst dropdownPanel: HTMLElement = this.dropdownPanel.nativeElement;\nconst bodyRect = document.body.getBoundingClientRect();\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: focus only if filter value is not set (#244)
closes #242
| 1
|
fix
| null |
815,746
|
08.02.2018 18:13:06
| -7,200
|
7f346d12c5fff55f4c1dfdef4db4611675b9110c
|
chore(release): 0.20.1
|
[
{
"change_type": "MODIFY",
"diff": "All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n+<a name=\"0.20.1\"></a>\n+## [0.20.1](https://github.com/ng-select/ng-select/compare/v0.20.0...v0.20.1) (2018-02-08)\n+\n+\n+### Bug Fixes\n+\n+* focus only if filter value is not set ([#244](https://github.com/ng-select/ng-select/issues/244)) ([e264a15](https://github.com/ng-select/ng-select/commit/e264a15)), closes [#242](https://github.com/ng-select/ng-select/issues/242)\n+\n+\n+\n<a name=\"0.20.0\"></a>\n# [0.20.0](https://github.com/ng-select/ng-select/compare/v0.19.0...v0.20.0) (2018-02-08)\n",
"new_path": "CHANGELOG.md",
"old_path": "CHANGELOG.md"
},
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"@ng-select/ng-select\",\n- \"version\": \"0.20.0\",\n+ \"version\": \"0.20.1\",\n\"description\": \"Angular ng-select - All in One UI Select, Multiselect and Autocomplete\",\n\"author\": \"@ng-select/ng-select\",\n\"license\": \"MIT\",\n",
"new_path": "src/package.json",
"old_path": "src/package.json"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
chore(release): 0.20.1
| 1
|
chore
|
release
|
791,676
|
08.02.2018 19:45:55
| -3,600
|
b57a59d46d8eb7f4e7655253d9becba470c3c14a
|
core(webfonts): patch fonts gatherer to handle missing font item
|
[
{
"change_type": "MODIFY",
"diff": "@@ -146,7 +146,7 @@ class Fonts extends Gatherer {\n).then(([loadedFonts, fontFaces]) => {\nreturn loadedFonts.map(fontFace => {\nconst fontFaceItem = this._findSameFontFamily(fontFace, fontFaces);\n- fontFace.src = fontFaceItem.src || [];\n+ fontFace.src = (fontFaceItem && fontFaceItem.src) || [];\nreturn fontFace;\n});\n",
"new_path": "lighthouse-core/gather/gatherers/fonts.js",
"old_path": "lighthouse-core/gather/gatherers/fonts.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -97,4 +97,22 @@ describe('Fonts gatherer', () => {\nassert.ok(artifact);\n});\n});\n+\n+ // some stylesheets are loaded by import rules. document.stylesheets do not capture these.\n+ // this means we can't find the src of a webfont.\n+ it('shouldn\\'t break when no font-face rules are found', function() {\n+ return fontsGatherer.afterPass({\n+ driver: {\n+ evaluateAsync: (code) => {\n+ if (code.includes('getAllLoadedFonts')) {\n+ return Promise.resolve(openSansFontFaces);\n+ } else {\n+ return Promise.resolve([]);\n+ }\n+ },\n+ },\n+ }).then(artifact => {\n+ assert.ok(artifact);\n+ });\n+ });\n});\n",
"new_path": "lighthouse-core/test/gather/gatherers/fonts-test.js",
"old_path": "lighthouse-core/test/gather/gatherers/fonts-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(webfonts): patch fonts gatherer to handle missing font item (#4465)
| 1
|
core
|
webfonts
|
573,185
|
09.02.2018 02:18:15
| -3,600
|
656e60e03d5fe2b011f8b2198178bc22d749b21f
|
fix: add support for secureOptions in createServer
|
[
{
"change_type": "MODIFY",
"diff": "@@ -162,7 +162,8 @@ function Server(options) {\npassphrase: self.passphrase,\nrejectUnauthorized: options.rejectUnauthorized,\nrequestCert: options.requestCert,\n- ciphers: options.ciphers\n+ ciphers: options.ciphers,\n+ secureOptions: options.secureOptions\n});\n} else if (options.httpsServerOptions) {\nthis.server = https.createServer(options.httpsServerOptions);\n",
"new_path": "lib/server.js",
"old_path": "lib/server.js"
}
] |
JavaScript
|
MIT License
|
restify/node-restify
|
fix: add support for secureOptions in createServer (#1575)
| 1
|
fix
| null |
791,690
|
09.02.2018 07:12:48
| 28,800
|
9825c6c5e85186857b340628db1fb94666ca79ee
|
core(fonts): fix infinite loop
|
[
{
"change_type": "MODIFY",
"diff": "'use strict';\nconst Gatherer = require('./gatherer');\n+const Sentry = require('../../lib/sentry');\nconst fontFaceDescriptors = [\n'display',\n'family',\n@@ -119,7 +120,7 @@ function getFontFaceFromStylesheets() {\npromises.push(Promise.resolve(getSheetsFontFaces(stylesheet)));\n}\n} catch (err) {\n- promises.push(loadStylesheetWithCORS(stylesheet.ownerNode));\n+ promises.push({err: {message: err.message, stack: err.stack}});\n}\n}\n// Flatten results\n@@ -145,11 +146,18 @@ class Fonts extends Gatherer {\n]\n).then(([loadedFonts, fontFaces]) => {\nreturn loadedFonts.map(fontFace => {\n+ if (fontFace.err) {\n+ const err = new Error(fontFace.err.message);\n+ err.stack = fontFace.err.stack;\n+ Sentry.captureException(err, {tags: {gatherer: 'Fonts'}, level: 'warning'});\n+ return null;\n+ }\n+\nconst fontFaceItem = this._findSameFontFamily(fontFace, fontFaces);\nfontFace.src = (fontFaceItem && fontFaceItem.src) || [];\nreturn fontFace;\n- });\n+ }).filter(Boolean);\n});\n}\n}\n",
"new_path": "lighthouse-core/gather/gatherers/fonts.js",
"old_path": "lighthouse-core/gather/gatherers/fonts.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(fonts): fix infinite loop (#4488)
| 1
|
core
|
fonts
|
791,690
|
09.02.2018 07:13:07
| 28,800
|
c3620b18e4ecf880763594f6cfcb1c2bc4783e40
|
core(responsive-images): move images with no dimensions to offscreen audit
|
[
{
"change_type": "MODIFY",
"diff": "@@ -103,6 +103,12 @@ setTimeout(() => {\n<!-- FAIL(offscreen): image is offscreen -->\n<img style=\"margin-top: 1000px; width: 120px; height: 80px;\" src=\"lighthouse-480x320.webp\">\n+ <!-- PASS(optimized): image is JPEG optimized -->\n+ <!-- PASS(webp): image is WebP optimized -->\n+ <!-- PASS(responsive): image is not visible -->\n+ <!-- FAIL(offscreen): image is not visible -->\n+ <div class=\"onscreen\" style=\"display: none;\"><img class=\"onscreen\" style=\"width: 120px; height: 80px;\" src=\"lighthouse-480x320.webp?invisible\"></div>\n+\n<!-- PASS(optimized): image is vector -->\n<!-- PASS(webp): image is vector -->\n<!-- PASS(responsive): image is vector -->\n",
"new_path": "lighthouse-cli/test/fixtures/byte-efficiency/tester.html",
"old_path": "lighthouse-cli/test/fixtures/byte-efficiency/tester.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -67,6 +67,8 @@ module.exports = [\nurl: /lighthouse-unoptimized.jpg$/,\n}, {\nurl: /lighthouse-480x320.webp$/,\n+ }, {\n+ url: /lighthouse-480x320.webp\\?invisible$/,\n}, {\nurl: /large.svg$/,\n},\n",
"new_path": "lighthouse-cli/test/smokehouse/byte-efficiency/expectations.js",
"old_path": "lighthouse-cli/test/smokehouse/byte-efficiency/expectations.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -28,7 +28,7 @@ class OffscreenImages extends ByteEfficiencyAudit {\nname: 'offscreen-images',\ndescription: 'Offscreen images',\ninformative: true,\n- helpText: 'Consider lazy-loading offscreen images to improve page load speed ' +\n+ helpText: 'Consider lazy-loading offscreen and hidden images to improve page load speed ' +\n'and time to interactive. ' +\n'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/offscreen-images).',\nrequiredArtifacts: ['ImageUsage', 'ViewportDimensions', 'traces', 'devtoolsLogs'],\n",
"new_path": "lighthouse-core/audits/byte-efficiency/offscreen-images.js",
"old_path": "lighthouse-core/audits/byte-efficiency/offscreen-images.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -50,6 +50,12 @@ class UsesResponsiveImages extends ByteEfficiencyAudit {\nconst totalBytes = image.networkRecord.resourceSize;\nconst wastedBytes = Math.round(totalBytes * wastedRatio);\n+ // If the image has 0 dimensions, it's probably hidden/offscreen, so let the offscreen-images\n+ // audit handle it instead.\n+ if (!usedPixels) {\n+ return null;\n+ }\n+\nif (!Number.isFinite(wastedRatio)) {\nreturn new Error(`Invalid image sizing information ${url}`);\n}\n@@ -85,6 +91,8 @@ class UsesResponsiveImages extends ByteEfficiencyAudit {\n}\nconst processed = UsesResponsiveImages.computeWaste(image, DPR);\n+ if (!processed) return;\n+\nif (processed instanceof Error) {\ndebugString = processed.message;\nSentry.captureException(processed, {tags: {audit: this.meta.name}, level: 'warning'});\n",
"new_path": "lighthouse-core/audits/byte-efficiency/uses-responsive-images.js",
"old_path": "lighthouse-core/audits/byte-efficiency/uses-responsive-images.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(responsive-images): move images with no dimensions to offscreen audit (#4487)
| 1
|
core
|
responsive-images
|
791,731
|
09.02.2018 07:16:30
| 28,800
|
3e34af7c722e0a4dc9d1e46c1fac908b0ebde69b
|
docs: examples of combining puppeteer & lighthouse
|
[
{
"change_type": "ADD",
"diff": "+# Recipes Puppeteer with Lighthouse\n+\n+**Note**: https://github.com/GoogleChrome/lighthouse/issues/3837 tracks the discussion for making Lighthouse work in concert with Puppeteer.\n+Some things are possible today (login to a page using Puppeteer, audit it using Lighthouse) while others (A/B testing the perf of UI changes) are trickier or not yet possible.\n+\n+### Inject JS/CSS before the page loads\n+\n+The example below shows how to inject CSS into the page before Lighthouse audits the page.\n+A similar approach can be taken for injecting JavaScript.\n+\n+```js\n+const puppeteer = require('puppeteer');\n+const lighthouse = require('lighthouse');\n+const {URL} = require('url');\n+\n+(async() => {\n+const url = 'https://www.chromestatus.com/features';\n+\n+// Use Puppeteer to launch Chrome. appMode launches headful chrome and doesn't size the viewport.\n+const browser = await puppeteer.launch({appMode: true});\n+\n+// Wait for Lighthouse to open url, then customize network conditions.\n+// Note: this will re-establish these conditions when LH reloads the page. Think that's ok....\n+browser.on('targetchanged', async target => {\n+ const page = await target.page();\n+\n+ function addStyleContent(content) {\n+ const style = document.createElement('style');\n+ style.type = 'text/css';\n+ style.appendChild(document.createTextNode(content));\n+ document.head.appendChild(style);\n+ }\n+\n+ const css = '* {color: red}';\n+\n+ if (page && page.url() === url) {\n+ // Note: can't use page.addStyleTag due to github.com/GoogleChrome/puppeteer/issues/1955.\n+ // Do it ourselves.\n+ const client = await page.target().createCDPSession();\n+ await client.send('Runtime.evaluate', {\n+ expression: `(${addStyleContent.toString()})('${css}')`\n+ });\n+ }\n+});\n+\n+// Lighthouse will open URL. Puppeteer observes `targetchanged` and sets up network conditions.\n+// Possible race condition.\n+const lhr = await lighthouse(url, {\n+ port: (new URL(browser.wsEndpoint())).port,\n+ output: 'json',\n+ logLevel: 'info',\n+});\n+\n+console.log(`Lighthouse score: ${lhr.score}`);\n+\n+await browser.close();\n+})();\n+```\n+\n+### Connecting Puppeteer to a browser instance launched by chrome-launcher.\n+\n+When using Lighthouse programmatically, you'll often use chrome-launcher to launch Chrome.\n+Puppeteer can reconnect to this existing browser instance like so:\n+\n+```js\n+const chromeLauncher = require('chrome-launcher');\n+const puppeteer = require('puppeteer');\n+const lighthouse = require('lighthouse');\n+const request = require('request');\n+const util = require('util');\n+\n+(async() => {\n+\n+const URL = 'https://www.chromestatus.com/features';\n+\n+const opts = {\n+ //chromeFlags: ['--headless'],\n+ logLevel: 'info',\n+ output: 'json'\n+};\n+\n+// Launch chrome using chrome-launcher.\n+const chrome = await chromeLauncher.launch(opts);\n+opts.port = chrome.port;\n+\n+// Connect to it using puppeteer.connect().\n+const resp = await util.promisify(request)(`http://localhost:${opts.port}/json/version`);\n+const {webSocketDebuggerUrl} = JSON.parse(resp.body);\n+const browser = await puppeteer.connect({browserWSEndpoint: webSocketDebuggerUrl});\n+\n+// Run Lighthouse.\n+const lhr = await lighthouse(URL, opts, null);\n+console.log(`Lighthouse score: ${lhr.score}`);\n+\n+await browser.disconnect();\n+await chrome.kill();\n+\n+})();\n+```\n",
"new_path": "docs/puppeteer.md",
"old_path": null
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
docs: examples of combining puppeteer & lighthouse (#4408)
| 1
|
docs
| null |
791,876
|
09.02.2018 14:57:05
| 0
|
e685dedc29263262850dcfdb09173ffbdef713a3
|
misc(spelling): fix discernable to discernible
|
[
{
"change_type": "MODIFY",
"diff": "@@ -20,7 +20,7 @@ class LinkName extends AxeAudit {\nreturn {\nname: 'link-name',\ndescription: 'Links have a discernible name',\n- failureDescription: 'Links do not have a discernable name',\n+ failureDescription: 'Links do not have a discernible name',\nhelpText: 'Link text (and alternate text for images, when used as links) that is ' +\n'discernible, unique, and focusable improves the navigation experience for ' +\n'screen reader users. ' +\n",
"new_path": "lighthouse-core/audits/accessibility/link-name.js",
"old_path": "lighthouse-core/audits/accessibility/link-name.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -219,7 +219,7 @@ module.exports = {\ndescription: 'These are opportunities to improve the configuration of your HTML elements.',\n},\n'a11y-element-names': {\n- title: 'Elements Have Discernable Names',\n+ title: 'Elements Have Discernible Names',\ndescription: 'These are opportunities to improve the semantics of the controls in your application. This may enhance the experience for users of assistive technology, like a screen reader.',\n},\n'a11y-language': {\n",
"new_path": "lighthouse-core/config/default.js",
"old_path": "lighthouse-core/config/default.js"
},
{
"change_type": "MODIFY",
"diff": "\"description\": \"Screen readers and other assitive technologies require annotations to understand otherwise ambiguous content.\"\n},\n\"a11y-element-names\": {\n- \"title\": \"Elements Have Discernable Names\",\n+ \"title\": \"Elements Have Discernible Names\",\n\"description\": \"Screen readers and other assitive technologies require annotations to understand otherwise ambiguous content.\"\n},\n\"a11y-language\": {\n",
"new_path": "lighthouse-core/test/fixtures/dbw_tester-perf-results.json",
"old_path": "lighthouse-core/test/fixtures/dbw_tester-perf-results.json"
},
{
"change_type": "MODIFY",
"diff": "\"scoringMode\": \"binary\",\n\"name\": \"link-name\",\n\"category\": \"Accessibility\",\n- \"description\": \"Links have a discernable name.\",\n+ \"description\": \"Links have a discernible name.\",\n\"helpText\": \"Link text (and alternate text for images, when used as links) that is discernible, not duplicated, and focusable improves the navigating experience for screen reader users.\"\n},\n\"list\": {\n\"scoringMode\": \"binary\",\n\"name\": \"link-name\",\n\"category\": \"Accessibility\",\n- \"description\": \"Links have a discernable name.\",\n+ \"description\": \"Links have a discernible name.\",\n\"helpText\": \"Link text (and alternate text for images, when used as links) that is discernible, not duplicated, and focusable improves the navigating experience for screen reader users.\"\n},\n\"score\": 100\n\"description\": \"Screen readers and other assistive technologies require annotations to understand otherwise ambiguous content.\"\n},\n\"a11y-element-names\": {\n- \"title\": \"Elements Have Discernable Names\",\n+ \"title\": \"Elements Have Discernible Names\",\n\"description\": \"Screen readers and other assistive technologies require annotations to understand otherwise ambiguous content.\"\n},\n\"a11y-language\": {\n",
"new_path": "lighthouse-core/test/results/sample_v2.json",
"old_path": "lighthouse-core/test/results/sample_v2.json"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
misc(spelling): fix discernable to discernible (#4485)
| 1
|
misc
|
spelling
|
815,745
|
10.02.2018 18:47:41
| -7,200
|
fb7b94bbb7cecfe732c1da29ce6574fd4214a7b2
|
fix(multiselect): allow to clear item even no items available
fixes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -782,6 +782,26 @@ describe('NgSelectComponent', function () {\ntick();\n}));\n+ it('should clear item even if there are no items loaded', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectBasicTestCmp,\n+ `<ng-select [items]=\"cities\"\n+ bindLabel=\"name\"\n+ [(ngModel)]=\"selectedCity\">\n+ </ng-select>`);\n+\n+ selectOption(fixture, KeyCode.ArrowDown, 0);\n+ fixture.detectChanges();\n+ expect(fixture.componentInstance.select.selectedItems.length).toBe(1);\n+ const selected = fixture.componentInstance.selectedCity;\n+ fixture.componentInstance.cities = [];\n+ fixture.detectChanges();\n+\n+ fixture.componentInstance.select.clearItem(selected)\n+ expect(fixture.componentInstance.select.selectedItems.length).toBe(0);\n+ tick();\n+ }));\n+\nit('should display custom dropdown option template', async(() => {\nconst fixture = createTestingModule(\nNgSelectBasicTestCmp,\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -128,7 +128,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nprivate _disposeDocumentResizeListener = () => { };\nclearItem = (item: any) => {\n- const option = this.itemsList.items.find(x => x.value === item);\n+ const option = this.selectedItems.find(x => x.value === item);\nthis.unselect(option);\n};\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix(multiselect): allow to clear item even no items available (#251)
fixes #247
| 1
|
fix
|
multiselect
|
815,745
|
10.02.2018 18:48:43
| -7,200
|
6be231af57e2a16405abf0265490ac951a3f74e7
|
fix: don't show not found text while loading
fixes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -519,6 +519,7 @@ describe('NgSelectComponent', function () {\nNgSelectBasicTestCmp,\n`<ng-select [items]=\"cities\"\nbindLabel=\"name\"\n+ [loading]=\"citiesLoading\"\n[multiple]=\"multiple\"\n[(ngModel)]=\"selectedCity\">\n</ng-select>`);\n@@ -539,6 +540,17 @@ describe('NgSelectComponent', function () {\nexpect(text).toContain('No items found');\n}));\n+ it('should open dropdown with loading message', fakeAsync(() => {\n+ fixture.componentInstance.cities = [];\n+ fixture.componentInstance.citiesLoading = true;\n+ tickAndDetectChanges(fixture);\n+ triggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Space);\n+ tickAndDetectChanges(fixture);\n+ const options = fixture.debugElement.queryAll(By.css('.ng-option'));\n+ expect(options.length).toBe(1);\n+ expect(options[0].nativeElement.innerHTML).toContain('Loading...');\n+ }));\n+\nit('should open dropdown and mark first item', () => {\nconst result = { value: fixture.componentInstance.cities[0] };\ntriggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Space);\n@@ -1493,6 +1505,7 @@ class NgSelectBasicTestCmp {\nselectedCity: { id: number; name: string };\nmultiple = false;\ndropdownPosition = 'bottom';\n+ citiesLoading = false;\ncities = [\n{ id: 1, name: 'Vilnius' },\n{ id: 2, name: 'Kaunas' },\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -359,7 +359,7 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie\nshowNoItemsFound() {\nconst empty = this.itemsList.filteredItems.length === 0;\n- return (empty && !this._isTypeahead) ||\n+ return (empty && !this._isTypeahead && !this.loading) ||\n(empty && this._isTypeahead && this.filterValue && !this.isLoading);\n}\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: don't show not found text while loading (#252)
fixes #243
| 1
|
fix
| null |
807,849
|
11.02.2018 15:41:34
| 28,800
|
e9f30643f620cc2b0606d5ef895643b626a4699c
|
chore(test/helpers): ensure callsBack() waits for the next tick
|
[
{
"change_type": "MODIFY",
"diff": "@@ -4,5 +4,5 @@ module.exports = callsBack;\n// for mocking the behaviour of methods that accept a callback\nfunction callsBack(err, val) {\n- return (...args) => args.pop()(err, val);\n+ return (...args) => process.nextTick(args.pop(), err, val);\n}\n",
"new_path": "test/helpers/callsBack.js",
"old_path": "test/helpers/callsBack.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore(test/helpers): ensure callsBack() waits for the next tick
| 1
|
chore
|
test/helpers
|
807,849
|
11.02.2018 23:54:45
| 28,800
|
ac0eae9e5d5d05a56809c6433f1b145050eafaf1
|
chore: extract consoleOutput test helper, return strings
|
[
{
"change_type": "MODIFY",
"diff": "\"use strict\";\n-const chalk = require(\"chalk\");\nconst log = require(\"npmlog\");\n-const normalizeNewline = require(\"normalize-newline\");\n-\n-// mocked or stubbed modules\n-const output = require(\"../src/utils/output\");\n// helpers\n+const consoleOutput = require(\"./helpers/consoleOutput\");\nconst initFixture = require(\"./helpers/initFixture\");\nconst yargsRunner = require(\"./helpers/yargsRunner\");\n@@ -16,16 +12,9 @@ const commandModule = require(\"../src/commands/LsCommand\");\nconst run = yargsRunner(commandModule);\n-jest.mock(\"../src/utils/output\");\n-\n// silence logs\nlog.level = \"silent\";\n-// keep snapshots stable cross-platform\n-chalk.enabled = false;\n-\n-const consoleOutput = () => output.mock.calls.map(args => normalizeNewline(args[0]));\n-\ndescribe(\"LsCommand\", () => {\nafterEach(() => jest.resetAllMocks());\n",
"new_path": "test/LsCommand.js",
"old_path": "test/LsCommand.js"
},
{
"change_type": "MODIFY",
"diff": "\"use strict\";\n-const chalk = require(\"chalk\");\nconst log = require(\"npmlog\");\nconst normalizeNewline = require(\"normalize-newline\");\nconst path = require(\"path\");\n@@ -12,10 +11,10 @@ const ConventionalCommitUtilities = require(\"../src/ConventionalCommitUtilities\"\nconst GitUtilities = require(\"../src/GitUtilities\");\nconst NpmUtilities = require(\"../src/NpmUtilities\");\nconst PromptUtilities = require(\"../src/PromptUtilities\");\n-const output = require(\"../src/utils/output\");\n// helpers\nconst callsBack = require(\"./helpers/callsBack\");\n+const consoleOutput = require(\"./helpers/consoleOutput\");\nconst initFixture = require(\"./helpers/initFixture\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\nconst yargsRunner = require(\"./helpers/yargsRunner\");\n@@ -31,21 +30,15 @@ jest.mock(\"../src/GitUtilities\");\njest.mock(\"../src/NpmUtilities\");\njest.mock(\"../src/PromptUtilities\");\njest.mock(\"../src/ConventionalCommitUtilities\");\n-jest.mock(\"../src/utils/output\");\n// silence logs\nlog.level = \"silent\";\n-// keep snapshots stable cross-platform\n-chalk.enabled = false;\n-\nconst execOpts = testDir =>\nexpect.objectContaining({\ncwd: testDir,\n});\n-const consoleOutput = () => output.mock.calls.map(args => normalizeNewline(args[0]));\n-\nconst publishedTagInDirectories = testDir =>\nNpmUtilities.publishTaggedInDir.mock.calls.reduce((arr, args) => {\nconst tag = args[0];\n",
"new_path": "test/PublishCommand.js",
"old_path": "test/PublishCommand.js"
},
{
"change_type": "MODIFY",
"diff": "\"use strict\";\n-const chalk = require(\"chalk\");\nconst execa = require(\"execa\");\nconst log = require(\"npmlog\");\n-const normalizeNewline = require(\"normalize-newline\");\nconst path = require(\"path\");\nconst touch = require(\"touch\");\n-// mocked or stubbed modules\n-const output = require(\"../src/utils/output\");\n-\n// helpers\n+const consoleOutput = require(\"./helpers/consoleOutput\");\nconst initFixture = require(\"./helpers/initFixture\");\nconst updateLernaConfig = require(\"./helpers/updateLernaConfig\");\nconst yargsRunner = require(\"./helpers/yargsRunner\");\n@@ -20,16 +16,9 @@ const commandModule = require(\"../src/commands/UpdatedCommand\");\nconst run = yargsRunner(commandModule);\n-jest.mock(\"../src/utils/output\");\n-\n// silence logs\nlog.level = \"silent\";\n-// keep snapshots stable cross-platform\n-chalk.enabled = false;\n-\n-const consoleOutput = () => output.mock.calls.map(args => normalizeNewline(args[0]));\n-\nconst gitTag = cwd => execa(\"git\", [\"tag\", \"v1.0.0\"], { cwd });\nconst gitAdd = cwd => execa(\"git\", [\"add\", \"-A\"], { cwd });\nconst gitCommit = cwd => execa(\"git\", [\"commit\", \"-m\", \"Commit\"], { cwd });\n",
"new_path": "test/UpdatedCommand.js",
"old_path": "test/UpdatedCommand.js"
},
{
"change_type": "MODIFY",
"diff": "// Jest Snapshot v1, https://goo.gl/fbAQLP\nexports[`LsCommand in a Yarn workspace should use package.json/workspaces setting 1`] = `\n-Array [\n\"package-1 v1.0.0\n-package-2 v1.0.0 \",\n-]\n+package-2 v1.0.0 \"\n`;\n-exports[`LsCommand in a basic repo does not list changes for ignored packages 1`] = `\n-Array [\n- \"package-1 v1.0.0 \",\n-]\n-`;\n+exports[`LsCommand in a basic repo does not list changes for ignored packages 1`] = `\"package-1 v1.0.0 \"`;\n-exports[`LsCommand in a basic repo lists changes for a given scope 1`] = `\n-Array [\n- \"package-1 v1.0.0 \",\n-]\n-`;\n+exports[`LsCommand in a basic repo lists changes for a given scope 1`] = `\"package-1 v1.0.0 \"`;\nexports[`LsCommand in a basic repo should list packages 1`] = `\n-Array [\n\"package-1 v1.0.0\npackage-2 v1.0.0\npackage-3 v1.0.0\npackage-4 v1.0.0\n-package-5 v1.0.0 (private)\",\n-]\n+package-5 v1.0.0 (private)\"\n`;\nexports[`LsCommand in a repo with packages outside of packages/ should list packages 1`] = `\n-Array [\n\"package-1 v1.0.0\npackage-2 v1.0.0\n-package-3 v1.0.0 \",\n-]\n+package-3 v1.0.0 \"\n`;\nexports[`LsCommand with --include-filtered-dependencies should list packages, including filtered ones 1`] = `\n-Array [\n\"@test/package-2 v1.0.0\n-@test/package-1 v1.0.0 \",\n-]\n+@test/package-1 v1.0.0 \"\n`;\nexports[`LsCommand with --json should list packages as json objects 1`] = `\n@@ -74,8 +58,4 @@ Array [\n]\n`;\n-exports[`LsCommand with an undefined version should list packages 1`] = `\n-Array [\n- \"package-1 MISSING \",\n-]\n-`;\n+exports[`LsCommand with an undefined version should list packages 1`] = `\"package-1 MISSING \"`;\n",
"new_path": "test/__snapshots__/LsCommand.js.snap",
"old_path": "test/__snapshots__/LsCommand.js.snap"
},
{
"change_type": "MODIFY",
"diff": "@@ -137,21 +137,19 @@ Object {\n`;\nexports[`PublishCommand independent mode should publish the changed packages in independent mode: console output 1`] = `\n-Array [\n- \"\",\n- \"Changes:\",\n- \" - package-1: 1.0.0 => 1.0.1\n+\"\n+Changes:\n+ - package-1: 1.0.0 => 1.0.1\n- package-2: 2.0.0 => 1.1.0\n- package-3: 3.0.0 => 2.0.0\n- package-4: 4.0.0 => 1.1.0\n- - package-5: 5.0.0 => 1.0.1 (private)\",\n- \"\",\n- \"Successfully published:\",\n- \" - package-1@1.0.1\n+ - package-5: 5.0.0 => 1.0.1 (private)\n+\n+Successfully published:\n+ - package-1@1.0.1\n- package-2@1.1.0\n- package-3@2.0.0\n- - package-4@1.1.0\",\n-]\n+ - package-4@1.1.0\"\n`;\nexports[`PublishCommand independent mode should publish the changed packages in independent mode: git added files 1`] = `\n@@ -277,21 +275,19 @@ Object {\n`;\nexports[`PublishCommand normal mode should publish the changed packages: console output 1`] = `\n-Array [\n- \"\",\n- \"Changes:\",\n- \" - package-1: 1.0.0 => 1.0.1\n+\"\n+Changes:\n+ - package-1: 1.0.0 => 1.0.1\n- package-2: 1.0.0 => 1.0.1\n- package-3: 1.0.0 => 1.0.1\n- package-4: 1.0.0 => 1.0.1\n- - package-5: 1.0.0 => 1.0.1 (private)\",\n- \"\",\n- \"Successfully published:\",\n- \" - package-1@1.0.1\n+ - package-5: 1.0.0 => 1.0.1 (private)\n+\n+Successfully published:\n+ - package-1@1.0.1\n- package-2@1.0.1\n- package-3@1.0.1\n- - package-4@1.0.1\",\n-]\n+ - package-4@1.0.1\"\n`;\nexports[`PublishCommand normal mode should publish the changed packages: git added files 1`] = `\n",
"new_path": "test/__snapshots__/PublishCommand.js.snap",
"old_path": "test/__snapshots__/PublishCommand.js.snap"
},
{
"change_type": "MODIFY",
"diff": "// Jest Snapshot v1, https://goo.gl/fbAQLP\nexports[`UpdatedCommand basic should list all packages when no tag is found 1`] = `\n-Array [\n\"- package-1\n- package-2\n- package-3\n- package-4\n-- package-5 (private)\",\n-]\n+- package-5 (private)\"\n`;\nexports[`UpdatedCommand basic should list changes 1`] = `\n-Array [\n\"- package-2\n-- package-3\",\n-]\n+- package-3\"\n`;\n-exports[`UpdatedCommand basic should list changes in private packages 1`] = `\n-Array [\n- \"- package-5 (private)\",\n-]\n-`;\n+exports[`UpdatedCommand basic should list changes in private packages 1`] = `\"- package-5 (private)\"`;\nexports[`UpdatedCommand basic should list changes with --force-publish * 1`] = `\n-Array [\n\"- package-1\n- package-2\n- package-3\n- package-4\n-- package-5 (private)\",\n-]\n+- package-5 (private)\"\n`;\nexports[`UpdatedCommand basic should list changes with --force-publish [package,package] 1`] = `\n-Array [\n\"- package-2\n- package-3\n-- package-4\",\n-]\n+- package-4\"\n`;\n-exports[`UpdatedCommand basic should list changes without ignored files 1`] = `\n-Array [\n- \"- package-3\",\n-]\n-`;\n+exports[`UpdatedCommand basic should list changes without ignored files 1`] = `\"- package-3\"`;\nexports[`UpdatedCommand circular should list changes 1`] = `\n-Array [\n\"- package-3\n-- package-4\",\n-]\n+- package-4\"\n`;\nexports[`UpdatedCommand circular should list changes with --force-publish * 1`] = `\n-Array [\n\"- package-1\n- package-2\n- package-3\n- package-4\n-- package-5 (private)\",\n-]\n+- package-5 (private)\"\n`;\nexports[`UpdatedCommand circular should list changes with --force-publish [package,package] 1`] = `\n-Array [\n\"- package-2\n- package-3\n-- package-4\",\n-]\n+- package-4\"\n`;\nexports[`UpdatedCommand circular should list changes without ignored files 1`] = `\n-Array [\n\"- package-3\n-- package-4\",\n-]\n+- package-4\"\n`;\nexports[`UpdatedCommand with --json should list changes as a json object 1`] = `\n",
"new_path": "test/__snapshots__/UpdatedCommand.js.snap",
"old_path": "test/__snapshots__/UpdatedCommand.js.snap"
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const chalk = require(\"chalk\");\n+const normalizeNewline = require(\"normalize-newline\");\n+const output = require(\"../../src/utils/output\");\n+\n+jest.mock(\"../../src/utils/output\");\n+\n+// keep snapshots stable cross-platform\n+chalk.enabled = false;\n+\n+module.exports = consoleOutput;\n+\n+function consoleOutput() {\n+ return output.mock.calls.map(args => normalizeNewline(args[0])).join(\"\\n\");\n+}\n",
"new_path": "test/helpers/consoleOutput.js",
"old_path": null
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: extract consoleOutput test helper, return strings
| 1
|
chore
| null |
807,849
|
12.02.2018 00:11:51
| 28,800
|
69193557ee295cd214b0b3cffb94afb21b18b6e5
|
refactor: add getShortSHA() util
|
[
{
"change_type": "MODIFY",
"diff": "@@ -178,6 +178,15 @@ function getCurrentSHA(opts) {\nreturn sha;\n}\n+function getShortSHA(opts) {\n+ log.silly(\"getShortSHA\");\n+\n+ const sha = ChildProcessUtilities.execSync(\"git\", [\"rev-parse\", \"--short\", \"HEAD\"], opts);\n+ log.verbose(\"getShortSHA\", sha);\n+\n+ return sha;\n+}\n+\nfunction checkoutChanges(fileGlob, opts) {\nlog.silly(\"checkoutChanges\", fileGlob);\nChildProcessUtilities.execSync(\"git\", [\"checkout\", \"--\", fileGlob], opts);\n@@ -220,6 +229,7 @@ exports.diffSinceIn = diffSinceIn;\nexports.getWorkspaceRoot = getWorkspaceRoot;\nexports.getCurrentBranch = getCurrentBranch;\nexports.getCurrentSHA = getCurrentSHA;\n+exports.getShortSHA = getShortSHA;\nexports.checkoutChanges = checkoutChanges;\nexports.init = init;\nexports.hasCommit = hasCommit;\n",
"new_path": "src/GitUtilities.js",
"old_path": "src/GitUtilities.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -269,6 +269,15 @@ describe(\"GitUtilities\", () => {\n});\n});\n+ describe(\".getShortSHA()\", () => {\n+ it(\"returns short SHA of current ref\", () => {\n+ ChildProcessUtilities.execSync.mockImplementation(() => \"deadbee\");\n+ const opts = { cwd: \"test\" };\n+ expect(GitUtilities.getShortSHA(opts)).toBe(\"deadbee\");\n+ expect(ChildProcessUtilities.execSync).lastCalledWith(\"git\", [\"rev-parse\", \"--short\", \"HEAD\"], opts);\n+ });\n+ });\n+\ndescribe(\".checkoutChanges()\", () => {\nit(\"calls git checkout with specified arg\", () => {\nconst opts = { cwd: \"test\" };\n",
"new_path": "test/GitUtilities.js",
"old_path": "test/GitUtilities.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor: add getShortSHA() util
| 1
|
refactor
| null |
807,849
|
12.02.2018 01:31:31
| 28,800
|
3313bf5b2dbde0a9d8ccd92a318674494ee4f08b
|
chore: add test/helpers/cliRunner for integration usage
|
[
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const log = require(\"npmlog\");\n+const cli = require(\"../../src/cli\");\n+\n+jest.mock(\"is-ci\", () => true);\n+\n+// silence logs\n+log.level = \"silent\";\n+\n+module.exports = runner;\n+\n+function runner(cwd) {\n+ // create a _new_ yargs instance every time cwd changes to avoid singleton pollution\n+ const instance = cli([], cwd)\n+ .exitProcess(false)\n+ .detectLocale(false)\n+ .showHelpOnFail(false)\n+ .wrap(null);\n+\n+ return (...argv) =>\n+ new Promise((resolve, reject) => {\n+ const yargsMeta = {};\n+\n+ const context = {\n+ cwd,\n+ onResolved: result => {\n+ Object.assign(result, yargsMeta);\n+ resolve(result);\n+ },\n+ onRejected: result => {\n+ Object.assign(result, yargsMeta);\n+ // tests expect errors thrown to indicate failure,\n+ // _not_ just non-zero exitCode\n+ reject(result);\n+ },\n+ };\n+\n+ const parseFn = (yargsError, parsedArgv, yargsOutput) => {\n+ // this is synchronous, before the async handlers resolve\n+ Object.assign(yargsMeta, { parsedArgv, yargsOutput });\n+ };\n+\n+ // workaround wonky yargs-parser configuration not being read during tests\n+ // hackDoubleDash(args, context);\n+\n+ instance\n+ .fail((msg, err) => {\n+ // since yargs 10.1.0, this is the only way to catch handler rejection\n+ // _and_ yargs validation exceptions when using async command handlers\n+ const actual = err || new Error(msg);\n+ // backfill exitCode for test convenience\n+ yargsMeta.exitCode = \"exitCode\" in actual ? actual.exitCode : 1;\n+ context.onRejected(actual);\n+ })\n+ .parse(argv, context, parseFn);\n+ });\n+}\n",
"new_path": "test/helpers/cliRunner.js",
"old_path": null
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: add test/helpers/cliRunner for integration usage
| 1
|
chore
| null |
807,849
|
12.02.2018 01:33:11
| 28,800
|
49c242ad598f1315c954e641ff19ba11a0570324
|
chore: sort functions in FileSystemUtilities
|
[
{
"change_type": "MODIFY",
"diff": "@@ -26,6 +26,11 @@ function chmodSync(filePath, mode) {\nfs.chmodSync(filePath, mode);\n}\n+function existsSync(filePath) {\n+ log.silly(\"existsSync\", filePath);\n+ return pathExists.sync(filePath);\n+}\n+\nfunction mkdirp(filePath, callback) {\nlog.silly(\"mkdirp\", filePath);\nfs.ensureDir(filePath, callback);\n@@ -41,16 +46,6 @@ function readdirSync(filePath) {\nreturn fs.readdirSync(filePath);\n}\n-function existsSync(filePath) {\n- log.silly(\"existsSync\", filePath);\n- return pathExists.sync(filePath);\n-}\n-\n-function writeFile(filePath, fileContents, callback) {\n- log.silly(\"writeFile\", [filePath, fileContents]);\n- fs.writeFile(filePath, ensureEndsWithNewLine(fileContents), callback);\n-}\n-\nfunction rename(from, to, callback) {\nlog.silly(\"rename\", [from, to]);\nfs.rename(from, to, callback);\n@@ -61,6 +56,11 @@ function renameSync(from, to) {\nfs.renameSync(from, to);\n}\n+function writeFile(filePath, fileContents, callback) {\n+ log.silly(\"writeFile\", [filePath, fileContents]);\n+ return fs.writeFile(filePath, ensureEndsWithNewLine(fileContents), callback);\n+}\n+\nfunction writeFileSync(filePath, fileContents) {\nlog.silly(\"writeFileSync\", [filePath, fileContents]);\nfs.writeFileSync(filePath, ensureEndsWithNewLine(fileContents));\n@@ -186,13 +186,13 @@ function resolveWindowsSymlink(filePath) {\nexports.chmod = chmod;\nexports.chmodSync = chmodSync;\n+exports.existsSync = existsSync;\nexports.mkdirp = mkdirp;\nexports.mkdirpSync = mkdirpSync;\nexports.readdirSync = readdirSync;\n-exports.existsSync = existsSync;\n-exports.writeFile = writeFile;\nexports.rename = rename;\nexports.renameSync = renameSync;\n+exports.writeFile = writeFile;\nexports.writeFileSync = writeFileSync;\nexports.readFileSync = readFileSync;\nexports.statSync = statSync;\n",
"new_path": "src/FileSystemUtilities.js",
"old_path": "src/FileSystemUtilities.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: sort functions in FileSystemUtilities
| 1
|
chore
| null |
807,849
|
12.02.2018 01:36:11
| 28,800
|
5e72a136309b67eb56e66d6f3d8db013cc641deb
|
chore: remove unused GitUtilities.removeTag
|
[
{
"change_type": "MODIFY",
"diff": "@@ -69,11 +69,6 @@ function addTag(tag, opts) {\nChildProcessUtilities.execSync(\"git\", [\"tag\", tag, \"-m\", tag], opts);\n}\n-function removeTag(tag, opts) {\n- log.silly(\"removeTag\", tag);\n- ChildProcessUtilities.execSync(\"git\", [\"tag\", \"-d\", tag], opts);\n-}\n-\nfunction hasTags(opts) {\nlog.silly(\"hasTags\");\n@@ -217,7 +212,6 @@ exports.isInitialized = isInitialized;\nexports.addFile = addFile;\nexports.commit = commit;\nexports.addTag = addTag;\n-exports.removeTag = removeTag;\nexports.hasTags = hasTags;\nexports.getLastTaggedCommit = getLastTaggedCommit;\nexports.getLastTaggedCommitInBranch = getLastTaggedCommitInBranch;\n",
"new_path": "src/GitUtilities.js",
"old_path": "src/GitUtilities.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -121,14 +121,6 @@ describe(\"GitUtilities\", () => {\n});\n});\n- describe(\".removeTag()\", () => {\n- it(\"deletes specified git tag\", () => {\n- const opts = { cwd: \"test\" };\n- GitUtilities.removeTag(\"foo\", opts);\n- expect(ChildProcessUtilities.execSync).lastCalledWith(\"git\", [\"tag\", \"-d\", \"foo\"], opts);\n- });\n- });\n-\ndescribe(\".hasTags()\", () => {\nit(\"returns true when one or more git tags exist\", () => {\nChildProcessUtilities.execSync.mockImplementation(() => \"v1.0.0\");\n",
"new_path": "test/GitUtilities.js",
"old_path": "test/GitUtilities.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: remove unused GitUtilities.removeTag
| 1
|
chore
| null |
807,849
|
12.02.2018 12:36:17
| 28,800
|
e65e3dd059388e120006573d1086bafce4e9fcd4
|
fix: trim trailing whitespace from every line of every entry of console output, ugh
|
[
{
"change_type": "MODIFY",
"diff": "@@ -12,5 +12,12 @@ chalk.enabled = false;\nmodule.exports = consoleOutput;\nfunction consoleOutput() {\n- return output.mock.calls.map(args => normalizeNewline(args[0])).join(\"\\n\");\n+ return output.mock.calls\n+ .map(args =>\n+ normalizeNewline(args[0])\n+ .split(\"\\n\")\n+ .map(line => line.trimRight())\n+ .join(\"\\n\")\n+ )\n+ .join(\"\\n\");\n}\n",
"new_path": "test/helpers/consoleOutput.js",
"old_path": "test/helpers/consoleOutput.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
fix: trim trailing whitespace from every line of every entry of console output, ugh
| 1
|
fix
| null |
791,723
|
12.02.2018 15:11:32
| 28,800
|
ecedb320bbbea5a4e523a96c99df27c053fb02dc
|
tests(appveyor): quietly unzip Chrome to keep appveyor logs cleaner
|
[
{
"change_type": "MODIFY",
"diff": "@@ -22,5 +22,5 @@ fi\nif [ -e \"$LIGHTHOUSE_CHROMIUM_PATH\" ]; then\necho \"cached chrome found\"\nelse\n- wget \"$url\" --no-check-certificate -q -O chrome.zip && unzip chrome.zip\n+ wget \"$url\" --no-check-certificate -q -O chrome.zip && unzip -q chrome.zip\nfi\n",
"new_path": "lighthouse-core/scripts/download-chrome.sh",
"old_path": "lighthouse-core/scripts/download-chrome.sh"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
tests(appveyor): quietly unzip Chrome to keep appveyor logs cleaner
| 1
|
tests
|
appveyor
|
791,723
|
12.02.2018 15:12:16
| 28,800
|
a9cde8f15ed5b3e051f1ad2a2cebeb9839e08421
|
core(gather-runner): [revert] load a blank data URI, rather than about:blank
This reverts commit
|
[
{
"change_type": "DELETE",
"diff": "-<!doctype html>\n-<html>\n-<meta charset=\"utf-8\">\n-<meta name=\"viewport\" content=\"width=device-width\">\n-<title>Resetting page...</title>\n-<style>\n- html, body {\n- height: 100%;\n- background: hsl(231, 99%, 99%);\n- overflow: hidden;\n- }\n-</style>\n-<body>\n",
"new_path": null,
"old_path": "lighthouse-core/gather/blank-page.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -498,15 +498,6 @@ class Driver {\n};\n}\n- /**\n- * Return a promise that resolves `pauseAfterLoadMs` after the load event fires.\n- * @param {number} pauseAfterLoadMs\n- * @return {!Promise}\n- */\n- waitForLoadEvent(pauseAfterLoadMs = 0) {\n- return this._waitForLoadEvent(pauseAfterLoadMs).promise;\n- }\n-\n/**\n* Return a promise that resolves `pauseAfterLoadMs` after the load event\n* fires and a method to cancel internal listeners and timeout.\n",
"new_path": "lighthouse-core/gather/driver.js",
"old_path": "lighthouse-core/gather/driver.js"
},
{
"change_type": "DELETE",
"diff": "-<!doctype html>\n-<html>\n-<meta name=\"viewport\" content=\"width=device-width\">\n-<meta charset=\"utf-8\">\n-<title>Resetting page....</title>\n-<style>\n- html, body {\n- background: hsl(231, 99%, 99%);\n- height: 100%;\n- overflow: hidden;\n- display: flex;\n- align-items: center;\n- justify-content: center;\n- }\n- svg {\n- filter: saturate(20%);\n- width: 150px;\n- height: 150px;\n- margin-top: -50px;\n- }\n-</style>\n-<body>\n-\n-<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 750 750\"><path fill=\"#304ffe\" d=\"M92.43 571.02c52.32 0 52.32-33.94 104.64-33.94s52.3 33.94 104.63 33.94c52.32 0 52.32-33.94 104.63-33.94 52.3 0 52.32 33.94 104.64 33.94s52.32-33.94 104.64-33.94c49.48 0 52.17 30.34 96.56 33.64a326.73 326.73 0 0 0 8.09-72.39c0-179.87-145.82-325.69-325.7-325.69s-325.7 145.82-325.7 325.7a326.75 326.75 0 0 0 7.9 71.5 98.88 98.88 0 0 0 15.67 1.18z\"/><g transform=\"translate(-111.07 296.27)\"><circle cx=\"593.87\" cy=\"-88.78\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"624.87\" cy=\"109.62\" r=\"6.13\" fill=\"#fff9c4\"/><circle cx=\"253.47\" cy=\"53.59\" r=\"6.13\" fill=\"#fff9c4\"/><circle cx=\"353.42\" cy=\"160.21\" r=\"6.13\" fill=\"#fff9c4\"/><circle cx=\"598.48\" cy=\"11.64\" r=\"6.13\" fill=\"#fff9c4\"/><circle cx=\"727.63\" cy=\"169.54\" r=\"6.13\" fill=\"#fff9c4\"/><circle cx=\"240.27\" cy=\"192.4\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"272.83\" cy=\"121.09\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"294.74\" cy=\"102.71\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"387.35\" cy=\"20\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"679.87\" cy=\"30.22\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"818.6\" cy=\"177.65\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"328.68\" cy=\"9.39\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"640.9\" cy=\"179.2\" r=\"3.53\" fill=\"#fdd835\"/><circle cx=\"747.87\" cy=\"90.75\" r=\"3.53\" fill=\"#fdd835\"/></g><path fill=\"#2979ff\" d=\"M542.66 245.81a19.59 19.59 0 0 1 8.32 1.84 34.49 34.49 0 0 1 66.7-9h.12a23.25 23.25 0 0 1 0 46.5h-75.14a19.67 19.67 0 1 1 0-39.34z\"/><path fill=\"#ffd54f\" d=\"M362.98 213.56h84.84v78.5h-84.84z\"/><path fill=\"#fff176\" d=\"M362.98 213.56h29.95v78.5h-29.95z\"/><ellipse cx=\"392.3\" cy=\"233.21\" fill=\"#fff176\" rx=\"19.84\" ry=\"24.89\"/><path fill=\"#f4511e\" d=\"M360.9 204.7a43.84 43.84 0 1 1 87.67 0\"/><path fill=\"#e64a19\" d=\"M405.1 160.87a43.51 43.51 0 0 1 43.47 43.83H405.1v-43.83z\"/><rect width=\"104.64\" height=\"11.31\" x=\"352.42\" y=\"203.29\" fill=\"#f4511e\" rx=\"5.66\" ry=\"5.66\"/><path fill=\"#c5cae9\" d=\"M350.8 534.02l12.23-242.5h84.84l10.93 230.5z\"/><path fill=\"#ff7043\" d=\"M449.04 310.25l3.26 64.17m-92.45-22.6l-3.42 67.3 95.87-44.7-3.26-64.17zm95.67 85.84l3.27 64.18m-105.74-16.42l-3.42 67.3 109.16-50.88-3.27-64.18z\"/><path fill=\"#e64a19\" d=\"M349.99 255.9h109.49v35.82h-109.5z\"/><path fill=\"#f4511e\" d=\"M349.99 255.9h71.78v35.82h-71.78z\"/><path fill=\"#ffe082\" d=\"M403.98 255.9c0 13-12.1 23.5-27 23.5s-27-10.52-27-23.5\" opacity=\".5\"/><path fill=\"#304ffe\" d=\"M451.07 291.52h-42.9v219.5l52 23L449 291.52z\" opacity=\".5\"/><path fill=\"#448aff\" d=\"M319.66 433.3a16.6 16.6 0 0 1 7 1.55 29.23 29.23 0 0 1 56.53-7.63h.1a19.71 19.71 0 1 1 0 39.41h-63.63a16.67 16.67 0 1 1 0-33.34z\"/><path fill=\"#ffe082\" d=\"M364.42 212.37L29.8 164.58a3.65 3.65 0 0 0-1-.14c-8.67 0-16 31.9-16 71.15 0 39.26 7.33 71.07 16 71.07a3.66 3.66 0 0 0 .93-.13l334.64-47.88v-46.28z\" opacity=\".5\"/><path fill=\"#00c853\" d=\"M302.7 571.75c52.32 0 52.32-33.94 104.63-33.94 52.3 0 52.32 33.94 104.63 33.94 44.42 0 51.13-24.46 84.16-31.84-45.13-24.66-112.53-40.33-187.84-40.33-75.63 0-143.28 15.8-188.41 40.64 31.93 7.73 39.02 31.53 82.83 31.53z\"/><path fill=\"#64dd17\" d=\"M302.8 571.28c52.32 0 52.32-33.94 104.63-33.94h1.1l-.58-37.32c-74.9 0-142 15.5-187.08 39.91 31.16 7.98 38.55 31.35 81.93 31.35z\"/></svg>\n",
"new_path": null,
"old_path": "lighthouse-core/gather/logo-page.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -18,9 +18,6 @@ module.exports = {\ngotoURL() {\nreturn Promise.resolve('https://example.com');\n},\n- waitForLoadEvent() {\n- return Promise.resolve();\n- },\nbeginEmulation() {\nreturn Promise.resolve();\n},\n",
"new_path": "lighthouse-core/test/gather/fake-driver.js",
"old_path": "lighthouse-core/test/gather/fake-driver.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -56,9 +56,6 @@ function getMockedEmulationDriver(emulationFn, netThrottleFn, cpuThrottleFn,\ngetUserAgent() {\nreturn Promise.resolve('Fake user agent');\n}\n- waitForLoadEvent() {\n- return Promise.resolve();\n- }\n};\nconst EmulationMock = class extends Connection {\nsendCommand(command, params) {\n@@ -258,8 +255,6 @@ describe('GatherRunner', function() {\ndismissJavaScriptDialogs: asyncFunc,\nenableRuntimeEvents: asyncFunc,\ncacheNatives: asyncFunc,\n- gotoURL: asyncFunc,\n- waitForLoadEvent: asyncFunc,\nregisterPerformanceObserver: asyncFunc,\ncleanBrowserCaches: createCheck('calledCleanBrowserCaches'),\nclearDataForOrigin: createCheck('calledClearStorage'),\n@@ -319,8 +314,6 @@ describe('GatherRunner', function() {\ndismissJavaScriptDialogs: asyncFunc,\nenableRuntimeEvents: asyncFunc,\ncacheNatives: asyncFunc,\n- gotoURL: asyncFunc,\n- waitForLoadEvent: asyncFunc,\nregisterPerformanceObserver: asyncFunc,\ncleanBrowserCaches: createCheck('calledCleanBrowserCaches'),\nclearDataForOrigin: createCheck('calledClearStorage'),\n",
"new_path": "lighthouse-core/test/gather/gather-runner-test.js",
"old_path": "lighthouse-core/test/gather/gather-runner-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(gather-runner): [revert] load a blank data URI, rather than about:blank (#4518)
This reverts commit 3030b4f0651fc4eb2634600d7cf0dbca43972b32.
| 1
|
core
|
gather-runner
|
807,849
|
12.02.2018 18:12:13
| 28,800
|
b28d8dac8ba75f63f8d6c6eea5494fddcfaeceec
|
chore: convert test/PublishCommand to clearAllMocks, not reset
|
[
{
"change_type": "MODIFY",
"diff": "@@ -94,24 +94,24 @@ const updatedPackageJSON = name =>\n.pop();\ndescribe(\"PublishCommand\", () => {\n- beforeEach(() => {\n// default exports that return Promises\n- writePkg.mockImplementation(() => Promise.resolve());\n- writeJsonFile.mockImplementation(() => Promise.resolve());\n+ writePkg.mockResolvedValue();\n+ writeJsonFile.mockResolvedValue();\n// we've already tested these utilities elsewhere\n- GitUtilities.isInitialized = jest.fn(() => true);\n- GitUtilities.getCurrentBranch = jest.fn(() => \"master\");\n- GitUtilities.getShortSHA = jest.fn(() => \"deadbeef\");\n+ GitUtilities.isInitialized.mockReturnValue(true);\n+ GitUtilities.getCurrentBranch.mockReturnValue(\"master\");\n+ GitUtilities.getShortSHA.mockReturnValue(\"deadbeef\");\n+ GitUtilities.diffSinceIn.mockReturnValue(\"\");\n- NpmUtilities.publishTaggedInDir = jest.fn(() => Promise.resolve());\n- NpmUtilities.checkDistTag = jest.fn(() => true);\n+ NpmUtilities.publishTaggedInDir.mockResolvedValue();\n+ NpmUtilities.checkDistTag.mockReturnValue(true);\n- PromptUtilities.select.mockImplementation(() => Promise.resolve(\"1.0.1\"));\n- PromptUtilities.confirm.mockImplementation(() => Promise.resolve(true));\n- });\n+ PromptUtilities.select.mockResolvedValue(\"1.0.1\");\n+ PromptUtilities.confirm.mockResolvedValue(true);\n- afterEach(() => jest.resetAllMocks());\n+ // don't reset default impls, just clear calls\n+ afterEach(jest.clearAllMocks);\n/** =========================================================================\n* NORMAL\n@@ -536,15 +536,13 @@ describe(\"PublishCommand\", () => {\n* ======================================================================= */\ndescribe(\"normal mode with previous prerelease\", () => {\n- beforeEach(async () => {\n- GitUtilities.hasTags.mockReturnValue(true);\n- GitUtilities.getLastTag.mockReturnValue(\"v1.0.1-beta.3\");\n- GitUtilities.diffSinceIn.mockImplementation((since, location) => {\n- if (location.endsWith(\"package-3\")) {\n- return \"packages/package-3/newfile.json\";\n- }\n- return \"\";\n- });\n+ beforeEach(() => {\n+ GitUtilities.hasTags.mockReturnValueOnce(true);\n+ GitUtilities.getLastTag.mockReturnValueOnce(\"v1.0.1-beta.3\");\n+ GitUtilities.diffSinceIn\n+ .mockReturnValueOnce(\"\")\n+ .mockReturnValueOnce(\"\")\n+ .mockReturnValueOnce(\"packages/package-3/newfile.json\");\n});\nit(\"publishes changed & prereleased packages if --cd-version is non-prerelease\", async () => {\n",
"new_path": "test/PublishCommand.js",
"old_path": "test/PublishCommand.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: convert test/PublishCommand to clearAllMocks, not reset
| 1
|
chore
| null |
791,731
|
13.02.2018 10:14:36
| 28,800
|
9b56ccb4f1539090922d021a0352ef1c821aefb2
|
docs(headless-chrome.md): fix broken link
|
[
{
"change_type": "MODIFY",
"diff": "@@ -96,5 +96,5 @@ launchChromeAndRunLighthouse('https://github.com', flags).then(results => {\nOther resources you might find helpful:\n- [Getting Started with Headless Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome)\n-- Example [Dockerfile](https://github.com/ebidel/lighthouse-ci/blob/master/builder/Dockerfile.headless)\n+- Example [Dockerfile](https://github.com/ebidel/lighthouse-ci/blob/master/builder/Dockerfile)\n- Lighthouse's [`.travis.yml`](https://github.com/GoogleChrome/lighthouse/blob/master/.travis.yml)\n",
"new_path": "docs/headless-chrome.md",
"old_path": "docs/headless-chrome.md"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
docs(headless-chrome.md): fix broken link (#4523)
| 1
|
docs
|
headless-chrome.md
|
807,849
|
13.02.2018 13:22:46
| 28,800
|
56cce9c6e803296bfbd48f69a7e9a6c06153059e
|
chore: Fix transitive dependent collection broken in
|
[
{
"change_type": "MODIFY",
"diff": "@@ -74,14 +74,11 @@ class UpdatedPackagesCollector {\ngetUpdates() {\nthis.logger.silly(\"getUpdates\");\n- const updatedPackages = this.collectUpdatedPackages();\n- const prereleasedPackages = this.collectPrereleasedPackages();\n- const dependents = new Set(\n- [...updatedPackages, ...prereleasedPackages].reduce(\n- (arr, node) => arr.concat(...node.localDependents),\n- []\n- )\n- );\n+ this.candidates = new Set();\n+\n+ this.collectUpdatedPackages();\n+ this.collectPrereleasedPackages();\n+ this.collectTransitiveDependents();\nconst updates = [];\n@@ -96,7 +93,7 @@ class UpdatedPackagesCollector {\nthis.packages.forEach(mapper);\n} else {\nthis.packages.forEach((node, name) => {\n- if (updatedPackages.has(node) || prereleasedPackages.has(node) || dependents.has(node)) {\n+ if (this.candidates.has(node)) {\nmapper(node, name);\n}\n});\n@@ -126,42 +123,70 @@ class UpdatedPackagesCollector {\nthis.logger.info(\"\", `Comparing with ${since || \"initial commit\"}.`);\n- const updatedPackages = new Set();\nconst forced = getForcedPackages(forcePublish);\nif (!since || forced.has(\"*\")) {\n- this.packages.forEach(node => updatedPackages.add(node));\n+ this.packages.forEach(node => this.candidates.add(node));\n} else {\nconst hasDiffSinceThatIsntIgnored = makeDiffSince(rootPath, execOpts, ignorePatterns);\nthis.packages.forEach((node, name) => {\nif (forced.has(name) || hasDiffSinceThatIsntIgnored(node, since)) {\n- updatedPackages.add(node);\n+ this.candidates.add(node);\n}\n});\n}\n-\n- return updatedPackages;\n}\ncollectPrereleasedPackages() {\n- this.logger.info(\"\", \"Checking for prereleased packages...\");\n-\n- const prereleasedPackages = new Set();\n-\nif ((this.options.cdVersion || \"\").startsWith(\"pre\")) {\n- return prereleasedPackages;\n+ return;\n}\n+ this.logger.info(\"\", \"Checking for prereleased packages...\");\n+\n// skip packages that have not been previously prereleased\nthis.packages.forEach((node, name) => {\nif (semver.prerelease(node.version)) {\nthis.logger.verbose(\"prereleased\", name);\n- prereleasedPackages.add(node);\n+ this.candidates.add(node);\n+ }\n+ });\n}\n+\n+ collectTransitiveDependents() {\n+ const collected = new Set();\n+\n+ this.candidates.forEach((currentNode, currentName) => {\n+ if (currentNode.localDependents.size === 0) {\n+ // no point diving into a non-existent tree\n+ return;\n+ }\n+\n+ // depth-first search, whee\n+ const seen = new Set();\n+\n+ const visit = (dependentNode, dependentName, siblingDependents) => {\n+ if (seen.has(dependentNode)) {\n+ return;\n+ }\n+\n+ seen.add(dependentNode);\n+\n+ if (dependentNode === currentNode || siblingDependents.has(currentName)) {\n+ // a direct or transitive cycle, skip it\n+ return;\n+ }\n+\n+ collected.add(dependentNode);\n+\n+ dependentNode.localDependents.forEach(visit);\n+ };\n+\n+ currentNode.localDependents.forEach(visit);\n});\n- return prereleasedPackages;\n+ collected.forEach(node => this.candidates.add(node));\n}\n}\n",
"new_path": "src/UpdatedPackagesCollector.js",
"old_path": "src/UpdatedPackagesCollector.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -23,8 +23,8 @@ const commandModule = require(\"../src/commands/PublishCommand\");\nconst run = yargsRunner(commandModule);\n-jest.mock(\"write-json-file\", () => jest.fn(() => Promise.resolve()));\n-jest.mock(\"write-pkg\", () => jest.fn(() => Promise.resolve()));\n+jest.mock(\"write-json-file\");\n+jest.mock(\"write-pkg\");\njest.mock(\"../src/GitUtilities\");\njest.mock(\"../src/NpmUtilities\");\njest.mock(\"../src/PromptUtilities\");\n@@ -33,11 +33,6 @@ jest.mock(\"../src/ConventionalCommitUtilities\");\n// silence logs\nlog.level = \"silent\";\n-const execOpts = testDir =>\n- expect.objectContaining({\n- cwd: testDir,\n- });\n-\nconst publishedTagInDirectories = testDir =>\nNpmUtilities.publishTaggedInDir.mock.calls.reduce((arr, args) => {\nconst tag = args[0];\n@@ -151,7 +146,13 @@ describe(\"PublishCommand\", () => {\nexpect(publishedTagInDirectories(testDir)).toMatchSnapshot(\"npm published\");\n- expect(GitUtilities.pushWithTags).lastCalledWith(\"origin\", gitTagsAdded(), execOpts(testDir));\n+ expect(GitUtilities.pushWithTags).lastCalledWith(\n+ \"origin\",\n+ gitTagsAdded(),\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n+ );\nexpect(consoleOutput()).toMatchSnapshot(\"console output\");\n});\n@@ -174,7 +175,7 @@ describe(\"PublishCommand\", () => {\nit(\"should publish the changed packages in independent mode\", async () => {\n// mock version prompt choices\n[\"1.0.1\", \"1.1.0\", \"2.0.0\", \"1.1.0\", \"1.0.1\"].forEach(chosenVersion =>\n- PromptUtilities.select.mockReturnValueOnce(Promise.resolve(chosenVersion))\n+ PromptUtilities.select.mockResolvedValueOnce(chosenVersion)\n);\nconst testDir = await initFixture(\"PublishCommand/independent\");\n@@ -205,7 +206,13 @@ describe(\"PublishCommand\", () => {\nexpect(publishedTagInDirectories(testDir)).toMatchSnapshot(\"npm published\");\n- expect(GitUtilities.pushWithTags).lastCalledWith(\"origin\", gitTagsAdded(), execOpts(testDir));\n+ expect(GitUtilities.pushWithTags).lastCalledWith(\n+ \"origin\",\n+ gitTagsAdded(),\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n+ );\nexpect(consoleOutput()).toMatchSnapshot(\"console output\");\n});\n});\n@@ -239,7 +246,9 @@ describe(\"PublishCommand\", () => {\nexpect(GitUtilities.addTag).not.toBeCalled();\nexpect(GitUtilities.checkoutChanges).lastCalledWith(\nexpect.stringContaining(\"packages/*/package.json\"),\n- execOpts(testDir)\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n);\nexpect(GitUtilities.pushWithTags).not.toBeCalled();\n@@ -412,7 +421,13 @@ describe(\"PublishCommand\", () => {\nexpect(removedDistTagInDirectories(testDir)).toMatchSnapshot(\"npm dist-tag rm\");\nexpect(addedDistTagInDirectories(testDir)).toMatchSnapshot(\"npm dist-tag add\");\n- expect(GitUtilities.pushWithTags).lastCalledWith(\"origin\", [\"v1.0.1\"], execOpts(testDir));\n+ expect(GitUtilities.pushWithTags).lastCalledWith(\n+ \"origin\",\n+ [\"v1.0.1\"],\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n+ );\n});\n});\n@@ -631,7 +646,13 @@ describe(\"PublishCommand\", () => {\nconst testDir = await initFixture(\"PublishCommand/normal\");\nawait run(testDir)(\"--git-remote\", \"upstream\");\n- expect(GitUtilities.pushWithTags).lastCalledWith(\"upstream\", [\"v1.0.1\"], execOpts(testDir));\n+ expect(GitUtilities.pushWithTags).lastCalledWith(\n+ \"upstream\",\n+ [\"v1.0.1\"],\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n+ );\n});\n});\n@@ -658,14 +679,24 @@ describe(\"PublishCommand\", () => {\nconst testDir = await initFixture(\"PublishCommand/normal\");\nawait run(testDir)(\"--message\", \"chore: Release %s :rocket:\");\n- expect(GitUtilities.commit).lastCalledWith(\"chore: Release v1.0.1 :rocket:\", execOpts(testDir));\n+ expect(GitUtilities.commit).lastCalledWith(\n+ \"chore: Release v1.0.1 :rocket:\",\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n+ );\n});\nit(\"commits changes with a custom message using %v\", async () => {\nconst testDir = await initFixture(\"PublishCommand/normal\");\nawait run(testDir)(\"--message\", \"chore: Release %v :rocket:\");\n- expect(GitUtilities.commit).lastCalledWith(\"chore: Release 1.0.1 :rocket:\", execOpts(testDir));\n+ expect(GitUtilities.commit).lastCalledWith(\n+ \"chore: Release 1.0.1 :rocket:\",\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n+ );\n});\n});\n@@ -678,7 +709,12 @@ describe(\"PublishCommand\", () => {\nconst testDir = await initFixture(\"PublishCommand/independent\");\nawait run(testDir)(\"-m\", \"chore: Custom publish message\");\n- expect(GitUtilities.commit).lastCalledWith(expect.stringContaining(\"chore:\"), execOpts(testDir));\n+ expect(GitUtilities.commit).lastCalledWith(\n+ expect.stringContaining(\"chore: Custom publish message\"),\n+ expect.objectContaining({\n+ cwd: testDir,\n+ })\n+ );\nexpect(gitCommitMessage()).toMatchSnapshot(\"git commit message\");\n});\n});\n@@ -688,18 +724,16 @@ describe(\"PublishCommand\", () => {\n* ======================================================================= */\ndescribe(\"--conventional-commits\", () => {\n- beforeEach(() => {\nConventionalCommitUtilities.updateChangelog.mockImplementation(pkg =>\nPromise.resolve(path.join(pkg.location, \"CHANGELOG.md\"))\n);\n- });\ndescribe(\"independent mode\", () => {\nconst versionBumps = [\"1.0.1\", \"2.1.0\", \"4.0.0\", \"4.1.0\", \"5.0.1\"];\nbeforeEach(() => {\nversionBumps.forEach(bump =>\n- ConventionalCommitUtilities.recommendVersion.mockReturnValueOnce(Promise.resolve(bump))\n+ ConventionalCommitUtilities.recommendVersion.mockResolvedValueOnce(bump)\n);\n});\n@@ -747,11 +781,11 @@ describe(\"PublishCommand\", () => {\ndescribe(\"fixed mode\", () => {\nbeforeEach(() => {\nConventionalCommitUtilities.recommendVersion\n- .mockReturnValueOnce(Promise.resolve(\"1.0.1\"))\n- .mockReturnValueOnce(Promise.resolve(\"1.1.0\"))\n- .mockReturnValueOnce(Promise.resolve(\"2.0.0\"))\n- .mockReturnValueOnce(Promise.resolve(\"1.1.0\"))\n- .mockReturnValueOnce(Promise.resolve(\"1.0.0\"));\n+ .mockResolvedValueOnce(\"1.0.1\")\n+ .mockResolvedValueOnce(\"1.1.0\")\n+ .mockResolvedValueOnce(\"2.0.0\")\n+ .mockResolvedValueOnce(\"1.1.0\")\n+ .mockResolvedValueOnce(\"1.0.0\");\n});\nit(\"should use conventional-commits utility to guess version bump and generate CHANGELOG\", async () => {\n@@ -781,7 +815,7 @@ describe(\"PublishCommand\", () => {\nexpect(ConventionalCommitUtilities.updateChangelog).lastCalledWith(\nexpect.objectContaining({\nname: \"normal\",\n- location: path.join(testDir),\n+ location: testDir,\n}),\n\"root\",\n{ changelogPreset: undefined, version: \"2.0.0\" }\n@@ -948,4 +982,16 @@ describe(\"PublishCommand\", () => {\nexpect(NpmUtilities.runScriptInDirSync.mock.calls.map(args => args[0])).toEqual(scripts);\n});\n});\n+\n+ it(\"publishes all transitive dependents after change\", async () => {\n+ const testDir = await initFixture(\"PublishCommand/snake-graph\");\n+\n+ GitUtilities.hasTags.mockReturnValueOnce(true);\n+ GitUtilities.getLastTag.mockReturnValueOnce(\"v1.0.0\");\n+ GitUtilities.diffSinceIn.mockReturnValueOnce(\"packages/package-1/package.json\");\n+\n+ await run(testDir)(\"--cd-version\", \"major\", \"--yes\");\n+\n+ expect(updatedPackageVersions(testDir)).toMatchSnapshot();\n+ });\n});\n",
"new_path": "test/PublishCommand.js",
"old_path": "test/PublishCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -518,3 +518,13 @@ Object {\n\"packages/package-3\": \"1.0.1-beta.4\",\n}\n`;\n+\n+exports[`PublishCommand publishes all transitive dependents after change 1`] = `\n+Object {\n+ \"packages/package-1\": \"2.0.0\",\n+ \"packages/package-2\": \"2.0.0\",\n+ \"packages/package-3\": \"2.0.0\",\n+ \"packages/package-4\": \"2.0.0\",\n+ \"packages/package-5\": \"2.0.0\",\n+}\n+`;\n",
"new_path": "test/__snapshots__/PublishCommand.js.snap",
"old_path": "test/__snapshots__/PublishCommand.js.snap"
},
{
"change_type": "ADD",
"diff": "+{\n+ \"lerna\": \"__TEST_VERSION__\",\n+ \"version\": \"1.0.0\"\n+}\n",
"new_path": "test/fixtures/PublishCommand/snake-graph/lerna.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"snake-graph\",\n+ \"description\": \"when a change in the head (package-1) occurs, the tail (package-5) should be bumped as well\"\n+}\n",
"new_path": "test/fixtures/PublishCommand/snake-graph/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"package-1\",\n+ \"description\": \"no local dependencies, four local dependents (three transitive)\",\n+ \"version\": \"1.0.0\"\n+}\n",
"new_path": "test/fixtures/PublishCommand/snake-graph/packages/package-1/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"package-2\",\n+ \"description\": \"one local dependency, one direct dependent, no transitive dependencies\",\n+ \"version\": \"1.0.0\",\n+ \"dependencies\": {\n+ \"package-1\": \"^1.0.0\"\n+ }\n+}\n",
"new_path": "test/fixtures/PublishCommand/snake-graph/packages/package-2/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"package-3\",\n+ \"description\": \"one local dependency, one direct dependent, one transitive dependency\",\n+ \"version\": \"1.0.0\",\n+ \"dependencies\": {\n+ \"package-2\": \"^1.0.0\"\n+ }\n+}\n",
"new_path": "test/fixtures/PublishCommand/snake-graph/packages/package-3/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"package-4\",\n+ \"description\": \"one local dependency, one direct dependent, two transitive dependencies\",\n+ \"version\": \"1.0.0\",\n+ \"dependencies\": {\n+ \"package-3\": \"^1.0.0\"\n+ }\n+}\n",
"new_path": "test/fixtures/PublishCommand/snake-graph/packages/package-4/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"package-5\",\n+ \"description\": \"one local dependency, no dependents, three transitive dependencies\",\n+ \"version\": \"1.0.0\",\n+ \"dependencies\": {\n+ \"package-4\": \"^1.0.0\"\n+ }\n+}\n",
"new_path": "test/fixtures/PublishCommand/snake-graph/packages/package-5/package.json",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "@@ -243,6 +243,49 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n]\n`;\n+exports[`lerna publish updates all transitive dependents 1`] = `\n+Array [\n+ Object {\n+ change: true,\n+ description: no local dependencies, four local dependents (three transitive),\n+ name: package-1,\n+ version: 2.0.0,\n+ },\n+ Object {\n+ dependencies: Object {\n+ package-1: ^2.0.0,\n+ },\n+ description: one local dependency, one direct dependent, no transitive dependencies,\n+ name: package-2,\n+ version: 2.0.0,\n+ },\n+ Object {\n+ dependencies: Object {\n+ package-2: ^2.0.0,\n+ },\n+ description: one local dependency, one direct dependent, one transitive dependency,\n+ name: package-3,\n+ version: 2.0.0,\n+ },\n+ Object {\n+ dependencies: Object {\n+ package-3: ^2.0.0,\n+ },\n+ description: one local dependency, one direct dependent, two transitive dependencies,\n+ name: package-4,\n+ version: 2.0.0,\n+ },\n+ Object {\n+ dependencies: Object {\n+ package-4: ^2.0.0,\n+ },\n+ description: one local dependency, no dependents, three transitive dependencies,\n+ name: package-5,\n+ version: 2.0.0,\n+ },\n+]\n+`;\n+\nexports[`lerna publish updates fixed versions: commit 1`] = `\nv1.0.1\n",
"new_path": "test/integration/__snapshots__/lerna-publish.test.js.snap",
"old_path": "test/integration/__snapshots__/lerna-publish.test.js.snap"
},
{
"change_type": "MODIFY",
"diff": "@@ -91,6 +91,18 @@ describe(\"lerna publish\", () => {\nexpect(commitMessage).toMatchSnapshot(\"commit\");\n});\n+ test(\"updates all transitive dependents\", async () => {\n+ const cwd = await initFixture(\"PublishCommand/snake-graph\");\n+ const args = [\"publish\", \"--skip-npm\", \"--cd-version=major\", \"--yes\"];\n+\n+ await execa(\"git\", [\"tag\", \"v1.0.0\", \"-m\", \"v1.0.0\"], { cwd });\n+ await commitChangeToPackage(cwd, \"package-1\", \"change\", { change: true });\n+\n+ await runner(cwd)(...args);\n+\n+ expect(await loadPkgManifests(cwd)).toMatchSnapshot();\n+ });\n+\ntest(\"uses default suffix with canary flag\", async () => {\nconst cwd = await initFixture(\"PublishCommand/normal\");\nconst args = [\"publish\", \"--canary\", \"--skip-npm\", \"--yes\"];\n",
"new_path": "test/integration/lerna-publish.test.js",
"old_path": "test/integration/lerna-publish.test.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: Fix transitive dependent collection broken in #1260
| 1
|
chore
| null |
807,849
|
14.02.2018 13:13:20
| 28,800
|
72dcb4dbea52733703d16e77800000c43e2e5afe
|
fix: bump conventional-changelog-* to ensure security fixes propagate
|
[
{
"change_type": "MODIFY",
"diff": "\"dev\": true\n},\n\"conventional-changelog-angular\": {\n- \"version\": \"1.6.2\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.6.2.tgz\",\n- \"integrity\": \"sha512-LiGZkMJOCJFLNzDlZo3f+DpblcDSzsaYHUWhC+kzsqq+no4qwDP3uW0HVIHueXT4jJDhYNaE9t/XCD7vu7xR1g==\",\n+ \"version\": \"1.6.4\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.6.4.tgz\",\n+ \"integrity\": \"sha512-CGtgqRBYOYYwP/FGBZ+NydolVv0+9bFcQZYMqw8YPKms1n6QlKguaqO0bfBLRChWZjDXjTI3Spd/bNineVtAqA==\",\n\"requires\": {\n\"compare-func\": \"1.3.2\",\n\"q\": \"1.5.1\"\n}\n},\n\"conventional-changelog-core\": {\n- \"version\": \"2.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-2.0.1.tgz\",\n- \"integrity\": \"sha512-XxgSDsCUGXT4j3uVpYkz17D1AoWzO8BOC0VO1fSwvvXJB5Q32zhPGXObvu7vTb0GE0OS15eDgzYN32fU3mOzYA==\",\n+ \"version\": \"2.0.3\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-2.0.3.tgz\",\n+ \"integrity\": \"sha512-yLnwThgG5M7k4ZuG87sWXQBEQPTijcB4TpUrSzJcH6Jk7vkZR4ej7GJgY5TqKKiVwALWzyAGd6GenzGbNZvYnw==\",\n\"requires\": {\n- \"conventional-changelog-writer\": \"3.0.0\",\n- \"conventional-commits-parser\": \"2.1.1\",\n+ \"conventional-changelog-writer\": \"3.0.2\",\n+ \"conventional-commits-parser\": \"2.1.3\",\n\"dateformat\": \"1.0.12\",\n\"get-pkg-repo\": \"1.4.0\",\n- \"git-raw-commits\": \"1.3.0\",\n+ \"git-raw-commits\": \"1.3.2\",\n\"git-remote-origin-url\": \"2.0.0\",\n- \"git-semver-tags\": \"1.3.0\",\n+ \"git-semver-tags\": \"1.3.2\",\n\"lodash\": \"4.17.5\",\n\"normalize-package-data\": \"2.4.0\",\n\"q\": \"1.5.1\",\n}\n},\n\"conventional-changelog-preset-loader\": {\n- \"version\": \"1.1.2\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-1.1.2.tgz\",\n- \"integrity\": \"sha512-uQiqFzPb38JPOOcGDfrIAQzMHlbJdYxnlGy3yzdGmNMihXJLRPJE+KuZEiQp519/i0gSCqF85upWL4wuzJmwsQ==\"\n+ \"version\": \"1.1.4\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-1.1.4.tgz\",\n+ \"integrity\": \"sha512-KY9sGPKnKlW542FpNN4++GkijXnND69/MgMa6EDibnyYXO6gV/NPwQwDTH6MOVVIjhspMgEM69H3yFVHo5Ud5g==\"\n},\n\"conventional-changelog-writer\": {\n- \"version\": \"3.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-3.0.0.tgz\",\n- \"integrity\": \"sha1-4QYVTtlDQeOH1xe2G+IYH/UyVMw=\",\n+ \"version\": \"3.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-3.0.2.tgz\",\n+ \"integrity\": \"sha512-eYXmYxT1IUuzzfpQuFA2/t3ex+7rFBbJchDIWyDTAs7OFkPBAfAs3EG04cDkEAG6Tn3wnwrtDKVZL9sMfA3kIw==\",\n\"requires\": {\n\"compare-func\": \"1.3.2\",\n- \"conventional-commits-filter\": \"1.1.1\",\n+ \"conventional-commits-filter\": \"1.1.3\",\n\"dateformat\": \"1.0.12\",\n\"handlebars\": \"4.0.11\",\n\"json-stringify-safe\": \"5.0.1\",\n}\n},\n\"conventional-commits-filter\": {\n- \"version\": \"1.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-1.1.1.tgz\",\n- \"integrity\": \"sha512-bQyatySNKHhcaeKVr9vFxYWA1W1Tdz6ybVMYDmv4/FhOXY1+fchiW07TzRbIQZhVa4cvBwrEaEUQBbCncFSdJQ==\",\n+ \"version\": \"1.1.3\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-1.1.3.tgz\",\n+ \"integrity\": \"sha512-kwGGg0xCHR51YIVjtoCTNgx9I1qEMETerTdSK4XsH2OxNLigDn6XKXnPMFZ+gfoUxaqbnpFSJqs4jYVpuJ1XAg==\",\n\"requires\": {\n\"is-subset\": \"0.1.1\",\n\"modify-values\": \"1.0.0\"\n}\n},\n\"conventional-commits-parser\": {\n- \"version\": \"2.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.1.1.tgz\",\n- \"integrity\": \"sha512-Qqxaul7TELPnTrm7KhWGjVTFTs7T9yUblzXugtXEff2C2uXFK4S0uVGqsyX7feQZzoFbXnJ1KdEs+IMmSxGbqQ==\",\n+ \"version\": \"2.1.3\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.1.3.tgz\",\n+ \"integrity\": \"sha512-j5nXna/snJtrzFtPbDm+9R5UsjteJkXn+cG1kGEi4+4e25U57CZBB6DiUdxOCnM9LOIHeLDBF61e9MtjPsZthw==\",\n\"requires\": {\n\"JSONStream\": \"1.3.2\",\n\"is-text-path\": \"1.0.1\",\n}\n},\n\"conventional-recommended-bump\": {\n- \"version\": \"2.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-2.0.1.tgz\",\n- \"integrity\": \"sha512-RnRn5kauE/tODxl/c66kJ8OSo6A+WkSc7xW1Rd7xdZ2E7++UN/Vd/NAq+6QKpP5ml5FMCliwaYM+sjhYfUJ4rQ==\",\n+ \"version\": \"2.0.4\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-2.0.4.tgz\",\n+ \"integrity\": \"sha512-GICSJxGywYR7Am6aEerLYS5CZoLvV1IzpOBeCl4v5WFmqyVecKVSOL62NqFuAz9mskSNqjzBjDxNIt3Lagag9g==\",\n\"requires\": {\n\"concat-stream\": \"1.6.0\",\n- \"conventional-changelog-preset-loader\": \"1.1.2\",\n- \"conventional-commits-filter\": \"1.1.1\",\n- \"conventional-commits-parser\": \"2.1.1\",\n- \"git-raw-commits\": \"1.3.0\",\n- \"git-semver-tags\": \"1.3.0\",\n+ \"conventional-changelog-preset-loader\": \"1.1.4\",\n+ \"conventional-commits-filter\": \"1.1.3\",\n+ \"conventional-commits-parser\": \"2.1.3\",\n+ \"git-raw-commits\": \"1.3.2\",\n+ \"git-semver-tags\": \"1.3.2\",\n\"meow\": \"3.7.0\",\n\"q\": \"1.5.1\"\n}\n}\n},\n\"git-raw-commits\": {\n- \"version\": \"1.3.0\",\n- \"resolved\": \"https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.3.0.tgz\",\n- \"integrity\": \"sha1-C8hZbpDV/+c29/VUa9LRL3OrqsY=\",\n+ \"version\": \"1.3.2\",\n+ \"resolved\": \"https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.3.2.tgz\",\n+ \"integrity\": \"sha512-ojMbErvEIPXaqNNwomSp/DYLhhbU+BEcCOyPZ26U8VNaQjBRN9lZ7E3vfjIkTA8JLWYc5zsSxuVXut6bczKhrg==\",\n\"requires\": {\n\"dargs\": \"4.1.0\",\n\"lodash.template\": \"4.4.0\",\n}\n},\n\"git-semver-tags\": {\n- \"version\": \"1.3.0\",\n- \"resolved\": \"https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-1.3.0.tgz\",\n- \"integrity\": \"sha1-sVSDOmq1w2DArTsaqbjxLqBt6Rk=\",\n+ \"version\": \"1.3.2\",\n+ \"resolved\": \"https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-1.3.2.tgz\",\n+ \"integrity\": \"sha512-CXQJ4GdxkUya1YQaEKGcYIJ9RiuX4RTWnRIhiMlTItl8czRix4akE0CpoUSLmljuxEnUM/pFpd2FFwo+nV0SPA==\",\n\"requires\": {\n\"meow\": \"3.7.0\",\n\"semver\": \"5.5.0\"\n",
"new_path": "package-lock.json",
"old_path": "package-lock.json"
},
{
"change_type": "MODIFY",
"diff": "\"cmd-shim\": \"^2.0.2\",\n\"columnify\": \"^1.5.4\",\n\"command-join\": \"^2.0.0\",\n- \"conventional-changelog-angular\": \"^1.6.2\",\n- \"conventional-changelog-core\": \"^2.0.1\",\n- \"conventional-recommended-bump\": \"^2.0.1\",\n+ \"conventional-changelog-angular\": \"^1.6.4\",\n+ \"conventional-changelog-core\": \"^2.0.3\",\n+ \"conventional-recommended-bump\": \"^2.0.4\",\n\"dedent\": \"^0.7.0\",\n\"execa\": \"^0.9.0\",\n\"find-up\": \"^2.1.0\",\n",
"new_path": "package.json",
"old_path": "package.json"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
fix: bump conventional-changelog-* to ensure security fixes propagate
| 1
|
fix
| null |
807,849
|
15.02.2018 09:23:35
| 28,800
|
c8546166d0fd50e843a06d586254c1055a484c5d
|
refactor: DiffCommand
use PackageGraph instead of list search
throw ValidationError instead of generic
|
[
{
"change_type": "MODIFY",
"diff": "\"use strict\";\n-const _ = require(\"lodash\");\n-\nconst ChildProcessUtilities = require(\"../ChildProcessUtilities\");\nconst Command = require(\"../Command\");\nconst GitUtilities = require(\"../GitUtilities\");\n+const ValidationError = require(\"../utils/ValidationError\");\nexports.handler = function handler(argv) {\n// eslint-disable-next-line no-use-before-define\n@@ -38,27 +37,27 @@ class DiffCommand extends Command {\nlet targetPackage;\nif (packageName) {\n- targetPackage = _.find(this.packages, pkg => pkg.name === packageName);\n+ targetPackage = this.packageGraph.get(packageName);\nif (!targetPackage) {\n- callback(new Error(`Package '${packageName}' does not exist.`));\n- return;\n+ throw new ValidationError(\"ENOPKG\", `Cannot diff, the package '${packageName}' does not exist.`);\n}\n}\nif (!GitUtilities.hasCommit(this.execOpts)) {\n- callback(new Error(\"Can't diff. There are no commits in this repository, yet.\"));\n- return;\n+ throw new ValidationError(\"ENOCOMMITS\", \"Cannot diff, there are no commits in this repository yet.\");\n}\n- this.args = [\"diff\", getLastCommit(this.execOpts), \"--color=auto\"];\n+ const args = [\"diff\", getLastCommit(this.execOpts), \"--color=auto\"];\nif (targetPackage) {\n- this.args.push(\"--\", targetPackage.location);\n+ args.push(\"--\", targetPackage.location);\n} else {\n- this.args.push(\"--\", ...this.repository.packageParentDirs);\n+ args.push(\"--\", ...this.repository.packageParentDirs);\n}\n+ this.args = args;\n+\ncallback(null, true);\n}\n",
"new_path": "src/commands/DiffCommand.js",
"old_path": "src/commands/DiffCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -90,7 +90,7 @@ describe(\"DiffCommand\", () => {\nawait lernaDiff(\"missing\");\n} catch (err) {\nexpect(err.exitCode).toBe(1);\n- expect(err.message).toBe(\"Package 'missing' does not exist.\");\n+ expect(err.message).toBe(\"Cannot diff, the package 'missing' does not exist.\");\n}\n});\n@@ -102,7 +102,7 @@ describe(\"DiffCommand\", () => {\nawait lernaDiff(\"package-1\");\n} catch (err) {\nexpect(err.exitCode).toBe(1);\n- expect(err.message).toBe(\"Can't diff. There are no commits in this repository, yet.\");\n+ expect(err.message).toBe(\"Cannot diff, there are no commits in this repository yet.\");\n}\n});\n",
"new_path": "test/DiffCommand.js",
"old_path": "test/DiffCommand.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor: DiffCommand
- use PackageGraph instead of list search
- throw ValidationError instead of generic
| 1
|
refactor
| null |
807,849
|
15.02.2018 09:26:01
| 28,800
|
ebb5ddc7ddeb6e5588171fff9d9604bc0f6f34db
|
refactor: UpdatedCommand
yargs builder is a function the mixes in publishOptions
format results in ternary before output is emitted
|
[
{
"change_type": "MODIFY",
"diff": "\"use strict\";\n-const _ = require(\"lodash\");\nconst chalk = require(\"chalk\");\nconst Command = require(\"../Command\");\n@@ -8,15 +7,6 @@ const output = require(\"../utils/output\");\nconst publishOptions = require(\"./PublishCommand\").builder;\nconst UpdatedPackagesCollector = require(\"../UpdatedPackagesCollector\");\n-const updatedOptions = _.assign({}, publishOptions, {\n- json: {\n- describe: \"Show information in JSON format\",\n- group: \"Command Options:\",\n- type: \"boolean\",\n- default: undefined,\n- },\n-});\n-\nexports.handler = function handler(argv) {\n// eslint-disable-next-line no-use-before-define\nreturn new UpdatedCommand(argv);\n@@ -26,13 +16,34 @@ exports.command = \"updated\";\nexports.describe = \"Check which packages have changed since the last publish.\";\n-exports.builder = yargs => yargs.options(updatedOptions);\n+exports.builder = yargs =>\n+ yargs.options(\n+ Object.assign({}, publishOptions, {\n+ json: {\n+ describe: \"Show information in JSON format\",\n+ group: \"Command Options:\",\n+ type: \"boolean\",\n+ default: undefined,\n+ },\n+ })\n+ );\nclass UpdatedCommand extends Command {\n+ get otherCommandConfigs() {\n+ return [\"publish\"];\n+ }\n+\n+ get defaultOptions() {\n+ return Object.assign({}, super.defaultOptions, {\n+ json: false,\n+ });\n+ }\n+\ninitialize(callback) {\nthis.updates = new UpdatedPackagesCollector(this).getUpdates();\nconst proceedWithUpdates = this.updates.length > 0;\n+\nif (!proceedWithUpdates) {\nthis.logger.info(\"No packages need updating\");\n}\n@@ -40,16 +51,6 @@ class UpdatedCommand extends Command {\ncallback(null, proceedWithUpdates, 1);\n}\n- get otherCommandConfigs() {\n- return [\"publish\"];\n- }\n-\n- get defaultOptions() {\n- return Object.assign({}, super.defaultOptions, {\n- json: false,\n- });\n- }\n-\nexecute(callback) {\nconst updatedPackages = this.updates.map(update => update.package).map(pkg => ({\nname: pkg.name,\n@@ -57,15 +58,13 @@ class UpdatedCommand extends Command {\nprivate: pkg.private,\n}));\n- this.logger.info(\"result\");\n- if (this.options.json) {\n- output(JSON.stringify(updatedPackages, null, 2));\n- } else {\n- const formattedUpdates = updatedPackages\n+ const formattedUpdates = this.options.json\n+ ? JSON.stringify(updatedPackages, null, 2)\n+ : updatedPackages\n.map(pkg => `- ${pkg.name}${pkg.private ? ` (${chalk.red(\"private\")})` : \"\"}`)\n.join(\"\\n\");\n+\noutput(formattedUpdates);\n- }\ncallback(null, true);\n}\n",
"new_path": "src/commands/UpdatedCommand.js",
"old_path": "src/commands/UpdatedCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -59,20 +59,27 @@ describe(\"UpdatedCommand\", () => {\nexpect(consoleOutput()).toMatchSnapshot();\n});\n- it(\"should list changes with --force-publish *\", async () => {\n+ it(\"should list changes with --force-publish\", async () => {\nawait setupGitChanges(testDir, [\"packages/package-2/random-file\"]);\nawait lernaUpdated(\"--force-publish\");\nexpect(consoleOutput()).toMatchSnapshot();\n});\n- it(\"should list changes with --force-publish [package,package]\", async () => {\n+ it(\"should list changes with --force-publish package-2,package-4\", async () => {\nawait setupGitChanges(testDir, [\"packages/package-3/random-file\"]);\nawait lernaUpdated(\"--force-publish\", \"package-2,package-4\");\nexpect(consoleOutput()).toMatchSnapshot();\n});\n+ it(\"should list changes with --force-publish package-2 --force-publish package-4\", async () => {\n+ await setupGitChanges(testDir, [\"packages/package-3/random-file\"]);\n+\n+ await lernaUpdated(\"--force-publish\", \"package-2\", \"--force-publish\", \"package-4\");\n+ expect(consoleOutput()).toMatchSnapshot();\n+ });\n+\nit(\"should list changes without ignored files\", async () => {\nawait updateLernaConfig(testDir, {\ncommands: {\n@@ -142,7 +149,7 @@ describe(\"UpdatedCommand\", () => {\nexpect(consoleOutput()).toMatchSnapshot();\n});\n- it(\"should list changes with --force-publish [package,package]\", async () => {\n+ it(\"should list changes with --force-publish package-2\", async () => {\nawait setupGitChanges(testDir, [\"packages/package-4/random-file\"]);\nawait lernaUpdated(\"--force-publish\", \"package-2\");\n",
"new_path": "test/UpdatedCommand.js",
"old_path": "test/UpdatedCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -15,7 +15,7 @@ exports[`UpdatedCommand basic should list changes 1`] = `\nexports[`UpdatedCommand basic should list changes in private packages 1`] = `\"- package-5 (private)\"`;\n-exports[`UpdatedCommand basic should list changes with --force-publish * 1`] = `\n+exports[`UpdatedCommand basic should list changes with --force-publish 1`] = `\n\"- package-1\n- package-2\n- package-3\n@@ -23,7 +23,13 @@ exports[`UpdatedCommand basic should list changes with --force-publish * 1`] = `\n- package-5 (private)\"\n`;\n-exports[`UpdatedCommand basic should list changes with --force-publish [package,package] 1`] = `\n+exports[`UpdatedCommand basic should list changes with --force-publish package-2 --force-publish package-4 1`] = `\n+\"- package-2\n+- package-3\n+- package-4\"\n+`;\n+\n+exports[`UpdatedCommand basic should list changes with --force-publish package-2,package-4 1`] = `\n\"- package-2\n- package-3\n- package-4\"\n@@ -44,7 +50,7 @@ exports[`UpdatedCommand circular should list changes with --force-publish * 1`]\n- package-5 (private)\"\n`;\n-exports[`UpdatedCommand circular should list changes with --force-publish [package,package] 1`] = `\n+exports[`UpdatedCommand circular should list changes with --force-publish package-2 1`] = `\n\"- package-2\n- package-3\n- package-4\"\n",
"new_path": "test/__snapshots__/UpdatedCommand.js.snap",
"old_path": "test/__snapshots__/UpdatedCommand.js.snap"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor: UpdatedCommand
- yargs builder is a function the mixes in publishOptions
- format results in ternary before output is emitted
| 1
|
refactor
| null |
807,849
|
15.02.2018 14:51:00
| 28,800
|
e06d77fa3a1917b4f4e0578eb29bf97f1e1c9c8e
|
refactor(test): don't actually chdir during Command unit tests
|
[
{
"change_type": "MODIFY",
"diff": "@@ -26,7 +26,7 @@ const onAllExitedOriginal = ChildProcessUtilities.onAllExited;\nconst getChildProcessCountOriginal = ChildProcessUtilities.getChildProcessCount;\ndescribe(\"Command\", () => {\n- const originalCWD = process.cwd();\n+ let testDir;\nafterEach(() => jest.resetAllMocks());\n@@ -34,15 +34,12 @@ describe(\"Command\", () => {\nChildProcessUtilities.onAllExited = jest.fn(callsBack());\nChildProcessUtilities.getChildProcessCount = jest.fn(() => 0);\n- const testDir = await initFixture(\"Command/basic\");\n- process.chdir(testDir);\n+ testDir = await initFixture(\"Command/basic\");\n});\nafterAll(() => {\nChildProcessUtilities.onAllExited = onAllExitedOriginal;\nChildProcessUtilities.getChildProcessCount = getChildProcessCountOriginal;\n-\n- process.chdir(originalCWD);\n});\n// swallow errors when passed in argv\n@@ -58,7 +55,7 @@ describe(\"Command\", () => {\n}\n// convenience to avoid silly \"not implemented errors\"\n- const testFactory = (argv = {}) => new OkCommand(argv);\n+ const testFactory = (argv = {}) => new OkCommand(Object.assign({ cwd: testDir }, argv));\ndescribe(\".lernaVersion\", () => {\nit(\"should be added to the instance\", async () => {\n@@ -110,7 +107,7 @@ describe(\"Command\", () => {\nit(\"has repo path\", () => {\nconst command = testFactory();\n- expect(command.execOpts.cwd).toBe(process.cwd());\n+ expect(command.execOpts.cwd).toBe(testDir);\n});\n});\n@@ -187,7 +184,7 @@ describe(\"Command\", () => {\n}\ntry {\n- await new PkgErrorCommand({});\n+ await new PkgErrorCommand({ cwd: testDir });\n} catch (err) {\nexpect(console.error.mock.calls).toHaveLength(2);\nexpect(console.error.mock.calls[0]).toEqual([\"pkg-err-stdout\"]);\n@@ -331,32 +328,33 @@ describe(\"Command\", () => {\n}\nit(\"is a lazy getter\", () => {\n- const instance = new TestACommand({ onRejected });\n+ const instance = new TestACommand({ cwd: testDir, onRejected });\nexpect(instance.options).toBe(instance.options);\n});\nit(\"should pick up global options\", () => {\n- const instance = new TestACommand({ onRejected });\n+ const instance = new TestACommand({ cwd: testDir, onRejected });\nexpect(instance.options.testOption).toBe(\"default\");\n});\nit(\"should override global options with command-level options\", () => {\n- const instance = new TestBCommand({ onRejected });\n+ const instance = new TestBCommand({ cwd: testDir, onRejected });\nexpect(instance.options.testOption).toBe(\"b\");\n});\nit(\"should override global options with inherited command-level options\", () => {\n- const instance = new TestCCommand({ onRejected });\n+ const instance = new TestCCommand({ cwd: testDir, onRejected });\nexpect(instance.options.testOption).toBe(\"b\");\n});\nit(\"should override inherited command-level options with local command-level options\", () => {\n- const instance = new TestCCommand({ onRejected });\n+ const instance = new TestCCommand({ cwd: testDir, onRejected });\nexpect(instance.options.testOption2).toBe(\"c\");\n});\nit(\"should override everything with a CLI flag\", () => {\nconst instance = new TestCCommand({\n+ cwd: testDir,\nonRejected,\ntestOption2: \"f\",\n});\n@@ -365,6 +363,7 @@ describe(\"Command\", () => {\nit(\"should inherit durable options when a CLI flag is undefined\", () => {\nconst instance = new TestCCommand({\n+ cwd: testDir,\nonRejected,\ntestOption: undefined, // yargs does this when --test-option is not passed\n});\n@@ -373,6 +372,7 @@ describe(\"Command\", () => {\nit(\"should merge flags with defaultOptions\", () => {\nconst instance = new TestCCommand({\n+ cwd: testDir,\nonRejected,\ntestOption: \"b\",\n});\n@@ -483,7 +483,7 @@ describe(\"Command\", () => {\ndescribe(\"subclass implementation\", () => {\n[\"initialize\", \"execute\"].forEach(method => {\nit(`throws if ${method}() is not overridden`, () => {\n- const command = new Command({ onRejected });\n+ const command = new Command({ cwd: testDir, onRejected });\nexpect(() => command[method]()).toThrow();\n});\n});\n@@ -491,6 +491,8 @@ describe(\"Command\", () => {\ndescribe(\"validations\", () => {\nit(\"throws ENOGIT when repository is not initialized\", async () => {\n+ expect.assertions(2);\n+\nconst cwd = tempy.directory();\ntry {\n@@ -499,12 +501,13 @@ describe(\"Command\", () => {\nexpect(err.exitCode).toBe(1);\nexpect(err.prefix).toBe(\"ENOGIT\");\n}\n-\n- expect.assertions(2);\n});\nit(\"throws ENOPKG when root package.json is not found\", async () => {\n+ expect.assertions(2);\n+\nconst cwd = await initFixture(\"Command/basic\");\n+\nawait fs.remove(path.join(cwd, \"package.json\"));\ntry {\n@@ -513,12 +516,13 @@ describe(\"Command\", () => {\nexpect(err.exitCode).toBe(1);\nexpect(err.prefix).toBe(\"ENOPKG\");\n}\n-\n- expect.assertions(2);\n});\nit(\"throws ENOLERNA when lerna.json is not found\", async () => {\n+ expect.assertions(2);\n+\nconst cwd = await initFixture(\"Command/basic\");\n+\nawait fs.remove(path.join(cwd, \"lerna.json\"));\ntry {\n@@ -527,8 +531,6 @@ describe(\"Command\", () => {\nexpect(err.exitCode).toBe(1);\nexpect(err.prefix).toBe(\"ENOLERNA\");\n}\n-\n- expect.assertions(2);\n});\n});\n});\n",
"new_path": "test/Command.js",
"old_path": "test/Command.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor(test): don't actually chdir during Command unit tests
| 1
|
refactor
|
test
|
807,849
|
15.02.2018 14:59:44
| 28,800
|
2db09baa4a09325c97333b474e8e97da55a4c856
|
refactor(test): Use async readJSON in AddCommand unit tests
|
[
{
"change_type": "MODIFY",
"diff": "@@ -21,7 +21,7 @@ expect.extend(pkgMatchers);\n// silence logs\nlog.level = \"silent\";\n-const readPkg = (testDir, pkg) => fs.readJsonSync(path.join(testDir, pkg, \"package.json\"));\n+const readPkg = (testDir, pkg) => fs.readJSON(path.join(testDir, pkg, \"package.json\"));\ndescribe(\"AddCommand\", () => {\n// we already have enough tests of BootstrapCommand\n@@ -58,10 +58,10 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"lerna\");\n- expect(readPkg(testDir, \"packages/package-1\")).toDependOn(\"lerna\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDependOn(\"lerna\");\n- expect(readPkg(testDir, \"packages/package-3\")).toDependOn(\"lerna\");\n- expect(readPkg(testDir, \"packages/package-4\")).toDependOn(\"lerna\");\n+ expect(await readPkg(testDir, \"packages/package-1\")).toDependOn(\"lerna\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDependOn(\"lerna\");\n+ expect(await readPkg(testDir, \"packages/package-3\")).toDependOn(\"lerna\");\n+ expect(await readPkg(testDir, \"packages/package-4\")).toDependOn(\"lerna\");\n});\nit(\"should reference local dependencies\", async () => {\n@@ -69,9 +69,9 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-3\")).toDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-4\")).toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-3\")).toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-4\")).toDependOn(\"@test/package-1\");\n});\nit(\"should reference to multiple dependencies\", async () => {\n@@ -79,12 +79,12 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1\", \"@test/package-2\");\n- expect(readPkg(testDir, \"packages/package-1\")).toDependOn(\"@test/package-2\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-3\")).toDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-3\")).toDependOn(\"@test/package-2\");\n- expect(readPkg(testDir, \"packages/package-4\")).toDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-4\")).toDependOn(\"@test/package-2\");\n+ expect(await readPkg(testDir, \"packages/package-1\")).toDependOn(\"@test/package-2\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-3\")).toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-3\")).toDependOn(\"@test/package-2\");\n+ expect(await readPkg(testDir, \"packages/package-4\")).toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-4\")).toDependOn(\"@test/package-2\");\n});\nit(\"should reference current caret range if unspecified\", async () => {\n@@ -92,8 +92,8 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1\", \"@test/package-2\");\n- expect(readPkg(testDir, \"packages/package-1\")).toDependOn(\"@test/package-2\", \"^2.0.0\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\", \"^1.0.0\");\n+ expect(await readPkg(testDir, \"packages/package-1\")).toDependOn(\"@test/package-2\", \"^2.0.0\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\", \"^1.0.0\");\n});\nit(\"should reference specfied range\", async () => {\n@@ -101,7 +101,7 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1@~1\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\", \"~1\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\", \"~1\");\n});\nit(\"should reference to devDepdendencies\", async () => {\n@@ -109,9 +109,9 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1\", \"--dev\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDevDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-3\")).toDevDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-4\")).toDevDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDevDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-3\")).toDevDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-4\")).toDevDependOn(\"@test/package-1\");\n});\nit(\"should not reference packages to themeselves\", async () => {\n@@ -119,7 +119,7 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-1\")).not.toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-1\")).not.toDependOn(\"@test/package-1\");\n});\nit(\"should respect scopes\", async () => {\n@@ -127,9 +127,9 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1\", \"--scope=@test/package-2\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-3\")).not.toDevDependOn(\"@test/package-1\");\n- expect(readPkg(testDir, \"packages/package-4\")).not.toDevDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-3\")).not.toDevDependOn(\"@test/package-1\");\n+ expect(await readPkg(testDir, \"packages/package-4\")).not.toDevDependOn(\"@test/package-1\");\n});\nit(\"should retain existing dependencies\", async () => {\n@@ -137,7 +137,7 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-2\");\n- expect(readPkg(testDir, \"packages/package-1\")).toDependOn(\"pify\");\n+ expect(await readPkg(testDir, \"packages/package-1\")).toDependOn(\"pify\");\n});\nit(\"should retain existing devDependencies\", async () => {\n@@ -145,7 +145,7 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-1\", \"--dev\");\n- expect(readPkg(testDir, \"packages/package-2\")).toDevDependOn(\"file-url\");\n+ expect(await readPkg(testDir, \"packages/package-2\")).toDevDependOn(\"file-url\");\n});\nit(\"should bootstrap changed packages\", async () => {\n@@ -197,9 +197,9 @@ describe(\"AddCommand\", () => {\nawait lernaAdd(testDir)(\"@test/package-2\", \"pify\");\n- const pkg1 = readPkg(testDir, \"packages/package-1\");\n- const pkg2 = readPkg(testDir, \"packages/package-2\");\n- const pkg3 = readPkg(testDir, \"packages/package-3\");\n+ const pkg1 = await readPkg(testDir, \"packages/package-1\");\n+ const pkg2 = await readPkg(testDir, \"packages/package-2\");\n+ const pkg3 = await readPkg(testDir, \"packages/package-3\");\nexpect(pkg1).toDependOn(\"pify\", \"^3.0.0\"); // overwrites ^2.0.0\nexpect(pkg1).toDependOn(\"@test/package-2\");\n",
"new_path": "test/AddCommand.js",
"old_path": "test/AddCommand.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
refactor(test): Use async readJSON in AddCommand unit tests
| 1
|
refactor
|
test
|
807,849
|
15.02.2018 15:26:50
| 28,800
|
310a702ccefce34e44c04beb747acfc7fb53ec1f
|
chore: rename yargsRunner -> command-runner
|
[
{
"change_type": "MODIFY",
"diff": "@@ -12,7 +12,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst pkgMatchers = require(\"./helpers/pkgMatchers\");\n// file under test\n-const lernaAdd = require(\"./helpers/yargsRunner\")(require(\"../src/commands/AddCommand\"));\n+const lernaAdd = require(\"./helpers/command-runner\")(require(\"../src/commands/AddCommand\"));\njest.mock(\"../src/commands/BootstrapCommand\");\n",
"new_path": "test/AddCommand.js",
"old_path": "test/AddCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -13,7 +13,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\n-const lernaBootstrap = require(\"./helpers/yargsRunner\")(require(\"../src/commands/BootstrapCommand\"));\n+const lernaBootstrap = require(\"./helpers/command-runner\")(require(\"../src/commands/BootstrapCommand\"));\njest.mock(\"../src/utils/npm-install\");\njest.mock(\"../src/utils/npm-run-script\");\n",
"new_path": "test/BootstrapCommand.js",
"old_path": "test/BootstrapCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -12,7 +12,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\n-const lernaClean = require(\"./helpers/yargsRunner\")(require(\"../src/commands/CleanCommand\"));\n+const lernaClean = require(\"./helpers/command-runner\")(require(\"../src/commands/CleanCommand\"));\njest.mock(\"../src/PromptUtilities\");\n",
"new_path": "test/CleanCommand.js",
"old_path": "test/CleanCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -12,7 +12,7 @@ const callsBack = require(\"./helpers/callsBack\");\nconst initFixture = require(\"./helpers/initFixture\");\n// file under test\n-const lernaDiff = require(\"./helpers/yargsRunner\")(require(\"../src/commands/DiffCommand\"));\n+const lernaDiff = require(\"./helpers/command-runner\")(require(\"../src/commands/DiffCommand\"));\njest.mock(\"../src/ChildProcessUtilities\");\njest.mock(\"../src/GitUtilities\");\n",
"new_path": "test/DiffCommand.js",
"old_path": "test/DiffCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -13,7 +13,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\n-const lernaExec = require(\"./helpers/yargsRunner\")(require(\"../src/commands/ExecCommand\"));\n+const lernaExec = require(\"./helpers/command-runner\")(require(\"../src/commands/ExecCommand\"));\njest.mock(\"../src/ChildProcessUtilities\");\njest.mock(\"../src/UpdatedPackagesCollector\");\n",
"new_path": "test/ExecCommand.js",
"old_path": "test/ExecCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -15,7 +15,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst updateLernaConfig = require(\"./helpers/updateLernaConfig\");\n// file under test\n-const lernaImport = require(\"./helpers/yargsRunner\")(require(\"../src/commands/ImportCommand\"));\n+const lernaImport = require(\"./helpers/command-runner\")(require(\"../src/commands/ImportCommand\"));\njest.mock(\"../src/PromptUtilities\");\n",
"new_path": "test/ImportCommand.js",
"old_path": "test/ImportCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -10,7 +10,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst lernaVersion = require(\"../package.json\").version;\n// file under test\n-const lernaInit = require(\"./helpers/yargsRunner\")(require(\"../src/commands/InitCommand\"));\n+const lernaInit = require(\"./helpers/command-runner\")(require(\"../src/commands/InitCommand\"));\n// silence logs\nlog.level = \"silent\";\n",
"new_path": "test/InitCommand.js",
"old_path": "test/InitCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -11,7 +11,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\n-const lernaLink = require(\"./helpers/yargsRunner\")(require(\"../src/commands/LinkCommand\"));\n+const lernaLink = require(\"./helpers/command-runner\")(require(\"../src/commands/LinkCommand\"));\n// silence logs\nlog.level = \"silent\";\n",
"new_path": "test/LinkCommand.js",
"old_path": "test/LinkCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -7,7 +7,7 @@ const consoleOutput = require(\"./helpers/consoleOutput\");\nconst initFixture = require(\"./helpers/initFixture\");\n// file under test\n-const lernaLs = require(\"./helpers/yargsRunner\")(require(\"../src/commands/LsCommand\"));\n+const lernaLs = require(\"./helpers/command-runner\")(require(\"../src/commands/LsCommand\"));\n// silence logs\nlog.level = \"silent\";\n",
"new_path": "test/LsCommand.js",
"old_path": "test/LsCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -20,7 +20,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\n-const lernaPublish = require(\"./helpers/yargsRunner\")(require(\"../src/commands/PublishCommand\"));\n+const lernaPublish = require(\"./helpers/command-runner\")(require(\"../src/commands/PublishCommand\"));\njest.mock(\"write-json-file\");\njest.mock(\"write-pkg\");\n",
"new_path": "test/PublishCommand.js",
"old_path": "test/PublishCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -14,7 +14,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\n-const lernaRun = require(\"./helpers/yargsRunner\")(require(\"../src/commands/RunCommand\"));\n+const lernaRun = require(\"./helpers/command-runner\")(require(\"../src/commands/RunCommand\"));\njest.mock(\"../src/utils/output\");\njest.mock(\"../src/utils/npm-run-script\");\n",
"new_path": "test/RunCommand.js",
"old_path": "test/RunCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -11,7 +11,7 @@ const initFixture = require(\"./helpers/initFixture\");\nconst updateLernaConfig = require(\"./helpers/updateLernaConfig\");\n// file under test\n-const lernaUpdated = require(\"./helpers/yargsRunner\")(require(\"../src/commands/UpdatedCommand\"));\n+const lernaUpdated = require(\"./helpers/command-runner\")(require(\"../src/commands/UpdatedCommand\"));\n// silence logs\nlog.level = \"silent\";\n",
"new_path": "test/UpdatedCommand.js",
"old_path": "test/UpdatedCommand.js"
},
{
"change_type": "RENAME",
"diff": "const yargs = require(\"yargs/yargs\");\nconst globalOptions = require(\"../../src/Command\").builder;\n-module.exports = yargsRunner;\n+module.exports = commandRunner;\n/**\n* A higher-order function to help with passing _actual_ yargs-parsed argv\n@@ -12,7 +12,7 @@ module.exports = yargsRunner;\n* @param {Object} commandModule The yargs command exports\n* @return {Function} with partially-applied yargs config\n*/\n-function yargsRunner(commandModule) {\n+function commandRunner(commandModule) {\nconst cmd = commandModule.command.split(\" \")[0];\nconst hackDoubleDash = makeWorkAround();\n",
"new_path": "test/helpers/command-runner.js",
"old_path": "test/helpers/yargsRunner.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: rename yargsRunner -> command-runner
| 1
|
chore
| null |
679,913
|
15.02.2018 16:06:29
| 0
|
47d5df09c3fbe1287877cf4caa5c8868015f1877
|
chore: update issue tpl
|
[
{
"change_type": "MODIFY",
"diff": "<!--\n-Please use the following convention:\n-\n-- title: \"[module-name] issue subject\", e.g. \"[hiccup-dom] serialization question\"\n-- please also use any relevant labels to tag your issue\n-\n-If possible (or relevant), please include a minimum reproducable code example.\n+1. Please use labels to tag your issue (especially \"package:*\")\n+2. If possible (or relevant), please include a minimum reproducable code example.\n-->\n",
"new_path": ".github/issue_template.md",
"old_path": ".github/issue_template.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
chore: update issue tpl
| 1
|
chore
| null |
807,849
|
15.02.2018 16:15:48
| 28,800
|
d07d36bb83e13aa5ca630cd629a64dfedb352ca6
|
chore: add test/helpers/silence-logging to jest.setupFiles
|
[
{
"change_type": "MODIFY",
"diff": "\"<rootDir>/src\",\n\"<rootDir>/test\"\n],\n+ \"setupFiles\": [\n+ \"<rootDir>/test/helpers/silence-logging.js\"\n+ ],\n\"testEnvironment\": \"node\",\n\"testMatch\": [\n\"**/test/*.js\"\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const log = require(\"npmlog\");\n+\n+// silence logs\n+log.level = \"silent\";\n+\n+// keep snapshots stable\n+log.disableColor();\n+\n+// avoid corrupting test logging\n+log.disableProgress();\n",
"new_path": "test/helpers/silence-logging.js",
"old_path": null
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: add test/helpers/silence-logging to jest.setupFiles
| 1
|
chore
| null |
807,849
|
15.02.2018 16:20:32
| 28,800
|
a9a2cd1f96386b57777e8220002216fb74914370
|
chore: improve loggingOutput helper, remove irrelevant log tests
|
[
{
"change_type": "MODIFY",
"diff": "const fs = require(\"fs-extra\");\nconst execa = require(\"execa\");\n-const loadJsonFile = require(\"load-json-file\");\nconst log = require(\"npmlog\");\nconst path = require(\"path\");\nconst tempy = require(\"tempy\");\nconst touch = require(\"touch\");\n-const writeJsonFile = require(\"write-json-file\");\n// partially mocked\nconst ChildProcessUtilities = require(\"../src/ChildProcessUtilities\");\n@@ -15,6 +13,8 @@ const ChildProcessUtilities = require(\"../src/ChildProcessUtilities\");\n// helpers\nconst callsBack = require(\"./helpers/callsBack\");\nconst initFixture = require(\"./helpers/initFixture\");\n+const loggingOutput = require(\"./helpers/loggingOutput\");\n+const updateLernaConfig = require(\"./helpers/updateLernaConfig\");\nconst LERNA_VERSION = require(\"../package.json\").version;\n// file under test\n@@ -115,27 +115,19 @@ describe(\"Command\", () => {\nit(\"waits to resolve when 1 child process active\", async () => {\nChildProcessUtilities.getChildProcessCount.mockReturnValueOnce(1);\n- let warning;\n- log.once(\"log.warn\", m => {\n- warning = m;\n- });\n-\nawait testFactory();\n- expect(warning.message).toMatch(\"Waiting for 1 child process to exit.\");\n+ const [logMessage] = loggingOutput(\"warn\");\n+ expect(logMessage).toMatch(\"Waiting for 1 child process to exit.\");\n});\nit(\"waits to resolve when 2 child processes active\", async () => {\nChildProcessUtilities.getChildProcessCount.mockReturnValueOnce(2);\n- let warning;\n- log.once(\"log.warn\", m => {\n- warning = m;\n- });\n-\nawait testFactory();\n- expect(warning.message).toMatch(\"Waiting for 2 child processes to exit.\");\n+ const [logMessage] = loggingOutput(\"warn\");\n+ expect(logMessage).toMatch(\"Waiting for 2 child processes to exit.\");\n});\n});\n@@ -194,11 +186,7 @@ describe(\"Command\", () => {\nit(\"is set from lerna.json config\", async () => {\nconst cwd = await initFixture(\"Command/basic\");\n- const lernaJsonLocation = path.join(cwd, \"lerna.json\");\n- const lernaConfig = await loadJsonFile(lernaJsonLocation);\n- lernaConfig.loglevel = \"warn\";\n- await writeJsonFile(lernaJsonLocation, lernaConfig, { indent: 2 });\n-\n+ await updateLernaConfig(cwd, { loglevel: \"warn\" });\nawait testFactory({ cwd, onRejected });\nexpect(log.level).toBe(\"warn\");\n@@ -378,28 +366,8 @@ describe(\"Command\", () => {\nclass TestCommand extends Command {}\ndescribe(\"bootstrapConfig\", () => {\n- afterEach(() => {\n- log.removeAllListeners(\"log.warn\");\n- });\n-\nclass BootstrapCommand extends Command {}\n- it(\"should warn when used\", () => {\n- let warning;\n- log.once(\"log.warn\", m => {\n- warning = m;\n- });\n-\n- const instance = new BootstrapCommand({ onRejected, cwd });\n-\n- instance.options; // eslint-disable-line no-unused-expressions\n-\n- expect(warning).toHaveProperty(\n- \"message\",\n- \"`bootstrapConfig.ignore` has been replaced by `command.bootstrap.ignore`.\"\n- );\n- });\n-\nit(\"should provide a correct value\", () => {\nconst instance = new BootstrapCommand({ onRejected, cwd });\nexpect(instance.options.ignore).toBe(\"package-a\");\n@@ -408,11 +376,9 @@ describe(\"Command\", () => {\nit(\"should not warn with other commands\", () => {\nconst instance = new TestCommand({ onRejected, cwd });\n- log.once(\"log.warn\", () => {\n- throw new Error(\"should not warn bootstrapConfig\");\n- });\n-\ninstance.options; // eslint-disable-line no-unused-expressions\n+\n+ expect(loggingOutput(\"warn\")).toHaveLength(0);\n});\nit(\"should not provide a value to other commands\", () => {\n@@ -422,28 +388,8 @@ describe(\"Command\", () => {\n});\ndescribe(\"publishConfig\", () => {\n- afterEach(() => {\n- log.removeAllListeners(\"log.warn\");\n- });\n-\nclass PublishCommand extends Command {}\n- it(\"should warn when used\", () => {\n- let warning;\n- log.once(\"log.warn\", m => {\n- warning = m;\n- });\n-\n- const instance = new PublishCommand({ onRejected, cwd });\n-\n- instance.options; // eslint-disable-line no-unused-expressions\n-\n- expect(warning).toHaveProperty(\n- \"message\",\n- \"`publishConfig.ignore` has been replaced by `command.publish.ignore`.\"\n- );\n- });\n-\nit(\"should provide a correct value\", () => {\nconst instance = new PublishCommand({ onRejected, cwd });\nexpect(instance.options.ignore).toBe(\"package-b\");\n@@ -452,11 +398,9 @@ describe(\"Command\", () => {\nit(\"should not warn with other commands\", () => {\nconst instance = new TestCommand({ onRejected, cwd });\n- log.once(\"log.warn\", () => {\n- throw new Error(\"should not warn publishConfig\");\n- });\n-\ninstance.options; // eslint-disable-line no-unused-expressions\n+\n+ expect(loggingOutput(\"warn\")).toHaveLength(0);\n});\nit(\"should not provide a value to other commands\", () => {\n",
"new_path": "test/Command.js",
"old_path": "test/Command.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -10,6 +10,7 @@ const UpdatedPackagesCollector = require(\"../src/UpdatedPackagesCollector\");\n// helpers\nconst callsBack = require(\"./helpers/callsBack\");\nconst initFixture = require(\"./helpers/initFixture\");\n+const loggingOutput = require(\"./helpers/loggingOutput\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\n@@ -57,17 +58,12 @@ describe(\"ExecCommand\", () => {\nboom.code = 1;\nboom.cmd = \"boom\";\n- let errorLog;\n- log.once(\"log.error\", m => {\n- errorLog = m;\n- });\n-\nChildProcessUtilities.spawn.mockImplementationOnce(callsBack(boom));\ntry {\nawait lernaExec(testDir)(\"boom\");\n} catch (err) {\n- expect(errorLog).toHaveProperty(\"message\", \"Errored while executing 'boom' in 'package-1'\");\n+ expect(err.message).toBe(\"execa error\");\n}\n});\n@@ -201,13 +197,9 @@ describe(\"ExecCommand\", () => {\nit(\"warns when cycles are encountered\", async () => {\nconst testDir = await initFixture(\"PackageUtilities/toposort\");\n- let logMessage = null;\n- log.once(\"log.warn\", e => {\n- logMessage = e.message;\n- });\n-\nawait lernaExec(testDir)(\"ls\");\n+ const [logMessage] = loggingOutput(\"warn\");\nexpect(logMessage).toMatch(\"Dependency cycles detected, you should fix these!\");\nexpect(logMessage).toMatch(\"package-cycle-1 -> package-cycle-2 -> package-cycle-1\");\nexpect(logMessage).toMatch(\"package-cycle-2 -> package-cycle-1 -> package-cycle-2\");\n",
"new_path": "test/ExecCommand.js",
"old_path": "test/ExecCommand.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -5,18 +5,18 @@ const log = require(\"npmlog\");\n// mocked modules\nconst npmRunScript = require(\"../src/utils/npm-run-script\");\n-const output = require(\"../src/utils/output\");\nconst UpdatedPackagesCollector = require(\"../src/UpdatedPackagesCollector\");\n// helpers\nconst callsBack = require(\"./helpers/callsBack\");\nconst initFixture = require(\"./helpers/initFixture\");\n+const consoleOutput = require(\"./helpers/consoleOutput\");\n+const loggingOutput = require(\"./helpers/loggingOutput\");\nconst normalizeRelativeDir = require(\"./helpers/normalizeRelativeDir\");\n// file under test\nconst lernaRun = require(\"./helpers/command-runner\")(require(\"../src/commands/RunCommand\"));\n-jest.mock(\"../src/utils/output\");\njest.mock(\"../src/utils/npm-run-script\");\n// silence logs\n@@ -49,7 +49,7 @@ describe(\"RunCommand\", () => {\nawait lernaRun(testDir)(\"my-script\");\nexpect(ranInPackages(testDir)).toMatchSnapshot();\n- expect(output).lastCalledWith(\"stdout\");\n+ expect(consoleOutput()).toMatch(\"stdout\\nstdout\");\n});\nit(\"runs a script in packages with --stream\", async () => {\n@@ -108,7 +108,7 @@ describe(\"RunCommand\", () => {\nawait lernaRun(testDir)(\"missing-script\");\nexpect(npmRunScript).not.toBeCalled();\n- expect(output).not.toBeCalled();\n+ expect(consoleOutput()).toBe(\"\");\n});\nit(\"runs a script in all packages with --parallel\", async () => {\n@@ -140,14 +140,10 @@ describe(\"RunCommand\", () => {\ndescribe(\"in a cyclical repo\", () => {\nit(\"warns when cycles are encountered\", async () => {\nconst testDir = await initFixture(\"PackageUtilities/toposort\");\n- let logMessage = null;\n-\n- log.once(\"log.warn\", e => {\n- logMessage = e.message;\n- });\nawait lernaRun(testDir)(\"env\");\n+ const [logMessage] = loggingOutput(\"warn\");\nexpect(logMessage).toMatch(\"Dependency cycles detected, you should fix these!\");\nexpect(logMessage).toMatch(\"package-cycle-1 -> package-cycle-2 -> package-cycle-1\");\nexpect(logMessage).toMatch(\"package-cycle-2 -> package-cycle-1 -> package-cycle-2\");\n",
"new_path": "test/RunCommand.js",
"old_path": "test/RunCommand.js"
},
{
"change_type": "MODIFY",
"diff": "\"use strict\";\n-const _ = require(\"lodash\");\nconst log = require(\"npmlog\");\n+const normalizeNewline = require(\"normalize-newline\");\nmodule.exports = loggingOutput;\n@@ -10,19 +10,18 @@ afterEach(() => {\nlog.record.length = 0;\n});\n-const getVisibleMessages = _.flow(\n- list =>\n- _.filter(\n- list,\n- m =>\n- // select all info, warn, and error logs\n- log.levels[m.level] >= log.levels.info\n- ),\n- list => _.map(list, \"message\"),\n- // remove empty logs (\"newline\")\n- _.compact\n+function loggingOutput(minLevel = \"info\") {\n+ // returns an array of log messages at or above the prescribed minLevel\n+ return (\n+ log.record\n+ // select all non-empty info, warn, or error logs\n+ .filter(m => log.levels[m.level] >= log.levels[minLevel] && m.message)\n+ // return just the normalized message content\n+ .map(m =>\n+ normalizeNewline(m.message)\n+ .split(\"\\n\")\n+ .map(line => line.trimRight())\n+ .join(\"\\n\")\n+ )\n);\n-\n-function loggingOutput() {\n- return getVisibleMessages(log.record);\n}\n",
"new_path": "test/helpers/loggingOutput.js",
"old_path": "test/helpers/loggingOutput.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -16,7 +16,9 @@ module.exports = updateLernaConfig;\n*/\nasync function updateLernaConfig(testDir, updates) {\nconst lernaJsonLocation = path.join(testDir, \"lerna.json\");\n- const lernaJson = await fs.readJson(lernaJsonLocation);\n+ const lernaJson = await fs.readJSON(lernaJsonLocation);\n+\nObject.assign(lernaJson, updates);\n- await fs.writeJson(lernaJsonLocation, lernaJson, { spaces: 2 });\n+\n+ return fs.writeJSON(lernaJsonLocation, lernaJson, { spaces: 2 });\n}\n",
"new_path": "test/helpers/updateLernaConfig.js",
"old_path": "test/helpers/updateLernaConfig.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore: improve loggingOutput helper, remove irrelevant log tests
| 1
|
chore
| null |
807,849
|
15.02.2018 18:16:57
| 28,800
|
51e99508b9319f1b0f18950caaa822d1a6d4eebc
|
fix: clear mocks during publish integration test
|
[
{
"change_type": "MODIFY",
"diff": "@@ -59,6 +59,9 @@ describe(\"lerna publish\", () => {\nif (process.cwd() !== currentDirectory) {\nprocess.chdir(currentDirectory);\n}\n+\n+ // consoleOutput creates a mock\n+ jest.clearAllMocks();\n});\ntest(\"exit 0 when no updates\", async () => {\n",
"new_path": "test/integration/lerna-publish.test.js",
"old_path": "test/integration/lerna-publish.test.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
fix: clear mocks during publish integration test
| 1
|
fix
| null |
791,813
|
15.02.2018 18:26:44
| -3,600
|
2f807e0c5f5a7424d9067bf904ffedefa4414141
|
core(main-resource): adjust main resource identification logic
|
[
{
"change_type": "MODIFY",
"diff": "'use strict';\nconst ComputedArtifact = require('./computed-artifact');\n-const HTTP_REDIRECT_CODE_LOW = 300;\n-const HTTP_REDIRECT_CODE_HIGH = 399;\n/**\n* @fileoverview This artifact identifies the main resource on the page. Current solution assumes\n@@ -18,15 +16,6 @@ class MainResource extends ComputedArtifact {\nreturn 'MainResource';\n}\n- /**\n- * @param {WebInspector.NetworkRequest} record\n- * @return {boolean}\n- */\n- isMainResource(request) {\n- return request.statusCode < HTTP_REDIRECT_CODE_LOW ||\n- request.statusCode > HTTP_REDIRECT_CODE_HIGH;\n- }\n-\n/**\n* @param {!DevtoolsLog} devtoolsLog\n* @param {!ComputedArtifacts} artifacts\n@@ -35,7 +24,7 @@ class MainResource extends ComputedArtifact {\ncompute_(devtoolsLog, artifacts) {\nreturn artifacts.requestNetworkRecords(devtoolsLog)\n.then(requests => {\n- const mainResource = requests.find(this.isMainResource);\n+ const mainResource = requests.find(request => request.url === artifacts.URL.finalUrl);\nif (!mainResource) {\nthrow new Error('Unable to identify the main resource');\n",
"new_path": "lighthouse-core/gather/computed/main-resource.js",
"old_path": "lighthouse-core/gather/computed/main-resource.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -50,6 +50,7 @@ function replaceChain(chains, networkRecords) {\ndescribe('CriticalRequestChain gatherer: extractChain function', () => {\nit('returns correct data for chain from a devtoolsLog', () => {\nconst computedArtifacts = Runner.instantiateComputedArtifacts();\n+ computedArtifacts.URL = {finalUrl: 'https://en.m.wikipedia.org/wiki/Main_Page'};\nconst wikiDevtoolsLog = require('../../fixtures/wikipedia-redirect.devtoolslog.json');\nconst wikiChains = require('../../fixtures/wikipedia-redirect.critical-request-chains.json');\n",
"new_path": "lighthouse-core/test/gather/computed/critical-request-chains-test.js",
"old_path": "lighthouse-core/test/gather/computed/critical-request-chains-test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -19,12 +19,14 @@ describe('MainResource computed artifact', () => {\nit('returns an artifact', () => {\nconst record = {\n- statusCode: 404,\n+ url: 'https://example.com',\n};\nconst networkRecords = [\n+ {url: 'http://example.com'},\nrecord,\n];\ncomputedArtifacts.requestNetworkRecords = _ => Promise.resolve(networkRecords);\n+ computedArtifacts.URL = {finalUrl: 'https://example.com'};\nreturn computedArtifacts.requestMainResource({}).then(output => {\nassert.equal(output, record);\n@@ -33,11 +35,10 @@ describe('MainResource computed artifact', () => {\nit('thows when main resource can\\'t be found', () => {\nconst networkRecords = [\n- {\n- statusCode: 302,\n- },\n+ {url: 'https://example.com'},\n];\ncomputedArtifacts.requestNetworkRecords = _ => Promise.resolve(networkRecords);\n+ computedArtifacts.URL = {finalUrl: 'https://m.example.com'};\nreturn computedArtifacts.requestMainResource({}).then(() => {\nassert.ok(false, 'should have thrown');\n@@ -46,28 +47,9 @@ describe('MainResource computed artifact', () => {\n});\n});\n- it('should ignore redirects', () => {\n- const record = {\n- statusCode: 404,\n- };\n- const networkRecords = [\n- {\n- statusCode: 301,\n- },\n- {\n- statusCode: 302,\n- },\n- record,\n- ];\n- computedArtifacts.requestNetworkRecords = _ => Promise.resolve(networkRecords);\n-\n- return computedArtifacts.requestMainResource({}).then(output => {\n- assert.equal(output, record);\n- });\n- });\n-\nit('should identify correct main resource in the wikipedia fixture', () => {\nconst wikiDevtoolsLog = require('../../fixtures/wikipedia-redirect.devtoolslog.json');\n+ computedArtifacts.URL = {finalUrl: 'https://en.m.wikipedia.org/wiki/Main_Page'};\nreturn computedArtifacts.requestMainResource(wikiDevtoolsLog).then(output => {\nassert.equal(output.url, 'https://en.m.wikipedia.org/wiki/Main_Page');\n",
"new_path": "lighthouse-core/test/gather/computed/main-resource-test.js",
"old_path": "lighthouse-core/test/gather/computed/main-resource-test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -16,7 +16,7 @@ module.exports = {\nreturn Promise.resolve();\n},\ngotoURL() {\n- return Promise.resolve('https://example.com');\n+ return Promise.resolve('https://www.reddit.com/r/nba');\n},\nbeginEmulation() {\nreturn Promise.resolve();\n",
"new_path": "lighthouse-core/test/gather/fake-driver.js",
"old_path": "lighthouse-core/test/gather/fake-driver.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -366,6 +366,9 @@ describe('Runner', () => {\n],\nartifacts: {\n+ URL: {\n+ finalUrl: 'https://www.reddit.com/r/nba',\n+ },\ndevtoolsLogs: {\ndefaultPass: path.join(__dirname, '/fixtures/perflog.json'),\n},\n@@ -509,7 +512,7 @@ describe('Runner', () => {\nconst config = new Config({\npasses: [{\npassName: 'firstPass',\n- gatherers: ['viewport-dimensions'],\n+ gatherers: ['url', 'viewport-dimensions'],\n}],\naudits: [\n",
"new_path": "lighthouse-core/test/runner-test.js",
"old_path": "lighthouse-core/test/runner-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(main-resource): adjust main resource identification logic (#4475)
| 1
|
core
|
main-resource
|
791,813
|
15.02.2018 22:39:00
| -3,600
|
c510a49761e5df29d73b96d39647c10571983ab2
|
core(font-size): recalibrate the legible font sizes
|
[
{
"change_type": "MODIFY",
"diff": "<style>\n.small {\n- font-size: 15px;\n+ font-size: 11px;\n}\n</style>\n</head>\n<a href='javascript:void(0);'>click this</a>\n<h2>Small text</h2>\n- <!-- PASS(font-size): amount of illegible text is below the 75% threshold -->\n+ <!-- PASS(font-size): amount of illegible text is below the 60% threshold -->\n<p class='small'> 1 </p>\n- <small>2</small>\n+ <h6>2</h6>\n<font size=\"1\">3<b>4</b></font>\n<p style='font-size:10px'>5 </p>\n<script class='small'>\n",
"new_path": "lighthouse-cli/test/fixtures/seo/seo-tester.html",
"old_path": "lighthouse-cli/test/fixtures/seo/seo-tester.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -18,8 +18,7 @@ const CSSMatchedStyles = require('../../../lib/web-inspector').CSSMatchedStyles;\nconst Gatherer = require('../gatherer');\nconst FONT_SIZE_PROPERTY_NAME = 'font-size';\nconst TEXT_NODE_BLOCK_LIST = new Set(['SCRIPT', 'STYLE', 'NOSCRIPT']);\n-// 16px value comes from https://developers.google.com/speed/docs/insights/UseLegibleFontSizes\n-const MINIMAL_LEGIBLE_FONT_SIZE_PX = 16;\n+const MINIMAL_LEGIBLE_FONT_SIZE_PX = 12;\n// limit number of protocol calls to make sure that gatherer doesn't take more than 1-2s\nconst MAX_NODES_VISITED = 500;\nconst MAX_NODES_ANALYZED = 50;\n",
"new_path": "lighthouse-core/gather/gatherers/seo/font-size.js",
"old_path": "lighthouse-core/gather/gatherers/seo/font-size.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -27,25 +27,25 @@ describe('SEO: Font size audit', () => {\nassert.ok(auditResult.debugString.includes('missing viewport'));\n});\n- it('fails when less than 75% of text is legible', () => {\n+ it('fails when less than 60% of text is legible', () => {\nconst artifacts = {\nURL,\nViewport: validViewport,\nFontSize: {\ntotalTextLength: 100,\nvisitedTextLength: 100,\n- failingTextLength: 33,\n- analyzedFailingTextLength: 33,\n+ failingTextLength: 41,\n+ analyzedFailingTextLength: 41,\nanalyzedFailingNodesData: [\n- {textLength: 11, fontSize: 14, node: {nodeId: 1, localName: 'p', attributes: []}},\n- {textLength: 22, fontSize: 15, node: {nodeId: 2, localName: 'p', attributes: []}},\n+ {textLength: 10, fontSize: 10, node: {nodeId: 1, localName: 'p', attributes: []}},\n+ {textLength: 31, fontSize: 11, node: {nodeId: 2, localName: 'p', attributes: []}},\n],\n},\n};\nconst auditResult = FontSizeAudit.audit(artifacts);\nassert.equal(auditResult.rawValue, false);\n- assert.ok(auditResult.debugString.includes('33%'));\n+ assert.ok(auditResult.debugString.includes('41%'));\n});\nit('passes when there is no text', () => {\n@@ -58,7 +58,7 @@ describe('SEO: Font size audit', () => {\nfailingTextLength: 0,\nanalyzedFailingTextLength: 0,\nanalyzedFailingNodesData: [\n- {textLength: 0, fontSize: 14, node: {nodeId: 1, localName: 'p', attributes: []}},\n+ {textLength: 0, fontSize: 11, node: {nodeId: 1, localName: 'p', attributes: []}},\n],\n},\n};\n@@ -67,7 +67,7 @@ describe('SEO: Font size audit', () => {\nassert.equal(auditResult.rawValue, true);\n});\n- it('passes when more than 75% of text is legible', () => {\n+ it('passes when more than 60% of text is legible', () => {\nconst artifacts = {\nURL,\nViewport: validViewport,\n@@ -77,8 +77,8 @@ describe('SEO: Font size audit', () => {\nfailingTextLength: 33,\nanalyzedFailingTextLength: 33,\nanalyzedFailingNodesData: [\n- {textLength: 11, fontSize: 14, node: {nodeId: 1, localName: 'p', attributes: []}},\n- {textLength: 22, fontSize: 15, node: {nodeId: 2, localName: 'p', attributes: []}},\n+ {textLength: 11, fontSize: 10, node: {nodeId: 1, localName: 'p', attributes: []}},\n+ {textLength: 22, fontSize: 11, node: {nodeId: 2, localName: 'p', attributes: []}},\n],\n},\n};\n@@ -112,9 +112,9 @@ describe('SEO: Font size audit', () => {\nfailingTextLength: 7,\nanalyzedFailingTextLength: 7,\nanalyzedFailingNodesData: [\n- {textLength: 3, fontSize: 15, node: {nodeId: 1}, cssRule: style1},\n- {textLength: 2, fontSize: 14, node: {nodeId: 2}, cssRule: style2},\n- {textLength: 2, fontSize: 14, node: {nodeId: 3}, cssRule: style2},\n+ {textLength: 3, fontSize: 11, node: {nodeId: 1}, cssRule: style1},\n+ {textLength: 2, fontSize: 10, node: {nodeId: 2}, cssRule: style2},\n+ {textLength: 2, fontSize: 10, node: {nodeId: 3}, cssRule: style2},\n],\n},\n};\n@@ -135,7 +135,7 @@ describe('SEO: Font size audit', () => {\nfailingTextLength: 50,\nanalyzedFailingTextLength: 10,\nanalyzedFailingNodesData: [\n- {textLength: 10, fontSize: 14, node: {nodeId: 1, localName: 'p', attributes: []}},\n+ {textLength: 10, fontSize: 10, node: {nodeId: 1, localName: 'p', attributes: []}},\n],\n},\n};\n@@ -156,7 +156,7 @@ describe('SEO: Font size audit', () => {\nfailingTextLength: 50,\nanalyzedFailingTextLength: 50,\nanalyzedFailingNodesData: [\n- {textLength: 50, fontSize: 14, node: {nodeId: 1, localName: 'p', attributes: []}},\n+ {textLength: 50, fontSize: 10, node: {nodeId: 1, localName: 'p', attributes: []}},\n],\n},\n};\n",
"new_path": "lighthouse-core/test/audits/seo/font-size-test.js",
"old_path": "lighthouse-core/test/audits/seo/font-size-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(font-size): recalibrate the legible font sizes (#4550)
| 1
|
core
|
font-size
|
807,849
|
16.02.2018 10:16:33
| 28,800
|
28507a66a59088c0792b346f231f985b4bfd3b34
|
chore(lint): allow for-of statements, this isn't a browser
|
[
{
"change_type": "MODIFY",
"diff": "- err # Error decoration\n- obj # .reduce() object\n- pkg # Package instance\n+ no-restricted-syntax:\n+ - error\n+ - ForInStatement\n+ - LabeledStatement\n+ - WithStatement\nno-underscore-dangle:\n- error\n- allowAfterThis: true\n",
"new_path": ".eslintrc.yaml",
"old_path": ".eslintrc.yaml"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore(lint): allow for-of statements, this isn't a browser
| 1
|
chore
|
lint
|
679,913
|
16.02.2018 11:00:54
| 0
|
722042b1712507d230d62ecacae4cb7bcb4f5974
|
feat(transducers): add range2d / range3d generators
|
[
{
"change_type": "MODIFY",
"diff": "@@ -103,6 +103,8 @@ export * from \"./iter/cycle\";\nexport * from \"./iter/iterate\";\nexport * from \"./iter/pairs\";\nexport * from \"./iter/range\";\n+export * from \"./iter/range2d\";\n+export * from \"./iter/range3d\";\nexport * from \"./iter/repeat\";\nexport * from \"./iter/repeatedly\";\nexport * from \"./iter/reverse\";\n",
"new_path": "packages/transducers/src/index.ts",
"old_path": "packages/transducers/src/index.ts"
},
{
"change_type": "ADD",
"diff": "+import { range } from \"./range\";\n+\n+export function range2d(fromX: number, toX: number, fromY: number, toY: number): IterableIterator<[number, number]>;\n+export function range2d(fromX: number, toX: number, fromY: number, toY: number, stepX: number, stepY: number): IterableIterator<[number, number]>;\n+export function* range2d(...args: number[]) {\n+ let [fromX, toX, fromY, toY] = args;\n+ let stepX, stepY;\n+ switch (args.length) {\n+ case 4:\n+ break;\n+ case 6:\n+ stepX = args[4];\n+ stepY = args[5];\n+ break;\n+ default:\n+ throw new Error(`invalid arity: ${args.length}`);\n+ }\n+ for (let y of range(fromY, toY, stepY)) {\n+ for (let x of range(fromX, toX, stepX)) {\n+ yield [x, y];\n+ }\n+ }\n+}\n",
"new_path": "packages/transducers/src/iter/range2d.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { range } from \"./range\";\n+\n+export function range3d(fromX: number, toX: number, fromY: number, toY: number, fromZ: number, toZ: number): IterableIterator<[number, number, number]>;\n+export function range3d(fromX: number, toX: number, fromY: number, toY: number, fromZ: number, toZ: number, stepX: number, stepY: number, stepZ: number): IterableIterator<[number, number, number]>;\n+export function* range3d(...args: number[]) {\n+ let [fromX, toX, fromY, toY, fromZ, toZ] = args;\n+ let stepX, stepY, stepZ;\n+ switch (args.length) {\n+ case 6:\n+ break;\n+ case 9:\n+ stepX = args[6];\n+ stepY = args[7];\n+ stepZ = args[8];\n+ break;\n+ default:\n+ throw new Error(`invalid arity: ${args.length}`);\n+ }\n+ for (let z of range(fromZ, toZ, stepZ)) {\n+ for (let y of range(fromY, toY, stepY)) {\n+ for (let x of range(fromX, toX, stepX)) {\n+ yield [x, y, z];\n+ }\n+ }\n+ }\n+}\n",
"new_path": "packages/transducers/src/iter/range3d.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(transducers): add range2d / range3d generators
| 1
|
feat
|
transducers
|
679,913
|
16.02.2018 11:45:09
| 0
|
d38f47e07df9a067b5f52ad2a039d21c01bf4c0d
|
test(transducers): add range2d tests
|
[
{
"change_type": "ADD",
"diff": "+import { range2d } from \"../src/iter/range2d\";\n+\n+import * as assert from \"assert\";\n+\n+describe(\"range2d\", () => {\n+ it(\"forward\", () => {\n+ assert.deepEqual(\n+ [...range2d(0, 3, 1, 3)],\n+ [[0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2]]\n+ );\n+ });\n+ it(\"forward w/ step\", () => {\n+ assert.deepEqual(\n+ [...range2d(0, 5, 1, 6, 2, 3)],\n+ [[0, 1], [2, 1], [4, 1], [0, 4], [2, 4], [4, 4]]\n+ );\n+ });\n+ it(\"reverse\", () => {\n+ assert.deepEqual(\n+ [...range2d(3, 0, 3, 1)],\n+ [[3, 3], [2, 3], [1, 3], [3, 2], [2, 2], [1, 2]]\n+ );\n+ });\n+ it(\"reverse w/ step\", () => {\n+ assert.deepEqual(\n+ [...range2d(5, 0, 6, 1, -2, -3)],\n+ [[5, 6], [3, 6], [1, 6], [5, 3], [3, 3], [1, 3]]\n+ );\n+ });\n+ it(\"empty w/ wrong step sign (x)\", () => {\n+ assert.deepEqual(\n+ [...range2d(0, 1, 0, 1, -1, 1)],\n+ []\n+ );\n+ });\n+ it(\"empty w/ wrong step sign (y)\", () => {\n+ assert.deepEqual(\n+ [...range2d(0, 1, 0, 1, 1, -1)],\n+ []\n+ );\n+ });\n+ it(\"single output\", () => {\n+ assert.deepEqual(\n+ [...range2d(0, 1, 0, 1)],\n+ [[0, 0]]\n+ );\n+ });\n+});\n",
"new_path": "packages/transducers/test/range2d.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
test(transducers): add range2d tests
| 1
|
test
|
transducers
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.