-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: rewrite bundle as node script #10
base: main
Are you sure you want to change the base?
Conversation
this is where i feel like we're re-inventing the wheel and i'd suggest we re-evaluate whether gulp makes sense. |
I don't mind gulp if that is preferred but in this case, I personally find a simple node script is much easier to follow how things are setup especially in cases like this where we have integration with browsersync watching. Put another way, writing this file in gulp would more or less the same file but add another abstraction and I don't really see what value gulp would add. |
Some benefits I see in gulp:
here's an example gulpfile i'm using across oak projects: I just feel like gulp is more feature rich than what's currently available in this script, and I can do more if I need to without having to write too much code. |
Okay, yeah I can see if you want to go and more to tasks like you have, it would be easier to do in gulp which makes sense for starter. Let me update this with gulp. |
before you put too much effort into rewriting this i'd suggest getting @jeremydw 's take on this since he seemed keen on not depending on gulp. i personally think gulp is worth using since it's basically just a task runner and it frees up package.json from looking too messy. |
For the record I liked how we were able to get things working without writing any code, and just running scripts invoked in package.json. That was before we realized we had more complex requirements around bundling and processing. I suppose, it's fine to depend on gulp if it helps stay organized. I agree with Scott's notion about using a simple script, but after reading Steven's comments I agree it might help to have separate gulp tasks for invoking the CSS build, JS build, both, etc. Scott, that was something I didn't think of when you pinged this to me earlier. |
Yup sounds good. I haven't had much need to messing with gulp beyond getting JS / CSS going in a project so I thought simpler is better but on second thought, Steven's makes a good point and I think the starter should be easily expandable and to easy pick up. :) |
Okay this is updated with gulp now. Let me know if you have any further feedback. |
Oops before you submit, could you double check that the TS output location is correct? I took a quick peek at tsconfig.json and it says outDir is |
Thanks for catching that. Looks like it was picking up a file I had generated earlier. I've fixed this but the JS file generated from the ts build is not cleaned up. Here is what happens right now:
The main downside is that We can:
@jeremydw Another option might be to have an exclusion rule to staticRoutes so we exclude main.js from the build. |
Submitted a bit early. Given the three options (but maybe there are more), I personally lean towards just compiling twice and using -noEmit. It might add some small time to the compilation but I haven't found it noticeable and it makes the code easier to follow. |
I just checked amagaki.js and looks like the entire |
I don't think we want to export out the tsc outputted We could export it to some other folder like Deleting is possible but again, I am feeling a bit that compiling twice with -noEmit is probably an acceptable trade-off to having the extra folder or adding this complexity to the build process. |
Ah yeah sorry I forgot that ama uses (I don't think we should compile twice, there it creates an arbitrary slowness in the build workflow, which I consider bad practice.) |
FYI, I'm going to sit on this a bit more as I noticed a few more issues while using this on a project.
|
@uxder - in #21 I've moved this to use |
Slight update – I need to remove some additional node scripts (the sass scripts are not needed anymore as they are handled in gulp); will do so shortly. |
Is browsersync working okay? I tried this config on a project but the main issue was that browsersync was flaky. I ended up disabling browsersync integration in that project. |
It is working OK at the moment, but I haven't put it through deep testing.
Now I can make CSS or YAML edits and things autoreload. I just tested it with vim (which uses swap files) and things seemed to work fine; but it's just a limited test. |
71d557f
to
9a4f902
Compare
It was a bit hard to follow the npm scripts so I propose this change: