Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support integration with other Node application #18

Open
promethyttrium opened this issue Apr 15, 2020 · 4 comments
Open

feat: Support integration with other Node application #18

promethyttrium opened this issue Apr 15, 2020 · 4 comments

Comments

@promethyttrium
Copy link

promethyttrium commented Apr 15, 2020

Expected Behavior

Instead of just being used as a CLI, make npm-add-dependencies reusable by making it a module that can used programmatically.

Actual Behavior

Cannot be called programmatically.

@arfeo
Copy link
Owner

arfeo commented Apr 15, 2020

Hello,

Could you, please, describe more thoroughly the use case you want the program to be used in? Thank you.

@promethyttrium
Copy link
Author

promethyttrium commented Apr 15, 2020

Sure, for example, if I were to write something similar to create-react-app, I would want to programmatically add a set of dependencies from inside another node.js application.

Currently, I can't just require('add-dependencies') and call it to add modules because index.js export any methods. It assumes that I'll always use add-dependencies as a CLI tool. I was to use it just like any other node module.

@phyzical
Copy link

phyzical commented Jun 19, 2020

Ah yes i actually ran into this issue today trying to refactor my build script further,

i.e say i wanted to go
npm run saveDependencies
with the following script

    "saveDependencies": "node tasks/saveDependencies.js",

then i would expect to be able to do something like

const addDeps =  require('add-dependencies');
addDeps.setDev(true)
addDeps.setOverwrite(false)
addDeps.addPackage('packagename')
addDeps.addPackage('packagename2')
addDeps.addPackages(['packagename3','packagename4'])
addDeps.updatePackageJson()

or something like that.

the reason for me wanting this is simply due to the fact that package.json doesn't allow for multi lines

but this does change it from a cli only package

@phyzical
Copy link

#21

phyzical pushed a commit to phyzical/npm-add-dependencies that referenced this issue Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants