Skip to content

Commit

Permalink
feat: add manager option
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Apr 24, 2020
1 parent 5dfe5fd commit eee5168
Show file tree
Hide file tree
Showing 4 changed files with 372 additions and 355 deletions.
12 changes: 10 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Options
--version Show version.
--watch, -w Watch for changes.
--connect, -c Can be used with link command to also connect.
--manager Package manager to use npm or yarn. Defaults: 'yarn'
Examples
$ connect-deps link ../dep-folder1 ../dep-folder2
Expand All @@ -45,6 +46,11 @@ Examples
connect: {
type: 'boolean',
alias: 'c'
},
manager: {
type: 'string',
alias: 'm',
default: hasYarn() ? 'yarn' : 'npm'
}
}
});
Expand Down Expand Up @@ -76,15 +82,17 @@ if (['link', 'connect', 'reset'].includes(cmd)) {

let packageManager;

if (hasYarn(cwd)) {
if (cli.flags.manager === 'yarn') {
packageManager = {
add: modules => execa('yarn', ['add', ...modules]),
rm: modules => execa('yarn', ['remove', ...modules]),
addDev: modules => execa('yarn', ['add', '--dev', ...modules]),
pack: (packFile, depPath) =>
execa('yarn', ['pack', '--filename', packFile], { cwd: depPath })
};
} else {
}

if (cli.flags.manager === 'npm') {
packageManager = {
add: modules => execa('npm', ['install', ...modules]),
rm: modules => execa('npm', ['rm', ...modules]),
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,31 @@
],
"dependencies": {
"chokidar": "^3.3.1",
"conf": "^6.2.0",
"conf": "^6.2.4",
"del": "^5.1.0",
"execa": "^4.0.0",
"has-yarn": "^2.1.0",
"meow": "^6.0.0",
"ora": "^4.0.3",
"meow": "^6.1.0",
"ora": "^4.0.4",
"p-debounce": "^2.1.0",
"p-queue": "^6.2.1",
"p-queue": "^6.3.0",
"read-pkg": "^5.2.0",
"update-notifier": "^4.0.0"
"update-notifier": "^4.1.0"
},
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"ava": "^3.1.0",
"codecov": "^3.6.2",
"ava": "^3.7.1",
"codecov": "^3.6.5",
"conventional-changelog-cli": "^2.0.31",
"eslint": "^4.7.1",
"eslint-config-halo": "^2.3.3",
"http-serve": "^1.0.1",
"husky": "^4.2.1",
"lint-staged": "^10.0.5",
"np": "^5.2.1",
"husky": "^4.2.5",
"lint-staged": "^10.1.7",
"np": "^6.2.2",
"npm-run-all": "^4.1.1",
"nyc": "^15.0.0"
"nyc": "^15.0.1"
},
"husky": {
"hooks": {
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Options
--help Show help.
--watch, -w Watch for changes.
--connect, -c Can be used with link command to also connect.
--manager Package manager to use npm or yarn.
Examples
$ connect-deps link ../dep-folder
Expand Down
Loading

0 comments on commit eee5168

Please sign in to comment.