Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

comby-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comby-wrapper

Wrapper around [Comby](https://github.com/comby-tools/comby). Comby is a tool for searching and changing code structure

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Comby Wrapper

Wrapper around Comby. Comby is a tool for searching and changing code structure

Quckstart

  1. Install Comby Server
git clone https://github.com/obenjiro/comby-server.git
cd comby-server
docker-compose up
  1. Install comby-wrapper and rambdax
npm i comby-wrapper, rambdax
  1. Create script file (script.js) and import comby-wrapper and install functional helper lib (I recommend you to use rambdax)
const CW = require('comby-wrapper');
const R = require('rambdax');
  1. Write other code for the script file (script.js)
async function main() {
    const files = await CW.getFiles(["./react_app/**/*.js"], {
        ignore: ['**/node_modules/**']
    });

    await R.pipedAsync(
        files,
        // query
        CW.match(`const :[[cname]] = props => {:[hole]}`),
        // here we preparing replacments
        CW.replaceWithSmartIndent(`class :[[cname]] extends React.Component {
            render() {
                const props = this.props;
                :[hole]
            }
        }`),
        // this command is applying all the replacments in original files
        CW.flushWith(CW.flushInPlace) 
    )
}
main();
  1. Run script
node script.js

# or if you want to see progress bar
PROGRESS=1 node script.js

Documentation

Plz read this before you start to use comby-wrapper:

  1. official comby docs https://comby.dev/docs/overview
  2. official rambdax docs https://github.com/selfrefactor/rambdax#api
  3. examples folder for query and replace example

FAQs

Package last updated on 18 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc