-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: introduce poc cli #45
Conversation
BREAKING CHANGE: This changes the runtime behaviour of bankai and shifts its focus to a dev server for the time being
Oh man, you're killing it! Re: some of the points you're making:
I think it'd be wise to always compile with sourcemaps, but split them out using exorcist. A second pass through
Hmh, so I think it'd be best to make as few assumptions as possible about the entry point. For
I was thinking: perhaps we should make enabling the HMR stuff to explicit? I think having it on in
I think 4.0+ should be OK ✨ - basically targeting the latest LTS release
Great idea, let's change this. Perhaps a separate issue / PR?
Could you elaborate? Why is replacing the script tag sub optimal? Awesome work so far hey; super excited about this 😁 |
Hey @yoshuawuyts, thanks for your feedback. Glad you like the concept! If understand you correctly the way forward should be Things to do to land this PR
Things to decide (and then do) to land this PR
Things to do next (in a separate PR)
Things let over for later (in separate PRs)
This could play out as pretty kick-ass development environment for choo apps – Looking forward to this! 🚀
What I meant when writing this was var tree = app.start()
document.body.replaceChild(tree, document.body.firstChild) See feat/cli/client-hmr.js#L45 This runs for each and every hmr update and loses all state of the current application that is not managed by choo models (e.g. focus). I thought it would be nice if var tree = app.start('[some-selector-here]')
if (tree) {
document.body.appendChild(tree)
} Alternatively this API would be nice too (given a guarantee the passed in element remains attached to the DOM) var el = document.querySelector('foo');
app.start(el) |
Hey @yoshuawuyts it would be dope if you found the time to give partial feedback; I've got some time this evening and could work on this then. |
Almost done with feedback - today is a long day, haha. Posting in a sec |
Woooh! 🎉
Aye, sounds good. The simplified HMR stuff is definitely simple enough - I
For const html = require('choo/html')
const hmr = require('choo-hmr')
const choo = require('choo')
const app = choo()
app.use(hmr())
app.router([ '/', () => html`<div>hello world</div>`])
const tree = app.start()
document.body.appendChild(tree) This is not possible with the current API though, so using a placeholder that
🎉
Have you seen choojs/choo#203? The API for const mount = require('choo/mount')
const choo = require('choo')
const app = choo()
if (module.parent) {
module.exports = app
} else {
const tree = app.start()
mount('[some-selector-here]', tree)
}
Hmm, shouldn't Sorry for taking so long to reply haha, hope this was helpful :D |
Thank you, this clears things up quite a bit!
|
@marionebl just holler when you think this is ready to merge, and I'll be happy to 😁 |
@yoshuawuyts moved the actual and feasible PR to #52, closing this and keeping the change history around for future reference |
Old version
This shows a possible way forward for #43:
New stuff
bankai start
js
,css
embeddinghtml
,css
,js
flag namespaces for the corresponding bankai methodsChanged stuff
development
is assumed as default environment, that is pretty breakingThings to consider
opts.debug
should be true ifenv !== 'production'
?Notes
0.12
still supported as https://github.com/yoshuawuyts/bankai/blob/master/.travis.yml#L2 implies?(opts) => {css, html, js}
would make things considerably easier and would allow to get rid of most of thestate
stuff. Remains could be put into a state containerchoo
is a bit clumsy, usingreplaceNode
obviously is sub optimal. It would help a big deal ifchoo
retained the id it hydrates on to support consecutiveapp.start(selector)
callsToDo:
Full rehydration, pass initial state viascript[type=application/json]
Tests?