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

@appworks/codemod

v0.2.0

Published

AppWorks codemod scripts

Downloads

15

Readme

@appworks/codemod

AppWorks codemod scripts for rax, ice and react project.

Install

$ npm i @appworks/codemod -g

Usage

1. CLI

$ appworks-codemod <transform> <path> [...options?]
  • transform - name of transform, see available transforms below.
  • path - files or directory to transform.
  • options? - option for jscodeshift.

Example:

$ appworks-codemod plugin-rax-component-to-component ./

2. API

Check()

You can retrieve the recommended codemod of the current project through the check method.

Options:

  • directory: string, the target directory path
  • files: string[], the target directory files path array

Return:

  • results: IResult[] (see interface), the target project recommended codemod info array.

Example:

import glob from "glob";
import { check } from "@appworks/codemod";

const dir = "/xxx/xx";

glob(
  "**/*",
  { cwd: dir, ignore: ["**/node_modules/**"], nodir: true, realpath: true },
  function (er, files) {
    check(dir, files).then((results) => {
      console.log(results);
    });
  }
);

Run()

You can use the run method to execute specific codemod.

Options:

  • directory: string, the target directory path
  • files: string[], the target directory files path array
  • transform: string, the name of transform, see available transforms below.

Return:

  • result: IResult (see interface), run codemod result.

Example:

import glob from "glob";
import { check } from "@appworks/codemod";

const dir = "/xxx/xx";

glob(
  "**/*",
  { cwd: dir, ignore: ["**/node_modules/**"], nodir: true, realpath: true },
  function (er, files) {
    run(dir, files, "plugin-rax-component-to-component").then((result) => {
      console.log(result);
    });
  }
);

Interface

IResult:

interface IResult {
  transform: string; // transform key, see `Included Transforms`
  title: string; // transform description title
  title_en: string; 
  message: string; // transform description message
  message_en: string; 
  severity: 0 | 1 | 2; // 0: advice 1: warning 2: error
  mode: "run" | "check"; // mode, see API
  docs: string; // docs url
  output: string; // jscodeshift CLI output
  npm_deprecate?: string; // same as https://docs.npmjs.com/cli/v7/commands/npm-deprecate/ 
}

Included Transforms

1. plugin-rax-component-to-component

Update plugin-rax-component to plugin-component. docs

2. lint-config-to-spec

Follow Alibaba FED lint rules, and use @iceworks/spec best practices. docs