commandline-ssg
Commander.js
commandline-ssg | Commander.js | |
---|---|---|
5 | 44 | |
0 | 26,117 | |
- | - | |
0.0 | 8.5 | |
over 2 years ago | 2 days ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
commandline-ssg
-
Working on another repo
So this week for our lab we did more practice with working with another person's repo. This week I decided to mix it up a bit and work on a SSG in JavaScript, so I made a pull request for Ritik's repository. Our task was to add a new feature that would allow the user to input a JSON config file as an argument, that config file would contain a JSON object with all the arguments the user wanted to use for the HTML output. Such as input file, output location, stylesheet, language, etc.
-
Contributing code to open source repositories
Once I had approval from the owner, the .md ticket was assigned to me and I started off by forking the repository and creating a branch to work on the issue (dhillonks/commandline-ssg:issue-8). The code in the repo was already organized into modules which made it easier for me to expand the parsing functionality. I ended up splitting the parsing method to add a flow for .md files. This ensured that I wasn't affecting any old functionality, leaving the parsing for .txt as is. After some coding, I was able to parse .md files and detect headings h1-h6. I used the first h1 text as the placeholder for . The tool could now also generate paragraphs properly for separated lines which were not headings. Moreover, both
**bold**
and__bold__
markdown syntax forbold
text were supported. Along with these code changes, I also modified theReadme.md
file to document this new functionality.Creating a pull request to get the work accepted into the original repo
After I had thoroughly testing my changes, making sure that the new functionality worked and also ensuring that it didn't break any old functionality, I created a pull request on the original repository.
Link to the pr to commandline-ssg - Click here!
I included a description of the changes that were made, the functionality that was added and sample usage for
.md
files. I also pinged the code owner to review the pull request once it was created. Today, I just found out that my changes were approved and the pull request was merged!Reviewing a pull request to cli-ssg
I also received a pull request to the open source tool I had created earlier.
Link to the pr to my repo - Click here
The pr was also adding functionality to parse
.md
files including the headings, bold, italics, links and strikethrough. It looked good at a first glance and the functionality mostly worked but I ended up finding a few issues after looking closely.
The biggest problem was thatparagraphs were not being generated for non-headings. This was obviously an big problem which I need to highlight.
Also, it rendered bold usingand italics using
which is not the best way to markup emphasis. So I suggested that bold should instead use
and italics should instead use
.
My last suggestion was not a bug, but since the PR was also implementing the syntax support for links, I wanted to make sure that it also supported automatic links i.e. links within angled bracesshould be rendered to an anchor tag.
I highlighted these and requested changes when I added my review to the pr. I look forward to reviewing the pr again once these changes are made. -
Learnings from release 0.1
He also helped me in reviewing and testing my code. I was eager for him creating issues so that I can work on them and improve my tool. His issues did not surprise me as I was sure I might have made a few mistakes during the development. He was able to find 3 issues in my code as well! He found issues of a typo, picking version from the file and program giving errors in special cases. I had a typing mistake in my code where I misspelled ‘successfully’ to ‘successfullly’. The issue can be found here. The second issue was versioning related as he suggested me to pick the program version from package.json which could reduce programmers work manually updating it in every file that uses it. And the last issue he found was input file/folder related in which he entered a file which did not exist. Instead of my program warning the user, it created an empty folder which was never expected. I later worked on all the 3 issues and resolved them ASAP.
-
Process of reviewing my friend's code in Nodejs
At the beginning, I had no trouble reading his code because he's done it pretty clean and understandable. But everyone makes mistakes right, he also did :) He had a few typos in his code that could have been tracked by an extension in Visual Studio if he had used it (Code Spell Tracker) but that's no big deal at all Issue on github can be found here. After a few hours reading, I found another thing that could have been improved which is the program version. I read it online saying that the program version can be pulled off of the package.json so we don't need to hard code the program version everywhere Issue on github can be found here. The third problem that I found is quite important and it can lead to severe errors as he forgot to handle cases when users type in invalid files or folders Issue on github can be found here. Other than those small bugs, I couldn't find any other bugs as he did it very well.
-
commandline-ssg release 0.0.1
GitHub Repo
Commander.js
-
Developing a Node CLI App in an NX monorepo
Visit the Commander.js reference.
-
Next.js Codebase Analysis <> create-next-app <> index.ts explained — Part 1.3
In the previous article, I looked at a Commander to configure and accept cli options and assign it to a variable called program.
-
[AskJS] Looking for JS course for experienced developers?
You can write a command line utility using zx or commander.js. Hit a public api, spit stuff out in the console, etc.
-
[AskJS] What is your preferred solution to share and execute Node.js scripts ?
In your index.js you can do whatever you want, even create an interactive CLI (check commander).
-
Exploring video generators in FFMPEG
There is clearly a whole load of repetition, so this should be fairly easy to build and parameterise. Essentially this will all just be string building so we won't need to use any particular libraries for most of this script. We will need a way to call ffmpeg though - and ffmpeg will need to be present too, of course. To call a CLI command we can use the package commander.
-
How to Create a Testable CLI using TypeScript?
Commander.js is an NPM package that makes it easier to build CLI tools. You can find its documentation over here
-
Creating a Node.js Command-line Tool, Linux Terminal CLI and NPM Package
You can also use npm package commander to make more complex command line tool with lot of options and sub commands.
-
Create a Node.js command-line library with NRWL NX workspace
commander - npm - Required. A library that lets you define the commands and their arguments, options, help, etc.
-
Releasing package to npm
Throughout my time writing and updating my static-site generator, I've been using npm from the very foundation I use an npm package called commander. Therefore, it is obvious that for the tool that I will be using to publish my ssg, I will do so with npm.
-
Building a TypeScript CLI with Node.js and Commander
The command line has thousands of tools, such as awk, sed, grep, and find available at your disposal that cut development time and automate tedious tasks. Creating a command line tool in Node.js isn't very complicated, thanks to a powerful library like Commander.js.
What are some alternatives?
cv-ssg - Static site generator
oclif - CLI for generating, building, and releasing oclif CLIs. Built by Salesforce.
cli-ssg - Tool to generate html web site from txt input
Ink - 🌈 React for interactive command-line apps
commandline-ssg
zx - A tool for writing better scripts
Bit - A build system for development of composable software.
listr - Terminal task list
chalk - 🖍 Terminal string styling done right
gluegun - A delightful toolkit for building TypeScript-powered command-line apps.
vantage - Distributed, realtime CLI for live Node apps.
is-up - Check whether a website is up or down