Git Product home page Git Product logo

monorepo-mode's Introduction

npm-mode

This is npm-mode, an Emacs minor mode for working with NPM projects.

Installation

Package Manager

The recommended way to install npm-mode is through the package manager and MELPA.

Manual Installation

Start by cloning the npm-mode package repository:

$ git clone https://github.com/mojochao/npm-mode.git /your/path/here

Finish by loading the npm-mode package in your emacs configuration:

(add-to-list 'load-path "/your/path/here/npm-mode")
(require 'npm-mode)

Configuration

The npm-mode package provides a minor mode which can be activated with:

(npm-mode)

Global Activation

The mode can be activated globally with:

(npm-global-mode)

Project Activation

The mode can be activated on a per-project basis using directory local variables by running add-dir-local-variable from the root directory of a project.

For example, visit the README.md file in the root directory of a project, and run M-x add-dir-local-variable. Emacs will prompt you for Mode or subdirectory:, to which you should enter nil.

Next, you will be prompted for Add directory-local variable:, to which you should enter mode.

Next, you will be prompted for Add mode with value:, to which you should enter npm-mode.

Next, you will be placed in a new .dir-locals.el buffer containing the directory local variables for the project, including the added npm-mode configuration.

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((nil
  (mode . npm)))

Finally, save the buffer contents with C-x C-s, and your project is configured for npm-mode.

Now when you visit any file under the project directory, npm-mode will be activated and its commands made available.

Command Keymap Prefix

The mode provides a command keymap, whose default C-c n prefix can be configured with M-x customize-variable npm-mode-keymap-prefix.

Usage

Command Keymap

Once npm-mode has been activated, its commands are accessed by the C-c n command prefix:

command keymap description
npm-mode-npm-init n Initialize new project
npm-mode-npm-install i Install all project dependencies
npm-mode-npm-install-save s Add new project dependency
npm-mode-npm-install-save-dev d Add new project dev dependency
npm-mode-npm-uninstall u Remove project dependency
npm-mode-npm-list l List installed project dependencies
npm-mode-npm-run r Run project script
npm-mode-visit-project-file v Visit project package.json file
? Display keymap commands

npm-mode-npm-init

Running C-c n n will create a new project in the current directory.

npm-mode-npm-install

Running C-c n i in a project directory will install all project dependencies.

npm-mode-npm-install-save

Running C-c n s in a project directory will prompt for the name of a package to install and will install it as a project dependency.

npm-mode-npm-install-save-dev

Running C-c n d in a project directory will prompt for the name of a to install and will install it as a project dev dependency.

npm-mode-npm-uninstall

Running C-c n u in a project directory will prompt for the name of a package to uninstall and will uninstall it and remove it from project dependencies.

npm-mode-npm-list

Running C-c n l in a project directory will list the project.

npm-mode-npm-run

Running C-c n r in a project directory will prompt for the name of a script to run and will run it. Completion support is provided.

npm-mode-visit-project-file

Running C-c n v in a project directory will visit the project file in a buffer.

Acknowledgements

This repo is a rewrite of a fork of https://github.com/AlexChesters/emacs-npm, and its history has been preserved. Many thanks to Alex for his contribution.

monorepo-mode's People

Contributors

alexchesters avatar mojochao avatar nickserv avatar syohex avatar

Watchers

James Cloos avatar

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.