Giter Club home page Giter Club logo

npm-add-dependencies's People

Contributors

17number avatar andersdjohnson avatar arfeo avatar mykolab-wix avatar yurigor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

npm-add-dependencies's Issues

Wrong result when specify version

Expected Behavior

$ npm-add-dependencies [email protected]

package.json

{
  "name": "npm-add-dependencies-test",
  "version": "1.0.0",
  "main": "index.js",
  "dependencies": {
    "bulma": "0.7.0"
  }
}

Actual Behavior

$ npm-add-dependencies [email protected]

package.json

{
  "name": "npm-add-dependencies-test",
  "version": "1.0.0",
  "main": "index.js",
  "dependencies": {
    "[email protected]": "^0.7.5"
  }
}

Specifications

  • Version: v0.1.5

feat: support --save-exact

Expected Behavior

We should support --save-exact/-E to write the exact version X.X.X instead of ^X.X.X.

Actual Behavior

No way to do this right now.

fix: bundledDependencies should be array

Expected Behavior

With --bundled, we're supposed to get bundledDependencies as an array, not an object (see here for npm and here for yarn).

Per npm docs:

-B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.

So we should get:

  "bundledDependencies": ["debug"]

So perhaps we should remove support for it, or implement it correctly?

Actual Behavior

  "bundledDependencies": {
    "debug": "^4.1.1"
  }

Steps to Reproduce the Problem

  1. npx npm-add-dependencies --bundled debug

Removes trailing newline from package.json

Expected Behavior

When I run npm run add-dependencies packages/euanmarten/package.json express it should not modify trailing whitespace in the file.

Actual Behavior

Running npm run add-dependencies packages/euanmarten/package.json express results in trailing newline being removed from the package.json file.

Steps to Reproduce the Problem

Specifications

  • Version: 1.1.0
  • Platform: npm v7, Node.js v14.15.3, macOS v11.2.1
  • Subsystem:

feat: rename/alias to add-dep

Expected Behavior

Would be nice to have a more terse command like npx add-dep or npx add-deps. We could rename/publish as add-dep / add-deps instead.

Actual Behavior

Must run as npx npm-add-dependencies which takes long to type out.

dependencies are not added but replaced

Expected Behavior

I expect npm-add-dependencies will add dependencies, but not replace them

Actual Behavior

when i try to add some packages to the existing package.json, all the packages already listed in the corresponding section (devDependencies) disappear, so newly added packages fully replace old list.

Steps to Reproduce the Problem

before

{
  "name": "1-end",
  "version": "0.0.1",
  "license": "MIT",
  "scripts": {
    "build": "next build",
    "start": "next start",
    "dev": "next",
    "lint": "eslint components pages lib"
  },
  "dependencies": {
    "@material-ui/core": "^3.3.1",
    "next": "^7.0.2",
    "prop-types": "^15.6.2",
    "react": "^16.6.0",
    "react-dom": "^16.6.0",
    "react-jss": "^8.6.1"
  },
  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "eslint": "^5.7.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.2",
    "eslint-plugin-react": "^7.11.1"
  }
}

command
npm-add-dependencies eslint-config-prettier eslint-plugin-prettier prettier --dev

after

{
  "name": "1-end",
  "version": "0.0.1",
  "license": "MIT",
  "scripts": {
    "build": "next build",
    "start": "next start",
    "dev": "next",
    "lint": "eslint components pages lib"
  },
  "dependencies": {
    "@material-ui/core": "^3.3.1",
    "next": "^7.0.2",
    "prop-types": "^15.6.2",
    "react": "^16.6.0",
    "react-dom": "^16.6.0",
    "react-jss": "^8.6.1"
  },
  "devDependencies": {
    "eslint-config-prettier": "^3.3.0",
    "eslint-plugin-prettier": "^3.0.0",
    "prettier": "^1.15.3"
  }
}

Specifications

  • Version: 0.1.2, npm 6.4.1
  • Platform: Ubuntu 18.04

Feat: Tests

Shouldn't be too hard to write a few quick tests that run on a fake project.

then parse that json for the results.

edit: if i get some spare time i might try to setup some up dont think it'll be "too" much work ๐Ÿ‘

package@latest not accepted

Expected Behavior

npx add-dependencies eslint@latest -D should work

Actual Behavior

โฏ npx add-dependencies eslint@latest -D
This script adds dependencies (latest or specified versions) to the package.json file skipping the installation process.
Adding packages to 'devDependencies'...
Could not obtain the specified version for: eslint. Skip.
Done.

Running without @latest works, but I want the latest. If the latest is already used, it should at least ignore the @latest part.

Specifications

  • Version: "add-dependencies": "1.1.0",
  • Platform: Linux
  • Subsystem: Ubuntu 20.10

Cannot add dependencies starting with @ any more

Expected Behavior

npm-add-dependencies @angular/material
ok

Actual Behavior

npm-add-dependencies @angular/material
This script adds dependencies (latest or specified versions) into the package.json file without installing them

Adding packages to 'dependencies'...
undefined:2
[email protected] | MIT | deps: 8 | versions: 17
^

SyntaxError: Unexpected token n JSON at position 1
at JSON.parse ()
at npmRun.exec (C:\Users\c383650\AppData\Roaming\npm\node_modules\npm-add-dependencies\index.js:69:42)
at ChildProcess.exithandler (child_process.js:285:7)
at ChildProcess.emit (events.js:198:13)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

Steps to Reproduce the Problem

  1. Try to add any dependency whose name starts with @, example: npm-add-dependencies @angular/material

Specifications

  • Version: 0.2.0
  • Platform: Windows, Linux
  • Subsystem:

Hello, on rorw 59 of index.js i found:
runNpmShow(dep) {
const [depName, depVersion] = dep.split('@');

such split cause an undefined depName when package name starts with @

Could not fetch version info

Hey,

I'm trying to use your plugin. After a npm install -g npm-add-dependencies I run in my project :
npm-add-dependencies git+https://github.com/arfeo/npm-add-dependencies.git#master --dev

And I've got this :
This script adds dependencies (latest or specified versions) to the package.json file without installing them Adding packages to 'devDependencies'... Could not fetch version info for: git+https://github.com/arfeo/npm-add-dependencies.git#master. Skip. Done.

Any ideas ?
Thanks :)

[Feature Request] Add -i --install option

So it can be a npm i alternative, and if in my npx install script the user don't pass the --no-install, the -i flag is included in the add-dependencies command and the deps are installed.

Also, seems that the addd name is available on npm. Maybe you could use it

feat: add alias -D for --dev

Expected Behavior

We should be able to use -D as shorthand for --dev, just like npm add.

Actual Behavior

-D is not recognized.

Steps to Reproduce the Problem

  1. npx npm-add-dependencies debug -D

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.