From d8627ca78648a7727e78736b813eb4907fde4d82 Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Mon, 27 Mar 2017 15:09:56 -0700 Subject: [PATCH 01/18] docs: correct version on change-log --- docs/change-log.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/change-log.md b/docs/change-log.md index 5a9b75a3..fbc047b6 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,17 +1,18 @@ # Change log -- [v1.0.2](#v101) +- [v1.1.0](#v110) - [v1.0.1](#v101) - [Migrating from v0.2.x](#migrating-from-v02x) - [Older docs](http://mithril.js.org/archive/v0.2.5/index.html) --- -### v1.0.2 +### v1.1.0 #### News - support for ES6 class components +- support for closure components - updated typescript definitions #### Bug fixes From 5d9694cc2ef983cdd73e3c13d8ee516329408ea7 Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Mon, 27 Mar 2017 15:12:22 -0700 Subject: [PATCH 02/18] docs: remove fake change --- docs/change-log.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/change-log.md b/docs/change-log.md index fbc047b6..ca5e695c 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -13,7 +13,6 @@ - support for ES6 class components - support for closure components -- updated typescript definitions #### Bug fixes From a6bb1d46518e2a5fbbdd76edb5c535d361daf262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Yves=20G=C3=A9rardy?= Date: Tue, 28 Mar 2017 00:19:16 +0200 Subject: [PATCH 03/18] docs: update the toc of components.md to match the content (#1748) --- docs/components.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/components.md b/docs/components.md index 3d958aad..229f1293 100644 --- a/docs/components.md +++ b/docs/components.md @@ -2,9 +2,9 @@ - [Structure](#structure) - [Lifecycle methods](#lifecycle-methods) +- [Syntactic variants](#syntactic-variants) - [State](#state) -- [ES6 classes](#es6-classes) -- [Avoid-anti-patterns](#avoid-anti-patterns) +- [Avoid anti-patterns](#avoid-anti-patterns) ### Structure @@ -101,7 +101,7 @@ To learn more about lifecycle methods, [see the lifecycle methods page](lifecycl --- -### Alternate component syntaxes +### Syntactic variants #### ES6 classes From 87a053224c2b00754b0696fdde37f801ccd4d749 Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Mon, 27 Mar 2017 15:24:36 -0700 Subject: [PATCH 04/18] docs: updated releasing workflow --- docs/releasing.md | 55 +++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/docs/releasing.md b/docs/releasing.md index eadab31b..12ceb19b 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,36 +1,49 @@ # Releasing -Releasing new builds of mithril is mostly automated via `npm version` - ## Publishing to NPM -1. `npm run release ` +Releasing new builds of mithril to NPM is mostly automated via `npm run release` + +1. Update information in `docs/change-log.md` to match reality & the new version that will be released +2. `npm run release ` All further steps are automated and run as follows: -2. New bundles are generated using updated version -3. Tests are run -4. Linting is run (but doesn't fail build) -5. Version number in package.json is incremented -6. `git add` called on bundle output -7. `package.json` and updated bundles are committed to git -8. previous commit is tagged using new version number -9. `git push --follow-tags` pushes up new version commit & tag to github -10. Travis sees new release, starts build -11. Travis generates new bundles before running tests -12. Travis runs tests -13. Travis lints files (but can't fail build) -14. If build fails, abort -15. Build succeeded, so travis will commit back any changes to the repo (but there won't be any) -16. Travis sees that this commit has a tag associated with it -17. Travis will use the encrypted npm creds in `.travis.yml` to publish a new version to npm +3. New bundles are generated using updated version +4. Tests are run +5. Linting is run (but doesn't fail build) +6. Version number in package.json is incremented +7. `git add` called on bundle output +8. `package.json` and updated bundles are committed to git +9. previous commit is tagged using new version number +10. `git push --follow-tags` pushes up new version commit & tag to github +11. Travis sees new release, starts build +12. Travis generates new bundles before running tests +13. Travis runs tests +14. Travis lints files (but can't fail build) +15. If build fails, abort +16. Build succeeded, so travis will commit back any changes to the repo (but there won't be any) +17. Travis sees that this commit has a tag associated with it +18. Travis will use the encrypted npm creds in `.travis.yml` to publish a new version to npm ## Publishing a GitHub release Happens automatically as part of the [Publishing to NPM](#publishing-to-npm) process described above. -Does require a manual description to be added though, as the auto-generated one isn't very interesting. +Does require a manual description to be added though, as the auto-generated one isn't very interesting. I suggest coming up with a fun title & then copying the `docs/change-log.md` entry for the build. ## Updating `docs/change-log.md` -**TODO** +This is still a manual process, I'm sorry. + +## Updating docs (outside of a new version) + +Fixes to documentation can land whenever, updates to the site are published via Travis. + +1. `git co next` +2. `git pull lhorie next` +3. `git co master` +4. `git co next -- ./docs` +5. Ensure that no new features are added +6. `git push lhorie` +7. After the Travis build completes new docs should appear in ~3 minutes From 7ba74ad424f346784897b3ca544f6aed88973499 Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Tue, 28 Mar 2017 11:21:01 -0700 Subject: [PATCH 05/18] docs: Fix missing generated docs (#1754) --- docs/generate.js | 14 ++++++------ docs/index.md | 4 ++-- docs/layout.html | 6 +++--- docs/lib/prism/prism.css | 6 ------ docs/lib/prism/prism.js | 7 ------ docs/{guides.md => nav-guides.md} | 0 docs/{methods.md => nav-methods.md} | 0 docs/style.css | 33 +++++++++++++++++++++-------- 8 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 docs/lib/prism/prism.css delete mode 100644 docs/lib/prism/prism.js rename docs/{guides.md => nav-guides.md} (100%) rename docs/{methods.md => nav-methods.md} (100%) diff --git a/docs/generate.js b/docs/generate.js index 438b8343..52bc3e70 100644 --- a/docs/generate.js +++ b/docs/generate.js @@ -8,13 +8,9 @@ var version = JSON.parse(fs.readFileSync("./package.json", "utf-8")).version try {fs.mkdirSync("./dist")} catch (e) {/* ignore */} try {fs.mkdirSync("./dist/archive")} catch (e) {/* ignore */} try {fs.mkdirSync("./dist/archive/v" + version)} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/archive/v" + version + "/lib")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/archive/v" + version + "/lib/prism")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/lib")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/lib/prism")} catch (e) {/* ignore */} -var guides = fs.readFileSync("docs/guides.md", "utf-8") -var methods = fs.readFileSync("docs/methods.md", "utf-8") +var guides = fs.readFileSync("docs/nav-guides.md", "utf-8") +var methods = fs.readFileSync("docs/nav-methods.md", "utf-8") var index = fs.readFileSync("docs/index.md", "utf-8") fs.writeFileSync("README.md", index.replace(/(\]\()(.+?)\.md(\))/g, "$1http://mithril.js.org/$2.html$3"), "utf-8") @@ -27,7 +23,7 @@ function generate(pathname) { generate(pathname + "/" + filename) }) } - else if (!pathname.match(/tutorials|archive|guides|methods/)) { + else if (!pathname.match(/tutorials|archive|nav-/)) { if (pathname.match(/\.md$/)) { var outputFilename = pathname.replace(/\.md$/, ".html") var markdown = fs.readFileSync(pathname, "utf-8") @@ -55,7 +51,9 @@ function generate(pathname) { .replace(/\[version\]/, version) // update version .replace(/\[body\]/, markedHtml) .replace(/(.+?)<\/h.>/gim, function(match, n, id, text) { // fix anchors - return ".+?<\/a>/g, "").replace(/\.|\[|\]|"|\/|\(|\)/g, "").replace(/\s/g, "-") + '">' + text + "" + var anchor = text.toLowerCase().replace(/<(\/?)code>/g, "").replace(/.+?<\/a>/g, "").replace(/\.|\[|\]|"|\/|\(|\)/g, "").replace(/\s/g, "-"); + + return `${text}`; }) fs.writeFileSync("./dist/archive/v" + version + "/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") fs.writeFileSync("./dist/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") diff --git a/docs/index.md b/docs/index.md index 1481b21e..86aca2cc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ ### What is Mithril? -Mithril is a modern client-side Javascript framework for building Single Page Applications. +Mithril is a modern client-side Javascript framework for building Single Page Applications. It's small (< 8kb gzip), fast and provides routing and XHR utilities out of the box.
@@ -69,7 +69,7 @@ Let's create an HTML file to follow along: ### Hello world -Let's start as small as well can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) +Let's start as small as we can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) ```javascript var root = document.body diff --git a/docs/layout.html b/docs/layout.html index 9dac0d2d..f5ce0231 100644 --- a/docs/layout.html +++ b/docs/layout.html @@ -2,8 +2,7 @@ Mithril.js - - + @@ -27,7 +26,8 @@ License: MIT. © Leo Horie. - + + - + diff --git a/render/tests/test-onbeforeremove.js b/render/tests/test-onbeforeremove.js index 2e23215b..0e83d4a0 100644 --- a/render/tests/test-onbeforeremove.js +++ b/render/tests/test-onbeforeremove.js @@ -199,9 +199,8 @@ o.spec("onbeforeremove", function() { render(root, [{tag: component}]) render(root, []) + o(onremove.callCount).equals(0) callAsync(function(){ - o(onremove.callCount).equals(0) - callAsync(function() { o(onremove.callCount).equals(1) done() From 98e3cbdc696ee038a13f4cfc9240de0e9de52e24 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 4 Apr 2017 12:20:14 +0200 Subject: [PATCH 16/18] Revert attrs.class creation logic to what we had in v1.0.1. fix #1764 --- render/hyperscript.js | 4 +- render/tests/test-hyperscript.js | 102 +++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 2 deletions(-) diff --git a/render/hyperscript.js b/render/hyperscript.js index ece288fc..3d4b21e4 100644 --- a/render/hyperscript.js +++ b/render/hyperscript.js @@ -34,8 +34,8 @@ function execSelector(state, attrs, children) { } } - if (className != null) { - if (attrs.class != null) { + if (className !== undefined) { + if (attrs.class !== undefined) { attrs.class = undefined attrs.className = className } diff --git a/render/tests/test-hyperscript.js b/render/tests/test-hyperscript.js index cf0b3155..3ef03358 100644 --- a/render/tests/test-hyperscript.js +++ b/render/tests/test-hyperscript.js @@ -16,6 +16,108 @@ o.spec("hyperscript", function() { o(vnode.tag).equals("a") }) + o("v1.0.1 bug-for-bug regression suite", function(){ + o + console.log(m('a', { + class: null + }).attrs, { + class: undefined, + className: null + }) + o(m('a', { + class: null + }).attrs).deepEquals({ + class: undefined, + className: null + }) + o(m('a', { + class: undefined + }).attrs).deepEquals({ + class: undefined, + }) + o(m('a', { + class: false + }).attrs).deepEquals({ + class: undefined, + className: false + }) + o(m('a', { + class: true + }).attrs).deepEquals({ + class: undefined, + className: true + }) + console.log(m('a.x', { + class: null + }).attrs, { + class: undefined, + className: "x null" + }) + o(m('a.x', { + class: null + }).attrs).deepEquals({ + class: undefined, + className: "x null" + }) + o(m('a.x', { + class: undefined + }).attrs).deepEquals({ + class: undefined, + className: "x" + }) + o(m('a.x', { + class: false + }).attrs).deepEquals({ + class: undefined, + className: "x false" + }) + o(m('a.x', { + class: true + }).attrs).deepEquals({ + class: undefined, + className: "x true" + }) + o(m('a', { + className: null + }).attrs).deepEquals({ + className: null + }) + o(m('a', { + className: undefined + }).attrs).deepEquals({ + className: undefined + }) + o(m('a', { + className: false + }).attrs).deepEquals({ + className: false + }) + o(m('a', { + className: true + }).attrs).deepEquals({ + className: true + }) + o(m('a.x', { + className: null + }).attrs).deepEquals({ + className: "x" + }) + o(m('a.x', { + className: undefined + }).attrs).deepEquals({ + className: "x" + }) + o(m('a.x', { + className: false + }).attrs).deepEquals({ + className: "x" + }) + o(m('a.x', { + className: true + }).attrs).deepEquals({ + className: "x true" + }) + }) o("handles class in selector", function() { var vnode = m(".a") From 0b5f05f4ae1ffa15f71337fb62b9aaf49a34de9f Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Tue, 4 Apr 2017 10:28:10 +0000 Subject: [PATCH 17/18] Bundled output for commit d60e7ab30c8440efe9fa3f564a410f317d425e86 [skip ci] --- mithril.js | 4 ++-- mithril.min.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mithril.js b/mithril.js index bc3045c8..1c1495d4 100644 --- a/mithril.js +++ b/mithril.js @@ -42,8 +42,8 @@ function execSelector(state, attrs, children) { attrs[key] = state.attrs[key] } } - if (className != null) { - if (attrs.class != null) { + if (className !== undefined) { + if (attrs.class !== undefined) { attrs.class = undefined attrs.className = className } diff --git a/mithril.min.js b/mithril.min.js index 58d33dde..35332cf2 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,8 +1,8 @@ (function(){function B(b,d,f,g,e,n){return{tag:b,key:d,attrs:f,children:g,text:e,dom:n,domSize:void 0,state:void 0,_state:void 0,events:void 0,instance:void 0,skip:!1}}function C(b){var d=arguments[1],f=2,g;if(null==b||"string"!==typeof b&&"function"!==typeof b&&"function"!==typeof b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b){var e;if(!(e=M[b])){g="div";for(var n=[],k={};e=P.exec(b);){var q=e[1],m=e[2];""===q&&""!==m?g=m:"#"===q?k.id=m:"."===q? n.push(m):"["===e[3][0]&&((q=e[6])&&(q=q.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===e[4]?n.push(q):k[e[4]]=q||!0)}0 Date: Tue, 4 Apr 2017 12:35:34 +0200 Subject: [PATCH 18/18] Fix change log --- docs/change-log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/change-log.md b/docs/change-log.md index 2d3b03fe..042b8008 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -13,7 +13,7 @@ #### Bug fixes - hyperscript: Allow `0` as the second argument to `m()` - [#1752](https://github.com/lhorie/mithril.js/issues/#1752) / [#1753](https://github.com/lhorie/mithril.js/pull/#1753) ([@StephanHoyer](https://github.com/StephanHoyer)) -- hyperscript: remove `attrs.class` after normalizing to `attrs.className` - [#1764](https://github.com/lhorie/mithril.js/issues/#1764) / [#1769](https://github.com/lhorie/mithril.js/pull/#1769) +- hyperscript: restore `attrs.class` handling to what it was in v1.0.1 - [#1764](https://github.com/lhorie/mithril.js/issues/#1764) / [#1769](https://github.com/lhorie/mithril.js/pull/#1769) - documentation improvements ([@JAForbes](https://github.com/JAForbes), [@smuemd](https://github.com/smuemd), [@hankeypancake](https://github.com/hankeypancake)) ### v1.1.0