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

module-scripts

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

module-scripts

Opinioned scripts for maintaing npm module. Includes linting, testing, transpiling.

  • 0.0.39
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

module-scripts

Opinioned scripts for maintaing npm module. Includes linting, testing, transpiling, type checking.

It's like create-react-app, but for packages or librarires.

To install or update run

npx nmx init

in your package folder.

module-scripts assumes that your source is stored under src folder.

Caution: for now it formats the source code with tabs on and semicolons off. Other options are in TODO.

Basically your package.json starts to look like

  "main": "dist/commonjs/index.js",
  "module": "dist/module/index.js",
  "esnext": "dist/esnext/index.js",
  "scripts": {
    "compile": "nmx compile",
    "clean": "nmx clean",
    "types": "nmx types",
    "build": "nmx build",
    "lint": "nmx lint",
    "lint:fix": "nmx lint:fix",
    "lint:ci": "nmx lint:ci",
    "test": "nmx test",
    "test:debug": "nmx test:debug",
    "coverage": "nmx coverage",
    "prepack": "nmx prepack",
    "prepublishOnly": "nmx prepublishOnly"
  },
  "devDependencies": {
    "module-scripts": "...",

No more transpilers, linters and other common noise in devDependencies.

module-scripts will add absent scripts for you, but existing scripts you should update manually.

Usage: module-scripts <command>

Commands:

compile

Compiles the content of the src folder and creates three folders with compiled stuff. Supports babel macros.

  • dist/commonjs/ transplies imports to require and most of modern syntax.

  • dist/module/ transplies less syntax and preserves imports.

  • dist/esnext/ preserves as much as possible, but still transpiles to standard javascript. Mostly removes type declarations.

clean

Removes dist folder.

types

Runs typescript for type checking and generates type definitions in dist/types/.

build

Cleans the folder, lints, compiles and type checks the code.

lint

Checks for lint errors.

lint:fix

Prettifies the code.

lint:ci

Like lint, but treats all warnings as errors. For CI and prepublishing script.

test

Runs tests.

test:debug

Runs tests in debug mode. Opens browser debug tools. Do not forget to insert debug statement in your test somewhere for break point.

coverage

Calculates test coverage.

prepack

Builds module after installation from source, e.g. from github and before publishing your package.

preversion

Lints the code before incrementing the package version.

prepublishOnly

Lints and tests to ensure all is ok before publishing.

postpublish

Pushes commits to remote git.

Keywords

FAQs

Package last updated on 11 May 2020

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