Closed artis3n closed 6 years ago
At first I thought the commands were executed by npm itself in javascript or something cross-platform, but it seems like the only thing happening is you now have an alias for each command using npm
. Can you elaborate a bit on the benefits? :)
It seems that this is what you wanted: https://github.com/migueldemoura/migueldemoura.com/blob/master/bin/console
Yup, just aliases. Little nicer to run for users in my opinion. It's what I use on my blog and thought I'd push that upstream. If there's no interest, I can close this PR and push one that solely has the --drafts
addition. That should definitely be merged in to allow rendering of draft articles locally.
Yep, that is pretty cool. Since we already require npm anyway, this could indeed be simpler. You seem to have investigated this pretty throughly; do you know any way of replacing the shell scripts with something cross-platform (i.e., that works on windows without WSL)? That would be really great for windows users.
I don't think we're going to find something easily cross-platform. I imagine a Powershell script is what you would want to use for Windows, though. I am not very familiar, but this seems like a good place to start: https://gist.github.com/noelmace/997a2e3d3ced0e1e6086066990036b16. I'd be happy to look into it more in a new issue, although I don't know how quickly I would be able to get into it.
You could get into a dev ops tool like Ansible that could make the install cross-platform, but even as simple as Ansible is it feels like too heavy-handed a solution for this. If you want to look into that I could write up an Ansible playbook pretty quickly.
@arikalfus I like it! Can you also update the post with the setup instructions please?
re: Ansible - that's a terrible idea forget I said that.
@nielsenramon What setup instructions are you talking about? I replace the old commands in the README with these new ones.
@arikalfus, I think he's talking about this:
https://github.com/nielsenramon/chalk/blob/master/_posts/2017-12-23-introducing-chalk.md
Ah, right! Updated
@arikalfus Thanks a lot!
& Added Intellij system files to .gitignore
Changes
npm run
commands for the build, development, and publish features of the theme.bin/setup
->npm run setup
bundle exec jekyll serve
->npm run local
bin/deploy
->npm run publish
--drafts
flag tobundle exec jekyll serve
so draft articles will work.Rationale
Changes to the commands (like adding
--drafts
) can occur without the user having to change the command they run. They runnpm run local
and behind the scenes the maintainers can update that command's function as needed.Instead of having to remember longer commands or file paths, just run
npm run <the thing you want>
and it Shall Be Done for you. This was more of a pet peeve of mine.Testing
This is not platform-dependent and all commands have been tested to work successfully.
Concerns
NPM has some standard commands (
publish
is one of them). If you runnpm publish
on this repo, the command will fail and give an error message that will lead the user down a red herring. They won't know that the command they want isnpm run publish
. The fix would be to rename the commands to any keyword that is not in the list of scripts, but I really like the word publish for the action that is happening. It probably makes more sense to make itnpm run deploy
, though.