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

landscaper

v0.0.10

Published

CodeMods as a Service

Downloads

10

Readme

Apply code mods to projects

npm install --global landscaper

npm

Landscaper is a command-line tool for making sweeping changes to any number of projects using code mods.

Features

  • Combine any number of code mods into a single transformation
  • Run code mods on any number of directories at once
  • Run code mods on any number of Github repositories at once
  • Use code mods published on NPM
  • Use code mods saved as Github gists
  • Apply JSCodeShift code mods without any modification
  • Automatically submit pull requests to Github repositories

Use cases

"I need to upgrade my current codebase with code mods and want to run them all together."

Landscaper can run code mods in a series back to back, no problem.

"I need to fix a typo in the README of every personal project I ever published on Github, ever."

Landscaper can take your update script and run it against a new branch forked from the master branch of each of your repositories. Once finished, it will push the new branch with changes and create a pull request.

"I want to update pre-release version dependencies in the package.json of every project in my Github organization."

Sure, we have a code mod for that already.

"It's {CURRENT-YEAR}, I want to update the copyright year in all my LICENSE files."

Sure, we have a code mod for that already.

"I want to switch from tabs|spaces to spaces|tabs in all my diary entries in my Desktop folder"

Notice how I did not take a side here.

Super Mod

The JSCodeShift code mods take a file and transform it based on its contents. Landscaper supports those mods without any configuration, but in some cases you may want more power. This power lies in a Super Mod.

A Super Mod:

  • Accepts any number of configuration options, allowing transformations to take user input and be dynamic to use cases.
  • Access the entire working directory, have access to the project, and create, delete, and rename files and folders.

Essentially, a Super Mod can do anything. Below is a simple example of a Super Mod that creates a file with the content entered by the user when configuring the code mod.

var fs = require('fs')
var path = require('path')

module.exports = {
  getOptions: function () {
    return [{
      name: 'content',
      type: 'input',
      default: 'Some text I made',
      message: 'Text to write'
    }]
  },

  run: function (directory, options) {
    var text = options.content
    var filepath = path.join(directory, 'foo.txt')
    return new Promise(function (resolve, reject) {
      fs.writeFile(filepath, text, function (error) {
        error ? reject(error) : resolve()
      })
    })
  }
}

Note: Configuration options go through inquirer.prompt().