Giter VIP home page Giter VIP logo

linemod-core's Introduction

Linemod Core

Comment driven line modifications

npm version npm downloads Module type: ESM Types in JS js-semistandard-style Follow @voxpelli@mastodon.social

Usage

import { linemod } from 'linemod-core';
import pathModule from 'node:path';

await linemod(
  [pathModule.resolve(__dirname, 'index.js')],
  { outputExtension: '.mjs' }
);

In CommonJS using available import() expression

const { linemod } = await import('linemod-core');

API

linemod(paths, { outputExtension }) => Promise<void>

Takes an array of string file paths (paths), applies modifications to them and outputs them to the same destination with the specified extension (outputExtension)

linemodFile(path, { outputExtension }) => Promise<void>

Same as linemod(), but takes a single string file path (path) rather than an array.

linemodApply(content) => string

Applies any modifications on the string input (content) and returns back the resulting string.

Available modifications

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 = () => {};

linemod-core's People

Contributors

renovate-bot avatar renovate[bot] avatar voxpelli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

linemod-core's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency installed-check to v8

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
.github/workflows/dependency-review.yml
.github/workflows/lint.yml
.github/workflows/nodejs.yml
.github/workflows/types.yml
npm
package.json
  • @types/chai ^4.3.5
  • @types/mocha ^10.0.1
  • @voxpelli/eslint-config ^18.0.0
  • @voxpelli/tsconfig ^8.0.0
  • c8 ^8.0.0
  • chai ^4.3.7
  • eslint ^8.42.0
  • eslint-plugin-es-x ^7.1.0
  • eslint-plugin-import ^2.27.5
  • eslint-plugin-jsdoc ^46.2.6
  • eslint-plugin-mocha ^10.1.0
  • eslint-plugin-n ^16.0.0
  • eslint-plugin-promise ^6.1.1
  • eslint-plugin-security ^1.7.1
  • eslint-plugin-sort-destructure-keys ^1.5.0
  • eslint-plugin-unicorn ^47.0.0
  • husky ^8.0.3
  • installed-check ^7.1.1
  • knip ^2.13.0
  • mocha ^10.2.0
  • npm-run-all2 ^6.0.5
  • type-coverage ^2.26.0
  • typescript ~5.1.3
  • node >=16.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.