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
807,849
06.03.2018 13:20:52
28,800
2b585ff75121d4674e190c67476ace393863ae3b
feat: split filter-options out of global-options
[ { "change_type": "MODIFY", "diff": "\"use strict\";\n+const filterable = require(\"@lerna/filter-options\");\nconst BootstrapCommand = require(\".\");\n/**\n@@ -9,7 +10,7 @@ exports.command = \"bootstrap\";\nexports.describe = \"Link local packages together and install remaining package dependencies\";\n-exports.builder = yargs =>\n+exports.builder = yargs => {\nyargs\n.example(\n\"$0 bootstrap -- --no-optional\",\n@@ -53,6 +54,9 @@ exports.builder = yargs =>\n},\n});\n+ return filterable(yargs);\n+};\n+\nexports.handler = function handler(argv) {\nreturn new BootstrapCommand(argv);\n};\n", "new_path": "commands/bootstrap/command.js", "old_path": "commands/bootstrap/command.js" }, { "change_type": "MODIFY", "diff": "\"dependencies\": {\n\"@lerna/batch-packages\": \"file:../../utils/batch-packages\",\n\"@lerna/command\": \"file:../../core/command\",\n+ \"@lerna/filter-options\": \"file:../../core/filter-options\",\n\"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/has-dependency-installed\": \"file:../../utils/has-dependency-installed\",\n\"@lerna/match-package-name\": \"file:../../utils/match-package-name\",\n", "new_path": "commands/bootstrap/package.json", "old_path": "commands/bootstrap/package.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+const filterable = require(\"@lerna/filter-options\");\nconst CleanCommand = require(\".\");\n/**\n@@ -9,11 +10,15 @@ exports.command = \"clean\";\nexports.describe = \"Remove the node_modules directory from all packages.\";\n-exports.builder = {\n+exports.builder = yargs => {\n+ yargs.options({\nyes: {\ngroup: \"Command Options:\",\ndescribe: \"Skip all confirmation prompts\",\n},\n+ });\n+\n+ return filterable(yargs);\n};\nexports.handler = function handler(argv) {\n", "new_path": "commands/clean/command.js", "old_path": "commands/clean/command.js" }, { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@lerna/command\": \"file:../../core/command\",\n+ \"@lerna/filter-options\": \"file:../../core/filter-options\",\n\"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/prompt\": \"file:../../core/prompt\",\n\"p-map\": \"^1.2.0\",\n", "new_path": "commands/clean/package.json", "old_path": "commands/clean/package.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+const filterable = require(\"@lerna/filter-options\");\nconst ExecCommand = require(\".\");\n/**\n@@ -9,7 +10,7 @@ exports.command = \"exec [cmd] [args..]\";\nexports.describe = \"Run an arbitrary command in each package.\";\n-exports.builder = yargs =>\n+exports.builder = yargs => {\nyargs\n.example(\"$0 exec ls -- --la\", \"# execute `ls -la` in all packages\")\n.example(\"$0 exec -- ls --la\", \"# execute `ls -la` in all packages, keeping cmd outside\")\n@@ -42,6 +43,9 @@ exports.builder = yargs =>\ntype: \"string\",\n});\n+ return filterable(yargs);\n+};\n+\nexports.handler = function handler(argv) {\nreturn new ExecCommand(argv);\n};\n", "new_path": "commands/exec/command.js", "old_path": "commands/exec/command.js" }, { "change_type": "MODIFY", "diff": "\"@lerna/child-process\": \"file:../../core/child-process\",\n\"@lerna/command\": \"file:../../core/command\",\n\"@lerna/batch-packages\": \"file:../../utils/batch-packages\",\n+ \"@lerna/filter-options\": \"file:../../core/filter-options\",\n\"@lerna/run-parallel-batches\": \"file:../../utils/run-parallel-batches\",\n\"@lerna/validation-error\": \"file:../../core/validation-error\"\n}\n", "new_path": "commands/exec/package.json", "old_path": "commands/exec/package.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+const filterable = require(\"@lerna/filter-options\");\nconst LsCommand = require(\".\");\n/**\n@@ -11,13 +12,17 @@ exports.aliases = [\"ls\"];\nexports.describe = \"List local packages\";\n-exports.builder = {\n+exports.builder = yargs => {\n+ yargs.options({\njson: {\n- describe: \"Show information in JSON format\",\ngroup: \"Command Options:\",\n+ describe: \"Show information in JSON format\",\ntype: \"boolean\",\ndefault: undefined,\n},\n+ });\n+\n+ return filterable(yargs);\n};\nexports.handler = function handler(argv) {\n", "new_path": "commands/list/command.js", "old_path": "commands/list/command.js" }, { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@lerna/command\": \"file:../../core/command\",\n+ \"@lerna/filter-options\": \"file:../../core/filter-options\",\n\"@lerna/output\": \"file:../../utils/output\",\n\"chalk\": \"^2.3.1\",\n\"columnify\": \"^1.5.4\"\n", "new_path": "commands/list/package.json", "old_path": "commands/list/package.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+const filterable = require(\"@lerna/filter-options\");\nconst RunCommand = require(\".\");\n/**\n@@ -9,7 +10,7 @@ exports.command = \"run <script>\";\nexports.describe = \"Run an npm script in each package that contains that script.\";\n-exports.builder = yargs =>\n+exports.builder = yargs => {\nyargs\n.example(\"$0 run build -- --silent\", \"# `npm run build --silent` in all packages with a build script\")\n.options({\n@@ -21,13 +22,13 @@ exports.builder = yargs =>\n},\nparallel: {\ngroup: \"Command Options:\",\n- describe: \"Run script in all packages with unlimited concurrency, streaming prefixed output\",\n+ describe: \"Run script in all packages with unlimited concurrency, streaming prefixed output.\",\ntype: \"boolean\",\ndefault: undefined,\n},\n\"npm-client\": {\ngroup: \"Command Options:\",\n- describe: \"Executable used to run scripts (npm, yarn, pnpm, ...)\",\n+ describe: \"Executable used to run scripts (npm, yarn, pnpm, ...).\",\ntype: \"string\",\nrequiresArg: true,\n},\n@@ -37,6 +38,9 @@ exports.builder = yargs =>\ntype: \"string\",\n});\n+ return filterable(yargs);\n+};\n+\nexports.handler = function handler(argv) {\nreturn new RunCommand(argv);\n};\n", "new_path": "commands/run/command.js", "old_path": "commands/run/command.js" }, { "change_type": "MODIFY", "diff": "\"dependencies\": {\n\"@lerna/batch-packages\": \"file:../../utils/batch-packages\",\n\"@lerna/command\": \"file:../../core/command\",\n+ \"@lerna/filter-options\": \"file:../../core/filter-options\",\n\"@lerna/npm-run-script\": \"file:../../utils/npm-run-script\",\n\"@lerna/output\": \"file:../../utils/output\",\n\"@lerna/run-parallel-batches\": \"file:../../utils/run-parallel-batches\",\n", "new_path": "commands/run/package.json", "old_path": "commands/run/package.json" }, { "change_type": "ADD", "diff": "+# `@lerna/filter-options`\n+\n+> Options for lerna sub-commands that need filtering\n+\n+## Usage\n+\n+TODO\n", "new_path": "core/filter-options/README.md", "old_path": null }, { "change_type": "ADD", "diff": "+\"use strict\";\n+\n+const dedent = require(\"dedent\");\n+\n+module.exports = filterOptions;\n+\n+function filterOptions(yargs) {\n+ // Only for 'run', 'exec', 'clean', 'ls', and 'bootstrap' commands\n+ const opts = {\n+ scope: {\n+ describe: \"Include only packages with names matching the given glob.\",\n+ type: \"string\",\n+ requiresArg: true,\n+ },\n+ ignore: {\n+ describe: \"Exclude packages with names matching the given glob.\",\n+ type: \"string\",\n+ requiresArg: true,\n+ },\n+ since: {\n+ describe: dedent`\n+ Only include packages that have been updated since the specified [ref].\n+ If no ref is passed, it defaults to the most-recent tag.\n+ `,\n+ type: \"string\",\n+ },\n+ \"include-filtered-dependencies\": {\n+ describe: dedent`\n+ Include all transitive dependencies when running a command,\n+ regardless of --include, --exclude or --since.\n+ `,\n+ boolean: true,\n+ },\n+ };\n+\n+ return yargs.options(opts).group(Object.keys(opts), \"Filter Options:\");\n+}\n", "new_path": "core/filter-options/index.js", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"@lerna/filter-options\",\n+ \"version\": \"3.0.0-alpha.3\",\n+ \"description\": \"Options for lerna sub-commands that need filtering\",\n+ \"keywords\": [\n+ \"lerna\",\n+ \"core\"\n+ ],\n+ \"homepage\": \"https://github.com/lerna/lerna\",\n+ \"license\": \"MIT\",\n+ \"author\": {\n+ \"name\": \"Daniel Stockman\",\n+ \"url\": \"https://github.com/evocateur\"\n+ },\n+ \"files\": [\n+ \"index.js\"\n+ ],\n+ \"main\": \"index.js\",\n+ \"engines\": {\n+ \"node\": \">= 6.9.0\"\n+ },\n+ \"publishConfig\": {\n+ \"access\": \"public\"\n+ },\n+ \"repository\": {\n+ \"type\": \"git\",\n+ \"url\": \"git+https://github.com/lerna/lerna.git\"\n+ },\n+ \"scripts\": {\n+ \"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n+ },\n+ \"dependencies\": {\n+ \"dedent\": \"^0.7.0\"\n+ }\n+}\n", "new_path": "core/filter-options/package.json", "old_path": null }, { "change_type": "MODIFY", "diff": "\"use strict\";\n-const dedent = require(\"dedent\");\n-\nmodule.exports = globalOptions;\nfunction globalOptions(yargs) {\n@@ -13,47 +11,18 @@ function globalOptions(yargs) {\ntype: \"string\",\n},\nconcurrency: {\n- describe: \"How many threads to use if lerna parallelises the tasks.\",\n+ describe: \"How many processes to use when lerna parallelizes tasks.\",\ntype: \"number\",\nrequiresArg: true,\n},\n- scope: {\n- describe: dedent`\n- Restricts the scope to package names matching the given glob.\n- (Only for 'run', 'exec', 'clean', 'ls', and 'bootstrap' commands)\n- `,\n- type: \"string\",\n- requiresArg: true,\n- },\n- since: {\n- describe: dedent`\n- Restricts the scope to the packages that have been updated since\n- the specified [ref], or if not specified, the latest tag.\n- (Only for 'run', 'exec', 'clean', 'ls', and 'bootstrap' commands)\n- `,\n- type: \"string\",\n- },\n- ignore: {\n- describe: dedent`\n- Ignore packages with names matching the given glob.\n- (Only for 'run', 'exec', 'clean', 'ls', and 'bootstrap' commands)\n- `,\n- type: \"string\",\n- requiresArg: true,\n- },\n- \"include-filtered-dependencies\": {\n- describe: dedent`\n- Include all transitive dependencies when running a command,\n- regardless of --scope, --since or --ignore.\n- `,\n- },\n\"reject-cycles\": {\n- describe: \"Fail if a cycle is detected among dependencies\",\n+ describe: \"Fail if a cycle is detected among dependencies.\",\ntype: \"boolean\",\ndefault: undefined,\n},\nsort: {\n- describe: \"Sort packages topologically (all dependencies before dependents)\",\n+ defaultDescription: \"true\",\n+ describe: \"Sort packages topologically (all dependencies before dependents).\",\ntype: \"boolean\",\ndefault: undefined,\n},\n", "new_path": "core/global-options/index.js", "old_path": "core/global-options/index.js" }, { "change_type": "MODIFY", "diff": "},\n\"scripts\": {\n\"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n- },\n- \"dependencies\": {\n- \"dedent\": \"^0.7.0\"\n}\n}\n", "new_path": "core/global-options/package.json", "old_path": "core/global-options/package.json" }, { "change_type": "MODIFY", "diff": "\"requires\": {\n\"@lerna/batch-packages\": \"file:utils/batch-packages\",\n\"@lerna/command\": \"file:core/command\",\n+ \"@lerna/filter-options\": \"file:core/filter-options\",\n\"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/has-dependency-installed\": \"file:utils/has-dependency-installed\",\n\"@lerna/match-package-name\": \"file:utils/match-package-name\",\n\"version\": \"file:commands/clean\",\n\"requires\": {\n\"@lerna/command\": \"file:core/command\",\n+ \"@lerna/filter-options\": \"file:core/filter-options\",\n\"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/prompt\": \"file:core/prompt\",\n\"p-map\": \"1.2.0\",\n\"@lerna/batch-packages\": \"file:utils/batch-packages\",\n\"@lerna/child-process\": \"file:core/child-process\",\n\"@lerna/command\": \"file:core/command\",\n+ \"@lerna/filter-options\": \"file:core/filter-options\",\n\"@lerna/run-parallel-batches\": \"file:utils/run-parallel-batches\",\n\"@lerna/validation-error\": \"file:core/validation-error\"\n}\n},\n+ \"@lerna/filter-options\": {\n+ \"version\": \"file:core/filter-options\",\n+ \"requires\": {\n+ \"dedent\": \"0.7.0\"\n+ }\n+ },\n\"@lerna/filter-packages\": {\n\"version\": \"file:utils/filter-packages\",\n\"requires\": {\n}\n},\n\"@lerna/global-options\": {\n- \"version\": \"file:core/global-options\",\n- \"requires\": {\n- \"dedent\": \"0.7.0\"\n- }\n+ \"version\": \"file:core/global-options\"\n},\n\"@lerna/has-dependency-installed\": {\n\"version\": \"file:utils/has-dependency-installed\",\n\"version\": \"file:commands/list\",\n\"requires\": {\n\"@lerna/command\": \"file:core/command\",\n+ \"@lerna/filter-options\": \"file:core/filter-options\",\n\"@lerna/output\": \"file:utils/output\",\n\"chalk\": \"2.3.2\",\n\"columnify\": \"1.5.4\"\n\"requires\": {\n\"@lerna/batch-packages\": \"file:utils/batch-packages\",\n\"@lerna/command\": \"file:core/command\",\n+ \"@lerna/filter-options\": \"file:core/filter-options\",\n\"@lerna/npm-run-script\": \"file:utils/npm-run-script\",\n\"@lerna/output\": \"file:utils/output\",\n\"@lerna/run-parallel-batches\": \"file:utils/run-parallel-batches\",\n", "new_path": "package-lock.json", "old_path": "package-lock.json" } ]
JavaScript
MIT License
lerna/lerna
feat: split filter-options out of global-options
1
feat
null
679,913
06.03.2018 13:25:59
0
be46af3f77f0faaa6550cae695a24a8bb61c17b0
feat(examples): add svg viz to devcards demo
[ { "change_type": "MODIFY", "diff": "}\ndiv.card div.body {\n- padding: 0.25rem;\n+ padding: 0.5rem;\n}\ndiv.card pre {\n", "new_path": "examples/devcards/index.html", "old_path": "examples/devcards/index.html" }, { "change_type": "MODIFY", "diff": "@@ -111,14 +111,39 @@ function bmi(state: IAtom<any>) {\nstate.resetIn(\"bmi\", weight / (height * height));\n}\n};\n+\n+ // define BMI thresholds\n+ const thresh: [number, string, string][] = [\n+ [10, \"underweight\", \"#cf3\"],\n+ [18.5, \"normal\", \"#7f0\"],\n+ [25, \"overweight\", \"#f90\"],\n+ [30, \"obese\", \"#f00\"]\n+ ];\n+\n// derived view of bmi value to translate it into english\nconst bmiClass = state.addView(\n\"bmi\",\n(bmi: number) =>\n- bmi < 18.5 ? \"underweight\" :\n- bmi < 25 ? \"normal\" :\n- bmi < 30 ? \"overweight\" : \"obese\"\n+ bmi > thresh[3][0] ? thresh[3][1] :\n+ bmi > thresh[2][0] ? thresh[2][1] :\n+ bmi > thresh[1][0] ? thresh[1][1] : thresh[0][1]\n+ );\n+\n+ // another derived view to create SVG visualization\n+ const bmiScale = (x) => (x - 10) / 30 * 100 + \"%\";\n+ const bmiViz = state.addView(\n+ \"bmi\",\n+ (bmi: number) =>\n+ [\"div\",\n+ [\"svg\",\n+ { width: \"100%\", height: 30, style: { \"font-size\": \"10px\" } },\n+ ...thresh.map(([t, _, col]) =>\n+ [\"rect\", { x: bmiScale(t), y: 0, width: \"100%\", height: 30, fill: col }]),\n+ ...thresh.map(([t, label]) =>\n+ [\"text\", { x: bmiScale(t + 0.5), y: 12 }, label]),\n+ [\"circle\", { cx: bmiScale(bmi), cy: 20, r: 5 }]]]\n);\n+\n// define slider components\n// note how each uses a cursor to their respective\n// target values in the app state\n@@ -133,7 +158,7 @@ function bmi(state: IAtom<any>) {\nconst weight = slider(\nnew Cursor(state, \"weight\"),\n{\n- min: 10, max: 200,\n+ min: 10, max: 150,\nlabel: (v) => `Weight: ${~~v}kg`,\nonchange: () => calc()\n}\n@@ -150,7 +175,7 @@ function bmi(state: IAtom<any>) {\n// perform initial calculation\ncalc();\n- return () => [\"div\", height, weight, bmi];\n+ return () => [\"div\", height, weight, bmi, [\"div\", bmiViz.deref()]];\n}\n/**\n@@ -172,8 +197,8 @@ const db = new Atom({ card1: { weight: 75, height: 194 } });\ndefcard(bmi, new Cursor(db, \"card1\"), \"BMI calculator (shared)\");\ndefcard(bmi, new Cursor(db, \"card2\"));\n-defcard(() => {\n+defcard((state) => {\n// just some random task to populate another part of the app state\n- setInterval(() => db.resetIn(\"stats.now\", new Date().toISOString()), 1000);\n+ setInterval(() => state.resetIn(\"stats.now\", new Date().toISOString()), 1000);\nreturn [\"div\", \"The full shared state:\"];\n}, db);\n", "new_path": "examples/devcards/src/index.ts", "old_path": "examples/devcards/src/index.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(examples): add svg viz to devcards demo
1
feat
examples
807,849
06.03.2018 13:28:30
28,800
bb096d7dc55d0525e18e533c7363099d0f88b8ba
refactor(commands): move .positional() above .options()
[ { "change_type": "MODIFY", "diff": "@@ -11,14 +11,15 @@ exports.describe = \"Add dependencies to matched packages\";\nexports.builder = yargs =>\nyargs\n+ .positional(\"pkgNames\", {\n+ describe: \"One or more package names to add as a dependency\",\n+ type: \"string\",\n+ })\n.options({\ndev: {\n+ group: \"Command Options:\",\ndescribe: \"Save to devDependencies\",\n},\n- })\n- .positional(\"pkgNames\", {\n- describe: \"One or more package names to add as a dependency\",\n- type: \"string\",\n});\nexports.handler = function handler(argv) {\n", "new_path": "commands/add/command.js", "old_path": "commands/add/command.js" }, { "change_type": "MODIFY", "diff": "@@ -14,6 +14,14 @@ exports.builder = yargs => {\nyargs\n.example(\"$0 exec ls -- --la\", \"# execute `ls -la` in all packages\")\n.example(\"$0 exec -- ls --la\", \"# execute `ls -la` in all packages, keeping cmd outside\")\n+ .positional(\"cmd\", {\n+ describe: \"The command to execute. Any command flags must be passed after --\",\n+ type: \"string\",\n+ })\n+ .positional(\"args\", {\n+ describe: \"Positional arguments (not recognized by lerna) to send to command\",\n+ type: \"string\",\n+ })\n.options({\nbail: {\ngroup: \"Command Options:\",\n@@ -33,14 +41,6 @@ exports.builder = yargs => {\ntype: \"boolean\",\ndefault: undefined,\n},\n- })\n- .positional(\"cmd\", {\n- describe: \"The command to execute. Any command flags must be passed after --\",\n- type: \"string\",\n- })\n- .positional(\"args\", {\n- describe: \"Positional arguments (not recognized by lerna) to send to command\",\n- type: \"string\",\n});\nreturn filterable(yargs);\n", "new_path": "commands/exec/command.js", "old_path": "commands/exec/command.js" }, { "change_type": "MODIFY", "diff": "@@ -14,6 +14,7 @@ exports.describe = dedent`\nexports.builder = yargs =>\nyargs\n+ .positional(\"dir\", { describe: \"The path to an external git repository that contains an npm package\" })\n.options({\nyes: {\ngroup: \"Command Options:\",\n@@ -23,8 +24,7 @@ exports.builder = yargs =>\ngroup: \"Command Options:\",\ndescribe: \"Import each merge commit as a single change the merge introduced\",\n},\n- })\n- .positional(\"dir\", { describe: \"The path to an external git repository that contains an npm package\" });\n+ });\nexports.handler = function handler(argv) {\nreturn new ImportCommand(argv);\n", "new_path": "commands/import/command.js", "old_path": "commands/import/command.js" }, { "change_type": "MODIFY", "diff": "@@ -13,6 +13,10 @@ exports.describe = \"Run an npm script in each package that contains that script.\nexports.builder = yargs => {\nyargs\n.example(\"$0 run build -- --silent\", \"# `npm run build --silent` in all packages with a build script\")\n+ .positional(\"script\", {\n+ describe: \"The npm script to run. Pass flags to send to the npm client after --\",\n+ type: \"string\",\n+ })\n.options({\nstream: {\ngroup: \"Command Options:\",\n@@ -32,10 +36,6 @@ exports.builder = yargs => {\ntype: \"string\",\nrequiresArg: true,\n},\n- })\n- .positional(\"script\", {\n- describe: \"The npm script to run. Pass flags to send to the npm client after --\",\n- type: \"string\",\n});\nreturn filterable(yargs);\n", "new_path": "commands/run/command.js", "old_path": "commands/run/command.js" } ]
JavaScript
MIT License
lerna/lerna
refactor(commands): move .positional() above .options()
1
refactor
commands
807,849
06.03.2018 13:30:03
28,800
a7e9171da2fd636fbdeb1e04003f7dff69a227b9
refactor(commands): alphabetize command options (mostly)
[ { "change_type": "MODIFY", "diff": "\"use strict\";\n-const dedent = require(\"dedent\");\nconst ImportCommand = require(\".\");\n/**\n@@ -8,22 +7,20 @@ const ImportCommand = require(\".\");\n*/\nexports.command = \"import <dir>\";\n-exports.describe = dedent`\n- Import the package in <dir> into packages/<dir> with commit history.\n-`;\n+exports.describe = \"Import the package in <dir> into packages/<dir> with commit history.\";\nexports.builder = yargs =>\nyargs\n.positional(\"dir\", { describe: \"The path to an external git repository that contains an npm package\" })\n.options({\n- yes: {\n- group: \"Command Options:\",\n- describe: \"Skip all confirmation prompts\",\n- },\nflatten: {\ngroup: \"Command Options:\",\ndescribe: \"Import each merge commit as a single change the merge introduced\",\n},\n+ yes: {\n+ group: \"Command Options:\",\n+ describe: \"Skip all confirmation prompts\",\n+ },\n});\nexports.handler = function handler(argv) {\n", "new_path": "commands/import/command.js", "old_path": "commands/import/command.js" }, { "change_type": "MODIFY", "diff": "@@ -17,6 +17,10 @@ exports.builder = yargs => {\n// TODO: share only relevant options with `lerna changed`\nconst opts = {\n+ \"allow-branch\": {\n+ describe: \"Specify which branches to allow publishing from.\",\n+ type: \"array\",\n+ },\ncanary: {\ndefaultDescription: \"alpha\",\ndescribe: \"Publish packages after every successful merge using the sha as part of the tag.\",\n@@ -56,11 +60,6 @@ exports.builder = yargs => {\ntype: \"string\",\nrequiresArg: true,\n},\n- yes: {\n- describe: \"Skip all confirmation prompts.\",\n- type: \"boolean\",\n- default: undefined,\n- },\nmessage: {\ndescribe: \"Use a custom commit message when creating the publish commit.\",\nalias: \"m\",\n@@ -107,9 +106,10 @@ exports.builder = yargs => {\ntype: \"boolean\",\ndefault: undefined,\n},\n- \"allow-branch\": {\n- describe: \"Specify which branches to allow publishing from.\",\n- type: \"array\",\n+ yes: {\n+ describe: \"Skip all confirmation prompts.\",\n+ type: \"boolean\",\n+ default: undefined,\n},\n};\n", "new_path": "commands/publish/command.js", "old_path": "commands/publish/command.js" } ]
JavaScript
MIT License
lerna/lerna
refactor(commands): alphabetize command options (mostly)
1
refactor
commands
807,849
06.03.2018 13:41:03
28,800
70ec375330d3a5487df9ee11ef94fe6f9b6df872
fix(commands/add): add filter-options (previously implicit)
[ { "change_type": "MODIFY", "diff": "\"use strict\";\n+const filterable = require(\"@lerna/filter-options\");\nconst AddCommand = require(\".\");\n/**\n@@ -9,7 +10,7 @@ exports.command = \"add [pkgNames..]\";\nexports.describe = \"Add dependencies to matched packages\";\n-exports.builder = yargs =>\n+exports.builder = yargs => {\nyargs\n.positional(\"pkgNames\", {\ndescribe: \"One or more package names to add as a dependency\",\n@@ -22,6 +23,9 @@ exports.builder = yargs =>\n},\n});\n+ return filterable(yargs);\n+};\n+\nexports.handler = function handler(argv) {\nreturn new AddCommand(argv);\n};\n", "new_path": "commands/add/command.js", "old_path": "commands/add/command.js" }, { "change_type": "MODIFY", "diff": "\"dependencies\": {\n\"@lerna/bootstrap\": \"file:../bootstrap\",\n\"@lerna/command\": \"file:../../core/command\",\n+ \"@lerna/filter-options\": \"file:../../core/filter-options\",\n\"@lerna/validation-error\": \"file:../../core/validation-error\",\n\"dedent\": \"^0.7.0\",\n\"npm-package-arg\": \"^6.0.0\",\n", "new_path": "commands/add/package.json", "old_path": "commands/add/package.json" } ]
JavaScript
MIT License
lerna/lerna
fix(commands/add): add filter-options (previously implicit)
1
fix
commands/add
807,849
06.03.2018 14:45:41
28,800
ef493c6e9fe20daec127c557035f0139a0effcb4
chore(collect-updates): remove unused rootPath argument
[ { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ const makeDiffPredicate = require(\"./lib/make-diff-predicate\");\nmodule.exports = collectUpdates;\n-function collectUpdates({ filteredPackages, packageGraph, options, rootPath, execOpts, logger }) {\n+function collectUpdates({ filteredPackages, packageGraph, options, execOpts, logger }) {\nconst packages =\nfilteredPackages.length === packageGraph.size\n? packageGraph\n@@ -41,7 +41,7 @@ function collectUpdates({ filteredPackages, packageGraph, options, rootPath, exe\n} else {\ncandidates = new Set();\n- const hasDiff = makeDiffPredicate(committish, rootPath, execOpts, options.ignore);\n+ const hasDiff = makeDiffPredicate(committish, execOpts, ignorePatterns);\nconst needsBump = (options.cdVersion || \"\").startsWith(\"pre\")\n? () => false\n: /* skip packages that have not been previously prereleased */\n", "new_path": "utils/collect-updates/collect-updates.js", "old_path": "utils/collect-updates/collect-updates.js" }, { "change_type": "MODIFY", "diff": "@@ -5,7 +5,7 @@ const GitUtilities = require(\"@lerna/git-utils\");\nmodule.exports = makeDiffPredicate;\n-function makeDiffPredicate(committish, rootPath, execOpts, ignorePatterns = []) {\n+function makeDiffPredicate(committish, execOpts, ignorePatterns = []) {\nconst ignoreFilters = new Set(\nArray.from(ignorePatterns).map(p => minimatch.filter(`!${p}`, { matchBase: true }))\n);\n", "new_path": "utils/collect-updates/lib/make-diff-predicate.js", "old_path": "utils/collect-updates/lib/make-diff-predicate.js" } ]
JavaScript
MIT License
lerna/lerna
chore(collect-updates): remove unused rootPath argument
1
chore
collect-updates
815,745
06.03.2018 16:04:06
-7,200
25a32456a600c27b26e6342ee5149ac0e44e8d78
fix(tag): tag should be same type as items fixes
[ { "change_type": "MODIFY", "diff": "@@ -32,8 +32,8 @@ export class ItemsList {\nreturn this._markedIndex;\n}\n- setItems(items: any[], simple = false) {\n- this._items = items.map((item, index) => this.mapItem(item, simple, index));\n+ setItems(items: any[]) {\n+ this._items = items.map((item, index) => this.mapItem(item, index));\nif (this._ngSelect.groupBy) {\nthis._groups = this._groupBy(this._items, this._ngSelect.groupBy);\nthis._items = this._flatten(this._groups);\n@@ -82,11 +82,7 @@ export class ItemsList {\n}\naddItem(item: any) {\n- const option = {\n- index: this._items.length,\n- label: this.resolveNested(item, this._ngSelect.bindLabel),\n- value: item\n- };\n+ const option = this.mapItem(item, this._items.length);\nthis._items.push(option);\nthis._filteredItems.push(option);\nreturn option;\n@@ -161,6 +157,9 @@ export class ItemsList {\n}\nresolveNested(option: any, key: string): any {\n+ if (!(typeof option === 'object')) {\n+ return option;\n+ }\nif (key.indexOf('.') === -1) {\nreturn option[key];\n} else {\n@@ -176,20 +175,13 @@ export class ItemsList {\n}\n}\n- mapItem(item: any, simple: boolean, index: number): NgOption {\n- let option = item;\n- let label = null;\n- if (simple) {\n- option = item;\n- label = item;\n- } else {\n- label = this.resolveNested(option, this._ngSelect.bindLabel);\n- }\n+ mapItem(item: any, index: number): NgOption {\n+ const label = this.resolveNested(item, this._ngSelect.bindLabel);\nreturn {\nindex: index,\nlabel: label || '',\n- value: option,\n- disabled: option.disabled,\n+ value: item,\n+ disabled: item.disabled,\n};\n}\n", "new_path": "src/ng-select/items-list.ts", "old_path": "src/ng-select/items-list.ts" }, { "change_type": "MODIFY", "diff": "@@ -165,7 +165,6 @@ describe('NgSelectComponent', function () {\nfixture.componentInstance.cities = [];\ntickAndDetectChanges(fixture);\n-\nfixture.componentInstance.selectedCity = 'Kaunas';\ntickAndDetectChanges(fixture);\n@@ -1173,6 +1172,22 @@ describe('NgSelectComponent', function () {\nexpect(fixture.componentInstance.selectedCity.name).toBe('new tag');\n}));\n+ it('should add tag as string', fakeAsync(() => {\n+ let fixture = createTestingModule(\n+ NgSelectSimpleCmp,\n+ `<ng-select [items]=\"cities\"\n+ [addTag]=\"true\"\n+ placeholder=\"select value\"\n+ [(ngModel)]=\"selectedCity\">\n+ </ng-select>`);\n+\n+ tickAndDetectChanges(fixture);\n+ fixture.componentInstance.select.filter('Copenhagen');\n+ tickAndDetectChanges(fixture);\n+ triggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Enter);\n+ expect(fixture.componentInstance.selectedCity).toBe('Copenhagen');\n+ }));\n+\nit('should select tag even if there are filtered items that matches search term', fakeAsync(() => {\nlet 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": "@@ -126,6 +126,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nprivate _defaultLabel = 'label';\nprivate _defaultValue = 'value';\nprivate _typeaheadLoading = false;\n+ private _primitive: boolean;\nprivate readonly _destroy$ = new Subject<void>();\nprivate _onChange = (_: NgOption) => { };\n@@ -326,7 +327,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nif (this.addTag instanceof Function) {\ntag = this.addTag(this.filterValue);\n} else {\n- tag = { [this.bindLabel]: this.filterValue };\n+ tag = this._primitive ? this.filterValue : { [this.bindLabel]: this.filterValue };\n}\nif (tag instanceof Promise) {\n@@ -414,8 +415,8 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nprivate _setItems(items: any[]) {\nconst firstItem = items[0];\nthis.bindLabel = this.bindLabel || this._defaultLabel;\n- const simple = firstItem && !(firstItem instanceof Object);\n- this.itemsList.setItems(items, simple);\n+ this._primitive = firstItem && !(firstItem instanceof Object);\n+ this.itemsList.setItems(items);\nif (this._isDefined(this._ngModel) && items.length > 0) {\nthis.itemsList.clearSelected();\nthis._selectWriteValue(this._ngModel);\n@@ -437,7 +438,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nlabel: option.elementRef.nativeElement.innerHTML,\ndisabled: option.disabled\n}));\n- this.itemsList.setItems(this.items, false);\n+ this.itemsList.setItems(this.items);\nif (this._isDefined(this._ngModel)) {\nthis.itemsList.clearSelected();\nthis._selectWriteValue(this._ngModel);\n@@ -498,7 +499,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nconst isObject = val instanceof Object;\nconst simpleValue = !isObject && !this.bindValue;\nif (isObject || simpleValue) {\n- this.itemsList.select(this.itemsList.mapItem(val, simpleValue, null));\n+ this.itemsList.select(this.itemsList.mapItem(val, null));\n}\n}\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(tag): tag should be same type as items (#322) fixes #315
1
fix
tag
807,849
06.03.2018 17:49:25
28,800
07d080db6cb77f3d1b28abce5bde7c732523a091
feat(npm-publish): pass --non-interactive to yarn publish
[ { "change_type": "MODIFY", "diff": "@@ -53,7 +53,7 @@ describe(\"npm-publish\", () => {\nexpect(ChildProcessUtilities.exec).lastCalledWith(\n\"yarn\",\n- [\"publish\", \"--tag\", \"yarn-publish\", \"--new-version\", pkg.version],\n+ [\"publish\", \"--tag\", \"yarn-publish\", \"--new-version\", pkg.version, \"--non-interactive\"],\n{\ncwd: pkg.location,\n}\n", "new_path": "utils/npm-publish/__tests__/npm-publish.test.js", "old_path": "utils/npm-publish/__tests__/npm-publish.test.js" }, { "change_type": "MODIFY", "diff": "@@ -16,7 +16,7 @@ function npmPublish(tag, pkg, { npmClient, registry }) {\nif (npmClient === \"yarn\") {\n// skip prompt for new version, use existing instead\n// https://yarnpkg.com/en/docs/cli/publish#toc-yarn-publish-new-version\n- args.push(\"--new-version\", pkg.version);\n+ args.push(\"--new-version\", pkg.version, \"--non-interactive\");\n}\nreturn ChildProcessUtilities.exec(npmClient, args, opts);\n", "new_path": "utils/npm-publish/npm-publish.js", "old_path": "utils/npm-publish/npm-publish.js" } ]
JavaScript
MIT License
lerna/lerna
feat(npm-publish): pass --non-interactive to yarn publish
1
feat
npm-publish
807,849
06.03.2018 18:11:51
28,800
e022d7237c0315abe865e779ed903fa634413e79
chore(release): Update CHANGELOG for v3.0.0-beta.0
[ { "change_type": "MODIFY", "diff": "+## v3.0.0-beta.0 (2018-03-07)\n+\n+This is the first `lerna` release published by `lerna` itself. :tada:\n+\n+#### :boom: Breaking Change\n+\n+* [#1307](https://github.com/lerna/lerna/pull/1307) Convert `lerna/lerna` into a `lerna`-based monorepo. ([@evocateur](https://github.com/evocateur))\n+\n+* **Rename `lerna publish` flag `--ignore` to `--ignore-changes`** ([8c92956](https://github.com/lerna/lerna/commit/8c92956))\n+\n+ This resolves previous ambiguity as to what exactly was intended by the \"ignore\" config for lerna publish,\n+ which was _not_ intended to be identical to the filtering option `--ignore`.\n+\n+ The old option will still work when found in `lerna.json` config, but it is recommended to migrate to the\n+ new option name to ensure future compatibility.\n+\n+#### :rocket: Enhancement\n+\n+* [#1310](https://github.com/lerna/lerna/pull/1310) Add gitHead property to package.json before publish. ([@evocateur](https://github.com/evocateur))\n+\n+#### Committers: 1\n+\n+* Daniel Stockman ([evocateur](https://github.com/evocateur))\n+\n## v3.0.0-alpha.3 (2018-03-03)\n#### :bug: Bug Fix\n", "new_path": "CHANGELOG.md", "old_path": "CHANGELOG.md" } ]
JavaScript
MIT License
lerna/lerna
chore(release): Update CHANGELOG for v3.0.0-beta.0
1
chore
release
791,719
06.03.2018 19:02:01
28,800
11fa6afdbc46ebfdee19cd6b0c709d14a65324ee
report: update link to rel=canonical reference
[ { "change_type": "MODIFY", "diff": "@@ -64,8 +64,7 @@ class Canonical extends Audit {\ndescription: 'Document has a valid `rel=canonical`',\nfailureDescription: 'Document does not have a valid `rel=canonical`',\nhelpText: 'Canonical links suggest which URL to show in search results. ' +\n- 'Read more in [Use canonical URLs]' +\n- '(https://support.google.com/webmasters/answer/139066).',\n+ '[Learn more](https://developers.google.com/web/tools/lighthouse/audits/canonical).',\nrequiredArtifacts: ['Canonical', 'Hreflang'],\n};\n}\n", "new_path": "lighthouse-core/audits/seo/canonical.js", "old_path": "lighthouse-core/audits/seo/canonical.js" } ]
JavaScript
Apache License 2.0
googlechrome/lighthouse
report: update link to rel=canonical reference (#4701)
1
report
null
679,913
07.03.2018 04:29:03
0
e01bf733cbbdbec610ef253f1a5103f5d57d7568
feat(atom): re-add refactored EventBus & interceptor handling add new types, interfaces & consts to api.ts add EventBus class add existing interceptors (ensurePred() etc.)
[ { "change_type": "MODIFY", "diff": "@@ -7,6 +7,13 @@ export type SwapFn<T> = (curr: T, ...args: any[]) => T;\nexport type ViewTransform<T> = (x: any) => T;\n+export type InterceptorFn = (state: any, e: Event) => any;\n+export type InterceptorPredicate = (state: any, e: Event) => boolean;\n+\n+export type SideEffect = (x: any) => void;\n+export type EventDef = Interceptor | Interceptor[] | InterceptorFn | InterceptorFn[];\n+export type EffectDef = [SideEffect, number];\n+\nexport interface ReadonlyAtom<T> extends\napi.IDeref<T>,\napi.IWatch<T> {\n@@ -43,3 +50,18 @@ export interface IView<T> extends\nexport interface IViewable {\naddView<T>(path: Path, tx?: ViewTransform<T>): IView<T>;\n}\n+\n+export interface Event extends Array<any> {\n+ [0]: string;\n+ [1]?: any;\n+}\n+\n+export interface Interceptor {\n+ pre?: InterceptorFn;\n+ post?: InterceptorFn;\n+}\n+\n+export const FX_STATE = \"state\";\n+export const FX_DISPACH_NOW = \"dispatch-now\";\n+export const FX_DISPATCH = \"dispatch\";\n+export const FX_CANCEL = \"cancel\";\n", "new_path": "packages/atom/src/api.ts", "old_path": "packages/atom/src/api.ts" }, { "change_type": "ADD", "diff": "+import { IObjectOf } from \"@thi.ng/api/api\";\n+import { isArray } from \"@thi.ng/checks/is-array\";\n+import { isFunction } from \"@thi.ng/checks/is-function\";\n+import { DCons } from \"@thi.ng/dcons\";\n+\n+import * as api from \"./api\";\n+\n+export class EventBus {\n+\n+ state: api.IAtom<any>;\n+ eventQueue: api.Event[];\n+ currQueue: api.Event[];\n+\n+ handlers: IObjectOf<api.Interceptor[]>;\n+ effects: IObjectOf<api.SideEffect>;\n+ priorites: DCons<[number, string]>;\n+\n+ constructor(state: api.IAtom<any>, handlers?: IObjectOf<api.EventDef>, effects?: IObjectOf<api.EffectDef>) {\n+ this.state = state;\n+ this.handlers = {};\n+ this.effects = {};\n+ this.eventQueue = [];\n+ this.priorites = new DCons();\n+ this.addEffect(api.FX_STATE, (x) => this.state.reset(x), -1000);\n+ this.addEffect(api.FX_DISPATCH, (e) => this.dispatch(e), -999);\n+ if (handlers) {\n+ this.addHandlers(handlers);\n+ }\n+ if (effects) {\n+ this.addEffects(effects);\n+ }\n+ }\n+\n+ addHandler(id: string, spec: api.EventDef) {\n+ const iceps = isArray(spec) ?\n+ (<any>spec).map((i) => isFunction(i) ? { pre: i } : i) :\n+ isFunction(spec) ? [{ pre: spec }] : [spec];\n+ if (iceps.length > 0) {\n+ this.handlers[id] = iceps;\n+ } else {\n+ throw new Error(`no handlers in spec for ID: ${id}`);\n+ }\n+ }\n+\n+ addHandlers(specs: IObjectOf<api.EventDef>) {\n+ for (let id in specs) {\n+ this.addHandler(id, specs[id]);\n+ }\n+ }\n+\n+ addEffect(id: string, fx: api.SideEffect, priority = 1) {\n+ this.effects[id] = fx;\n+ this.priorites.insertSorted([priority, id], (a, b) => a[0] - b[0]);\n+ }\n+\n+ addEffects(specs: IObjectOf<api.EffectDef>) {\n+ for (let id in specs) {\n+ this.addEffect(id, specs[id][0], specs[id][1]);\n+ }\n+ }\n+\n+ dispatch(e: api.Event) {\n+ this.eventQueue.push(e);\n+ }\n+\n+ dispatchNow(e: api.Event) {\n+ (this.currQueue || this.eventQueue).push(e);\n+ }\n+\n+ processQueue() {\n+ if (this.eventQueue.length > 0) {\n+ const prev = this.state.deref();\n+ this.currQueue = [...this.eventQueue];\n+ this.eventQueue.length = 0;\n+ let fx = { state: prev };\n+ for (let e of this.currQueue) {\n+ this.processEvent(fx, e);\n+ }\n+ this.currQueue = null;\n+ this.processEffects(fx);\n+ return this.state.deref() !== prev;\n+ }\n+ return false;\n+ }\n+\n+ protected processEvent(fx: any, e: api.Event) {\n+ const iceps = this.handlers[e[0]];\n+ const n = iceps.length - 1;\n+ let hasPost = false;\n+ for (let i = 0; i <= n && !fx[api.FX_CANCEL]; i++) {\n+ const icep = iceps[i];\n+ if (icep.pre) {\n+ this.mergeEffects(fx, icep.pre(fx.state, e));\n+ }\n+ hasPost = hasPost || !!icep.post;\n+ }\n+ if (!hasPost) {\n+ return;\n+ }\n+ for (let i = n; i >= 0 && !fx[api.FX_CANCEL]; i--) {\n+ const icep = iceps[i];\n+ if (icep.post) {\n+ this.mergeEffects(fx, icep.post(fx.state, e));\n+ }\n+ }\n+ }\n+\n+ protected processEffects(fx: any) {\n+ const effects = this.effects;\n+ for (let p of this.priorites) {\n+ const id = p[1];\n+ const val = fx[id];\n+ if (val !== undefined) {\n+ const fn = effects[id];\n+ if (id !== api.FX_STATE) {\n+ for (let v of val) {\n+ fn(v);\n+ }\n+ } else {\n+ fn(val);\n+ }\n+ }\n+ }\n+ }\n+\n+ protected mergeEffects(fx: any, ret: any) {\n+ if (!ret) {\n+ return;\n+ }\n+ for (let k in ret) {\n+ if (k === api.FX_STATE || k === api.FX_CANCEL) {\n+ fx[k] = ret[k];\n+ } else if (k === api.FX_DISPACH_NOW) {\n+ this.dispatchNow(ret[k]);\n+ } else {\n+ fx[k] ? fx[k].push(ret[k]) : (fx[k] = [ret[k]]);\n+ }\n+ }\n+ }\n+}\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { InterceptorFn, InterceptorPredicate, FX_CANCEL } from \"./api\";\n+import { getIn } from \"./path\";\n+\n+///////////////////////////////////////////////////////////////////////\n+// re-usable interceptors\n+\n+// this one simply logs the current event\n+export const trace = (_, e) => console.log(\"event:\", e);\n+\n+// higher-order interceptor for validation purposes\n+// takes a predicate function and an optional interceptor function\n+// which will be called if the predicate fails for a given event\n+// by default the FX_CANCEL side effect is triggered if there is a failure\n+// ensuring the actual event handler for the failed event will not be\n+// executed anymore\n+export const ensurePred = (pred: InterceptorPredicate, err?: InterceptorFn) =>\n+ (state, e) => {\n+ if (!pred(state, e)) {\n+ return { [FX_CANCEL]: true, ...(err ? err(state, e) : null) };\n+ }\n+ };\n+\n+// specialization of `ensurePred()` to ensure a value less than given max\n+export const ensureLessThan = (max: number, err: InterceptorFn) =>\n+ ensurePred((state, e) => getIn(state, e[1]) < max, err);\n+\n+// specialization of `ensurePred()` to ensure a value greater than given min\n+export const ensureGreaterThan = (min: number, err: InterceptorFn) =>\n+ ensurePred((state, e) => getIn(state, e[1]) > min, err);\n", "new_path": "packages/atom/src/interceptors.ts", "old_path": null } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(atom): re-add refactored EventBus & interceptor handling - add new types, interfaces & consts to api.ts - add EventBus class - add existing interceptors (ensurePred() etc.)
1
feat
atom
679,913
07.03.2018 04:30:15
0
a0d662bbb20cb55512be8ed7afb2231a14ec4cc0
build(atom): add dep
[ { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.3\"\n+ \"@thi.ng/api\": \"^2.0.3\",\n+ \"@thi.ng/dcons\": \"0.1.13\"\n},\n\"keywords\": [\n\"cursor\",\n", "new_path": "packages/atom/package.json", "old_path": "packages/atom/package.json" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
build(atom): add @thi.ng/dcons dep
1
build
atom
679,913
07.03.2018 04:33:48
0
4958606b24a58b3712750a54aee66bf12ced6071
feat(examples): add interceptors example
[ { "change_type": "ADD", "diff": "+node_modules\n+yarn.lock\n+*.js\n", "new_path": "examples/interceptor-basics/.gitignore", "old_path": null }, { "change_type": "ADD", "diff": "+# interceptor-basics\n+\n+[Live demo](http://demo.thi.ng/umbrella/interceptor-basics/)\n+\n+```\n+git clone https://github.com/thi-ng/umbrella.git\n+cd umbrella/examples/interceptor-basics\n+yarn install\n+```\n+Then\n+\n+```\n+# For Mac\n+yarn dev\n+```\n+\n+```\n+# For Debian, Ubuntu, Etc.\n+yarn debdev\n+```\n+\n+Once webpack has completed building, refresh your browser...\n", "new_path": "examples/interceptor-basics/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+ #addcounter {\n+ display: block;\n+ font-size: 1rem;\n+ width: 10rem;\n+ padding: 0.5rem;\n+ margin: 0.25rem;\n+ background: #000;\n+ color: #fff;\n+ border: 0;\n+ }\n+\n+ div.counter {\n+ display: inline-block;\n+ background: #6cf;\n+ padding: 0.5rem;\n+ margin: 0.25rem;\n+ width: 5rem;\n+ text-align: center;\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/interceptor-basics/index.html", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"interceptor-basics\",\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+ \"debdev\": \"see index.html && webpack -w\"\n+ },\n+ \"devDependencies\": {\n+ \"ts-loader\": \"^3.5.0\",\n+ \"typescript\": \"^2.7.2\",\n+ \"webpack\": \"^3.11.0\"\n+ },\n+ \"dependencies\": {\n+ \"@thi.ng/api\": \"^2.0.3\",\n+ \"@thi.ng/atom\": \"^0.8.0\",\n+ \"@thi.ng/hdom\": \"^2.1.0\"\n+ }\n+}\n\\ No newline at end of file\n", "new_path": "examples/interceptor-basics/package.json", "old_path": null }, { "change_type": "ADD", "diff": "+import { IObjectOf } from \"@thi.ng/api/api\";\n+import { Path } from \"@thi.ng/atom/api\";\n+import { Atom } from \"@thi.ng/atom/atom\";\n+import { updateIn, setIn } from \"@thi.ng/atom/path\";\n+import { start } from \"@thi.ng/hdom/start\";\n+\n+import { EffectDef, EventDef, FX_DISPACH_NOW, FX_STATE } from \"@thi.ng/atom/api\";\n+import { EventBus } from \"@thi.ng/atom/event-bus\";\n+import { ensureLessThan, ensureGreaterThan, trace } from \"@thi.ng/atom/interceptors\";\n+\n+///////////////////////////////////////////////////////////////////////\n+// event handler definitions\n+\n+const events: IObjectOf<EventDef> = {\n+ // generic handler to set state value at given path\n+ init: (state, [_, [path, val]]) => ({ [FX_STATE]: setIn(state, path, val) }),\n+\n+ // these event handlers delegate to \"updateVal\" in same processing frame (using FX_DISPATCH_NOW)\n+ // note how we also inject the predicate interceptors here to ensure\n+ // counter values will be always be in the range between 0 .. 100\n+ inc: [\n+ ensureLessThan(100, () => console.warn(\"eek, reached max\")),\n+ (_, [__, path]) => ({ [FX_DISPACH_NOW]: [\"updateVal\", [path, 1]] })\n+ ],\n+ dec: [\n+ ensureGreaterThan(0, () => console.warn(\"eek, reached min\")),\n+ (_, [__, path]) => ({ [FX_DISPACH_NOW]: [\"updateVal\", [path, -1]] })\n+ ],\n+\n+ // this event handler injects the trace interceptor from above\n+ // to log the event each time it's triggered\n+ updateVal: [\n+ trace,\n+ (state, [_, [path, y]]) => ({ [FX_STATE]: updateIn(state, path, (x) => x + y) })\n+ ],\n+\n+ // this handler increments the `nextID` state value and\n+ // triggers \"addCounter\" side effect with config options for the new counter\n+ addCounter: (state) => ({\n+ [FX_DISPACH_NOW]: [\"updateVal\", [\"nextID\", 1]],\n+ \"addCounter\": {\n+ id: state.nextID,\n+ start: ~~(Math.random() * 100),\n+ color: [\"gold\", \"orange\", \"springgreen\", \"yellow\", \"cyan\"][~~(Math.random() * 5)]\n+ }\n+ }),\n+};\n+\n+///////////////////////////////////////////////////////////////////////\n+// skeleton for other side effects, ignore for now\n+\n+const effects: IObjectOf<EffectDef> = {\n+\n+};\n+\n+///////////////////////////////////////////////////////////////////////\n+// components\n+\n+// counter component function\n+// calls to this function will be triggered via \"addCounter\" event and its side effect\n+// (see further below)\n+const counter = (bus: EventBus, path: Path, start = 0, color: string) => {\n+ const view = bus.state.addView(path);\n+ bus.dispatch([\"init\", [path, start]]);\n+ return () =>\n+ [\"div.counter\",\n+ { style: { background: color } },\n+ view.deref() || 0,\n+ [\"div\",\n+ [\"button\", { onclick: () => bus.dispatch([\"dec\", view.path]) }, \"-\"],\n+ [\"button\", { onclick: () => bus.dispatch([\"inc\", view.path]) }, \"+\"]]];\n+}\n+\n+// our main app\n+const app = () => {\n+ // setup central state atom\n+ const db = new Atom({});\n+ // connect event bus to state and configure with above handlers/effects\n+ const bus = new EventBus(db, events, effects);\n+\n+ // an array to store counter component instances\n+ const counters = [];\n+\n+ // in addition to externally defined event handlers & side effects\n+ // each type can also be added & remove dynamically\n+ // here we define the \"addCounter\" side effect, responsible for\n+ // creating a new `counter()` component\n+ bus.addEffect(\"addCounter\",\n+ ({ id, color, start }) =>\n+ counters.push(counter(bus, `counters.${id}`, start, color)));\n+\n+ // this not just initializes the given state value\n+ // the changed state will also trigger re-rendering (see returned function below)\n+ bus.dispatch([\"init\", [\"nextID\", 0]]);\n+\n+ // our actual root component function passed to hdom\n+ const root = () =>\n+ [\"div\",\n+ [\"button#addcounter\", { onclick: () => bus.dispatch([\"addCounter\"]) }, \"add counter\"],\n+ [\"div.buttons\", ...counters],\n+ [\"pre\", JSON.stringify(db.deref(), null, 2)]];\n+\n+ return () => {\n+ // here we do an optional fail fast check, a useful & energy saving\n+ // approach for apps, which purely rely on the central app state.\n+ // this example app is such a case and we can check if there were\n+ // any events processed which caused a state change and only\n+ // return the root component then (i.e. `processQueue()` returned `true`)\n+\n+ // if there were no changes, we simply return nothing.\n+ // hdom interprets this as a skipped frame (and does nothing until this\n+ // function is called again during the next frame update cycle...)\n+ if (bus.processQueue()) {\n+ return root;\n+ }\n+ }\n+};\n+\n+// kick off hdom render loop\n+start(\"app\", app());\n", "new_path": "examples/interceptor-basics/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/interceptor-basics/tsconfig.json", "old_path": null }, { "change_type": "RENAME", "diff": "", "new_path": "examples/interceptor-basics/webpack.config.js", "old_path": "examples/lifecycle-hooks/webpack.config.js" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(examples): add interceptors example
1
feat
examples
807,849
07.03.2018 10:56:15
28,800
1ddc927e9663d3ba23b3bf028e234627122ebd83
chore: change trailing template delimiter location and indent
[ { "change_type": "MODIFY", "diff": "@@ -85,7 +85,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n### Features\n- * feat: I should be placed in the CHANGELOG`\n+ * feat: I should be placed in the CHANGELOG\n+ `\n)\n);\n});\n@@ -112,7 +113,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n### Features\n- * feat: I should be placed in the CHANGELOG`\n+ * feat: I should be placed in the CHANGELOG\n+ `\n);\n});\n@@ -126,7 +128,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n### Bug Fixes\n- * fix: a second commit for our CHANGELOG`\n+ * fix: a second commit for our CHANGELOG\n+ `\n)\n);\n@@ -142,7 +145,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n### Features\n- * feat: I should be placed in the CHANGELOG`\n+ * feat: I should be placed in the CHANGELOG\n+ `\n)\n);\n@@ -172,7 +176,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n### Features\n- * feat: I should be placed in the CHANGELOG`\n+ * feat: I should be placed in the CHANGELOG\n+ `\n);\n});\n@@ -181,7 +186,8 @@ describe(\"ConventionalCommitUtilities\", () => {\nPromise.resolve(\ndedent`\n<a name=\"1.0.1\"></a>\n- ## 1.0.1 (2017-08-11)(/compare/v1.0.1...v1.0.0) (2017-08-09)`\n+ ## 1.0.1 (2017-08-11)(/compare/v1.0.1...v1.0.0) (2017-08-09)\n+ `\n)\n);\nFileSystemUtilities.readFile.mockReturnValueOnce(\n@@ -196,7 +202,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n### Features\n- * add a feature aaa1111`\n+ * add a feature aaa1111\n+ `\n)\n);\n@@ -223,7 +230,8 @@ describe(\"ConventionalCommitUtilities\", () => {\n### Features\n- * add a feature aaa1111`\n+ * add a feature aaa1111\n+ `\n);\n});\n", "new_path": "core/conventional-commits/__tests__/conventional-commits.test.js", "old_path": "core/conventional-commits/__tests__/conventional-commits.test.js" } ]
JavaScript
MIT License
lerna/lerna
chore: change trailing template delimiter location and indent
1
chore
null
807,849
07.03.2018 10:56:50
28,800
6ff74aa7033ba3bac9606ceefc1dd9fbb3d75a59
refactor(conventional-commits): move unchanging content into constants
[ { "change_type": "MODIFY", "diff": "@@ -6,12 +6,21 @@ const dedent = require(\"dedent\");\nconst getStream = require(\"get-stream\");\nconst log = require(\"npmlog\");\nconst npa = require(\"npm-package-arg\");\n+const os = require(\"os\");\nconst path = require(\"path\");\nconst semver = require(\"semver\");\nconst FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst ValidationError = require(\"@lerna/validation-error\");\n+const BLANK_LINE = os.EOL + os.EOL;\n+const CHANGELOG_HEADER = dedent`\n+ # Change Log\n+\n+ All notable changes to this project will be documented in this file.\n+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n+`;\n+\nconst cfgCache = new Map();\nfunction getChangelogConfig(changelogPreset = \"conventional-changelog-angular\") {\n@@ -164,19 +173,11 @@ function updateChangelog(pkg, type, { changelogPreset, version }) {\n]).then(([newEntry, [changelogFileLoc, changelogContents]]) => {\nlog.silly(type, \"writing new entry: %j\", newEntry);\n- return FileSystemUtilities.writeFile(\n- changelogFileLoc,\n- dedent`\n- # Change Log\n-\n- All notable changes to this project will be documented in this file.\n- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n-\n- ${newEntry}\n+ const content = [CHANGELOG_HEADER, newEntry, changelogContents].join(BLANK_LINE);\n- ${changelogContents}`\n- ).then(() => {\n+ return FileSystemUtilities.writeFile(changelogFileLoc, content.trim()).then(() => {\nlog.verbose(type, \"wrote\", changelogFileLoc);\n+\nreturn changelogFileLoc;\n});\n});\n", "new_path": "core/conventional-commits/index.js", "old_path": "core/conventional-commits/index.js" } ]
JavaScript
MIT License
lerna/lerna
refactor(conventional-commits): move unchanging content into constants
1
refactor
conventional-commits
679,913
07.03.2018 12:57:04
0
1ab803aacca3f2ee055cb1acfa746cecb8aa4276
refactor(atom): update InterceptorFn, ensureXXX(), update deps, add docs pass collected sidefx obj to interceptors (as opt last arg), adv. use only make EventDef/EffectDef type decl more flexible add path extractor arg for ensureLessThan/GreaterThan() remove DCons dep (again), update priority sorting add various doc strings
[ { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.3\",\n- \"@thi.ng/dcons\": \"0.1.13\"\n+ \"@thi.ng/api\": \"^2.0.3\"\n},\n\"keywords\": [\n\"cursor\",\n", "new_path": "packages/atom/package.json", "old_path": "packages/atom/package.json" }, { "change_type": "MODIFY", "diff": "@@ -7,12 +7,13 @@ export type SwapFn<T> = (curr: T, ...args: any[]) => T;\nexport type ViewTransform<T> = (x: any) => T;\n-export type InterceptorFn = (state: any, e: Event) => any;\n-export type InterceptorPredicate = (state: any, e: Event) => boolean;\n+export type InterceptorFn = (state: any, e: Event, fx?: any) => any;\n+export type InterceptorPredicate = (state: any, e: Event, fx?: any) => boolean;\nexport type SideEffect = (x: any) => void;\n-export type EventDef = Interceptor | Interceptor[] | InterceptorFn | InterceptorFn[];\n-export type EffectDef = [SideEffect, number];\n+export type EventDef = Interceptor | InterceptorFn | (Interceptor | InterceptorFn)[];\n+export type EffectDef = SideEffect | [SideEffect, number];\n+export type EffectPriority = [string, number];\nexport interface ReadonlyAtom<T> extends\napi.IDeref<T>,\n", "new_path": "packages/atom/src/api.ts", "old_path": "packages/atom/src/api.ts" }, { "change_type": "MODIFY", "diff": "import { IObjectOf } from \"@thi.ng/api/api\";\nimport { isArray } from \"@thi.ng/checks/is-array\";\nimport { isFunction } from \"@thi.ng/checks/is-function\";\n-import { DCons } from \"@thi.ng/dcons\";\nimport * as api from \"./api\";\n+/**\n+ * Batched event processor for using composable interceptors for event handling\n+ * and side effects to execute the result of handled events.\n+ *\n+ * In this model an event handler is an array of objects with `pre` and/or `post`\n+ * keys and functions attached to each key. These functions are called interceptors,\n+ * since each intercepts the processing of an event and can contribute their\n+ * own side effects. The outcome of this setup is a more aspect-oriented, composable\n+ * approach to event handling and allows to inject common, re-usable behaviors\n+ * for multiple event types (tracing, validation, undo/redo triggers etc.)\n+ *\n+ * The overall approach of this type of event processing is heavily based on the\n+ * pattern initially pioneered by @Day8/re-frame, with the following differences:\n+ *\n+ * - standalone implementation (no assumptions about surrounding context/framework)\n+ * - manual trigger of event queue processing\n+ * - supports event cancellation\n+ * - side effect collection (multiple side effects for same effect type per frame)\n+ * - side effect priorities (to better control execution order)\n+ * - dynamic addition/removal of handlers & effects\n+ *\n+ */\nexport class EventBus {\nstate: api.IAtom<any>;\n@@ -13,14 +34,14 @@ export class EventBus {\nhandlers: IObjectOf<api.Interceptor[]>;\neffects: IObjectOf<api.SideEffect>;\n- priorites: DCons<[number, string]>;\n+ priorities: api.EffectPriority[];\nconstructor(state: api.IAtom<any>, handlers?: IObjectOf<api.EventDef>, effects?: IObjectOf<api.EffectDef>) {\nthis.state = state;\nthis.handlers = {};\nthis.effects = {};\nthis.eventQueue = [];\n- this.priorites = new DCons();\n+ this.priorities = [];\nthis.addEffect(api.FX_STATE, (x) => this.state.reset(x), -1000);\nthis.addEffect(api.FX_DISPATCH, (e) => this.dispatch(e), -999);\nif (handlers) {\n@@ -50,23 +71,89 @@ export class EventBus {\naddEffect(id: string, fx: api.SideEffect, priority = 1) {\nthis.effects[id] = fx;\n- this.priorites.insertSorted([priority, id], (a, b) => a[0] - b[0]);\n+ const p: api.EffectPriority = [id, priority];\n+ const priors = this.priorities;\n+ for (let i = 0; i < priors.length; i++) {\n+ if (p[1] < priors[i][1]) {\n+ priors.splice(i, 0, p);\n+ return;\n+ }\n+ }\n+ priors.push(p);\n}\naddEffects(specs: IObjectOf<api.EffectDef>) {\nfor (let id in specs) {\n- this.addEffect(id, specs[id][0], specs[id][1]);\n+ const fx = specs[id];\n+ if (isArray(fx)) {\n+ this.addEffect(id, fx[0], fx[1]);\n+ } else {\n+ this.addEffect(id, fx);\n+ }\n+ }\n+ }\n+\n+ removeHandler(id: string) {\n+ delete this.handlers[id];\n+ }\n+\n+ removeHandlers(ids: string[]) {\n+ for (let id of ids) {\n+ this.removeHandler(id);\n}\n}\n+ removeEffect(id: string) {\n+ delete this.effects[id];\n+ const p = this.priorities;\n+ for (let i = p.length - 1; i >= 0; i--) {\n+ if (id === p[i][0]) {\n+ p.splice(i, 1);\n+ return;\n+ }\n+ }\n+ }\n+\n+ removeEffects(ids: string[]) {\n+ for (let id of ids) {\n+ this.removeEffect(id);\n+ }\n+ }\n+\n+ /**\n+ * Adds given event to event queue to be processed\n+ * by `processQueue()` later on.\n+ *\n+ * @param e\n+ */\ndispatch(e: api.Event) {\nthis.eventQueue.push(e);\n}\n+ /**\n+ * Adds given event to whatever is the current\n+ * event queue. If triggered via the `FX_DISPATCH_NOW`\n+ * side effect the event will still be executed\n+ * in the currently active batch. If called from\n+ * elsewhere, the result is the same as calling\n+ * `dispatch()`.\n+ *\n+ * @param e\n+ */\ndispatchNow(e: api.Event) {\n(this.currQueue || this.eventQueue).push(e);\n}\n+ /**\n+ * Triggers processing of current event queue and\n+ * returns `true` if the any of the processed events\n+ * caused a state change.\n+ *\n+ * If an event handler triggers the `FX_DISPATCH_NOW`\n+ * side effect, the new event will be added to the\n+ * currently processed batch and therefore executed\n+ * in the same frame. Also see `dispatchNow()`.\n+ */\nprocessQueue() {\nif (this.eventQueue.length > 0) {\nconst prev = this.state.deref();\n@@ -83,14 +170,43 @@ export class EventBus {\nreturn false;\n}\n+ /**\n+ * Processes a single event using the configured handler/interceptor chain.\n+ * Logs warning message and skips processing if no handler\n+ * is available for the event.\n+ *\n+ * This function processes the array of interceptors in bi-directional\n+ * order. First any `pre` interceptors are processed in\n+ * forward order. Then `post` interceptors are processed in reverse.\n+ *\n+ * Each interceptor can return a result object of side effects,\n+ * which are being merged and collected for `processEffects()`.\n+ *\n+ * Any interceptor can trigger zero or more known side effects,\n+ * each (side effect) will be collected in an array to support\n+ * multiple invocations of the same effect type per frame. If no\n+ * side effects are requested, an interceptor can return `undefined`.\n+ *\n+ * Processing of the current event stops immediatedly, if an\n+ * interceptor includes the `FX_CANCEL` side effect. However, the\n+ * results interceptors (incl. the one which cancelled) are kept and\n+ * processed further as usual.\n+ *\n+ * @param fx\n+ * @param e\n+ */\nprotected processEvent(fx: any, e: api.Event) {\nconst iceps = this.handlers[e[0]];\n+ if (!iceps) {\n+ console.warn(`missing handler for event type: ${e[0]}`);\n+ return;\n+ }\nconst n = iceps.length - 1;\nlet hasPost = false;\nfor (let i = 0; i <= n && !fx[api.FX_CANCEL]; i++) {\nconst icep = iceps[i];\nif (icep.pre) {\n- this.mergeEffects(fx, icep.pre(fx.state, e));\n+ this.mergeEffects(fx, icep.pre(fx.state, e, fx));\n}\nhasPost = hasPost || !!icep.post;\n}\n@@ -100,15 +216,22 @@ export class EventBus {\nfor (let i = n; i >= 0 && !fx[api.FX_CANCEL]; i--) {\nconst icep = iceps[i];\nif (icep.post) {\n- this.mergeEffects(fx, icep.post(fx.state, e));\n+ this.mergeEffects(fx, icep.post(fx.state, e, fx));\n}\n}\n}\n+ /**\n+ * Takes a collection of side effects generated during\n+ * event processing and applies them in order of configured\n+ * priorities.\n+ *\n+ * @param fx\n+ */\nprotected processEffects(fx: any) {\nconst effects = this.effects;\n- for (let p of this.priorites) {\n- const id = p[1];\n+ for (let p of this.priorities) {\n+ const id = p[0];\nconst val = fx[id];\nif (val !== undefined) {\nconst fn = effects[id];\n@@ -137,4 +260,8 @@ export class EventBus {\n}\n}\n}\n+\n+ protected insertPriority(p: api.EffectPriority) {\n+\n+ }\n}\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" }, { "change_type": "MODIFY", "diff": "-import { InterceptorFn, InterceptorPredicate, FX_CANCEL } from \"./api\";\n+import { Event, InterceptorFn, InterceptorPredicate, FX_CANCEL, Path } from \"./api\";\nimport { getIn } from \"./path\";\n-///////////////////////////////////////////////////////////////////////\n-// re-usable interceptors\n-\n-// this one simply logs the current event\n-export const trace = (_, e) => console.log(\"event:\", e);\n+/**\n+ * Debug interceptor to log the current event to the console.\n+ */\n+export function trace(_, e) {\n+ console.log(\"event:\", e);\n+}\n-// higher-order interceptor for validation purposes\n-// takes a predicate function and an optional interceptor function\n-// which will be called if the predicate fails for a given event\n-// by default the FX_CANCEL side effect is triggered if there is a failure\n-// ensuring the actual event handler for the failed event will not be\n-// executed anymore\n-export const ensurePred = (pred: InterceptorPredicate, err?: InterceptorFn) =>\n- (state, e) => {\n- if (!pred(state, e)) {\n- return { [FX_CANCEL]: true, ...(err ? err(state, e) : null) };\n+/**\n+ * Higher-order interceptor for validation purposes.\n+ * Takes a predicate function and an optional interceptor function,\n+ * which will only be called if the predicate fails for a given event.\n+ * By default the `FX_CANCEL` side effect is triggered if the predicate\n+ * failed, thus ensuring the actual event handler for the failed event\n+ * will not be executed anymore. However, this can be overridden using\n+ * the error interceptor's result, which is merged into the result of\n+ * this interceptor.\n+ *\n+ * Note: For this interceptor to work as expected, it needs to be provided\n+ * BEFORE the main handler in the interceptor list for a given event, i.e.\n+ *\n+ * ```\n+ * [\n+ * ensurePred((state, e) => false),\n+ * (state, e) => console.log(\"no one never calls me\")\n+ * ]\n+ * ```\n+ *\n+ * @param pred predicate applied to given state & event\n+ * @param err interceptor triggered on predicate failure\n+ */\n+export function ensurePred(pred: InterceptorPredicate, err?: InterceptorFn) {\n+ return (state, e, fx) => {\n+ if (!pred(state, e, fx)) {\n+ return { [FX_CANCEL]: true, ...(err ? err(state, e, fx) : null) };\n}\n};\n+}\n-// specialization of `ensurePred()` to ensure a value less than given max\n-export const ensureLessThan = (max: number, err: InterceptorFn) =>\n- ensurePred((state, e) => getIn(state, e[1]) < max, err);\n+/**\n+ * Specialization of `ensurePred()` to ensure a state value is less than given max.\n+ * The optional `path` fn is used to extract or produce the path for the state\n+ * value to be validated. If omitted, the event's payload item is interpreted as\n+ * the value path.\n+ *\n+ * For example, without a provided `path` function and for an event\n+ * of this form: `[\"event-id\", \"foo.bar\"]`, the term `\"foo.bar\"` would be\n+ * interpreted as path.\n+ *\n+ * If the event has this shape: `[\"event-id\", [\"foo.bar\", 23]]`, we must provide\n+ * `(e) => e[1][0]` as path function to extract `\"foo.bar\"` from the event.\n+ *\n+ * @param path path extractor\n+ */\n+export function ensureLessThan(max: number, path?: (e: Event) => Path, err?: InterceptorFn) {\n+ return ensurePred((state, e) => getIn(state, path ? path(e) : e[1]) < max, err);\n+}\n-// specialization of `ensurePred()` to ensure a value greater than given min\n-export const ensureGreaterThan = (min: number, err: InterceptorFn) =>\n- ensurePred((state, e) => getIn(state, e[1]) > min, err);\n+/**\n+ * Specialization of `ensurePred()` to ensure a state value is greater than given min.\n+ * See `ensureLessThan()` for further details.\n+ *\n+ * @param path path extractor\n+ */\n+export function ensureGreaterThan(min: number, path?: (e: Event) => Path, err?: InterceptorFn) {\n+ return ensurePred((state, e) => getIn(state, path ? path(e) : e[1]) > min, err);\n+}\n", "new_path": "packages/atom/src/interceptors.ts", "old_path": "packages/atom/src/interceptors.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(atom): update InterceptorFn, ensureXXX(), update deps, add docs - pass collected sidefx obj to interceptors (as opt last arg), adv. use only - make EventDef/EffectDef type decl more flexible - add path extractor arg for ensureLessThan/GreaterThan() - remove DCons dep (again), update priority sorting - add various doc strings
1
refactor
atom
679,913
07.03.2018 13:18:31
0
5b21c147379bf0bea26ce9f73ff890da97a7a821
build(examples): update interceptor deps
[ { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@thi.ng/api\": \"^2.0.3\",\n- \"@thi.ng/atom\": \"^0.8.0\",\n+ \"@thi.ng/atom\": \"^0.9.1\",\n\"@thi.ng/hdom\": \"^2.1.0\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/interceptor-basics/package.json", "old_path": "examples/interceptor-basics/package.json" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
build(examples): update interceptor deps
1
build
examples
807,849
07.03.2018 13:30:14
28,800
39170cf8ef3842d2af839ff2ebb4f1b4bf33b493
feat(collect-packages): simplify signature BREAKING CHANGE: Formerly a config object, it is now two parameters, only the first of which (rootPath) is required. The second parameter is a list of package location globs, defaulting to lerna's default of `["packages/*"]`.
[ { "change_type": "MODIFY", "diff": "@@ -201,7 +201,7 @@ class Command {\nlet chain = Promise.resolve();\n- chain = chain.then(() => collectPackages({ rootPath, packageConfigs }));\n+ chain = chain.then(() => collectPackages(rootPath, packageConfigs));\nchain = chain.then(packages => {\nthis.packages = packages;\nthis.packageGraph = new PackageGraph(packages);\n", "new_path": "core/command/index.js", "old_path": "core/command/index.js" }, { "change_type": "MODIFY", "diff": "@@ -10,7 +10,7 @@ const ValidationError = require(\"@lerna/validation-error\");\nmodule.exports = collectPackages;\n-function collectPackages({ packageConfigs, rootPath }) {\n+function collectPackages(rootPath, packageConfigs = [\"packages/*\"]) {\nconst globOpts = {\ncwd: rootPath,\nabsolute: true,\n", "new_path": "utils/collect-packages/collect-packages.js", "old_path": "utils/collect-packages/collect-packages.js" } ]
JavaScript
MIT License
lerna/lerna
feat(collect-packages): simplify signature BREAKING CHANGE: Formerly a config object, it is now two parameters, only the first of which (rootPath) is required. The second parameter is a list of package location globs, defaulting to lerna's default of `["packages/*"]`.
1
feat
collect-packages
791,723
07.03.2018 14:12:26
28,800
aaa000df2e859e4e9ac4c2d354b5b17e2fdc4048
misc: drop support of Node 6
[ { "change_type": "MODIFY", "diff": "@@ -9,11 +9,11 @@ branches:\nenvironment:\nfast_finish: true\nmatrix:\n- - nodejs_version: \"6\"\n+ - nodejs_version: \"8\"\nplatform: x86\n- # node 7 is skipped, as appveyor only allows 1 concurrent job\n+ # other Node versions are skipped, as appveyor only allows 1 concurrent job\n# and we want appveyor finishing ASAP. see #2382\n- # - nodejs_version: \"7\"\n+ # - nodejs_version: \"9\"\n# platform: x86\nbuild: off\n", "new_path": ".appveyor.yml", "old_path": ".appveyor.yml" }, { "change_type": "MODIFY", "diff": "@@ -5,9 +5,7 @@ branches:\n- master\nmatrix:\ninclude:\n- - node_js: \"6.9.1\"\n- node_js: \"8\"\n- if: head_branch IS blank AND branch = master\n- node_js: \"9\"\nif: head_branch IS blank AND branch = master\ndist: trusty\n", "new_path": ".travis.yml", "old_path": ".travis.yml" }, { "change_type": "MODIFY", "diff": "\"name\": \"lighthouse-extension\",\n\"private\": true,\n\"engines\": {\n- \"node\": \">=6\"\n+ \"node\": \">=8\"\n},\n\"scripts\": {\n\"watch\": \"gulp watch\",\n", "new_path": "lighthouse-extension/package.json", "old_path": "lighthouse-extension/package.json" }, { "change_type": "MODIFY", "diff": "\"name\": \"lighthouse-viewer\",\n\"private\": true,\n\"engines\": {\n- \"node\": \">=6\"\n+ \"node\": \">=8\"\n},\n\"scripts\": {\n\"watch\": \"gulp watch\",\n", "new_path": "lighthouse-viewer/package.json", "old_path": "lighthouse-viewer/package.json" }, { "change_type": "MODIFY", "diff": "\"chrome-debug\": \"./chrome-launcher/manual-chrome-launcher.js\"\n},\n\"engines\": {\n- \"node\": \">=6\"\n+ \"node\": \">=8\"\n},\n\"scripts\": {\n\"install-all\": \"npm-run-posix-or-windows install-all:task\",\n", "new_path": "package.json", "old_path": "package.json" } ]
JavaScript
Apache License 2.0
googlechrome/lighthouse
misc: drop support of Node 6 (#4703)
1
misc
null
807,849
07.03.2018 17:02:54
28,800
64916d650233f939d49d34ec52c691037f89106c
fix(conventional-commits): output version bump message closer to version heading
[ { "change_type": "MODIFY", "diff": "@@ -9,11 +9,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/lerna/conventional-commits-fixed/compare/v1.0.0...v1.0.1) (YYYY-MM-DD)\n+**Note:** Version bump only for package package-2\n-**Note:** Version bump only for package package-2\n<a name=\"1.0.0\"></a>\n", "new_path": "core/conventional-commits/__tests__/__snapshots__/conventional-commits.test.js.snap", "old_path": "core/conventional-commits/__tests__/__snapshots__/conventional-commits.test.js.snap" }, { "change_type": "MODIFY", "diff": "@@ -101,13 +101,13 @@ function recommendVersion(pkg, type, { changelogPreset }) {\nfunction makeBumpOnlyFilter(pkg) {\nreturn newEntry => {\n// When force publishing, it is possible that there will be no actual changes, only a version bump.\n- // Add a note to indicate that only a version bump has occurred.\nif (!newEntry.split(\"\\n\").some(line => line.startsWith(\"*\"))) {\n- return dedent(`\n- ${newEntry}\n+ // Add a note to indicate that only a version bump has occurred.\n+ // TODO: actually list the dependencies that were bumped\n+ const message = `**Note:** Version bump only for package ${pkg.name}`;\n- **Note:** Version bump only for package ${pkg.name}\n- `);\n+ // the extra blank lines preserve the whitespace delimiting releases\n+ return [newEntry.trim(), message, BLANK_LINE].join(BLANK_LINE);\n}\nreturn newEntry;\n", "new_path": "core/conventional-commits/index.js", "old_path": "core/conventional-commits/index.js" } ]
JavaScript
MIT License
lerna/lerna
fix(conventional-commits): output version bump message closer to version heading
1
fix
conventional-commits
815,746
07.03.2018 17:09:22
-7,200
32455b80b1887c426135c5d540f65884556c7dd5
feat: selectable group fixes
[ { "change_type": "MODIFY", "diff": "@@ -130,6 +130,7 @@ map: {\n| clearAllText | `string` | `Clear all` | no | Set custom text for clear all icon title |\n| dropdownPosition | `bottom`,`top`,`auto` | `bottom` | no | Set the dropdown position on open |\n| [groupBy] | `string` | null | no | Allow to group items by key |\n+| [selectableGroup] | `boolean` | false | no | Allow to select group when groupBy is used |\n| [items] | `Array<NgOption>` | `[]` | yes | Items array |\n| loading | `boolean` | `-` | no | You can set the loading state from the outside (e.g. async items loading) |\n| loadingText | `string` | `Loading...` | no | Set custom text when for loading items |\n", "new_path": "README.md", "old_path": "README.md" }, { "change_type": "MODIFY", "diff": "@@ -4,6 +4,7 @@ import { NgOption } from '@ng-select/ng-select';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { DataService } from '../shared/data.service';\nimport { NgSelectComponent } from '../../../src/ng-select/ng-select.component';\n+import { delay } from 'rxjs/operators';\n@Component({\nselector: 'reactive-forms',\n@@ -256,7 +257,7 @@ export class ReactiveFormsComponent {\n}\nprivate loadAlbums() {\n- this.dataService.getAlbums().subscribe(albums => {\n+ this.dataService.getAlbums().pipe(delay(500)).subscribe(albums => {\nthis.allAlbums = albums;\nthis.albums = [...this.allAlbums];\nthis.selectFirstAlbum();\n", "new_path": "demo/app/examples/reactive-forms.component.ts", "old_path": "demo/app/examples/reactive-forms.component.ts" }, { "change_type": "MODIFY", "diff": "@@ -64,9 +64,7 @@ export class SelectSearchComponent {\nsearchTerm = new EventEmitter<string>();\npeopleTypeahead = new EventEmitter<string>();\n- selectedPersons = [{\n- name: 'Karyn Wright'\n- }];\n+ selectedPersons = [{name: 'Karyn Wright'}, {name: 'Other'}];\nselectedPerson: any;\nselectedCustom: any;\n", "new_path": "demo/app/examples/search.component.ts", "old_path": "demo/app/examples/search.component.ts" }, { "change_type": "MODIFY", "diff": "import { NgOption } from './ng-select.types';\nimport * as searchHelper from './search-helper';\nimport { NgSelectComponent } from './ng-select.component';\n+import { isObject } from './utils';\nexport class ItemsList {\n@@ -157,7 +158,7 @@ export class ItemsList {\n}\nresolveNested(option: any, key: string): any {\n- if (!(typeof option === 'object')) {\n+ if (!isObject(option)) {\nreturn option;\n}\nif (key.indexOf('.') === -1) {\n@@ -185,6 +186,10 @@ export class ItemsList {\n};\n}\n+ updateSelectedItem(item: NgOption, index: number) {\n+ this._selected[index] = item;\n+ }\n+\nprivate _getNextItemIndex(steps: number) {\nif (steps > 0) {\nreturn (this._markedIndex === this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);\n@@ -224,7 +229,7 @@ export class ItemsList {\nlabel: key,\nhasChildren: true,\nindex: i,\n- disabled: true\n+ disabled: !this._ngSelect.selectableGroup\n};\nparent.value = {};\nparent.value[this._ngSelect.groupBy] = key;\n", "new_path": "src/ng-select/items-list.ts", "old_path": "src/ng-select/items-list.ts" }, { "change_type": "MODIFY", "diff": "@@ -24,7 +24,7 @@ import { MockNgZone, MockNgWindow } from '../testing/mocks';\ndescribe('NgSelectComponent', function () {\n- describe('Model change detection', () => {\n+ describe('Model bindings', () => {\nit('should update ngModel on value change', fakeAsync(() => {\nconst fixture = createTestingModule(\nNgSelectModelChangesTestCmp,\n@@ -95,7 +95,31 @@ describe('NgSelectComponent', function () {\nexpect(fixture.componentInstance.select.selectedItems).toEqual([]);\n}));\n- it('should set items correctly after ngModel set first', fakeAsync(() => {\n+ it('should set items correctly after ngModel set first when bindValue is used', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectModelChangesTestCmp,\n+ `<ng-select [items]=\"cities\"\n+ bindLabel=\"name\"\n+ bindValue=\"id\"\n+ [clearable]=\"true\"\n+ [(ngModel)]=\"selectedCityId\">\n+ </ng-select>`);\n+\n+ fixture.componentInstance.cities = [];\n+ fixture.componentInstance.selectedCityId = 7;\n+ tickAndDetectChanges(fixture);\n+\n+ fixture.componentInstance.cities = [{ id: 7, name: 'Pailgis' }];\n+ tickAndDetectChanges(fixture);\n+\n+ const select = fixture.componentInstance.select;\n+ expect(select.selectedItems[0]).toBe(select.itemsList.items[0]);\n+ expect(select.selectedItems).toEqual([jasmine.objectContaining({\n+ value: { id: 7, name: 'Pailgis' }\n+ })]);\n+ }));\n+\n+ it('should set items correctly after ngModel set first when bindValue is not used', fakeAsync(() => {\nconst fixture = createTestingModule(\nNgSelectModelChangesTestCmp,\n`<ng-select [items]=\"cities\"\n@@ -104,17 +128,81 @@ describe('NgSelectComponent', function () {\n[(ngModel)]=\"selectedCity\">\n</ng-select>`);\n- const cities = [{ id: 7, name: 'Pailgis' }];\n+ fixture.componentInstance.cities = [];\nfixture.componentInstance.selectedCity = { id: 7, name: 'Pailgis' };\ntickAndDetectChanges(fixture);\n- fixture.componentInstance.cities = cities;\n+\n+ fixture.componentInstance.cities = [{ id: 7, name: 'Pailgis' }];\ntickAndDetectChanges(fixture);\n- expect(fixture.componentInstance.select.selectedItems).toEqual([jasmine.objectContaining({\n- value: cities[0]\n+ const select = fixture.componentInstance.select;\n+ expect(select.selectedItems[0]).toBe(select.itemsList.items[0]);\n+ expect(select.selectedItems).toEqual([jasmine.objectContaining({\n+ value: { id: 7, name: 'Pailgis' }\n})]);\n}));\n+ it('should set items correctly after ngModel set first when typeahead and single select is used', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectSelectedTypeaheadWithBindValueMultipleCmp,\n+ `<ng-select [items]=\"cities\"\n+ bindLabel=\"name\"\n+ [typeahead]=\"filter\"\n+ placeholder=\"select value\"\n+ [(ngModel)]=\"selectedCity\">\n+ </ng-select>`);\n+\n+ const select = fixture.componentInstance.select;\n+ fixture.componentInstance.selectedCity = { id: 1, name: 'Vilnius' };\n+ tickAndDetectChanges(fixture);\n+ expect(select.selectedItems).toEqual([\n+ jasmine.objectContaining({ label: 'Vilnius', value: { id: 1, name: 'Vilnius' } })\n+ ]);\n+\n+ fixture.componentInstance.cities = [\n+ { id: 1, name: 'Vilnius' },\n+ { id: 2, name: 'Kaunas' },\n+ { id: 3, name: 'Pabrade' },\n+ ];\n+ tickAndDetectChanges(fixture);\n+ const vilnius = select.itemsList.items[0];\n+ expect(select.selectedItems[0]).toBe(select.itemsList.items[0]);\n+ expect(vilnius.selected).toBeTruthy();\n+ }));\n+\n+ it('should set items correctly after ngModel set first when typeahead and multiselect is used', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectSelectedTypeaheadWithBindValueMultipleCmp,\n+ `<ng-select [items]=\"cities\"\n+ bindLabel=\"name\"\n+ [multiple]=\"true\"\n+ [typeahead]=\"filter\"\n+ placeholder=\"select value\"\n+ [(ngModel)]=\"selectedCities\">\n+ </ng-select>`);\n+\n+ const select = fixture.componentInstance.select;\n+ fixture.componentInstance.selectedCities = [{ id: 1, name: 'Vilnius' }, { id: 2, name: 'Kaunas' }];\n+ tickAndDetectChanges(fixture);\n+ expect(select.selectedItems).toEqual([\n+ jasmine.objectContaining({ label: 'Vilnius', value: { id: 1, name: 'Vilnius' } }),\n+ jasmine.objectContaining({ label: 'Kaunas', value: { id: 2, name: 'Kaunas' } })\n+ ]);\n+\n+ fixture.componentInstance.cities = [\n+ { id: 1, name: 'Vilnius' },\n+ { id: 2, name: 'Kaunas' },\n+ { id: 3, name: 'Pabrade' },\n+ ];\n+ tickAndDetectChanges(fixture);\n+ const vilnius = select.itemsList.items[0];\n+ const kaunas = select.itemsList.items[1];\n+ expect(select.selectedItems[0]).toBe(vilnius);\n+ expect(vilnius.selected).toBeTruthy();\n+ expect(select.selectedItems[1]).toBe(kaunas);\n+ expect(kaunas.selected).toBeTruthy();\n+ }));\n+\nit('should set items correctly if there is no bindLabel', fakeAsync(() => {\nconst fixture = createTestingModule(\nNgSelectModelChangesTestCmp,\n@@ -243,9 +331,7 @@ describe('NgSelectComponent', function () {\nexpect(internalItems.length).toBe(1);\nexpect(internalItems[0].value).toEqual(jasmine.objectContaining({ id: 1, name: 'New city' }));\n}));\n- });\n- describe('Model bindings', () => {\nit('bind to custom object properties', fakeAsync(() => {\nconst fixture = createTestingModule(\nNgSelectCustomBindingsTestCmp,\n@@ -354,7 +440,6 @@ describe('NgSelectComponent', function () {\n})]);\ndiscardPeriodicTasks();\n}));\n- });\ndescribe('Pre-selected model', () => {\ndescribe('single', () => {\n@@ -462,7 +547,7 @@ describe('NgSelectComponent', function () {\nexpect(fixture.componentInstance.select.selectedItems).toEqual(result);\n}));\n- it('should select none when there is no items', fakeAsync(() => {\n+ it('should select selected when there is no items', fakeAsync(() => {\nconst fixture = createTestingModule(\nNgSelectSelectedEmptyCmp,\n`<ng-select [items]=\"cities\"\n@@ -473,7 +558,9 @@ describe('NgSelectComponent', function () {\n</ng-select>`);\ntickAndDetectChanges(fixture);\n- expect(fixture.componentInstance.select.selectedItems).toEqual([]);\n+ const selected = fixture.componentInstance.select.selectedItems[0];\n+ expect(selected.label).toEqual('');\n+ expect(selected.value).toEqual({name: null, id: 2});\n}));\n});\n@@ -519,6 +606,7 @@ describe('NgSelectComponent', function () {\n}));\n});\n});\n+ });\ndescribe('Dropdown panel', () => {\nit('should set and render items in dropdown panel', fakeAsync(() => {\n@@ -529,10 +617,10 @@ describe('NgSelectComponent', function () {\n[(ngModel)]=\"city\">\n</ng-select>`);\n- fixture.componentInstance.select.isOpen = true;\n- tickAndDetectChanges(fixture);\n+ const select = fixture.componentInstance.select;\n+ select.open();\n- expect(fixture.componentInstance.select.dropdownPanel.items.length).toBe(3);\n+ expect(select.dropdownPanel.items.length).toBe(3);\nlet options = fixture.debugElement.nativeElement.querySelectorAll('.ng-option');\nexpect(options.length).toBe(3);\nexpect(options[0].innerText).toBe('Vilnius');\n@@ -555,8 +643,8 @@ describe('NgSelectComponent', function () {\n[(ngModel)]=\"city\">\n</ng-select>`);\n- fixture.componentInstance.select.isOpen = true;\n- tickAndDetectChanges(fixture);\n+ const select = fixture.componentInstance.select;\n+ select.open();\nexpect(fixture.componentInstance.select.dropdownPanel.items.length).toBe(3);\nlet options = fixture.debugElement.nativeElement.querySelectorAll('.ng-option');\n@@ -582,7 +670,7 @@ describe('NgSelectComponent', function () {\nconst cmp = fixture.componentInstance;\nconst el: HTMLElement = fixture.debugElement.nativeElement;\n- cmp.select.isOpen = true;\n+ cmp.select.open();\ntickAndDetectChanges(fixture);\ncmp.cities = Array.from(Array(30).keys()).map((_, i) => ({ id: i, name: String.fromCharCode(97 + i) }));\n@@ -605,7 +693,7 @@ describe('NgSelectComponent', function () {\nconst cmp = fixture.componentInstance;\nconst el: HTMLElement = fixture.debugElement.nativeElement;\n- cmp.select.isOpen = true;\n+ cmp.select.open();\ntickAndDetectChanges(fixture);\ncmp.cities = Array.from(Array(30).keys()).map((_, i) => ({ id: i, name: String.fromCharCode(97 + i) }));\n@@ -1832,6 +1920,25 @@ describe('NgSelectComponent', function () {\nselect.filter('not in list');\nexpect(select.itemsList.filteredItems.length).toBe(0);\n}));\n+\n+ it('should allow select optgroup items when [selectableGroup]=\"true\"', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectGroupingTestCmp,\n+ `<ng-select [items]=\"accounts\"\n+ groupBy=\"country\"\n+ bindLabel=\"name\"\n+ bindValue=\"email\"\n+ [selectableGroup]=\"true\"\n+ [(ngModel)]=\"selectedAccount\">\n+ </ng-select>`);\n+\n+ tickAndDetectChanges(fixture);\n+ selectOption(fixture, KeyCode.ArrowDown, 0);\n+ expect(fixture.componentInstance.selectedAccount).toBe('United States');\n+\n+ selectOption(fixture, KeyCode.ArrowDown, 1);\n+ expect(fixture.componentInstance.selectedAccount).toBe('adam@email.com');\n+ }));\n});\n});\n@@ -1840,9 +1947,9 @@ function tickAndDetectChanges(fixture) {\ntick();\n}\n-function selectOption(fixture, key: KeyCode, steps: number) {\n+function selectOption(fixture, key: KeyCode, index: number) {\ntriggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Space); // open\n- for (let i = 0; i < steps; i++) {\n+ for (let i = 0; i < index; i++) {\ntriggerKeyDownEvent(getNgSelectElement(fixture), key);\n}\ntriggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Enter); // select\n@@ -1936,6 +2043,7 @@ class NgSelectSelectedEmptyCmp {\n@ViewChild(NgSelectComponent) select: NgSelectComponent;\nselectedCity = 2;\ncities = [];\n+ filter = new Subject<string>();\n}\n@Component({\n@@ -1951,6 +2059,21 @@ class NgSelectSelectedSimpleMultipleCmp {\n];\n}\n+@Component({\n+ template: ``\n+})\n+class NgSelectSelectedTypeaheadWithBindValueMultipleCmp {\n+ @ViewChild(NgSelectComponent) select: NgSelectComponent;\n+ selectedCities = [];\n+ selectedCity: any;\n+ filter = new Subject<string>();\n+ cities = [];\n+\n+ ngOnInit() {\n+ this.filter.subscribe();\n+ }\n+}\n+\n@Component({\ntemplate: ``\n})\n@@ -2018,6 +2141,7 @@ class NgSelectModelChangesTestCmp {\nvisible = true;\nselectedCity: { id: number; name: string };\n+ selectedCityId: number;\nselectedCities = [];\ncities = [\n{ id: 1, name: 'Vilnius' },\n@@ -2091,6 +2215,7 @@ class NgSelectEventsTestCmp {\nclass NgSelectGroupingTestCmp {\n@ViewChild(NgSelectComponent) select: NgSelectComponent;\nselectedAccountName = 'Adam';\n+ selectedAccount = null;\naccounts = [\n{ name: 'Adam', email: 'adam@email.com', age: 12, country: 'United States' },\n{ name: 'Samantha', email: 'samantha@email.com', age: 30, country: 'United States' },\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": "@@ -24,7 +24,7 @@ import {\nSimpleChanges,\nContentChildren,\nQueryList,\n- InjectionToken\n+ InjectionToken,\n} from '@angular/core';\nimport {\n@@ -39,9 +39,12 @@ import { NgOption, KeyCode, NgSelectConfig } from './ng-select.types';\nimport { ItemsList } from './items-list';\nimport { NgOptionComponent } from './ng-option.component';\nimport { NgDropdownPanelComponent } from './ng-dropdown-panel.component';\n+import { isDefined, isFunction, isPromise } from './utils';\n+import { isObject } from 'util';\nexport const NG_SELECT_DEFAULT_CONFIG = new InjectionToken<NgSelectConfig>('ng-select-default-options');\nexport type DropdownPosition = 'bottom' | 'top' | 'auto';\n+export type AddTagFn = ((term: string) => any | Promise<any>);\n@Component({\nselector: 'ng-select',\n@@ -84,9 +87,10 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n@Input() groupBy: string;\n@Input() bufferAmount = 4;\n@Input() virtualScroll = false;\n+ @Input() selectableGroup = false;\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) => any | Promise<any>) = false;\n+ @Input() @HostBinding('class.taggable') addTag: boolean | AddTagFn = false;\n@Input() @HostBinding('class.searchable') searchable = true;\n// output events\n@@ -122,7 +126,6 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nfilterValue: string = null;\ncurrentDropdownPosition: DropdownPosition = 'bottom';\n- private _ngModel: any = null;\nprivate _defaultLabel = 'label';\nprivate _defaultValue = 'value';\nprivate _typeaheadLoading = false;\n@@ -239,10 +242,11 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\nwriteValue(value: any | any[]): void {\n- this._ngModel = value;\n+ if (value === undefined) {\n+ return;\n+ }\nthis._validateWriteValue(value);\n- this.itemsList.clearSelected();\n- this._selectWriteValue(value);\n+ this._handleWriteValue(value);\nthis.detectChanges();\n}\n@@ -324,13 +328,13 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nselectTag() {\nlet tag;\n- if (this.addTag instanceof Function) {\n- tag = this.addTag(this.filterValue);\n+ if (isFunction(this.addTag)) {\n+ tag = (<AddTagFn>this.addTag)(this.filterValue);\n} else {\ntag = this._primitive ? this.filterValue : { [this.bindLabel]: this.filterValue };\n}\n- if (tag instanceof Promise) {\n+ if (isPromise(tag)) {\ntag.then(item => this.select(this.itemsList.addItem(item)))\n.catch(() => { });\n} else if (tag) {\n@@ -415,11 +419,10 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nprivate _setItems(items: any[]) {\nconst firstItem = items[0];\nthis.bindLabel = this.bindLabel || this._defaultLabel;\n- this._primitive = firstItem && !(firstItem instanceof Object);\n+ this._primitive = !isObject(firstItem);\nthis.itemsList.setItems(items);\n- if (this._isDefined(this._ngModel) && items.length > 0) {\n- this.itemsList.clearSelected();\n- this._selectWriteValue(this._ngModel);\n+ if (items.length > 0 && this.hasValue) {\n+ this._updateSelectedItems();\n}\nif (this._isTypeahead) {\n@@ -439,9 +442,8 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\ndisabled: option.disabled\n}));\nthis.itemsList.setItems(this.items);\n- if (this._isDefined(this._ngModel)) {\n- this.itemsList.clearSelected();\n- this._selectWriteValue(this._ngModel);\n+ if (this.hasValue) {\n+ this._updateSelectedItems();\n}\nthis.detectChanges();\n}\n@@ -466,12 +468,12 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\nprivate _validateWriteValue(value: any) {\n- if (!this._isDefined(value)) {\n+ if (!isDefined(value)) {\nreturn;\n}\nconst validateBinding = (item: any) => {\n- if (item instanceof Object && this.bindValue) {\n+ if (isObject(item) && this.bindValue) {\nthrow new Error('Binding object with bindValue is not allowed.');\n}\n};\n@@ -486,20 +488,28 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\n}\n- private _selectWriteValue(ngModel: any | any[]) {\n- if (!this._isDefined(ngModel)) {\n+ private _handleWriteValue(ngModel: any | any[]) {\n+ const isEmptyArray = ngModel && Array.isArray(ngModel) && ngModel.length === 0;\n+ if (ngModel === null || isEmptyArray) {\n+ this.itemsList.clearSelected();\nreturn;\n}\nconst select = (val: any) => {\n- const item = this.itemsList.findItem(val);\n+ let item = this.itemsList.findItem(val);\nif (item) {\nthis.itemsList.select(item);\n} else {\n- const isObject = val instanceof Object;\n- const simpleValue = !isObject && !this.bindValue;\n- if (isObject || simpleValue) {\n+ const isValObject = isObject(val)\n+ const isPrimitive = !isValObject && !this.bindValue;\n+ if ((isValObject || isPrimitive)) {\nthis.itemsList.select(this.itemsList.mapItem(val, null));\n+ } else if (this.bindValue) {\n+ item = {\n+ [this.bindLabel]: null,\n+ [this.bindValue]: val\n+ };\n+ this.itemsList.select(this.itemsList.mapItem(item, null));\n}\n}\n};\n@@ -513,22 +523,41 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\n}\n+ private _updateSelectedItems() {\n+ this.selectedItems.forEach((s, i) => {\n+ const val = this.bindValue ? s.value[this.bindValue] : s.value;\n+ const item = this.itemsList.findItem(val);\n+ if (item && s !== item) {\n+ item.selected = true;\n+ this.itemsList.updateSelectedItem(item, i);\n+ }\n+ });\n+ }\n+\nprivate _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+ const values = [];\n+ for (const item of this.selectedItems) {\n+ if (this.bindValue) {\n+ let resolvedValue = null;\n+ if (item.hasChildren) {\n+ resolvedValue = item.value[this.groupBy];\n} else {\n- ngModel = this.itemsList.resolveNested(ngModel, this.bindValue);\n+ resolvedValue = this.itemsList.resolveNested(item.value, this.bindValue);\n}\n- this._onChange(ngModel);\n+ values.push(resolvedValue);\n} else {\n- this._onChange(ngModel);\n+ values.push(item.value);\n+ }\n+ }\n+\n+ let ngModel = null;\n+ if (this.multiple) {\n+ ngModel = values;\n+ } else if (isDefined(values[0])) {\n+ ngModel = values[0];\n}\n- this._ngModel = ngModel;\n- this.changeEvent.emit(this._value);\n+ this._onChange(ngModel);\n+ this.changeEvent.emit(ngModel);\nthis._cd.markForCheck();\n}\n@@ -627,14 +656,6 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nreturn this.typeahead && this.typeahead.observers.length > 0;\n}\n- private get _value() {\n- if (this.multiple) {\n- return this.selectedItems.map(option => option.value);\n- }\n- const selectedItem = this.selectedItems[0];\n- return selectedItem ? selectedItem.value : null;\n- }\n-\nprivate _mergeGlobalConfig(config: NgSelectConfig) {\nthis.notFoundText = this.notFoundText || config.notFoundText;\nthis.typeToSearchText = this.typeToSearchText || config.typeToSearchText;\n@@ -642,8 +663,4 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nthis.loadingText = this.loadingText || config.loadingText;\nthis.clearAllText = this.clearAllText || config.clearAllText;\n}\n-\n- private _isDefined(value: any) {\n- return value !== null && value !== undefined;\n- }\n}\n", "new_path": "src/ng-select/ng-select.component.ts", "old_path": "src/ng-select/ng-select.component.ts" }, { "change_type": "ADD", "diff": "+export function isDefined(value: any) {\n+ return value !== null && value !== undefined;\n+}\n+\n+export function isObject(value: any) {\n+ return isDefined(value) && typeof value === 'object'\n+}\n+\n+export function isPromise(value: any) {\n+ return value instanceof Promise;\n+}\n+\n+export function isFunction(value: any) {\n+ return value instanceof Function;\n+}\n", "new_path": "src/ng-select/utils.ts", "old_path": null }, { "change_type": "MODIFY", "diff": "@@ -198,8 +198,19 @@ $color-selected: #f5faff;\nuser-select: none;\ncursor: default;\npadding: 8px 10px;\n+ &.disabled {\ncolor: rgba(0,0,0,.54);\n}\n+ &.marked {\n+ background-color: #ebf5ff;\n+ color: #333;\n+ }\n+ &.selected {\n+ color: #333;\n+ background-color: $color-selected;\n+ font-weight: 600;\n+ }\n+ }\n.ng-option {\nbackground-color: #fff;\n@@ -207,6 +218,7 @@ $color-selected: #f5faff;\npadding: 8px 10px;\n&.selected {\n+ color: #333;\nbackground-color: $color-selected;\n.ng-option-label {\nfont-weight: 600;\n@@ -216,9 +228,6 @@ $color-selected: #f5faff;\nbackground-color: #ebf5ff;\ncolor: #333;\n}\n- &.selected {\n- color: #333;\n- }\n&.disabled {\ncolor: #cccccc;\n}\n", "new_path": "src/themes/default.theme.scss", "old_path": "src/themes/default.theme.scss" }, { "change_type": "MODIFY", "diff": "@@ -191,10 +191,21 @@ $highlight-color: #3f51b5;\n.ng-optgroup {\nuser-select: none;\ncursor: default;\n- color: rgba(0,0,0,.54);\nline-height: 3em;\nheight: 3em;\npadding: 0 16px;\n+\n+ &.marked {\n+ background: rgba(0, 0, 0, .04);\n+ color: rgba(0, 0, 0, .87);\n+ }\n+ &.disabled {\n+ color: rgba(0,0,0,.54);\n+ }\n+ &.selected {\n+ background: rgba(0, 0, 0, .12);\n+ color: $highlight-color;\n+ }\n}\n.ng-option {\n", "new_path": "src/themes/material.theme.scss", "old_path": "src/themes/material.theme.scss" } ]
TypeScript
MIT License
ng-select/ng-select
feat: selectable group (#325) fixes #282
1
feat
null
807,849
07.03.2018 17:34:46
28,800
f1816d05bd0e9897712683adc69a972d79a6593c
test(helpers): extract serialize-changelog
[ { "change_type": "MODIFY", "diff": "const execa = require(\"execa\");\nconst fs = require(\"fs-extra\");\n-const normalizeNewline = require(\"normalize-newline\");\nconst path = require(\"path\");\nconst collectPackages = require(\"@lerna/collect-packages\");\n@@ -13,17 +12,7 @@ const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\nconst { recommendVersion, updateChangelog } = require(\"..\");\n// stabilize changelog commit SHA and datestamp\n-expect.addSnapshotSerializer({\n- print(val) {\n- return normalizeNewline(val)\n- .replace(/\\b[0-9a-f]{7,8}\\b/g, \"SHA\")\n- .replace(/\\b[0-9a-f]{40}\\b/g, \"GIT_HEAD\")\n- .replace(/\\(\\d{4}-\\d{2}-\\d{2}\\)/g, \"(YYYY-MM-DD)\");\n- },\n- test(val) {\n- return val && typeof val === \"string\";\n- },\n-});\n+expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\ndescribe(\"conventional-commits\", () => {\nconst currentDirectory = process.cwd();\n", "new_path": "core/conventional-commits/__tests__/conventional-commits.test.js", "old_path": "core/conventional-commits/__tests__/conventional-commits.test.js" }, { "change_type": "ADD", "diff": "+\"use strict\";\n+\n+const normalizeNewline = require(\"normalize-newline\");\n+\n+// expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\n+module.exports = {\n+ print(val) {\n+ return normalizeNewline(val)\n+ .replace(/\\b[0-9a-f]{7,8}\\b/g, \"SHA\")\n+ .replace(/\\b[0-9a-f]{40}\\b/g, \"GIT_HEAD\")\n+ .replace(/\\(\\d{4}-\\d{2}-\\d{2}\\)/g, \"(YYYY-MM-DD)\");\n+ },\n+ test(val) {\n+ return val && typeof val === \"string\";\n+ },\n+};\n", "new_path": "helpers/serialize-changelog/index.js", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"@lerna-test/serialize-changelog\",\n+ \"version\": \"0.0.0-test-only\",\n+ \"description\": \"A local test helper\",\n+ \"main\": \"index.js\",\n+ \"private\": true,\n+ \"license\": \"MIT\",\n+ \"dependencies\": {\n+ \"normalize-newline\": \"^3.0.0\"\n+ }\n+}\n", "new_path": "helpers/serialize-changelog/package.json", "old_path": null }, { "change_type": "MODIFY", "diff": "@@ -18,17 +18,7 @@ const loadManifests = require(\"@lerna-test/load-manifests\");\nconst normalizeTestRoot = require(\"@lerna-test/normalize-test-root\");\n// stabilize changelog commit SHA and datestamp\n-expect.addSnapshotSerializer({\n- print(val) {\n- return normalizeNewline(val)\n- .replace(/\\b[0-9a-f]{7,8}\\b/g, \"SHA\")\n- .replace(/\\b[0-9a-f]{40}\\b/g, \"GIT_HEAD\")\n- .replace(/\\(\\d{4}-\\d{2}-\\d{2}\\)/g, \"(YYYY-MM-DD)\");\n- },\n- test(val) {\n- return val && typeof val === \"string\";\n- },\n-});\n+expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\nconst lastCommitMessage = cwd =>\nexeca.stdout(\"git\", [\"log\", \"-1\", \"--format=%B\"], { cwd }).then(normalizeNewline);\n", "new_path": "integration/lerna-publish.test.js", "old_path": "integration/lerna-publish.test.js" }, { "change_type": "MODIFY", "diff": "\"semver\": \"5.5.0\"\n}\n},\n+ \"@lerna-test/serialize-changelog\": {\n+ \"version\": \"file:helpers/serialize-changelog\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"normalize-newline\": \"3.0.0\"\n+ }\n+ },\n\"@lerna-test/serialize-placeholders\": {\n\"version\": \"file:helpers/serialize-placeholders\",\n\"dev\": true,\n\"requires\": {\n\"@lerna/bootstrap\": \"file:commands/bootstrap\",\n\"@lerna/command\": \"file:core/command\",\n+ \"@lerna/filter-options\": \"file:core/filter-options\",\n\"@lerna/validation-error\": \"file:core/validation-error\",\n\"dedent\": \"0.7.0\",\n\"npm-package-arg\": \"6.0.0\",\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "MODIFY", "diff": "\"@lerna-test/normalize-relative-dir\": \"file:helpers/normalize-relative-dir\",\n\"@lerna-test/normalize-test-root\": \"file:helpers/normalize-test-root\",\n\"@lerna-test/pkg-matchers\": \"file:helpers/pkg-matchers\",\n+ \"@lerna-test/serialize-changelog\": \"file:helpers/serialize-changelog\",\n\"@lerna-test/serialize-placeholders\": \"file:helpers/serialize-placeholders\",\n\"@lerna-test/silence-logging\": \"file:helpers/silence-logging\",\n\"@lerna-test/update-lerna-config\": \"file:helpers/update-lerna-config\",\n", "new_path": "package.json", "old_path": "package.json" } ]
JavaScript
MIT License
lerna/lerna
test(helpers): extract serialize-changelog
1
test
helpers
679,913
07.03.2018 23:44:19
0
9e5239bc1a05e6ca53052edcc5368fd69bb60fae
fix(atom): add EventBus to module re-exports, minor cleanup
[ { "change_type": "MODIFY", "diff": "@@ -260,8 +260,4 @@ export class EventBus {\n}\n}\n}\n-\n- protected insertPriority(p: api.EffectPriority) {\n-\n- }\n}\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" }, { "change_type": "MODIFY", "diff": "export * from \"./api\";\nexport * from \"./atom\";\nexport * from \"./cursor\";\n+export * from \"./event-bus\";\nexport * from \"./history\";\nexport * from \"./path\";\nexport * from \"./view\";\n", "new_path": "packages/atom/src/index.ts", "old_path": "packages/atom/src/index.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
fix(atom): add EventBus to module re-exports, minor cleanup
1
fix
atom
679,913
07.03.2018 23:45:13
0
c9794acb4199785eeb00cf054b5afec15c80f4d7
feat(examples): add async fx example
[ { "change_type": "ADD", "diff": "+node_modules\n+yarn.lock\n+*.js\n", "new_path": "examples/async-effect/.gitignore", "old_path": null }, { "change_type": "ADD", "diff": "+# async-effect\n+\n+[Live demo](http://demo.thi.ng/umbrella/async-effect/)\n+\n+```\n+git clone https://github.com/thi-ng/umbrella.git\n+cd umbrella/examples/async-effect\n+yarn install\n+```\n+Then\n+\n+```\n+# For Mac\n+yarn dev\n+\n+# For Debian, Ubuntu, Etc.\n+yarn debdev\n+```\n+\n+Once webpack has completed building, refresh your browser...\n", "new_path": "examples/async-effect/README.md", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"computer\": \"says yesss!\"\n+}\n\\ No newline at end of file\n", "new_path": "examples/async-effect/foo.json", "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+ #status {\n+ padding: 0.5rem;\n+ }\n+\n+ #status.success {\n+ background: #cf6;\n+ }\n+\n+ #status.error {\n+ background: #faa;\n+ }\n+\n+ pre {\n+ padding: 0.5rem;\n+ background: #eee;\n+ }\n+ </style>\n+</head>\n+\n+<body>\n+ <h1>async side effect handling</h1>\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/async-effect/index.html", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"async-effect\",\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+ \"debdev\": \"see 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.3\",\n+ \"@thi.ng/atom\": \"^0.9.1\",\n+ \"@thi.ng/hdom\": \"^2.1.0\"\n+ }\n+}\n\\ No newline at end of file\n", "new_path": "examples/async-effect/package.json", "old_path": null }, { "change_type": "ADD", "diff": "+import { Atom, EventBus, setIn, FX_DISPACH_NOW, FX_STATE } from \"@thi.ng/atom\";\n+import { start } from \"@thi.ng/hdom/start\";\n+\n+const FX_ASYNC = \"async\";\n+\n+const events = {\n+ setStatus: (state, [_, s]) => ({ [FX_STATE]: setIn(state, \"status\", s) }),\n+\n+ // this event is the initial trigger for starting an async IO operation\n+ // via the FX_ASYNC side effect, which takes this general definition:\n+ // [[fxid, fx-arg], success-event-id, error-event-id]\n+ //\n+ // FX_ASYNC acts as a wrapper for the actual side effect to be executed,\n+ // in this case it's the \"json\" side effect defined below\n+ // the last items in the array are the event IDs for success & error outcomes\n+ loadJSON: (_, [__, url]) => ({\n+ [FX_DISPACH_NOW]: [\"setStatus\", [\"idle\", `loading: ${url}...`]],\n+ [FX_ASYNC]: [[\"json\", url], \"receiveJSON\", \"error\"]\n+ }),\n+\n+ // this event will be triggered after JSON data has been successfully loaded\n+ receiveJSON: (state, [_, json]) => ({\n+ [FX_DISPACH_NOW]: [\"setStatus\", [\"success\", \"JSON succesfully loaded\"]],\n+ [FX_STATE]: setIn(state, \"json\", JSON.stringify(json, null, 2))\n+ }),\n+\n+ error: (_, [__, err]) => ({\n+ [FX_DISPACH_NOW]: [\"setStatus\", [\"error\", err.message]],\n+ })\n+};\n+\n+const effects = {\n+ // an async side effect ALWAYS MUST RETURN A PROMISE\n+ json: (url) => fetch(url).then((res) => res.json())\n+};\n+\n+const app = () => {\n+ const db = new Atom<any>({});\n+ const bus = new EventBus(db, events, effects);\n+\n+ // this is the above mentioned async effect wrapper\n+ // its definition should/will be moved inside the EventBus class...\n+ // assumes the specified async effect function returns a Promise\n+ bus.addEffect(FX_ASYNC, ([[id, arg], success, err]) =>\n+ (<any>bus.effects[id](arg))\n+ .then((body) => bus.dispatch([success, body]))\n+ .catch((e) => bus.dispatch([err, e]))\n+ );\n+\n+ // kick off IO\n+ bus.dispatch([\"loadJSON\", \"foo.json\"]);\n+\n+ // root component function\n+ return () => {\n+ if (bus.processQueue()) {\n+ let status = db.deref().status;\n+ return [\"div\",\n+ [\"p#status\", { class: status[0] }, `status: ${status[1]}`],\n+ [\"pre\",]\n+ ];\n+ }\n+ }\n+};\n+\n+start(\"app\", app());\n\\ No newline at end of file\n", "new_path": "examples/async-effect/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/async-effect/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/async-effect/webpack.config.js", "old_path": null } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(examples): add async fx example
1
feat
examples
679,913
08.03.2018 00:06:22
0
52fff0931e42542e25db869fe2db39d569fa60cc
docs(examples): update async readme & html
[ { "change_type": "MODIFY", "diff": "git clone https://github.com/thi-ng/umbrella.git\ncd umbrella/examples/async-effect\nyarn install\n+yarn build\n```\n-Then\n-```\n-# For Mac\n-yarn dev\n+Unlike other examples, this one requires a local webserver to function, for example:\n-# For Debian, Ubuntu, Etc.\n-yarn debdev\n+```\n+python -m SimpleHTTPServer\n```\n-Once webpack has completed building, refresh your browser...\n+Ps. You can also run the demo without server, but this only good for testing\n+the error event handling :)\n\\ No newline at end of file\n", "new_path": "examples/async-effect/README.md", "old_path": "examples/async-effect/README.md" }, { "change_type": "MODIFY", "diff": "<body>\n<h1>async side effect handling</h1>\n+ <p>\n+ <a href=\"https://github.com/thi-ng/umbrella/blob/master/examples/async-effect/src/index.ts\">Source</a>\n+ </p>\n<div id=\"app\"></div>\n<script type=\"text/javascript\" src=\"bundle.js\"></script>\n</body>\n", "new_path": "examples/async-effect/index.html", "old_path": "examples/async-effect/index.html" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
docs(examples): update async readme & html
1
docs
examples
679,913
08.03.2018 02:59:11
0
9900e991192b89fb9a6c3690936b18532db883a1
feat(checks): add isPromise() & isPromiseLike()
[ { "change_type": "MODIFY", "diff": "@@ -30,6 +30,8 @@ export * from \"./is-object\";\nexport * from \"./is-odd\";\nexport * from \"./is-plain-object\";\nexport * from \"./is-positive\";\n+export * from \"./is-promise\";\n+export * from \"./is-promiselike\";\nexport * from \"./is-regexp\";\nexport * from \"./is-safari\";\nexport * from \"./is-string\";\n", "new_path": "packages/checks/src/index.ts", "old_path": "packages/checks/src/index.ts" }, { "change_type": "ADD", "diff": "+export function isPromise(x: any): x is Promise<any> {\n+ return x instanceof Promise;\n+}\n", "new_path": "packages/checks/src/is-promise.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { implementsFunction } from \"./implements-function\";\n+\n+export function isPromiseLike(x: any): x is Promise<any> {\n+ return x instanceof Promise ||\n+ (implementsFunction(x, \"then\") && implementsFunction(x, \"catch\"));\n+}\n", "new_path": "packages/checks/src/is-promiselike.ts", "old_path": null } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(checks): add isPromise() & isPromiseLike()
1
feat
checks
679,913
08.03.2018 05:06:57
0
a6beda9dda2f8dd18e3279dfd5d89e12fa33079e
refactor(examples): update async & interceptor demos
[ { "change_type": "MODIFY", "diff": "-import { Atom, EventBus, setIn, FX_DISPACH_NOW, FX_STATE } from \"@thi.ng/atom\";\n+import { IObjectOf } from \"@thi.ng/api/api\";\n+import { EventDef, EffectDef } from \"@thi.ng/atom/api\";\n+import { FX_DISPATCH_ASYNC, FX_DISPATCH_NOW, FX_STATE } from \"@thi.ng/atom/api\";\n+import { Atom } from \"@thi.ng/atom/atom\";\n+import { EventBus } from \"@thi.ng/atom/event-bus\";\n+import { setIn } from \"@thi.ng/atom/path\";\nimport { start } from \"@thi.ng/hdom/start\";\n-const FX_ASYNC = \"async\";\n-\n-const events = {\n+const events: IObjectOf<EventDef> = {\nsetStatus: (state, [_, s]) => ({ [FX_STATE]: setIn(state, \"status\", s) }),\n// this event is the initial trigger for starting an async IO operation\n- // via the FX_ASYNC side effect, which takes this general definition:\n- // [[fxid, fx-arg], success-event-id, error-event-id]\n+ // via the FX_DISPATCH_ASYNC side effect, which takes this general definition:\n+ // [fx-id, fx-arg, success-event-id, error-event-id]\n//\n- // FX_ASYNC acts as a wrapper for the actual side effect to be executed,\n+ // FX_DISPATCH_ASYNC acts as a wrapper for the actual side effect to be executed,\n// in this case it's the \"json\" side effect defined below\n// the last items in the array are the event IDs for success & error outcomes\nloadJSON: (_, [__, url]) => ({\n- [FX_DISPACH_NOW]: [\"setStatus\", [\"idle\", `loading: ${url}...`]],\n- [FX_ASYNC]: [[\"json\", url], \"receiveJSON\", \"error\"]\n+ [FX_DISPATCH_NOW]: [\"setStatus\", [\"idle\", `loading: ${url}...`]],\n+ [FX_DISPATCH_ASYNC]: [\"json\", url, \"receiveJSON\", \"error\"]\n}),\n// this event will be triggered after JSON data has been successfully loaded\n+ // sets status message, `json` state value and triggers another,\n+ // delayed invocation of \"setStatus\" event to reset message after 1sec\nreceiveJSON: (state, [_, json]) => ({\n- [FX_DISPACH_NOW]: [\"setStatus\", [\"success\", \"JSON succesfully loaded\"]],\n- [FX_STATE]: setIn(state, \"json\", JSON.stringify(json, null, 2))\n+ [FX_STATE]: setIn(state, \"json\", JSON.stringify(json, null, 2)),\n+ [FX_DISPATCH_NOW]: [\"setStatus\", [\"success\", \"JSON succesfully loaded\"]],\n+ [FX_DISPATCH_ASYNC]: [\"delay\", [1000, [\"idle\", \"done.\"]], \"setStatus\", \"error\"],\n}),\n+ // error event handler\nerror: (_, [__, err]) => ({\n- [FX_DISPACH_NOW]: [\"setStatus\", [\"error\", err.message]],\n- })\n+ [FX_DISPATCH_NOW]: [\"setStatus\", [\"error\", err.message]],\n+ }),\n};\n-const effects = {\n- // an async side effect ALWAYS MUST RETURN A PROMISE\n- json: (url) => fetch(url).then((res) => res.json())\n+const effects: IObjectOf<EffectDef> = {\n+ // these are async side effects. ALWAYS MUST RETURN A PROMISE\n+ json: (url) => fetch(url).then((res) => res.json()),\n+ delay: ([x, msg]) => new Promise((res) => setTimeout(() => res(msg), x))\n};\nconst app = () => {\n- const db = new Atom<any>({});\n- const bus = new EventBus(db, events, effects);\n-\n- // this is the above mentioned async effect wrapper\n- // its definition should/will be moved inside the EventBus class...\n- // assumes the specified async effect function returns a Promise\n- bus.addEffect(FX_ASYNC, ([[id, arg], success, err]) =>\n- (<any>bus.effects[id](arg))\n- .then((body) => bus.dispatch([success, body]))\n- .catch((e) => bus.dispatch([err, e]))\n- );\n+ const bus = new EventBus(new Atom<any>({}), events, effects);\n- // kick off IO\n+ // kick off JSON request\nbus.dispatch([\"loadJSON\", \"foo.json\"]);\n// root component function\nreturn () => {\nif (bus.processQueue()) {\n- let status = db.deref().status;\n+ let { json, status } = bus.state.deref();\nreturn [\"div\",\n[\"p#status\", { class: status[0] }, `status: ${status[1]}`],\n- [\"pre\",]\n+ [\"pre\", json]\n];\n}\n}\n", "new_path": "examples/async-effect/src/index.ts", "old_path": "examples/async-effect/src/index.ts" }, { "change_type": "MODIFY", "diff": "import { IObjectOf } from \"@thi.ng/api/api\";\n-import { Path } from \"@thi.ng/atom/api\";\n+import { EffectDef, EventDef, FX_DISPATCH_NOW, FX_STATE, IDispatch, Path } from \"@thi.ng/atom/api\";\nimport { Atom } from \"@thi.ng/atom/atom\";\n+import { EventBus } from \"@thi.ng/atom/event-bus\";\n+import { ensureLessThan, ensureGreaterThan, trace } from \"@thi.ng/atom/interceptors\";\nimport { updateIn, setIn } from \"@thi.ng/atom/path\";\nimport { start } from \"@thi.ng/hdom/start\";\n-import { EffectDef, EventDef, FX_DISPACH_NOW, FX_STATE } from \"@thi.ng/atom/api\";\n-import { EventBus } from \"@thi.ng/atom/event-bus\";\n-import { ensureLessThan, ensureGreaterThan, trace } from \"@thi.ng/atom/interceptors\";\n///////////////////////////////////////////////////////////////////////\n// event handler definitions\n@@ -20,11 +19,11 @@ const events: IObjectOf<EventDef> = {\n// counter values will be always be in the range between 0 .. 100\ninc: [\nensureLessThan(100, null, () => console.warn(\"eek, reached max\")),\n- (_, [__, path]) => ({ [FX_DISPACH_NOW]: [\"updateVal\", [path, 1]] })\n+ (_, [__, path]) => ({ [FX_DISPATCH_NOW]: [\"updateVal\", [path, 1]] })\n],\ndec: [\nensureGreaterThan(0, null, () => console.warn(\"eek, reached min\")),\n- (_, [__, path]) => ({ [FX_DISPACH_NOW]: [\"updateVal\", [path, -1]] })\n+ (_, [__, path]) => ({ [FX_DISPATCH_NOW]: [\"updateVal\", [path, -1]] })\n],\n// this event handler injects the trace interceptor\n@@ -37,7 +36,7 @@ const events: IObjectOf<EventDef> = {\n// this handler increments the `nextID` state value and\n// triggers \"addCounter\" side effect with config options for the new counter\naddCounter: (state) => ({\n- [FX_DISPACH_NOW]: [\"updateVal\", [\"nextID\", 1]],\n+ [FX_DISPATCH_NOW]: [\"updateVal\", [\"nextID\", 1]],\n// the \"addCounter\" side effect is defined further below\n// here we simply prepare some configuration data for the new counter\n\"addCounter\": {\n@@ -61,7 +60,7 @@ const effects: IObjectOf<EffectDef> = {\n// counter component function\n// calls to this function will be triggered via the \"addCounter\" event and its side effect\n// (see further below)\n-const counter = (bus: EventBus, path: Path, start = 0, color: string) => {\n+const counter = (bus: IDispatch, path: Path, start = 0, color: string) => {\nconst view = bus.state.addView(path);\nbus.dispatch([\"init\", [path, start]]);\nreturn () =>\n@@ -92,7 +91,7 @@ const app = () => {\n// here we define the \"addCounter\" side effect, responsible for\n// creating a new `counter()` component\nbus.addEffect(\"addCounter\",\n- ({ id, color, start }) =>\n+ ({ id, color, start }, bus) =>\ncounters.push(counter(bus, `counters.${id}`, start, color)));\n// this not just initializes the given state value\n", "new_path": "examples/interceptor-basics/src/index.ts", "old_path": "examples/interceptor-basics/src/index.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(examples): update async & interceptor demos
1
refactor
examples
679,913
08.03.2018 05:26:30
0
c5d5ed56973ce67ae9d32d491a28bce9481e031c
build(examples): update all deps
[ { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.10.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.3\",\n- \"@thi.ng/atom\": \"^0.9.1\",\n- \"@thi.ng/hdom\": \"^2.1.0\"\n+ \"@thi.ng/api\": \"^2.0.4\",\n+ \"@thi.ng/atom\": \"^0.10.0\",\n+ \"@thi.ng/hdom\": \"^2.1.1\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/async-effect/package.json", "old_path": "examples/async-effect/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.3\",\n- \"@thi.ng/hdom\": \"^2.0.0\",\n- \"@thi.ng/hdom-components\": \"^1.0.0\",\n- \"@thi.ng/transducers\": \"^1.6.1\"\n+ \"@thi.ng/api\": \"^2.0.4\",\n+ \"@thi.ng/hdom\": \"^2.1.1\",\n+ \"@thi.ng/hdom-components\": \"^1.0.1\",\n+ \"@thi.ng/transducers\": \"^1.6.2\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/cellular-automata/package.json", "old_path": "examples/cellular-automata/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/hdom\": \"^2.0.0\"\n+ \"@thi.ng/hdom\": \"^2.1.1\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/dashboard/package.json", "old_path": "examples/dashboard/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.10.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.3\",\n- \"@thi.ng/atom\": \"^0.8.0\",\n- \"@thi.ng/hdom\": \"^2.1.0\",\n- \"@thi.ng/rstream\": \"^1.0.9\",\n- \"@thi.ng/transducers\": \"^1.6.1\"\n+ \"@thi.ng/api\": \"^2.0.4\",\n+ \"@thi.ng/atom\": \"^0.10.0\",\n+ \"@thi.ng/hdom\": \"^2.1.1\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/devcards/package.json", "old_path": "examples/devcards/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/hdom\": \"^2.0.0\"\n+ \"@thi.ng/hdom\": \"^2.1.1\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/hdom-basics/package.json", "old_path": "examples/hdom-basics/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.3\",\n- \"@thi.ng/hdom\": \"^2.0.0\",\n- \"@thi.ng/rstream\": \"^1.0.7\",\n- \"@thi.ng/transducers\": \"^1.6.1\"\n+ \"@thi.ng/api\": \"^2.0.4\",\n+ \"@thi.ng/hdom\": \"^2.1.1\",\n+ \"@thi.ng/rstream\": \"^1.0.13\",\n+ \"@thi.ng/transducers\": \"^1.6.2\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/hdom-benchmark/package.json", "old_path": "examples/hdom-benchmark/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/api\": \"^2.0.3\",\n- \"@thi.ng/atom\": \"^0.9.1\",\n- \"@thi.ng/hdom\": \"^2.1.0\"\n+ \"@thi.ng/api\": \"^2.0.4\",\n+ \"@thi.ng/atom\": \"^0.10.0\",\n+ \"@thi.ng/hdom\": \"^2.1.1\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/interceptor-basics/package.json", "old_path": "examples/interceptor-basics/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/hdom\": \"^2.0.0\",\n- \"@thi.ng/transducers\": \"^1.6.1\"\n+ \"@thi.ng/hdom\": \"^2.1.1\",\n+ \"@thi.ng/transducers\": \"^1.6.2\"\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/atom\": \"^0.7.3\",\n- \"@thi.ng/hdom\": \"^2.0.0\"\n+ \"@thi.ng/atom\": \"^0.10.0\",\n+ \"@thi.ng/hdom\": \"^2.1.1\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/login-form/package.json", "old_path": "examples/login-form/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/hdom\": \"^2.0.0\",\n- \"@thi.ng/transducers\": \"^1.6.1\"\n+ \"@thi.ng/hdom\": \"^2.1.1\",\n+ \"@thi.ng/transducers\": \"^1.6.2\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/svg-particles/package.json", "old_path": "examples/svg-particles/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/atom\": \"^0.7.3\",\n- \"@thi.ng/hdom\": \"^2.0.0\",\n- \"@thi.ng/transducers\": \"^1.6.1\"\n+ \"@thi.ng/atom\": \"^0.10.0\",\n+ \"@thi.ng/hdom\": \"^2.1.1\",\n+ \"@thi.ng/transducers\": \"^1.6.2\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/todo-list/package.json", "old_path": "examples/todo-list/package.json" }, { "change_type": "MODIFY", "diff": "\"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n- \"@thi.ng/hdom\": \"^2.0.0\",\n- \"@thi.ng/hdom-components\": \"^1.0.0\"\n+ \"@thi.ng/hdom\": \"^2.1.1\",\n+ \"@thi.ng/hdom-components\": \"^1.0.1\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/webgl/package.json", "old_path": "examples/webgl/package.json" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
build(examples): update all deps
1
build
examples
807,849
08.03.2018 10:56:40
28,800
ddfb517ab9a061876378a925467b60c8abf17534
fix(publish): work around yarn "link:" intransigency refs npm/npm#15900, refs yarnpkg/yarn#4212
[ { "change_type": "ADD", "diff": "+workspaces-experimental true\n", "new_path": "commands/__fixtures__/yarn-link-spec/.yarnrc", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"version\": \"1.0.0\",\n+ \"npmClient\": \"yarn\",\n+ \"useWorkspaces\": true\n+}\n", "new_path": "commands/__fixtures__/yarn-link-spec/lerna.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"yarn-link-spec\",\n+ \"private\": true,\n+ \"workspaces\": [\n+ \"workspaces/*\"\n+ ]\n+}\n", "new_path": "commands/__fixtures__/yarn-link-spec/package.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"package-1\",\n+ \"version\": \"1.0.0\"\n+}\n", "new_path": "commands/__fixtures__/yarn-link-spec/workspaces/package-1/package.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"package-2\",\n+ \"version\": \"1.0.0\",\n+ \"dependencies\": {\n+ \"package-1\": \"link:../package-1\"\n+ }\n+}\n", "new_path": "commands/__fixtures__/yarn-link-spec/workspaces/package-2/package.json", "old_path": null }, { "change_type": "MODIFY", "diff": "@@ -1204,6 +1204,16 @@ describe(\"PublishCommand\", () => {\n\"package-6\": \"6.0.0\",\n});\n});\n+\n+ it(\"works around npm-incompatible link: specifiers\", async () => {\n+ const testDir = await initFixture(\"yarn-link-spec\");\n+\n+ await lernaPublish(testDir)(\"--cd-version\", \"major\", \"--yes\");\n+\n+ expect(updatedPackageJSON(\"package-2\").dependencies).toMatchObject({\n+ \"package-1\": \"^2.0.0\",\n+ });\n+ });\n});\ndescribe(\"in a cyclical repo\", () => {\n", "new_path": "commands/publish/__tests__/publish-command.test.js", "old_path": "commands/publish/__tests__/publish-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -70,7 +70,11 @@ class PackageGraph extends Map {\nObject.keys(graphDependencies).forEach(depName => {\nconst depNode = this.get(depName);\n- const resolved = npa.resolve(depName, graphDependencies[depName], currentNode.location);\n+ // Yarn decided to ignore https://github.com/npm/npm/pull/15900 and implemented \"link:\"\n+ // As they apparently have no intention of being compatible, we have to do it for them.\n+ // @see https://github.com/yarnpkg/yarn/issues/4212\n+ const spec = graphDependencies[depName].replace(/^link:/, \"file:\");\n+ const resolved = npa.resolve(depName, spec, currentNode.location);\nif (!depNode) {\n// it's an external dependency, store the resolution and bail\n", "new_path": "core/package-graph/index.js", "old_path": "core/package-graph/index.js" } ]
JavaScript
MIT License
lerna/lerna
fix(publish): work around yarn "link:" intransigency refs npm/npm#15900, refs yarnpkg/yarn#4212
1
fix
publish
815,745
08.03.2018 12:05:24
-7,200
6584eb135fe904c2e0e09d6a59ae803a1d9ce2a0
fix: label formatting fixes
[ { "change_type": "MODIFY", "diff": "import { NgOption } from './ng-select.types';\nimport * as searchHelper from './search-helper';\nimport { NgSelectComponent } from './ng-select.component';\n-import { isObject } from './utils';\n+import { isObject, isDefined } from './utils';\nexport class ItemsList {\n@@ -180,7 +180,7 @@ export class ItemsList {\nconst label = this.resolveNested(item, this._ngSelect.bindLabel);\nreturn {\nindex: index,\n- label: label || '',\n+ label: isDefined(label) ? label.toString() : '',\nvalue: item,\ndisabled: item.disabled,\n};\n", "new_path": "src/ng-select/items-list.ts", "old_path": "src/ng-select/items-list.ts" }, { "change_type": "MODIFY", "diff": "@@ -24,6 +24,23 @@ import { MockNgZone, MockNgWindow } from '../testing/mocks';\ndescribe('NgSelectComponent', function () {\n+ describe('init', () => {\n+ it('should map items correctly', fakeAsync(() => {\n+ const fixture = createTestingModule(\n+ NgSelectSelectedSimpleCmp,\n+ `<ng-select [searchable]=\"false\"\n+ [clearable]=\"false\"\n+ [items]=\"[0, 30, 60, 90, 120, 180, 240]\"\n+ [(ngModel)]=\"selectedCity\">\n+ </ng-select>`);\n+\n+ fixture.componentInstance.selectedCity = 0;\n+ tickAndDetectChanges(fixture);\n+ expect(fixture.componentInstance.selectedCity).toEqual(0);\n+ expect(fixture.componentInstance.select.itemsList.items[0].label).toEqual('0');\n+ }));\n+ });\n+\ndescribe('Model bindings', () => {\nit('should update ngModel on value change', fakeAsync(() => {\nconst fixture = createTestingModule(\n", "new_path": "src/ng-select/ng-select.component.spec.ts", "old_path": "src/ng-select/ng-select.component.spec.ts" } ]
TypeScript
MIT License
ng-select/ng-select
fix: label formatting (#327) fixes #326
1
fix
null
807,849
08.03.2018 12:41:58
28,800
f4a27ef59139fc72ae9acff462467eb2a2fe162e
test(conventional-commits): pkg.toJSON() is not required with fs.writeJSON()
[ { "change_type": "MODIFY", "diff": "@@ -29,7 +29,9 @@ describe(\"conventional-commits\", () => {\nconst cwd = await initFixture(\"fixed\");\nconst [pkg1] = await collectPackages(cwd);\n- await fs.writeJSON(pkg1.manifestLocation, Object.assign(pkg1.toJSON(), { changed: 1 }));\n+ // make a change in package-1\n+ pkg1.json.changed = 1;\n+ await fs.writeJSON(pkg1.manifestLocation, pkg1);\nawait execa(\"git\", [\"commit\", \"-am\", \"feat: changed\"], { cwd });\nprocess.chdir(cwd);\n@@ -42,9 +44,12 @@ describe(\"conventional-commits\", () => {\nconst [pkg1, pkg2] = await collectPackages(cwd);\nconst opts = { changelogPreset: \"angular\" };\n+ // make a change in package-1 and package-2\n+ pkg1.json.changed = 1;\n+ pkg2.json.changed = 2;\nawait Promise.all([\n- fs.writeJSON(pkg1.manifestLocation, Object.assign(pkg1.toJSON(), { changed: 1 })),\n- fs.writeJSON(pkg2.manifestLocation, Object.assign(pkg2.toJSON(), { changed: 2 })),\n+ fs.writeJSON(pkg1.manifestLocation, pkg1),\n+ fs.writeJSON(pkg2.manifestLocation, pkg2),\n]);\nawait execa(\"git\", [\"add\", pkg1.manifestLocation], { cwd });\n@@ -78,12 +83,12 @@ describe(\"conventional-commits\", () => {\n// make a change in package-1\npkg1.json.changed = 1;\n- await fs.writeJSON(pkg1.manifestLocation, pkg1.toJSON());\n+ await fs.writeJSON(pkg1.manifestLocation, pkg1);\nawait execa(\"git\", [\"commit\", \"-am\", \"feat: I should be placed in the CHANGELOG\"], { cwd });\n// update version\npkg1.version = \"1.1.0\";\n- await fs.writeJSON(pkg1.manifestLocation, pkg1.toJSON());\n+ await fs.writeJSON(pkg1.manifestLocation, pkg1);\nconst changelogLocation = await updateChangelog(pkg1, \"fixed\", {\nchangelogPreset: \"angular\",\n@@ -111,12 +116,12 @@ describe(\"conventional-commits\", () => {\n// make a change in package-1\npkg1.json.changed = 1;\n- await fs.writeJSON(pkg1.manifestLocation, pkg1.toJSON());\n+ await fs.writeJSON(pkg1.manifestLocation, pkg1);\nawait execa(\"git\", [\"commit\", \"-am\", \"fix: A second commit for our CHANGELOG\"], { cwd });\n// update version\npkg1.version = \"1.0.1\";\n- await fs.writeJSON(pkg1.manifestLocation, pkg1.toJSON());\n+ await fs.writeJSON(pkg1.manifestLocation, pkg1);\nawait expect(\nupdateChangelog(pkg1, \"fixed\", /* default preset */ {}).then(getFileContent)\n@@ -138,12 +143,12 @@ describe(\"conventional-commits\", () => {\n// make a change in package-1\npkg1.json.changed = 1;\n- await fs.writeJSON(pkg1.manifestLocation, pkg1.toJSON());\n+ await fs.writeJSON(pkg1.manifestLocation, pkg1);\nawait execa(\"git\", [\"commit\", \"-am\", \"fix(pkg1): A dependency-triggered bump\"], { cwd });\n// update version\npkg2.version = \"1.0.1\";\n- await fs.writeJSON(pkg2.manifestLocation, pkg2.toJSON());\n+ await fs.writeJSON(pkg2.manifestLocation, pkg2);\nawait expect(\nupdateChangelog(pkg2, \"fixed\", { changelogPreset: \"angular\" }).then(getFileContent)\n@@ -164,8 +169,8 @@ describe(\"conventional-commits\", () => {\npkg1.json.changed = 1;\npkg2.json.changed = 2;\nawait Promise.all([\n- fs.writeJSON(pkg1.manifestLocation, pkg1.toJSON()),\n- fs.writeJSON(pkg2.manifestLocation, pkg2.toJSON()),\n+ fs.writeJSON(pkg1.manifestLocation, pkg1),\n+ fs.writeJSON(pkg2.manifestLocation, pkg2),\n]);\nawait execa(\"git\", [\"add\", pkg1.manifestLocation], { cwd });\n@@ -178,8 +183,8 @@ describe(\"conventional-commits\", () => {\npkg1.version = \"1.0.1\";\npkg2.version = \"1.1.0\";\nawait Promise.all([\n- fs.writeJSON(pkg1.manifestLocation, pkg1.toJSON()),\n- fs.writeJSON(pkg2.manifestLocation, pkg2.toJSON()),\n+ fs.writeJSON(pkg1.manifestLocation, pkg1),\n+ fs.writeJSON(pkg2.manifestLocation, pkg2),\n]);\nconst opts = {\n", "new_path": "core/conventional-commits/__tests__/conventional-commits.test.js", "old_path": "core/conventional-commits/__tests__/conventional-commits.test.js" } ]
JavaScript
MIT License
lerna/lerna
test(conventional-commits): pkg.toJSON() is not required with fs.writeJSON()
1
test
conventional-commits
807,849
08.03.2018 12:42:49
28,800
6f2903d5e78760c3062162e6aae821c3ce7dbc47
test(conventional-commits): DRY-up git helpers
[ { "change_type": "MODIFY", "diff": "@@ -16,6 +16,11 @@ expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\ndescribe(\"conventional-commits\", () => {\nconst currentDirectory = process.cwd();\n+ const gitCommitAll = (cwd, message) => execa(\"git\", [\"commit\", \"-am\", message], { cwd });\n+ const gitCommitPkg = (cwd, pkg, message) =>\n+ Promise.resolve()\n+ .then(() => execa(\"git\", [\"add\", pkg.manifestLocation], { cwd }))\n+ .then(() => execa(\"git\", [\"commit\", \"-m\", message], { cwd }));\nafterEach(() => {\n// conventional-recommended-bump is incapable of accepting cwd config :P\n@@ -32,8 +37,9 @@ describe(\"conventional-commits\", () => {\n// make a change in package-1\npkg1.json.changed = 1;\nawait fs.writeJSON(pkg1.manifestLocation, pkg1);\n- await execa(\"git\", [\"commit\", \"-am\", \"feat: changed\"], { cwd });\n+ await gitCommitAll(cwd, \"feat: changed 1\");\n+ // conventional-recommended-bump does not accept cwd config\nprocess.chdir(cwd);\nawait expect(recommendVersion(pkg1, \"fixed\", {})).resolves.toBe(\"1.1.0\");\n@@ -52,12 +58,10 @@ describe(\"conventional-commits\", () => {\nfs.writeJSON(pkg2.manifestLocation, pkg2),\n]);\n- await execa(\"git\", [\"add\", pkg1.manifestLocation], { cwd });\n- await execa(\"git\", [\"commit\", \"-m\", \"fix: changed 1\"], { cwd });\n-\n- await execa(\"git\", [\"add\", pkg2.manifestLocation], { cwd });\n- await execa(\"git\", [\"commit\", \"-m\", \"feat: changed 2\"], { cwd });\n+ await gitCommitPkg(cwd, pkg1, \"fix: changed 1\");\n+ await gitCommitPkg(cwd, pkg2, \"feat: changed 2\");\n+ // conventional-recommended-bump does not accept cwd config\nprocess.chdir(cwd);\nawait expect(recommendVersion(pkg1, \"independent\", opts)).resolves.toBe(\"1.0.1\");\n@@ -84,7 +88,7 @@ describe(\"conventional-commits\", () => {\n// make a change in package-1\npkg1.json.changed = 1;\nawait fs.writeJSON(pkg1.manifestLocation, pkg1);\n- await execa(\"git\", [\"commit\", \"-am\", \"feat: I should be placed in the CHANGELOG\"], { cwd });\n+ await gitCommitAll(cwd, \"feat: I should be placed in the CHANGELOG\");\n// update version\npkg1.version = \"1.1.0\";\n@@ -117,7 +121,7 @@ describe(\"conventional-commits\", () => {\n// make a change in package-1\npkg1.json.changed = 1;\nawait fs.writeJSON(pkg1.manifestLocation, pkg1);\n- await execa(\"git\", [\"commit\", \"-am\", \"fix: A second commit for our CHANGELOG\"], { cwd });\n+ await gitCommitAll(cwd, \"fix: A second commit for our CHANGELOG\");\n// update version\npkg1.version = \"1.0.1\";\n@@ -144,7 +148,7 @@ describe(\"conventional-commits\", () => {\n// make a change in package-1\npkg1.json.changed = 1;\nawait fs.writeJSON(pkg1.manifestLocation, pkg1);\n- await execa(\"git\", [\"commit\", \"-am\", \"fix(pkg1): A dependency-triggered bump\"], { cwd });\n+ await gitCommitAll(cwd, \"fix(pkg1): A dependency-triggered bump\");\n// update version\npkg2.version = \"1.0.1\";\n@@ -173,11 +177,8 @@ describe(\"conventional-commits\", () => {\nfs.writeJSON(pkg2.manifestLocation, pkg2),\n]);\n- await execa(\"git\", [\"add\", pkg1.manifestLocation], { cwd });\n- await execa(\"git\", [\"commit\", \"-m\", \"fix(stuff): changed\"], { cwd });\n-\n- await execa(\"git\", [\"add\", pkg2.manifestLocation], { cwd });\n- await execa(\"git\", [\"commit\", \"-m\", \"feat(thing): added\"], { cwd });\n+ await gitCommitPkg(cwd, pkg1, \"fix(stuff): changed\");\n+ await gitCommitPkg(cwd, pkg2, \"feat(thing): added\");\n// update versions\npkg1.version = \"1.0.1\";\n", "new_path": "core/conventional-commits/__tests__/conventional-commits.test.js", "old_path": "core/conventional-commits/__tests__/conventional-commits.test.js" } ]
JavaScript
MIT License
lerna/lerna
test(conventional-commits): DRY-up git helpers
1
test
conventional-commits
791,834
08.03.2018 13:08:51
28,800
3b8d4b9c43e3cc18df37dbf61421d06a9fd66614
core: make url-shim extend native URL module; add type checking
[ { "change_type": "MODIFY", "diff": "* 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-// @ts-nocheck\n'use strict';\n/**\nconst Util = require('../report/v2/renderer/util.js');\n-// TODO: Add back node require('url').URL parsing when bug is resolved:\n-// https://github.com/GoogleChrome/lighthouse/issues/1186\n-const URL = (typeof self !== 'undefined' && self.URL) || require('whatwg-url').URL;\n+// Type cast so tsc sees window.URL and require('url').URL as sufficiently equivalent.\n+const URL = /** @type {!Window[\"URL\"]} */ (typeof self !== 'undefined' && self.URL) ||\n+ require('url').URL;\n-URL.URLSearchParams = (typeof self !== 'undefined' && self.URLSearchParams) ||\n- require('whatwg-url').URLSearchParams;\n-\n-URL.INVALID_URL_DEBUG_STRING =\n- 'Lighthouse was unable to determine the URL of some script executions. ' +\n- 'It\\'s possible a Chrome extension or other eval\\'d code is the source.';\n+/**\n+ * There is fancy URL rewriting logic for the chrome://settings page that we need to work around.\n+ * Why? Special handling was added by Chrome team to allow a pushState transition between chrome:// pages.\n+ * As a result, the network URL (chrome://chrome/settings/) doesn't match the final document URL (chrome://settings/).\n+ * @param {string} url\n+ * @return {string}\n+ */\n+function rewriteChromeInternalUrl(url) {\n+ if (!url || !url.startsWith('chrome://')) return url;\n+ // Chrome adds a trailing slash to `chrome://` URLs, but the spec does not.\n+ // https://github.com/GoogleChrome/lighthouse/pull/3941#discussion_r154026009\n+ if (url.endsWith('/')) url = url.replace(/\\/$/, '');\n+ return url.replace(/^chrome:\\/\\/chrome\\//, 'chrome://');\n+}\n+class URLShim extends URL {\n/**\n* @param {string} url\n* @return {boolean}\n*/\n-URL.isValid = function isValid(url) {\n+ static isValid(url) {\ntry {\nnew URL(url);\nreturn true;\n} catch (e) {\nreturn false;\n}\n-};\n+ }\n/**\n* @param {string} urlA\n* @param {string} urlB\n* @return {boolean}\n*/\n-URL.hostsMatch = function hostsMatch(urlA, urlB) {\n+ static hostsMatch(urlA, urlB) {\ntry {\nreturn new URL(urlA).host === new URL(urlB).host;\n} catch (e) {\nreturn false;\n}\n-};\n+ }\n/**\n* @param {string} urlA\n* @param {string} urlB\n* @return {boolean}\n*/\n-URL.originsMatch = function originsMatch(urlA, urlB) {\n+ static originsMatch(urlA, urlB) {\ntry {\nreturn new URL(urlA).origin === new URL(urlB).origin;\n} catch (e) {\nreturn false;\n}\n-};\n+ }\n/**\n* @param {string} url\n* @return {?string}\n*/\n-URL.getOrigin = function getOrigin(url) {\n+ static getOrigin(url) {\ntry {\nconst urlInfo = new URL(url);\n// check for both host and origin since some URLs schemes like data and file set origin to the\n@@ -77,40 +85,29 @@ URL.getOrigin = function getOrigin(url) {\n} catch (e) {\nreturn null;\n}\n-};\n+ }\n/**\n* @param {string} url\n* @param {{numPathParts: number, preserveQuery: boolean, preserveHost: boolean}=} options\n* @return {string}\n*/\n-URL.getURLDisplayName = function getURLDisplayName(url, options) {\n+ static getURLDisplayName(url, options) {\nreturn Util.getURLDisplayName(new URL(url), options);\n-};\n+ }\n/**\n* Limits data URIs to 100 characters, returns all other strings untouched.\n* @param {string} url\n* @return {string}\n*/\n-URL.elideDataURI = function elideDataURI(url) {\n+ static elideDataURI(url) {\ntry {\nconst parsed = new URL(url);\nreturn parsed.protocol === 'data:' ? url.slice(0, 100) : url;\n} catch (e) {\nreturn url;\n}\n-};\n-\n-// There is fancy URL rewriting logic for the chrome://settings page that we need to work around.\n-// Why? Special handling was added by Chrome team to allow a pushState transition between chrome:// pages.\n-// As a result, the network URL (chrome://chrome/settings/) doesn't match the final document URL (chrome://settings/).\n-function rewriteChromeInternalUrl(url) {\n- if (!url || !url.startsWith('chrome://')) return url;\n- // Chrome adds a trailing slash to `chrome://` URLs, but the spec does not.\n- // https://github.com/GoogleChrome/lighthouse/pull/3941#discussion_r154026009\n- if (url.endsWith('/')) url = url.replace(/\\/$/, '');\n- return url.replace(/^chrome:\\/\\/chrome\\//, 'chrome://');\n}\n/**\n@@ -119,19 +116,27 @@ function rewriteChromeInternalUrl(url) {\n* @param {string} url2\n* @return {boolean}\n*/\n-URL.equalWithExcludedFragments = function(url1, url2) {\n+ static equalWithExcludedFragments(url1, url2) {\n[url1, url2] = [url1, url2].map(rewriteChromeInternalUrl);\ntry {\n- url1 = new URL(url1);\n- url1.hash = '';\n+ const urla = new URL(url1);\n+ urla.hash = '';\n- url2 = new URL(url2);\n- url2.hash = '';\n+ const urlb = new URL(url2);\n+ urlb.hash = '';\n- return url1.href === url2.href;\n+ return urla.href === urlb.href;\n} catch (e) {\nreturn false;\n}\n-};\n+ }\n+}\n+\n+URLShim.URLSearchParams = (typeof self !== 'undefined' && self.URLSearchParams) ||\n+ require('url').URLSearchParams;\n+\n+URLShim.INVALID_URL_DEBUG_STRING =\n+ 'Lighthouse was unable to determine the URL of some script executions. ' +\n+ 'It\\'s possible a Chrome extension or other eval\\'d code is the source.';\n-module.exports = URL;\n+module.exports = URLShim;\n", "new_path": "lighthouse-core/lib/url-shim.js", "old_path": "lighthouse-core/lib/url-shim.js" }, { "change_type": "MODIFY", "diff": "@@ -121,7 +121,6 @@ gulp.task('browserify-lighthouse', () => {\n// to the modified version internal to Lighthouse.\nbundle.transform('./dtm-transform.js', {global: true})\n.ignore('source-map')\n- .ignore('whatwg-url')\n.ignore('url')\n.ignore('debug/node')\n.ignore('raven')\n", "new_path": "lighthouse-extension/gulpfile.js", "old_path": "lighthouse-extension/gulpfile.js" }, { "change_type": "MODIFY", "diff": "\"semver\": \"^5.3.0\",\n\"speedline\": \"1.3.0\",\n\"update-notifier\": \"^2.1.0\",\n- \"whatwg-url\": \"^6.3.0\",\n\"ws\": \"3.3.2\",\n\"yargs\": \"3.32.0\",\n\"yargs-parser\": \"7.0.0\"\n", "new_path": "package.json", "old_path": "package.json" }, { "change_type": "MODIFY", "diff": "@@ -2705,10 +2705,6 @@ lodash.restparam@^3.0.0:\nversion \"3.6.1\"\nresolved \"https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805\"\n-lodash.sortby@^4.7.0:\n- version \"4.7.0\"\n- resolved \"https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438\"\n-\nlodash.template@^3.0.0:\nversion \"3.6.2\"\nresolved \"https://registry.yarnpkg.com/lodash.template/-/lodash.template-3.6.2.tgz#f8cdecc6169a255be9098ae8b0c53d378931d14f\"\n@@ -3298,10 +3294,6 @@ punycode@^1.4.1:\nversion \"1.4.1\"\nresolved \"https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e\"\n-punycode@^2.1.0:\n- version \"2.1.0\"\n- resolved \"https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d\"\n-\nq@^1.4.1:\nversion \"1.5.1\"\nresolved \"https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7\"\n@@ -4040,12 +4032,6 @@ tough-cookie@^2.3.2, tough-cookie@~2.3.0:\ndependencies:\npunycode \"^1.4.1\"\n-tr46@^1.0.0:\n- version \"1.0.1\"\n- resolved \"https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09\"\n- dependencies:\n- punycode \"^2.1.0\"\n-\ntr46@~0.0.3:\nversion \"0.0.3\"\nresolved \"https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a\"\n@@ -4239,10 +4225,6 @@ webidl-conversions@^4.0.0:\nversion \"4.0.1\"\nresolved \"https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.1.tgz#8015a17ab83e7e1b311638486ace81da6ce206a0\"\n-webidl-conversions@^4.0.1:\n- version \"4.0.2\"\n- resolved \"https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad\"\n-\nwhatwg-encoding@^1.0.1:\nversion \"1.0.1\"\nresolved \"https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.1.tgz#3c6c451a198ee7aec55b1ec61d0920c67801a5f4\"\n@@ -4256,14 +4238,6 @@ whatwg-url@^4.3.0:\ntr46 \"~0.0.3\"\nwebidl-conversions \"^3.0.0\"\n-whatwg-url@^6.3.0:\n- version \"6.3.0\"\n- resolved \"https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.3.0.tgz#597ee5488371abe7922c843397ddec1ae94c048d\"\n- dependencies:\n- lodash.sortby \"^4.7.0\"\n- tr46 \"^1.0.0\"\n- webidl-conversions \"^4.0.1\"\n-\nwhich@^1.1.1, which@^1.2.10, which@^1.2.8, which@^1.2.9:\nversion \"1.2.11\"\nresolved \"https://registry.yarnpkg.com/which/-/which-1.2.11.tgz#c8b2eeea6b8c1659fa7c1dd4fdaabe9533dc5e8b\"\n", "new_path": "yarn.lock", "old_path": "yarn.lock" } ]
JavaScript
Apache License 2.0
googlechrome/lighthouse
core: make url-shim extend native URL module; add type checking (#4712)
1
core
null
679,913
08.03.2018 14:43:28
0
1fd43d7cb3dddda88a925a56cf7b50d06b72e4c2
feat(atom): add default handlers, add/rename event/fx const values, add checks add EV_SET_VALUE & EV_UPDATE_VALUE event handlers add prefixes to built-in event/fx ID values to avoid name clashes w/ user IDs refactor EventBus, add addBuiltIns() display warnings if overriding existing handler/effect
[ { "change_type": "MODIFY", "diff": "@@ -16,11 +16,14 @@ export type EffectDef = SideEffect | [SideEffect, number];\nexport type AsyncEffectDef = [string, any, string, string];\nexport type EffectPriority = [string, number];\n-export const FX_STATE = \"state\";\n-export const FX_DISPATCH = \"dispatch\";\n-export const FX_DISPATCH_ASYNC = \"dispatch-async\";\n-export const FX_DISPATCH_NOW = \"dispatch-now\";\n-export const FX_CANCEL = \"cancel\";\n+export const EV_SET_VALUE = \"--set-value\";\n+export const EV_UPDATE_VALUE = \"--update-value\";\n+\n+export const FX_STATE = \"--state\";\n+export const FX_DISPATCH = \"--dispatch\";\n+export const FX_DISPATCH_ASYNC = \"--dispatch-async\";\n+export const FX_DISPATCH_NOW = \"--dispatch-now\";\n+export const FX_CANCEL = \"--cancel\";\nexport interface ReadonlyAtom<T> extends\napi.IDeref<T>,\n", "new_path": "packages/atom/src/api.ts", "old_path": "packages/atom/src/api.ts" }, { "change_type": "MODIFY", "diff": "@@ -4,6 +4,7 @@ import { isFunction } from \"@thi.ng/checks/is-function\";\nimport { isPromise } from \"@thi.ng/checks/is-promise\";\nimport * as api from \"./api\";\n+import { setIn, updateIn } from \"./path\";\n/**\n* Batched event processor for using composable interceptors for event handling\n@@ -44,6 +45,56 @@ export class EventBus implements\nthis.effects = {};\nthis.eventQueue = [];\nthis.priorities = [];\n+ this.addBuiltIns();\n+ if (handlers) {\n+ this.addHandlers(handlers);\n+ }\n+ if (effects) {\n+ this.addEffects(effects);\n+ }\n+ }\n+\n+ /**\n+ * Add built-in event & side effect handlers:\n+ *\n+ * ### Handlers\n+ *\n+ * #### `EV_SET_VALUE`\n+ *\n+ * Resets state path to provided value. See `setIn()`.\n+ *\n+ * Example event definition:\n+ * ```\n+ * [EV_SET_VALUE, [\"path.to.value\", val]]\n+ * ```\n+ *\n+ * #### `EV_UPDATE_VALUE`\n+ *\n+ * Updates a state path's value with provided function and\n+ * optional extra arguments. See `updateIn()`.\n+ *\n+ * Example event definition:\n+ * ```\n+ * [EV_UPDATE_VALUE, [\"path.to.value\", (x, y) => x + y, 1]]\n+ * ```\n+ *\n+ * ### Side effects\n+ *\n+ * #### FX_DISPATCH\n+ * #### FX_DISPATCH_ASYNC\n+ * #### FX_STATE\n+ *\n+ */\n+ addBuiltIns(): any {\n+ // handlers\n+ this.addHandler(api.EV_SET_VALUE,\n+ (state, [_, [path, val]]) =>\n+ ({ [api.FX_STATE]: setIn(state, path, val) }));\n+ this.addHandler(api.EV_UPDATE_VALUE,\n+ (state, [_, [path, fn, ...args]]) =>\n+ ({ [api.FX_STATE]: updateIn(state, path, fn, ...args) }));\n+\n+ // effects\nthis.addEffect(api.FX_STATE, (x) => this.state.reset(x), -1000);\nthis.addEffect(api.FX_DISPATCH, (e) => this.dispatch(e), -999);\nthis.addEffect(api.FX_DISPATCH_ASYNC,\n@@ -63,12 +114,6 @@ export class EventBus implements\n},\n-999\n);\n- if (handlers) {\n- this.addHandlers(handlers);\n- }\n- if (effects) {\n- this.addEffects(effects);\n- }\n}\naddHandler(id: string, spec: api.EventDef) {\n@@ -76,6 +121,10 @@ export class EventBus implements\n(<any>spec).map((i) => isFunction(i) ? { pre: i } : i) :\nisFunction(spec) ? [{ pre: spec }] : [spec];\nif (iceps.length > 0) {\n+ if (this.handlers[id]) {\n+ this.removeHandler(id);\n+ console.warn(`overriding handler for ID: ${id}`);\n+ }\nthis.handlers[id] = iceps;\n} else {\nthrow new Error(`no handlers in spec for ID: ${id}`);\n@@ -89,6 +138,10 @@ export class EventBus implements\n}\naddEffect(id: string, fx: api.SideEffect, priority = 1) {\n+ if (this.effects[id]) {\n+ this.removeEffect(id);\n+ console.warn(`overriding effect for ID: ${id}`);\n+ }\nthis.effects[id] = fx;\nconst p: api.EffectPriority = [id, priority];\nconst priors = this.priorities;\n@@ -178,7 +231,7 @@ export class EventBus implements\nconst prev = this.state.deref();\nthis.currQueue = [...this.eventQueue];\nthis.eventQueue.length = 0;\n- let fx = { state: prev };\n+ let fx = { [api.FX_STATE]: prev };\nfor (let e of this.currQueue) {\nthis.processEvent(fx, e);\n}\n@@ -225,7 +278,7 @@ export class EventBus implements\nfor (let i = 0; i <= n && !fx[api.FX_CANCEL]; i++) {\nconst icep = iceps[i];\nif (icep.pre) {\n- this.mergeEffects(fx, icep.pre(fx.state, e, fx, this));\n+ this.mergeEffects(fx, icep.pre(fx[api.FX_STATE], e, fx, this));\n}\nhasPost = hasPost || !!icep.post;\n}\n@@ -235,7 +288,7 @@ export class EventBus implements\nfor (let i = n; i >= 0 && !fx[api.FX_CANCEL]; i--) {\nconst icep = iceps[i];\nif (icep.post) {\n- this.mergeEffects(fx, icep.post(fx.state, e, fx, this));\n+ this.mergeEffects(fx, icep.post(fx[api.FX_STATE], e, fx, this));\n}\n}\n}\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(atom): add default handlers, add/rename event/fx const values, add checks - add EV_SET_VALUE & EV_UPDATE_VALUE event handlers - add prefixes to built-in event/fx ID values to avoid name clashes w/ user IDs - refactor EventBus, add addBuiltIns() - display warnings if overriding existing handler/effect
1
feat
atom
807,849
08.03.2018 14:46:47
28,800
6674d18017daa263b8bcf54200817d11ab41ffa1
feat(filter-options): Exclude private packages with --no-private
[ { "change_type": "MODIFY", "diff": "@@ -26,6 +26,12 @@ describe(\"LsCommand\", () => {\nawait lernaLs(testDir)(\"--ignore\", \"package-@(2|3|4|5)\");\nexpect(consoleOutput()).toMatchSnapshot();\n});\n+\n+ it(\"does not list private packages with --no-private\", async () => {\n+ const testDir = await initFixture(\"basic\");\n+ await lernaLs(testDir)(\"--no-private\");\n+ expect(consoleOutput()).not.toMatch(\"package-5 v1.0.0 (private)\");\n+ });\n});\ndescribe(\"in a repo with packages outside of packages/\", () => {\n", "new_path": "commands/list/__tests__/list-command.test.js", "old_path": "commands/list/__tests__/list-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -205,7 +205,7 @@ class Command {\nchain = chain.then(packages => {\nthis.packages = packages;\nthis.packageGraph = new PackageGraph(packages);\n- this.filteredPackages = filterPackages(packages, { scope, ignore });\n+ this.filteredPackages = filterPackages(packages, { scope, ignore }, this.options.private);\n});\n// collectUpdates requires that filteredPackages be present prior to checking for\n", "new_path": "core/command/index.js", "old_path": "core/command/index.js" }, { "change_type": "MODIFY", "diff": "@@ -17,6 +17,11 @@ function filterOptions(yargs) {\ntype: \"string\",\nrequiresArg: true,\n},\n+ private: {\n+ describe: \"Include private packages. Pass --no-private to exclude private packages.\",\n+ type: \"boolean\",\n+ default: true,\n+ },\nsince: {\ndescribe: dedent`\nOnly include packages that have been updated since the specified [ref].\n", "new_path": "core/filter-options/index.js", "old_path": "core/filter-options/index.js" }, { "change_type": "MODIFY", "diff": "@@ -13,12 +13,17 @@ module.exports = filterPackages;\n* @param {Object} filters The scope and ignore filters.\n* @param {String} filters.scope glob The glob to match the package name against\n* @param {String} filters.ignore glob The glob to filter the package name against\n+ * @param {Boolean} showPrivate When false, filter out private packages\n* @return {Array.<Package>} The packages with a name matching the glob\n* @throws when a given glob would produce an empty list of packages\n*/\n-function filterPackages(packagesToFilter, { scope, ignore }) {\n+function filterPackages(packagesToFilter, { scope, ignore }, showPrivate) {\nlet packages = packagesToFilter.slice();\n+ if (showPrivate === false) {\n+ packages = packages.filter(pkg => !pkg.private);\n+ }\n+\nif (scope) {\npackages = packages.filter(pkg => matchPackageName(pkg.name, scope));\n", "new_path": "utils/filter-packages/filter-packages.js", "old_path": "utils/filter-packages/filter-packages.js" } ]
JavaScript
MIT License
lerna/lerna
feat(filter-options): Exclude private packages with --no-private
1
feat
filter-options
791,834
08.03.2018 15:21:56
28,800
ca2df18802ebecd06a2dca95ede422c57331cd85
misc(codeowners): revert brendan's leave This reverts commit
[ { "change_type": "MODIFY", "diff": "# https://help.github.com/articles/about-codeowners/\nlighthouse-cli/ @patrickhulce @paulirish\n-lighthouse-cli/test/fixtures/ @patrickhulce # @brendankenny\n-lighthouse-cli/test/smokehouse/ @patrickhulce # @brendankenny\n+lighthouse-cli/test/fixtures/ @patrickhulce @brendankenny\n+lighthouse-cli/test/smokehouse/ @patrickhulce @brendankenny\nlighthouse-core/gather/ @patrickhulce @paulirish\n-lighthouse-core/audits/ @patrickhulce @paulirish # @brendankenny\n+lighthouse-core/audits/ @patrickhulce @brendankenny @paulirish\nlighthouse-core/report/ @vinamratasingal @paulirish\n-lighthouse-core/config/ @patrickhulce # @brendankenny\n-lighthouse-core/lib/ @paulirish # @brendankenny\n+lighthouse-core/config/ @patrickhulce @brendankenny\n+lighthouse-core/lib/ @brendankenny @paulirish\nlighthouse-extension/ @paulirish @patrickhulce\n-lighthouse-viewer/ @ebidel # @brendankenny\n+lighthouse-viewer/ @ebidel @brendankenny\ndocs/ @vinamratasingal @paulirish\n", "new_path": ".github/CODEOWNERS", "old_path": ".github/CODEOWNERS" } ]
JavaScript
Apache License 2.0
googlechrome/lighthouse
misc(codeowners): revert brendan's leave (#4716) This reverts commit b72dffefab4e691c528713a08088102b15dc2379.
1
misc
codeowners
807,849
08.03.2018 17:20:15
28,800
bbb3310922a6059d36c705e59303ba6eb7707b21
refactor(command): return result of execute() in promise chain
[ { "change_type": "MODIFY", "diff": "@@ -50,10 +50,10 @@ class Command {\nchain = chain.then(() => this.runCommand());\nchain.then(\n- () => {\n+ result => {\nwarnIfHanging();\n- resolve();\n+ resolve(result);\n},\nerr => {\nif (err.pkg) {\n", "new_path": "core/command/index.js", "old_path": "core/command/index.js" }, { "change_type": "MODIFY", "diff": "@@ -34,7 +34,7 @@ function commandRunner(commandModule) {\nconst context = {\ncwd,\nonResolved: result => {\n- // success does not resolve anything, currently\n+ // success resolves the result, if any, returned from execute()\nresolve(Object.assign({}, result, yargsMeta));\n},\nonRejected: result => {\n", "new_path": "helpers/command-runner/index.js", "old_path": "helpers/command-runner/index.js" } ]
JavaScript
MIT License
lerna/lerna
refactor(command): return result of execute() in promise chain
1
refactor
command
807,849
08.03.2018 17:23:33
28,800
96030553265115aad038b7f14b90c17d91043afc
test(diff): real tests, not brittle mocks
[ { "change_type": "MODIFY", "diff": "{\n\"name\": \"package-1\",\n+ \"changed\": 0,\n\"version\": \"1.0.0\"\n}\n", "new_path": "commands/diff/__tests__/__fixtures__/basic/packages/package-1/package.json", "old_path": "commands/diff/__tests__/__fixtures__/basic/packages/package-1/package.json" }, { "change_type": "MODIFY", "diff": "{\n\"name\": \"package-2\",\n+ \"changed\": 0,\n\"version\": \"1.0.0\",\n\"dependencies\": {\n\"package-1\": \"^1.0.0\"\n", "new_path": "commands/diff/__tests__/__fixtures__/basic/packages/package-2/package.json", "old_path": "commands/diff/__tests__/__fixtures__/basic/packages/package-2/package.json" }, { "change_type": "DELETE", "diff": "-{\n- \"name\": \"package-3\",\n- \"version\": \"1.0.0\",\n- \"devDependencies\": {\n- \"package-2\": \"^1.0.0\"\n- }\n-}\n", "new_path": null, "old_path": "commands/diff/__tests__/__fixtures__/basic/packages/package-3/package.json" }, { "change_type": "DELETE", "diff": "-{\n- \"name\": \"package-4\",\n- \"version\": \"1.0.0\",\n- \"dependencies\": {\n- \"package-1\": \"^0.0.0\"\n- }\n-}\n", "new_path": null, "old_path": "commands/diff/__tests__/__fixtures__/basic/packages/package-4/package.json" }, { "change_type": "ADD", "diff": "+// Jest Snapshot v1, https://goo.gl/fbAQLP\n+\n+exports[`DiffCommand should diff a specific package 1`] = `\n+diff --git a/packages/package-2/package.json b/packages/package-2/package.json\n+index SHA..SHA 100644\n+--- a/packages/package-2/package.json\n++++ b/packages/package-2/package.json\n+@@ -1,6 +1,6 @@\n+ {\n+ \"name\": \"package-2\",\n+- \"changed\": 0,\n++ \"changed\": 1,\n+ \"version\": \"1.0.0\",\n+ \"dependencies\": {\n+ \"package-1\": \"^1.0.0\"\n+`;\n+\n+exports[`DiffCommand should diff packages from the first commit 1`] = `\n+diff --git a/packages/package-1/package.json b/packages/package-1/package.json\n+index SHA..SHA 100644\n+--- a/packages/package-1/package.json\n++++ b/packages/package-1/package.json\n+@@ -1,5 +1,5 @@\n+ {\n+ \"name\": \"package-1\",\n+- \"changed\": 0,\n++ \"changed\": 1,\n+ \"version\": \"1.0.0\"\n+ }\n+`;\n+\n+exports[`DiffCommand should diff packages from the most recent tag 1`] = `\n+diff --git a/packages/package-1/package.json b/packages/package-1/package.json\n+index SHA..SHA 100644\n+--- a/packages/package-1/package.json\n++++ b/packages/package-1/package.json\n+@@ -1,5 +1,6 @@\n+ {\n+ \"name\": \"package-1\",\n+ \"changed\": 1,\n+- \"version\": \"1.0.0\"\n++ \"version\": \"1.0.0\",\n++ \"sinceLastTag\": true\n+ }\n+`;\n", "new_path": "commands/diff/__tests__/__snapshots__/diff-command.test.js.snap", "old_path": null }, { "change_type": "MODIFY", "diff": "\"use strict\";\n-jest.mock(\"@lerna/child-process\");\n-jest.mock(\"@lerna/git-utils\");\n-\n+const execa = require(\"execa\");\n+const fs = require(\"fs-extra\");\nconst path = require(\"path\");\n+const collectPackages = require(\"@lerna/collect-packages\");\n// mocked modules\nconst ChildProcessUtilities = require(\"@lerna/child-process\");\n-const GitUtilities = require(\"@lerna/git-utils\");\n// helpers\nconst initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n@@ -15,78 +14,93 @@ const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n// file under test\nconst lernaDiff = require(\"@lerna-test/command-runner\")(require(\"../command\"));\n+// stabilize diff commit SHA and datestamp\n+expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\n+\ndescribe(\"DiffCommand\", () => {\n- ChildProcessUtilities.spawn.mockResolvedValue();\n- GitUtilities.isInitialized.mockReturnValue(true);\n- GitUtilities.hasCommit.mockReturnValue(true);\n+ // overwrite spawn so we get piped stdout, not inherited\n+ ChildProcessUtilities.spawn = jest.fn((...args) => execa(...args));\n+\n+ const writeManifest = pkg => fs.writeJSON(pkg.manifestLocation, pkg, { spaces: 2 });\n+ const gitTag = (cwd, tag) => execa(\"git\", [\"tag\", tag, \"-m\", tag], { cwd });\n+ const gitCommit = (cwd, message) =>\n+ Promise.resolve()\n+ .then(() => execa(\"git\", [\"add\", \".\"], { cwd }))\n+ .then(() => execa(\"git\", [\"commit\", \"-m\", message], { cwd }));\nit(\"should diff packages from the first commit\", async () => {\n- const testDir = await initFixture(\"basic\");\n+ const cwd = await initFixture(\"basic\");\n+ const [pkg1] = await collectPackages(cwd);\n+ const rootReadme = path.join(cwd, \"README.md\");\n- GitUtilities.getFirstCommit.mockReturnValueOnce(\"beefcafe\");\n+ pkg1.json.changed += 1;\n- await lernaDiff(testDir)();\n+ await writeManifest(pkg1);\n+ await fs.outputFile(rootReadme, \"change outside packages glob\");\n+ await gitCommit(cwd, \"changed\");\n- expect(ChildProcessUtilities.spawn).lastCalledWith(\n- \"git\",\n- [\"diff\", \"beefcafe\", \"--color=auto\", \"--\", path.join(testDir, \"packages\")],\n- expect.objectContaining({ cwd: testDir })\n- );\n+ const { stdout } = await lernaDiff(cwd)();\n+ expect(stdout).toMatchSnapshot();\n});\nit(\"should diff packages from the most recent tag\", async () => {\n- const testDir = await initFixture(\"basic\");\n+ const cwd = await initFixture(\"basic\");\n+ const [pkg1] = await collectPackages(cwd);\n+\n+ pkg1.json.changed += 1;\n+\n+ await writeManifest(pkg1);\n+ await gitCommit(cwd, \"changed\");\n+ await gitTag(cwd, \"v1.0.1\");\n- GitUtilities.hasTags.mockReturnValueOnce(true);\n- GitUtilities.getLastTaggedCommit.mockReturnValueOnce(\"cafedead\");\n+ pkg1.json.sinceLastTag = true;\n- await lernaDiff(testDir)();\n+ await writeManifest(pkg1);\n+ await gitCommit(cwd, \"changed\");\n- expect(ChildProcessUtilities.spawn).lastCalledWith(\n- \"git\",\n- [\"diff\", \"cafedead\", \"--color=auto\", \"--\", path.join(testDir, \"packages\")],\n- expect.objectContaining({ cwd: testDir })\n- );\n+ const { stdout } = await lernaDiff(cwd)();\n+ expect(stdout).toMatchSnapshot();\n});\nit(\"should diff a specific package\", async () => {\n- const testDir = await initFixture(\"basic\");\n+ const cwd = await initFixture(\"basic\");\n+ const [pkg1, pkg2] = await collectPackages(cwd);\n- GitUtilities.getFirstCommit.mockReturnValueOnce(\"deadbeef\");\n+ pkg1.json.changed += 1;\n+ pkg2.json.changed += 1;\n- await lernaDiff(testDir)(\"package-1\");\n+ await Promise.all([writeManifest(pkg1), writeManifest(pkg2)]);\n+ await gitCommit(cwd, \"changed\");\n- expect(ChildProcessUtilities.spawn).lastCalledWith(\n- \"git\",\n- [\"diff\", \"deadbeef\", \"--color=auto\", \"--\", path.join(testDir, \"packages/package-1\")],\n- expect.objectContaining({ cwd: testDir })\n- );\n+ const { stdout } = await lernaDiff(cwd)(\"package-2\");\n+ expect(stdout).toMatchSnapshot();\n});\nit(\"should error when attempting to diff a package that doesn't exist\", async () => {\n- const testDir = await initFixture(\"basic\");\n+ const cwd = await initFixture(\"basic\");\ntry {\n- await lernaDiff(testDir)(\"missing\");\n+ await lernaDiff(cwd)(\"missing\");\n} catch (err) {\nexpect(err.message).toBe(\"Cannot diff, the package 'missing' does not exist.\");\n}\n});\nit(\"should error when running in a repository without commits\", async () => {\n- const testDir = await initFixture(\"basic\");\n+ const cwd = await initFixture(\"basic\");\n- GitUtilities.hasCommit.mockReturnValueOnce(false);\n+ await fs.remove(path.join(cwd, \".git\"));\n+ await execa(\"git\", [\"init\"], { cwd });\ntry {\n- await lernaDiff(testDir)(\"package-1\");\n+ await lernaDiff(cwd)(\"package-1\");\n} catch (err) {\nexpect(err.message).toBe(\"Cannot diff, there are no commits in this repository yet.\");\n}\n});\nit(\"should error when git diff exits non-zero\", async () => {\n- const testDir = await initFixture(\"basic\");\n+ const cwd = await initFixture(\"basic\");\nChildProcessUtilities.spawn.mockImplementationOnce(() => {\nconst nonZero = new Error(\"An actual non-zero, not git diff pager SIGPIPE\");\n@@ -96,7 +110,7 @@ describe(\"DiffCommand\", () => {\n});\ntry {\n- await lernaDiff(testDir)(\"package-1\");\n+ await lernaDiff(cwd)(\"package-1\");\n} catch (err) {\nexpect(err.message).toBe(\"An actual non-zero, not git diff pager SIGPIPE\");\n}\n", "new_path": "commands/diff/__tests__/diff-command.test.js", "old_path": "commands/diff/__tests__/diff-command.test.js" } ]
JavaScript
MIT License
lerna/lerna
test(diff): real tests, not brittle mocks
1
test
diff
807,849
08.03.2018 17:24:30
28,800
c27c2e0603aaaf31b42e044065518887733e3e00
feat(diff): filter diff output with --ignore-changes
[ { "change_type": "MODIFY", "diff": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n+exports[`DiffCommand passes diff exclude globs configured with --ignored-changes 1`] = `\n+diff --git a/packages/package-1/package.json b/packages/package-1/package.json\n+index SHA..SHA 100644\n+--- a/packages/package-1/package.json\n++++ b/packages/package-1/package.json\n+@@ -1,5 +1,5 @@\n+ {\n+ \"name\": \"package-1\",\n+- \"changed\": 0,\n++ \"changed\": 1,\n+ \"version\": \"1.0.0\"\n+ }\n+`;\n+\nexports[`DiffCommand should diff a specific package 1`] = `\ndiff --git a/packages/package-2/package.json b/packages/package-2/package.json\nindex SHA..SHA 100644\n", "new_path": "commands/diff/__tests__/__snapshots__/diff-command.test.js.snap", "old_path": "commands/diff/__tests__/__snapshots__/diff-command.test.js.snap" }, { "change_type": "MODIFY", "diff": "@@ -76,6 +76,20 @@ describe(\"DiffCommand\", () => {\nexpect(stdout).toMatchSnapshot();\n});\n+ it(\"passes diff exclude globs configured with --ignored-changes\", async () => {\n+ const cwd = await initFixture(\"basic\");\n+ const [pkg1] = await collectPackages(cwd);\n+\n+ pkg1.json.changed += 1;\n+\n+ await writeManifest(pkg1);\n+ await fs.outputFile(path.join(pkg1.location, \"README.md\"), \"ignored change\");\n+ await gitCommit(cwd, \"changed\");\n+\n+ const { stdout } = await lernaDiff(cwd)(\"--ignore-changes\", \"**/README.md\");\n+ expect(stdout).toMatchSnapshot();\n+ });\n+\nit(\"should error when attempting to diff a package that doesn't exist\", async () => {\nconst cwd = await initFixture(\"basic\");\n", "new_path": "commands/diff/__tests__/diff-command.test.js", "old_path": "commands/diff/__tests__/diff-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -10,9 +10,20 @@ exports.command = \"diff [pkgName]\";\nexports.describe = \"Diff all packages or a single package since the last release.\";\nexports.builder = yargs =>\n- yargs.positional(\"pkgName\", {\n+ yargs\n+ .positional(\"pkgName\", {\ndescribe: \"An optional package name to filter the diff output\",\n- });\n+ })\n+ .options({\n+ \"ignore-changes\": {\n+ group: \"Command Options:\",\n+ describe: \"Ignore changes in files matched by glob(s).\",\n+ type: \"array\",\n+ },\n+ })\n+ .epilogue(\n+ \"When ignoreChanges is configured in lerna.json, pass --no-ignore-changes to include ignored files.\"\n+ );\nexports.handler = function handler(argv) {\nreturn new DiffCommand(argv);\n", "new_path": "commands/diff/command.js", "old_path": "commands/diff/command.js" }, { "change_type": "MODIFY", "diff": "@@ -35,6 +35,13 @@ class DiffCommand extends Command {\nargs.push(\"--\", ...this.repository.packageParentDirs);\n}\n+ if (this.options.ignoreChanges) {\n+ this.options.ignoreChanges.forEach(ignorePattern => {\n+ // https://stackoverflow.com/a/21079437\n+ args.push(`:(exclude,glob)${ignorePattern}`);\n+ });\n+ }\n+\nthis.args = args;\n}\n", "new_path": "commands/diff/index.js", "old_path": "commands/diff/index.js" } ]
JavaScript
MIT License
lerna/lerna
feat(diff): filter diff output with --ignore-changes
1
feat
diff
807,849
08.03.2018 18:10:39
28,800
d21b66ee8ffcceccc56b4145aba3865f898f74de
fix(filter-options): require a git repo when using --since refs
[ { "change_type": "MODIFY", "diff": "@@ -462,11 +462,24 @@ describe(\"BootstrapCommand\", () => {\nit(\"does not require an initialized git repo\", async () => {\nconst testDir = await initFixture(\"zero-pkgs\");\n- fs.remove(path.join(testDir, \".git\"));\n+ await fs.remove(path.join(testDir, \".git\"));\nconst result = await lernaBootstrap(testDir)();\n// cheesy workaround for jest's expectation of assertions\nexpect(result).toBeDefined();\n});\n+\n+ it(\"requires a git repo when using --since\", async () => {\n+ expect.assertions(1);\n+ const testDir = await initFixture(\"zero-pkgs\");\n+\n+ await fs.remove(path.join(testDir, \".git\"));\n+\n+ try {\n+ await lernaBootstrap(testDir)(\"--since\", \"some-branch\");\n+ } catch (err) {\n+ expect(err.message).toMatch(\"this is not a git repository\");\n+ }\n+ });\n});\n", "new_path": "commands/bootstrap/__tests__/bootstrap-command.test.js", "old_path": "commands/bootstrap/__tests__/bootstrap-command.test.js" }, { "change_type": "MODIFY", "diff": "jest.mock(\"@lerna/prompt\");\n+const fs = require(\"fs-extra\");\n+const path = require(\"path\");\n+\n// mocked or stubbed modules\nconst FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst PromptUtilities = require(\"@lerna/prompt\");\n@@ -90,6 +93,20 @@ describe(\"CleanCommand\", () => {\nexpect(err.message).toMatch(\"whoops\");\n}\n});\n+\n+ it(\"requires a git repo when using --since\", async () => {\n+ expect.assertions(1);\n+\n+ const testDir = await initFixture(\"basic\");\n+\n+ await fs.remove(path.join(testDir, \".git\"));\n+\n+ try {\n+ await lernaClean(testDir)(\"--since\", \"some-branch\");\n+ } catch (err) {\n+ expect(err.message).toMatch(\"this is not a git repository\");\n+ }\n+ });\n});\ndescribe(\"--include-filtered-dependencies\", () => {\n", "new_path": "commands/clean/__tests__/clean-command.test.js", "old_path": "commands/clean/__tests__/clean-command.test.js" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n-jest.mock(\"@lerna/child-process\");\n-jest.mock(\"@lerna/collect-updates\");\n-\n+const execa = require(\"execa\");\n+const fs = require(\"fs-extra\");\nconst path = require(\"path\");\n// mocked modules\nconst ChildProcessUtilities = require(\"@lerna/child-process\");\n-const collectUpdates = require(\"@lerna/collect-updates\"); // FIXME: remove coupling to implementation detail\n// helpers\nconst initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n@@ -30,8 +28,8 @@ const execInPackagesStreaming = testDir =>\ndescribe(\"ExecCommand\", () => {\n// TODO: it's very suspicious that mockResolvedValue() doesn't work here\n- ChildProcessUtilities.spawn.mockImplementation(() => Promise.resolve());\n- ChildProcessUtilities.spawnStreaming.mockResolvedValue();\n+ ChildProcessUtilities.spawn = jest.fn(() => Promise.resolve());\n+ ChildProcessUtilities.spawnStreaming = jest.fn(() => Promise.resolve());\ndescribe(\"in a basic repo\", () => {\nit(\"should complain if invoked without command\", async () => {\n@@ -99,29 +97,49 @@ describe(\"ExecCommand\", () => {\nit(\"should filter packages that are not updated with --since\", async () => {\nconst testDir = await initFixture(\"basic\");\n+ const file1 = path.join(testDir, \"packages/package-1\", \"file-1.js\");\n+ const file2 = path.join(testDir, \"packages/package-2\", \"file-2.js\");\n- collectUpdates.mockReturnValueOnce([\n- {\n- pkg: {\n- name: \"package-2\",\n- location: path.join(testDir, \"packages/package-2\"),\n- },\n- },\n- ]);\n+ // make change\n+ await fs.appendFile(file2, \"// package-2\");\n+ await execa(\"git\", [\"add\", file2], { cwd: testDir });\n+ await execa(\"git\", [\"commit\", \"-m\", \"skip change\"], { cwd: testDir });\n+\n+ // tag a release\n+ await execa(\"git\", [\"tag\", \"-m\", \"v1.0.1\", \"v1.0.1\"], { cwd: testDir });\n+\n+ // make another change\n+ await fs.appendFile(file1, \"// package-1\");\n+ await execa(\"git\", [\"add\", file1], { cwd: testDir });\n+ await execa(\"git\", [\"commit\", \"-m\", \"show change\"], { cwd: testDir });\nawait lernaExec(testDir)(\"ls\", \"--since\");\nexpect(ChildProcessUtilities.spawn).toHaveBeenCalledTimes(1);\nexpect(ChildProcessUtilities.spawn).lastCalledWith(\"ls\", [], {\n- cwd: path.join(testDir, \"packages/package-2\"),\n+ cwd: path.join(testDir, \"packages/package-1\"),\nenv: expect.objectContaining({\n- LERNA_PACKAGE_NAME: \"package-2\",\n+ LERNA_PACKAGE_NAME: \"package-1\",\n}),\nreject: true,\nshell: true,\n});\n});\n+ it(\"requires a git repo when using --since\", async () => {\n+ expect.assertions(1);\n+\n+ const testDir = await initFixture(\"basic\");\n+\n+ await fs.remove(path.join(testDir, \".git\"));\n+\n+ try {\n+ await lernaExec(testDir)(\"ls\", \"--since\", \"some-branch\");\n+ } catch (err) {\n+ expect(err.message).toMatch(\"this is not a git repository\");\n+ }\n+ });\n+\nit(\"should run a command\", async () => {\nconst testDir = await initFixture(\"basic\");\n@@ -158,7 +176,6 @@ describe(\"ExecCommand\", () => {\nit(\"executes a command in all packages with --parallel\", async () => {\nconst testDir = await initFixture(\"basic\");\n- ChildProcessUtilities.spawnStreaming = jest.fn(() => Promise.resolve());\nawait lernaExec(testDir)(\"--parallel\", \"ls\");\n@@ -167,7 +184,6 @@ describe(\"ExecCommand\", () => {\nit(\"executes a command in all packages with --stream\", async () => {\nconst testDir = await initFixture(\"basic\");\n- ChildProcessUtilities.spawnStreaming = jest.fn(() => Promise.resolve());\nawait lernaExec(testDir)(\"--stream\", \"ls\");\n", "new_path": "commands/exec/__tests__/exec-command.test.js", "old_path": "commands/exec/__tests__/exec-command.test.js" }, { "change_type": "MODIFY", "diff": "\"use strict\";\njest.mock(\"@lerna/npm-run-script\");\n-jest.mock(\"@lerna/collect-updates\");\n+const execa = require(\"execa\");\n+const fs = require(\"fs-extra\");\nconst path = require(\"path\");\n// mocked modules\nconst npmRunScript = require(\"@lerna/npm-run-script\");\n-const collectUpdates = require(\"@lerna/collect-updates\"); // FIXME: remove coupling to implementation detail\n// helpers\nconst initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n@@ -83,22 +83,41 @@ describe(\"RunCommand\", () => {\nit(\"should filter packages that are not updated with --since\", async () => {\nconst testDir = await initFixture(\"basic\");\n+ const pkgLocation = path.join(testDir, \"packages/package-3\");\n+ const readmeFile = path.join(pkgLocation, \"README.md\");\n- collectUpdates.mockReturnValueOnce([\n- {\n- pkg: {\n- name: \"package-3\",\n- location: path.join(testDir, \"packages/package-3\"),\n- scripts: { \"my-script\": \"echo package-3\" },\n- },\n- },\n- ]);\n+ // change in master\n+ await fs.outputFile(readmeFile, \"# package-3\");\n+ await execa(\"git\", [\"add\", readmeFile], { cwd: testDir });\n+ await execa(\"git\", [\"commit\", \"-m\", \"add readme\"], { cwd: testDir });\n- await lernaRun(testDir)(\"my-script\", \"--since\");\n+ // branch\n+ await execa(\"git\", [\"checkout\", \"-b\", \"feature/yay-docs\"], { cwd: testDir });\n+\n+ // change in feature branch\n+ await fs.appendFile(readmeFile, \"yay docs\");\n+ await execa(\"git\", [\"add\", readmeFile], { cwd: testDir });\n+ await execa(\"git\", [\"commit\", \"-m\", \"yay docs\"], { cwd: testDir });\n+\n+ await lernaRun(testDir)(\"my-script\", \"--since\", \"master\");\nexpect(ranInPackages(testDir)).toMatchSnapshot();\n});\n+ it(\"requires a git repo when using --since\", async () => {\n+ expect.assertions(1);\n+\n+ const testDir = await initFixture(\"basic\");\n+\n+ await fs.remove(path.join(testDir, \".git\"));\n+\n+ try {\n+ await lernaRun(testDir)(\"my-script\", \"--since\", \"some-branch\");\n+ } catch (err) {\n+ expect(err.message).toMatch(\"this is not a git repository\");\n+ }\n+ });\n+\nit(\"does not error when no packages match\", async () => {\nconst testDir = await initFixture(\"basic\");\n", "new_path": "commands/run/__tests__/run-command.test.js", "old_path": "commands/run/__tests__/run-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -156,11 +156,11 @@ class Command {\n}\nrunValidations() {\n- if (this.requiresGit && !GitUtilities.isInitialized(this.execOpts)) {\n- throw new ValidationError(\n- \"ENOGIT\",\n- \"git binary missing, or this is not a git repository. Did you already run `git init` or `lerna init`?\"\n- );\n+ if (\n+ (this.options.since !== undefined || this.requiresGit) &&\n+ !GitUtilities.isInitialized(this.execOpts)\n+ ) {\n+ throw new ValidationError(\"ENOGIT\", \"The git binary was not found, or this is not a git repository.\");\n}\nif (!this.repository.packageJson) {\n@@ -210,7 +210,7 @@ class Command {\n// collectUpdates requires that filteredPackages be present prior to checking for\n// updates. That's okay because it further filters based on what's already been filtered.\n- if (typeof this.options.since === \"string\") {\n+ if (this.options.since !== undefined) {\nchain = chain.then(() => collectUpdates(this));\nchain = chain.then(updates => {\nconst updated = new Set(updates.map(({ pkg }) => pkg.name));\n", "new_path": "core/command/index.js", "old_path": "core/command/index.js" } ]
JavaScript
MIT License
lerna/lerna
fix(filter-options): require a git repo when using --since refs #822
1
fix
filter-options
807,849
08.03.2018 18:25:24
28,800
a504d7e557bddd3f7605daeef3b43e1b23b2d4fe
fix(publish): default root manifest name when missing fixes
[ { "change_type": "ADD", "diff": "+{\n+ \"version\": \"1.0.0\"\n+}\n", "new_path": "commands/publish/__tests__/__fixtures__/lifecycle-no-root-name/lerna.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"version\": \"0.0.0-missing-name\",\n+ \"scripts\": {\n+ \"preversion\": \"echo preversion-root\",\n+ \"version\": \"echo version-root\",\n+ \"postversion\": \"echo postversion-root\"\n+ }\n+}\n", "new_path": "commands/publish/__tests__/__fixtures__/lifecycle-no-root-name/package.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"package-1\",\n+ \"version\": \"1.0.0\",\n+ \"scripts\": {\n+ \"preversion\": \"echo preversion-package-1\",\n+ \"version\": \"echo version-package-1\",\n+ \"postversion\": \"echo postversion-package-1\"\n+ }\n+}\n", "new_path": "commands/publish/__tests__/__fixtures__/lifecycle-no-root-name/packages/package-1/package.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"package-2\",\n+ \"version\": \"1.0.0\",\n+ \"dependencies\": {\n+ \"package-1\": \"^1.0.0\"\n+ }\n+}\n", "new_path": "commands/publish/__tests__/__fixtures__/lifecycle-no-root-name/packages/package-2/package.json", "old_path": null }, { "change_type": "MODIFY", "diff": "@@ -1085,6 +1085,25 @@ describe(\"PublishCommand\", () => {\nconst [errorLog] = loggingOutput(\"error\");\nexpect(errorLog).toMatch(\"error running preversion in lifecycle\");\n});\n+\n+ it(\"adapts to missing root package name\", async () => {\n+ const testDir = await initFixture(\"lifecycle-no-root-name\");\n+\n+ await lernaPublish(testDir)();\n+\n+ expect(runLifecycle).toHaveBeenCalledTimes(6);\n+\n+ [\"preversion\", \"version\", \"postversion\"].forEach(script => {\n+ expect(runLifecycle).toHaveBeenCalledWith(\n+ expect.objectContaining({\n+ // defaulted from dirname, like npm init\n+ name: path.basename(testDir),\n+ }),\n+ script,\n+ expect.any(Object) // conf\n+ );\n+ });\n+ });\n});\nit(\"publishes all transitive dependents after change\", async () => {\n", "new_path": "commands/publish/__tests__/publish-command.test.js", "old_path": "commands/publish/__tests__/publish-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -74,6 +74,11 @@ class Project {\nif (!this._packageJson) {\ntry {\nthis._packageJson = loadJsonFile.sync(this.packageJsonLocation);\n+\n+ if (!this._packageJson.name) {\n+ // npm-lifecycle chokes if this is missing, so default like npm init does\n+ this._packageJson.name = path.basename(path.dirname(this.packageJsonLocation));\n+ }\n} catch (err) {\n// don't swallow syntax errors\nif (err.name === \"JSONError\") {\n", "new_path": "core/project/index.js", "old_path": "core/project/index.js" } ]
JavaScript
MIT License
lerna/lerna
fix(publish): default root manifest name when missing fixes #1305
1
fix
publish
807,849
08.03.2018 18:39:02
28,800
04b256a813fc2645254c6b5795302bcff300d2b3
fix(publish): Respect pkg.publishConfig.tag fixes
[ { "change_type": "MODIFY", "diff": "@@ -186,19 +186,19 @@ exports[`PublishCommand independent mode should publish the changed packages in\nArray [\nObject {\n\"dir\": \"packages/package-1\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-3\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-4\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-2\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\n]\n`;\n@@ -312,19 +312,19 @@ exports[`PublishCommand normal mode should publish the changed packages: npm pub\nArray [\nObject {\n\"dir\": \"packages/package-1\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-3\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-4\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-2\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\n]\n`;\n@@ -394,7 +394,7 @@ exports[`PublishCommand normal mode with --ignore-changes does not publish packa\nArray [\nObject {\n\"dir\": \"packages/package-4\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\n]\n`;\n@@ -410,7 +410,7 @@ exports[`PublishCommand normal mode with --ignore-changes maps deprecated --igno\nArray [\nObject {\n\"dir\": \"packages/package-4\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\n]\n`;\n@@ -440,19 +440,19 @@ exports[`PublishCommand normal mode with --registry passes registry to npm comma\nArray [\nObject {\n\"dir\": \"packages/package-1\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-3\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-4\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-2\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\n]\n`;\n@@ -471,19 +471,19 @@ exports[`PublishCommand normal mode with --skip-git should publish the changed p\nArray [\nObject {\n\"dir\": \"packages/package-1\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-3\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-4\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\nObject {\n\"dir\": \"packages/package-2\",\n- \"tag\": \"latest\",\n+ \"tag\": undefined,\n},\n]\n`;\n", "new_path": "commands/publish/__tests__/__snapshots__/publish-command.test.js.snap", "old_path": "commands/publish/__tests__/__snapshots__/publish-command.test.js.snap" }, { "change_type": "MODIFY", "diff": "@@ -35,9 +35,8 @@ const lernaPublish = require(\"@lerna-test/command-runner\")(require(\"../command\")\n// assertion helpers\nconst publishedTagInDirectories = testDir =>\n- npmPublish.mock.calls.reduce((arr, args) => {\n- const tag = args[0];\n- const dir = normalizeRelativeDir(testDir, args[1].location);\n+ npmPublish.mock.calls.reduce((arr, [pkg, tag]) => {\n+ const dir = normalizeRelativeDir(testDir, pkg.location);\narr.push({ dir, tag });\nreturn arr;\n}, []);\n", "new_path": "commands/publish/__tests__/publish-command.test.js", "old_path": "commands/publish/__tests__/publish-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -554,7 +554,7 @@ class PublishCommand extends Command {\nconst mapPackage = pkg => {\ntracker.verbose(\"publishing\", pkg.name);\n- return npmPublish(distTag, pkg, this.npmConfig).then(() => {\n+ return npmPublish(pkg, distTag, this.npmConfig).then(() => {\ntracker.info(\"published\", pkg.name);\ntracker.completeWork(1);\n@@ -594,14 +594,22 @@ class PublishCommand extends Command {\n}\nupdateTag(pkg) {\n- const distTag = this.getDistTag();\n+ const distTag = this.getDistTag() || \"latest\";\nconst version = this.options.canary ? pkg.version : this.updatesVersions.get(pkg.name);\nreturn this.removeTempTag(pkg).then(() => npmDistTag.add(pkg, version, distTag, this.npmConfig.registry));\n}\ngetDistTag() {\n- return this.options.npmTag || (this.options.canary && \"canary\") || \"latest\";\n+ if (this.options.npmTag) {\n+ return this.options.npmTag;\n+ }\n+\n+ if (this.options.canary) {\n+ return \"canary\";\n+ }\n+\n+ // undefined defaults to \"latest\" OR whatever is in pkg.publishConfig.tag\n}\n}\n", "new_path": "commands/publish/index.js", "old_path": "commands/publish/index.js" }, { "change_type": "MODIFY", "diff": "@@ -18,7 +18,7 @@ describe(\"npm-publish\", () => {\n};\nit(\"runs npm publish in a directory with --tag support\", async () => {\n- await npmPublish(\"published-tag\", pkg, { npmClient: \"npm\" });\n+ await npmPublish(pkg, \"published-tag\", { npmClient: \"npm\" });\nexpect(ChildProcessUtilities.exec).lastCalledWith(\"npm\", [\"publish\", \"--tag\", \"published-tag\"], {\ncwd: pkg.location,\n@@ -26,7 +26,7 @@ describe(\"npm-publish\", () => {\n});\nit(\"trims trailing whitespace in tag parameter\", async () => {\n- await npmPublish(\"trailing-tag \", pkg, { npmClient: \"npm\" });\n+ await npmPublish(pkg, \"trailing-tag \", { npmClient: \"npm\" });\nexpect(ChildProcessUtilities.exec).lastCalledWith(\"npm\", [\"publish\", \"--tag\", \"trailing-tag\"], {\ncwd: pkg.location,\n@@ -36,7 +36,7 @@ describe(\"npm-publish\", () => {\nit(\"supports custom registry\", async () => {\nconst registry = \"https://custom-registry/npmPublish\";\n- await npmPublish(\"custom-registry\", pkg, { npmClient: \"npm\", registry });\n+ await npmPublish(pkg, \"custom-registry\", { npmClient: \"npm\", registry });\nexpect(ChildProcessUtilities.exec).lastCalledWith(\"npm\", [\"publish\", \"--tag\", \"custom-registry\"], {\ncwd: pkg.location,\n@@ -49,7 +49,7 @@ describe(\"npm-publish\", () => {\ndescribe(\"with npmClient yarn\", () => {\nit(\"appends --new-version to avoid interactive prompt\", async () => {\n- await npmPublish(\"yarn-publish\", pkg, { npmClient: \"yarn\" });\n+ await npmPublish(pkg, \"yarn-publish\", { npmClient: \"yarn\" });\nexpect(ChildProcessUtilities.exec).lastCalledWith(\n\"yarn\",\n", "new_path": "utils/npm-publish/__tests__/npm-publish.test.js", "old_path": "utils/npm-publish/__tests__/npm-publish.test.js" }, { "change_type": "MODIFY", "diff": "@@ -7,11 +7,16 @@ const getExecOpts = require(\"@lerna/get-npm-exec-opts\");\nmodule.exports = npmPublish;\n-function npmPublish(tag, pkg, { npmClient, registry }) {\n+function npmPublish(pkg, tag, { npmClient, registry }) {\nlog.silly(\"npmPublish\", tag, pkg.name);\n+ const distTag = tag.trim();\nconst opts = getExecOpts(pkg, registry);\n- const args = [\"publish\", \"--tag\", tag.trim()];\n+ const args = [\"publish\"];\n+\n+ if (distTag) {\n+ args.push(\"--tag\", distTag);\n+ }\nif (npmClient === \"yarn\") {\n// skip prompt for new version, use existing instead\n", "new_path": "utils/npm-publish/npm-publish.js", "old_path": "utils/npm-publish/npm-publish.js" } ]
JavaScript
MIT License
lerna/lerna
fix(publish): Respect pkg.publishConfig.tag fixes #1311
1
fix
publish
807,849
08.03.2018 18:40:33
28,800
ce8f9310dca1c7a0179f9ee9b4cc0b6a51ef06e1
chore: dog-food respect of publishConfig.tag
[ { "change_type": "MODIFY", "diff": "\"files\": [\n\"cli.js\"\n],\n+ \"publishConfig\": {\n+ \"tag\": \"next\"\n+ },\n\"engines\": {\n\"node\": \">= 6.9.0\"\n},\n", "new_path": "core/lerna/package.json", "old_path": "core/lerna/package.json" }, { "change_type": "MODIFY", "diff": "\"allowBranch\": \"master\",\n\"cdVersion\": \"prerelease\",\n\"preid\": \"beta\",\n- \"message\": \"chore(release): publish %s\",\n- \"npmTag\": \"next\"\n+ \"message\": \"chore(release): publish %s\"\n}\n},\n\"ignoreChanges\": [\n", "new_path": "lerna.json", "old_path": "lerna.json" } ]
JavaScript
MIT License
lerna/lerna
chore: dog-food respect of publishConfig.tag
1
chore
null
815,746
08.03.2018 18:40:52
-7,200
1898ca44d6468bdc8bdea6f54e5d5eb1e202690f
fix: update change event to fire object
[ { "change_type": "MODIFY", "diff": "@@ -1651,18 +1651,23 @@ describe('NgSelectComponent', function () {\nconst fixture = createTestingModule(\nNgSelectEventsTestCmp,\n`<ng-select [items]=\"cities\"\n- (change)=\"onChange()\"\n- [(ngModel)]=\"selectedCity\">\n+ bindValue=\"id\"\n+ bindLabel=\"name\"\n+ (change)=\"onChange($event)\"\n+ [(ngModel)]=\"selectedCityId\">\n</ng-select>`);\nspyOn(fixture.componentInstance, 'onChange');\n- fixture.componentInstance.selectedCity = fixture.componentInstance.cities[0];\n+ fixture.componentInstance.selectedCityId = fixture.componentInstance.cities[1].id;\ntickAndDetectChanges(fixture);\n- fixture.componentInstance.select.select(fixture.componentInstance.cities[1]);\n+ const select = fixture.componentInstance.select;\n+ select.select(select.itemsList.items[0]);\n+ tickAndDetectChanges(fixture);\n- expect(fixture.componentInstance.onChange).toHaveBeenCalledTimes(1);\n+ expect(fixture.componentInstance.onChange).toHaveBeenCalledWith(select.selectedItems[0].value);\n+ expect(fixture.componentInstance.selectedCityId).toBe(0);\n}));\nit('do not fire change when item not changed', fakeAsync(() => {\n@@ -2193,8 +2198,10 @@ class NgSelectFilterTestCmp {\nclass NgSelectEventsTestCmp {\n@ViewChild(NgSelectComponent) select: NgSelectComponent;\nselectedCity: { id: number; name: string };\n+ selectedCityId: number\nselectedCities: Array<{ id: number; name: string }>;\ncities = [\n+ { id: 0, name: 'All' },\n{ id: 1, name: 'Vilnius' },\n{ id: 2, name: 'Kaunas' },\n{ id: 3, name: 'Pabrade' },\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": "@@ -535,7 +535,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\nprivate _updateNgModel() {\n- const values = [];\n+ const model = [];\nfor (const item of this.selectedItems) {\nif (this.bindValue) {\nlet resolvedValue = null;\n@@ -544,20 +544,20 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n} else {\nresolvedValue = this.itemsList.resolveNested(item.value, this.bindValue);\n}\n- values.push(resolvedValue);\n+ model.push(resolvedValue);\n} else {\n- values.push(item.value);\n+ model.push(item.value);\n}\n}\n- let ngModel = null;\nif (this.multiple) {\n- ngModel = values;\n- } else if (isDefined(values[0])) {\n- ngModel = values[0];\n+ this._onChange(model);\n+ this.changeEvent.emit(this.selectedItems.map(x => x.value));\n+ } else {\n+ this._onChange(isDefined(model[0]) ? model[0] : null);\n+ this.changeEvent.emit(this.selectedItems[0] && this.selectedItems[0].value);\n}\n- this._onChange(ngModel);\n- this.changeEvent.emit(ngModel);\n+\nthis._cd.markForCheck();\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: update change event to fire object (#328)
1
fix
null
815,746
08.03.2018 18:41:15
-7,200
1fa84f479cf9b784fb782c61166bc7a4b349a000
chore(release): 0.26.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.26.1\"></a>\n+## [0.26.1](https://github.com/ng-select/ng-select/compare/v0.26.0...v0.26.1) (2018-03-08)\n+\n+\n+### Bug Fixes\n+\n+* label formatting ([#327](https://github.com/ng-select/ng-select/issues/327)) ([6584eb1](https://github.com/ng-select/ng-select/commit/6584eb1)), closes [#326](https://github.com/ng-select/ng-select/issues/326)\n+* update change event to fire object ([#328](https://github.com/ng-select/ng-select/issues/328)) ([1898ca4](https://github.com/ng-select/ng-select/commit/1898ca4))\n+\n+\n+\n<a name=\"0.26.0\"></a>\n# [0.26.0](https://github.com/ng-select/ng-select/compare/v0.25.0...v0.26.0) (2018-03-07)\n", "new_path": "CHANGELOG.md", "old_path": "CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "{\n\"$schema\": \"../node_modules/ng-packagr/package.schema.json\",\n\"name\": \"@ng-select/ng-select\",\n- \"version\": \"0.26.0\",\n+ \"version\": \"0.26.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.26.1
1
chore
release
807,849
08.03.2018 18:45:46
28,800
d8ce2531a9013a1ceb72c25d3666afaf93a27e75
fix(publish): guard against undefined tag refs
[ { "change_type": "MODIFY", "diff": "@@ -25,6 +25,14 @@ describe(\"npm-publish\", () => {\n});\n});\n+ it(\"does not pass --tag when none present (npm default)\", async () => {\n+ await npmPublish(pkg, undefined, { npmClient: \"npm\" });\n+\n+ expect(ChildProcessUtilities.exec).lastCalledWith(\"npm\", [\"publish\"], {\n+ cwd: pkg.location,\n+ });\n+ });\n+\nit(\"trims trailing whitespace in tag parameter\", async () => {\nawait npmPublish(pkg, \"trailing-tag \", { npmClient: \"npm\" });\n", "new_path": "utils/npm-publish/__tests__/npm-publish.test.js", "old_path": "utils/npm-publish/__tests__/npm-publish.test.js" }, { "change_type": "MODIFY", "diff": "@@ -10,7 +10,7 @@ module.exports = npmPublish;\nfunction npmPublish(pkg, tag, { npmClient, registry }) {\nlog.silly(\"npmPublish\", tag, pkg.name);\n- const distTag = tag.trim();\n+ const distTag = tag && tag.trim();\nconst opts = getExecOpts(pkg, registry);\nconst args = [\"publish\"];\n", "new_path": "utils/npm-publish/npm-publish.js", "old_path": "utils/npm-publish/npm-publish.js" } ]
JavaScript
MIT License
lerna/lerna
fix(publish): guard against undefined tag refs #1311
1
fix
publish
807,849
08.03.2018 18:55:49
28,800
3c3492b9e378b613feaf6b22ff22c5abe62973e4
chore: remove spurious 'closes' in changelog [skip ci]
[ { "change_type": "MODIFY", "diff": "@@ -16,8 +16,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n* **publish:** default root manifest name when missing ([a504d7e](https://github.com/lerna/lerna/commit/a504d7e)), closes [#1305](https://github.com/lerna/lerna/issues/1305)\n* **publish:** guard against undefined tag ([d8ce253](https://github.com/lerna/lerna/commit/d8ce253)), closes [#1311](https://github.com/lerna/lerna/issues/1311)\n* **publish:** Respect pkg.publishConfig.tag ([04b256a](https://github.com/lerna/lerna/commit/04b256a)), closes [#1311](https://github.com/lerna/lerna/issues/1311)\n-* **publish:** work around yarn \"link:\" intransigency ([ddfb517](https://github.com/lerna/lerna/commit/ddfb517)), closes [npm/npm#15900](https://github.com/npm/npm/issues/15900) [yarnpkg/yarn#4212](https://github.com/yarnpkg/yarn/issues/4212)\n-\n+* **publish:** work around yarn \"link:\" intransigency ([ddfb517](https://github.com/lerna/lerna/commit/ddfb517))\n### Features\n", "new_path": "CHANGELOG.md", "old_path": "CHANGELOG.md" } ]
JavaScript
MIT License
lerna/lerna
chore: remove spurious 'closes' in changelog [skip ci]
1
chore
null
679,913
08.03.2018 21:52:21
0
443875c853cb93a3b363228fb62ff92e87e99b11
refactor(atom): update InterceptorFn handling remove InterceptorContext arg from InterceptorFn add EventBus.context() to obtain current InterceptorContext (rarely needed) update docs
[ { "change_type": "MODIFY", "diff": "@@ -7,7 +7,7 @@ export type SwapFn<T> = (curr: T, ...args: any[]) => T;\nexport type ViewTransform<T> = (x: any) => T;\n-export type InterceptorFn = (state: any, e: Event, fx?: InterceptorContext, bus?: IDispatch) => InterceptorContext | void;\n+export type InterceptorFn = (state: any, e: Event, bus?: IDispatch) => InterceptorContext | void;\nexport type InterceptorPredicate = (state: any, e: Event, fx?: any) => boolean;\nexport type SideEffect = (x: any, bus?: IDispatch) => any;\n", "new_path": "packages/atom/src/api.ts", "old_path": "packages/atom/src/api.ts" }, { "change_type": "MODIFY", "diff": "@@ -34,6 +34,7 @@ export class EventBus implements\nprotected eventQueue: api.Event[];\nprotected currQueue: api.Event[];\n+ protected currCtx: api.InterceptorContext;\nprotected handlers: IObjectOf<api.Interceptor[]>;\nprotected effects: IObjectOf<api.SideEffect>;\n@@ -45,6 +46,7 @@ export class EventBus implements\nthis.effects = {};\nthis.eventQueue = [];\nthis.priorities = [];\n+ this.currQueue = this.currCtx = null;\nthis.addBuiltIns();\nif (handlers) {\nthis.addHandlers(handlers);\n@@ -192,6 +194,10 @@ export class EventBus implements\n}\n}\n+ context() {\n+ return this.currCtx;\n+ }\n+\n/**\n* Adds given event to event queue to be processed\n* by `processQueue()` later on.\n@@ -231,11 +237,11 @@ export class EventBus implements\nconst prev = this.state.deref();\nthis.currQueue = [...this.eventQueue];\nthis.eventQueue.length = 0;\n- let fx = { [api.FX_STATE]: prev };\n+ let fx = this.currCtx = { [api.FX_STATE]: prev };\nfor (let e of this.currQueue) {\nthis.processEvent(fx, e);\n}\n- this.currQueue = null;\n+ this.currQueue = this.currCtx = null;\nthis.processEffects(fx);\nreturn this.state.deref() !== prev;\n}\n@@ -243,13 +249,13 @@ export class EventBus implements\n}\n/**\n- * Processes a single event using the configured handler/interceptor chain.\n- * Logs warning message and skips processing if no handler\n- * is available for the event.\n+ * Processes a single event using its configured handler/interceptor\n+ * chain. Logs warning message and skips processing if no handler\n+ * is available for the event type.\n*\n- * This function processes the array of interceptors in bi-directional\n- * order. First any `pre` interceptors are processed in\n- * forward order. Then `post` interceptors are processed in reverse.\n+ * The array of interceptors is processed in bi-directional order.\n+ * First any `pre` interceptors are processed in forward order.\n+ * Then `post` interceptors are processed in reverse.\n*\n* Each interceptor can return a result object of side effects,\n* which are being merged and collected for `processEffects()`.\n@@ -259,10 +265,10 @@ export class EventBus implements\n* multiple invocations of the same effect type per frame. If no\n* side effects are requested, an interceptor can return `undefined`.\n*\n- * Processing of the current event stops immediatedly, if an\n- * interceptor includes the `FX_CANCEL` side effect. However, the\n- * results interceptors (incl. the one which cancelled) are kept and\n- * processed further as usual.\n+ * Processing of the current event stops immediatedly, if an interceptor\n+ * sets the `FX_CANCEL` side effect key to `true`. However, the results\n+ * of any previous interceptors (incl. the one which cancelled) are kept\n+ * and processed further as usual.\n*\n* @param fx\n* @param e\n@@ -278,7 +284,7 @@ export class EventBus implements\nfor (let i = 0; i <= n && !fx[api.FX_CANCEL]; i++) {\nconst icep = iceps[i];\nif (icep.pre) {\n- this.mergeEffects(fx, icep.pre(fx[api.FX_STATE], e, fx, this));\n+ this.mergeEffects(fx, icep.pre(fx[api.FX_STATE], e, this));\n}\nhasPost = hasPost || !!icep.post;\n}\n@@ -288,7 +294,7 @@ export class EventBus implements\nfor (let i = n; i >= 0 && !fx[api.FX_CANCEL]; i--) {\nconst icep = iceps[i];\nif (icep.post) {\n- this.mergeEffects(fx, icep.post(fx[api.FX_STATE], e, fx, this));\n+ this.mergeEffects(fx, icep.post(fx[api.FX_STATE], e, this));\n}\n}\n}\n@@ -322,14 +328,17 @@ export class EventBus implements\n* Merges the new side effects returned from an interceptor\n* into the internal effect accumulator.\n*\n- * Special handling applies for the `FX_STATE`, `FX_CANCEL`\n- * and `FX_DISPATCH_NOW` effects.\n+ * Any events assigned to the `FX_DISPATCH_NOW` effect key are\n+ * immediately added to the currently active event batch.\n*\n* If an interceptor wishes to cause multiple invocations of\n* a single side effect type (e.g. dispatch multiple other events),\n- * it MUST return an array of these values. The only exception\n- * to this is the FX_STATE effect, which for obvious reasons\n- * can only accept a single value.\n+ * it MUST return an array of these values. The only exceptions\n+ * to this are the following effects, which for obvious reasons\n+ * can only accept a single value:\n+ *\n+ * - `FX_CANCEL`\n+ * - `FX_STATE`\n*\n* Note that because of this support (of multiple values),\n* the value of a single side effect SHOULD NOT be a nested array\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(atom): update InterceptorFn handling - remove InterceptorContext arg from InterceptorFn - add EventBus.context() to obtain current InterceptorContext (rarely needed) - update docs
1
refactor
atom
679,913
08.03.2018 21:53:12
0
359c4f5ab1f38a0acabb9877da27185e6744d065
feat(atom): add valueSetter/Updater() interceptors
[ { "change_type": "MODIFY", "diff": "-import { Event, InterceptorFn, InterceptorPredicate, FX_CANCEL, Path } from \"./api\";\n-import { getIn } from \"./path\";\n+import { FX_CANCEL, FX_STATE, Event, InterceptorFn, InterceptorPredicate, Path } from \"./api\";\n+import { getIn, setIn, updateIn } from \"./path\";\n/**\n* Debug interceptor to log the current event to the console.\n@@ -18,12 +18,27 @@ export function trace(_, e) {\n* the error interceptor's result, which is merged into the result of\n* this interceptor.\n*\n+ * The error interceptor can return any number of other side effects and\n+ * so be used to dispatch alternative events instead, for example:\n+ *\n+ * ```\n+ * // this interceptor will cause cancellation of current event\n+ * // and trigger an \"error\" event instead\n+ * ensurePred(\n+ * // a dummy predicate which always fails\n+ * () => false\n+ * // error interceptor fn\n+ * () => ({[FX_DISPATCH_NOW]: [\"error\", \"reason\"]})\n+ * )\n+ * ```\n+ *\n* Note: For this interceptor to work as expected, it needs to be provided\n* BEFORE the main handler in the interceptor list for a given event, i.e.\n*\n* ```\n* [\n* ensurePred((state, e) => false),\n+ * // actual event handler\n* (state, e) => console.log(\"no one never calls me\")\n* ]\n* ```\n@@ -40,9 +55,10 @@ export function ensurePred(pred: InterceptorPredicate, err?: InterceptorFn): Int\n}\n/**\n- * Specialization of `ensurePred()` to ensure a state value is less than given max.\n- * The optional `path` fn is used to extract or produce the path for the state\n- * value to be validated. If omitted, the event's payload item is interpreted as\n+ * Specialization of `ensurePred()` to ensure a state value is less than\n+ * given max at the time when the event is being processed. The optional\n+ * `path` fnis used to extract or produce the path for the state value to\n+ * be validated. If omitted, the event's payload item is interpreted as\n* the value path.\n*\n* For example, without a provided `path` function and for an event\n@@ -59,11 +75,38 @@ export function ensureLessThan(max: number, path?: (e: Event) => Path, err?: Int\n}\n/**\n- * Specialization of `ensurePred()` to ensure a state value is greater than given min.\n- * See `ensureLessThan()` for further details.\n+ * Specialization of `ensurePred()` to ensure a state value is greater than\n+ * given min. See `ensureLessThan()` for further details.\n*\n* @param path path extractor\n*/\nexport function ensureGreaterThan(min: number, path?: (e: Event) => Path, err?: InterceptorFn) {\nreturn ensurePred((state, e) => getIn(state, path ? path(e) : e[1]) > min, err);\n}\n+\n+/**\n+ * Higher-order interceptor. Returns new interceptor to set state value at\n+ * provided path. This allows for dedicated events to set state values more\n+ * concisely, e.g. given this event definition:\n+ *\n+ * ```\n+ * setFoo: valueSetter(\"foo.bar\")\n+ * ```\n+ *\n+ * ...the `setFoo` event then can be triggered like so to update the state\n+ * value at `foo.bar`:\n+ *\n+ * ```\n+ * bus.dispatch([\"foo\", 23])\n+ * ```\n+ *\n+ * @param path\n+ * @param tx\n+ */\n+export function valueSetter<T>(path: Path, tx?: (x: T) => T): InterceptorFn {\n+ return (state, [_, val]) => ({ [FX_STATE]: setIn(state, path, tx ? tx(val) : val) });\n+}\n+\n+export function valueUpdater<T>(path: Path, fn: (x: T, ...args: any[]) => T): InterceptorFn {\n+ return (state, [_, ...args]) => ({ [FX_STATE]: updateIn(state, path, fn, ...args) });\n+}\n", "new_path": "packages/atom/src/interceptors.ts", "old_path": "packages/atom/src/interceptors.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(atom): add valueSetter/Updater() interceptors
1
feat
atom
679,913
08.03.2018 21:53:34
0
fb9b19c4f8d73eb4353781dbf40c42abc57b0d55
docs(atom): minor update View docs
[ { "change_type": "MODIFY", "diff": "@@ -5,7 +5,7 @@ import { getter, toPath } from \"./path\";\nexport class View<T> implements\nIView<T> {\n- static NEXT_ID = 0;\n+ protected static NEXT_ID = 0;\nreadonly id: string;\n@@ -55,9 +55,9 @@ export class View<T> implements\n* value change, returns result of this sub's transformer or else\n* the cached value.\n*\n- * **Important:** Use this function only if the view's transformer\n- * is stateless or else might cause undefined/inconsistent\n- * behavior when calling deref() subsequently.\n+ * **Important:** Use this function only if the view has none or\n+ * or a stateless transformer. Else might cause undefined/inconsistent\n+ * behavior when calling `view()` or `deref()` subsequently.\n*/\nview() {\nreturn this.isDirty ? this.tx(this.unprocessed) : this.state;\n", "new_path": "packages/atom/src/view.ts", "old_path": "packages/atom/src/view.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
docs(atom): minor update View docs
1
docs
atom
679,913
08.03.2018 21:54:07
0
4d7613d8c37e1356f5ec6ab11402d956cbb200dc
refactor(examples): update interceptor-basics
[ { "change_type": "MODIFY", "diff": "import { IObjectOf } from \"@thi.ng/api/api\";\n-import { EffectDef, EventDef, FX_DISPATCH_NOW, FX_STATE, IDispatch, Path } from \"@thi.ng/atom/api\";\n+import { EffectDef, EventDef, IDispatch, Path } from \"@thi.ng/atom/api\";\n+import { EV_SET_VALUE, EV_UPDATE_VALUE, FX_DISPATCH_NOW } from \"@thi.ng/atom/api\";\nimport { Atom } from \"@thi.ng/atom/atom\";\nimport { EventBus } from \"@thi.ng/atom/event-bus\";\nimport { ensureLessThan, ensureGreaterThan, trace } from \"@thi.ng/atom/interceptors\";\n-import { updateIn, setIn } from \"@thi.ng/atom/path\";\nimport { start } from \"@thi.ng/hdom/start\";\n-\n///////////////////////////////////////////////////////////////////////\n-// event handler definitions\n+// event name and handler definitions\n-const events: IObjectOf<EventDef> = {\n- // generic handler to set state value at given path\n- init: (state, [_, [path, val]]) => ({ [FX_STATE]: setIn(state, path, val) }),\n+// best practice tip:\n+// define event & effect names as consts or enums and\n+// avoid hardcoded strings for easier refactoring\n+// additionally/alternatively define dispatch functions\n+const EV_INC = \"inc-counter\";\n+const EV_DEC = \"dec-counter\";\n+const EV_ADD_COUNTER = \"add-counter\";\n+const EV_ADD_VALUE = \"add-value\";\n+\n+const FX_ADD_COUNTER = \"add-counter\";\n- // these event handlers delegate to \"updateVal\" in same processing frame (using FX_DISPATCH_NOW)\n+const events: IObjectOf<EventDef> = {\n+ // these event handlers delegate to \"updateVal\" in same\n+ // processing frame (using FX_DISPATCH_NOW)\n// note how we also inject the predicate interceptors here to ensure\n// counter values will be always be in the range between 0 .. 100\n- inc: [\n+ [EV_INC]: [\nensureLessThan(100, null, () => console.warn(\"eek, reached max\")),\n- (_, [__, path]) => ({ [FX_DISPATCH_NOW]: [\"updateVal\", [path, 1]] })\n+ (_, [__, path]) => ({ [FX_DISPATCH_NOW]: [EV_ADD_VALUE, [path, 1]] })\n],\n- dec: [\n+ [EV_DEC]: [\nensureGreaterThan(0, null, () => console.warn(\"eek, reached min\")),\n- (_, [__, path]) => ({ [FX_DISPATCH_NOW]: [\"updateVal\", [path, -1]] })\n+ (_, [__, path]) => ({ [FX_DISPATCH_NOW]: [EV_ADD_VALUE, [path, -1]] })\n],\n- // this event handler injects the trace interceptor\n- // to log the event each time it's triggered\n- updateVal: [\n+ // similar to the EV_INIT handler above, here we just delegate to the\n+ // the built-in EV_UPDATE_VALUE handler to update a given path value.\n+ // Additionally, we inject the `trace` interceptor to log the event\n+ // each time it's triggered\n+ [EV_ADD_VALUE]: [\ntrace,\n- (state, [_, [path, y]]) => ({ [FX_STATE]: updateIn(state, path, (x) => x + y) })\n+ (_, [__, [path, y]]) =>\n+ ({ [FX_DISPATCH_NOW]: [EV_UPDATE_VALUE, [path, (x) => x + y]] })\n],\n// this handler increments the `nextID` state value and\n- // triggers \"addCounter\" side effect with config options for the new counter\n- addCounter: (state) => ({\n- [FX_DISPATCH_NOW]: [\"updateVal\", [\"nextID\", 1]],\n- // the \"addCounter\" side effect is defined further below\n+ // triggers FX_ADD_COUNTER side effect with config options for the new counter\n+ [EV_ADD_COUNTER]: (state) => ({\n+ [FX_DISPATCH_NOW]: [EV_ADD_VALUE, [\"nextID\", 1]],\n+ // the FX_ADD_COUNTER side effect is defined further below\n// here we simply prepare some configuration data for the new counter\n- \"addCounter\": {\n+ [FX_ADD_COUNTER]: {\nid: state.nextID,\nstart: ~~(Math.random() * 100),\ncolor: [\"gold\", \"orange\", \"springgreen\", \"yellow\", \"cyan\"][~~(Math.random() * 5)]\n@@ -57,52 +68,53 @@ const effects: IObjectOf<EffectDef> = {\n///////////////////////////////////////////////////////////////////////\n// components\n+const button = (bus, event, label, id?) =>\n+ [\"button\", { id, onclick: () => bus.dispatch(event) }, label];\n+\n// counter component function\n// calls to this function will be triggered via the \"addCounter\" event and its side effect\n// (see further below)\nconst counter = (bus: IDispatch, path: Path, start = 0, color: string) => {\nconst view = bus.state.addView(path);\n- bus.dispatch([\"init\", [path, start]]);\n- return () =>\n- [\"div.counter\",\n+ bus.dispatch([EV_SET_VALUE, [path, start]]);\n+ return [\"div.counter\",\n{ style: { background: color } },\n- view.deref() || 0,\n+ () => view.deref() || 0,\n[\"div\",\n- [\"button\", { onclick: () => bus.dispatch([\"dec\", view.path]) }, \"-\"],\n- [\"button\", { onclick: () => bus.dispatch([\"inc\", view.path]) }, \"+\"]]];\n+ button(bus, [EV_DEC, view.path], \"-\"),\n+ button(bus, [EV_INC, view.path], \"+\")]];\n}\n// main app\nconst app = () => {\n- // setup central state atom\n- const db = new Atom({});\n- // connect event bus to state and configure with above handlers/effects\n- const bus = new EventBus(db, events, effects);\n-\n- // add derived view for updating JSON state trace\n- // (only executed when state changes)\n- const json = db.addView([], (state) => JSON.stringify(state, null, 2));\n-\n// an array to store counter component instances\n+ // (only using component local state for KISS reasons)\nconst counters = [];\n+ // create event bus with app state atom and configure with above handlers/effects\n+ const bus = new EventBus(new Atom({}), events, effects);\n+\n// in addition to externally defined event handlers & side effects\n// each type can also be added & remove dynamically\n- // here we define the \"addCounter\" side effect, responsible for\n+ // here we define the FX_ADD_COUNTER side effect, responsible for\n// creating a new `counter()` component\n- bus.addEffect(\"addCounter\",\n+ bus.addEffect(FX_ADD_COUNTER,\n({ id, color, start }, bus) =>\n- counters.push(counter(bus, `counters.${id}`, start, color)));\n+ counters.push(counter(bus, [\"counters\", id], start, color)));\n+\n+ // add derived view subscription for updating JSON state trace\n+ // (only executed when state changes)\n+ const json = bus.state.addView([], (state) => JSON.stringify(state, null, 2));\n// this not just initializes the given state value\n- // the changed state will also trigger re-rendering (see returned function below)\n- bus.dispatch([\"init\", [\"nextID\", 0]]);\n+ // the changed state will also trigger the 1st DOM rendering (see returned function below)\n+ bus.dispatch([EV_SET_VALUE, [\"nextID\", 0]]);\n// our actual root component function passed to hdom\nconst root = () =>\n[\"div\",\n- [\"button#addcounter\", { onclick: () => bus.dispatch([\"addCounter\"]) }, \"add counter\"],\n- [\"div.buttons\", ...counters],\n+ button(bus, [EV_ADD_COUNTER], \"add counter\", \"addcounter\"),\n+ [\"div\", ...counters],\n[\"pre\", json.deref()]];\nreturn () => {\n", "new_path": "examples/interceptor-basics/src/index.ts", "old_path": "examples/interceptor-basics/src/index.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(examples): update interceptor-basics
1
refactor
examples
679,913
08.03.2018 21:54:32
0
a48b776297c5fa322e573c859ee277445f1be5b9
refactor(examples): update async-effect
[ { "change_type": "MODIFY", "diff": "import { IObjectOf } from \"@thi.ng/api/api\";\nimport { EventDef, EffectDef } from \"@thi.ng/atom/api\";\n-import { FX_DISPATCH_ASYNC, FX_DISPATCH_NOW, FX_STATE } from \"@thi.ng/atom/api\";\n+import { FX_DISPATCH_ASYNC, FX_DISPATCH_NOW } from \"@thi.ng/atom/api\";\nimport { Atom } from \"@thi.ng/atom/atom\";\nimport { EventBus } from \"@thi.ng/atom/event-bus\";\n-import { setIn } from \"@thi.ng/atom/path\";\n+import { valueSetter } from \"@thi.ng/atom/interceptors\";\nimport { start } from \"@thi.ng/hdom/start\";\n+// best practice tip:\n+// define event & effect names as consts or enums and\n+// avoid hardcoded strings\n+// additionally/alternatively define dispatch functions\n+\n+const EV_SET_STATUS = \"set-status\";\n+const EV_LOAD_JSON = \"load-json\";\n+const EV_RECEIVE_JSON = \"receive-json\";\n+const EV_ERROR = \"error\";\n+\n+const FX_JSON = \"load-json\";\n+const FX_DELAY = \"delay\";\n+\n+// event handler definitions\n+\nconst events: IObjectOf<EventDef> = {\n- setStatus: (state, [_, s]) => ({ [FX_STATE]: setIn(state, \"status\", s) }),\n+ // valueSetter() produces an interceptor to set value at given path\n+ [EV_SET_STATUS]: valueSetter(\"status\"),\n// this event is the initial trigger for starting an async IO operation\n// via the FX_DISPATCH_ASYNC side effect, which takes this general definition:\n@@ -16,42 +32,49 @@ const events: IObjectOf<EventDef> = {\n// FX_DISPATCH_ASYNC acts as a wrapper for the actual side effect to be executed,\n// in this case it's the \"json\" side effect defined below\n// the last items in the array are the event IDs for success & error outcomes\n- loadJSON: (_, [__, url]) => ({\n- [FX_DISPATCH_NOW]: [\"setStatus\", [\"idle\", `loading: ${url}...`]],\n- [FX_DISPATCH_ASYNC]: [\"json\", url, \"receiveJSON\", \"error\"]\n+ [EV_LOAD_JSON]: (_, [__, url]) => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [\"idle\", `loading: ${url}...`]],\n+ [FX_DISPATCH_ASYNC]: [FX_JSON, url, EV_RECEIVE_JSON, EV_ERROR]\n}),\n// this event will be triggered after JSON data has been successfully loaded\n- // sets status message, `json` state value and triggers another,\n- // delayed invocation of \"setStatus\" event to reset message after 1sec\n- receiveJSON: (state, [_, json]) => ({\n- [FX_STATE]: setIn(state, \"json\", JSON.stringify(json, null, 2)),\n- [FX_DISPATCH_NOW]: [\"setStatus\", [\"success\", \"JSON succesfully loaded\"]],\n- [FX_DISPATCH_ASYNC]: [\"delay\", [1000, [\"idle\", \"done.\"]], \"setStatus\", \"error\"],\n- }),\n+ // sets `json` state value, status and triggers another, delayed invocation\n+ // of EV_SET_STATUS event to reset message after 1sec\n+\n+ // as with the EV_SET_STATUS event, we're using the higher-order valueSetter()\n+ // to produce an interceptor, here with additional value transformer to\n+ // create a formatted JSON string\n+ [EV_RECEIVE_JSON]: [\n+ valueSetter(\"json\", (json) => JSON.stringify(json, null, 2)),\n+ () => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [\"success\", \"JSON succesfully loaded\"]],\n+ [FX_DISPATCH_ASYNC]: [FX_DELAY, [1000, [\"idle\", \"done.\"]], EV_SET_STATUS, EV_ERROR],\n+ })\n+ ],\n// error event handler\n- error: (_, [__, err]) => ({\n- [FX_DISPATCH_NOW]: [\"setStatus\", [\"error\", err.message]],\n+ [EV_ERROR]: (_, [__, err]) => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [\"error\", err.message]],\n}),\n};\nconst effects: IObjectOf<EffectDef> = {\n// these are async side effects. ALWAYS MUST RETURN A PROMISE\n- json: (url) => fetch(url).then((res) => res.json()),\n- delay: ([x, msg]) => new Promise((res) => setTimeout(() => res(msg), x))\n+ [FX_JSON]: (url) => fetch(url).then((res) => res.json()),\n+ [FX_DELAY]: ([x, msg]) => new Promise((res) => setTimeout(() => res(msg), x))\n};\n+// main app component\nconst app = () => {\nconst bus = new EventBus(new Atom<any>({}), events, effects);\n// kick off JSON request\n- bus.dispatch([\"loadJSON\", \"foo.json\"]);\n+ bus.dispatch([EV_LOAD_JSON, \"foo.json\"]);\n// root component function\nreturn () => {\nif (bus.processQueue()) {\n- let { json, status } = bus.state.deref();\n+ const { json, status } = bus.state.deref();\nreturn [\"div\",\n[\"p#status\", { class: status[0] }, `status: ${status[1]}`],\n[\"pre\", json]\n", "new_path": "examples/async-effect/src/index.ts", "old_path": "examples/async-effect/src/index.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(examples): update async-effect
1
refactor
examples
815,746
09.03.2018 09:24:56
-7,200
2f633f0af6d8d0305cfb839bef8792404faf34c9
fix: remove nodejs import fixes
[ { "change_type": "MODIFY", "diff": "import { NgOption } from './ng-select.types';\nimport * as searchHelper from './search-helper';\nimport { NgSelectComponent } from './ng-select.component';\n-import { isObject, isDefined } from './utils';\n+import { isObject, isDefined } from './value-utils';\nexport class ItemsList {\n", "new_path": "src/ng-select/items-list.ts", "old_path": "src/ng-select/items-list.ts" }, { "change_type": "MODIFY", "diff": "@@ -39,8 +39,7 @@ import { NgOption, KeyCode, NgSelectConfig } from './ng-select.types';\nimport { ItemsList } from './items-list';\nimport { NgOptionComponent } from './ng-option.component';\nimport { NgDropdownPanelComponent } from './ng-dropdown-panel.component';\n-import { isDefined, isFunction, isPromise } from './utils';\n-import { isObject } from 'util';\n+import { isDefined, isFunction, isPromise, isObject } from './value-utils';\nexport const NG_SELECT_DEFAULT_CONFIG = new InjectionToken<NgSelectConfig>('ng-select-default-options');\nexport type DropdownPosition = 'bottom' | 'top' | 'auto';\n", "new_path": "src/ng-select/ng-select.component.ts", "old_path": "src/ng-select/ng-select.component.ts" }, { "change_type": "RENAME", "diff": "", "new_path": "src/ng-select/value-utils.ts", "old_path": "src/ng-select/utils.ts" }, { "change_type": "MODIFY", "diff": "\"angular4\"\n],\n\"peerDependencies\": {\n- \"@angular/common\": \">=4.0.0 <6.0.0\",\n- \"@angular/core\": \">=4.0.0 <6.0.0\",\n- \"@angular/forms\": \">=4.0.0 <6.0.0\"\n+ \"@angular/common\": \">=5.0.0 <6.0.0\",\n+ \"@angular/core\": \">=5.0.0 <6.0.0\",\n+ \"@angular/forms\": \">=5.0.0 <6.0.0\"\n},\n\"ngPackage\": {\n\"lib\": {\n", "new_path": "src/package.json", "old_path": "src/package.json" } ]
TypeScript
MIT License
ng-select/ng-select
fix: remove nodejs import (#334) fixes #333, #331
1
fix
null
815,746
09.03.2018 09:25:30
-7,200
fd8254b1c4cbc46e2685836529160a54f2244d5d
chore(release): 0.26.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.26.2\"></a>\n+## [0.26.2](https://github.com/ng-select/ng-select/compare/v0.26.1...v0.26.2) (2018-03-09)\n+\n+\n+### Bug Fixes\n+\n+* remove nodejs import ([#334](https://github.com/ng-select/ng-select/issues/334)) ([2f633f0](https://github.com/ng-select/ng-select/commit/2f633f0)), closes [#333](https://github.com/ng-select/ng-select/issues/333) [#331](https://github.com/ng-select/ng-select/issues/331)\n+\n+\n+\n<a name=\"0.26.1\"></a>\n## [0.26.1](https://github.com/ng-select/ng-select/compare/v0.26.0...v0.26.1) (2018-03-08)\n", "new_path": "CHANGELOG.md", "old_path": "CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "{\n\"$schema\": \"../node_modules/ng-packagr/package.schema.json\",\n\"name\": \"@ng-select/ng-select\",\n- \"version\": \"0.26.1\",\n+ \"version\": \"0.26.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.26.2
1
chore
release
807,849
09.03.2018 10:47:22
28,800
c09ccbdb028dcdbda642451e19fc0d683acc25d3
fix: Move into bootstrap/lib
[ { "change_type": "MODIFY", "diff": "@@ -15,7 +15,7 @@ const npmInstall = require(\"@lerna/npm-install\");\nconst runLifecycle = require(\"@lerna/run-lifecycle\");\nconst batchPackages = require(\"@lerna/batch-packages\");\nconst runParallelBatches = require(\"@lerna/run-parallel-batches\");\n-const hasDependencyInstalled = require(\"@lerna/has-dependency-installed\");\n+const hasDependencyInstalled = require(\"./lib/has-dependency-installed\");\nconst symlinkBinary = require(\"@lerna/symlink-binary\");\nconst symlinkDependencies = require(\"@lerna/symlink-dependencies\");\nconst ValidationError = require(\"@lerna/validation-error\");\n", "new_path": "commands/bootstrap/index.js", "old_path": "commands/bootstrap/index.js" }, { "change_type": "RENAME", "diff": "", "new_path": "commands/bootstrap/lib/has-dependency-installed.js", "old_path": "utils/has-dependency-installed/has-dependency-installed.js" }, { "change_type": "MODIFY", "diff": "\"@lerna/command\": \"file:../../core/command\",\n\"@lerna/filter-options\": \"file:../../core/filter-options\",\n\"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n- \"@lerna/has-dependency-installed\": \"file:../../utils/has-dependency-installed\",\n\"@lerna/match-package-name\": \"file:../../utils/match-package-name\",\n\"@lerna/npm-install\": \"file:../../utils/npm-install\",\n\"@lerna/run-lifecycle\": \"file:../../utils/run-lifecycle\",\n\"@lerna/validation-error\": \"file:../../core/validation-error\",\n\"dedent\": \"^0.7.0\",\n\"get-port\": \"^3.2.0\",\n+ \"load-json-file\": \"^4.0.0\",\n\"npm-conf\": \"^1.1.3\",\n+ \"npmlog\": \"^4.1.2\",\n\"p-finally\": \"^1.0.0\",\n- \"p-map\": \"^1.2.0\",\n\"p-map-series\": \"^1.0.0\",\n+ \"p-map\": \"^1.2.0\",\n+ \"semver\": \"^5.5.0\",\n\"p-waterfall\": \"^1.0.0\"\n}\n}\n", "new_path": "commands/bootstrap/package.json", "old_path": "commands/bootstrap/package.json" }, { "change_type": "MODIFY", "diff": "\"@lerna/command\": \"file:core/command\",\n\"@lerna/filter-options\": \"file:core/filter-options\",\n\"@lerna/fs-utils\": \"file:core/fs-utils\",\n- \"@lerna/has-dependency-installed\": \"file:utils/has-dependency-installed\",\n\"@lerna/match-package-name\": \"file:utils/match-package-name\",\n\"@lerna/npm-install\": \"file:utils/npm-install\",\n\"@lerna/run-lifecycle\": \"file:utils/run-lifecycle\",\n\"@lerna/validation-error\": \"file:core/validation-error\",\n\"dedent\": \"0.7.0\",\n\"get-port\": \"3.2.0\",\n+ \"load-json-file\": \"4.0.0\",\n\"npm-conf\": \"1.1.3\",\n+ \"npmlog\": \"4.1.2\",\n\"p-finally\": \"1.0.0\",\n\"p-map\": \"1.2.0\",\n\"p-map-series\": \"1.0.0\",\n- \"p-waterfall\": \"1.0.0\"\n+ \"p-waterfall\": \"1.0.0\",\n+ \"semver\": \"5.5.0\"\n}\n},\n\"@lerna/changed\": {\n\"@lerna/global-options\": {\n\"version\": \"file:core/global-options\"\n},\n- \"@lerna/has-dependency-installed\": {\n- \"version\": \"file:utils/has-dependency-installed\",\n- \"requires\": {\n- \"load-json-file\": \"4.0.0\",\n- \"npmlog\": \"4.1.2\",\n- \"semver\": \"5.5.0\"\n- }\n- },\n\"@lerna/import\": {\n\"version\": \"file:commands/import\",\n\"requires\": {\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "DELETE", "diff": "-# `@lerna/has-dependency-installed`\n-\n-> description TODO\n-\n-## Usage\n-\n-TODO\n-\n", "new_path": null, "old_path": "utils/has-dependency-installed/README.md" }, { "change_type": "DELETE", "diff": "-{\n- \"name\": \"@lerna/has-dependency-installed\",\n- \"version\": \"3.0.0-beta.0\",\n- \"description\": \"TODO\",\n- \"keywords\": [\n- \"lerna\",\n- \"utils\"\n- ],\n- \"homepage\": \"https://github.com/lerna/lerna\",\n- \"license\": \"MIT\",\n- \"author\": {\n- \"name\": \"Daniel Stockman\",\n- \"url\": \"https://github.com/evocateur\"\n- },\n- \"files\": [\n- \"has-dependency-installed.js\"\n- ],\n- \"main\": \"has-dependency-installed.js\",\n- \"engines\": {\n- \"node\": \">= 6.9.0\"\n- },\n- \"publishConfig\": {\n- \"access\": \"public\"\n- },\n- \"repository\": {\n- \"type\": \"git\",\n- \"url\": \"git+https://github.com/lerna/lerna.git\"\n- },\n- \"scripts\": {\n- \"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n- },\n- \"dependencies\": {\n- \"load-json-file\": \"^4.0.0\",\n- \"npmlog\": \"^4.1.2\",\n- \"semver\": \"^5.5.0\"\n- }\n-}\n", "new_path": null, "old_path": "utils/has-dependency-installed/package.json" } ]
JavaScript
MIT License
lerna/lerna
fix: Move @lerna/has-dependency-installed into bootstrap/lib
1
fix
null
807,849
09.03.2018 11:17:11
28,800
9c35a8622d20c449909cc9249d0cc4d4400ad4da
feat: Replace dependency with fs-extra
[ { "change_type": "MODIFY", "diff": "\"use strict\";\nconst dedent = require(\"dedent\");\n+const fs = require(\"fs-extra\");\nconst path = require(\"path\");\nconst pMapSeries = require(\"p-map-series\");\nconst ChildProcessUtilities = require(\"@lerna/child-process\");\nconst Command = require(\"@lerna/command\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst GitUtilities = require(\"@lerna/git-utils\");\nconst PromptUtilities = require(\"@lerna/prompt\");\nconst ValidationError = require(\"@lerna/validation-error\");\n@@ -34,7 +34,7 @@ class ImportCommand extends Command {\nlet stats;\ntry {\n- stats = FileSystemUtilities.statSync(externalRepoPath);\n+ stats = fs.statSync(externalRepoPath);\n} catch (e) {\nif (e.code === \"ENOENT\") {\nthrow new Error(`No repository found at \"${inputPath}\"`);\n@@ -65,7 +65,7 @@ class ImportCommand extends Command {\nconst lernaRootRelativeToGitRoot = path.relative(gitRepoRoot, this.repository.rootPath);\nthis.targetDirRelativeToGitRoot = path.join(lernaRootRelativeToGitRoot, targetDir);\n- if (FileSystemUtilities.existsSync(path.resolve(this.repository.rootPath, targetDir))) {\n+ if (fs.existsSync(path.resolve(this.repository.rootPath, targetDir))) {\nthrow new Error(`Target directory already exists \"${targetDir}\"`);\n}\n", "new_path": "commands/import/index.js", "old_path": "commands/import/index.js" }, { "change_type": "MODIFY", "diff": "\"dependencies\": {\n\"@lerna/child-process\": \"file:../../core/child-process\",\n\"@lerna/command\": \"file:../../core/command\",\n- \"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/git-utils\": \"file:../../core/git-utils\",\n\"@lerna/prompt\": \"file:../../core/prompt\",\n\"@lerna/validation-error\": \"file:../../core/validation-error\",\n\"dedent\": \"^0.7.0\",\n+ \"fs-extra\": \"^5.0.0\",\n\"p-map-series\": \"^1.0.0\"\n}\n}\n", "new_path": "commands/import/package.json", "old_path": "commands/import/package.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+const fs = require(\"fs-extra\");\nconst writeJsonFile = require(\"write-json-file\");\nconst writePkg = require(\"write-pkg\");\nconst Command = require(\"@lerna/command\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst GitUtilities = require(\"@lerna/git-utils\");\nclass InitCommand extends Command {\n@@ -107,7 +107,7 @@ class InitCommand extends Command {\nensurePackagesDir() {\nthis.logger.info(\"\", \"Creating packages directory\");\n- this.repository.packageParentDirs.map(dir => FileSystemUtilities.mkdirpSync(dir));\n+ this.repository.packageParentDirs.map(dir => fs.mkdirpSync(dir));\n}\n}\n", "new_path": "commands/init/index.js", "old_path": "commands/init/index.js" }, { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@lerna/command\": \"file:../../core/command\",\n- \"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/git-utils\": \"file:../../core/git-utils\",\n+ \"fs-extra\": \"5.0.0\",\n\"write-json-file\": \"^2.3.0\",\n\"write-pkg\": \"^3.1.0\"\n}\n", "new_path": "commands/init/package.json", "old_path": "commands/init/package.json" }, { "change_type": "MODIFY", "diff": "const conventionalChangelogCore = require(\"conventional-changelog-core\");\nconst conventionalRecommendedBump = require(\"conventional-recommended-bump\");\nconst dedent = require(\"dedent\");\n+const fs = require(\"fs-extra\");\nconst getStream = require(\"get-stream\");\nconst log = require(\"npmlog\");\nconst npa = require(\"npm-package-arg\");\n@@ -10,7 +11,6 @@ const os = require(\"os\");\nconst path = require(\"path\");\nconst semver = require(\"semver\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst ValidationError = require(\"@lerna/validation-error\");\nconst BLANK_LINE = os.EOL + os.EOL;\n@@ -117,7 +117,8 @@ function makeBumpOnlyFilter(pkg) {\nfunction readExistingChangelog({ location }) {\nconst changelogFileLoc = path.join(location, \"CHANGELOG.md\");\n- return FileSystemUtilities.readFile(changelogFileLoc)\n+ return Promise.resolve()\n+ .then(() => fs.readFile(changelogFileLoc, \"utf8\"))\n.catch(() => \"\") // allow missing file\n.then(changelogContents => {\n// CHANGELOG entries start with <a name=, we remove\n@@ -175,7 +176,7 @@ function updateChangelog(pkg, type, { changelogPreset, version }) {\nconst content = [CHANGELOG_HEADER, newEntry, changelogContents].join(BLANK_LINE);\n- return FileSystemUtilities.writeFile(changelogFileLoc, content.trim()).then(() => {\n+ return fs.writeFile(changelogFileLoc, content.trim() + os.EOL).then(() => {\nlog.verbose(type, \"wrote\", changelogFileLoc);\nreturn changelogFileLoc;\n", "new_path": "core/conventional-commits/index.js", "old_path": "core/conventional-commits/index.js" }, { "change_type": "MODIFY", "diff": "\"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n},\n\"dependencies\": {\n- \"@lerna/fs-utils\": \"file:../fs-utils\",\n\"@lerna/validation-error\": \"file:../validation-error\",\n\"conventional-changelog-angular\": \"^1.6.6\",\n\"conventional-changelog-core\": \"^2.0.5\",\n\"conventional-recommended-bump\": \"^2.0.6\",\n\"dedent\": \"^0.7.0\",\n+ \"fs-extra\": \"5.0.0\",\n\"get-stream\": \"^3.0.0\",\n\"npm-package-arg\": \"^6.0.0\",\n\"npmlog\": \"^4.1.2\",\n", "new_path": "core/conventional-commits/package.json", "old_path": "core/conventional-commits/package.json" }, { "change_type": "MODIFY", "diff": "\"@lerna/conventional-commits\": {\n\"version\": \"file:core/conventional-commits\",\n\"requires\": {\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/validation-error\": \"file:core/validation-error\",\n\"conventional-changelog-angular\": \"1.6.6\",\n\"conventional-changelog-core\": \"2.0.5\",\n\"conventional-recommended-bump\": \"2.0.6\",\n\"dedent\": \"0.7.0\",\n+ \"fs-extra\": \"5.0.0\",\n\"get-stream\": \"3.0.0\",\n\"npm-package-arg\": \"6.0.0\",\n\"npmlog\": \"4.1.2\",\n\"requires\": {\n\"@lerna/child-process\": \"file:core/child-process\",\n\"@lerna/command\": \"file:core/command\",\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/git-utils\": \"file:core/git-utils\",\n\"@lerna/prompt\": \"file:core/prompt\",\n\"@lerna/validation-error\": \"file:core/validation-error\",\n\"dedent\": \"0.7.0\",\n+ \"fs-extra\": \"5.0.0\",\n\"p-map-series\": \"1.0.0\"\n}\n},\n\"version\": \"file:commands/init\",\n\"requires\": {\n\"@lerna/command\": \"file:core/command\",\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/git-utils\": \"file:core/git-utils\",\n+ \"fs-extra\": \"5.0.0\",\n\"write-json-file\": \"2.3.0\",\n\"write-pkg\": \"3.1.0\"\n}\n\"version\": \"file:utils/npm-install\",\n\"requires\": {\n\"@lerna/child-process\": \"file:core/child-process\",\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/get-npm-exec-opts\": \"file:utils/get-npm-exec-opts\",\n+ \"fs-extra\": \"5.0.0\",\n\"npm-package-arg\": \"6.0.0\",\n\"npmlog\": \"4.1.2\",\n\"signal-exit\": \"3.0.2\",\n\"version\": \"file:utils/symlink-binary\",\n\"requires\": {\n\"@lerna/create-symlink\": \"file:utils/create-symlink\",\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/package\": \"file:core/package\",\n\"fs-extra\": \"5.0.0\",\n\"p-map\": \"1.2.0\",\n\"version\": \"file:utils/symlink-dependencies\",\n\"requires\": {\n\"@lerna/create-symlink\": \"file:utils/create-symlink\",\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/resolve-symlink\": \"file:utils/resolve-symlink\",\n\"@lerna/symlink-binary\": \"file:utils/symlink-binary\",\n\"fs-extra\": \"5.0.0\",\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+jest.mock(\"fs-extra\");\njest.mock(\"write-pkg\");\njest.mock(\"@lerna/child-process\");\n-jest.mock(\"@lerna/fs-utils\");\nconst path = require(\"path\");\n// mocked modules\n+const fs = require(\"fs-extra\");\nconst writePkg = require(\"write-pkg\");\nconst ChildProcessUtilities = require(\"@lerna/child-process\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\n// file under test\nconst npmInstall = require(\"..\");\ndescribe(\"npm-install\", () => {\nChildProcessUtilities.exec.mockResolvedValue();\n- FileSystemUtilities.rename.mockResolvedValue();\n+ fs.rename.mockResolvedValue();\nwritePkg.mockResolvedValue();\ndescribe(\"npmInstall()\", () => {\n@@ -73,6 +73,7 @@ describe(\"npm-install\", () => {\nit(\"installs dependencies in targeted directory\", async () => {\nconst location = path.normalize(\"/test/npm-install-deps\");\nconst manifestLocation = path.join(location, \"package.json\");\n+ const backupManifest = `${manifestLocation}.lerna_backup`;\nconst pkg = {\nlocation,\nmanifestLocation,\n@@ -100,14 +101,8 @@ describe(\"npm-install\", () => {\nawait npmInstall.dependencies(pkg, dependencies, config);\n- expect(FileSystemUtilities.rename).lastCalledWith(\n- manifestLocation,\n- path.join(location, \"package.json.lerna_backup\")\n- );\n- expect(FileSystemUtilities.renameSync).lastCalledWith(\n- path.join(location, \"package.json.lerna_backup\"),\n- manifestLocation\n- );\n+ expect(fs.rename).lastCalledWith(manifestLocation, backupManifest);\n+ expect(fs.renameSync).lastCalledWith(backupManifest, manifestLocation);\nexpect(writePkg).lastCalledWith(manifestLocation, {\nname: \"npm-install-deps\",\nversion: \"1.0.0\",\n@@ -405,7 +400,7 @@ describe(\"npm-install\", () => {\nconst dependencies = [\"I'm just here so we don't exit early\"];\nconst config = {};\n- FileSystemUtilities.rename.mockRejectedValueOnce(new Error(\"Unable to rename file\"));\n+ fs.rename.mockRejectedValueOnce(new Error(\"Unable to rename file\"));\ntry {\nawait npmInstall.dependencies(pkg, dependencies, config);\n@@ -417,6 +412,7 @@ describe(\"npm-install\", () => {\nit(\"cleans up synchronously after writeFile error\", async () => {\nconst location = path.normalize(\"/test/npm-install-deps/writeError\");\nconst manifestLocation = path.join(location, \"package.json\");\n+ const backupManifest = `${manifestLocation}.lerna_backup`;\nconst pkg = {\nlocation,\nmanifestLocation,\n@@ -434,17 +430,14 @@ describe(\"npm-install\", () => {\nawait npmInstall.dependencies(pkg, dependencies, config);\n} catch (err) {\nexpect(err.message).toBe(\"Unable to write file\");\n-\n- expect(FileSystemUtilities.renameSync).lastCalledWith(\n- path.join(location, \"package.json.lerna_backup\"),\n- manifestLocation\n- );\n+ expect(fs.renameSync).lastCalledWith(backupManifest, manifestLocation);\n}\n});\nit(\"cleans up synchronously after client install error\", async () => {\nconst location = path.normalize(\"/test/npm-install-deps/clientError\");\nconst manifestLocation = path.join(location, \"package.json\");\n+ const backupManifest = `${manifestLocation}.lerna_backup`;\nconst pkg = {\nlocation,\nmanifestLocation,\n@@ -462,11 +455,7 @@ describe(\"npm-install\", () => {\nawait npmInstall.dependencies(pkg, dependencies, config);\n} catch (err) {\nexpect(err.message).toBe(\"Unable to install dependency\");\n-\n- expect(FileSystemUtilities.renameSync).lastCalledWith(\n- path.join(location, \"package.json.lerna_backup\"),\n- manifestLocation\n- );\n+ expect(fs.renameSync).lastCalledWith(backupManifest, manifestLocation);\n}\n});\n});\n", "new_path": "utils/npm-install/__tests__/npm-install.test.js", "old_path": "utils/npm-install/__tests__/npm-install.test.js" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+const fs = require(\"fs-extra\");\nconst log = require(\"npmlog\");\nconst npa = require(\"npm-package-arg\");\nconst onExit = require(\"signal-exit\");\nconst writePkg = require(\"write-pkg\");\nconst ChildProcessUtilities = require(\"@lerna/child-process\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst getExecOpts = require(\"@lerna/get-npm-exec-opts\");\nmodule.exports = npmInstall;\n@@ -53,11 +53,11 @@ function npmInstallDependencies(pkg, dependencies, config) {\nlog.silly(\"npmInstallDependencies\", \"backup\", pkg.manifestLocation);\n- return FileSystemUtilities.rename(pkg.manifestLocation, packageJsonBkp).then(() => {\n+ return fs.rename(pkg.manifestLocation, packageJsonBkp).then(() => {\nconst cleanup = () => {\nlog.silly(\"npmInstallDependencies\", \"cleanup\", pkg.manifestLocation);\n// Need to do this one synchronously because we might be doing it on exit.\n- FileSystemUtilities.renameSync(packageJsonBkp, pkg.manifestLocation);\n+ fs.renameSync(packageJsonBkp, pkg.manifestLocation);\n};\n// If we die we need to be sure to put things back the way we found them.\n", "new_path": "utils/npm-install/npm-install.js", "old_path": "utils/npm-install/npm-install.js" }, { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@lerna/child-process\": \"file:../../core/child-process\",\n- \"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/get-npm-exec-opts\": \"file:../get-npm-exec-opts\",\n+ \"fs-extra\": \"5.0.0\",\n\"npm-package-arg\": \"^6.0.0\",\n\"npmlog\": \"^4.1.2\",\n\"signal-exit\": \"^3.0.2\",\n", "new_path": "utils/npm-install/package.json", "old_path": "utils/npm-install/package.json" }, { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@lerna/create-symlink\": \"file:../create-symlink\",\n- \"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/package\": \"file:../../core/package\",\n\"fs-extra\": \"^5.0.0\",\n\"p-map\": \"^1.2.0\",\n", "new_path": "utils/symlink-binary/package.json", "old_path": "utils/symlink-binary/package.json" }, { "change_type": "MODIFY", "diff": "@@ -6,7 +6,6 @@ const pMap = require(\"p-map\");\nconst readPkg = require(\"read-pkg\");\nconst Package = require(\"@lerna/package\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst createSymlink = require(\"@lerna/create-symlink\");\nmodule.exports = symlinkBinary;\n@@ -35,12 +34,10 @@ function symlinkBinary(srcPackageRef, destPackageRef) {\nreturn Promise.resolve();\n}\n- return FileSystemUtilities.mkdirp(destPackage.binLocation).then(() =>\n+ return fs.mkdirp(destPackage.binLocation).then(() =>\npMap(actions, meta => {\nif (meta) {\n- return createSymlink(meta.src, meta.dst, \"exec\").then(() =>\n- FileSystemUtilities.chmod(meta.src, \"755\")\n- );\n+ return createSymlink(meta.src, meta.dst, \"exec\").then(() => fs.chmod(meta.src, \"755\"));\n}\n})\n);\n", "new_path": "utils/symlink-binary/symlink-binary.js", "old_path": "utils/symlink-binary/symlink-binary.js" }, { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@lerna/create-symlink\": \"file:../create-symlink\",\n- \"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/resolve-symlink\": \"file:../resolve-symlink\",\n\"@lerna/symlink-binary\": \"file:../symlink-binary\",\n\"fs-extra\": \"^5.0.0\",\n", "new_path": "utils/symlink-dependencies/package.json", "old_path": "utils/symlink-dependencies/package.json" }, { "change_type": "MODIFY", "diff": "@@ -6,7 +6,6 @@ const pMap = require(\"p-map\");\nconst pMapSeries = require(\"p-map-series\");\nconst path = require(\"path\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\nconst createSymlink = require(\"@lerna/create-symlink\");\nconst resolveSymlink = require(\"@lerna/resolve-symlink\");\nconst symlinkBinary = require(\"@lerna/symlink-binary\");\n@@ -71,11 +70,11 @@ function symlinkDependencies(packages, packageGraph, logger) {\n);\n// remove installed dependency\n- return FileSystemUtilities.rimraf(targetDirectory);\n+ return fs.remove(targetDirectory);\n}\n} else {\n// ensure destination directory exists (dealing with scoped subdirs)\n- return FileSystemUtilities.mkdirp(path.dirname(targetDirectory));\n+ return fs.ensureDir(path.dirname(targetDirectory));\n}\n});\n", "new_path": "utils/symlink-dependencies/symlink-dependencies.js", "old_path": "utils/symlink-dependencies/symlink-dependencies.js" } ]
JavaScript
MIT License
lerna/lerna
feat: Replace @lerna/fs-utils dependency with fs-extra
1
feat
null
730,424
09.03.2018 12:05:29
18,000
b5fafc4d6306b2551dad0d015a735bfcaed211e0
fix(widget-message): Incorrect events payload
[ { "change_type": "MODIFY", "diff": "@@ -120,20 +120,15 @@ Array [\n},\n],\n},\n- \"tags\": Array [],\n- },\n- },\n- \"type\": \"conversation/CREATE_CONVERSATION\",\n- },\n- Object {\n- \"payload\": Object {\n- \"conversationState\": Object {\n+ \"status\": Object {\n\"isLocked\": false,\n\"isModerator\": false,\n\"isOneOnOne\": false,\n},\n+ \"tags\": Array [],\n},\n- \"type\": \"conversation/UPDATE_CONVERSATION_STATE\",\n+ },\n+ \"type\": \"conversation/CREATE_CONVERSATION\",\n},\n]\n`;\n@@ -191,20 +186,15 @@ Array [\n},\n],\n},\n- \"tags\": Array [],\n- },\n- },\n- \"type\": \"conversation/CREATE_CONVERSATION\",\n- },\n- Object {\n- \"payload\": Object {\n- \"conversationState\": Object {\n+ \"status\": Object {\n\"isLocked\": false,\n\"isModerator\": false,\n\"isOneOnOne\": false,\n},\n+ \"tags\": Array [],\n},\n- \"type\": \"conversation/UPDATE_CONVERSATION_STATE\",\n+ },\n+ \"type\": \"conversation/CREATE_CONVERSATION\",\n},\n]\n`;\n@@ -244,6 +234,11 @@ Array [\n},\n],\n},\n+ \"status\": Object {\n+ \"isLocked\": true,\n+ \"isModerator\": false,\n+ \"isOneOnOne\": false,\n+ },\n\"tags\": Array [\n\"LOCKED\",\n],\n@@ -251,16 +246,6 @@ Array [\n},\n\"type\": \"conversation/CREATE_CONVERSATION\",\n},\n- Object {\n- \"payload\": Object {\n- \"conversationState\": Object {\n- \"isLocked\": true,\n- \"isModerator\": false,\n- \"isOneOnOne\": false,\n- },\n- },\n- \"type\": \"conversation/UPDATE_CONVERSATION_STATE\",\n- },\n]\n`;\n@@ -283,6 +268,11 @@ Array [\n},\n],\n},\n+ \"status\": Object {\n+ \"isLocked\": true,\n+ \"isModerator\": true,\n+ \"isOneOnOne\": false,\n+ },\n\"tags\": Array [\n\"LOCKED\",\n],\n@@ -290,16 +280,6 @@ Array [\n},\n\"type\": \"conversation/CREATE_CONVERSATION\",\n},\n- Object {\n- \"payload\": Object {\n- \"conversationState\": Object {\n- \"isLocked\": true,\n- \"isModerator\": true,\n- \"isOneOnOne\": false,\n- },\n- },\n- \"type\": \"conversation/UPDATE_CONVERSATION_STATE\",\n- },\n]\n`;\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/__snapshots__/actions.test.js.snap", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/__snapshots__/actions.test.js.snap" }, { "change_type": "MODIFY", "diff": "@@ -137,23 +137,35 @@ export function updateConversationState(conversationState) {\n/**\n* Computes and updates room properties\n- * @param {Function} dispatch\n* @param {Object} conversation\n- * @param {Object} spark\n- * @returns {Promise}\n+ * @param {Object} sparkInstance\n+ * @returns {Object}\n*/\n-function computeRoomProperties(dispatch, conversation, spark) {\n+function computeRoomProperties(conversation, sparkInstance) {\n+ const computedConversation = Object.assign({}, conversation);\n+\nconst lockedTag = 'LOCKED';\nconst oneOnOneTag = 'ONE_ON_ONE';\nconst isLocked = conversation.tags.some((tag) => tag === lockedTag);\nconst isOneOnOne = conversation.tags.some((tag) => tag === oneOnOneTag);\n- const currentUserId = spark.internal.device.userId;\n+ const currentUserId = sparkInstance.internal.device.userId;\nconst currentUserParticipant = conversation.participants.items\n.find((participant) => participant.id === currentUserId);\nconst isModerator = currentUserParticipant\n&& currentUserParticipant.roomProperties\n&& currentUserParticipant.roomProperties.isModerator;\n- return dispatch(updateConversationState({isLocked, isModerator, isOneOnOne}));\n+\n+ if (isOneOnOne && !conversation.displayName) {\n+ const otherUser = conversation.participants.items\n+ .find((p) => p.id !== currentUserId);\n+ if (otherUser) {\n+ computedConversation.displayName = otherUser.displayName;\n+ }\n+ }\n+ computedConversation.status = Object.assign({}, conversation.status,\n+ {isLocked, isModerator, isOneOnOne});\n+\n+ return computedConversation;\n}\n@@ -178,7 +190,6 @@ export function acknowledgeActivityOnServer(conversation, activity, spark) {\n* @returns {function}\n*/\nexport function createConversation(participants = [], spark) {\n- let conversation;\nreturn (dispatch) => {\ndispatch(createConversationBegin());\n@@ -189,11 +200,10 @@ export function createConversation(participants = [], spark) {\nactivitiesLimit: 40,\nparticipantAckFilter: 'all'\n})\n- .then((createdConversation) => {\n- conversation = createdConversation;\n- return dispatch(storeConversation(conversation));\n- })\n- .then(() => computeRoomProperties(dispatch, conversation, spark))\n+ .then((conversation) =>\n+ dispatch(storeConversation(\n+ computeRoomProperties(conversation, spark)\n+ )))\n.catch((error) => dispatch(updateConversationState({error})));\n};\n}\n@@ -222,7 +232,6 @@ export function getConversation(id, spark) {\n// check if id is uuid\nconst uuidTest = new RegExp(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);\nlet uuid = id;\n- let conversation;\nif (!uuidTest.test(uuid)) {\nuuid = atob(id).split('/').pop();\n}\n@@ -237,11 +246,10 @@ export function getConversation(id, spark) {\nparticipantAckFilter: 'all',\nincludeParticipants: true\n})\n- .then((createdConversation) => {\n- conversation = createdConversation;\n- return dispatch(storeConversation(conversation));\n- })\n- .then(() => computeRoomProperties(dispatch, conversation, spark))\n+ .then((conversation) =>\n+ dispatch(storeConversation(\n+ computeRoomProperties(conversation, spark)\n+ )))\n.catch((error) => dispatch(updateConversationState({error})));\n}\nreturn false;\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.js", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.js" }, { "change_type": "MODIFY", "diff": "@@ -116,7 +116,8 @@ export default function reducer(state = initialState, action) {\npublished,\nurl,\nlastReadableActivityDate,\n- teams\n+ teams,\n+ status\n} = action.payload.conversation;\nconst conversationActivities = action.payload.conversation.activities.items;\n@@ -138,11 +139,11 @@ export default function reducer(state = initialState, action) {\ntags,\nlastReadableActivityDate,\nteams,\n- status: {\n+ status: Object.assign({}, status, {\nerror: null,\nisFetching: false,\nisLoaded: true\n- },\n+ }),\nparticipants: participants.items\n});\n}\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/reducer.js", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/reducer.js" }, { "change_type": "MODIFY", "diff": "@@ -51,7 +51,7 @@ const getSpace = createSelector(\n(conversation, users) => {\nconst space = conversation;\nconst currentUser = users.getIn(['byId', users.get('currentUserId')]);\n- if (space.get('type') === 'direct') {\n+ if (space.getIn(['status', 'isOneOnOne'])) {\nreturn constructOneOnOne(space, currentUser);\n}\nreturn constructGroup(space, currentUser);\n", "new_path": "packages/node_modules/@ciscospark/widget-message/src/selector.js", "old_path": "packages/node_modules/@ciscospark/widget-message/src/selector.js" } ]
JavaScript
MIT License
webex/react-widgets
fix(widget-message): Incorrect events payload
1
fix
widget-message
730,424
09.03.2018 12:05:59
18,000
62133696634a5c12a38fdb9daf1c1056eda1e19e
fix(react-container-message-composer): Proptypes error from mention lib
[ { "change_type": "MODIFY", "diff": "@@ -208,7 +208,7 @@ export class MessageComposer extends Component {\n// Only show mentions if this is not a one on one convo\nconst showMentions = props.showMentions && !conversation.getIn(['status', 'isOneOnOne']);\n-\n+ const getData = showMentions ? this.searchForMention : () => {};\nreturn (\n<div className={classNames('ciscospark-message-composer', styles.messageComposer, textAreaFocusStyle)}>\n<FileUploader onSubmit={this.handleSubmit} />\n@@ -225,15 +225,12 @@ export class MessageComposer extends Component {\nrows={1}\nvalue={text}\n>\n- {\n- showMentions\n- && <Mention\n+ <Mention\nclassName={mentionStyles.mentions__mention}\n- data={this.searchForMention}\n+ data={getData}\nrenderSuggestion={MessageComposer.renderSuggestion}\ntrigger=\"@\"\n/>\n- }\n</MentionsInput>\n</div>\n</div>\n", "new_path": "packages/node_modules/@ciscospark/react-container-message-composer/src/container.js", "old_path": "packages/node_modules/@ciscospark/react-container-message-composer/src/container.js" } ]
JavaScript
MIT License
webex/react-widgets
fix(react-container-message-composer): Proptypes error from mention lib
1
fix
react-container-message-composer
807,849
09.03.2018 12:29:14
28,800
55aff64a204509367cb10b3bb6d762b3fdb5f332
chore: remove unused fs-utils exports
[ { "change_type": "MODIFY", "diff": "\"use strict\";\n-jest.mock(\"fs-extra\");\njest.mock(\"path-exists\");\njest.mock(\"@lerna/child-process\");\nconst path = require(\"path\");\n// mocked modules\n-const fs = require(\"fs-extra\");\nconst pathExists = require(\"path-exists\");\nconst ChildProcessUtilities = require(\"@lerna/child-process\");\n// file under test\nconst FileSystemUtilities = require(\"..\");\n-describe(\"FileSystemUtilities\", () => {\n- describe(\".mkdirp()\", () => {\n- it(\"calls fs.ensureDir\", async () => {\n- expect.assertions(1);\n- const dirPath = \"mkdirp/test\";\n-\n- fs.ensureDir.mockResolvedValueOnce();\n-\n- await FileSystemUtilities.mkdirp(dirPath);\n-\n- expect(fs.ensureDir).lastCalledWith(dirPath);\n- });\n- });\n-\n- describe(\".mkdirpSync()\", () => {\n- it(\"calls fs.ensureDirSync\", () => {\n- const dirPath = \"mkdirpSync/test\";\n-\n- FileSystemUtilities.mkdirpSync(dirPath);\n- expect(fs.ensureDirSync).lastCalledWith(dirPath);\n- });\n- });\n-\n- describe(\".readdirSync()\", () => {\n- it(\"calls fs.readdirSync\", () => {\n- const dirPath = \"readdirSync-test\";\n-\n- fs.readdirSync.mockReturnValueOnce([\"a\", \"b\", \"c\"]);\n-\n- expect(FileSystemUtilities.readdirSync(dirPath)).toEqual([\"a\", \"b\", \"c\"]);\n- expect(fs.readdirSync).lastCalledWith(dirPath);\n- });\n- });\n-\n- describe(\".existsSync()\", () => {\n- it(\"calls pathExists.sync\", () => {\n- const filePath = \"existsSync-test\";\n-\n- pathExists.sync.mockReturnValueOnce(true);\n-\n- expect(FileSystemUtilities.existsSync(filePath)).toBe(true);\n- expect(pathExists.sync).lastCalledWith(filePath);\n- });\n- });\n-\n- describe(\".writeFile()\", () => {\n- it(\"calls fs.writeFile\", async () => {\n- expect.assertions(1);\n- const filePath = \"writeFile-test\";\n-\n- fs.writeFile.mockResolvedValueOnce();\n-\n- await FileSystemUtilities.writeFile(filePath, \"contents\");\n- expect(fs.writeFile).lastCalledWith(filePath, \"contents\\n\");\n- });\n- });\n-\n- describe(\".writeFileSync()\", () => {\n- it(\"calls fs.writeFileSync\", () => {\n- const filePath = \"writeFileSync-test\";\n-\n- FileSystemUtilities.writeFileSync(filePath, \"contents\");\n- expect(fs.writeFileSync).lastCalledWith(filePath, \"contents\\n\");\n- });\n- });\n-\n- describe(\".readFileSync()\", () => {\n- it(\"calls fs.readFileSync\", () => {\n- const filePath = \"readFileSync-test\";\n-\n- fs.readFileSync.mockReturnValueOnce(\"contents\\n\");\n-\n- expect(FileSystemUtilities.readFileSync(filePath)).toBe(\"contents\");\n- expect(fs.readFileSync).lastCalledWith(filePath, \"utf8\");\n- });\n- });\n-\n- describe(\".rimraf()\", () => {\n+describe(\"FileSystemUtilities.rimraf()\", () => {\nit(\"calls rimraf CLI with arguments\", async () => {\nexpect.assertions(1);\nconst dirPath = \"rimraf/test\";\n@@ -116,50 +37,3 @@ describe(\"FileSystemUtilities\", () => {\nexpect(ChildProcessUtilities.spawn).not.toBeCalled();\n});\n});\n-\n- describe(\".rename()\", () => {\n- it(\"calls fs.rename\", async () => {\n- expect.assertions(1);\n- const srcPath = \"rename-src\";\n- const dstPath = \"rename-dst\";\n-\n- fs.rename.mockResolvedValueOnce();\n-\n- await FileSystemUtilities.rename(srcPath, dstPath);\n- expect(fs.rename).lastCalledWith(srcPath, dstPath);\n- });\n- });\n-\n- describe(\".renameSync()\", () => {\n- it(\"calls fs.renameSync\", () => {\n- const srcPath = \"renameSync-src\";\n- const dstPath = \"renameSync-dst\";\n-\n- FileSystemUtilities.renameSync(srcPath, dstPath);\n- expect(fs.renameSync).lastCalledWith(srcPath, dstPath);\n- });\n- });\n-\n- describe(\".statSync()\", () => {\n- it(\"calls fs.statSync\", () => {\n- fs.statSync.mockReturnValueOnce({\n- isDirectory: () => true,\n- });\n-\n- const dirPath = \"stat-dir\";\n- const stat = FileSystemUtilities.statSync(dirPath);\n-\n- expect(fs.statSync).lastCalledWith(dirPath);\n- expect(stat.isDirectory()).toBe(true);\n- });\n- });\n-\n- describe(\".unlinkSync()\", () => {\n- it(\"calls fs.unlinkSync\", () => {\n- const filePath = \"unlinkSync-test\";\n-\n- FileSystemUtilities.unlinkSync(filePath);\n- expect(fs.unlinkSync).lastCalledWith(filePath);\n- });\n- });\n-});\n", "new_path": "core/fs-utils/__tests__/fs-utils.test.js", "old_path": "core/fs-utils/__tests__/fs-utils.test.js" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n-const fs = require(\"fs-extra\");\nconst log = require(\"npmlog\");\nconst path = require(\"path\");\nconst pathExists = require(\"path-exists\");\n@@ -10,79 +9,6 @@ const ChildProcessUtilities = require(\"@lerna/child-process\");\n// NOTE: if rimraf moves the location of its executable, this will need to be updated\nconst RIMRAF_CLI = require.resolve(\"rimraf/bin\");\n-function ensureEndsWithNewLine(string) {\n- return /\\n$/.test(string) ? string : `${string}\\n`;\n-}\n-\n-function chmod(filePath, mode) {\n- log.silly(\"chmod\", filePath, mode);\n-\n- return fs.chmod(filePath, mode);\n-}\n-\n-function chmodSync(filePath, mode) {\n- log.silly(\"chmodSync\", filePath, mode);\n- fs.chmodSync(filePath, mode);\n-}\n-\n-function existsSync(filePath) {\n- log.silly(\"existsSync\", filePath);\n- return pathExists.sync(filePath);\n-}\n-\n-function mkdirp(filePath) {\n- log.silly(\"mkdirp\", filePath);\n-\n- return fs.ensureDir(filePath);\n-}\n-\n-function mkdirpSync(filePath) {\n- log.silly(\"mkdirpSync\", filePath);\n- fs.ensureDirSync(filePath);\n-}\n-\n-function readdirSync(filePath) {\n- log.silly(\"readdirSync\", filePath);\n- return fs.readdirSync(filePath);\n-}\n-\n-function rename(fromPath, toPath) {\n- log.silly(\"rename\", [fromPath, toPath]);\n-\n- return fs.rename(fromPath, toPath);\n-}\n-\n-function renameSync(from, to) {\n- log.silly(\"renameSync\", [from, to]);\n- fs.renameSync(from, to);\n-}\n-\n-function writeFile(filePath, fileContents) {\n- log.silly(\"writeFile\", [filePath, fileContents]);\n-\n- return fs.writeFile(filePath, ensureEndsWithNewLine(fileContents));\n-}\n-\n-function writeFileSync(filePath, fileContents) {\n- log.silly(\"writeFileSync\", [filePath, fileContents]);\n- fs.writeFileSync(filePath, ensureEndsWithNewLine(fileContents));\n-}\n-\n-function readFile(filePath) {\n- log.silly(\"readFile\", filePath);\n- return fs.readFile(filePath, \"utf8\").then(content => content.trim());\n-}\n-\n-function readFileSync(filePath) {\n- log.silly(\"readFileSync\", filePath);\n- return fs.readFileSync(filePath, \"utf8\").trim();\n-}\n-\n-function statSync(filePath) {\n- log.silly(\"statSync\", filePath);\n- return fs.statSync(filePath);\n-}\n-\nfunction rimraf(dirPath) {\nlog.silly(\"rimraf\", dirPath);\n// Shelling out to a child process for a noop is expensive.\n@@ -106,23 +32,4 @@ function rimraf(dirPath) {\n});\n}\n-function unlinkSync(filePath) {\n- log.silly(\"unlinkSync\", filePath);\n- fs.unlinkSync(filePath);\n-}\n-\n-exports.chmod = chmod;\n-exports.chmodSync = chmodSync;\n-exports.existsSync = existsSync;\n-exports.mkdirp = mkdirp;\n-exports.mkdirpSync = mkdirpSync;\n-exports.readdirSync = readdirSync;\n-exports.rename = rename;\n-exports.renameSync = renameSync;\n-exports.writeFile = writeFile;\n-exports.writeFileSync = writeFileSync;\n-exports.readFile = readFile;\n-exports.readFileSync = readFileSync;\n-exports.statSync = statSync;\nexports.rimraf = rimraf;\n-exports.unlinkSync = unlinkSync;\n", "new_path": "core/fs-utils/index.js", "old_path": "core/fs-utils/index.js" }, { "change_type": "MODIFY", "diff": "},\n\"dependencies\": {\n\"@lerna/child-process\": \"file:../child-process\",\n- \"fs-extra\": \"^5.0.0\",\n\"npmlog\": \"^4.1.2\",\n- \"path-exists\": \"^3.0.0\"\n+ \"path-exists\": \"^3.0.0\",\n+ \"rimraf\": \"^2.6.2\"\n}\n}\n", "new_path": "core/fs-utils/package.json", "old_path": "core/fs-utils/package.json" }, { "change_type": "MODIFY", "diff": "\"version\": \"file:core/fs-utils\",\n\"requires\": {\n\"@lerna/child-process\": \"file:core/child-process\",\n- \"fs-extra\": \"5.0.0\",\n\"npmlog\": \"4.1.2\",\n- \"path-exists\": \"3.0.0\"\n+ \"path-exists\": \"3.0.0\",\n+ \"rimraf\": \"2.6.2\"\n}\n},\n\"@lerna/get-npm-exec-opts\": {\n", "new_path": "package-lock.json", "old_path": "package-lock.json" } ]
JavaScript
MIT License
lerna/lerna
chore: remove unused fs-utils exports
1
chore
null
807,849
09.03.2018 13:15:07
28,800
30451edb709740e64ea7dbf789daa8a862c6ac65
feat: Rename =>
[ { "change_type": "MODIFY", "diff": "\"use strict\";\n+jest.mock(\"@lerna/rimraf-dir\");\njest.mock(\"@lerna/npm-install\");\njest.mock(\"@lerna/run-lifecycle\");\njest.mock(\"@lerna/create-symlink\");\n@@ -8,7 +9,7 @@ const fs = require(\"fs-extra\");\nconst path = require(\"path\");\n// mocked or stubbed modules\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\n+const rimrafDir = require(\"@lerna/rimraf-dir\");\nconst npmInstall = require(\"@lerna/npm-install\");\nconst runLifecycle = require(\"@lerna/run-lifecycle\");\nconst createSymlink = require(\"@lerna/create-symlink\");\n@@ -41,6 +42,9 @@ const ranScriptsInDirectories = testDir =>\nreturn obj;\n}, {});\n+const removedDirectories = testDir =>\n+ rimrafDir.mock.calls.map(([directory]) => normalizeRelativeDir(testDir, directory));\n+\nconst symlinkedDirectories = testDir =>\ncreateSymlink.mock.calls\n.slice()\n@@ -53,6 +57,9 @@ const symlinkedDirectories = testDir =>\n}));\ndescribe(\"BootstrapCommand\", () => {\n+ // stub rimraf because we trust isaacs\n+ rimrafDir.mockResolvedValue();\n+\n// we stub npmInstall in most tests because\n// we already have enough tests of npmInstall\nnpmInstall.mockResolvedValue();\n@@ -85,20 +92,6 @@ describe(\"BootstrapCommand\", () => {\n});\ndescribe(\"with hoisting\", () => {\n- // stub rimraf because we trust isaacs\n- const fsRimraf = FileSystemUtilities.rimraf;\n-\n- beforeEach(() => {\n- FileSystemUtilities.rimraf = jest.fn(() => Promise.resolve());\n- });\n-\n- afterEach(() => {\n- FileSystemUtilities.rimraf = fsRimraf;\n- });\n-\n- const removedDirectories = testDir =>\n- FileSystemUtilities.rimraf.mock.calls.map(([directory]) => normalizeRelativeDir(testDir, directory));\n-\nit(\"should hoist\", async () => {\nconst testDir = await initFixture(\"basic\");\n", "new_path": "commands/bootstrap/__tests__/bootstrap-command.test.js", "old_path": "commands/bootstrap/__tests__/bootstrap-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -10,7 +10,7 @@ const pMapSeries = require(\"p-map-series\");\nconst pWaterfall = require(\"p-waterfall\");\nconst Command = require(\"@lerna/command\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\n+const rimrafDir = require(\"@lerna/rimraf-dir\");\nconst npmInstall = require(\"@lerna/npm-install\");\nconst runLifecycle = require(\"@lerna/run-lifecycle\");\nconst batchPackages = require(\"@lerna/batch-packages\");\n@@ -415,7 +415,7 @@ class BootstrapCommand extends Command {\nreturn pMap(\ncandidates,\ndirPath =>\n- FileSystemUtilities.rimraf(dirPath).then(() => {\n+ rimrafDir(dirPath).then(() => {\ntracker.verbose(\"prune\", dirPath);\ntracker.completeWork(1);\n}),\n", "new_path": "commands/bootstrap/index.js", "old_path": "commands/bootstrap/index.js" }, { "change_type": "MODIFY", "diff": "\"@lerna/batch-packages\": \"file:../../utils/batch-packages\",\n\"@lerna/command\": \"file:../../core/command\",\n\"@lerna/filter-options\": \"file:../../core/filter-options\",\n- \"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/match-package-name\": \"file:../../utils/match-package-name\",\n\"@lerna/npm-install\": \"file:../../utils/npm-install\",\n+ \"@lerna/rimraf-dir\": \"file:../../utils/rimraf-dir\",\n\"@lerna/run-lifecycle\": \"file:../../utils/run-lifecycle\",\n\"@lerna/run-parallel-batches\": \"file:../../utils/run-parallel-batches\",\n\"@lerna/symlink-binary\": \"file:../../utils/symlink-binary\",\n", "new_path": "commands/bootstrap/package.json", "old_path": "commands/bootstrap/package.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n+jest.mock(\"@lerna/rimraf-dir\");\njest.mock(\"@lerna/prompt\");\nconst fs = require(\"fs-extra\");\nconst path = require(\"path\");\n// mocked or stubbed modules\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\n+const rimrafDir = require(\"@lerna/rimraf-dir\");\nconst PromptUtilities = require(\"@lerna/prompt\");\n// helpers\n@@ -18,17 +19,12 @@ const lernaClean = require(\"@lerna-test/command-runner\")(require(\"../command\"));\n// assertion helpers\nconst removedDirectories = testDir =>\n- FileSystemUtilities.rimraf.mock.calls.map(([directory]) => normalizeRelativeDir(testDir, directory));\n+ rimrafDir.mock.calls.map(([directory]) => normalizeRelativeDir(testDir, directory));\ndescribe(\"CleanCommand\", () => {\n// stub rimraf because we trust isaacs\n- const fsRimraf = FileSystemUtilities.rimraf;\n- beforeEach(() => {\n- FileSystemUtilities.rimraf = jest.fn(() => Promise.resolve());\n- });\n- afterEach(() => {\n- FileSystemUtilities.rimraf = fsRimraf;\n- });\n+ // .mockResolvedValue() doesn't work when you want to reject it later\n+ rimrafDir.mockImplementation(() => Promise.resolve());\nPromptUtilities.confirm.mockResolvedValue(true);\n@@ -85,7 +81,7 @@ describe(\"CleanCommand\", () => {\nconst testDir = await initFixture(\"basic\");\n- FileSystemUtilities.rimraf.mockImplementationOnce(() => Promise.reject(new Error(\"whoops\")));\n+ rimrafDir.mockImplementationOnce(() => Promise.reject(new Error(\"whoops\")));\ntry {\nawait lernaClean(testDir)();\n", "new_path": "commands/clean/__tests__/clean-command.test.js", "old_path": "commands/clean/__tests__/clean-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -4,7 +4,7 @@ const path = require(\"path\");\nconst pMap = require(\"p-map\");\nconst Command = require(\"@lerna/command\");\n-const FileSystemUtilities = require(\"@lerna/fs-utils\");\n+const rimrafDir = require(\"@lerna/rimraf-dir\");\nconst PromptUtilities = require(\"@lerna/prompt\");\nclass CleanCommand extends Command {\n@@ -33,7 +33,7 @@ class CleanCommand extends Command {\nconst mapper = dirPath => {\ntracker.info(\"clean\", \"removing\", dirPath);\n- return FileSystemUtilities.rimraf(dirPath).then(() => {\n+ return rimrafDir(dirPath).then(() => {\ntracker.completeWork(1);\n});\n};\n", "new_path": "commands/clean/index.js", "old_path": "commands/clean/index.js" }, { "change_type": "MODIFY", "diff": "\"dependencies\": {\n\"@lerna/command\": \"file:../../core/command\",\n\"@lerna/filter-options\": \"file:../../core/filter-options\",\n- \"@lerna/fs-utils\": \"file:../../core/fs-utils\",\n\"@lerna/prompt\": \"file:../../core/prompt\",\n+ \"@lerna/rimraf-dir\": \"file:../../utils/rimraf-dir\",\n\"p-map\": \"^1.2.0\",\n\"p-map-series\": \"^1.0.0\",\n\"p-waterfall\": \"^1.0.0\"\n", "new_path": "commands/clean/package.json", "old_path": "commands/clean/package.json" }, { "change_type": "DELETE", "diff": "-# `@lerna/fs-utils`\n-\n-> description TODO\n-\n-## Usage\n-\n-TODO\n", "new_path": null, "old_path": "core/fs-utils/README.md" }, { "change_type": "MODIFY", "diff": "\"@lerna/batch-packages\": \"file:utils/batch-packages\",\n\"@lerna/command\": \"file:core/command\",\n\"@lerna/filter-options\": \"file:core/filter-options\",\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/match-package-name\": \"file:utils/match-package-name\",\n\"@lerna/npm-install\": \"file:utils/npm-install\",\n+ \"@lerna/rimraf-dir\": \"file:utils/rimraf-dir\",\n\"@lerna/run-lifecycle\": \"file:utils/run-lifecycle\",\n\"@lerna/run-parallel-batches\": \"file:utils/run-parallel-batches\",\n\"@lerna/symlink-binary\": \"file:utils/symlink-binary\",\n\"requires\": {\n\"@lerna/command\": \"file:core/command\",\n\"@lerna/filter-options\": \"file:core/filter-options\",\n- \"@lerna/fs-utils\": \"file:core/fs-utils\",\n\"@lerna/prompt\": \"file:core/prompt\",\n+ \"@lerna/rimraf-dir\": \"file:utils/rimraf-dir\",\n\"p-map\": \"1.2.0\",\n\"p-map-series\": \"1.0.0\",\n\"p-waterfall\": \"1.0.0\"\n\"@lerna/validation-error\": \"file:core/validation-error\"\n}\n},\n- \"@lerna/fs-utils\": {\n- \"version\": \"file:core/fs-utils\",\n- \"requires\": {\n- \"@lerna/child-process\": \"file:core/child-process\",\n- \"npmlog\": \"4.1.2\",\n- \"path-exists\": \"3.0.0\",\n- \"rimraf\": \"2.6.2\"\n- }\n- },\n\"@lerna/get-npm-exec-opts\": {\n\"version\": \"file:utils/get-npm-exec-opts\",\n\"requires\": {\n\"read-cmd-shim\": \"1.0.1\"\n}\n},\n+ \"@lerna/rimraf-dir\": {\n+ \"version\": \"file:utils/rimraf-dir\",\n+ \"requires\": {\n+ \"@lerna/child-process\": \"file:core/child-process\",\n+ \"npmlog\": \"4.1.2\",\n+ \"path-exists\": \"3.0.0\",\n+ \"rimraf\": \"2.6.2\"\n+ }\n+ },\n\"@lerna/run\": {\n\"version\": \"file:commands/run\",\n\"requires\": {\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "ADD", "diff": "+# `@lerna/rimraf-dir`\n+\n+> Run rimraf on a directory in a subprocess to hack around slowness\n+\n+## Usage\n+\n+```js\n+const rimrafDir = require(\"@lerna/rimraf-dir\");\n+\n+rimrafDir(\"/path/to/directory\").then(removedDir => {\n+ console.log(\"removed\", removedDir);\n+});\n+```\n", "new_path": "utils/rimraf-dir/README.md", "old_path": null }, { "change_type": "RENAME", "diff": "@@ -10,18 +10,18 @@ const pathExists = require(\"path-exists\");\nconst ChildProcessUtilities = require(\"@lerna/child-process\");\n// file under test\n-const FileSystemUtilities = require(\"..\");\n+const rimrafDir = require(\"..\");\n-describe(\"FileSystemUtilities.rimraf()\", () => {\n+describe(\"rimrafDir()\", () => {\nit(\"calls rimraf CLI with arguments\", async () => {\n- expect.assertions(1);\nconst dirPath = \"rimraf/test\";\npathExists.mockResolvedValueOnce(true);\nChildProcessUtilities.spawn.mockResolvedValueOnce();\n- await FileSystemUtilities.rimraf(dirPath);\n+ const removedPath = await rimrafDir(dirPath);\n+ expect(removedPath).toBe(dirPath);\nexpect(ChildProcessUtilities.spawn).lastCalledWith(process.execPath, [\nrequire.resolve(\"rimraf/bin\"),\n\"--no-glob\",\n@@ -30,10 +30,11 @@ describe(\"FileSystemUtilities.rimraf()\", () => {\n});\nit(\"does not attempt to delete a non-existent directory\", async () => {\n- expect.assertions(1);\npathExists.mockResolvedValueOnce(false);\n- await FileSystemUtilities.rimraf(\"rimraf/non-existent\");\n+ const removedPath = await rimrafDir(\"rimraf/non-existent\");\n+\n+ expect(removedPath).toBe(undefined);\nexpect(ChildProcessUtilities.spawn).not.toBeCalled();\n});\n});\n", "new_path": "utils/rimraf-dir/__tests__/rimraf-dir.test.js", "old_path": "core/fs-utils/__tests__/fs-utils.test.js" }, { "change_type": "RENAME", "diff": "{\n- \"name\": \"@lerna/fs-utils\",\n+ \"name\": \"@lerna/rimraf-dir\",\n\"version\": \"3.0.0-beta.0\",\n- \"description\": \"TODO\",\n+ \"description\": \"Run rimraf on a directory in a subprocess to hack around slowness\",\n\"keywords\": [\n\"lerna\",\n\"utils\"\n\"url\": \"https://github.com/evocateur\"\n},\n\"files\": [\n- \"index.js\"\n+ \"rimraf-dir.js\"\n],\n- \"main\": \"index.js\",\n+ \"main\": \"rimraf-dir.js\",\n\"engines\": {\n\"node\": \">= 6.9.0\"\n},\n\"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n},\n\"dependencies\": {\n- \"@lerna/child-process\": \"file:../child-process\",\n+ \"@lerna/child-process\": \"file:../../core/child-process\",\n\"npmlog\": \"^4.1.2\",\n\"path-exists\": \"^3.0.0\",\n\"rimraf\": \"^2.6.2\"\n", "new_path": "utils/rimraf-dir/package.json", "old_path": "core/fs-utils/package.json" }, { "change_type": "RENAME", "diff": "@@ -9,8 +9,10 @@ const ChildProcessUtilities = require(\"@lerna/child-process\");\n// NOTE: if rimraf moves the location of its executable, this will need to be updated\nconst RIMRAF_CLI = require.resolve(\"rimraf/bin\");\n-function rimraf(dirPath) {\n- log.silly(\"rimraf\", dirPath);\n+module.exports = rimrafDir;\n+\n+function rimrafDir(dirPath) {\n+ log.silly(\"rimrafDir\", dirPath);\n// Shelling out to a child process for a noop is expensive.\n// Checking if `dirPath` exists to be removed is cheap.\n// This lets us short-circuit if we don't have anything to do.\n@@ -27,9 +29,9 @@ function rimraf(dirPath) {\n// We call this resolved CLI path in the \"path/to/node path/to/cli <..args>\"\n// pattern to avoid Windows hangups with shebangs (e.g., WSH can't handle it)\nreturn ChildProcessUtilities.spawn(process.execPath, args).then(() => {\n- log.verbose(\"rimraf\", \"removed\", dirPath);\n+ log.verbose(\"rimrafDir\", \"removed\", dirPath);\n+\n+ return dirPath;\n});\n});\n}\n-\n-exports.rimraf = rimraf;\n", "new_path": "utils/rimraf-dir/rimraf-dir.js", "old_path": "core/fs-utils/index.js" } ]
JavaScript
MIT License
lerna/lerna
feat: Rename @lerna/fs-utils => @lerna/rimraf-dir
1
feat
null
217,922
09.03.2018 14:10:14
-3,600
1a06d08329907ef2d526319031c9765f1e7c7af1
chore: add conventional commits badge
[ { "change_type": "MODIFY", "diff": "@@ -8,6 +8,9 @@ Discord for support, bugs discussion and contributors: https://discord.gg/r6qxt6\n## Development\n+[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n+\n+\n### Prepare your environment\n* Install [Node.js](http://nodejs.org/) (>= 8.2) and NPM (>=5.3)\n* Install local dev dependencies: `npm install` while current directory is this repo\n", "new_path": "README.md", "old_path": "README.md" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
chore: add conventional commits badge
1
chore
null
679,913
09.03.2018 14:11:38
0
e96cc991ed99e4319d5b7ad32292bac8621bdf43
refactor(atom): minor update event bus, add/update docs
[ { "change_type": "MODIFY", "diff": "@@ -6,24 +6,45 @@ import { isPromise } from \"@thi.ng/checks/is-promise\";\nimport * as api from \"./api\";\nimport { setIn, updateIn } from \"./path\";\n+const FX_CANCEL = api.FX_CANCEL;\n+const FX_DISPATCH_NOW = api.FX_DISPATCH_NOW;\n+const FX_STATE = api.FX_STATE;\n+\n/**\n- * Batched event processor for using composable interceptors for event handling\n- * and side effects to execute the result of handled events.\n+ * Batched event processor for using composable interceptors for event\n+ * handling and side effects to execute the result of handled events.\n+ *\n+ * Events processed by this class are simple 2-element tuples/arrays of\n+ * this form: `[\"event-id\", payload?]`, where the `payload` is optional\n+ * and can be any data.\n*\n- * In this model an event handler is an array of objects with `pre` and/or `post`\n- * keys and functions attached to each key. These functions are called interceptors,\n- * since each intercepts the processing of an event and can contribute their\n- * own side effects. The outcome of this setup is a more aspect-oriented, composable\n- * approach to event handling and allows to inject common, re-usable behaviors\n- * for multiple event types (tracing, validation, undo/redo triggers etc.)\n+ * Events are processed by registered handlers which transform each\n+ * event into a number of side effects to be executed later. This\n+ * separation ensures event handlers themselves are pure functions and\n+ * too leads to more efficient reuse of side effecting operations. The\n+ * pure data nature until the last stage of processing (the application\n+ * side effects) also means event flow can be much easier inspected and\n+ * debugged.\n*\n- * The overall approach of this type of event processing is heavily based on the\n- * pattern initially pioneered by @Day8/re-frame, with the following differences:\n+ * In this model an event handler itself is an array of objects with\n+ * `pre` and/or `post` keys and functions attached to each key. These\n+ * functions are called interceptors, since each intercepts the\n+ * processing of an event and can contribute their own side effects. The\n+ * outcome of this setup is a more aspect-oriented, composable approach\n+ * to event handling and allows to inject common, re-usable behaviors\n+ * for multiple event types (logging, validation, undo/redo triggers\n+ * etc.)\n*\n- * - standalone implementation (no assumptions about surrounding context/framework)\n+ * The overall approach of this type of event processing is heavily\n+ * based on the pattern initially pioneered by @Day8/re-frame, with the\n+ * following differences:\n+ *\n+ * - standalone implementation (no assumptions about surrounding\n+ * context/framework)\n* - manual trigger of event queue processing\n* - supports event cancellation\n- * - side effect collection (multiple side effects for same effect type per frame)\n+ * - side effect collection (multiple side effects for same effect type\n+ * per frame)\n* - side effect priorities (to better control execution order)\n* - dynamic addition/removal of handlers & effects\n*/\n@@ -46,7 +67,6 @@ export class EventBus implements\nthis.effects = {};\nthis.eventQueue = [];\nthis.priorities = [];\n- this.currQueue = this.currCtx = null;\nthis.addBuiltIns();\nif (handlers) {\nthis.addHandlers(handlers);\n@@ -72,8 +92,8 @@ export class EventBus implements\n*\n* #### `EV_UPDATE_VALUE`\n*\n- * Updates a state path's value with provided function and\n- * optional extra arguments. See `updateIn()`.\n+ * Updates a state path's value with provided function and optional\n+ * extra arguments. See `updateIn()`.\n*\n* Example event definition:\n* ```\n@@ -82,22 +102,22 @@ export class EventBus implements\n*\n* ### Side effects\n*\n- * #### FX_DISPATCH\n- * #### FX_DISPATCH_ASYNC\n- * #### FX_STATE\n+ * #### `FX_DISPATCH`\n+ * #### `FX_DISPATCH_ASYNC`\n+ * #### `FX_STATE`\n*\n*/\naddBuiltIns(): any {\n// handlers\nthis.addHandler(api.EV_SET_VALUE,\n(state, [_, [path, val]]) =>\n- ({ [api.FX_STATE]: setIn(state, path, val) }));\n+ ({ [FX_STATE]: setIn(state, path, val) }));\nthis.addHandler(api.EV_UPDATE_VALUE,\n(state, [_, [path, fn, ...args]]) =>\n- ({ [api.FX_STATE]: updateIn(state, path, fn, ...args) }));\n+ ({ [FX_STATE]: updateIn(state, path, fn, ...args) }));\n// effects\n- this.addEffect(api.FX_STATE, (x) => this.state.reset(x), -1000);\n+ this.addEffect(FX_STATE, (x) => this.state.reset(x), -1000);\nthis.addEffect(api.FX_DISPATCH, (e) => this.dispatch(e), -999);\nthis.addEffect(api.FX_DISPATCH_ASYNC,\n([id, arg, success, err]) => {\n@@ -199,8 +219,8 @@ export class EventBus implements\n}\n/**\n- * Adds given event to event queue to be processed\n- * by `processQueue()` later on.\n+ * Adds given event to event queue to be processed by\n+ * `processQueue()` later on.\n*\n* @param e\n*/\n@@ -209,12 +229,10 @@ export class EventBus implements\n}\n/**\n- * Adds given event to whatever is the current\n- * event queue. If triggered via the `FX_DISPATCH_NOW`\n- * side effect the event will still be executed\n- * in the currently active batch. If called from\n- * elsewhere, the result is the same as calling\n- * `dispatch()`.\n+ * Adds given event to whatever is the current event queue. If\n+ * triggered via the `FX_DISPATCH_NOW` side effect the event will\n+ * still be executed in the currently active batch. If called from\n+ * elsewhere, the result is the same as calling `dispatch()`.\n*\n* @param e\n*/\n@@ -223,25 +241,23 @@ export class EventBus implements\n}\n/**\n- * Triggers processing of current event queue and\n- * returns `true` if the any of the processed events\n- * caused a state change.\n- *\n- * If an event handler triggers the `FX_DISPATCH_NOW`\n- * side effect, the new event will be added to the\n- * currently processed batch and therefore executed\n- * in the same frame. Also see `dispatchNow()`.\n+ * Triggers processing of current event queue and returns `true` if\n+ * the any of the processed events caused a state change.\n+ *\n+ * If an event handler triggers the `FX_DISPATCH_NOW` side effect,\n+ * the new event will be added to the currently processed batch and\n+ * therefore executed in the same frame. Also see `dispatchNow()`.\n*/\nprocessQueue() {\nif (this.eventQueue.length > 0) {\nconst prev = this.state.deref();\nthis.currQueue = [...this.eventQueue];\nthis.eventQueue.length = 0;\n- let fx = this.currCtx = { [api.FX_STATE]: prev };\n+ const fx = this.currCtx = { [FX_STATE]: prev };\nfor (let e of this.currQueue) {\nthis.processEvent(fx, e);\n}\n- this.currQueue = this.currCtx = null;\n+ this.currQueue = this.currCtx = undefined;\nthis.processEffects(fx);\nreturn this.state.deref() !== prev;\n}\n@@ -250,30 +266,30 @@ export class EventBus implements\n/**\n* Processes a single event using its configured handler/interceptor\n- * chain. Logs warning message and skips processing if no handler\n- * is available for the event type.\n+ * chain. Logs warning message and skips processing if no handler is\n+ * available for the event type.\n*\n* The array of interceptors is processed in bi-directional order.\n- * First any `pre` interceptors are processed in forward order.\n- * Then `post` interceptors are processed in reverse.\n+ * First any `pre` interceptors are processed in forward order. Then\n+ * `post` interceptors are processed in reverse.\n*\n* Each interceptor can return a result object of side effects,\n* which are being merged and collected for `processEffects()`.\n*\n- * Any interceptor can trigger zero or more known side effects,\n- * each (side effect) will be collected in an array to support\n- * multiple invocations of the same effect type per frame. If no\n- * side effects are requested, an interceptor can return `undefined`.\n+ * Any interceptor can trigger zero or more known side effects, each\n+ * (side effect) will be collected in an array to support multiple\n+ * invocations of the same effect type per frame. If no side effects\n+ * are requested, an interceptor can return `undefined`.\n*\n- * Processing of the current event stops immediatedly, if an interceptor\n- * sets the `FX_CANCEL` side effect key to `true`. However, the results\n- * of any previous interceptors (incl. the one which cancelled) are kept\n- * and processed further as usual.\n+ * Processing of the current event stops immediatedly, if an\n+ * interceptor sets the `FX_CANCEL` side effect key to `true`.\n+ * However, the results of any previous interceptors (incl. the one\n+ * which cancelled) are kept and processed further as usual.\n*\n* @param fx\n* @param e\n*/\n- protected processEvent(fx: any, e: api.Event) {\n+ protected processEvent(fx: api.InterceptorContext, e: api.Event) {\nconst iceps = this.handlers[e[0]];\nif (!iceps) {\nconsole.warn(`missing handler for event type: ${e[0]}`);\n@@ -281,39 +297,38 @@ export class EventBus implements\n}\nconst n = iceps.length - 1;\nlet hasPost = false;\n- for (let i = 0; i <= n && !fx[api.FX_CANCEL]; i++) {\n+ for (let i = 0; i <= n && !fx[FX_CANCEL]; i++) {\nconst icep = iceps[i];\nif (icep.pre) {\n- this.mergeEffects(fx, icep.pre(fx[api.FX_STATE], e, this));\n+ this.mergeEffects(fx, icep.pre(fx[FX_STATE], e, this));\n}\nhasPost = hasPost || !!icep.post;\n}\nif (!hasPost) {\nreturn;\n}\n- for (let i = n; i >= 0 && !fx[api.FX_CANCEL]; i--) {\n+ for (let i = n; i >= 0 && !fx[FX_CANCEL]; i--) {\nconst icep = iceps[i];\nif (icep.post) {\n- this.mergeEffects(fx, icep.post(fx[api.FX_STATE], e, this));\n+ this.mergeEffects(fx, icep.post(fx[FX_STATE], e, this));\n}\n}\n}\n/**\n- * Takes a collection of side effects generated during\n- * event processing and applies them in order of configured\n- * priorities.\n+ * Takes a collection of side effects generated during event\n+ * processing and applies them in order of configured priorities.\n*\n* @param fx\n*/\n- protected processEffects(fx: any) {\n+ protected processEffects(fx: api.InterceptorContext) {\nconst effects = this.effects;\nfor (let p of this.priorities) {\nconst id = p[0];\nconst val = fx[id];\nif (val !== undefined) {\nconst fn = effects[id];\n- if (id !== api.FX_STATE) {\n+ if (id !== FX_STATE) {\nfor (let v of val) {\nfn(v, this);\n}\n@@ -325,24 +340,24 @@ export class EventBus implements\n}\n/**\n- * Merges the new side effects returned from an interceptor\n- * into the internal effect accumulator.\n+ * Merges the new side effects returned from an interceptor into the\n+ * internal effect accumulator.\n*\n* Any events assigned to the `FX_DISPATCH_NOW` effect key are\n* immediately added to the currently active event batch.\n*\n- * If an interceptor wishes to cause multiple invocations of\n- * a single side effect type (e.g. dispatch multiple other events),\n- * it MUST return an array of these values. The only exceptions\n- * to this are the following effects, which for obvious reasons\n- * can only accept a single value:\n+ * If an interceptor wishes to cause multiple invocations of a\n+ * single side effect type (e.g. dispatch multiple other events), it\n+ * MUST return an array of these values. The only exceptions to this\n+ * are the following effects, which for obvious reasons can only\n+ * accept a single value:\n*\n* - `FX_CANCEL`\n* - `FX_STATE`\n*\n- * Note that because of this support (of multiple values),\n- * the value of a single side effect SHOULD NOT be a nested array\n- * itself, or rather not its first item.\n+ * Note that because of this support (of multiple values), the value\n+ * of a single side effect MUST NOT be a nested array itself, or\n+ * rather not its first item.\n*\n* For example:\n*\n@@ -357,15 +372,15 @@ export class EventBus implements\n* @param fx\n* @param ret\n*/\n- protected mergeEffects(fx: any, ret: any) {\n+ protected mergeEffects(fx: api.InterceptorContext, ret: any) {\nif (!ret) {\nreturn;\n}\nfor (let k in ret) {\nconst v = ret[k];\n- if (k === api.FX_STATE || k === api.FX_CANCEL) {\n+ if (k === FX_STATE || k === FX_CANCEL) {\nfx[k] = v;\n- } else if (k === api.FX_DISPATCH_NOW) {\n+ } else if (k === FX_DISPATCH_NOW) {\nif (isArray(v[0])) {\nfor (let e of v) {\nthis.dispatchNow(e);\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(atom): minor update event bus, add/update docs
1
refactor
atom
217,922
09.03.2018 14:12:28
-3,600
27ce9f0405962186245b206d85130b2034048167
build: fix for deployment
[ { "change_type": "MODIFY", "diff": "@@ -7,11 +7,8 @@ before_install:\n- export DISPLAY=:99.0\n- sh -e /etc/init.d/xvfb start\n-before_script:\n- - npm install -g @angular/cli\n-\nscript:\n- - if [ \"$TRAVIS_BRANCH\" = \"beta\" ]; then npm run build:beta; else npm run build:prod; fi\n+ - if [ $TRAVIS_BRANCH = \"beta\" ]; then npm run build:beta; else npm run build:prod; fi\ndeploy:\n- provider: firebase\n@@ -23,7 +20,7 @@ deploy:\n- provider: firebase\nskip_cleanup: true\non:\n- condition: if [[ $TRAVIS_COMMIT_MESSAGE != \"chore\"* ]];\n+ condition: if [[ $TRAVIS_COMMIT_MESSAGE != chore* ]];\ntoken:\nsecure: m+OWcJipxF84Awq3rW3GZ+kH5WMOYYvYjn5Pj82Y+k9MRSA6MPqsk6bviOTcHK6R3hgif907ANnoqnDWLlF+AGh5F+eMfv4B/BFbqpKHkUUNz2FMgYRK+enSdovvvJQvm4EExOsrUA5jdZt0rPwXf5G3I3x3ZkFZb6c77UYjN7Kr/MoLNidGiDI7egkymRIkHSgfh8MWkZ4+QFAbHZER+DxRkQrMwvlVEbBSpY5OqPdaCflSL5MIFrRyXN4qWnPAyrx5dSegMTr5l6NWWS65Avk0fUucux7U2kRIkCnZ+11oE2qTjlE6U65zMxF9IU3VAqtOnt3KObQBO4WvPccLOev2tbg03t3bWC2TK4I/HkNPKwyqV6+iou9os6JSn7BEDCJiPmL9IGVzyzfwUyFSSMrNxjpZwUWvCkAxZbq5vMX5J+F4uhnPEIE1ZsuFlaKHn0NxQAgoFeH4cmTY3FPqtRb1vO/ndRlc/Z0IHY/UeEdS2aUVyb24xinudRXfqmZMZGVze2vzA5KEzY6tGqT23IKfWaRWY6imDiW7iDei6yvA70cz49veIHdxgVPNdqjjUtpt+oT5OtG7lxAGQJMjwyMKu52ARCuoP/spCxRrxudtVsxnzp8JynJgqDLydtKW5pn0lTAM/6u5Z+ga3DnIstrI0tuh+VXYT4ZztMH6j+Q=\n", "new_path": ".travis.yml", "old_path": ".travis.yml" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
build: fix for deployment
1
build
null
217,922
09.03.2018 14:13:52
-3,600
27b787b5c0663684b2c0087bcbc90b34f224a713
build: fix for deployment of beta version
[ { "change_type": "MODIFY", "diff": "@@ -19,8 +19,9 @@ deploy:\nsecure: m+OWcJipxF84Awq3rW3GZ+kH5WMOYYvYjn5Pj82Y+k9MRSA6MPqsk6bviOTcHK6R3hgif907ANnoqnDWLlF+AGh5F+eMfv4B/BFbqpKHkUUNz2FMgYRK+enSdovvvJQvm4EExOsrUA5jdZt0rPwXf5G3I3x3ZkFZb6c77UYjN7Kr/MoLNidGiDI7egkymRIkHSgfh8MWkZ4+QFAbHZER+DxRkQrMwvlVEbBSpY5OqPdaCflSL5MIFrRyXN4qWnPAyrx5dSegMTr5l6NWWS65Avk0fUucux7U2kRIkCnZ+11oE2qTjlE6U65zMxF9IU3VAqtOnt3KObQBO4WvPccLOev2tbg03t3bWC2TK4I/HkNPKwyqV6+iou9os6JSn7BEDCJiPmL9IGVzyzfwUyFSSMrNxjpZwUWvCkAxZbq5vMX5J+F4uhnPEIE1ZsuFlaKHn0NxQAgoFeH4cmTY3FPqtRb1vO/ndRlc/Z0IHY/UeEdS2aUVyb24xinudRXfqmZMZGVze2vzA5KEzY6tGqT23IKfWaRWY6imDiW7iDei6yvA70cz49veIHdxgVPNdqjjUtpt+oT5OtG7lxAGQJMjwyMKu52ARCuoP/spCxRrxudtVsxnzp8JynJgqDLydtKW5pn0lTAM/6u5Z+ga3DnIstrI0tuh+VXYT4ZztMH6j+Q=\n- provider: firebase\nskip_cleanup: true\n+ project: \"ffxivteamcraft-beta\"\non:\n- condition: if [[ $TRAVIS_COMMIT_MESSAGE != chore* ]];\n+ branch: beta\ntoken:\nsecure: m+OWcJipxF84Awq3rW3GZ+kH5WMOYYvYjn5Pj82Y+k9MRSA6MPqsk6bviOTcHK6R3hgif907ANnoqnDWLlF+AGh5F+eMfv4B/BFbqpKHkUUNz2FMgYRK+enSdovvvJQvm4EExOsrUA5jdZt0rPwXf5G3I3x3ZkFZb6c77UYjN7Kr/MoLNidGiDI7egkymRIkHSgfh8MWkZ4+QFAbHZER+DxRkQrMwvlVEbBSpY5OqPdaCflSL5MIFrRyXN4qWnPAyrx5dSegMTr5l6NWWS65Avk0fUucux7U2kRIkCnZ+11oE2qTjlE6U65zMxF9IU3VAqtOnt3KObQBO4WvPccLOev2tbg03t3bWC2TK4I/HkNPKwyqV6+iou9os6JSn7BEDCJiPmL9IGVzyzfwUyFSSMrNxjpZwUWvCkAxZbq5vMX5J+F4uhnPEIE1ZsuFlaKHn0NxQAgoFeH4cmTY3FPqtRb1vO/ndRlc/Z0IHY/UeEdS2aUVyb24xinudRXfqmZMZGVze2vzA5KEzY6tGqT23IKfWaRWY6imDiW7iDei6yvA70cz49veIHdxgVPNdqjjUtpt+oT5OtG7lxAGQJMjwyMKu52ARCuoP/spCxRrxudtVsxnzp8JynJgqDLydtKW5pn0lTAM/6u5Z+ga3DnIstrI0tuh+VXYT4ZztMH6j+Q=\n", "new_path": ".travis.yml", "old_path": ".travis.yml" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
build: fix for deployment of beta version
1
build
null
679,913
09.03.2018 14:25:15
0
3bf9fbaa5d66e2f8aeda2f7f5da26611e8d80322
docs(atom): update all doc strings
[ { "change_type": "MODIFY", "diff": "@@ -6,8 +6,8 @@ import { setIn, updateIn } from \"./path\";\nimport { View } from \"./view\";\n/**\n- * Mutable wrapper for an (usually) immutable value.\n- * Support for watches.\n+ * Mutable wrapper for an (usually) immutable value. Support for\n+ * watches.\n*/\n@IWatch\nexport class Atom<T> implements\n", "new_path": "packages/atom/src/atom.ts", "old_path": "packages/atom/src/atom.ts" }, { "change_type": "MODIFY", "diff": "@@ -6,11 +6,11 @@ import { getIn, setIn, updateIn } from \"./path\";\nimport { View } from \"./view\";\n/**\n- * Undo/redo history stack wrapper for atoms and cursors.\n- * Implements `IAtom` interface and so can be used directly in place\n- * and delegates to wrapped atom/cursor. Value changes are only\n- * recorded in history if `changed` predicate returns truthy value,\n- * or else by calling `record()` directly.\n+ * Undo/redo history stack wrapper for atoms and cursors. Implements\n+ * `IAtom` interface and so can be used directly in place and delegates\n+ * to wrapped atom/cursor. Value changes are only recorded in history if\n+ * `changed` predicate returns truthy value, or else by calling\n+ * `record()` directly.\n*/\nexport class History<T> implements\nIAtom<T> {\n@@ -118,12 +118,13 @@ export class History<T> implements\n/**\n* Records given state in history. This method is only needed when\n- * manually managing snapshots, i.e. when applying multiple swaps\n- * on the wrapped atom directly, but not wanting to create an\n- * history entry for each change. **DO NOT call this explicitly if\n- * using `History.reset()` / `History.swap()`**.\n+ * manually managing snapshots, i.e. when applying multiple swaps on\n+ * the wrapped atom directly, but not wanting to create an history\n+ * entry for each change. **DO NOT call this explicitly if using\n+ * `History.reset()` / `History.swap()`**.\n*\n- * If no `state` is given, uses the wrapped atom's current state value.\n+ * If no `state` is given, uses the wrapped atom's current state\n+ * value.\n*\n* @param state\n*/\n@@ -131,8 +132,8 @@ export class History<T> implements\nif (this.history.length >= this.maxLen) {\nthis.history.shift();\n}\n- // check for arg given and not if `state == null`\n- // we want to allow null/undefined as possible values\n+ // check for arg given and not if `state == null` we want to\n+ // allow null/undefined as possible values\nthis.history.push(arguments.length > 0 ? state : this.state.deref());\nthis.future.length = 0;\n}\n@@ -145,7 +146,8 @@ export class History<T> implements\n}\n/**\n- * `IWatch.addWatch()` implementation. Delegates to wrapped atom/cursor.\n+ * `IWatch.addWatch()` implementation. Delegates to wrapped\n+ * atom/cursor.\n*\n* @param id\n* @param fn\n@@ -155,7 +157,8 @@ export class History<T> implements\n}\n/**\n- * `IWatch.removeWatch()` implementation. Delegates to wrapped atom/cursor.\n+ * `IWatch.removeWatch()` implementation. Delegates to wrapped\n+ * atom/cursor.\n*\n* @param id\n*/\n@@ -164,7 +167,8 @@ export class History<T> implements\n}\n/**\n- * `IWatch.notifyWatches()` implementation. Delegates to wrapped atom/cursor.\n+ * `IWatch.notifyWatches()` implementation. Delegates to wrapped\n+ * atom/cursor.\n*\n* @param oldState\n* @param newState\n", "new_path": "packages/atom/src/history.ts", "old_path": "packages/atom/src/history.ts" }, { "change_type": "MODIFY", "diff": "@@ -9,14 +9,14 @@ export function trace(_, e) {\n}\n/**\n- * Higher-order interceptor for validation purposes.\n- * Takes a predicate function and an optional interceptor function,\n- * which will only be called if the predicate fails for a given event.\n- * By default the `FX_CANCEL` side effect is triggered if the predicate\n- * failed, thus ensuring the actual event handler for the failed event\n- * will not be executed anymore. However, this can be overridden using\n- * the error interceptor's result, which is merged into the result of\n- * this interceptor.\n+ * Higher-order interceptor for validation purposes. Takes a predicate\n+ * function and an optional interceptor function, which will only be\n+ * called if the predicate fails for a given event. By default the\n+ * `FX_CANCEL` side effect is triggered if the predicate failed, thus\n+ * ensuring the actual event handler for the failed event will not be\n+ * executed anymore. However, this can be overridden using the error\n+ * interceptor's result, which is merged into the result of this\n+ * interceptor.\n*\n* The error interceptor can return any number of other side effects and\n* so be used to dispatch alternative events instead, for example:\n@@ -32,8 +32,9 @@ export function trace(_, e) {\n* )\n* ```\n*\n- * Note: For this interceptor to work as expected, it needs to be provided\n- * BEFORE the main handler in the interceptor list for a given event, i.e.\n+ * Note: For this interceptor to work as expected, it needs to be\n+ * provided BEFORE the main handler in the interceptor list for a given\n+ * event, i.e.\n*\n* ```\n* [\n@@ -85,19 +86,19 @@ export function ensureGreaterThan(min: number, path?: (e: Event) => Path, err?:\n}\n/**\n- * Higher-order interceptor. Returns new interceptor to set state value at\n- * provided path. This allows for dedicated events to set state values more\n- * concisely, e.g. given this event definition:\n+ * Higher-order interceptor. Returns new interceptor to set state value\n+ * at provided path. This allows for dedicated events to set state\n+ * values more concisely, e.g. given this event definition:\n*\n* ```\n* setFoo: valueSetter(\"foo.bar\")\n* ```\n*\n- * ...the `setFoo` event then can be triggered like so to update the state\n- * value at `foo.bar`:\n+ * ...the `setFoo` event then can be triggered like so to update the\n+ * state value at `foo.bar`:\n*\n* ```\n- * bus.dispatch([\"foo\", 23])\n+ * bus.dispatch([\"setFoo\", 23])\n* ```\n*\n* @param path\n@@ -107,6 +108,27 @@ export function valueSetter<T>(path: Path, tx?: (x: T) => T): InterceptorFn {\nreturn (state, [_, val]) => ({ [FX_STATE]: setIn(state, path, tx ? tx(val) : val) });\n}\n+/**\n+ * Higher-order interceptor. Returns new interceptor to update state\n+ * value at provided path with given function. This allows for dedicated\n+ * events to update state values more concisely, e.g. given this event\n+ * definition:\n+ *\n+ * ```\n+ * incFoo: valueUpdater(\"foo.bar\", (x, y) => x + y)\n+ * ```\n+ *\n+ * ...the `incFoo` event then can be triggered like so to update the\n+ * state value at `foo.bar` (where `1` is the extra arg provided to the\n+ * update fn:\n+ *\n+ * ```\n+ * bus.dispatch([\"incFoo\", 1]) // results in value = value + 1\n+ * ```\n+ *\n+ * @param path\n+ * @param fn\n+ */\nexport function valueUpdater<T>(path: Path, fn: (x: T, ...args: any[]) => T): InterceptorFn {\nreturn (state, [_, ...args]) => ({ [FX_STATE]: updateIn(state, path, fn, ...args) });\n}\n", "new_path": "packages/atom/src/interceptors.ts", "old_path": "packages/atom/src/interceptors.ts" }, { "change_type": "MODIFY", "diff": "@@ -32,19 +32,18 @@ export function toPath(path: Path) {\n}\n/**\n- * Composes a getter function for given nested lookup path.\n- * Optimized fast execution paths are provided for path lengths\n- * less than 5.\n+ * Composes a getter function for given nested lookup path. Optimized\n+ * fast execution paths are provided for path lengths less than 5.\n*\n- * If `path` is given as string, it will be split using `.`.\n- * Returns function which accepts single object and\n- * when called, returns value at given path.\n+ * If `path` is given as string, it will be split using `.`. Returns\n+ * function which accepts single object and when called, returns value\n+ * at given path.\n*\n- * If any intermediate key is not present in the given obj,\n- * descent stops and the function returns `undefined`.\n+ * If any intermediate key is not present in the given obj, descent\n+ * stops and the function returns `undefined`.\n*\n- * If `path` is an empty string or array, the returned getter\n- * will simply return the given state arg (identity function).\n+ * If `path` is an empty string or array, the returned getter will\n+ * simply return the given state arg (identity function).\n*\n* Also see: `getIn()`\n*\n@@ -85,20 +84,19 @@ export function getter(path: Path) {\n}\n/**\n- * Composes a setter function for given nested lookup path.\n- * Optimized fast execution paths are provided for path lengths\n- * less than 5.\n+ * Composes a setter function for given nested lookup path. Optimized\n+ * fast execution paths are provided for path lengths less than 5.\n*\n- * If `path` is given as string, it will be split using `.`.\n- * Returns function which accepts single object and\n- * when called, **immutably** updates value at given path,\n- * i.e. produces a partial deep copy of obj up until given path.\n+ * If `path` is given as string, it will be split using `.`. Returns\n+ * function which accepts single object and when called, **immutably**\n+ * updates value at given path, i.e. produces a partial deep copy of obj\n+ * up until given path.\n*\n- * If any intermediate key is not present in the given obj,\n- * creates a plain empty object for that key and descends further.\n+ * If any intermediate key is not present in the given obj, creates a\n+ * plain empty object for that key and descends further.\n*\n- * If `path` is an empty string or array, the returned setter\n- * will simply return the new value.\n+ * If `path` is an empty string or array, the returned setter will\n+ * simply return the new value.\n*\n* Also see: `setIn()`, `updateIn()`, `deleteIn()`\n*\n@@ -117,9 +115,9 @@ export function getter(path: Path) {\n* // { a: { b: { c: 24 } } }\n* ```\n*\n- * Only keys in the path will be modied, all other keys present\n- * in the given object retain their original values to provide\n- * efficient structural sharing / re-use.\n+ * Only keys in the path will be modied, all other keys present in the\n+ * given object retain their original values to provide efficient\n+ * structural sharing / re-use.\n*\n* ```\n* s = setter(\"a.b.c\");\n@@ -210,8 +208,8 @@ export function updateIn(state: any, path: Path, fn: SwapFn<any>, ...args: any[]\n}\n/**\n- * Uses `updateIn()` and returns updated state with key for given path removed.\n- * Does not modify original state.\n+ * Uses `updateIn()` and returns updated state with key for given path\n+ * removed. Does not modify original state.\n*\n* Returns `undefined` if `path` is an empty string or array.\n*\n", "new_path": "packages/atom/src/path.ts", "old_path": "packages/atom/src/path.ts" }, { "change_type": "MODIFY", "diff": "@@ -2,6 +2,36 @@ import { equiv as _equiv } from \"@thi.ng/api/equiv\";\nimport { IView, Path, ReadonlyAtom, ViewTransform } from \"./api\";\nimport { getter, toPath } from \"./path\";\n+/**\n+ * This class implements readonly access to a deeply nested value with\n+ * in an Atom/Cursor. An optional transformer function can be supplied\n+ * at creation time to produce a derived/materialized view of the actual\n+ * value held in the atom. Views can be created directly or via the\n+ * `.addView()` method of the parent state. Views can be `deref()`'d\n+ * like atoms and polled for value changes using `changed()`. The\n+ * transformer is only applied once per value change and its result\n+ * cached until the next change.\n+ *\n+ * ```\n+ * a = new Atom({a: {b: 1}});\n+ * v = a.addView(\"a.b\", (x) => x * 10);\n+ *\n+ * v.deref()\n+ * // 10\n+ *\n+ * // update atom state\n+ * a.swap((state) => setIn(state, \"a.b\", 2));\n+ * // {a: {b: 2}}\n+ *\n+ * v.changed()\n+ * // true\n+ * v.deref()\n+ * // 20\n+ *\n+ * v.release()\n+ * // remove view from parent state\n+ * ```\n+ */\nexport class View<T> implements\nIView<T> {\n@@ -50,13 +80,13 @@ export class View<T> implements\n}\n/**\n- * Like `deref()`, but doesn't update view's cached state\n- * and dirty flag if value has changed. If there's an unprocessed\n- * value change, returns result of this sub's transformer or else\n- * the cached value.\n+ * Like `deref()`, but doesn't update view's cached state and dirty\n+ * flag if value has changed. If there's an unprocessed value\n+ * change, returns result of this sub's transformer or else the\n+ * cached value.\n*\n- * **Important:** Use this function only if the view has none or\n- * or a stateless transformer. Else might cause undefined/inconsistent\n+ * **Important:** Use this function only if the view has none or or\n+ * a stateless transformer. Else might cause undefined/inconsistent\n* behavior when calling `view()` or `deref()` subsequently.\n*/\nview() {\n", "new_path": "packages/atom/src/view.ts", "old_path": "packages/atom/src/view.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
docs(atom): update all doc strings
1
docs
atom
217,922
09.03.2018 14:28:26
-3,600
9a473492fad80d72721b5df5138eb8a6c44f9a5c
build: typo in beta project configuration
[ { "change_type": "MODIFY", "diff": "@@ -19,7 +19,7 @@ deploy:\nsecure: m+OWcJipxF84Awq3rW3GZ+kH5WMOYYvYjn5Pj82Y+k9MRSA6MPqsk6bviOTcHK6R3hgif907ANnoqnDWLlF+AGh5F+eMfv4B/BFbqpKHkUUNz2FMgYRK+enSdovvvJQvm4EExOsrUA5jdZt0rPwXf5G3I3x3ZkFZb6c77UYjN7Kr/MoLNidGiDI7egkymRIkHSgfh8MWkZ4+QFAbHZER+DxRkQrMwvlVEbBSpY5OqPdaCflSL5MIFrRyXN4qWnPAyrx5dSegMTr5l6NWWS65Avk0fUucux7U2kRIkCnZ+11oE2qTjlE6U65zMxF9IU3VAqtOnt3KObQBO4WvPccLOev2tbg03t3bWC2TK4I/HkNPKwyqV6+iou9os6JSn7BEDCJiPmL9IGVzyzfwUyFSSMrNxjpZwUWvCkAxZbq5vMX5J+F4uhnPEIE1ZsuFlaKHn0NxQAgoFeH4cmTY3FPqtRb1vO/ndRlc/Z0IHY/UeEdS2aUVyb24xinudRXfqmZMZGVze2vzA5KEzY6tGqT23IKfWaRWY6imDiW7iDei6yvA70cz49veIHdxgVPNdqjjUtpt+oT5OtG7lxAGQJMjwyMKu52ARCuoP/spCxRrxudtVsxnzp8JynJgqDLydtKW5pn0lTAM/6u5Z+ga3DnIstrI0tuh+VXYT4ZztMH6j+Q=\n- provider: firebase\nskip_cleanup: true\n- project: \"ffxivteamcraft-beta\"\n+ project: \"ffxiv-teamcraft-beta\"\non:\nbranch: beta\ntoken:\n", "new_path": ".travis.yml", "old_path": ".travis.yml" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
build: typo in beta project configuration
1
build
null
217,922
09.03.2018 14:30:45
-3,600
b8c29dfee35cc03b691a171127d387d7907d5f4b
chore(release): 3.4.0-beta.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=\"3.4.0-beta.0\"></a>\n+# [3.4.0-beta.0](https://github.com/Supamiu/ffxiv-teamcraft/compare/v3.3.1...v3.4.0-beta.0) (2018-03-09)\n+\n+\n+### Bug Fixes\n+\n+* : weird alarm behavior with timers around 12AM ([a0add09](https://github.com/Supamiu/ffxiv-teamcraft/commit/a0add09)), closes [#194](https://github.com/Supamiu/ffxiv-teamcraft/issues/194)\n+* aethersands not filtered by IS_TIMED ([71b2806](https://github.com/Supamiu/ffxiv-teamcraft/commit/71b2806))\n+* alarms played 3 times on each spawn ([3a6a329](https://github.com/Supamiu/ffxiv-teamcraft/commit/3a6a329))\n+* auto translated macro invalid in macro translator ([b46435e](https://github.com/Supamiu/ffxiv-teamcraft/commit/b46435e)), closes [#252](https://github.com/Supamiu/ffxiv-teamcraft/issues/252)\n+* collectible switch not working properly ([c2eef95](https://github.com/Supamiu/ffxiv-teamcraft/commit/c2eef95))\n+* copy to clipboard not available in small viewports ([ee2f2dc](https://github.com/Supamiu/ffxiv-teamcraft/commit/ee2f2dc))\n+* filters not working anymore ([aa6d514](https://github.com/Supamiu/ffxiv-teamcraft/commit/aa6d514))\n+* fish level sometimes wrong ([f3cc02f](https://github.com/Supamiu/ffxiv-teamcraft/commit/f3cc02f))\n+* push notifications queued for next call if not closed manually ([635095a](https://github.com/Supamiu/ffxiv-teamcraft/commit/635095a)), closes [#257](https://github.com/Supamiu/ffxiv-teamcraft/issues/257)\n+* sands timers missing ([da742a8](https://github.com/Supamiu/ffxiv-teamcraft/commit/da742a8))\n+* template broken on outdated lists with reductions ([e6d304d](https://github.com/Supamiu/ffxiv-teamcraft/commit/e6d304d)), closes [#258](https://github.com/Supamiu/ffxiv-teamcraft/issues/258)\n+* working on it not tagging immediately ([8167f7b](https://github.com/Supamiu/ffxiv-teamcraft/commit/8167f7b))\n+* workshop broken in some cases ([ac85600](https://github.com/Supamiu/ffxiv-teamcraft/commit/ac85600))\n+\n+\n+### Features\n+\n+* class icon in alarms panel ([67eadad](https://github.com/Supamiu/ffxiv-teamcraft/commit/67eadad)), closes [#263](https://github.com/Supamiu/ffxiv-teamcraft/issues/263)\n+* compact view in alarm panel ([c710021](https://github.com/Supamiu/ffxiv-teamcraft/commit/c710021)), closes [#262](https://github.com/Supamiu/ffxiv-teamcraft/issues/262)\n+* new language button in settings ([ceb14ae](https://github.com/Supamiu/ffxiv-teamcraft/commit/ceb14ae))\n+* show warning if missing book on gatherings ([17eb72b](https://github.com/Supamiu/ffxiv-teamcraft/commit/17eb72b))\n+* tags on list should appear in list listing ([29c0b96](https://github.com/Supamiu/ffxiv-teamcraft/commit/29c0b96)), closes [#265](https://github.com/Supamiu/ffxiv-teamcraft/issues/265)\n+\n+\n+\n<a name=\"3.3.2\"></a>\n## [3.3.2](https://github.com/Supamiu/ffxiv-teamcraft/compare/v3.3.1...v3.3.2) (2018-03-03)\n", "new_path": "CHANGELOG.md", "old_path": "CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "{\n\"name\": \"teamcraft\",\n- \"version\": \"3.3.2\",\n+ \"version\": \"3.4.0-beta.0\",\n\"lockfileVersion\": 1,\n\"requires\": true,\n\"dependencies\": {\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "MODIFY", "diff": "{\n\"name\": \"teamcraft\",\n- \"version\": \"3.3.2\",\n+ \"version\": \"3.4.0-beta.0\",\n\"license\": \"MIT\",\n\"scripts\": {\n\"ng\": \"ng\",\n\"build:beta\": \"node ./build/prebuild.js && ng build --aot --target=production --env=beta\",\n\"standard-version\": \"standard-version\",\n\"standard-version:dry\": \"standard-version --dry-run\",\n- \"release:git\": \"npm run standard-version && git push --follow-tags origin master\",\n+ \"release:prod\": \"npm run standard-version && git push --follow-tags origin master\",\n\"release:beta\": \"npm run standard-version -- --prerelease beta && git push --follow-tags origin beta\",\n- \"deploy\": \"npm run release:git && npm run build:prod && firebase deploy\",\n- \"deploy:beta\": \"npm run release:beta && npm run build:beta && firebase deploy -P beta\",\n\"test\": \"node ./build/prebuild.js && ng test --single-run\",\n\"lint\": \"ng lint\",\n\"e2e\": \"ng e2e\",\n", "new_path": "package.json", "old_path": "package.json" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
chore(release): 3.4.0-beta.0
1
chore
release
679,913
09.03.2018 14:45:02
0
9b3d91e5f7812a6b30bce002eb8fc04f99963bd9
feat(atom): add IRelease impls add IRelease to ReadonlyAtom implement IRelease for Atom, Cursor, History, View
[ { "change_type": "MODIFY", "diff": "@@ -27,6 +27,7 @@ export const FX_CANCEL = \"--cancel\";\nexport interface ReadonlyAtom<T> extends\napi.IDeref<T>,\n+ api.IRelease,\napi.IWatch<T>,\nIViewable {\n}\n", "new_path": "packages/atom/src/api.ts", "old_path": "packages/atom/src/api.ts" }, { "change_type": "MODIFY", "diff": "@@ -15,6 +15,7 @@ export class Atom<T> implements\nIEquiv {\nprotected value: T;\n+ protected _watches: any;\nconstructor(val?: T) {\nthis.value = val;\n@@ -76,4 +77,10 @@ export class Atom<T> implements\naddView<V>(path: Path, tx?: ViewTransform<V>): IView<V> {\nreturn new View<V>(this, path, tx);\n}\n+\n+ release() {\n+ delete this._watches;\n+ delete this.value;\n+ return true;\n+ }\n}\n", "new_path": "packages/atom/src/atom.ts", "old_path": "packages/atom/src/atom.ts" }, { "change_type": "MODIFY", "diff": "@@ -64,7 +64,7 @@ export class Cursor<T> implements\n}\nrelease() {\n- this.local.removeWatch(this.id);\n+ this.local.release();\nthis.parent.removeWatch(this.id);\ndelete this.local;\ndelete this.parent;\n", "new_path": "packages/atom/src/cursor.ts", "old_path": "packages/atom/src/cursor.ts" }, { "change_type": "MODIFY", "diff": "@@ -180,4 +180,10 @@ export class History<T> implements\naddView<V>(path: Path, tx?: ViewTransform<V>): IView<V> {\nreturn new View<V>(this, path, tx);\n}\n+\n+ release() {\n+ this.state.release();\n+ delete this.state;\n+ return true;\n+ }\n}\n", "new_path": "packages/atom/src/history.ts", "old_path": "packages/atom/src/history.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(atom): add IRelease impls - add IRelease to ReadonlyAtom - implement IRelease for Atom, Cursor, History, View
1
feat
atom
679,913
09.03.2018 14:45:59
0
667691ce890e0ef15f11f2224f75c3e3502337b4
feat(atom): update EventBus ctor, add deref()
[ { "change_type": "MODIFY", "diff": "-import { IObjectOf } from \"@thi.ng/api/api\";\n+import { IObjectOf, IDeref } from \"@thi.ng/api/api\";\nimport { isArray } from \"@thi.ng/checks/is-array\";\nimport { isFunction } from \"@thi.ng/checks/is-function\";\nimport { isPromise } from \"@thi.ng/checks/is-promise\";\nimport * as api from \"./api\";\n+import { Atom } from \"./atom\";\nimport { setIn, updateIn } from \"./path\";\nconst FX_CANCEL = api.FX_CANCEL;\n@@ -45,10 +46,11 @@ const FX_STATE = api.FX_STATE;\n* - supports event cancellation\n* - side effect collection (multiple side effects for same effect type\n* per frame)\n- * - side effect priorities (to better control execution order)\n+ * - side effect priorities (to control execution order)\n* - dynamic addition/removal of handlers & effects\n*/\nexport class EventBus implements\n+ IDeref<any>,\napi.IDispatch {\nreadonly state: api.IAtom<any>;\n@@ -61,8 +63,20 @@ export class EventBus implements\nprotected effects: IObjectOf<api.SideEffect>;\nprotected priorities: api.EffectPriority[];\n- constructor(state: api.IAtom<any>, handlers?: IObjectOf<api.EventDef>, effects?: IObjectOf<api.EffectDef>) {\n- this.state = state;\n+ /**\n+ * Creates a new event bus instance with given parent state, handler\n+ * and effect definitions (all optional). If no state is given,\n+ * automatically creates an `Atom` with empty state object.\n+ *\n+ * In addition to the user provided handlers & effects, a number of\n+ * built-ins are added automatically. See `addBuiltIns()`.\n+ *\n+ * @param state\n+ * @param handlers\n+ * @param effects\n+ */\n+ constructor(state?: api.IAtom<any>, handlers?: IObjectOf<api.EventDef>, effects?: IObjectOf<api.EffectDef>) {\n+ this.state = state || new Atom({});\nthis.handlers = {};\nthis.effects = {};\nthis.eventQueue = [];\n@@ -76,6 +90,14 @@ export class EventBus implements\n}\n}\n+ /**\n+ * Returns value of internal state. Shorthand for:\n+ * `bus.state.deref()`\n+ */\n+ deref() {\n+ return this.state.deref();\n+ }\n+\n/**\n* Add built-in event & side effect handlers:\n*\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(atom): update EventBus ctor, add deref()
1
feat
atom
730,429
09.03.2018 15:54:38
18,000
c7bc756cf2f1d804afeb2fba6160cf451c8013e4
feat(demo-widget): add to user id support
[ { "change_type": "MODIFY", "diff": "@@ -14,6 +14,7 @@ import TokenInput from '../token-input';\nimport styles from './styles.css';\n+const MODE_ONE_ON_ONE_ID = 'MODE_ONE_ON_ONE_ID';\nconst MODE_ONE_ON_ONE = 'MODE_ONE_ON_ONE';\nconst MODE_SPACE = 'MODE_SPACE';\n@@ -24,22 +25,14 @@ class DemoWidget extends Component {\nconstructor(props) {\nsuper(props);\nconst {cookies} = this.props;\n- const toPersonEmail = cookies.get('toPersonEmail') || '';\n- const spaceId = cookies.get('spaceId') || '';\n- let mode;\n- if (spaceId) {\n- mode = MODE_SPACE;\n- }\n- else if (toPersonEmail) {\n- mode = MODE_ONE_ON_ONE;\n- }\n+ const mode = cookies.get('destinationMode') || MODE_SPACE;\n+ const destinationId = cookies.get('destinationId') || '';\nthis.state = {\naccessToken: cookies.get('accessToken') || '',\naccessTokenType: cookies.get('accessTokenType') || '',\n+ destinationId,\nmode,\n- spaceRunning: false,\n- toPersonEmail,\n- spaceId\n+ spaceRunning: false\n};\n}\n@@ -47,21 +40,45 @@ class DemoWidget extends Component {\nreturn true;\n}\n+ getDestinationLabels() {\n+ let ariaLabel, placeholder;\n+ switch (this.state.mode) {\n+ case MODE_ONE_ON_ONE:\n+ ariaLabel = 'To User Email';\n+ placeholder = 'Spark User Email (For 1:1)';\n+ break;\n+ case MODE_ONE_ON_ONE_ID:\n+ ariaLabel = 'To User Id';\n+ placeholder = 'Spark User Id (For 1:1)';\n+ break;\n+ case MODE_SPACE:\n+ ariaLabel = 'To Space ID';\n+ placeholder = 'Spark Space Id';\n+ break;\n+ default: {\n+ ariaLabel = 'unknown mode';\n+ placeholder = 'Please pick a type';\n+ }\n+ }\n+ return {\n+ ariaLabel,\n+ placeholder\n+ };\n+ }\n+\n@autobind\nhandleOpenSpaceWidget(e) {\ne.preventDefault();\nconst {cookies} = this.props;\ncookies.set('accessToken', this.state.accessToken);\ncookies.set('accessTokenType', this.state.accessTokenType);\n- if (this.state.mode === MODE_ONE_ON_ONE) {\n- cookies.set('toPersonEmail', this.state.toPersonEmail);\n- }\n- else {\n- cookies.set('spaceId', this.state.spaceId);\n- }\n- const toPerson = this.state.mode === MODE_ONE_ON_ONE ? this.state.toPersonEmail : '';\n- const toSpace = this.state.mode === MODE_SPACE ? this.state.spaceId : '';\n- this.openSpaceWidget({toPerson, toSpace});\n+ cookies.set('destinationId', this.state.destinationId);\n+ cookies.set('destinationMode', this.state.mode);\n+\n+ const toPerson = this.state.mode === MODE_ONE_ON_ONE ? this.state.destinationId : '';\n+ const toPersonId = this.state.mode === MODE_ONE_ON_ONE_ID ? this.state.destinationId : '';\n+ const toSpace = this.state.mode === MODE_SPACE ? this.state.destinationId : '';\n+ this.openSpaceWidget({toPerson, toPersonId, toSpace});\n}\n@autobind\n@@ -112,23 +129,18 @@ class DemoWidget extends Component {\nreturn this.setState({accessToken, accessTokenType});\n}\n- @autobind\n- handleEmailChange(e) {\n- return this.setState({toPersonEmail: e.target.value});\n- }\n-\n@autobind\nhandleModeChange(e, value) {\n- return this.setState({mode: value});\n+ return this.setState({mode: value, destinationId: ''});\n}\n@autobind\n- handleSpaceChange(e) {\n- return this.setState({spaceId: e.target.value});\n+ handleDestinationChange(e) {\n+ return this.setState({destinationId: e.target.value});\n}\n@autobind\n- openSpaceWidget({toPerson, toSpace}) {\n+ openSpaceWidget({toPerson, toPersonId, toSpace}) {\nconst widgetEl = document.getElementById(spaceWidgetElementId);\nconst widgetOptions = {\nonEvent: (eventName, detail) => {\n@@ -141,6 +153,9 @@ class DemoWidget extends Component {\nelse {\nwidgetOptions.accessToken = this.state.accessToken;\n}\n+ if (toPersonId) {\n+ widgetOptions.toPersonId = toPersonId;\n+ }\nif (toPerson) {\nwidgetOptions.toPersonEmail = toPerson;\n}\n@@ -152,9 +167,7 @@ class DemoWidget extends Component {\n}\nrender() {\n- const hasToPerson = this.state.mode === MODE_ONE_ON_ONE && this.state.toPersonEmail;\n- const hasToSpace = this.state.mode === MODE_SPACE && this.state.spaceId;\n- const loadButtonEnabled = this.state.accessToken && (hasToPerson || hasToSpace) && !this.state.spaceRunning;\n+ const loadButtonEnabled = this.state.accessToken && this.state.destinationId && !this.state.spaceRunning;\nconst loadRecentsButtonEnabled = this.state.accessToken && !this.state.recentsRunning;\nconst componentSpaceContainerClassNames = [\nstyles.widgetSpaceComponentContainer\n@@ -175,6 +188,11 @@ class DemoWidget extends Component {\nrunningDemosContainerClassNames.push(styles.hidden);\n}\n+ const {\n+ ariaLabel,\n+ placeholder\n+ } = this.getDestinationLabels();\n+\n// eslint-disable-reason should not apply to jsx/html markup\n/* eslint-disable max-len */\nreturn (\n@@ -214,38 +232,27 @@ class DemoWidget extends Component {\nvalue={MODE_SPACE}\n/>\n<RadioButton\n- aria-label=\"To Person\"\n+ aria-label=\"To Person Email\"\nlabel=\"To Person\"\nvalue={MODE_ONE_ON_ONE}\n/>\n- </RadioButtonGroup>\n- </div>\n- {\n- this.state.mode === MODE_SPACE &&\n- <div>\n- <input\n- aria-label=\"To Space ID\"\n- className={styles.textInput}\n- id=\"toSpaceId\"\n- onChange={this.handleSpaceChange}\n- placeholder=\"Spark Space Id\"\n- value={this.state.spaceId}\n+ <RadioButton\n+ aria-label=\"To Person Id\"\n+ label=\"To Person Id\"\n+ value={MODE_ONE_ON_ONE_ID}\n/>\n+ </RadioButtonGroup>\n</div>\n- }\n- {\n- this.state.mode === MODE_ONE_ON_ONE &&\n<div>\n<input\n- aria-label=\"To User Email\"\n+ aria-label={ariaLabel}\nclassName={styles.textInput}\n- id=\"toUserEmail\"\n- onChange={this.handleEmailChange}\n- placeholder=\"Spark User Email (For 1:1)\"\n- value={this.state.toPersonEmail}\n+ id=\"destinationId\"\n+ onChange={this.handleDestinationChange}\n+ placeholder={placeholder}\n+ value={this.state.destinationId}\n/>\n</div>\n- }\n</CardText>\n<CardActions expandable>\n<RaisedButton\n", "new_path": "packages/node_modules/@ciscospark/widget-demo/src/components/demo-widget/index.js", "old_path": "packages/node_modules/@ciscospark/widget-demo/src/components/demo-widget/index.js" } ]
JavaScript
MIT License
webex/react-widgets
feat(demo-widget): add to user id support
1
feat
demo-widget
730,429
09.03.2018 15:55:50
18,000
9afaa4c2b0ad3b1aa313b9506dd4ff065795b94a
fix(redux-module-conversation): set conversation error message
[ { "change_type": "MODIFY", "diff": "@@ -141,7 +141,7 @@ Array [\nObject {\n\"payload\": Object {\n\"conversationState\": Object {\n- \"error\": [Error: failed. hard.],\n+ \"error\": \"failed. hard.\",\n},\n},\n\"type\": \"conversation/UPDATE_CONVERSATION_STATE\",\n@@ -207,7 +207,7 @@ Array [\nObject {\n\"payload\": Object {\n\"conversationState\": Object {\n- \"error\": [Error: failed. hard.],\n+ \"error\": \"failed. hard.\",\n},\n},\n\"type\": \"conversation/UPDATE_CONVERSATION_STATE\",\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/__snapshots__/actions.test.js.snap", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/__snapshots__/actions.test.js.snap" }, { "change_type": "MODIFY", "diff": "@@ -204,7 +204,7 @@ export function createConversation(participants = [], spark) {\ndispatch(storeConversation(\ncomputeRoomProperties(conversation, spark)\n)))\n- .catch((error) => dispatch(updateConversationState({error})));\n+ .catch((error) => dispatch(updateConversationState({error: error.message})));\n};\n}\n@@ -250,7 +250,7 @@ export function getConversation(id, spark) {\ndispatch(storeConversation(\ncomputeRoomProperties(conversation, spark)\n)))\n- .catch((error) => dispatch(updateConversationState({error})));\n+ .catch((error) => dispatch(updateConversationState({error: error.message})));\n}\nreturn false;\n};\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.js", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.js" } ]
JavaScript
MIT License
webex/react-widgets
fix(redux-module-conversation): set conversation error message
1
fix
redux-module-conversation
679,913
09.03.2018 16:25:16
0
3fae2496493a4eafb0e3638dfaa9367690b7f842
feat(atom): add/extract StatelessEventBus
[ { "change_type": "MODIFY", "diff": "@@ -20,26 +20,40 @@ const FX_STATE = api.FX_STATE;\n* and can be any data.\n*\n* Events are processed by registered handlers which transform each\n- * event into a number of side effects to be executed later. This\n- * separation ensures event handlers themselves are pure functions and\n- * too leads to more efficient reuse of side effecting operations. The\n+ * event into a number of side effect descriptions to be executed later.\n+ * This separation ensures event handlers themselves are pure functions\n+ * and leads to more efficient reuse of side effecting operations. The\n* pure data nature until the last stage of processing (the application\n- * side effects) also means event flow can be much easier inspected and\n- * debugged.\n- *\n- * In this model an event handler itself is an array of objects with\n- * `pre` and/or `post` keys and functions attached to each key. These\n- * functions are called interceptors, since each intercepts the\n- * processing of an event and can contribute their own side effects. The\n- * outcome of this setup is a more aspect-oriented, composable approach\n- * to event handling and allows to inject common, re-usable behaviors\n- * for multiple event types (logging, validation, undo/redo triggers\n- * etc.)\n+ * side effects) too means that event flow can be much easier inspected\n+ * and debugged.\n+ *\n+ * In this model a single event handler itself is an array of objects\n+ * with `pre` and/or `post` keys and functions attached to each key.\n+ * These functions are called interceptors, since each intercepts the\n+ * processing of an event and can contribute their own side effects.\n+ * Each event's interceptor chain is processed bi-directionally (`pre`\n+ * in forward, `post` in reverse order) and the effects returned from\n+ * each interceptor are merged/collected. The outcome of this setup is a\n+ * more aspect-oriented, composable approach to event handling and\n+ * allows to inject common, re-usable behaviors for multiple event types\n+ * (logging, validation, undo/redo triggers etc.).\n+ *\n+ * Side effects are only processed after all event handlers have run.\n+ * Furthermore, their order of execution can be configured with optional\n+ * priorities.\n+ *\n+ * See for further details:\n+ *\n+ * - `processQueue()`\n+ * - `processEvent()`\n+ * - `processEffects()`\n+ * - `mergeEffects()`\n*\n* The overall approach of this type of event processing is heavily\n* based on the pattern initially pioneered by @Day8/re-frame, with the\n* following differences:\n*\n+ * - stateless (see `StatefulEventBus` for alternative)\n* - standalone implementation (no assumptions about surrounding\n* context/framework)\n* - manual trigger of event queue processing\n@@ -49,11 +63,10 @@ const FX_STATE = api.FX_STATE;\n* - side effect priorities (to control execution order)\n* - dynamic addition/removal of handlers & effects\n*/\n-export class EventBus implements\n- IDeref<any>,\n+export class StatelessEventBus implements\napi.IDispatch {\n- readonly state: api.IAtom<any>;\n+ state: any;\nprotected eventQueue: api.Event[];\nprotected currQueue: api.Event[];\n@@ -71,12 +84,10 @@ export class EventBus implements\n* In addition to the user provided handlers & effects, a number of\n* built-ins are added automatically. See `addBuiltIns()`.\n*\n- * @param state\n* @param handlers\n* @param effects\n*/\n- constructor(state?: api.IAtom<any>, handlers?: IObjectOf<api.EventDef>, effects?: IObjectOf<api.EffectDef>) {\n- this.state = state || new Atom({});\n+ constructor(handlers?: IObjectOf<api.EventDef>, effects?: IObjectOf<api.EffectDef>) {\nthis.handlers = {};\nthis.effects = {};\nthis.eventQueue = [];\n@@ -91,55 +102,19 @@ export class EventBus implements\n}\n/**\n- * Returns value of internal state. Shorthand for:\n- * `bus.state.deref()`\n- */\n- deref() {\n- return this.state.deref();\n- }\n-\n- /**\n- * Add built-in event & side effect handlers:\n+ * Adds built-in event & side effect handlers:\n*\n* ### Handlers\n*\n- * #### `EV_SET_VALUE`\n- *\n- * Resets state path to provided value. See `setIn()`.\n- *\n- * Example event definition:\n- * ```\n- * [EV_SET_VALUE, [\"path.to.value\", val]]\n- * ```\n- *\n- * #### `EV_UPDATE_VALUE`\n- *\n- * Updates a state path's value with provided function and optional\n- * extra arguments. See `updateIn()`.\n- *\n- * Example event definition:\n- * ```\n- * [EV_UPDATE_VALUE, [\"path.to.value\", (x, y) => x + y, 1]]\n- * ```\n+ * none\n*\n* ### Side effects\n*\n* #### `FX_DISPATCH`\n* #### `FX_DISPATCH_ASYNC`\n- * #### `FX_STATE`\n*\n*/\naddBuiltIns(): any {\n- // handlers\n- this.addHandler(api.EV_SET_VALUE,\n- (state, [_, [path, val]]) =>\n- ({ [FX_STATE]: setIn(state, path, val) }));\n- this.addHandler(api.EV_UPDATE_VALUE,\n- (state, [_, [path, fn, ...args]]) =>\n- ({ [FX_STATE]: updateIn(state, path, fn, ...args) }));\n-\n- // effects\n- this.addEffect(FX_STATE, (x) => this.state.reset(x), -1000);\nthis.addEffect(api.FX_DISPATCH, (e) => this.dispatch(e), -999);\nthis.addEffect(api.FX_DISPATCH_ASYNC,\n([id, arg, success, err]) => {\n@@ -264,24 +239,30 @@ export class EventBus implements\n/**\n* Triggers processing of current event queue and returns `true` if\n- * the any of the processed events caused a state change.\n+ * any events have been processed.\n*\n* If an event handler triggers the `FX_DISPATCH_NOW` side effect,\n* the new event will be added to the currently processed batch and\n* therefore executed in the same frame. Also see `dispatchNow()`.\n+ *\n+ * An optional `ctx` (context) object can be provided, which is used\n+ * to collect any side effect definitions during processing. This\n+ * can be useful for debugging, inspection or post-processing\n+ * purposes.\n+ *\n+ * @param ctx\n*/\n- processQueue() {\n+ processQueue(ctx?: api.InterceptorContext) {\nif (this.eventQueue.length > 0) {\n- const prev = this.state.deref();\nthis.currQueue = [...this.eventQueue];\nthis.eventQueue.length = 0;\n- const fx = this.currCtx = { [FX_STATE]: prev };\n+ ctx = this.currCtx = ctx || {};\nfor (let e of this.currQueue) {\n- this.processEvent(fx, e);\n+ this.processEvent(ctx, e);\n}\nthis.currQueue = this.currCtx = undefined;\n- this.processEffects(fx);\n- return this.state.deref() !== prev;\n+ this.processEffects(ctx);\n+ return true;\n}\nreturn false;\n}\n@@ -311,7 +292,7 @@ export class EventBus implements\n* @param fx\n* @param e\n*/\n- protected processEvent(fx: api.InterceptorContext, e: api.Event) {\n+ protected processEvent(ctx: api.InterceptorContext, e: api.Event) {\nconst iceps = this.handlers[e[0]];\nif (!iceps) {\nconsole.warn(`missing handler for event type: ${e[0]}`);\n@@ -319,20 +300,20 @@ export class EventBus implements\n}\nconst n = iceps.length - 1;\nlet hasPost = false;\n- for (let i = 0; i <= n && !fx[FX_CANCEL]; i++) {\n+ for (let i = 0; i <= n && !ctx[FX_CANCEL]; i++) {\nconst icep = iceps[i];\nif (icep.pre) {\n- this.mergeEffects(fx, icep.pre(fx[FX_STATE], e, this));\n+ this.mergeEffects(ctx, icep.pre(ctx[FX_STATE], e, this));\n}\nhasPost = hasPost || !!icep.post;\n}\nif (!hasPost) {\nreturn;\n}\n- for (let i = n; i >= 0 && !fx[FX_CANCEL]; i--) {\n+ for (let i = n; i >= 0 && !ctx[FX_CANCEL]; i--) {\nconst icep = iceps[i];\nif (icep.post) {\n- this.mergeEffects(fx, icep.post(fx[FX_STATE], e, this));\n+ this.mergeEffects(ctx, icep.post(ctx[FX_STATE], e, this));\n}\n}\n}\n@@ -343,11 +324,11 @@ export class EventBus implements\n*\n* @param fx\n*/\n- protected processEffects(fx: api.InterceptorContext) {\n+ protected processEffects(ctx: api.InterceptorContext) {\nconst effects = this.effects;\nfor (let p of this.priorities) {\nconst id = p[0];\n- const val = fx[id];\n+ const val = ctx[id];\nif (val !== undefined) {\nconst fn = effects[id];\nif (id !== FX_STATE) {\n@@ -372,14 +353,17 @@ export class EventBus implements\n* single side effect type (e.g. dispatch multiple other events), it\n* MUST return an array of these values. The only exceptions to this\n* are the following effects, which for obvious reasons can only\n- * accept a single value:\n+ * accept a single value.\n+ *\n+ * **Note:** the `FX_STATE` effect is not actually used here, but is\n+ * supported to avoid code duplication in `StatefulEventBus`.\n*\n* - `FX_CANCEL`\n* - `FX_STATE`\n*\n- * Note that because of this support (of multiple values), the value\n- * of a single side effect MUST NOT be a nested array itself, or\n- * rather not its first item.\n+ * Because of this support (multiple values), the value of a single\n+ * side effect MUST NOT be a nested array itself, or rather its\n+ * first item can't be an array.\n*\n* For example:\n*\n@@ -394,14 +378,14 @@ export class EventBus implements\n* @param fx\n* @param ret\n*/\n- protected mergeEffects(fx: api.InterceptorContext, ret: any) {\n+ protected mergeEffects(ctx: api.InterceptorContext, ret: any) {\nif (!ret) {\nreturn;\n}\nfor (let k in ret) {\nconst v = ret[k];\nif (k === FX_STATE || k === FX_CANCEL) {\n- fx[k] = v;\n+ ctx[k] = v;\n} else if (k === FX_DISPATCH_NOW) {\nif (isArray(v[0])) {\nfor (let e of v) {\n@@ -411,16 +395,125 @@ export class EventBus implements\nthis.dispatchNow(v);\n}\n} else {\n- if (fx[k]) {\n+ if (ctx[k]) {\nif (isArray(v[0])) {\n- Array.prototype.push.apply(fx[k], v);\n+ Array.prototype.push.apply(ctx[k], v);\n} else {\n- fx[k].push(v)\n+ ctx[k].push(v)\n}\n} else {\n- fx[k] = [v];\n+ ctx[k] = [v];\n+ }\n+ }\n+ }\n+ }\n+}\n+\n+/**\n+ * Stateful version of `StatelessEventBus`. Wraps an `IAtom` state\n+ * container (Atom/Cursor) and provides additional pre-defined event\n+ * handlers and side effects to manipulate wrapped state. Prefer this\n+ * as the default implementation for most use cases.\n+ */\n+export class EventBus extends StatelessEventBus implements\n+ IDeref<any>,\n+ api.IDispatch {\n+\n+ readonly state: api.IAtom<any>;\n+\n+ /**\n+ * Creates a new event bus instance with given parent state, handler\n+ * and effect definitions (all optional). If no state is given,\n+ * automatically creates an `Atom` with empty state object.\n+ *\n+ * In addition to the user provided handlers & effects, a number of\n+ * built-ins are added automatically. See `addBuiltIns()`.\n+ *\n+ * @param state\n+ * @param handlers\n+ * @param effects\n+ */\n+ constructor(state?: api.IAtom<any>, handlers?: IObjectOf<api.EventDef>, effects?: IObjectOf<api.EffectDef>) {\n+ super(handlers, effects);\n+ this.state = state || new Atom({});\n+ }\n+\n+ /**\n+ * Returns value of internal state. Shorthand for:\n+ * `bus.state.deref()`\n+ */\n+ deref() {\n+ return this.state.deref();\n+ }\n+\n+ /**\n+ * Adds same built-in event & side effect handlers as in\n+ * `EventBus.addBuiltIns()` with the following additions:\n+ *\n+ * ### Handlers\n+ *\n+ * #### `EV_SET_VALUE`\n+ *\n+ * Resets state path to provided value. See `setIn()`.\n+ *\n+ * Example event definition:\n+ * ```\n+ * [EV_SET_VALUE, [\"path.to.value\", val]]\n+ * ```\n+ *\n+ * #### `EV_UPDATE_VALUE`\n+ *\n+ * Updates a state path's value with provided function and optional\n+ * extra arguments. See `updateIn()`.\n+ *\n+ * Example event definition:\n+ * ```\n+ * [EV_UPDATE_VALUE, [\"path.to.value\", (x, y) => x + y, 1]]\n+ * ```\n+ *\n+ * ### Side effects\n+ *\n+ * #### `FX_STATE`\n+ *\n+ * Resets state atom to provided value (only a single update per\n+ * processing frame)\n+ *\n+ */\n+ addBuiltIns(): any {\n+ super.addBuiltIns();\n+ // handlers\n+ this.addHandler(api.EV_SET_VALUE,\n+ (state, [_, [path, val]]) =>\n+ ({ [FX_STATE]: setIn(state, path, val) }));\n+ this.addHandler(api.EV_UPDATE_VALUE,\n+ (state, [_, [path, fn, ...args]]) =>\n+ ({ [FX_STATE]: updateIn(state, path, fn, ...args) }));\n+\n+ // effects\n+ this.addEffect(FX_STATE, (x) => this.state.reset(x), -1000);\n}\n+\n+ /**\n+ * Triggers processing of current event queue and returns `true` if\n+ * the any of the processed events caused a state change.\n+ *\n+ * If an event handler triggers the `FX_DISPATCH_NOW` side effect,\n+ * the new event will be added to the currently processed batch and\n+ * therefore executed in the same frame. Also see `dispatchNow()`.\n+ */\n+ processQueue() {\n+ if (this.eventQueue.length > 0) {\n+ const prev = this.state.deref();\n+ this.currQueue = [...this.eventQueue];\n+ this.eventQueue.length = 0;\n+ const ctx = this.currCtx = { [FX_STATE]: prev };\n+ for (let e of this.currQueue) {\n+ this.processEvent(ctx, e);\n}\n+ this.currQueue = this.currCtx = undefined;\n+ this.processEffects(ctx);\n+ return this.state.deref() !== prev;\n}\n+ return false;\n}\n}\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(atom): add/extract StatelessEventBus
1
feat
atom
730,429
09.03.2018 16:33:51
18,000
741b522b9b9786f6accf3f2f0ccb294f98bc2045
feat(redux-module-conversation): add hydra id support to create and get The sdk doesn't currently support hydra ids, so we need to convert to uuid.
[ { "change_type": "MODIFY", "diff": "@@ -133,6 +133,55 @@ Array [\n]\n`;\n+exports[`redux-module-conversation actions #createConversation can create a conversation with hydra ids 1`] = `\n+Array [\n+ Array [\n+ Object {\n+ \"participants\": Array [\n+ \"a1bae992-11b5-49ab-8c0b-e8e8716e1eb0\",\n+ ],\n+ },\n+ Object {\n+ \"activitiesLimit\": 40,\n+ \"latestActivity\": true,\n+ \"participantAckFilter\": \"all\",\n+ },\n+ ],\n+]\n+`;\n+\n+exports[`redux-module-conversation actions #createConversation can create a conversation with hydra ids 2`] = `\n+Array [\n+ Object {\n+ \"type\": \"conversation/CREATE_CONVERSATION_BEGIN\",\n+ },\n+ Object {\n+ \"payload\": Object {\n+ \"conversation\": Object {\n+ \"id\": \"created-conversation\",\n+ \"participants\": Object {\n+ \"items\": Array [\n+ Object {\n+ \"id\": \"this-user-id\",\n+ \"roomProperties\": Object {\n+ \"isModerator\": false,\n+ },\n+ },\n+ ],\n+ },\n+ \"status\": Object {\n+ \"isLocked\": false,\n+ \"isModerator\": false,\n+ \"isOneOnOne\": false,\n+ },\n+ \"tags\": Array [],\n+ },\n+ },\n+ \"type\": \"conversation/CREATE_CONVERSATION\",\n+ },\n+]\n+`;\n+\nexports[`redux-module-conversation actions #createConversation handles errors during create a conversation 1`] = `\nArray [\nObject {\n@@ -167,6 +216,54 @@ Array [\n]\n`;\n+exports[`redux-module-conversation actions #getConversation can get a conversation by hydra id 1`] = `\n+Array [\n+ Array [\n+ Object {\n+ \"id\": \"a1bae992-11b5-49ab-8c0b-e8e8716e1eb0\",\n+ },\n+ Object {\n+ \"activitiesLimit\": 40,\n+ \"includeParticipants\": true,\n+ \"latestActivity\": true,\n+ \"participantAckFilter\": \"all\",\n+ },\n+ ],\n+]\n+`;\n+\n+exports[`redux-module-conversation actions #getConversation can get a conversation by hydra id 2`] = `\n+Array [\n+ Object {\n+ \"type\": \"conversation/CREATE_CONVERSATION_BEGIN\",\n+ },\n+ Object {\n+ \"payload\": Object {\n+ \"conversation\": Object {\n+ \"id\": \"got-conversation\",\n+ \"participants\": Object {\n+ \"items\": Array [\n+ Object {\n+ \"id\": \"this-user-id\",\n+ \"roomProperties\": Object {\n+ \"isModerator\": false,\n+ },\n+ },\n+ ],\n+ },\n+ \"status\": Object {\n+ \"isLocked\": false,\n+ \"isModerator\": false,\n+ \"isOneOnOne\": false,\n+ },\n+ \"tags\": Array [],\n+ },\n+ },\n+ \"type\": \"conversation/CREATE_CONVERSATION\",\n+ },\n+]\n+`;\n+\nexports[`redux-module-conversation actions #getConversation can get a conversation by uuid 1`] = `\nArray [\nObject {\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/__snapshots__/actions.test.js.snap", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/__snapshots__/actions.test.js.snap" }, { "change_type": "MODIFY", "diff": "import {last} from 'lodash';\nimport isEmail from 'validator/lib/isEmail';\n+import {validateAndDecodeId} from '@ciscospark/react-component-utils';\nexport const ACKNOWLEDGE_ACTIVITY = 'conversation/ACKNOWLEDGE_ACTIVITY';\nexport const ADD_ACTIVITIES_TO_CONVERSATION = 'conversation/ADD_ACTIVITIES_TO_CONVERSATION';\n@@ -193,8 +194,19 @@ export function createConversation(participants = [], spark) {\nreturn (dispatch) => {\ndispatch(createConversationBegin());\n+ const mappedParticipants = participants.map((p) => {\n+ if (isEmail(p)) {\n+ return p;\n+ }\n+ const uuid = validateAndDecodeId(p);\n+ if (uuid) {\n+ return uuid;\n+ }\n+ return p;\n+ });\n+\nreturn spark.internal.conversation.create({\n- participants\n+ participants: mappedParticipants\n}, {\nlatestActivity: true,\nactivitiesLimit: 40,\n@@ -229,15 +241,10 @@ export function deleteActivity(conversation, activity, spark) {\n* @returns {Promise}\n*/\nexport function getConversation(id, spark) {\n- // check if id is uuid\n- const uuidTest = new RegExp(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);\n- let uuid = id;\n- if (!uuidTest.test(uuid)) {\n- uuid = atob(id).split('/').pop();\n- }\n+ const uuid = validateAndDecodeId(id);\nreturn (dispatch) => {\ndispatch(createConversationBegin());\n- if (uuidTest.test(uuid)) {\n+ if (uuid) {\nreturn spark.internal.conversation.get({\nid: uuid\n}, {\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.js", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.js" }, { "change_type": "MODIFY", "diff": "@@ -120,6 +120,16 @@ describe('redux-module-conversation actions', () => {\n});\n});\n+ it('can create a conversation with hydra ids', () => {\n+ const participants = ['Y2lzY29zcGFyazovL3VzL1BFT1BMRS9hMWJhZTk5Mi0xMWI1LTQ5YWItOGMwYi1lOGU4NzE2ZTFlYjA'];\n+ const store = mockStore({});\n+ return store.dispatch(actions.createConversation(participants, mockSpark))\n+ .then(() => {\n+ expect(mockSpark.internal.conversation.create.mock.calls).toMatchSnapshot();\n+ expect(store.getActions()).toMatchSnapshot();\n+ });\n+ });\n+\nit('handles errors during create a conversation', () => {\nmockSpark.internal.conversation.create = jest.fn(() => Promise.reject(new Error('failed. hard.')));\nconst store = mockStore({});\n@@ -155,6 +165,16 @@ describe('redux-module-conversation actions', () => {\n});\n});\n+ it('can get a conversation by hydra id', () => {\n+ const hydraId = 'Y2lzY29zcGFyazovL3VzL1BFT1BMRS9hMWJhZTk5Mi0xMWI1LTQ5YWItOGMwYi1lOGU4NzE2ZTFlYjA';\n+ const store = mockStore({});\n+ return store.dispatch(actions.getConversation(hydraId, mockSpark))\n+ .then(() => {\n+ expect(mockSpark.internal.conversation.get.mock.calls).toMatchSnapshot();\n+ expect(store.getActions()).toMatchSnapshot();\n+ });\n+ });\n+\nit('sets the locked status of a room properly', () => {\nconst uuid = '34abf792-10a7-4d5c-ae46-88f1bcaa07e4';\nconst store = mockStore({});\n", "new_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.test.js", "old_path": "packages/node_modules/@ciscospark/redux-module-conversation/src/actions.test.js" } ]
JavaScript
MIT License
webex/react-widgets
feat(redux-module-conversation): add hydra id support to create and get The sdk doesn't currently support hydra ids, so we need to convert to uuid.
1
feat
redux-module-conversation
807,849
09.03.2018 17:50:52
28,800
da235ed2dada0fbc279493886c9e3fc3e549e746
refactor(bootstrap): use for-of loops in validatePackageNames()
[ { "change_type": "MODIFY", "diff": "@@ -470,25 +470,26 @@ class BootstrapCommand extends Command {\n}\nvalidatePackageNames() {\n- const foundPackages = new Map();\n+ const seen = new Map();\n- this.filteredPackages.forEach(({ name, location }) => {\n- if (foundPackages.has(name)) {\n- foundPackages.get(name).add(location);\n+ for (const { name, location } of this.filteredPackages) {\n+ if (seen.has(name)) {\n+ seen.get(name).push(location);\n} else {\n- foundPackages.set(name, new Set([location]));\n+ seen.set(name, [location]);\n+ }\n}\n- });\n- foundPackages.forEach((locationsFound, pkgName) => {\n- if (locationsFound.size > 1) {\n+ for (const [name, locations] of seen) {\n+ if (locations.length > 1) {\nthrow new ValidationError(\n\"ENAME\",\n- `Package name \"${pkgName}\" used in multiple packages:\n- \\t${Array.from(locationsFound).join(\"\\n\\t\")}`\n+ [`Package name \"${name}\" used in multiple packages:`, ...locations].join(\"\\n\\t\")\n);\n}\n- });\n+ }\n+\n+ // hooray no duplicates\n}\n}\n", "new_path": "commands/bootstrap/index.js", "old_path": "commands/bootstrap/index.js" } ]
JavaScript
MIT License
lerna/lerna
refactor(bootstrap): use for-of loops in validatePackageNames()
1
refactor
bootstrap
807,849
09.03.2018 18:05:15
28,800
423f82cd52d833c0909b8ec4c6103556dbf7a610
feat: Replace with multimatch
[ { "change_type": "MODIFY", "diff": "@@ -21,14 +21,32 @@ exports.builder = yargs => {\ngroup: \"Command Options:\",\ndescribe: \"Install external dependencies matching [glob] to the repo root\",\ndefaultDescription: \"'**'\",\n- coerce: arg =>\n+ coerce: arg => {\n// `--hoist` is equivalent to `--hoist=**`.\n- arg === true ? \"**\" : arg,\n+ if (arg === true) {\n+ return [\"**\"];\n+ }\n+\n+ if (arg && !Array.isArray(arg)) {\n+ return [arg];\n+ }\n+\n+ return arg;\n+ },\n},\nnohoist: {\ngroup: \"Command Options:\",\ndescribe: \"Don't hoist external dependencies matching [glob] to the repo root\",\ntype: \"string\",\n+ requiresArg: true,\n+ coerce: arg => {\n+ // negate any globs passed\n+ if (!Array.isArray(arg)) {\n+ return [`!${arg}`];\n+ }\n+\n+ return arg.map(str => `!${str}`);\n+ },\n},\nmutex: {\nhidden: true,\n", "new_path": "commands/bootstrap/command.js", "old_path": "commands/bootstrap/command.js" }, { "change_type": "MODIFY", "diff": "@@ -29,7 +29,7 @@ class BootstrapCommand extends Command {\ninitialize() {\nconst { registry, rejectCycles, npmClient = \"npm\", npmClientArgs, mutex, hoist } = this.options;\n- if (npmClient === \"yarn\" && typeof hoist === \"string\") {\n+ if (npmClient === \"yarn\" && hoist) {\nthrow new ValidationError(\n\"EWORKSPACES\",\ndedent`\n@@ -209,8 +209,11 @@ class BootstrapCommand extends Command {\nconst { hoist, nohoist } = this.options;\nconst rootPkg = this.repository.package;\n+ let hoisting;\n+\nif (hoist) {\n- tracker.verbose(\"hoist\", \"enabled for %j\", hoist);\n+ hoisting = [].concat(hoist, nohoist || []);\n+ tracker.verbose(\"hoist\", \"using globs %j\", hoisting);\n}\n// This will contain entries for each hoistable dependency.\n@@ -274,7 +277,7 @@ class BootstrapCommand extends Command {\nfor (const [externalName, externalDependents] of depsToInstall) {\nlet rootVersion;\n- if (hoist && isHoistedPackage(externalName, hoist, nohoist)) {\n+ if (hoisting && isHoistedPackage(externalName, hoisting)) {\nconst commonVersion = Array.from(externalDependents.keys()).reduce(\n(a, b) => (externalDependents.get(a).size > externalDependents.get(b).size ? a : b)\n);\n", "new_path": "commands/bootstrap/index.js", "old_path": "commands/bootstrap/index.js" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n-const matchPackageName = require(\"@lerna/match-package-name\");\n+const multimatch = require(\"multimatch\");\nmodule.exports = isHoistedPackage;\n-function isHoistedPackage(name, hoist, nohoist) {\n- return matchPackageName(name, hoist) && matchPackageName(name, nohoist, true);\n+function isHoistedPackage(name, hoisting) {\n+ return multimatch([name], hoisting).length > 0;\n}\n", "new_path": "commands/bootstrap/lib/is-hoisted-package.js", "old_path": "commands/bootstrap/lib/is-hoisted-package.js" }, { "change_type": "MODIFY", "diff": "\"@lerna/batch-packages\": \"file:../../utils/batch-packages\",\n\"@lerna/command\": \"file:../../core/command\",\n\"@lerna/filter-options\": \"file:../../core/filter-options\",\n- \"@lerna/match-package-name\": \"file:../../utils/match-package-name\",\n\"@lerna/npm-install\": \"file:../../utils/npm-install\",\n\"@lerna/rimraf-dir\": \"file:../../utils/rimraf-dir\",\n\"@lerna/run-lifecycle\": \"file:../../utils/run-lifecycle\",\n\"dedent\": \"^0.7.0\",\n\"get-port\": \"^3.2.0\",\n\"load-json-file\": \"^4.0.0\",\n+ \"multimatch\": \"^2.1.0\",\n\"npm-conf\": \"^1.1.3\",\n\"npmlog\": \"^4.1.2\",\n\"p-finally\": \"^1.0.0\",\n", "new_path": "commands/bootstrap/package.json", "old_path": "commands/bootstrap/package.json" }, { "change_type": "MODIFY", "diff": "@@ -174,10 +174,7 @@ describe(\"LsCommand\", () => {\ntry {\nawait lernaLs(testDir)(\"--scope\", \"no-package-*\");\n} catch (err) {\n- expect(err).toHaveProperty(\n- \"message\",\n- expect.stringContaining(\"No packages found that match scope 'no-package-*'\")\n- );\n+ expect(err.message).toBe(\"No packages remain after filtering [ 'no-package-*' ]\");\n}\n});\n@@ -187,10 +184,7 @@ describe(\"LsCommand\", () => {\ntry {\nawait lernaLs(testDir)(\"--ignore\", \"package-*\");\n} catch (err) {\n- expect(err).toHaveProperty(\n- \"message\",\n- expect.stringContaining(\"No packages remain after ignoring 'package-*'\")\n- );\n+ expect(err.message).toBe(\"No packages remain after filtering [ '**', '!package-*' ]\");\n}\n});\n@@ -200,10 +194,7 @@ describe(\"LsCommand\", () => {\ntry {\nawait lernaLs(testDir)(\"--scope\", \"package-a-*\", \"--ignore\", \"package-a-@(1|2)\");\n} catch (err) {\n- expect(err).toHaveProperty(\n- \"message\",\n- expect.stringContaining(\"No packages remain after ignoring 'package-a-@(1|2)'\")\n- );\n+ expect(err.message).toBe(\"No packages remain after filtering [ 'package-a-*', '!package-a-@(1|2)' ]\");\n}\n});\n});\n", "new_path": "commands/list/__tests__/list-command.test.js", "old_path": "commands/list/__tests__/list-command.test.js" }, { "change_type": "MODIFY", "diff": "@@ -189,15 +189,7 @@ class Command {\n}\nconst { rootPath, packageConfigs } = this.repository;\n- const { scope, ignore } = this.options;\n-\n- if (scope) {\n- log.info(\"scope\", scope);\n- }\n-\n- if (ignore) {\n- log.info(\"ignore\", ignore);\n- }\n+ const { scope: include, ignore: exclude } = this.options;\nlet chain = Promise.resolve();\n@@ -205,7 +197,7 @@ class Command {\nchain = chain.then(packages => {\nthis.packages = packages;\nthis.packageGraph = new PackageGraph(packages);\n- this.filteredPackages = filterPackages(packages, { scope, ignore }, this.options.private);\n+ this.filteredPackages = filterPackages(packages, { include, exclude }, this.options.private);\n});\n// collectUpdates requires that filteredPackages be present prior to checking for\n", "new_path": "core/command/index.js", "old_path": "core/command/index.js" }, { "change_type": "MODIFY", "diff": "@@ -11,11 +11,27 @@ function filterOptions(yargs) {\ndescribe: \"Include only packages with names matching the given glob.\",\ntype: \"string\",\nrequiresArg: true,\n+ coerce: arg => {\n+ // always return a list of globs\n+ if (!Array.isArray(arg)) {\n+ return [arg];\n+ }\n+\n+ return arg;\n+ },\n},\nignore: {\ndescribe: \"Exclude packages with names matching the given glob.\",\ntype: \"string\",\nrequiresArg: true,\n+ coerce: arg => {\n+ // negate any globs passed\n+ if (!Array.isArray(arg)) {\n+ return [`!${arg}`];\n+ }\n+\n+ return arg.map(str => `!${str}`);\n+ },\n},\nprivate: {\ndescribe: \"Include private packages. Pass --no-private to exclude private packages.\",\n", "new_path": "core/filter-options/index.js", "old_path": "core/filter-options/index.js" }, { "change_type": "MODIFY", "diff": "@@ -10,14 +10,14 @@ lerna success - package-3\nexports[`lerna run my-script --scope: stderr 1`] = `\nlerna info version __TEST_VERSION__\n-lerna info scope package-1\n+lerna info filter [ 'package-1' ]\nlerna success run Ran npm script 'my-script' in packages:\nlerna success - package-1\n`;\nexports[`lerna run test --ignore: stderr 1`] = `\nlerna info version __TEST_VERSION__\n-lerna info ignore package-@(1|2|3)\n+lerna info filter [ '!package-@(1|2|3)' ]\nlerna success run Ran npm script 'test' in packages:\nlerna success - package-4\n`;\n", "new_path": "integration/__snapshots__/lerna-run.test.js.snap", "old_path": "integration/__snapshots__/lerna-run.test.js.snap" }, { "change_type": "MODIFY", "diff": "\"@lerna/batch-packages\": \"file:utils/batch-packages\",\n\"@lerna/command\": \"file:core/command\",\n\"@lerna/filter-options\": \"file:core/filter-options\",\n- \"@lerna/match-package-name\": \"file:utils/match-package-name\",\n\"@lerna/npm-install\": \"file:utils/npm-install\",\n\"@lerna/rimraf-dir\": \"file:utils/rimraf-dir\",\n\"@lerna/run-lifecycle\": \"file:utils/run-lifecycle\",\n\"dedent\": \"0.7.0\",\n\"get-port\": \"3.2.0\",\n\"load-json-file\": \"4.0.0\",\n+ \"multimatch\": \"2.1.0\",\n\"npm-conf\": \"1.1.3\",\n\"npmlog\": \"4.1.2\",\n\"p-finally\": \"1.0.0\",\n\"@lerna/filter-packages\": {\n\"version\": \"file:utils/filter-packages\",\n\"requires\": {\n- \"@lerna/match-package-name\": \"file:utils/match-package-name\",\n- \"@lerna/validation-error\": \"file:core/validation-error\"\n+ \"@lerna/validation-error\": \"file:core/validation-error\",\n+ \"multimatch\": \"2.1.0\",\n+ \"npmlog\": \"4.1.2\"\n}\n},\n\"@lerna/get-npm-exec-opts\": {\n\"columnify\": \"1.5.4\"\n}\n},\n- \"@lerna/match-package-name\": {\n- \"version\": \"file:utils/match-package-name\",\n- \"requires\": {\n- \"minimatch\": \"3.0.4\"\n- }\n- },\n\"@lerna/npm-dist-tag\": {\n\"version\": \"file:utils/npm-dist-tag\",\n\"requires\": {\n\"resolved\": \"https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz\",\n\"integrity\": \"sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=\"\n},\n+ \"array-differ\": {\n+ \"version\": \"1.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz\",\n+ \"integrity\": \"sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=\"\n+ },\n\"array-equal\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n\"integrity\": \"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=\"\n},\n+ \"multimatch\": {\n+ \"version\": \"2.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz\",\n+ \"integrity\": \"sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=\",\n+ \"requires\": {\n+ \"array-differ\": \"1.0.0\",\n+ \"array-union\": \"1.0.2\",\n+ \"arrify\": \"1.0.1\",\n+ \"minimatch\": \"3.0.4\"\n+ }\n+ },\n\"mute-stream\": {\n\"version\": \"0.0.7\",\n\"resolved\": \"https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz\",\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "MODIFY", "diff": "\"use strict\";\n-const matchPackageName = require(\"@lerna/match-package-name\");\n+const util = require(\"util\");\n+const multimatch = require(\"multimatch\");\n+const log = require(\"npmlog\");\n+\nconst ValidationError = require(\"@lerna/validation-error\");\nmodule.exports = filterPackages;\n@@ -10,35 +13,47 @@ module.exports = filterPackages;\n* and do not match the ignore glob\n*\n* @param {!Array.<Package>} packagesToFilter The packages to filter\n- * @param {Object} filters The scope and ignore filters.\n- * @param {String} filters.scope glob The glob to match the package name against\n- * @param {String} filters.ignore glob The glob to filter the package name against\n+ * @param {Object} filters The include and exclude filters.\n+ * @param {Array.<String>} filters.include A list of globs to match the package name against\n+ * @param {Array.<String>} filters.exclude A list of globs to filter the package name against\n* @param {Boolean} showPrivate When false, filter out private packages\n* @return {Array.<Package>} The packages with a name matching the glob\n* @throws when a given glob would produce an empty list of packages\n*/\n-function filterPackages(packagesToFilter, { scope, ignore }, showPrivate) {\n- let packages = packagesToFilter.slice();\n+function filterPackages(packagesToFilter, { include = [], exclude = [] }, showPrivate) {\n+ const filtered = new Set(packagesToFilter);\n+ const patterns = [].concat(include, exclude);\nif (showPrivate === false) {\n- packages = packages.filter(pkg => !pkg.private);\n+ for (const pkg of filtered) {\n+ if (pkg.private) {\n+ filtered.delete(pkg);\n+ }\n+ }\n}\n- if (scope) {\n- packages = packages.filter(pkg => matchPackageName(pkg.name, scope));\n+ if (patterns.length) {\n+ log.info(\"filter\", patterns);\n- if (!packages.length) {\n- throw new ValidationError(\"EFILTER\", `No packages found that match scope '${scope}'`);\n- }\n+ if (!include.length) {\n+ // only excludes needs to select all items first\n+ // globstar is for matching scoped packages\n+ patterns.unshift(\"**\");\n}\n- if (ignore) {\n- packages = packages.filter(pkg => matchPackageName(pkg.name, ignore, true));\n+ const pnames = Array.from(filtered).map(pkg => pkg.name);\n+ const chosen = new Set(multimatch(pnames, patterns));\n+\n+ for (const pkg of filtered) {\n+ if (!chosen.has(pkg.name)) {\n+ filtered.delete(pkg);\n+ }\n+ }\n- if (!packages.length) {\n- throw new ValidationError(\"EFILTER\", `No packages remain after ignoring '${ignore}'`);\n+ if (!filtered.size) {\n+ throw new ValidationError(\"EFILTER\", util.format(\"No packages remain after filtering\", patterns));\n}\n}\n- return packages;\n+ return Array.from(filtered);\n}\n", "new_path": "utils/filter-packages/filter-packages.js", "old_path": "utils/filter-packages/filter-packages.js" }, { "change_type": "MODIFY", "diff": "\"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n},\n\"dependencies\": {\n- \"@lerna/match-package-name\": \"file:../match-package-name\",\n- \"@lerna/validation-error\": \"file:../../core/validation-error\"\n+ \"@lerna/validation-error\": \"file:../../core/validation-error\",\n+ \"multimatch\": \"^2.1.0\",\n+ \"npmlog\": \"^4.1.2\"\n}\n}\n", "new_path": "utils/filter-packages/package.json", "old_path": "utils/filter-packages/package.json" }, { "change_type": "DELETE", "diff": "-# `@lerna/match-package-name`\n-\n-> description TODO\n-\n-## Usage\n-\n-TODO\n-\n", "new_path": null, "old_path": "utils/match-package-name/README.md" }, { "change_type": "DELETE", "diff": "-\"use strict\";\n-\n-const minimatch = require(\"minimatch\");\n-\n-module.exports = matchPackageName;\n-\n-/**\n- * A predicate that determines if a given package name satisfies a glob.\n- *\n- * @param {!String} name The package name\n- * @param {String|Array<String>} filters The glob (or globs) to match a package name against\n- * @param {Boolean} negate Negate glob pattern matches\n- * @return {Boolean} The packages with a name matching the glob\n- */\n-function matchPackageName(name, filters, negate) {\n- // If there isn't a filter then we can just return the package.\n- if (!filters) {\n- return true;\n- }\n-\n- // Include/exlude with no arguments implies splat.\n- // For example: `--hoist` is equivalent to `--hoist=**`.\n- // The double star here is to account for scoped packages.\n- if (filters === true) {\n- filters = \"**\"; // eslint-disable-line no-param-reassign\n- }\n-\n- if (!Array.isArray(filters)) {\n- filters = [filters]; // eslint-disable-line no-param-reassign\n- }\n-\n- if (negate) {\n- return filters.every(pattern => !minimatch(name, pattern));\n- }\n-\n- return filters.some(pattern => minimatch(name, pattern));\n-}\n", "new_path": null, "old_path": "utils/match-package-name/match-package-name.js" }, { "change_type": "DELETE", "diff": "-{\n- \"name\": \"@lerna/match-package-name\",\n- \"version\": \"3.0.0-beta.0\",\n- \"description\": \"TODO\",\n- \"keywords\": [\n- \"lerna\",\n- \"utils\"\n- ],\n- \"homepage\": \"https://github.com/lerna/lerna\",\n- \"license\": \"MIT\",\n- \"author\": {\n- \"name\": \"Daniel Stockman\",\n- \"url\": \"https://github.com/evocateur\"\n- },\n- \"files\": [\n- \"match-package-name.js\"\n- ],\n- \"main\": \"match-package-name.js\",\n- \"engines\": {\n- \"node\": \">= 6.9.0\"\n- },\n- \"publishConfig\": {\n- \"access\": \"public\"\n- },\n- \"repository\": {\n- \"type\": \"git\",\n- \"url\": \"git+https://github.com/lerna/lerna.git\"\n- },\n- \"scripts\": {\n- \"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n- },\n- \"dependencies\": {\n- \"minimatch\": \"^3.0.4\"\n- }\n-}\n", "new_path": null, "old_path": "utils/match-package-name/package.json" } ]
JavaScript
MIT License
lerna/lerna
feat: Replace @lerna/match-package-name with multimatch
1
feat
null
807,849
09.03.2018 18:16:25
28,800
47e1c86a10020dfdcb62e13da4460eb1e4db6b29
feat(filter-packages): Simplify method signature BREAKING CHANGE: The parameters to `filterPackages()` have changed: * Two lists (include, exclude) have replaced the destructured config object
[ { "change_type": "MODIFY", "diff": "@@ -197,7 +197,7 @@ class Command {\nchain = chain.then(packages => {\nthis.packages = packages;\nthis.packageGraph = new PackageGraph(packages);\n- this.filteredPackages = filterPackages(packages, { include, exclude }, this.options.private);\n+ this.filteredPackages = filterPackages(packages, include, exclude, this.options.private);\n});\n// collectUpdates requires that filteredPackages be present prior to checking for\n", "new_path": "core/command/index.js", "old_path": "core/command/index.js" }, { "change_type": "MODIFY", "diff": "@@ -13,14 +13,13 @@ module.exports = filterPackages;\n* and do not match the ignore glob\n*\n* @param {!Array.<Package>} packagesToFilter The packages to filter\n- * @param {Object} filters The include and exclude filters.\n- * @param {Array.<String>} filters.include A list of globs to match the package name against\n- * @param {Array.<String>} filters.exclude A list of globs to filter the package name against\n+ * @param {Array.<String>} include A list of globs to match the package name against\n+ * @param {Array.<String>} exclude A list of globs to filter the package name against\n* @param {Boolean} showPrivate When false, filter out private packages\n* @return {Array.<Package>} The packages with a name matching the glob\n* @throws when a given glob would produce an empty list of packages\n*/\n-function filterPackages(packagesToFilter, { include = [], exclude = [] }, showPrivate) {\n+function filterPackages(packagesToFilter, include = [], exclude = [], showPrivate) {\nconst filtered = new Set(packagesToFilter);\nconst patterns = [].concat(include, exclude);\n", "new_path": "utils/filter-packages/filter-packages.js", "old_path": "utils/filter-packages/filter-packages.js" } ]
JavaScript
MIT License
lerna/lerna
feat(filter-packages): Simplify method signature BREAKING CHANGE: The parameters to `filterPackages()` have changed: * Two lists (include, exclude) have replaced the destructured config object
1
feat
filter-packages
217,922
09.03.2018 18:16:41
-3,600
e9c7ba5f14b0385500e5c8936e394da56b97c50a
chore: implement patreon email availability check
[ { "change_type": "MODIFY", "diff": "@@ -82,6 +82,17 @@ export class UserService extends FirebaseStorage<AppUser> {\nthis.reloader.next(null);\n}\n+ /**\n+ * Checks if a given email is available for patreon account linking.\n+ * @param {string} email\n+ * @returns {Observable<boolean>}\n+ */\n+ checkPatreonEmailAvailability(email: string): Observable<boolean> {\n+ return this.firebase.list(this.getBaseUri(), ref => ref.orderByChild('email').equalTo(email))\n+ .valueChanges()\n+ .map(res => res.length === 0);\n+ }\n+\n/**\n* Deletes a user based on his id, deleting all of his lists at the same time.\n", "new_path": "src/app/core/database/user.service.ts", "old_path": "src/app/core/database/user.service.ts" }, { "change_type": "MODIFY", "diff": "@@ -10,4 +10,5 @@ export class AppUser extends DataModel {\npatron?: boolean;\nanonymous?: boolean;\nproviderId?: string;\n+ patreonEmail?: string;\n}\n", "new_path": "src/app/model/list/app-user.ts", "old_path": "src/app/model/list/app-user.ts" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
chore: implement patreon email availability check
1
chore
null
807,849
09.03.2018 18:36:29
28,800
ecc1efb5979be74a1da2a700e972d4bef1922ddd
chore: fix changelog again :P [skip ci]
[ { "change_type": "MODIFY", "diff": "@@ -9,21 +9,20 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Bug Fixes\n-* Move [@lerna](https://github.com/lerna)/has-dependency-installed into bootstrap/lib ([c09ccbd](https://github.com/lerna/lerna/commit/c09ccbd))\n-\n+* Move `@lerna/has-dependency-installed` into `commands/bootstrap/lib` ([c09ccbd](https://github.com/lerna/lerna/commit/c09ccbd))\n### Features\n-* Rename [@lerna](https://github.com/lerna)/fs-utils => [@lerna](https://github.com/lerna)/rimraf-dir ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n-* Replace [@lerna](https://github.com/lerna)/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n-* Replace [@lerna](https://github.com/lerna)/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n+* Rename `@lerna/fs-utils` => `@lerna/rimraf-dir` ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n+* Replace `@lerna/fs-utils` dependency with `fs-extra` ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n+* Replace `@lerna/match-package-name` with `multimatch` ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n* **filter-packages:** Simplify method signature ([47e1c86](https://github.com/lerna/lerna/commit/47e1c86))\n### BREAKING CHANGES\n* **filter-packages:** The parameters to `filterPackages()` have changed:\n- * Two lists (include, exclude) have replaced the destructured config object\n+ * Two lists (`include`, `exclude`) have replaced the destructured config object\n", "new_path": "CHANGELOG.md", "old_path": "CHANGELOG.md" } ]
JavaScript
MIT License
lerna/lerna
chore: fix changelog again :P [skip ci]
1
chore
null
807,849
09.03.2018 18:49:31
28,800
092746c6b4604539c4b095461a0dcbed40710dc3
chore: fix leaf changelogs [skip ci]
[ { "change_type": "MODIFY", "diff": "@@ -9,13 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Bug Fixes\n-* Move [@lerna](https://github.com/lerna)/has-dependency-installed into bootstrap/lib ([c09ccbd](https://github.com/lerna/lerna/commit/c09ccbd))\n+* Move @lerna/has-dependency-installed into bootstrap/lib ([c09ccbd](https://github.com/lerna/lerna/commit/c09ccbd))\n### Features\n-* Rename [@lerna](https://github.com/lerna)/fs-utils => [@lerna](https://github.com/lerna)/rimraf-dir ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n-* Replace [@lerna](https://github.com/lerna)/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n+* Rename @lerna/fs-utils => @lerna/rimraf-dir ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n+* Replace @lerna/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n", "new_path": "commands/bootstrap/CHANGELOG.md", "old_path": "commands/bootstrap/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Rename [@lerna](https://github.com/lerna)/fs-utils => [@lerna](https://github.com/lerna)/rimraf-dir ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n+* Rename @lerna/fs-utils => @lerna/rimraf-dir ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n", "new_path": "commands/clean/CHANGELOG.md", "old_path": "commands/clean/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n+* Replace @lerna/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n", "new_path": "commands/import/CHANGELOG.md", "old_path": "commands/import/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n+* Replace @lerna/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n", "new_path": "commands/init/CHANGELOG.md", "old_path": "commands/init/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n+* Replace @lerna/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n", "new_path": "commands/list/CHANGELOG.md", "old_path": "commands/list/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -4,39 +4,32 @@ All notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n<a name=\"3.0.0-beta.2\"></a>\n-# [3.0.0-beta.2](https://github.com/lerna/lerna/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2018-03-10)\n+# [3.0.0-beta.2](https://github.com/lerna/lerna/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2018-03-10)\n### Features\n-* Replace [@lerna](https://github.com/lerna)/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n+* Replace @lerna/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n* **filter-packages:** Simplify method signature ([47e1c86](https://github.com/lerna/lerna/commit/47e1c86))\n-\n### BREAKING CHANGES\n* **filter-packages:** The parameters to `filterPackages()` have changed:\n* Two lists (include, exclude) have replaced the destructured config object\n-\n-\n-\n-\n<a name=\"3.0.0-beta.1\"></a>\n-# [3.0.0-beta.1](https://github.com/lerna/lerna/compare/v3.0.0-beta.0...v3.0.0-beta.1) (2018-03-09)\n+# [3.0.0-beta.1](https://github.com/lerna/lerna/compare/v3.0.0-beta.0...v3.0.0-beta.1) (2018-03-09)\n### Bug Fixes\n* **filter-options:** require a git repo when using --since ([d21b66e](https://github.com/lerna/lerna/commit/d21b66e)), closes [#822](https://github.com/lerna/lerna/issues/822)\n-\n### Features\n* **collect-packages:** simplify signature ([39170cf](https://github.com/lerna/lerna/commit/39170cf))\n* **filter-options:** Exclude private packages with --no-private ([6674d18](https://github.com/lerna/lerna/commit/6674d18))\n-\n### BREAKING CHANGES\n* **collect-packages:** Formerly a config object, it is now two parameters, only the first of\n", "new_path": "core/command/CHANGELOG.md", "old_path": "core/command/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n+* Replace @lerna/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n", "new_path": "core/conventional-commits/CHANGELOG.md", "old_path": "core/conventional-commits/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n+* Replace @lerna/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n", "new_path": "core/filter-options/CHANGELOG.md", "old_path": "core/filter-options/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,7 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n+* Replace @lerna/match-package-name with multimatch ([423f82c](https://github.com/lerna/lerna/commit/423f82c))\n* **filter-packages:** Simplify method signature ([47e1c86](https://github.com/lerna/lerna/commit/47e1c86))\n", "new_path": "utils/filter-packages/CHANGELOG.md", "old_path": "utils/filter-packages/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,4 +9,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n+* Replace @lerna/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n", "new_path": "utils/npm-install/CHANGELOG.md", "old_path": "utils/npm-install/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,4 +9,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Rename [@lerna](https://github.com/lerna)/fs-utils => [@lerna](https://github.com/lerna)/rimraf-dir ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n+* Rename @lerna/fs-utils => @lerna/rimraf-dir ([30451ed](https://github.com/lerna/lerna/commit/30451ed))\n", "new_path": "utils/rimraf-dir/CHANGELOG.md", "old_path": "utils/rimraf-dir/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,4 +9,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n+* Replace @lerna/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n", "new_path": "utils/symlink-binary/CHANGELOG.md", "old_path": "utils/symlink-binary/CHANGELOG.md" }, { "change_type": "MODIFY", "diff": "@@ -9,4 +9,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* Replace [@lerna](https://github.com/lerna)/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n+* Replace @lerna/fs-utils dependency with fs-extra ([9c35a86](https://github.com/lerna/lerna/commit/9c35a86))\n", "new_path": "utils/symlink-dependencies/CHANGELOG.md", "old_path": "utils/symlink-dependencies/CHANGELOG.md" } ]
JavaScript
MIT License
lerna/lerna
chore: fix leaf changelogs [skip ci]
1
chore
null
679,913
10.03.2018 05:45:15
0
51b02e2b01ae4c40e18879947d985109d9d934ac
feat(examples): add router-basics demo
[ { "change_type": "ADD", "diff": "+node_modules\n+yarn.lock\n+*.js\n", "new_path": "examples/router-basics/.gitignore", "old_path": null }, { "change_type": "ADD", "diff": "+# router-basics\n+\n+[Live demo](http://demo.thi.ng/umbrella/router-basics/)\n+\n+```\n+git clone https://github.com/thi-ng/umbrella.git\n+cd umbrella/examples/router-basics\n+yarn install\n+```\n+Then\n+\n+```\n+# For Mac\n+yarn dev\n+\n+# For Debian, Ubuntu, Etc.\n+yarn debdev\n+```\n+\n+Once webpack has completed building, refresh your browser...\n", "new_path": "examples/router-basics/README.md", "old_path": null }, { "change_type": "ADD", "diff": "+<!DOCTYPE html>\n+<html>\n+\n+<head>\n+ <link href=\"https://unpkg.com/tachyons@4.9.1/css/tachyons.min.css\" rel=\"stylesheet\">\n+</head>\n+\n+<body>\n+ <div id=\"app\"></div>\n+ <p class=\"pa2 system-sans-serif\">\n+ <a href=\"https://github.com/thi-ng/umbrella/blob/master/examples/router-basics/src/\">Source</a>\n+ </p>\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/router-basics/index.html", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"router-basics\",\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+ \"debdev\": \"see 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.4\",\n+ \"@thi.ng/atom\": \"^0.12.0\",\n+ \"@thi.ng/hdom\": \"^2.1.1\",\n+ \"@thi.ng/hdom-components\": \"^1.0.1\",\n+ \"@thi.ng/router\": \"^0.0.1\",\n+ \"@thi.ng/transducers\": \"^1.6.2\"\n+ }\n+}\n\\ No newline at end of file\n", "new_path": "examples/router-basics/package.json", "old_path": null }, { "change_type": "ADD", "diff": "+import { IObjectOf } from \"@thi.ng/api/api\";\n+import { EventDef, EffectDef, ViewTransform } from \"@thi.ng/atom/api\";\n+import { HTMLRouterConfig } from \"@thi.ng/router/api\";\n+\n+import { App } from \"./app\";\n+\n+export type AppComponent = (app: App) => any;\n+\n+export type ViewSpec = string | [string, ViewTransform<any>];\n+\n+export interface AppConfig {\n+ router: HTMLRouterConfig;\n+ events: IObjectOf<EventDef>;\n+ effects: IObjectOf<EffectDef>;\n+ components: IObjectOf<AppComponent>;\n+ domRoot: string | Element;\n+ initialState?: any;\n+ views?: IObjectOf<ViewSpec>;\n+}\n", "new_path": "examples/router-basics/src/api.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { IObjectOf } from \"@thi.ng/api/api\";\n+import { IView } from \"@thi.ng/atom/api\";\n+import { Atom } from \"@thi.ng/atom/atom\";\n+import { EventBus } from \"@thi.ng/atom/event-bus\";\n+import { start } from \"@thi.ng/hdom\";\n+import { EVENT_ROUTE_CHANGED } from \"@thi.ng/router/api\";\n+import { HTMLRouter } from \"@thi.ng/router/history\";\n+\n+import { AppConfig, ViewSpec } from \"./api\";\n+import { isArray } from \"util\";\n+\n+export abstract class App {\n+\n+ config: AppConfig;\n+ state: Atom<any>;\n+ bus: EventBus;\n+ router: HTMLRouter;\n+ views: IObjectOf<IView<any>>;\n+\n+ constructor(config: AppConfig) {\n+ this.config = config;\n+ this.state = new Atom(config.initialState || {});\n+ this.bus = new EventBus(this.state, config.events, config.effects);\n+ this.router = new HTMLRouter(config.router);\n+ this.router.addListener(\n+ EVENT_ROUTE_CHANGED,\n+ (e) => this.bus.dispatch([EVENT_ROUTE_CHANGED, e.value])\n+ );\n+ this.views = {};\n+ this.addViews(this.config.views);\n+ this.addViews({\n+ route: \"route\",\n+ routeComponent: [\n+ \"route.id\",\n+ (id) =>\n+ (this.config.components[id] ||\n+ (() => [\"div\", `missing component for route: ${id}`]))(this)\n+ ]\n+ });\n+ }\n+\n+ /**\n+ * Starts router and kicks of hdom render loop, including batched\n+ * event processing and fast fail check if DOM updates are necessary\n+ * (assumes ALL state is held in the app state atom. So if there\n+ * weren't any events causing a state change since last frame,\n+ * re-rendering is skipped without even attempting to diff DOM tree).\n+ */\n+ start() {\n+ this.router.start();\n+ start(this.config.domRoot, () => {\n+ if (this.bus.processQueue()) {\n+ return this.rootComponent();\n+ }\n+ });\n+ }\n+\n+ /**\n+ * User provided function to return app's root component.\n+ */\n+ abstract rootComponent(): any;\n+\n+ addViews(specs: IObjectOf<ViewSpec>) {\n+ for (let id in specs) {\n+ const spec = specs[id];\n+ if (isArray(spec)) {\n+ this.views[id] = this.state.addView(spec[0], spec[1]);\n+ } else {\n+ this.views[id] = this.state.addView(spec);\n+ }\n+ }\n+ }\n+}\n", "new_path": "examples/router-basics/src/app.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { App } from \"../app\";\n+import { ROUTE_USER_LIST, ROUTE_USER_PROFILE } from \"../config\";\n+import { link } from \"./route-link\";\n+\n+/**\n+ * Homepage component.\n+ *\n+ * @param app\n+ */\n+export function home(app: App) {\n+ return [\"div\",\n+ [\"h1\", \"Welcome\"],\n+ [\"ul\",\n+ [\"li\", link(app, ROUTE_USER_LIST, null, null, \"All users\")],\n+ [\"li\", link(app, ROUTE_USER_PROFILE, { id: 1 }, null, \"Single user\")],\n+ ]\n+ ];\n+}\n", "new_path": "examples/router-basics/src/components/home.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { Route } from \"@thi.ng/router/api\";\n+\n+import { App } from \"../app\";\n+\n+/**\n+ * Takes a route ID, route params and creates a DOM `<a>` component\n+ * with `href` set to route and using provided attribs and body.\n+ * Also attaches an `onclick` handler to forward route to router.\n+ *\n+ * @param route\n+ * @param params\n+ * @param attribs\n+ * @param body\n+ */\n+export function link(app: App, route: Route, params: any, attribs: any, body: any) {\n+ const href = app.router.format(route.id, params);\n+ return [\"a\",\n+ {\n+ ...attribs,\n+ href,\n+ onclick: (e) => (e.preventDefault(), app.router.routeTo(href)),\n+ },\n+ body\n+ ];\n+}\n\\ No newline at end of file\n", "new_path": "examples/router-basics/src/components/route-link.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { range } from \"@thi.ng/iterators/range\";\n+import { map } from \"@thi.ng/iterators/map\";\n+\n+import { App } from \"../app\";\n+import { ROUTE_HOME, ROUTE_USER_PROFILE, UI } from \"../config\";\n+import { link } from \"./route-link\";\n+\n+/**\n+ * Dummy user list component.\n+ *\n+ * @param app\n+ */\n+export function userList(app: App) {\n+ return [\"div\",\n+ [\"h1\", \"All users\"],\n+ link(app, ROUTE_HOME, null, UI.button, \"Homepage\"),\n+ [linkList, app, 3]\n+ ];\n+}\n+\n+function linkList(app: App, num = 3) {\n+ const users = app.views.users.deref();\n+ return [\"ul\",\n+ map(\n+ (id: number) => [\"li\",\n+ link(\n+ app,\n+ ROUTE_USER_PROFILE,\n+ { id },\n+ null,\n+ users[id] ? users[id].name : `User #${id}`\n+ )\n+ ],\n+ range(1, num + 1)\n+ )];\n+}\n\\ No newline at end of file\n", "new_path": "examples/router-basics/src/components/user-list.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { App } from \"../app\";\n+import { EV_LOAD_USER, EV_SET_STATUS, ROUTE_USER_LIST, UI } from \"../config\";\n+import { link } from \"./route-link\";\n+\n+/**\n+ * Single user profile page. Trigger JSON I/O request if user data has\n+ * not been loaded yet.\n+ *\n+ * @param app\n+ */\n+export function userProfile(app: App) {\n+ const id = app.views.route.deref().params.id;\n+ if (!app.views.users.deref()[id]) {\n+ app.bus.dispatch([EV_LOAD_USER, id]);\n+ } else {\n+ app.bus.dispatch([EV_SET_STATUS, [\"idle\", \"loaded from cache\"]]);\n+ }\n+ return [\"div\",\n+ [userDetails, app, id],\n+ [\"p\", link(app, ROUTE_USER_LIST, null, UI.button, \"Show all users\")],\n+ [status, app]\n+ ];\n+}\n+\n+function userDetails(app: App, id: number) {\n+ const user = app.views.users.deref()[id];\n+ return user ?\n+ [\"h1\", user.name, [\"small\", UI.subtitle, ` (${user.job})`]] :\n+ [\"h1\", `User #${id}`];\n+}\n+\n+function status(app: App) {\n+ const status = app.views.status.deref() || [];\n+ return [\"p\", UI.status[status[0]], `${status[1]}`];\n+}\n\\ No newline at end of file\n", "new_path": "examples/router-basics/src/components/user-profile.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { FX_STATE, FX_DISPATCH_ASYNC, FX_DISPATCH_NOW } from \"@thi.ng/atom/api\";\n+import { valueSetter } from \"@thi.ng/atom/interceptors\";\n+import { setIn } from \"@thi.ng/atom/path\";\n+import { Route, EVENT_ROUTE_CHANGED } from \"@thi.ng/router/api\";\n+\n+import { AppConfig } from \"./api\";\n+\n+import { home } from \"./components/home\";\n+import { userList } from \"./components/user-list\";\n+import { userProfile } from \"./components/user-profile\";\n+\n+// route definitions:\n+// the `match` arrays specify the individual route elements\n+\n+export const ROUTE_HOME: Route = {\n+ id: \"home\",\n+ match: [\"home\"]\n+};\n+\n+// this is a parametric route w/ parameter coercion & validation\n+// if validation fails, the route will not be matched\n+\n+export const ROUTE_USER_PROFILE: Route = {\n+ id: \"user-profile\",\n+ match: [\"users\", \"?id\"],\n+ validate: {\n+ id: {\n+ coerce: (x) => parseInt(x),\n+ check: (x) => x > 0 && x < 100\n+ }\n+ }\n+};\n+\n+export const ROUTE_USER_LIST: Route = {\n+ id: \"user-list\",\n+ match: [\"users\"],\n+};\n+\n+// best practice tip: define event & effect names as consts or enums\n+// and avoid hardcoded strings\n+\n+export const EV_DONE = \"done\";\n+export const EV_ERROR = \"error\";\n+export const EV_LOAD_USER = \"load-user\";\n+export const EV_RECEIVE_USER = \"receive-user\";\n+export const EV_SET_STATUS = \"set-status\";\n+\n+const FX_JSON = \"load-json\";\n+const FX_DELAY = \"delay\";\n+\n+// main App configuration\n+\n+export const CONFIG: AppConfig = {\n+ // router configuration\n+ router: {\n+ // use URI hash for routes (KISS)\n+ useFragment: true,\n+ // route ID if no other matches (MUST be non-parametric!)\n+ defaultRouteID: ROUTE_HOME.id,\n+ // IMPORTANT: rules with common prefixes MUST be specified in\n+ // order of highest precision / longest path\n+ routes: [\n+ ROUTE_HOME,\n+ ROUTE_USER_PROFILE,\n+ ROUTE_USER_LIST,\n+ ]\n+ },\n+\n+ // event handlers\n+ events: {\n+ [EV_DONE]: () => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [\"idle\", \"done.\"]]\n+ }),\n+\n+ [EV_ERROR]: (_, [__, err]) => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [\"error\", err.message]],\n+ [FX_DISPATCH_ASYNC]: [FX_DELAY, [1000], EV_DONE, EV_ERROR],\n+ }),\n+\n+ [EV_LOAD_USER]: (_, [__, id]) => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [\"idle\", `loading user data...`]],\n+ [FX_DISPATCH_ASYNC]: [FX_JSON, `user-${id}.json`, EV_RECEIVE_USER, EV_ERROR]\n+ }),\n+\n+ [EV_RECEIVE_USER]: (state, [__, json]) => ({\n+ [FX_STATE]: setIn(state, [\"users\", json.id], json),\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [\"success\", \"JSON succesfully loaded\"]],\n+ [FX_DISPATCH_ASYNC]: [FX_DELAY, [1000], EV_DONE, EV_ERROR],\n+ }),\n+\n+ [EVENT_ROUTE_CHANGED]: valueSetter(\"route\"),\n+\n+ [EV_SET_STATUS]: valueSetter(\"status\"),\n+ },\n+\n+ // side effects\n+ effects: {\n+ [FX_JSON]: (url) =>\n+ fetch(url).then((res) => {\n+ if (!res.ok) {\n+ throw new Error(res.statusText);\n+ }\n+ return res.json();\n+ }),\n+ [FX_DELAY]: ([x, body]) => new Promise((res) => setTimeout(() => res(body), x))\n+ },\n+\n+ // mapping route IDs to their respective UI component functions\n+ // those functions are called with the app instance as sole argument\n+ components: {\n+ [ROUTE_HOME.id]: home,\n+ [ROUTE_USER_LIST.id]: userList,\n+ [ROUTE_USER_PROFILE.id]: userProfile,\n+ },\n+\n+ // derived view declarations\n+ // each key specifies the name of the view and its value\n+ // the state path or `[path, transformer]`\n+ views: {\n+ jsonState: [\"\", (state) => [\"pre\", UI.code, \"// App state:\\n\\n\", JSON.stringify(state, null, 2)]],\n+ status: \"status\",\n+ users: [\"users\", (users) => users || {}],\n+ },\n+\n+ // DOM root element (or ID)\n+ domRoot: \"app\"\n+};\n+\n+// tachyons.css class presets for skinning different UI elements\n+// see usage in `/view/*.ts` files...\n+export const UI = {\n+ root: { class: \"measure pa2 system-sans-serif \" },\n+ button: { class: \"pa2 bn bg-navy white link\" },\n+ code: { class: \"pa2 bg-moon-gray code f7\" },\n+ subtitle: { class: \"f5 normal moon-gray\" },\n+ status: {\n+ idle: { class: \"pa2 bg-light-yellow\" },\n+ success: { class: \"pa2 bg-light-green\" },\n+ error: { class: \"pa2 bg-light-red\" },\n+ }\n+};\n", "new_path": "examples/router-basics/src/config.ts", "old_path": null }, { "change_type": "ADD", "diff": "+import { CONFIG, UI } from \"./config\";\n+import { App } from \"./app\";\n+\n+class DemoApp extends App {\n+\n+ rootComponent() {\n+ return [\"div\", UI.root,\n+ this.views.routeComponent.deref(),\n+ this.views.jsonState.deref()\n+ ]\n+ }\n+}\n+\n+new DemoApp(CONFIG).start();\n", "new_path": "examples/router-basics/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/router-basics/tsconfig.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"id\": 1,\n+ \"name\": \"Alice Burton\",\n+ \"job\": \"AI researcher\"\n+}\n\\ No newline at end of file\n", "new_path": "examples/router-basics/user-1.json", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"id\": 2,\n+ \"name\": \"Charlie Deep\",\n+ \"job\": \"Blockchain enthusiast\"\n+}\n\\ No newline at end of file\n", "new_path": "examples/router-basics/user-2.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/router-basics/webpack.config.js", "old_path": null } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
feat(examples): add router-basics demo
1
feat
examples
679,913
10.03.2018 05:48:13
0
d8b8d9783fee4f9df0c2885db2d8ef001e2460aa
docs: add router package links to main readme
[ { "change_type": "MODIFY", "diff": "@@ -35,6 +35,7 @@ All packages are:\n| [`@thi.ng/hiccup-css`](./packages/hiccup-css) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/hiccup-css.svg)](https://www.npmjs.com/package/@thi.ng/hiccup-css) | [changelog](./packages/hiccup-css/CHANGELOG.md) |\n| [`@thi.ng/iterators`](./packages/iterators) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/iterators.svg)](https://www.npmjs.com/package/@thi.ng/iterators) | [changelog](./packages/iterators/CHANGELOG.md) |\n| [`@thi.ng/rle-pack`](./packages/rle-pack) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rle-pack.svg)](https://www.npmjs.com/package/@thi.ng/rle-pack) | [changelog](./packages/rle-pack/CHANGELOG.md) |\n+| [`@thi.ng/router`](./packages/router) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/router.svg)](https://www.npmjs.com/package/@thi.ng/router) | [changelog](./packages/router/CHANGELOG.md) |\n| [`@thi.ng/rstream`](./packages/rstream) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream.svg)](https://www.npmjs.com/package/@thi.ng/rstream) | [changelog](./packages/rstream/CHANGELOG.md) |\n| [`@thi.ng/rstream-csp`](./packages/rstream-csp) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream-csp.svg)](https://www.npmjs.com/package/@thi.ng/rstream-csp) | [changelog](./packages/rstream-csp/CHANGELOG.md) |\n| [`@thi.ng/rstream-log`](./packages/rstream-log) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream-log.svg)](https://www.npmjs.com/package/@thi.ng/rstream-log) | [changelog](./packages/rstream-log/CHANGELOG.md) |\n", "new_path": "README.md", "old_path": "README.md" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
docs: add router package links to main readme
1
docs
null
217,886
10.03.2018 18:27:14
-3,600
694ce88f7c8035dcd0ac2426487e7ab770b2a92f
chore: remove checkbox from issue_template checkboxes look nice, but they introduce a progress-bar in the issue listing, not very helpful in this case
[ { "change_type": "MODIFY", "diff": "## I'm submitting a...\n-- [ ] Bug report *- please add **bug:** before the title*\n-- [ ] Feature request *- please add **feat:** before the title*\n-- [ ] Support request *- please come on [our discord](https://discord.gg/r6qxt6P) instead*\n+* [_] Bug report *- please add **bug:** before the title*\n+* [_] Feature request *- please add **feat:** before the title*\n+* [_] Support request *- please come on [our discord](https://discord.gg/r6qxt6P) instead*\n<!-- Fill in for bug reports only -->\n## Environment\n", "new_path": ".github/ISSUE_TEMPLATE.md", "old_path": ".github/ISSUE_TEMPLATE.md" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
chore: remove checkbox from issue_template checkboxes look nice, but they introduce a progress-bar in the issue listing, not very helpful in this case
1
chore
null
217,886
10.03.2018 18:47:37
-3,600
ace61f546982b087b799661977df47945c84b76c
chore: issue_template checkbox fix - take 2 last change still resulted in checkboxes, so we're taking the sledgehammer approach.
[ { "change_type": "MODIFY", "diff": "## I'm submitting a...\n-* [_] Bug report *- please add **bug:** before the title*\n-* [_] Feature request *- please add **feat:** before the title*\n-* [_] Support request *- please come on [our discord](https://discord.gg/r6qxt6P) instead*\n+* (_) Bug report *- please add **bug:** before the title*\n+* (x) Feature request *- please add **feat:** before the title*\n+* (_) Support request *- please come on [our discord](https://discord.gg/r6qxt6P) instead*\n<!-- Fill in for bug reports only -->\n## Environment\n", "new_path": ".github/ISSUE_TEMPLATE.md", "old_path": ".github/ISSUE_TEMPLATE.md" } ]
TypeScript
MIT License
ffxiv-teamcraft/ffxiv-teamcraft
chore: issue_template checkbox fix - take 2 last change still resulted in checkboxes, so we're taking the sledgehammer approach.
1
chore
null
679,913
11.03.2018 00:10:36
0
eac0e96f2e580eedf213cc5bc8350cc3cee24e2e
docs(router): update readme & package
[ { "change_type": "MODIFY", "diff": "## About\n+Generic router for browser & non-browser based applications with support for:\n+- Declarative route definitions\n+- Parametric routes, each param with optional value coercion & validation\n+- Route authentication handler to enable/disable routes based on other state factors\n+- Fallback route\n+- Enforced initial route (optional)\n+- Route formatting (with params)\n+- HTML5 history & hash fragment support\n## Installation\n@@ -14,11 +22,102 @@ yarn add @thi.ng/router\n## Usage examples\n+A complete, full commented demo app is here:\n+\n+[Source](https://github.com/thi-ng/umbrella/blob/master/examples/router-basics/) | [Live demo](http://demo.thi.ng/umbrella/router-basics/)\n+\n```typescript\n-import * as router from \"@thi.ng/router\";\n+import * as r from \"@thi.ng/router\";\n+\n+// router configuration\n+const config = {\n+\n+ // use hash fragment for routes\n+ useFragment: true,\n+\n+ // fallback route (when no other matches)\n+ defaultRouteID: \"home\",\n+\n+ // optional enforced route when router starts\n+ initialRouteID: \"home\",\n+ // Optional route path component separator. Default: `/`\n+ separator: \"/\",\n+\n+ // Route prefix. Default: `/`. All routes to be parsed by `route()`\n+ // are assumed to have this prefix. All routes returned by\n+ // `format()` will include this prefix.\n+ prefix: \"/\",\n+\n+ // actual route defs\n+ // these are checked in given order\n+ // IMPORTANT: rules with common prefixes MUST be specified in\n+ // order of highest precision / longest path\n+ routes: [\n+ {\n+ // each route MUST have an ID\n+ id: \"home\",\n+ // optional title for UI purposes (no internal function)\n+ title: \"Home page\",\n+ // this array defines the route path items\n+ match: [\"home\"]\n+ },\n+ {\n+ id: \"user-profile\",\n+ // this rule is parametric\n+ // variable items are prefixed with `?`\n+ match: [\"users\", \"?id\"],\n+ // coercion & validation handlers for \"?id\" param\n+ // coercion fn is applied BEFORE validator\n+ validate: {\n+ id: {\n+ coerce: (x) => parseInt(x),\n+ check: (x)=> x > 0 && x < 100\n+ }\n+ }\n+ },\n+ {\n+ id: \"image\",\n+ // this route has 2 params and matches (for example):\n+ // \"/images/07a9d87b-c07a-42e3-82cf-baea2f94facc/xl\"\n+ match: [\"images\", \"?id\", \"?size\"],\n+ validate: {\n+ id: {\n+ check: (x)=> isUUID(x)\n+ },\n+ size: {\n+ check: (x)=> /^(s|m|l|xl)$/.test(x)\n+ }\n+ },\n+ // enable auth for this route\n+ // (see info about authenticator functions below)\n+ auth: true\n+ },\n+ {\n+ id: \"group-list\",\n+ // matches only: \"/users\" or \"/images\"\n+ match: [\"?type\"],\n+ validate: {\n+ type: {\n+ check: (x) => /^(users|images)$/.test(x)\n+ }\n+ },\n+ auth: true\n+ },\n+ ]\n+};\n+\n+\n+// `HTMLRouter` ONLY works in browser environments\n+// for non-browser use cases use `BasicRouter`\n+const router = new r.HTMLRouter(config);\n+router.addListener(r.EV_ROUTE_CHANGED, console.log);\n+\n+router.start();\n```\n+See [further comments in source code](https://github.com/thi-ng/umbrella/blob/master/packages/router/src/api.ts)\n+\n## Authors\n- Karsten Schmidt\n", "new_path": "packages/router/README.md", "old_path": "packages/router/README.md" }, { "change_type": "MODIFY", "diff": "{\n\"name\": \"@thi.ng/router\",\n\"version\": \"0.0.1\",\n- \"description\": \"TODO\",\n+ \"description\": \"Generic router for browser & non-browser based applications\",\n\"main\": \"./index.js\",\n\"typings\": \"./index.d.ts\",\n\"repository\": \"https://github.com/thi-ng/umbrella\",\n", "new_path": "packages/router/package.json", "old_path": "packages/router/package.json" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
docs(router): update readme & package
1
docs
router
679,913
11.03.2018 02:59:25
0
0ca0bf3ef1f67f0e6f85effc481a9e60b69fc7ce
fix(atom): ignore side fx with null values
[ { "change_type": "MODIFY", "diff": "@@ -375,6 +375,9 @@ export class StatelessEventBus implements\n* { [FX_DISPATCH]: [ [\"foo\", \"bar\"], [\"baz\", \"beep\"] ]}\n* ```\n*\n+ * Any `null` / `undefined` values directly assigned to a side effect\n+ * are ignored and will not trigger the effect.\n+ *\n* @param fx\n* @param ret\n*/\n@@ -384,6 +387,9 @@ export class StatelessEventBus implements\n}\nfor (let k in ret) {\nconst v = ret[k];\n+ if (v == null) {\n+ continue;\n+ }\nif (k === FX_STATE || k === FX_CANCEL) {\nctx[k] = v;\n} else if (k === FX_DISPATCH_NOW) {\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
fix(atom): ignore side fx with null values
1
fix
atom
679,913
11.03.2018 03:19:32
0
10ea19f5b393182f6e66cf0f03bc54a74c2a95dd
docs(atom): update readme & doc strings
[ { "change_type": "MODIFY", "diff": "@@ -395,10 +395,18 @@ a.u === b.u; // true\n### Event bus, interceptors, side effects\n-Description forthcoming, please check fully commented examples for now:\n+Description forthcoming. Please check the detailed commented source code and examples for now:\n-- [/examples/interceptor-basics](https://github.com/thi-ng/umbrella/tree/master/examples/interceptor-basics)\n-- [/examples/async-effect](https://github.com/thi-ng/umbrella/tree/master/examples/async-effect)\n+- [/src/event-bus.ts](https://github.com/thi-ng/umbrella/tree/master/packages/atom/src/event-bus.ts)\n+\n+Introductory:\n+\n+- [/examples/interceptor-basics](https://github.com/thi-ng/umbrella/tree/master/examples/interceptor-basics) | [live demo](http://demo.thi.ng/umbrella/interceptor-basics)\n+- [/examples/async-effect](https://github.com/thi-ng/umbrella/tree/master/examples/async-effect) | [live demo](http://demo.thi.ng/umbrella/async-effect)\n+\n+Advanced:\n+\n+- [/examples/router-basics](https://github.com/thi-ng/umbrella/tree/master/examples/router-basics) | [live demo](http://demo.thi.ng/umbrella/router-basics)\n## Authors\n", "new_path": "packages/atom/README.md", "old_path": "packages/atom/README.md" }, { "change_type": "MODIFY", "diff": "@@ -53,11 +53,11 @@ const FX_STATE = api.FX_STATE;\n* based on the pattern initially pioneered by @Day8/re-frame, with the\n* following differences:\n*\n- * - stateless (see `StatefulEventBus` for alternative)\n+ * - stateless (see `EventBus` for the more common stateful alternative)\n* - standalone implementation (no assumptions about surrounding\n* context/framework)\n- * - manual trigger of event queue processing\n- * - supports event cancellation\n+ * - manual control over event queue processing\n+ * - supports event cancellation (via FX_CANCEL side effect)\n* - side effect collection (multiple side effects for same effect type\n* per frame)\n* - side effect priorities (to control execution order)\n@@ -77,9 +77,8 @@ export class StatelessEventBus implements\nprotected priorities: api.EffectPriority[];\n/**\n- * Creates a new event bus instance with given parent state, handler\n- * and effect definitions (all optional). If no state is given,\n- * automatically creates an `Atom` with empty state object.\n+ * Creates a new event bus instance with given handler and effect\n+ * definitions (all optional).\n*\n* In addition to the user provided handlers & effects, a number of\n* built-ins are added automatically. See `addBuiltIns()`.\n@@ -106,7 +105,7 @@ export class StatelessEventBus implements\n*\n* ### Handlers\n*\n- * none\n+ * currently none\n*\n* ### Side effects\n*\n@@ -211,6 +210,10 @@ export class StatelessEventBus implements\n}\n}\n+ /**\n+ * If called during event processing, returns current side effect\n+ * accumulator / interceptor context. Otherwise returns nothing.\n+ */\ncontext() {\nreturn this.currCtx;\n}\n@@ -355,8 +358,9 @@ export class StatelessEventBus implements\n* are the following effects, which for obvious reasons can only\n* accept a single value.\n*\n- * **Note:** the `FX_STATE` effect is not actually used here, but is\n- * supported to avoid code duplication in `StatefulEventBus`.\n+ * **Note:** the `FX_STATE` effect is not actually defined by this\n+ * class here, but is supported to avoid code duplication in\n+ * `StatefulEventBus`.\n*\n* - `FX_CANCEL`\n* - `FX_STATE`\n@@ -375,8 +379,8 @@ export class StatelessEventBus implements\n* { [FX_DISPATCH]: [ [\"foo\", \"bar\"], [\"baz\", \"beep\"] ]}\n* ```\n*\n- * Any `null` / `undefined` values directly assigned to a side effect\n- * are ignored and will not trigger the effect.\n+ * Any `null` / `undefined` values directly assigned to a side\n+ * effect are ignored and will not trigger the effect.\n*\n* @param fx\n* @param ret\n@@ -454,7 +458,7 @@ export class EventBus extends StatelessEventBus implements\n/**\n* Adds same built-in event & side effect handlers as in\n- * `EventBus.addBuiltIns()` with the following additions:\n+ * `StatelessEventBus.addBuiltIns()` with the following additions:\n*\n* ### Handlers\n*\n", "new_path": "packages/atom/src/event-bus.ts", "old_path": "packages/atom/src/event-bus.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
docs(atom): update readme & doc strings
1
docs
atom
679,913
11.03.2018 03:23:24
0
eb73ae93b9a3b6941c2632d16998fc4c656fa1ce
refactor(examples): update router demo
[ { "change_type": "MODIFY", "diff": "git clone https://github.com/thi-ng/umbrella.git\ncd umbrella/examples/router-basics\nyarn install\n+yarn build\n```\n-Then\n-```\n-# For Mac\n-yarn dev\n+Unlike other examples, this one requires a local webserver to function, for example:\n-# For Debian, Ubuntu, Etc.\n-yarn debdev\n```\n+python -m SimpleHTTPServer\n+```\n+\n+## Notes\n-Once webpack has completed building, refresh your browser...\n+It is by design that loading of user #3 (\"Emilia Fox\") is failing. This\n+is to demonstrate error handling behavior...\n\\ No newline at end of file\n", "new_path": "examples/router-basics/README.md", "old_path": "examples/router-basics/README.md" }, { "change_type": "MODIFY", "diff": "\"debdev\": \"see index.html && webpack -w\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^3.3.1\",\n- \"typescript\": \"^2.7.1\",\n- \"webpack\": \"^3.10.0\"\n+ \"ts-loader\": \"^3.5.0\",\n+ \"typescript\": \"^2.7.2\",\n+ \"webpack\": \"^3.11.0\"\n},\n\"dependencies\": {\n\"@thi.ng/api\": \"^2.0.4\",\n- \"@thi.ng/atom\": \"^0.12.0\",\n+ \"@thi.ng/atom\": \"^0.12.1\",\n\"@thi.ng/hdom\": \"^2.1.1\",\n- \"@thi.ng/hdom-components\": \"^1.0.1\",\n- \"@thi.ng/router\": \"^0.0.1\",\n- \"@thi.ng/transducers\": \"^1.6.2\"\n+ \"@thi.ng/router\": \"^0.1.0\"\n}\n}\n\\ No newline at end of file\n", "new_path": "examples/router-basics/package.json", "old_path": "examples/router-basics/package.json" }, { "change_type": "MODIFY", "diff": "@@ -14,7 +14,7 @@ export function allUsers(app: App, ui: any) {\nif (!app.views.users.deref().all) {\napp.bus.dispatch([EV_LOAD_USER_LIST]);\n} else {\n- app.bus.dispatch([EV_SET_STATUS, [StatusType.INFO, \"loaded from cache\"]]);\n+ app.bus.dispatch([EV_SET_STATUS, [StatusType.SUCCESS, \"loaded from cache\", true]]);\n}\nreturn [\"div\",\n[status, app, ui.status],\n", "new_path": "examples/router-basics/src/components/all-users.ts", "old_path": "examples/router-basics/src/components/all-users.ts" }, { "change_type": "MODIFY", "diff": "@@ -16,7 +16,7 @@ export function userProfile(app: App, ui: any) {\n} else {\napp.bus.dispatch([\nEV_SET_STATUS,\n- [StatusType.INFO, \"loaded from cache\"]\n+ [StatusType.SUCCESS, \"loaded from cache\", true]\n]);\n}\nreturn [\"div\",\n", "new_path": "examples/router-basics/src/components/user-profile.ts", "old_path": "examples/router-basics/src/components/user-profile.ts" }, { "change_type": "MODIFY", "diff": "-import { FX_STATE, FX_DISPATCH_ASYNC, FX_DISPATCH_NOW } from \"@thi.ng/atom/api\";\n-import { valueSetter, valueUpdater } from \"@thi.ng/atom/interceptors\";\n-import { setIn } from \"@thi.ng/atom/path\";\n+import { Event, FX_DISPATCH_ASYNC, FX_DISPATCH_NOW, EV_SET_VALUE } from \"@thi.ng/atom/api\";\n+import { valueSetter, valueUpdater, trace } from \"@thi.ng/atom/interceptors\";\nimport { Route, EVENT_ROUTE_CHANGED } from \"@thi.ng/router/api\";\nimport { AppConfig } from \"./api\";\n@@ -9,10 +8,15 @@ import { home } from \"./components/home\";\nimport { allUsers } from \"./components/all-users\";\nimport { userProfile } from \"./components/user-profile\";\nimport { contact } from \"./components/contact\";\n+import { App } from \"./app\";\n// route definitions:\n+// routes are 1st class objects and used directly throughout the app\n+// without ever referring to their specific string representation\n+\n// the `match` arrays specify the individual route elements\n// docs here:\n+// https://github.com/thi-ng/umbrella/blob/master/packages/router/\n// https://github.com/thi-ng/umbrella/blob/master/packages/router/src/api.ts#L31\nexport const ROUTE_HOME: Route = {\n@@ -31,7 +35,9 @@ export const ROUTE_USER_LIST: Route = {\n};\n// this is a parametric route w/ parameter coercion & validation\n-// if validation fails, the route will not be matched\n+// if coercion or validation fails, the route will not be matched\n+// if no other route matches, the configured default route will\n+// be used (see full router config further below)\nexport const ROUTE_USER_PROFILE: Route = {\nid: \"user-profile\",\n@@ -50,14 +56,15 @@ export const ROUTE_USER_PROFILE: Route = {\nexport const EV_DONE = \"done\";\nexport const EV_ERROR = \"error\";\nexport const EV_LOAD_USER = \"load-user\";\n+export const EV_LOAD_USER_ERROR = \"load-user-error\"\nexport const EV_LOAD_USER_LIST = \"load-users\";\nexport const EV_RECEIVE_USER = \"receive-user\";\nexport const EV_RECEIVE_USERS = \"receive-users\";\nexport const EV_SET_STATUS = \"set-status\";\nexport const EV_TOGGLE_DEBUG = \"toggle-debug\";\n-// side effect IDs (don't / shouldn't need to be exported, other parts\n-// of the app should only use events)\n+// side effect IDs (these don't / shouldn't need to be exported. other\n+// parts of the app should only use events)\nconst FX_JSON = \"load-json\";\nconst FX_DELAY = \"delay\";\n@@ -90,9 +97,17 @@ export const CONFIG: AppConfig = {\n]\n},\n- // event handlers\n- // docs here:\n+ // event handlers events are queued and batch processed in app's RAF\n+ // renderloop event handlers can be single functions, interceptor\n+ // objects with `pre`/`post` keys or arrays of either.\n+\n+ // the event handlers' only task is to transform the event into a\n+ // number of side effects. event handlers should be pure functions\n+ // and only side effect functions execute any \"real\" work.\n+\n+ // see EventBus docs here:\n// https://github.com/thi-ng/umbrella/blob/master/packages/atom/src/event-bus.ts#L14\n+\nevents: {\n// sets status to \"done\"\n[EV_DONE]: () => ({\n@@ -100,43 +115,63 @@ export const CONFIG: AppConfig = {\n}),\n// sets status to thrown error's message\n- // then triggers EV_DONE after 1sec\n[EV_ERROR]: (_, [__, err]) => ({\n[FX_DISPATCH_NOW]: [EV_SET_STATUS, [StatusType.ERROR, err.message]],\n- [FX_DISPATCH_ASYNC]: [FX_DELAY, [1000], EV_DONE, EV_ERROR],\n}),\n// triggers loading of JSON for single user, sets status\n[EV_LOAD_USER]: (_, [__, id]) => ({\n[FX_DISPATCH_NOW]: [EV_SET_STATUS, [StatusType.INFO, `loading user data...`]],\n- [FX_DISPATCH_ASYNC]: [FX_JSON, `user-${id}.json`, EV_RECEIVE_USER, EV_ERROR]\n+ [FX_DISPATCH_ASYNC]: [FX_JSON, `assets/user-${id}.json`, EV_RECEIVE_USER, EV_LOAD_USER_ERROR]\n}),\n// triggered after successful IO\n// stores received user data under `users.{id}`, sets status\n- // then calls EV_DONE after 1sec\n- [EV_RECEIVE_USER]: (state, [__, json]) => ({\n- [FX_STATE]: setIn(state, [\"users\", json.id], json),\n- [FX_DISPATCH_NOW]: [EV_SET_STATUS, [StatusType.SUCCESS, \"JSON succesfully loaded\"]],\n- [FX_DISPATCH_ASYNC]: [FX_DELAY, [1000], EV_DONE, EV_ERROR],\n+ // note: we assign multiple value/events as array to the FX_DISPATCH_NOW side effect\n+ [EV_RECEIVE_USER]: (_, [__, json]) => ({\n+ [FX_DISPATCH_NOW]: [\n+ <Event>[EV_SET_VALUE, [[\"users\", json.id], json]],\n+ <Event>[EV_SET_STATUS, [StatusType.SUCCESS, \"JSON succesfully loaded\", true]]\n+ ],\n}),\n+ // error event for user profile IO requests (i.e. in this demo for user ID 3)\n+ // set status, then redirects to /users after 1sec\n+ [EV_LOAD_USER_ERROR]: (_, [__, err]) => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_STATUS, [StatusType.ERROR, err.message]],\n+ [FX_DISPATCH_ASYNC]: [FX_DELAY, [1000, [ROUTE_USER_LIST.id]], App.EV_ROUTE_TO, EV_ERROR],\n+ }),\n+\n+ // triggers loading of JSON summary of all users, sets status\n[EV_LOAD_USER_LIST]: () => ({\n[FX_DISPATCH_NOW]: [EV_SET_STATUS, [StatusType.INFO, `loading user data...`]],\n- [FX_DISPATCH_ASYNC]: [FX_JSON, `users.json`, EV_RECEIVE_USERS, EV_ERROR]\n+ [FX_DISPATCH_ASYNC]: [FX_JSON, `assets/users.json`, EV_RECEIVE_USERS, EV_ERROR]\n}),\n- [EV_RECEIVE_USERS]: (state, [__, json]) => ({\n- [FX_STATE]: setIn(state, \"users.all\", json),\n- [FX_DISPATCH_NOW]: [EV_SET_STATUS, [StatusType.SUCCESS, \"JSON succesfully loaded\"]],\n- [FX_DISPATCH_ASYNC]: [FX_DELAY, [1000], EV_DONE, EV_ERROR],\n+ // triggered after successful IO\n+ // note: we assign multiple value/events as array to the FX_DISPATCH_NOW side effect\n+ [EV_RECEIVE_USERS]: (_, [__, json]) => ({\n+ [FX_DISPATCH_NOW]: [\n+ <Event>[EV_SET_VALUE, [\"users.all\", json]],\n+ <Event>[EV_SET_STATUS, [StatusType.SUCCESS, \"JSON succesfully loaded\", true]]\n+ ],\n}),\n// stores current route details\n[EVENT_ROUTE_CHANGED]: valueSetter(\"route\"),\n- // stores status (a 2-tuple of `[status-type, message]`)\n- [EV_SET_STATUS]: valueSetter(\"status\"),\n+ // stores status (a tuple of `[type, message, done?]`) in app state\n+ // if status type != DONE & `done` == true, also triggers delayed EV_DONE\n+ // Note: we inject the `trace` interceptor to log the event to the console\n+ [EV_SET_STATUS]: [\n+ trace,\n+ (_, [__, status]) => ({\n+ [FX_DISPATCH_NOW]: [EV_SET_VALUE, [\"status\", status]],\n+ [FX_DISPATCH_ASYNC]: (status[0] !== StatusType.DONE && status[2]) ?\n+ [FX_DELAY, [1000], EV_DONE, EV_ERROR] :\n+ undefined\n+ })\n+ ],\n// toggles debug state flag on/off\n[EV_TOGGLE_DEBUG]: valueUpdater(\"debug\", (x: number) => x ^ 1)\n@@ -193,6 +228,9 @@ export const CONFIG: AppConfig = {\n},\n// component CSS class config using tachyons-css\n+ // these attribs are being passed to all/most components\n+\n+ // looks at first somewhat cryptic, but it's a great/powerful system\n// http://tachyons.io/\nui: {\nroot: { class: \"flex-ns sans-serif ma0\" },\n@@ -205,10 +243,10 @@ export const CONFIG: AppConfig = {\nbodyCopy: { class: \"center measure-narrow measure-ns tc lh-copy black-70\" },\nbodyLink: { class: \"link dim black\" },\nstatus: {\n- [StatusType.DONE]: { class: \"pa2 bg-light-yellow gold tc fadeout\" },\n- [StatusType.INFO]: { class: \"pa2 bg-light-yellow gold tc\" },\n- [StatusType.SUCCESS]: { class: \"pa2 bg-light-green green tc\" },\n- [StatusType.ERROR]: { class: \"pa2 bg-light-red dark-red tc\" },\n+ [StatusType.DONE]: { class: \"pa2 bg-light-yellow gold tc fadeout bg-animate\" },\n+ [StatusType.INFO]: { class: \"pa2 bg-light-yellow gold tc bg-animate\" },\n+ [StatusType.SUCCESS]: { class: \"pa2 bg-light-green green tc bg-animate\" },\n+ [StatusType.ERROR]: { class: \"pa2 bg-light-red dark-red tc bg-animate\" },\n},\ncard: {\ncontainer: { class: \"mw5 center bg-white br3 pa3 pa4-ns mv3 ba b--black-10 tc\" },\n", "new_path": "examples/router-basics/src/config.ts", "old_path": "examples/router-basics/src/config.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(examples): update router demo
1
refactor
examples
679,913
11.03.2018 21:19:39
0
777b1b05ef5f33edb656a53bea3ab2a65fe5c84a
refactor(examples): more stateless components, add docs
[ { "change_type": "MODIFY", "diff": "@@ -4,10 +4,22 @@ import { HTMLRouterConfig, RouteMatch } from \"@thi.ng/router/api\";\nimport { App } from \"./app\";\n+// general types defined for the base app\n+\n+/**\n+ * Function signature for main app components.\n+ * I.e. components representing different app states linked to router.\n+ */\nexport type AppComponent = (app: App, ui: any) => any;\n+/**\n+ * Derived view configurations.\n+ */\nexport type ViewSpec = string | [string, ViewTransform<any>];\n+/**\n+ * Structure of the overall application config object\n+ */\nexport interface AppConfig {\nrouter: HTMLRouterConfig;\nevents: IObjectOf<EventDef>;\n@@ -19,8 +31,23 @@ export interface AppConfig {\nui: any;\n}\n+/**\n+ * Base structure of derived views exposed by the base app\n+ */\nexport interface AppViews {\nroute: IView<RouteMatch>;\nrouteComponent: IView<any>;\n[id: string]: IView<any>;\n}\n+\n+/// demo app related types\n+\n+/**\n+ * Types for status line component\n+ */\n+export enum StatusType {\n+ DONE,\n+ INFO,\n+ SUCCESS,\n+ ERROR\n+}\n", "new_path": "examples/router-basics/src/api.ts", "old_path": "examples/router-basics/src/api.ts" }, { "change_type": "MODIFY", "diff": "+import { IView } from \"@thi.ng/atom/api\";\n+\nimport { App } from \"../app\";\n-import { EV_LOAD_USER_LIST, EV_SET_STATUS, ROUTE_USER_PROFILE, StatusType } from \"../config\";\n+import { StatusType } from \"../api\";\n+import { EV_LOAD_USER_LIST, EV_SET_STATUS, ROUTE_USER_PROFILE } from \"../config\";\nimport { appLink } from \"./link\";\nimport { status } from \"./status\";\n@@ -17,17 +20,34 @@ export function allUsers(app: App, ui: any) {\napp.bus.dispatch([EV_SET_STATUS, [StatusType.SUCCESS, \"loaded from cache\", true]]);\n}\nreturn [\"div\",\n- [status, app, ui.status],\n- [userList, app, ui.userlist]\n+ [status, ui.status, app.views.status],\n+ [userList, app, ui.userlist, app.views.users]\n];\n}\n-function userList(app: App, ui: any) {\n- const users = app.views.users.deref();\n- const all = users.all;\n- return all && [\"section\", ui.root, all.map(user(app, ui, users))];\n+/**\n+ * The actual user list component.\n+ *\n+ * @param app\n+ * @param ui\n+ * @param view\n+ */\n+function userList(app: App, ui: any, view: IView<any>) {\n+ const users = view.deref();\n+ return users.all &&\n+ [\"section\", ui.root, users.all.map(user(app, ui, users))];\n}\n+/**\n+ * Single user component (used as list items)\n+ *\n+ * Based on:\n+ * http://tachyons.io/components/lists/follower-notifications/index.html\n+ *\n+ * @param app\n+ * @param ui\n+ * @param users\n+ */\nfunction user(app: App, ui: any, users: any) {\nreturn (u) =>\n[\"article\", ui.container,\n@@ -38,6 +58,8 @@ function user(app: App, ui: any, users: any) {\nappLink(app, ROUTE_USER_PROFILE.id, { id: u.id }, null, u.name)],\n[\"h2\", ui.subtitle, `@${u.alias}`]\n],\n- [\"div\", ui.meta, users[u.id] ? \"cached\" : undefined]\n+ users[u.id] ?\n+ [\"div\", ui.meta, \"cached\"] :\n+ undefined\n];\n}\n", "new_path": "examples/router-basics/src/components/all-users.ts", "old_path": "examples/router-basics/src/components/all-users.ts" }, { "change_type": "MODIFY", "diff": "import { App } from \"../app\";\nimport { EV_TOGGLE_DEBUG } from \"../config\";\n+import { IView } from \"@thi.ng/atom/api\";\n/**\n* Collapsable component showing stringified app state.\n@@ -7,15 +8,17 @@ import { EV_TOGGLE_DEBUG } from \"../config\";\n* @param app\n* @param ui\n* @param debug\n+ * @param json\n*/\n-export function debugContainer(app: App, ui: any, debug: number) {\n+export function debugContainer(app: App, ui: any, debug: number, json: IView<any>) {\nreturn [\"div#debug\", ui.column.debug[debug],\n[\"a.toggle\",\n{\nhref: \"#\",\nonclick: (e) => (e.preventDefault(), app.bus.dispatch([EV_TOGGLE_DEBUG]))\n},\n- debug ? \"close \\u25bc\" : \"open \\u25b2\"],\n- [\"pre\", ui.code, app.views.jsonState.deref()]\n+ debug ? \"close \\u25bc\" : \"open \\u25b2\"\n+ ],\n+ [\"pre\", ui.code, json.deref()]\n];\n}\n", "new_path": "examples/router-basics/src/components/debug-container.ts", "old_path": "examples/router-basics/src/components/debug-container.ts" }, { "change_type": "MODIFY", "diff": "-import { App } from \"../app\";\n+import { IView } from \"@thi.ng/atom/api\";\n/**\n* Status line component\n@@ -6,7 +6,7 @@ import { App } from \"../app\";\n* @param app\n* @param ui\n*/\n-export function status(app: App, ui: any) {\n- const [type, msg] = app.views.status.deref();\n+export function status(ui: any, view: IView<any>) {\n+ const [type, msg] = view.deref();\nreturn [\"p\", ui[type], msg];\n}\n", "new_path": "examples/router-basics/src/components/status.ts", "old_path": "examples/router-basics/src/components/status.ts" }, { "change_type": "MODIFY", "diff": "import { App } from \"../app\";\n-import { EV_LOAD_USER, EV_SET_STATUS, StatusType } from \"../config\";\n+import { StatusType } from \"../api\";\n+import { EV_LOAD_USER, EV_SET_STATUS } from \"../config\";\nimport { status } from \"./status\";\n@@ -20,7 +21,7 @@ export function userProfile(app: App, ui: any) {\n]);\n}\nreturn [\"div\",\n- [status, app, ui.status],\n+ [status, ui.status, app.views.status],\n[userCard, app, ui.card, id]\n];\n}\n", "new_path": "examples/router-basics/src/components/user-profile.ts", "old_path": "examples/router-basics/src/components/user-profile.ts" }, { "change_type": "MODIFY", "diff": "@@ -2,7 +2,7 @@ import { Event, FX_DISPATCH_ASYNC, FX_DISPATCH_NOW, EV_SET_VALUE } from \"@thi.ng\nimport { valueSetter, valueUpdater, trace } from \"@thi.ng/atom/interceptors\";\nimport { Route, EVENT_ROUTE_CHANGED } from \"@thi.ng/router/api\";\n-import { AppConfig } from \"./api\";\n+import { AppConfig, StatusType } from \"./api\";\nimport { home } from \"./components/home\";\nimport { allUsers } from \"./components/all-users\";\n@@ -69,14 +69,6 @@ export const EV_TOGGLE_DEBUG = \"toggle-debug\";\nconst FX_JSON = \"load-json\";\nconst FX_DELAY = \"delay\";\n-// status types\n-export enum StatusType {\n- DONE,\n- INFO,\n- SUCCESS,\n- ERROR\n-}\n-\n// main App configuration\nexport const CONFIG: AppConfig = {\n// router configuration\n@@ -209,7 +201,7 @@ export const CONFIG: AppConfig = {\n// initial app state\ninitialState: {\n- status: [StatusType.INFO, \"OK\"],\n+ status: [StatusType.INFO, \"running\"],\nusers: {},\nroute: {},\ndebug: 1,\n@@ -221,7 +213,7 @@ export const CONFIG: AppConfig = {\n// docs here:\n// https://github.com/thi-ng/umbrella/tree/master/packages/atom#derived-views\nviews: {\n- jsonState: [\"\", (state) => `// App state:\\n\\n${JSON.stringify(state, null, 2)}`],\n+ json: [\"\", (state) => JSON.stringify(state, null, 2)],\nusers: [\"users\", (users) => users || {}],\nstatus: \"status\",\ndebug: \"debug\",\n@@ -229,6 +221,8 @@ export const CONFIG: AppConfig = {\n// component CSS class config using tachyons-css\n// these attribs are being passed to all/most components\n+ // with a bit more thought this can still be simplified a lot more\n+ // and repetitions minimized...\n// looks at first somewhat cryptic, but it's a great/powerful system\n// http://tachyons.io/\n@@ -238,7 +232,6 @@ export const CONFIG: AppConfig = {\ncontent: [{ class: \"w-90-ns ma2\" }, { class: \"w-50-ns ma2\" }],\ndebug: [{ class: \"w-10-ns ma2 close\" }, { class: \"w-50-ns ma2 open\" }],\n},\n- button: { class: \"pa2 bn bg-navy white link\" },\ncode: { class: \"ma0 ml4 pa2 f7 bg-light-gray code overflow-x-hidden\" },\nbodyCopy: { class: \"center measure-narrow measure-ns tc lh-copy black-70\" },\nbodyLink: { class: \"link dim black\" },\n", "new_path": "examples/router-basics/src/config.ts", "old_path": "examples/router-basics/src/config.ts" }, { "change_type": "MODIFY", "diff": "@@ -17,7 +17,7 @@ class DemoApp extends App {\n[\"div\", ui.column.content[debug],\n[nav, this, ui.nav],\nthis.views.routeComponent.deref()],\n- [debugContainer, this, ui, debug],\n+ [debugContainer, this, ui, debug, this.views.json],\n];\n}\n}\n", "new_path": "examples/router-basics/src/index.ts", "old_path": "examples/router-basics/src/index.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
refactor(examples): more stateless components, add docs
1
refactor
examples
679,913
12.03.2018 02:26:53
0
fc61aae6cd0bae4f114a5c5e557b41b561c5cf5e
minor(examples): add filesize info
[ { "change_type": "MODIFY", "diff": "@@ -25,6 +25,7 @@ export function home(_: App, ui: any) {\n[\"a\", { ...ui.bodyLink, href: \"http://tachyons.io/\" }, \"Tachyons CSS\"]],\n]],\n[\"p\",\n- \"Please see the related blog post and the commented source code for more details.\"]\n+ \"Please see the related blog post and the commented source code for more details.\"],\n+ [\"p\", \"(total app file size: 13.6KB)\"]\n];\n}\n", "new_path": "examples/router-basics/src/components/home.ts", "old_path": "examples/router-basics/src/components/home.ts" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
minor(examples): add filesize info
1
minor
examples
679,913
12.03.2018 02:27:10
0
8eb0a610df3771101489a5c0b21ad037fd4ce196
docs(examples): add README for example dir
[ { "change_type": "ADD", "diff": "+# @thi.ng/umbrella examples\n+\n+This directory contains a growing number of standalone example projects, including live online versions, build instructions and commented source code.\n+\n+If you want to [contribute](../CONTRIBUTING.md) an example, please get in touch using issue tracker, email or twitter!\n+\n+| # | Name | Description | Packages of interest | Difficulty |\n+| ---: | --- | --- | --- | --- |\n+| 1 | [async-effect](./async-effect) | | atom, hdom | intermediate |\n+| 2 | [cellular-automata](./cellular-automata) | | hdom, hdom-components, | transducers | basic |\n+| 3 | [dashboard](./cellular-automata) | | hdom, hdom-components, transducers | | basic |\n+| 4 | [devcards](./devcards) | | atom, hdom, hdom-components | intermediate |\n+| 5 | [hdom-basics](./hdom-basics) | | hdom, hiccup | basic |\n+| 6 | [hdom-benchmark](./hdom-benchmark) | | hdom, rstream, transducers | | intermediate |\n+| 7 | [interceptor-basics](./hdom-benchmark) | | atom, hdom | intermediate |\n+| 8| [json-components](./json-components) | | hdom, transducers | intermediate |\n+| 9 | [login-form](./login-form) | | atom, hdom | intermediate |\n+| 10 | [router-basics](./router-basics) | | atom, hdom, router | advanced |\n+| 11 | [svg-particles](./svg-particles) | | hdom, transducers | basic |\n+| 11 | [todo-list](./todo-list) | | atom, hdom, transducers | intermediate |\n+| 11 | [webgl](./webgl) | | hdom, hdom-components | basic |\n", "new_path": "examples/README.md", "old_path": null } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
docs(examples): add README for example dir
1
docs
examples
679,913
12.03.2018 03:52:29
0
c5cee48351ebdc6b4a692fae665aa78e3c6264d9
minor(examples): readme
[ { "change_type": "MODIFY", "diff": "This directory contains a growing number of standalone example projects, including live online versions, build instructions and commented source code.\n-If you want to [contribute](../CONTRIBUTING.md) an example, please get in touch using issue tracker, email or twitter!\n+If you want to [contribute](../CONTRIBUTING.md) an example, please get in touch via PR, issue tracker, email or twitter!\n| # | Name | Description | Packages of interest | Difficulty |\n| ---: | --- | --- | --- | --- |\n| 1 | [async-effect](./async-effect) | Async side effect handling (JSON I/O) | atom, hdom | intermediate |\n-| 2 | [cellular-automata](./cellular-automata) | Transducer based, customizable 2D cellular automata | hdom, hdom-components, | transducers | basic |\n+| 2 | [cellular-automata](./cellular-automata) | Transducer based, customizable 2D cellular automata | hdom, hdom-components, transducers | basic |\n| 3 | [dashboard](./cellular-automata) | Barebones components w/ local state | hdom, hdom-components, transducers | basic |\n| 4 | [devcards](./devcards) | multiple app instances with/without shared state | atom, hdom, hdom-components | intermediate |\n| 5 | [hdom-basics](./hdom-basics) | hello world | hdom, hiccup | basic |\n", "new_path": "examples/README.md", "old_path": "examples/README.md" } ]
TypeScript
Apache License 2.0
thi-ng/umbrella
minor(examples): readme
1
minor
examples
815,746
12.03.2018 09:53:47
-7,200
f6d94fad284b4486aba649df95eae18f79949576
feat: expose api for custom templates fixes
[ { "change_type": "MODIFY", "diff": "@@ -88,6 +88,16 @@ import { DataService } from '../shared/data.service';\n<p>\nSelected people: {{selectedPeople}}\n</p>\n+ <hr />\n+\n+ <label>Custom search</label>\n+ ---html,true\n+ <ng-select [items]=\"cities\" [(ngModel)]=\"selectedCity\" bindLabel=\"name\" bindValue=\"name\">\n+ <ng-template ng-header-tmp let-api=\"api\">\n+ <input style=\"width: 100%\" type=\"text\" (input)=\"api.filter($event.target.value)\" />\n+ </ng-template>\n+ </ng-select>\n+ ---\n`\n})\nexport class SelectWithTemplatesComponent {\n", "new_path": "demo/app/examples/custom-templates.component.ts", "old_path": "demo/app/examples/custom-templates.component.ts" }, { "change_type": "MODIFY", "diff": "@@ -28,7 +28,7 @@ import { VirtualScrollService } from './virtual-scroll.service';\nselector: 'ng-dropdown-panel',\ntemplate: `\n<div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\" ngProjectAs=\"header\" header>\n- <ng-container [ngTemplateOutlet]=\"headerTemplate\"></ng-container>\n+ <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ api: api }\"></ng-container>\n</div>\n<div #scroll class=\"ng-dropdown-panel-items scroll-host\">\n<div #padding [class.total-padding]=\"virtualScroll\"></div>\n@@ -37,7 +37,7 @@ import { VirtualScrollService } from './virtual-scroll.service';\n</div>\n</div>\n<div *ngIf=\"footerTemplate\" class=\"ng-dropdown-footer\" ngProjectAs=\"footer\" footer>\n- <ng-container [ngTemplateOutlet]=\"footerTemplate\"></ng-container>\n+ <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{ api: api }\"></ng-container>\n</div>\n`,\nstyleUrls: ['./ng-dropdown-panel.component.scss'],\n@@ -65,6 +65,7 @@ export class NgDropdownPanelComponent implements OnDestroy {\n@ViewChild('padding', { read: ElementRef }) paddingElementRef: ElementRef;\ncurrentPosition: DropdownPosition = 'bottom';\n+ api = null;\nprivate _selectElementRef: ElementRef;\nprivate _previousStart: number;\n@@ -86,6 +87,7 @@ export class NgDropdownPanelComponent implements OnDestroy {\n) {\nthis._selectElementRef = _ngSelect.elementRef;\nthis._itemsList = _ngSelect.itemsList;\n+ this.api = _ngSelect.api;\n}\nngOnInit() {\n", "new_path": "src/ng-select/ng-dropdown-panel.component.ts", "old_path": "src/ng-select/ng-dropdown-panel.component.ts" }, { "change_type": "MODIFY", "diff": "<ng-template\n[ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n- [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n+ [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label, api: api }\">\n</ng-template>\n</div>\n<ng-template\n[ngTemplateOutlet]=\"item.hasChildren ? (optgroupTemplate || defaultOptGroupTemplate) : (optionTemplate || defaultOptionTemplate)\"\n- [ngTemplateOutletContext]=\"{ item: item.value, index: item.index, searchTerm: filterValue }\">\n+ [ngTemplateOutletContext]=\"{ item: item.value, index: item.index, searchTerm: filterValue, api: api }\">\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": "@@ -1984,8 +1984,8 @@ function getNgSelectElement(fixture: ComponentFixture<any>): DebugElement {\nfunction triggerKeyDownEvent(element: DebugElement, key: number): void {\nelement.triggerEventHandler('keydown', {\nwhich: key,\n- preventDefault: () => {\n- }\n+ preventDefault: () => {},\n+ stopPropagation: () => {}\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": "@@ -125,6 +125,14 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nfilterValue: string = null;\ncurrentDropdownPosition: DropdownPosition = 'bottom';\n+ api = {\n+ open: this.open.bind(this),\n+ close: this.close.bind(this),\n+ filter: this.filter.bind(this),\n+ select: this.select.bind(this),\n+ unselect: this.select.bind(this)\n+ };\n+\nprivate _defaultLabel = 'label';\nprivate _defaultValue = 'value';\nprivate _typeaheadLoading = false;\n@@ -594,6 +602,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\n}\n$event.preventDefault();\n+ $event.stopPropagation();\n}\nprivate _handleSpace($event: KeyboardEvent) {\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: expose api for custom templates (#342) fixes #339
1
feat
null
815,746
12.03.2018 09:55:19
-7,200
531fd1b49d8ceb0ce23b55e736656cf407ae433e
fix: wrong method for api unselect
[ { "change_type": "MODIFY", "diff": "@@ -130,7 +130,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nclose: this.close.bind(this),\nfilter: this.filter.bind(this),\nselect: this.select.bind(this),\n- unselect: this.select.bind(this)\n+ unselect: this.unselect.bind(this)\n};\nprivate _defaultLabel = 'label';\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: wrong method for api unselect
1
fix
null
815,746
12.03.2018 11:52:51
-7,200
68b12f53dc4ebf61dcc84d45da68b11d13c26906
fix: remove uneeded api field
[ { "change_type": "MODIFY", "diff": "@@ -92,8 +92,8 @@ import { DataService } from '../shared/data.service';\n<label>Custom search</label>\n---html,true\n- <ng-select [items]=\"cities\" [(ngModel)]=\"selectedCity\" bindLabel=\"name\" bindValue=\"name\">\n- <ng-template ng-header-tmp let-api=\"api\">\n+ <ng-select #api [items]=\"cities\" [(ngModel)]=\"selectedCity\" bindLabel=\"name\" bindValue=\"name\">\n+ <ng-template ng-header-tmp>\n<input style=\"width: 100%\" type=\"text\" (input)=\"api.filter($event.target.value)\" />\n</ng-template>\n</ng-select>\n", "new_path": "demo/app/examples/custom-templates.component.ts", "old_path": "demo/app/examples/custom-templates.component.ts" }, { "change_type": "MODIFY", "diff": "@@ -28,7 +28,7 @@ import { VirtualScrollService } from './virtual-scroll.service';\nselector: 'ng-dropdown-panel',\ntemplate: `\n<div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\" ngProjectAs=\"header\" header>\n- <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ api: api }\"></ng-container>\n+ <ng-container [ngTemplateOutlet]=\"headerTemplate\"></ng-container>\n</div>\n<div #scroll class=\"ng-dropdown-panel-items scroll-host\">\n<div #padding [class.total-padding]=\"virtualScroll\"></div>\n@@ -37,7 +37,7 @@ import { VirtualScrollService } from './virtual-scroll.service';\n</div>\n</div>\n<div *ngIf=\"footerTemplate\" class=\"ng-dropdown-footer\" ngProjectAs=\"footer\" footer>\n- <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{ api: api }\"></ng-container>\n+ <ng-container [ngTemplateOutlet]=\"footerTemplate\"></ng-container>\n</div>\n`,\nstyleUrls: ['./ng-dropdown-panel.component.scss'],\n@@ -65,7 +65,6 @@ export class NgDropdownPanelComponent implements OnDestroy {\n@ViewChild('padding', { read: ElementRef }) paddingElementRef: ElementRef;\ncurrentPosition: DropdownPosition = 'bottom';\n- api = null;\nprivate _selectElementRef: ElementRef;\nprivate _previousStart: number;\n@@ -87,7 +86,6 @@ export class NgDropdownPanelComponent implements OnDestroy {\n) {\nthis._selectElementRef = _ngSelect.elementRef;\nthis._itemsList = _ngSelect.itemsList;\n- this.api = _ngSelect.api;\n}\nngOnInit() {\n", "new_path": "src/ng-select/ng-dropdown-panel.component.ts", "old_path": "src/ng-select/ng-dropdown-panel.component.ts" }, { "change_type": "MODIFY", "diff": "<ng-template\n[ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n- [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label, api: api }\">\n+ [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n</ng-template>\n</div>\n<ng-template\n[ngTemplateOutlet]=\"item.hasChildren ? (optgroupTemplate || defaultOptGroupTemplate) : (optionTemplate || defaultOptionTemplate)\"\n- [ngTemplateOutletContext]=\"{ item: item.value, index: item.index, searchTerm: filterValue, api: api }\">\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": "@@ -125,14 +125,6 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nfilterValue: string = null;\ncurrentDropdownPosition: DropdownPosition = 'bottom';\n- api = {\n- open: this.open.bind(this),\n- close: this.close.bind(this),\n- filter: this.filter.bind(this),\n- select: this.select.bind(this),\n- unselect: this.unselect.bind(this)\n- };\n-\nprivate _defaultLabel = 'label';\nprivate _defaultValue = 'value';\nprivate _typeaheadLoading = false;\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: remove uneeded api field
1
fix
null
791,723
12.03.2018 12:40:51
25,200
17a8bcc9445f936956d831d2299927a706ff375c
tests(closure): fix BSD sed calls within compile-devtools
[ { "change_type": "MODIFY", "diff": "@@ -49,10 +49,9 @@ yarn devtools \"$frontend_path/front_end/\"\n#\naudit2_modulejson_path=\"$frontend_path/front_end/audits2/module.json\"\n# remove existing renderer file mentions\n-sed -i 's/.*\\/renderer\\/.*//' $audit2_modulejson_path\n-# remove existing renderer file mentions\n-sed -i \"s/\\\"Audits2Panel\\.js\\\"/ $files_to_include \\\"Audits2Panel.js\\\"/\" $audit2_modulejson_path\n-\n+sed -i='' 's/.*\\/renderer\\/.*//' $audit2_modulejson_path\n+# add in our hardcoded renderer file mentions\n+sed -i='' \"s/\\\"Audits2Panel\\.js\\\"/ $files_to_include \\\"Audits2Panel.js\\\"/\" $audit2_modulejson_path\n# compile, finally\npython \"$frontend_path/scripts/compile_frontend.py\" --protocol-externs-file \"$protocol_path/externs/protocol_externs.js\"\n", "new_path": "lighthouse-core/scripts/compile-against-devtools.sh", "old_path": "lighthouse-core/scripts/compile-against-devtools.sh" } ]
JavaScript
Apache License 2.0
googlechrome/lighthouse
tests(closure): fix BSD sed calls within compile-devtools (#4736)
1
tests
closure
791,723
12.03.2018 13:13:22
25,200
ca07b99549be7b9019e686c51db76766977a4925
tests(closure): avoid failing closure compilation
[ { "change_type": "MODIFY", "diff": "@@ -181,17 +181,6 @@ if (typeof module !== 'undefined' && module.exports) {\nself.ReportRenderer = ReportRenderer;\n}\n-/**\n- * @typedef {{\n- * id: string,\n- * score: number,\n- * weight: number,\n- * group: (string|undefined),\n- * result: (ReportRenderer.AuditResultJSON|undefined)\n- * }}\n- */\n-ReportRenderer.AuditJSON; // eslint-disable-line no-unused-expressions\n-\n/**\n* @typedef {{\n* rawValue: (number|boolean|undefined),\n@@ -210,6 +199,17 @@ ReportRenderer.AuditJSON; // eslint-disable-line no-unused-expressions\n*/\nReportRenderer.AuditResultJSON; // eslint-disable-line no-unused-expressions\n+/**\n+ * @typedef {{\n+ * id: string,\n+ * score: number,\n+ * weight: number,\n+ * group: (string|undefined),\n+ * result: (ReportRenderer.AuditResultJSON|undefined)\n+ * }}\n+ */\n+ReportRenderer.AuditJSON; // eslint-disable-line no-unused-expressions\n+\n/**\n* @typedef {{\n* name: string,\n", "new_path": "lighthouse-core/report/v2/renderer/report-renderer.js", "old_path": "lighthouse-core/report/v2/renderer/report-renderer.js" } ]
JavaScript
Apache License 2.0
googlechrome/lighthouse
tests(closure): avoid failing closure compilation (#4737)
1
tests
closure
807,849
12.03.2018 13:24:27
25,200
06c0cadc0fb2719b9f2438b7ff112b7db06f5929
refactor(helpers): extract find-fixture
[ { "change_type": "MODIFY", "diff": "\"use strict\";\n-const findUp = require(\"find-up\");\n+const findFixture = require(\"@lerna-test/find-fixture\");\nconst fs = require(\"fs-extra\");\n-const path = require(\"path\");\nmodule.exports = copyFixture;\nfunction copyFixture(targetDir, fixtureName, cwd) {\n- return findUp(path.join(\"__fixtures__\", fixtureName), { cwd }).then(fp => fs.copy(fp, targetDir));\n+ return findFixture(cwd, fixtureName).then(fp => fs.copy(fp, targetDir));\n}\n", "new_path": "helpers/copy-fixture/index.js", "old_path": "helpers/copy-fixture/index.js" }, { "change_type": "MODIFY", "diff": "\"private\": true,\n\"license\": \"MIT\",\n\"dependencies\": {\n- \"find-up\": \"^2.1.0\",\n+ \"@lerna-test/find-fixture\": \"file:../find-fixture\",\n\"fs-extra\": \"^5.0.0\"\n}\n}\n", "new_path": "helpers/copy-fixture/package.json", "old_path": "helpers/copy-fixture/package.json" }, { "change_type": "ADD", "diff": "+\"use strict\";\n+\n+const findUp = require(\"find-up\");\n+const path = require(\"path\");\n+\n+module.exports = findFixture;\n+\n+function findFixture(cwd, fixtureName) {\n+ return findUp(path.join(\"__fixtures__\", fixtureName), { cwd }).then(fixturePath => {\n+ if (fixturePath === null) {\n+ throw new Error(`Could not find fixture with name \"${fixtureName}\"`);\n+ }\n+\n+ return fixturePath;\n+ });\n+}\n", "new_path": "helpers/find-fixture/index.js", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"@lerna-test/find-fixture\",\n+ \"version\": \"0.0.0-test-only\",\n+ \"description\": \"A local test helper\",\n+ \"main\": \"index.js\",\n+ \"private\": true,\n+ \"license\": \"MIT\",\n+ \"dependencies\": {\n+ \"find-up\": \"^2.1.0\"\n+ }\n+}\n", "new_path": "helpers/find-fixture/package.json", "old_path": null }, { "change_type": "MODIFY", "diff": "\"version\": \"file:helpers/copy-fixture\",\n\"dev\": true,\n\"requires\": {\n- \"find-up\": \"2.1.0\",\n+ \"@lerna-test/find-fixture\": \"file:helpers/find-fixture\",\n\"fs-extra\": \"5.0.0\"\n}\n},\n+ \"@lerna-test/find-fixture\": {\n+ \"version\": \"file:helpers/find-fixture\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"find-up\": \"2.1.0\"\n+ }\n+ },\n\"@lerna-test/git-add\": {\n\"version\": \"file:helpers/git-add\",\n\"dev\": true,\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "MODIFY", "diff": "\"@lerna-test/command-runner\": \"file:helpers/command-runner\",\n\"@lerna-test/console-output\": \"file:helpers/console-output\",\n\"@lerna-test/copy-fixture\": \"file:helpers/copy-fixture\",\n+ \"@lerna-test/find-fixture\": \"file:helpers/find-fixture\",\n\"@lerna-test/git-add\": \"file:helpers/git-add\",\n\"@lerna-test/git-commit\": \"file:helpers/git-commit\",\n\"@lerna-test/git-init\": \"file:helpers/git-init\",\n", "new_path": "package.json", "old_path": "package.json" } ]
JavaScript
MIT License
lerna/lerna
refactor(helpers): extract find-fixture
1
refactor
helpers
807,849
12.03.2018 14:24:54
25,200
baf9cf1bcf196ab921f4759148eb053927e1dd5f
refactor(helpers): extract serialize-git-sha
[ { "change_type": "MODIFY", "diff": "@@ -18,8 +18,8 @@ const gitTag = require(\"@lerna-test/git-tag\");\n// file under test\nconst lernaDiff = require(\"@lerna-test/command-runner\")(require(\"../command\"));\n-// stabilize diff commit SHA and datestamp\n-expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\n+// stabilize commit SHA\n+expect.addSnapshotSerializer(require(\"@lerna-test/serialize-git-sha\"));\nconst writeManifest = pkg => fs.writeJSON(pkg.manifestLocation, pkg, { spaces: 2 });\n", "new_path": "commands/diff/__tests__/diff-command.test.js", "old_path": "commands/diff/__tests__/diff-command.test.js" }, { "change_type": "MODIFY", "diff": "\"use strict\";\nconst normalizeNewline = require(\"normalize-newline\");\n+const serializeGitSHA = require(\"@lerna-test/serialize-git-sha\");\n// expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\nmodule.exports = {\nprint(val) {\n- return normalizeNewline(val)\n- .replace(/\\b[0-9a-f]{7,8}\\b/g, \"SHA\")\n- .replace(/\\b[0-9a-f]{40}\\b/g, \"GIT_HEAD\")\n+ return serializeGitSHA\n+ .print(normalizeNewline(val))\n.replace(/\\(\\d{4}-\\d{2}-\\d{2}\\)/g, \"(YYYY-MM-DD)\");\n},\ntest(val) {\n", "new_path": "helpers/serialize-changelog/index.js", "old_path": "helpers/serialize-changelog/index.js" }, { "change_type": "MODIFY", "diff": "\"private\": true,\n\"license\": \"MIT\",\n\"dependencies\": {\n+ \"@lerna-test/serialize-git-sha\": \"file:../serialize-git-sha\",\n\"normalize-newline\": \"^3.0.0\"\n}\n}\n", "new_path": "helpers/serialize-changelog/package.json", "old_path": "helpers/serialize-changelog/package.json" }, { "change_type": "ADD", "diff": "+\"use strict\";\n+\n+// expect.addSnapshotSerializer(require(\"@lerna-test/serialize-git-sha\"));\n+module.exports = {\n+ print(val) {\n+ return (\n+ val\n+ // short SHA tends to be in the path diff comparisons\n+ .replace(/\\b[0-9a-f]{7,8}\\b/g, \"SHA\")\n+ // full SHA corresponds to gitHead property in package.json files\n+ .replace(/\\b[0-9a-f]{40}\\b/g, \"GIT_HEAD\")\n+ );\n+ },\n+ test(val) {\n+ return val && typeof val === \"string\";\n+ },\n+};\n", "new_path": "helpers/serialize-git-sha/index.js", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"@lerna-test/serialize-git-sha\",\n+ \"version\": \"0.0.0-test-only\",\n+ \"description\": \"A local test helper\",\n+ \"main\": \"index.js\",\n+ \"private\": true,\n+ \"license\": \"MIT\",\n+ \"dependencies\": {}\n+}\n", "new_path": "helpers/serialize-git-sha/package.json", "old_path": null }, { "change_type": "MODIFY", "diff": "\"version\": \"file:helpers/serialize-changelog\",\n\"dev\": true,\n\"requires\": {\n+ \"@lerna-test/serialize-git-sha\": \"file:helpers/serialize-git-sha\",\n\"normalize-newline\": \"3.0.0\"\n}\n},\n+ \"@lerna-test/serialize-git-sha\": {\n+ \"version\": \"file:helpers/serialize-git-sha\",\n+ \"dev\": true\n+ },\n\"@lerna-test/serialize-placeholders\": {\n\"version\": \"file:helpers/serialize-placeholders\",\n\"dev\": true,\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "MODIFY", "diff": "\"@lerna-test/normalize-test-root\": \"file:helpers/normalize-test-root\",\n\"@lerna-test/pkg-matchers\": \"file:helpers/pkg-matchers\",\n\"@lerna-test/serialize-changelog\": \"file:helpers/serialize-changelog\",\n+ \"@lerna-test/serialize-git-sha\": \"file:helpers/serialize-git-sha\",\n\"@lerna-test/serialize-placeholders\": \"file:helpers/serialize-placeholders\",\n\"@lerna-test/silence-logging\": \"file:helpers/silence-logging\",\n\"@lerna-test/update-lerna-config\": \"file:helpers/update-lerna-config\",\n", "new_path": "package.json", "old_path": "package.json" } ]
JavaScript
MIT License
lerna/lerna
refactor(helpers): extract serialize-git-sha
1
refactor
helpers
807,849
12.03.2018 14:26:03
25,200
5bce46c97687cc0eb0275561048e827901ec8e12
test(helpers): Add clone-fixture This helper wraps initFixture and creates a bare repo that is used as the fixture remote, better simulating an actual git clone.
[ { "change_type": "ADD", "diff": "+\"use strict\";\n+\n+const execa = require(\"execa\");\n+const fileUrl = require(\"file-url\");\n+const tempy = require(\"tempy\");\n+const gitInit = require(\"@lerna-test/git-init\");\n+const initFactory = require(\"@lerna-test/init-fixture\");\n+\n+module.exports = cloneFixture;\n+\n+function cloneFixture(startDir) {\n+ const initFixture = initFactory(startDir);\n+\n+ return (...args) =>\n+ initFixture(...args).then(workDir => {\n+ const repoDir = tempy.directory();\n+ const repoUrl = fileUrl(repoDir, { resolve: false });\n+\n+ return gitInit(repoDir, \"--bare\")\n+ .then(() => execa(\"git\", [\"remote\", \"add\", \"origin\", repoUrl], { cwd: workDir }))\n+ .then(() => execa(\"git\", [\"push\", \"-u\", \"origin\", \"master\"], { cwd: workDir }))\n+ .then(() => workDir);\n+ });\n+}\n", "new_path": "helpers/clone-fixture/index.js", "old_path": null }, { "change_type": "ADD", "diff": "+{\n+ \"name\": \"@lerna-test/clone-fixture\",\n+ \"version\": \"0.0.0-test-only\",\n+ \"description\": \"A local test helper\",\n+ \"main\": \"index.js\",\n+ \"private\": true,\n+ \"license\": \"MIT\",\n+ \"dependencies\": {\n+ \"@lerna-test/git-init\": \"file:../git-init\",\n+ \"@lerna-test/init-fixture\": \"file:../init-fixture\",\n+ \"execa\": \"^0.9.0\",\n+ \"file-url\": \"^2.0.2\",\n+ \"tempy\": \"^0.2.1\"\n+ }\n+}\n", "new_path": "helpers/clone-fixture/package.json", "old_path": null }, { "change_type": "MODIFY", "diff": "@@ -8,6 +8,7 @@ module.exports = {\nprint(val) {\nreturn serializeGitSHA\n.print(normalizeNewline(val))\n+ .replace(/\\(http.*\\/commits\\/SHA\\)/g, \"(COMMIT_URL)\")\n.replace(/\\(\\d{4}-\\d{2}-\\d{2}\\)/g, \"(YYYY-MM-DD)\");\n},\ntest(val) {\n", "new_path": "helpers/serialize-changelog/index.js", "old_path": "helpers/serialize-changelog/index.js" }, { "change_type": "MODIFY", "diff": "@@ -62,13 +62,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Bug Fixes\n-* **package-1:** Fix foo SHA\n+* **package-1:** Fix foo ([SHA](COMMIT_URL))\n### Features\n-* init repo SHA\n-* **package-1:** Add foo SHA\n+* init repo ([SHA](COMMIT_URL))\n+* **package-1:** Add foo ([SHA](COMMIT_URL))\n,\n# Change Log\n@@ -81,12 +81,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Bug Fixes\n-* **package-2:** Fix bar SHA\n+* **package-2:** Fix bar ([SHA](COMMIT_URL))\n### Features\n-* init repo SHA\n+* init repo ([SHA](COMMIT_URL))\n,\n# Change Log\n@@ -99,8 +99,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* init repo SHA\n-* **package-3:** Add baz feature SHA\n+* init repo ([SHA](COMMIT_URL))\n+* **package-3:** Add baz feature ([SHA](COMMIT_URL))\n### BREAKING CHANGES\n@@ -118,7 +118,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* init repo SHA\n+* init repo ([SHA](COMMIT_URL))\n,\n# Change Log\n@@ -131,7 +131,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* init repo SHA\n+* init repo ([SHA](COMMIT_URL))\n,\n]\n`;\n@@ -160,15 +160,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Bug Fixes\n-* **package-1:** Fix foo SHA\n-* **package-2:** Fix bar SHA\n+* **package-1:** Fix foo ([SHA](COMMIT_URL))\n+* **package-2:** Fix bar ([SHA](COMMIT_URL))\n### Features\n-* init repo SHA\n-* **package-1:** Add foo SHA\n-* **package-3:** Add baz feature SHA\n+* init repo ([SHA](COMMIT_URL))\n+* **package-1:** Add foo ([SHA](COMMIT_URL))\n+* **package-3:** Add baz feature ([SHA](COMMIT_URL))\n### BREAKING CHANGES\n@@ -186,13 +186,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Bug Fixes\n-* **package-1:** Fix foo SHA\n+* **package-1:** Fix foo ([SHA](COMMIT_URL))\n### Features\n-* init repo SHA\n-* **package-1:** Add foo SHA\n+* init repo ([SHA](COMMIT_URL))\n+* **package-1:** Add foo ([SHA](COMMIT_URL))\n,\n# Change Log\n@@ -205,12 +205,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Bug Fixes\n-* **package-2:** Fix bar SHA\n+* **package-2:** Fix bar ([SHA](COMMIT_URL))\n### Features\n-* init repo SHA\n+* init repo ([SHA](COMMIT_URL))\n,\n# Change Log\n@@ -223,8 +223,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* init repo SHA\n-* **package-3:** Add baz feature SHA\n+* init repo ([SHA](COMMIT_URL))\n+* **package-3:** Add baz feature ([SHA](COMMIT_URL))\n### BREAKING CHANGES\n@@ -242,7 +242,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* init repo SHA\n+* init repo ([SHA](COMMIT_URL))\n,\n# Change Log\n@@ -255,7 +255,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n### Features\n-* init repo SHA\n+* init repo ([SHA](COMMIT_URL))\n,\n]\n`;\n", "new_path": "integration/__snapshots__/lerna-publish.test.js.snap", "old_path": "integration/__snapshots__/lerna-publish.test.js.snap" }, { "change_type": "MODIFY", "diff": "@@ -13,7 +13,7 @@ const cliRunner = require(\"@lerna-test/cli-runner\");\nconst gitAdd = require(\"@lerna-test/git-add\");\nconst gitCommit = require(\"@lerna-test/git-commit\");\nconst gitTag = require(\"@lerna-test/git-tag\");\n-const initFixture = require(\"@lerna-test/init-fixture\")(\n+const cloneFixture = require(\"@lerna-test/clone-fixture\")(\npath.resolve(__dirname, \"../commands/publish/__tests__\")\n);\nconst loadManifests = require(\"@lerna-test/load-manifests\");\n@@ -46,7 +46,7 @@ describe(\"lerna publish\", () => {\n});\ntest(\"exit 0 when no updates\", async () => {\n- const cwd = await initFixture(\"normal\");\n+ const cwd = await cloneFixture(\"normal\");\nconst args = [\"publish\"];\nawait gitTag(cwd, \"v1.0.0\");\n@@ -58,7 +58,7 @@ describe(\"lerna publish\", () => {\n});\ntest(\"updates fixed versions\", async () => {\n- const cwd = await initFixture(\"normal\");\n+ const cwd = await cloneFixture(\"normal\");\nconst args = [\"publish\", \"--skip-npm\", \"--cd-version=patch\", \"--yes\"];\nconst { stdout } = await cliRunner(cwd)(...args);\n@@ -71,7 +71,7 @@ describe(\"lerna publish\", () => {\n});\ntest(\"updates all transitive dependents\", async () => {\n- const cwd = await initFixture(\"snake-graph\");\n+ const cwd = await cloneFixture(\"snake-graph\");\nconst args = [\"publish\", \"--skip-npm\", \"--cd-version=major\", \"--yes\"];\nawait gitTag(cwd, \"v1.0.0\");\n@@ -83,7 +83,7 @@ describe(\"lerna publish\", () => {\n});\ntest(\"uses default suffix with canary flag\", async () => {\n- const cwd = await initFixture(\"normal\");\n+ const cwd = await cloneFixture(\"normal\");\nconst args = [\"publish\", \"--canary\", \"--skip-npm\", \"--yes\"];\nconst { stdout } = await cliRunner(cwd)(...args);\n@@ -91,7 +91,7 @@ describe(\"lerna publish\", () => {\n});\ntest(\"updates independent versions\", async () => {\n- const cwd = await initFixture(\"independent\");\n+ const cwd = await cloneFixture(\"independent\");\nconst args = [\"publish\", \"--skip-npm\", \"--cd-version=major\", \"--yes\"];\nconst { stdout } = await cliRunner(cwd)(...args);\n@@ -105,7 +105,7 @@ describe(\"lerna publish\", () => {\n[\"normal\", \"independent\"].forEach(flavor =>\ntest(`${flavor} mode --conventional-commits changelog`, async () => {\n- const cwd = await initFixture(`${flavor}`, \"feat: init repo\");\n+ const cwd = await cloneFixture(`${flavor}`, \"feat: init repo\");\nconst args = [\"publish\", \"--conventional-commits\", \"--skip-git\", \"--skip-npm\", \"--yes\"];\nawait commitChangeToPackage(cwd, \"package-1\", \"feat(package-1): Add foo\", { foo: true });\n@@ -138,7 +138,7 @@ describe(\"lerna publish\", () => {\n);\nit(\"replaces file: specifier with local version before npm publish but after git commit\", async () => {\n- const cwd = await initFixture(\"relative-file-specs\");\n+ const cwd = await cloneFixture(\"relative-file-specs\");\nawait gitTag(cwd, \"v1.0.0\");\nawait commitChangeToPackage(cwd, \"package-1\", \"feat(package-1): changed\", { changed: true });\n@@ -155,7 +155,7 @@ describe(\"lerna publish\", () => {\n});\ntest(\"calls lifecycle scripts\", async () => {\n- const cwd = await initFixture(\"lifecycle\");\n+ const cwd = await cloneFixture(\"lifecycle\");\nconst args = [\"publish\", \"--skip-npm\", \"--cd-version\", \"minor\", \"--yes\"];\nconst { stdout } = await cliRunner(cwd)(...args);\n@@ -163,7 +163,7 @@ describe(\"lerna publish\", () => {\n});\ntest(\"silences lifecycle scripts with --loglevel=silent\", async () => {\n- const cwd = await initFixture(\"lifecycle\");\n+ const cwd = await cloneFixture(\"lifecycle\");\nconst args = [\"publish\", \"--skip-npm\", \"--cd-version\", \"minor\", \"--yes\", \"--loglevel\", \"silent\"];\nconst { stdout } = await cliRunner(cwd)(...args);\n", "new_path": "integration/lerna-publish.test.js", "old_path": "integration/lerna-publish.test.js" }, { "change_type": "MODIFY", "diff": "\"execa\": \"0.9.0\"\n}\n},\n+ \"@lerna-test/clone-fixture\": {\n+ \"version\": \"file:helpers/clone-fixture\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"@lerna-test/git-init\": \"file:helpers/git-init\",\n+ \"@lerna-test/init-fixture\": \"file:helpers/init-fixture\",\n+ \"execa\": \"0.9.0\",\n+ \"file-url\": \"2.0.2\",\n+ \"tempy\": \"0.2.1\"\n+ }\n+ },\n\"@lerna-test/command-runner\": {\n\"version\": \"file:helpers/command-runner\",\n\"dev\": true,\n\"object-assign\": \"4.1.1\"\n}\n},\n+ \"file-url\": {\n+ \"version\": \"2.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/file-url/-/file-url-2.0.2.tgz\",\n+ \"integrity\": \"sha1-6VF4TXkJUSfTcTApqwY/QIGMoq4=\",\n+ \"dev\": true\n+ },\n\"filename-regex\": {\n\"version\": \"2.0.1\",\n\"resolved\": \"https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz\",\n", "new_path": "package-lock.json", "old_path": "package-lock.json" }, { "change_type": "MODIFY", "diff": "\"devDependencies\": {\n\"@lerna-test/calls-back\": \"file:helpers/calls-back\",\n\"@lerna-test/cli-runner\": \"file:helpers/cli-runner\",\n+ \"@lerna-test/clone-fixture\": \"file:helpers/clone-fixture\",\n\"@lerna-test/command-runner\": \"file:helpers/command-runner\",\n\"@lerna-test/console-output\": \"file:helpers/console-output\",\n\"@lerna-test/copy-fixture\": \"file:helpers/copy-fixture\",\n", "new_path": "package.json", "old_path": "package.json" } ]
JavaScript
MIT License
lerna/lerna
test(helpers): Add clone-fixture This helper wraps initFixture and creates a bare repo that is used as the fixture remote, better simulating an actual git clone.
1
test
helpers
807,849
12.03.2018 14:54:03
25,200
68d08859a9cb61e790f4215ead31781212fce66c
test(serialize-changelog): fix commit URL regex
[ { "change_type": "MODIFY", "diff": "@@ -8,7 +8,7 @@ module.exports = {\nprint(val) {\nreturn serializeGitSHA\n.print(normalizeNewline(val))\n- .replace(/\\(http.*\\/commits\\/SHA\\)/g, \"(COMMIT_URL)\")\n+ .replace(/(\\[.*?\\])\\(.*\\/commits\\/SHA\\)/g, \"$1(COMMIT_URL)\")\n.replace(/\\(\\d{4}-\\d{2}-\\d{2}\\)/g, \"(YYYY-MM-DD)\");\n},\ntest(val) {\n", "new_path": "helpers/serialize-changelog/index.js", "old_path": "helpers/serialize-changelog/index.js" } ]
JavaScript
MIT License
lerna/lerna
test(serialize-changelog): fix commit URL regex
1
test
serialize-changelog