npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dev-to-git

v1.4.10

Published

A CLI to keep your dev.to posts in sync from a GIT project, using the CI provider of your choice

Downloads

229

Readme

Dev.to git: One way publishing of your blog posts from a git repo to dev.to

First, what is dev.to?

https://dev.to is a free and open source blogging platform for developers.

dev.to (or just DEV) is a platform where software developers write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their place within our community.

Why would I want to put all my blog posts on a git repo?

  • Don't be afraid to mess up with one of your articles while editing it
  • Same good practices as when you're developing (format, commits, saving history, compare, etc)
  • Use prettier to format the markdown and all the code
  • Let people contribute to your article by creating a PR against it (tired of comments going sideways because of some typos? Just let people know they can make a PR at the end of your blog post)
  • Create code examples close to your blog post and make sure they're correct thanks to Embedme (*1)

*1: Embedme allows you to write code in actual files rather than your readme, and then from your Readme to make sure that your examples are matching those files.

If you prefer not to use Prettier or Embed me, you can do so by simply removing them but I think it's a nice thing to have!

How do I choose which files I want to publish?

There's a dev-to-git.json file where you can define an array of blog posts, e.g.

[
  {
    "id": 12345,
    "relativePathToArticle": "./blog-posts/name-of-your-blog-post/name-of-your-blog-post.md"
  }
]

How can I find the ID of my blog post on dev.to?

Whether it's published or just a draft, you have to create it on dev.to directly. Unfortunately, dev.to does not display the ID of the blog post on the page. So once it's created, you can open your browser console and paste the following code to retrieve the blog post ID:
+$('div[data-article-id]').getAttribute('data-article-id')

How do I configure every blog post individually?

A blog post has to have a front matter header. You can find an example in this repository here: https://github.com/maxime1992/dev-to-git/blob/master/test/article.md

Simple and from there you have control over the following properties: title, published, description, tags, series and canonical_url.

How do I add images to my blog posts?

Instead of uploading them manually on dev.to, simply put them within your git repo and within the blog post use a relative link. Here's an example: The following is an image: ![alt text](./assets/image.png 'Title image').

If you've got some plugin to preview your markdown from your IDE, the images will be correctly displayed. Then, on CI, right before they're published, the link will be updated to match the raw file.

How to setup CI for auto deploying the blog posts?

If you want to use Github and Travis, a .travis.yml file has been already prepared for you.

First, you have to activate the repository on Travis: https://travis-ci.org/account/repositories

Then, you have to create a token on your dev.to account: https://dev.to/settings/account and set an environment variable on Travis called DEV_TO_GIT_TOKEN that will have the newly created token as value.

How can I manage my blog posts? Mono repo? One article per repo?

It's totally up to you and you could even adopt both solutions at the same time.

You can have a repo with a single blog post, for example if you're presenting a library it might make sense to have the article written within that repo.

And if you prefer a mono repo approach with all your articles in the same repo, I've built a template repository to help you get started in a few minutes only: https://github.com/maxime1992/dev.to