I’ve been using Gatsby for a couple of years now. If you know me you know I hate repetition and that most of my open-source software revolve around solving a problem that I don’t want to solve again and again.
The gpm helps you install a Gatsby package with all of its dependencies. It also allows you to read the docs for a package right there in the command line — without having to browse any sites.
Yes, that’s it. Currently, the idea is quite simple which I suppose will grow as the Gatsby ecosystem grows and we have more things to deal with.
You know what npm and yarn do? They install a package and all of their dependencies for you so that you only have to remember what the package name is and not what their dependencies look like.
Before gpm you had to manually install a Gatsby package along with all the peer dependencies. I for one could never remember all of them.
🤔 So, it goes like this. I wake up one fine morning. Today, I’m working on a Gatsby site duh. I love to write content with MDX.
🙈 I go ahead and npm install gatsby-plugin-mdx but that’s not all I have to install. For the life of me, I can’t remember the peer dependencies needed to be installed.
🧐 So, I Google Gatsby Plugin MDX, land on the plugin page, scroll…scroll…scroll…table of contents…why MDX…yada…yadda…yadda… there you are. I then npm install @mdx-js/mdx @mdx-js/react.
☠️ That’s not quite how it should work. And then I close the tab and forget to read the first section of the readme.md docs — since I just need a refresher on how to configure this package. I’ve done it before. The entire story repeats itself.
🤔 I run gpm install gatsby-plugin-mdx and the package + the peer dependencies get installed. I also get a link the docs that I can click to read them online or most probably I fetch the docs in the terminal by running gpm docs gatsby-plugin-mdx.
Installs a Gatsby package with all of its peer dependencies.
# 1: Interactive mode.
# Type `gpm` and answer the questions asked.
gpm
# Alternatively, you can also run it via:
gatsby-package-manager
# 2: Direct mode.
# Several ways to run the same command.
gpm install
gpm i
gpm install gatsby-plugin-mdx
gpm i gatsby-plugin-mdx
The gatsby-package-manager (gpm) stores your choice of using npm or yarn in ~/.config/configstore/gatsby-package-manager.json file. This choice can be re-configured by using the option --config or -c when running gpm.
That’s all for now but I see this as an opportunity for what comes next. I believe with time Gatsby packages, the plugins, and themes, they’ll get a bit more complicated. gpm will help make Gatsby package management easy.
Some things that I could think gpm can do in the future:
🚀 Starters: Help search/install any of the existing starters
🎛 Standard Config: Help you configure a package provided we can all agree on a standard specification that gpm can read. Something that’s part of the package.json file, maybe?!
🗃 Packs: One of my apprentices, Saqib, suggested we could also have packs command that would install recommended or opinionated packs of packages. Let’s say gpm pack seo or gpm pack @ahmadawais/seo that installs different packs of packages and lists out the instructions to configure them. It would be cool.
🤯 Moaaar automation: Configure the packages automagically.
Nothing’s ever complete, so bear with me while we keep iterating towards a better future. You can definitely help make gpm better.
Coz every night I lie in bed
The brightest colors fill my head
A million dreams are keeping me awake
I think of what the world could be
A vision of the one I see
A million dreams is all it’s gonna take
A million dreams for the world we’re gonna make …
🌳 Node.js foundation Community Committee Outreach Lead, Member Linux Foundation, OpenAPI Business Governing Board, and DigitalOcean Navigator. 📟 Teaching thousands of developers Node.js CLI Automation and VSCode.pro course. Over 142 million views, 24 yrs Blogging, 108K developers learning, 200+ FOSS.
Stay ahead in the web dev community with Ahmad's expert insights on open-source, developer relations, dev-tools, and side-hustles. Insider-email-only-content. Don't miss out - subscirbe for a dose of professional advice and a dash of humor. No spam, pinky-promise!