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

synvert

v1.15.0

Published

write javascript code to rewrite javascript code

Downloads

9

Readme

synvert-javascript

Version AwesomeCode Status for xinminlabs/synvert-javascript

synvert-javascript is a command tool to rewrite javascript code automatically, it depends on synvert-core-javascript and synvert-snippets-javascript.

synvert-core-javascript provides a set of DSLs to rewrite javascript code.

synvert-snippets-javascript provides official snippets to rewrite javascript code.

Installation

Install through npm

$ npm install -g synvert

This will also install synvert-core-javascript.

Synvert is completely working with remote snippets on github, but you can sync all official snippets locally to make it run faster.

$ synvert-javascript --sync

Then you can use synvert to rewrite your javascript code, e.g.

$ synvert-javascript -r jqeury/migrate

Usage

$ synvert-javascript --help
Write javascript code to rewrite javascript code

USAGE
  $ synvert-javascript

OPTIONS
  -e, --execute=execute          execute a snippet, run or test
  -f, --format=format            output format
  -g, --generate=generate        generate a snippet with snippet name
  -h, --help                     show CLI help
  -l, --list                     list snippets
  -r, --run=run                  run a snippet with snippet name, or local file path, or remote http url
  -s, --show=show                show a snippet with snippet name
  -t, --test=test                test a snippet with snippet name, or local file path, or remote http url
  -v, --version
  --max-file-size=max-file-size  [default: 10240] skip file if its size is more than the size
  --no-semi                      prefer no semicolon, it prints semicolon by default
  --only-paths=only-paths        only paths, splitted by comma
  --root-path=root-path          [default: .] project root path
  --show-run-process             show processing files when running a snippet
  --single-quote                 prefer single quote, it uses double quote by default
  --skip-paths=skip-paths        [default: **/node_modules/**] skip paths, splitted by comma
  --sync                         sync snippets
  --tab-width=tab-width          [default: 2] prefer tab width

Commands

Sync snippets

Official Snippets are available on github, you can sync them any time you want.

$ synvert-javascript --sync

List snippets

List all available snippets.

$ synvert-javascript -l

$ synvert-javascript --list --format json

Show a snippet

Describe what a snippet does.

$ synvert-javascript -s jquery/migrate

Run a snippet

Run a snippet, analyze and then rewrite code.

$ synvert-javascript --run jquery/migrate

Run a snippet from remote url.

$ synvert-javascript --run https://raw.githubusercontent.com/xinminlabs/synvert-snippets-javascript/master/lib/javascript/no-useless-constructor.js

Run a snippet from local file.

$ synvert-javascript --run ~/Sites/xinminlabs/synvert-snippets-javascript/lib/jquery/deprecate-event-shorthand.js

Show processing files when running a snippet.

$ synvert-javascript --run javascript/no-useless-constructor --show-run-progress

Skip large files.

# skip files if its size is more than 10KB
$ synvert-javascript --run javascript/no-useless-constructor --max-file-size 10240

Skip paths.

$ synvert-javascript --run javascript/no-useless-constructor --skip-paths **/node_modules/**,**/dist/**

Only paths.

$ synvert-javascript --run javascript/no-useless-constructor --only-paths frontend/src/javascripts

Root path.

$ synvert-javascript --run javascript/no-useless-constructor --root-path /repos/synvert

Generate a snippet

$ synvert-javascript -g javascript/convert-foo-to-bar