Skip to content
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
9 changes: 7 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"import/no-extraneous-dependencies": 0,
"consistent-return": 0,
"prefer-promise-reject-errors": "off",
"no-restricted-globals":"off"
"no-restricted-globals":"off",
"no-param-reassign": "warn",
"prefer-destructuring": "off",
"one-var": "off",
"one-var-declaration-per-line": "off",
"max-len": "off"
}
}
}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ jspm_packages

# vscode
.vscode
*.lock
*.lock

#webstorm
.idea
10 changes: 6 additions & 4 deletions .santari.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"pr": {
"title": "Updating Dependencies from file",
"body": "Dependencies to Update"
}
}
"title": "PR title",
"body": "PR Body"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove title and body from demo config :). Atleast we can show the pr body being populated.

},
"repo": "remicass/santari",
"msg": "commit message goes here if you want"
}
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Santari looks for dependencies in your project and creates a PR with the latest
1. Gets your package.json file from your project and runs `npm-check-updates` in background.
2. If there are dependencies to be updated. It creates a new branch with updated dependencies package.json.
3. If a branch exists with the updated dependencies, branch and PR creation is avoided.
4. If you have locked version for deps, they are not overrided.
4. If you have locked version for deps, they are not overridden.

![image](https://cloud.githubusercontent.com/assets/2890683/19828761/93546cc4-9e01-11e6-8840-a931ce7f6711.png)

Expand All @@ -34,25 +34,31 @@ santari --repo jeremyrajan/santari

Replace the repo option with `username/repo-name`.

The repo will be read from your package.json `repository` property if you do not specify it here.

#### Options

You can pass the following options:

1. `--dry`: If you pass this as argument then, santari will not create PR/branches and will only display the latest
1. `--repo -r`: Pass the repository here. Required if it cannot be parsed from your package.json or read from `.santari.json`.
1. `--dry -d`: If you pass this as argument then, santari will not create PR/branches and will only display the latest
packages to be updated.

ex: `santari --repo <author>/<repo> --dry`

2. `--c`: From version > 2.5.0 you can pass a config file option wherein you can set PR details. Check [`.santari.json`](.santari.json) in
this repo.
2. `--config -c`: From version > 2.5.0 you can pass a config file option wherein you can set PR details. Check [`.santari.json`](.santari.json) in
this repo. If you do not specify a config file, the library will look for one in the directory it was executed from.

ex: `santari --repo <author>/<repo> --c .santari.json`

3. `--host -h`: specify an alternate github host. Useful for Github Enterprise usecases.
4. `--token -t`: pass your API token here instead of using the environment variable above.
5. `--message -m`: override the default git commit message.

## Automatic Checking

> Please note that this example uses travis CI.

1. Add `GITHUB_KEY` with your access token as `ENV` variable.
1. Add `GITHUB_KEY` with your access token as `ENV` variable or specify it on the command line with `--token` in step 3 below.
2. Add `npm i -g santari` to [`before_install`](https://github.com/jeremyrajan/santari/blob/master/.travis.yml#L12)
3. Add `santari --repo <author>/<name_of_repo>` to [`after_success`](https://github.com/jeremyrajan/santari/blob/master/.travis.yml#L13)
4. Configure cron in travis CI for the repo. You have a choice between daily, weekly or monthly.
Expand Down
35 changes: 26 additions & 9 deletions bin/index.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node

const yargs = require('yargs');
const santariStarter = require('../src/index');
const logger = require('../src/libs/logger');
const packageJSON = require('../package.json');
Expand All @@ -12,18 +12,35 @@ if (checkArgs[checkArgs.length - 1] === '-v') {
process.exit(0);
}

const args = require('yargs')
const args = yargs
.option('repo', {
alias: 'r',
describe: 'The repository to target your pull request. Reads from package.json if not supplied'
})
.option('dry', {
alias: 'd',
describe: 'Peform a dry run and print JSON to the console.'
})
.option('host', {
alias: 'h',
describe: 'Override the default github.com host. Useful for targeting Github enterprise'
})
.option('token', {
alias: 't',
describe: 'Redundant with environment variable GITHUB_KEY, will override if supplied. Can also be used instead of the environment variable.'
})
.option('config', {
alias: 'c',
describe: 'Config file. Defaults to ".santari.json". Keys supplied can match the input options on the cli.'
})
.option('msg', {
alias: 'm',
describe: 'Commit message header to use. Defaults to "chore(package.json): update dependencies". Body is written dynamically based on what is updated.'
})
.usage('Usage: $0 --repo [repo name]')
.example('$0 --repo jeremyrajan/frontend-starter', 'Check the dependencies and sends a PR')
.demand(['repo'])
.argv;

// if we cant find the repo then bail.
if (!args.repo) {
logger.error('Repo is not supplied!');
process.exit(0);
}

santariStarter(args, (err, result) => {
if (err) {
return logger.error(err);
Expand Down
Loading