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

Added recursive-ci next to recursive-install. #11

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
sudo: false
language: node_js
node_js:
- "6"
- "5"
- "4"
- "iojs"
- "0.12"
- "node"
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests recursive-ci",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test"
],
"internalConsoleOptions": "openOnSessionStart"
}

]
}
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,32 @@ Usage
`$ npm-recursive-install`

`$ npm-recursive-install --skip-root` - Will not install in `process.cwd()`

`$ npm-recursive-install --rootDir=lib` - Will only install from lib directory

`$ npm-recursive-install --production` - Will not install dev dependencies


recursive-ci [![Build Status](https://travis-ci.org/ReinoutW/recursive-ci.svg?branch=master)](https://github.com/ReinoutW/recursive-ci)
===

A small utility to recursively run `npm ci` in any child directory that have both a `package.json` as well as a `package-lock.json` file, excluding sub directories of `node_modules`.

Install
---
`$ npm i -g recursive-ci`

Usage
---
`$ npm-recursive-ci`

`$ npm-recursive-ci --skip-root` - Will not install in `process.cwd()`

`$ npm-recursive-ci --rootDir=lib` - Will only install from lib directory

`$ npm-recursive-ci --production` - Will not install dev dependencies


License
---
MIT
40 changes: 40 additions & 0 deletions lib/tools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// tools.js
// ========

var path = require('path');
var shell = require('shelljs');

module.exports = function() {
this.noop = function(x) {
return x;
};

this.getPackageJsonLocations = function(dirname) {
return getPackageFileLocations(dirname, 'package.json');
};

this.getPackageLockJsonLocations = function(dirname) {
return getPackageFileLocations(dirname, 'package-lock.json');
};

this.filterRoot = function(dir) {
if (path.normalize(dir) === path.normalize(process.cwd())) {
console.log('Skipping root package-json & package-lock.json');
return false;
} else {
return true;
}
};

function getPackageFileLocations(dirname, filename) {
return shell.find(dirname)
.filter(function (fname) {
return !(fname.indexOf('node_modules') > -1 || fname[0] === '.') &&
path.basename(fname) === filename;
})
.map(function (fname) {
return path.dirname(fname);
});
}
};

9 changes: 9 additions & 0 deletions license
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT) - http://www.opensource.org/licenses/mit-license.php

Copyright 2019

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading