linemod

1.1.0 • Public • Published

Linemod

npm version npm downloads js-semistandard-style Follow @voxpelli

CLI companion for linemod-core, a comment driven line modification tool.

Usage

As npm script

"scripts": {
  "test": "linemod -e new index.js lib/utils.js"
}

Command line

npm install -g linemod

Then run it at on your files that has modifications:

linemod -e new index.js lib/utils.js

If your command line supports globbing, then you can do:

linemod -e new *.js lib/**/*.js

Programmatic use

Use linemod-core directly.

Flags

  • --extension / -erequired – the file extension used on the output files.

Additional command line flags

  • --help / -h – prints all available flags
  • --strict / -s – treats warnings as errors
  • --verbose / -v – prints warnings and notices

Available modifications

All linemod-core modifications are supported. Linemods are added at the end of the line they are supposed to apply to.

linemod-add:

Prefixes the line with whatever is specified after the keyword:

// linemod-add: import escape from 'stringify-entities';

Becomes:

import escape from 'stringify-entities';

linemod-prefix-with:

Prefixes the line with whatever is specified after the keyword:

const exportedMethod = () => {}; // linemod-prefix-with: export

Becomes:

export const exportedMethod = () => {};

linemod-replace-with:

Replaces the line with whatever is specified after the keyword:

const escape = require('stringify-entities'); // linemod-replace-with: import escape from 'stringify-entities';

Becomes:

import escape from 'stringify-entities';

linemod-remove

Simply removes the entire line.

Quite useful when combined with linemod-prefix-with:

const exportedMethod = () => {}; // linemod-prefix-with: export
module.exports = { exportedMethod }; // linemod-remove

Becomes:

export const exportedMethod = () => {};

Dependents (0)

Package Sidebar

Install

npm i linemod

Weekly Downloads

19

Version

1.1.0

License

MIT

Unpacked Size

7.29 kB

Total Files

4

Last publish

Collaborators

  • voxpelli