Add most recent action
This commit is contained in:
parent
fa4fd2aed4
commit
dc7133054e
|
@ -10,8 +10,8 @@ jobs:
|
|||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
with:
|
||||
stale_age_days: 0
|
||||
wait_after_stale_days: 0
|
||||
max_operations_per_run: 1
|
||||
stale_age_days: 60
|
||||
wait_after_stale_days: 7
|
||||
max_operations_per_run: 30
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
|
67
README.md
67
README.md
|
@ -1,15 +1,12 @@
|
|||
# Close Stale Issues
|
||||
# Close Stale Issues and PRs
|
||||
|
||||
To use, spin up a workflow. The following inputs are available:
|
||||
* stale_age_days: The number of days old an issue can be before marking it stale (default 60)
|
||||
* wait_after_stale_days: The number of days to wait to close an issue after it being marked stale (default 7)
|
||||
* max_operations_per_run:The maximum number of operations per run, used to control rate limiting (default 30)
|
||||
* stale_label: The label to apply when an item is stale (default 'Stale')
|
||||
* stale_message: The message to post on the issue when tagging it
|
||||
Warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
|
||||
### Usage
|
||||
|
||||
See [action.yml](./action.yml) For comprehensive list of options.
|
||||
|
||||
You'll need to map `GITHUB_TOKEN` to a PAT token for the identity you want to use to modify the issues:
|
||||
|
||||
Example workflow:
|
||||
Basic:
|
||||
```
|
||||
name: "Close stale issues"
|
||||
on:
|
||||
|
@ -18,13 +15,53 @@ on:
|
|||
- cron: 0 * * * *
|
||||
|
||||
jobs:
|
||||
build:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
with:
|
||||
stale_age_days: 60
|
||||
wait_after_stale_days: 7
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale'
|
||||
stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale'
|
||||
```
|
||||
|
||||
Configure stale timeouts:
|
||||
```
|
||||
name: "Close stale issues"
|
||||
on:
|
||||
push: {}
|
||||
schedule:
|
||||
- cron: 0 * * * *
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
|
||||
days-before-stale: 30
|
||||
days-before-close: 5
|
||||
```
|
||||
|
||||
Configure labels:
|
||||
```
|
||||
name: "Close stale issues"
|
||||
on:
|
||||
push: {}
|
||||
schedule:
|
||||
- cron: 0 * * * *
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Stale issue message'
|
||||
stale-pr-message: 'Stale issue message'
|
||||
stale-issue-label: 'no-issue-activity'
|
||||
stale-pr-label: 'no-pr-activity'
|
||||
```
|
||||
|
|
34
action.yml
34
action.yml
|
@ -2,26 +2,28 @@ name: 'Close Stale Issues'
|
|||
description: 'Action to close stale issues'
|
||||
author: 'GitHub'
|
||||
inputs:
|
||||
stale_age_days:
|
||||
repo-token:
|
||||
description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
|
||||
required: true
|
||||
stale-issue-message:
|
||||
description: 'The message to post on the issue when tagging it. If none provided, will not mark iusses stale.'
|
||||
stale-pr-message:
|
||||
description: 'The message to post on the pr when tagging it. If none provided, will not mark prs stale.'
|
||||
days-before-stale:
|
||||
description: 'The number of days old an issue can be before marking it stale'
|
||||
default: 60
|
||||
wait_after_stale_days:
|
||||
description: 'The number of days to wait to close an issue after it being marked stale'
|
||||
days-before-close:
|
||||
description: 'The number of days to wait to close an issue or pr after it being marked stale'
|
||||
default: 7
|
||||
max_operations_per_run:
|
||||
stale-issue-label:
|
||||
description: 'The label to apply when an issue is stale'
|
||||
default: 'Stale'
|
||||
stale-pr-label:
|
||||
description: 'The label to apply when a pr is stale'
|
||||
default: 'Stale'
|
||||
operations-per-run:
|
||||
description: 'The maximum number of operations per run, used to control rate limiting'
|
||||
default: 30
|
||||
stale_label:
|
||||
description: 'The label to apply when an item is stale'
|
||||
default: 'Stale'
|
||||
stale_message:
|
||||
description: 'The message to post on the issue when tagging it'
|
||||
default: >
|
||||
Message goes here.
|
||||
#This issue has not had any activity within the past ${{inputs.stale_age_days}} days. It will be
|
||||
#closed in ${{wait_after_stale_days}} days if there is no more activity.
|
||||
GITHUB_TOKEN:
|
||||
description: 'The PAT for the identity to use to access to issues and to post messages'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'lib/main.js'
|
||||
main: 'lib/main.js'
|
129
lib/main.js
129
lib/main.js
|
@ -21,31 +21,8 @@ function run() {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const args = getAndValidateArgs();
|
||||
const octokit = new github.GitHub(args.token);
|
||||
const issues = yield octokit.issues.listForRepo({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
state: 'open'
|
||||
});
|
||||
let operationsLeft = args.max_operations_per_run - 1;
|
||||
for (var issue of issues.data.values()) {
|
||||
core.debug(`found issue: ${issue.title} last updated ${issue.updated_at}`);
|
||||
if (isLabeledStale(issue, args.stale_label)) {
|
||||
if (wasLastUpdatedBefore(issue, args.wait_after_stale_days)) {
|
||||
operationsLeft -= yield closeIssue(octokit, issue, args);
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (wasLastUpdatedBefore(issue, args.stale_age_days)) {
|
||||
operationsLeft -= yield markStale(octokit, issue, args);
|
||||
}
|
||||
if (operationsLeft <= 0) {
|
||||
core.warning(`performed ${args.max_operations_per_run} operations, exiting to avoid rate limit`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const client = new github.GitHub(args.repoToken);
|
||||
yield processIssues(client, args, args.operationsPerRun);
|
||||
}
|
||||
catch (error) {
|
||||
core.error(error);
|
||||
|
@ -53,69 +30,99 @@ function run() {
|
|||
}
|
||||
});
|
||||
}
|
||||
function processIssues(client, args, operationsLeft, page = 1) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const issues = yield client.issues.listForRepo({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
state: 'open',
|
||||
per_page: 100,
|
||||
page: page
|
||||
});
|
||||
operationsLeft -= 1;
|
||||
if (issues.data.length === 0 || operationsLeft === 0) {
|
||||
return operationsLeft;
|
||||
}
|
||||
for (var issue of issues.data.values()) {
|
||||
core.debug(`found issue: ${issue.title} last updated ${issue.updated_at}`);
|
||||
let isPr = !!issue.pull_request;
|
||||
let staleMessage = isPr ? args.stalePrMessage : args.staleIssueMessage;
|
||||
let staleLabel = isPr ? args.stalePrLabel : args.staleIssueLabel;
|
||||
if (isLabeledStale(issue, staleLabel)) {
|
||||
if (wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
|
||||
operationsLeft -= yield closeIssue(client, issue);
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (wasLastUpdatedBefore(issue, args.daysBeforeStale)) {
|
||||
operationsLeft -= yield markStale(client, issue, staleMessage, staleLabel);
|
||||
}
|
||||
if (operationsLeft <= 0) {
|
||||
core.warning(`performed ${args.operationsPerRun} operations, exiting to avoid rate limit`);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return yield processIssues(client, args, operationsLeft, page + 1);
|
||||
});
|
||||
}
|
||||
function isLabeledStale(issue, label) {
|
||||
return issue.labels.filter(i => i.name === label).length > 0;
|
||||
}
|
||||
function wasLastUpdatedBefore(issue, num_days) {
|
||||
const daysInMillis = (1000 * 60 * 60 * num_days);
|
||||
const daysInMillis = 1000 * 60 * 60 * num_days;
|
||||
const millisSinceLastUpdated = new Date().getTime() - new Date(issue.updated_at).getTime();
|
||||
core.debug(`${daysInMillis}, ${millisSinceLastUpdated}`);
|
||||
return millisSinceLastUpdated >= daysInMillis;
|
||||
}
|
||||
function markStale(octokit, issue, args) {
|
||||
function markStale(client, issue, staleMessage, staleLabel) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`marking issue${issue.title} as stale`);
|
||||
yield octokit.issues.createComment({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
yield client.issues.createComment({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: args.stale_message
|
||||
body: staleMessage
|
||||
});
|
||||
yield octokit.issues.addLabels({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
yield client.issues.addLabels({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
labels: [args.stale_label]
|
||||
labels: [staleLabel]
|
||||
});
|
||||
return 2; // operations performed
|
||||
});
|
||||
}
|
||||
function closeIssue(octokit, issue, args) {
|
||||
function closeIssue(client, issue) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`closing issue ${issue.title} for being stale`);
|
||||
yield octokit.issues.update({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
yield client.issues.update({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
state: "closed"
|
||||
state: 'closed'
|
||||
});
|
||||
return 1; // operations performed
|
||||
});
|
||||
}
|
||||
function getAndValidateArgs() {
|
||||
const args = {
|
||||
token: process.env.GITHUB_TOKEN || '',
|
||||
repo_owner: (process.env.GITHUB_REPOSITORY || '').split("/")[0],
|
||||
repo_name: (process.env.GITHUB_REPOSITORY || '').split("/")[1],
|
||||
stale_age_days: parseInt(core.getInput('stale_age_days')),
|
||||
wait_after_stale_days: parseInt(core.getInput('wait_after_stale_days')),
|
||||
max_operations_per_run: parseInt(core.getInput('max_operations_per_run')),
|
||||
stale_label: core.getInput('stale_label'),
|
||||
stale_message: core.getInput('stale_message')
|
||||
repoToken: core.getInput('repo-token', { required: true }),
|
||||
staleIssueMessage: core.getInput('stale-issue-message'),
|
||||
stalePrMessage: core.getInput('stale-pr-message', { required: true }),
|
||||
daysBeforeStale: parseInt(core.getInput('days-before-stale', { required: true })),
|
||||
daysBeforeClose: parseInt(core.getInput('days-before-close', { required: true })),
|
||||
staleIssueLabel: core.getInput('stale-issue-label', { required: true }),
|
||||
stalePrLabel: core.getInput('stale-pr-label', { required: true }),
|
||||
operationsPerRun: parseInt(core.getInput('operations-per-run', { required: true }))
|
||||
};
|
||||
if (!args.token) {
|
||||
throw new Error('could not resolve token from GITHUB_TOKEN');
|
||||
}
|
||||
if (!args.repo_owner || !args.repo_name) {
|
||||
throw new Error('could not resolve repo from GITHUB_REPOSITORY');
|
||||
}
|
||||
for (var stringInput of ["stale_label", "stale_message"]) {
|
||||
if (!args[stringInput]) {
|
||||
throw Error(`input ${stringInput} was empty`);
|
||||
}
|
||||
}
|
||||
for (var numberInput of ["stale_age_days", "wait_after_stale_days", "max_operations_per_run"]) {
|
||||
if (isNaN(args[numberInput])) {
|
||||
for (var numberInput of [
|
||||
'days-before-stale',
|
||||
'days-before-close',
|
||||
'operations-per-run'
|
||||
]) {
|
||||
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
||||
throw Error(`input ${numberInput} did not parse to a valid integer`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ case `uname` in
|
|||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../semver/bin/semver" "$@"
|
||||
"$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../semver/bin/semver" "$@"
|
||||
node "$basedir/../semver/bin/semver.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver" %*
|
||||
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\semver\bin\semver" %*
|
||||
node "%~dp0\..\semver\bin\semver.js" %*
|
||||
)
|
|
@ -7,24 +7,23 @@
|
|||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "Z:\\Dreamlifter\\stale-bot",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"raw": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-core-0.0.0.tgz",
|
||||
"fetchSpec": "Z:\\Dreamlifter\\stale-bot\\toolkit\\actions-core-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-core-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "Z:\\Dreamlifter\\stale-bot\\toolkit\\actions-core-0.0.0.tgz",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-core-0.0.0.tgz",
|
||||
"_shasum": "3f3d82f209fd62dd9c01f180c963596f6c479f29",
|
||||
"_spec": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
||||
"_where": "Z:\\Dreamlifter\\stale-bot",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -7,23 +7,23 @@
|
|||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"raw": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"name": "@actions/exec",
|
||||
"escapedName": "@actions%2fexec",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-exec-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-exec-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-exec-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_shasum": "341d868fe6c4123ded20db9c2106b7b8c16e1d73",
|
||||
"_spec": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -8,11 +8,12 @@ Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the A
|
|||
|
||||
```
|
||||
const github = require('@actions/github');
|
||||
const core = require('@actions/core');
|
||||
|
||||
// This should be a token with access to your repository scoped in as a secret.
|
||||
const myToken = process.env.GITHUB_TOKEN
|
||||
const myToken = core.getInput('myToken');
|
||||
|
||||
const octokit = new github.GitHub(myToken)
|
||||
const octokit = new github.GitHub(myToken);
|
||||
|
||||
const pulls = await octokit.pulls.get({
|
||||
owner: 'octokit',
|
||||
|
@ -21,15 +22,15 @@ const pulls = await octokit.pulls.get({
|
|||
mediaType: {
|
||||
format: 'diff'
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
console.log(pulls)
|
||||
console.log(pulls);
|
||||
```
|
||||
|
||||
You can also make GraphQL requests:
|
||||
|
||||
```
|
||||
const result = await octokit.graphql(query, variables)
|
||||
const result = await octokit.graphql(query, variables);
|
||||
```
|
||||
|
||||
Finally, you can get the context of the current action:
|
||||
|
@ -37,11 +38,11 @@ Finally, you can get the context of the current action:
|
|||
```
|
||||
const github = require('@actions/github');
|
||||
|
||||
const context = github.context
|
||||
const context = github.context;
|
||||
|
||||
const newIssue = await octokit.issues.create({
|
||||
...context.repo,
|
||||
title: 'New issue!',
|
||||
body: 'Hello Universe!'
|
||||
})
|
||||
```
|
||||
});
|
||||
```
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
|
||||
import Octokit from '@octokit/rest';
|
||||
import * as Context from './context';
|
||||
export declare const context: Context.Context;
|
||||
export declare class GitHub extends Octokit {
|
||||
graphql: (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>;
|
||||
constructor(token: string);
|
||||
|
|
|
@ -16,7 +16,7 @@ const rest_1 = __importDefault(require("@octokit/rest"));
|
|||
const Context = __importStar(require("./context"));
|
||||
// We need this in order to extend Octokit
|
||||
rest_1.default.prototype = new rest_1.default();
|
||||
module.exports.context = new Context.Context();
|
||||
exports.context = new Context.Context();
|
||||
class GitHub extends rest_1.default {
|
||||
constructor(token) {
|
||||
super({ auth: `token ${token}` });
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEjC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE9C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}
|
||||
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}
|
|
@ -1,13 +1,13 @@
|
|||
export interface PayloadRepository {
|
||||
[key: string]: any;
|
||||
fullName?: string;
|
||||
full_name?: string;
|
||||
name: string;
|
||||
owner: {
|
||||
[key: string]: any;
|
||||
login: string;
|
||||
name?: string;
|
||||
};
|
||||
htmlUrl?: string;
|
||||
html_url?: string;
|
||||
}
|
||||
export interface WebhookPayload {
|
||||
[key: string]: any;
|
||||
|
@ -18,10 +18,10 @@ export interface WebhookPayload {
|
|||
html_url?: string;
|
||||
body?: string;
|
||||
};
|
||||
pullRequest?: {
|
||||
pull_request?: {
|
||||
[key: string]: any;
|
||||
number: number;
|
||||
htmlUrl?: string;
|
||||
html_url?: string;
|
||||
body?: string;
|
||||
};
|
||||
sender?: {
|
||||
|
|
|
@ -2,27 +2,27 @@
|
|||
"_from": "file:toolkit\\actions-github-0.0.0.tgz",
|
||||
"_id": "@actions/github@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-K13pi9kbZqFnvhe8m6uqfz4kCnB4Ki6fzv4XBae1zDZfn2Si+Qx6j1pAfXSo7QI2+ZWAX/g0paFgcJsS6ZTWZA==",
|
||||
"_integrity": "sha512-CByX5VIagC5BqGwsHD9Qt5MfN+H6GDC9qQl+MIUipaHTc89sUG/vAY/xQDS9vxuuRwrxbdERwKO3dR6U1BSziw==",
|
||||
"_location": "/@actions/github",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"raw": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
|
||||
"name": "@actions/github",
|
||||
"escapedName": "@actions%2fgithub",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-github-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-github-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-github-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz",
|
||||
"_shasum": "0764713c5b42ec9bbd9b4ca26b971dcdedadd820",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-github-0.0.0.tgz",
|
||||
"_shasum": "d9a87b3682d66d032fffcaff1adcdb2decd92b81",
|
||||
"_spec": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -7,23 +7,23 @@
|
|||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"raw": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"name": "@actions/io",
|
||||
"escapedName": "@actions%2fio",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-io-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-io-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-io-0.0.0.tgz",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-io-0.0.0.tgz",
|
||||
"_shasum": "64c85baec8d8ed889a5fb8e2ef794e36a692eeb8",
|
||||
"_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -7,22 +7,22 @@
|
|||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"raw": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"name": "@actions/tool-cache",
|
||||
"escapedName": "@actions%2ftool-cache",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-tool-cache-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-tool-cache-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_shasum": "fa216c10f724010a74602fd14881f25f5b008070",
|
||||
"_spec": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
||||
"_shasum": "4cc88d68097bffd7ac42e3b7c903e7481424b4b9",
|
||||
"_spec": "universal-user-agent@^3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\endpoint",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\endpoint",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.2.tgz",
|
||||
"_shasum": "2deda2d869cac9ba7f370287d55667be2a808d4b",
|
||||
"_spec": "@octokit/endpoint@^5.1.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\request",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\request",
|
||||
"bugs": {
|
||||
"url": "https://github.com/octokit/endpoint.js/issues"
|
||||
},
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-2.1.3.tgz",
|
||||
"_shasum": "60c058a0ed5fa242eca6f938908d95fd1a2f4b92",
|
||||
"_spec": "@octokit/graphql@^2.0.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-github-0.0.0.tgz",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.0.4.tgz",
|
||||
"_shasum": "15e1dc22123ba4a9a4391914d80ec1e5303a23be",
|
||||
"_spec": "@octokit/request-error@^1.0.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\request",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\request",
|
||||
"bugs": {
|
||||
"url": "https://github.com/octokit/request-error.js/issues"
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
||||
"_shasum": "4cc88d68097bffd7ac42e3b7c903e7481424b4b9",
|
||||
"_spec": "universal-user-agent@^3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\request",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\request",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.0.2.tgz",
|
||||
"_shasum": "59a920451f24811c016ddc507adcc41aafb2dca5",
|
||||
"_spec": "@octokit/request@^5.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\graphql",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\graphql",
|
||||
"bugs": {
|
||||
"url": "https://github.com/octokit/request.js/issues"
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
||||
"_shasum": "4cc88d68097bffd7ac42e3b7c903e7481424b4b9",
|
||||
"_spec": "universal-user-agent@^3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.28.7.tgz",
|
||||
"_shasum": "a2c2db5b318da84144beba82d19c1a9dbdb1a1fa",
|
||||
"_spec": "@octokit/rest@^16.15.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-github-0.0.0.tgz",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz",
|
||||
"_shasum": "0fef5ad46f1bd7a8502c65727f0367d5ee43d696",
|
||||
"_spec": "atob-lite@^2.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "Hugh Kennedy",
|
||||
"email": "hughskennedy@gmail.com",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
|
||||
"_shasum": "b6c03487f44e24200dd30ca5e6a1979c5d2fb635",
|
||||
"_spec": "before-after-hook@^2.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "Gregor Martynus"
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz",
|
||||
"_shasum": "337766da15801210fdd956c22e9c6891ab9d0337",
|
||||
"_spec": "btoa-lite@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "Hugh Kennedy",
|
||||
"email": "hughskennedy@gmail.com",
|
||||
|
|
|
@ -1,39 +1,35 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"semver@5.7.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "semver@5.7.0",
|
||||
"_from": "semver@^5.5.0",
|
||||
"_id": "semver@5.7.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"_location": "/cross-spawn/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "semver@5.7.0",
|
||||
"raw": "semver@^5.5.0",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "5.7.0",
|
||||
"rawSpec": "^5.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5.7.0"
|
||||
"fetchSpec": "^5.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cross-spawn"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||
"_spec": "5.7.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "790a7cf6fea5459bac96110b29b60412dc8ff96b",
|
||||
"_spec": "semver@^5.5.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\cross-spawn",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^13.0.0-rc.18"
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"cross-spawn@6.0.5",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "cross-spawn@6.0.5",
|
||||
"_from": "cross-spawn@^6.0.0",
|
||||
"_id": "cross-spawn@6.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
|
||||
"_location": "/cross-spawn",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cross-spawn@6.0.5",
|
||||
"raw": "cross-spawn@^6.0.0",
|
||||
"name": "cross-spawn",
|
||||
"escapedName": "cross-spawn",
|
||||
"rawSpec": "6.0.5",
|
||||
"rawSpec": "^6.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.0.5"
|
||||
"fetchSpec": "^6.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||
"_spec": "6.0.5",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "4a5ec7c64dfae22c3a14124dbacdee846d80cbc4",
|
||||
"_spec": "cross-spawn@^6.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "André Cruz",
|
||||
"email": "andre@moxy.studio"
|
||||
|
@ -35,6 +29,7 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/moxystudio/node-cross-spawn/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
|
@ -47,6 +42,7 @@
|
|||
"shebang-command": "^1.2.0",
|
||||
"which": "^1.2.9"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Cross platform child_process#spawn and child_process#spawnSync",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^6.0.0",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.0.0.tgz",
|
||||
"_shasum": "3e3110ca29205f120d7cb064960a39c3d2087c09",
|
||||
"_spec": "deepmerge@4.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\endpoint",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\endpoint",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TehShrike/deepmerge/issues"
|
||||
},
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
|
||||
"_shasum": "6368cbdb40abf3373b525ac87e4a260c3a700919",
|
||||
"_spec": "deprecation@^2.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\request",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\request",
|
||||
"bugs": {
|
||||
"url": "https://github.com/gr2m/deprecation/issues"
|
||||
},
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"end-of-stream@1.4.1",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "end-of-stream@1.4.1",
|
||||
"_from": "end-of-stream@^1.1.0",
|
||||
"_id": "end-of-stream@1.4.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
|
||||
"_location": "/end-of-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "end-of-stream@1.4.1",
|
||||
"raw": "end-of-stream@^1.1.0",
|
||||
"name": "end-of-stream",
|
||||
"escapedName": "end-of-stream",
|
||||
"rawSpec": "1.4.1",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.4.1"
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pump"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
|
||||
"_spec": "1.4.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "ed29634d19baba463b6ce6b80a37213eab71ec43",
|
||||
"_spec": "end-of-stream@^1.1.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\pump",
|
||||
"author": {
|
||||
"name": "Mathias Buus",
|
||||
"email": "mathiasbuus@gmail.com"
|
||||
|
@ -35,9 +29,11 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/mafintosh/end-of-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Call a callback when a readable/writable/duplex stream has completed or failed.",
|
||||
"files": [
|
||||
"index.js"
|
||||
|
|
|
@ -1,26 +1,19 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"execa@1.0.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "execa@1.0.0",
|
||||
"_from": "execa@^1.0.0",
|
||||
"_id": "execa@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
|
||||
"_location": "/execa",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "execa@1.0.0",
|
||||
"raw": "execa@^1.0.0",
|
||||
"name": "execa",
|
||||
"escapedName": "execa",
|
||||
"rawSpec": "1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/husky",
|
||||
|
@ -30,8 +23,9 @@
|
|||
"/windows-release"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "c6236a5bb4df6d6f15e88e7f017798216749ddd8",
|
||||
"_spec": "execa@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\windows-release",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -40,6 +34,7 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/execa/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"cross-spawn": "^6.0.0",
|
||||
"get-stream": "^4.0.0",
|
||||
|
@ -49,6 +44,7 @@
|
|||
"signal-exit": "^3.0.0",
|
||||
"strip-eof": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A better `child_process`",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"get-stream@4.1.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "get-stream@4.1.0",
|
||||
"_from": "get-stream@^4.0.0",
|
||||
"_id": "get-stream@4.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
|
||||
"_location": "/get-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "get-stream@4.1.0",
|
||||
"raw": "get-stream@^4.0.0",
|
||||
"name": "get-stream",
|
||||
"escapedName": "get-stream",
|
||||
"rawSpec": "4.1.0",
|
||||
"rawSpec": "^4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.1.0"
|
||||
"fetchSpec": "^4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
||||
"_spec": "4.1.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5",
|
||||
"_spec": "get-stream@^4.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -36,9 +30,11 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/get-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"pump": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get a stream as a string, buffer, or array",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
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.
|
|
@ -0,0 +1,119 @@
|
|||
# is-plain-object [![NPM version](https://img.shields.io/npm/v/is-plain-object.svg?style=flat)](https://www.npmjs.com/package/is-plain-object) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![NPM total downloads](https://img.shields.io/npm/dt/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-plain-object.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-plain-object)
|
||||
|
||||
> Returns true if an object was created by the `Object` constructor.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-plain-object
|
||||
```
|
||||
|
||||
Use [isobject](https://github.com/jonschlinkert/isobject) if you only want to check if the value is an object and not an array or null.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import isPlainObject from 'is-plain-object';
|
||||
```
|
||||
|
||||
**true** when created by the `Object` constructor.
|
||||
|
||||
```js
|
||||
isPlainObject(Object.create({}));
|
||||
//=> true
|
||||
isPlainObject(Object.create(Object.prototype));
|
||||
//=> true
|
||||
isPlainObject({foo: 'bar'});
|
||||
//=> true
|
||||
isPlainObject({});
|
||||
//=> true
|
||||
```
|
||||
|
||||
**false** when not created by the `Object` constructor.
|
||||
|
||||
```js
|
||||
isPlainObject(1);
|
||||
//=> false
|
||||
isPlainObject(['foo', 'bar']);
|
||||
//=> false
|
||||
isPlainObject([]);
|
||||
//=> false
|
||||
isPlainObject(new Foo);
|
||||
//=> false
|
||||
isPlainObject(null);
|
||||
//=> false
|
||||
isPlainObject(Object.create(null));
|
||||
//=> false
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [is-number](https://www.npmjs.com/package/is-number): Returns true if a number or string value is a finite number. Useful for regex… [more](https://github.com/jonschlinkert/is-number) | [homepage](https://github.com/jonschlinkert/is-number "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.")
|
||||
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
|
||||
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 19 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 6 | [TrySound](https://github.com/TrySound) |
|
||||
| 6 | [stevenvachon](https://github.com/stevenvachon) |
|
||||
| 3 | [onokumus](https://github.com/onokumus) |
|
||||
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._
|
|
@ -0,0 +1,48 @@
|
|||
'use strict';
|
||||
|
||||
/*!
|
||||
* isobject <https://github.com/jonschlinkert/isobject>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
function isObject(val) {
|
||||
return val != null && typeof val === 'object' && Array.isArray(val) === false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
function isObjectObject(o) {
|
||||
return isObject(o) === true
|
||||
&& Object.prototype.toString.call(o) === '[object Object]';
|
||||
}
|
||||
|
||||
function isPlainObject(o) {
|
||||
var ctor,prot;
|
||||
|
||||
if (isObjectObject(o) === false) return false;
|
||||
|
||||
// If has modified constructor
|
||||
ctor = o.constructor;
|
||||
if (typeof ctor !== 'function') return false;
|
||||
|
||||
// If has modified prototype
|
||||
prot = ctor.prototype;
|
||||
if (isObjectObject(prot) === false) return false;
|
||||
|
||||
// If constructor does not have an Object-specific method
|
||||
if (prot.hasOwnProperty('isPrototypeOf') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Most likely a plain Object
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isPlainObject;
|
|
@ -0,0 +1,3 @@
|
|||
declare function isPlainObject(o: any): boolean;
|
||||
|
||||
export default isPlainObject;
|
|
@ -0,0 +1,35 @@
|
|||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
import isObject from 'isobject';
|
||||
|
||||
function isObjectObject(o) {
|
||||
return isObject(o) === true
|
||||
&& Object.prototype.toString.call(o) === '[object Object]';
|
||||
}
|
||||
|
||||
export default function isPlainObject(o) {
|
||||
var ctor,prot;
|
||||
|
||||
if (isObjectObject(o) === false) return false;
|
||||
|
||||
// If has modified constructor
|
||||
ctor = o.constructor;
|
||||
if (typeof ctor !== 'function') return false;
|
||||
|
||||
// If has modified prototype
|
||||
prot = ctor.prototype;
|
||||
if (isObjectObject(prot) === false) return false;
|
||||
|
||||
// If constructor does not have an Object-specific method
|
||||
if (prot.hasOwnProperty('isPrototypeOf') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Most likely a plain Object
|
||||
return true;
|
||||
};
|
|
@ -0,0 +1,125 @@
|
|||
{
|
||||
"_from": "is-plain-object@^3.0.0",
|
||||
"_id": "is-plain-object@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==",
|
||||
"_location": "/is-plain-object",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-plain-object@^3.0.0",
|
||||
"name": "is-plain-object",
|
||||
"escapedName": "is-plain-object",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@octokit/endpoint",
|
||||
"/@octokit/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz",
|
||||
"_shasum": "47bfc5da1b5d50d64110806c199359482e75a928",
|
||||
"_spec": "is-plain-object@^3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\request",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/is-plain-object/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "http://twitter.com/jonschlinkert"
|
||||
},
|
||||
{
|
||||
"name": "Osman Nuri Okumuş",
|
||||
"url": "http://onokumus.com"
|
||||
},
|
||||
{
|
||||
"name": "Steven Vachon",
|
||||
"url": "https://svachon.com"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/wtgtybhertgeghgtwtg"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"isobject": "^4.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Returns true if an object was created by the `Object` constructor.",
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"esm": "^3.2.22",
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^6.1.4",
|
||||
"mocha-headless-chrome": "^2.0.2",
|
||||
"rollup": "^1.10.1",
|
||||
"rollup-plugin-node-resolve": "^4.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.js",
|
||||
"index.cjs.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/is-plain-object",
|
||||
"keywords": [
|
||||
"check",
|
||||
"is",
|
||||
"is-object",
|
||||
"isobject",
|
||||
"javascript",
|
||||
"kind",
|
||||
"kind-of",
|
||||
"object",
|
||||
"plain",
|
||||
"type",
|
||||
"typeof",
|
||||
"value"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.cjs.js",
|
||||
"module": "index.js",
|
||||
"name": "is-plain-object",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/is-plain-object.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"prepare": "rollup -c",
|
||||
"test": "npm run test_node && npm run build && npm run test_browser",
|
||||
"test_browser": "mocha-headless-chrome --args=disable-web-security -f test/browser.html",
|
||||
"test_node": "mocha -r esm"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"is-number",
|
||||
"isobject",
|
||||
"kind-of"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"is-stream@1.1.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "is-stream@1.1.0",
|
||||
"_from": "is-stream@^1.1.0",
|
||||
"_id": "is-stream@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
|
||||
"_location": "/is-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-stream@1.1.0",
|
||||
"raw": "is-stream@^1.1.0",
|
||||
"name": "is-stream",
|
||||
"escapedName": "is-stream",
|
||||
"rawSpec": "1.1.0",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.0"
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
||||
"_spec": "1.1.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44",
|
||||
"_spec": "is-stream@^1.1.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -36,6 +30,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/is-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Check if something is a Node.js stream",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"isexe@2.0.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "isexe@2.0.0",
|
||||
"_from": "isexe@^2.0.0",
|
||||
"_id": "isexe@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
|
||||
"_location": "/isexe",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "isexe@2.0.0",
|
||||
"raw": "isexe@^2.0.0",
|
||||
"name": "isexe",
|
||||
"escapedName": "isexe",
|
||||
"rawSpec": "2.0.0",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.0.0"
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/which"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"_spec": "2.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "e8fbf374dc556ff8947a10dcb0572d633f2cfa10",
|
||||
"_spec": "isexe@^2.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\which",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
|
@ -36,6 +30,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/isaacs/isexe/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Minimal module to check if a file is executable.",
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.1",
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
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.
|
|
@ -0,0 +1,127 @@
|
|||
# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/isobject)
|
||||
|
||||
> Returns true if the value is an object and not an array or null.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save isobject
|
||||
```
|
||||
|
||||
Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install isobject
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import isObject from 'isobject';
|
||||
```
|
||||
|
||||
**True**
|
||||
|
||||
All of the following return `true`:
|
||||
|
||||
```js
|
||||
isObject({});
|
||||
isObject(Object.create({}));
|
||||
isObject(Object.create(Object.prototype));
|
||||
isObject(Object.create(null));
|
||||
isObject({});
|
||||
isObject(new Foo);
|
||||
isObject(/foo/);
|
||||
```
|
||||
|
||||
**False**
|
||||
|
||||
All of the following return `false`:
|
||||
|
||||
```js
|
||||
isObject();
|
||||
isObject(function () {});
|
||||
isObject(1);
|
||||
isObject([]);
|
||||
isObject(undefined);
|
||||
isObject(null);
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
|
||||
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
|
||||
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
|
||||
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 30 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 8 | [doowb](https://github.com/doowb) |
|
||||
| 7 | [TrySound](https://github.com/TrySound) |
|
||||
| 3 | [onokumus](https://github.com/onokumus) |
|
||||
| 1 | [LeSuisse](https://github.com/LeSuisse) |
|
||||
| 1 | [tmcw](https://github.com/tmcw) |
|
||||
| 1 | [ZhouHansen](https://github.com/ZhouHansen) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._
|
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
/*!
|
||||
* isobject <https://github.com/jonschlinkert/isobject>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
function isObject(val) {
|
||||
return val != null && typeof val === 'object' && Array.isArray(val) === false;
|
||||
}
|
||||
|
||||
module.exports = isObject;
|
|
@ -0,0 +1,3 @@
|
|||
declare function isObject(val: any): boolean;
|
||||
|
||||
export default isObject;
|
|
@ -0,0 +1,10 @@
|
|||
/*!
|
||||
* isobject <https://github.com/jonschlinkert/isobject>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
export default function isObject(val) {
|
||||
return val != null && typeof val === 'object' && Array.isArray(val) === false;
|
||||
};
|
|
@ -0,0 +1,125 @@
|
|||
{
|
||||
"_from": "isobject@^4.0.0",
|
||||
"_id": "isobject@4.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==",
|
||||
"_location": "/isobject",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "isobject@^4.0.0",
|
||||
"name": "isobject",
|
||||
"escapedName": "isobject",
|
||||
"rawSpec": "^4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/is-plain-object"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz",
|
||||
"_shasum": "3f1c9155e73b192022a80819bacd0343711697b0",
|
||||
"_spec": "isobject@^4.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\is-plain-object",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/isobject/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"url": "https://github.com/LeSuisse"
|
||||
},
|
||||
{
|
||||
"name": "Brian Woodward",
|
||||
"url": "https://twitter.com/doowb"
|
||||
},
|
||||
{
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "http://twitter.com/jonschlinkert"
|
||||
},
|
||||
{
|
||||
"name": "Magnús Dæhlen",
|
||||
"url": "https://github.com/magnudae"
|
||||
},
|
||||
{
|
||||
"name": "Tom MacWright",
|
||||
"url": "https://macwright.org"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Returns true if the value is an object and not an array or null.",
|
||||
"devDependencies": {
|
||||
"esm": "^3.2.22",
|
||||
"gulp-format-md": "^0.1.9",
|
||||
"mocha": "^2.4.5",
|
||||
"rollup": "^1.10.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.cjs.js",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/isobject",
|
||||
"keywords": [
|
||||
"check",
|
||||
"is",
|
||||
"is-object",
|
||||
"isobject",
|
||||
"kind",
|
||||
"kind-of",
|
||||
"kindof",
|
||||
"native",
|
||||
"object",
|
||||
"type",
|
||||
"typeof",
|
||||
"value"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.cjs.js",
|
||||
"module": "index.js",
|
||||
"name": "isobject",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/isobject.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -i index.js -o index.cjs.js -f cjs",
|
||||
"prepublish": "npm run build",
|
||||
"test": "mocha -r esm"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"verb": {
|
||||
"related": {
|
||||
"list": [
|
||||
"extend-shallow",
|
||||
"is-plain-object",
|
||||
"kind-of",
|
||||
"merge-deep"
|
||||
]
|
||||
},
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"reflinks": [
|
||||
"verb"
|
||||
]
|
||||
},
|
||||
"version": "4.0.0"
|
||||
}
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"_shasum": "2d177f652fa31e939b4438d5341499dfa3825e99",
|
||||
"_spec": "lodash.get@^4.4.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz",
|
||||
"_shasum": "d8757b1da807dde24816b0d6a84bea1a76230b23",
|
||||
"_spec": "lodash.set@^4.3.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
|
||||
"_shasum": "d0225373aeb652adc1bc82e4945339a842754773",
|
||||
"_spec": "lodash.uniq@^4.5.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz",
|
||||
"_shasum": "eb1930b036c0800adebccd5f17bc4c12de8bb71f",
|
||||
"_spec": "macos-release@^2.2.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\os-name",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\os-name",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
|
|
@ -1,39 +1,35 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"nice-try@1.0.5",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "nice-try@1.0.5",
|
||||
"_from": "nice-try@^1.0.4",
|
||||
"_id": "nice-try@1.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
|
||||
"_location": "/nice-try",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "nice-try@1.0.5",
|
||||
"raw": "nice-try@^1.0.4",
|
||||
"name": "nice-try",
|
||||
"escapedName": "nice-try",
|
||||
"rawSpec": "1.0.5",
|
||||
"rawSpec": "^1.0.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.5"
|
||||
"fetchSpec": "^1.0.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cross-spawn"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||
"_spec": "1.0.5",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "a3378a7696ce7d223e88fc9b764bd7ef1089e366",
|
||||
"_spec": "nice-try@^1.0.4",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\cross-spawn",
|
||||
"authors": [
|
||||
"Tobias Reich <tobias@electerious.com>"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/electerious/nice-try/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tries to execute a function and discards any error that occurs",
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.2",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
||||
"_shasum": "e633456386d4aa55863f676a7ab0daa8fdecb0fd",
|
||||
"_spec": "node-fetch@^2.3.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\request",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\request",
|
||||
"author": {
|
||||
"name": "David Frank"
|
||||
},
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"npm-run-path@2.0.2",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "npm-run-path@2.0.2",
|
||||
"_from": "npm-run-path@^2.0.0",
|
||||
"_id": "npm-run-path@2.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
|
||||
"_location": "/npm-run-path",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "npm-run-path@2.0.2",
|
||||
"raw": "npm-run-path@^2.0.0",
|
||||
"name": "npm-run-path",
|
||||
"escapedName": "npm-run-path",
|
||||
"rawSpec": "2.0.2",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.0.2"
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
|
||||
"_spec": "2.0.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "35a9232dfa35d7067b4cb2ddf2357b1871536c5f",
|
||||
"_spec": "npm-run-path@^2.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -36,9 +30,11 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/npm-run-path/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"path-key": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get your PATH prepended with locally installed binaries",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz",
|
||||
"_shasum": "cf472edc9d551055f9ef73f6e42b4dbb4c80bea4",
|
||||
"_spec": "octokit-pagination-methods@^1.1.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\rest",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\rest",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
|
|
|
@ -1,26 +1,19 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"once@1.4.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "once@1.4.0",
|
||||
"_from": "once@^1.4.0",
|
||||
"_id": "once@1.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"_location": "/once",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "once@1.4.0",
|
||||
"raw": "once@^1.4.0",
|
||||
"name": "once",
|
||||
"escapedName": "once",
|
||||
"rawSpec": "1.4.0",
|
||||
"rawSpec": "^1.4.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.4.0"
|
||||
"fetchSpec": "^1.4.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@octokit/request",
|
||||
|
@ -32,8 +25,9 @@
|
|||
"/pump"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"_spec": "1.4.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
|
||||
"_spec": "once@^1.4.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\request",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
|
@ -42,9 +36,11 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/isaacs/once/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Run a function exactly one time",
|
||||
"devDependencies": {
|
||||
"tap": "^7.0.1"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz",
|
||||
"_shasum": "dec19d966296e1cd62d701a5a66ee1ddeae70801",
|
||||
"_spec": "os-name@^3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\endpoint\\node_modules\\universal-user-agent",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\endpoint\\node_modules\\universal-user-agent",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"p-finally@1.0.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "p-finally@1.0.0",
|
||||
"_from": "p-finally@^1.0.0",
|
||||
"_id": "p-finally@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
|
||||
"_location": "/p-finally",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "p-finally@1.0.0",
|
||||
"raw": "p-finally@^1.0.0",
|
||||
"name": "p-finally",
|
||||
"escapedName": "p-finally",
|
||||
"rawSpec": "1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "3fbcfb15b899a44123b34b6dcc18b724336a2cae",
|
||||
"_spec": "p-finally@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -36,6 +30,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/p-finally/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "`Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -1,34 +1,28 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"path-key@2.0.1",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "path-key@2.0.1",
|
||||
"_from": "path-key@^2.0.1",
|
||||
"_id": "path-key@2.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
|
||||
"_location": "/path-key",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "path-key@2.0.1",
|
||||
"raw": "path-key@^2.0.1",
|
||||
"name": "path-key",
|
||||
"escapedName": "path-key",
|
||||
"rawSpec": "2.0.1",
|
||||
"rawSpec": "^2.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.0.1"
|
||||
"fetchSpec": "^2.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cross-spawn",
|
||||
"/npm-run-path"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
|
||||
"_spec": "2.0.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "411cadb574c5a140d3a4b1910d40d80cc9f40b40",
|
||||
"_spec": "path-key@^2.0.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\cross-spawn",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -37,6 +31,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/path-key/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Get the PATH environment variable key cross-platform",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"pump@3.0.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "pump@3.0.0",
|
||||
"_from": "pump@^3.0.0",
|
||||
"_id": "pump@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"_location": "/pump",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "pump@3.0.0",
|
||||
"raw": "pump@^3.0.0",
|
||||
"name": "pump",
|
||||
"escapedName": "pump",
|
||||
"rawSpec": "3.0.0",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.0"
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/get-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"_spec": "3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "b4a2116815bde2f4e1ea602354e8c75565107a64",
|
||||
"_spec": "pump@^3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\get-stream",
|
||||
"author": {
|
||||
"name": "Mathias Buus Madsen",
|
||||
"email": "mathiasbuus@gmail.com"
|
||||
|
@ -38,10 +32,12 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/mafintosh/pump/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "pipe streams together and close all of them if one of them closes",
|
||||
"homepage": "https://github.com/mafintosh/pump#readme",
|
||||
"keywords": [
|
||||
|
|
|
@ -1,5 +1,28 @@
|
|||
# changes log
|
||||
|
||||
## 6.2.0
|
||||
|
||||
* Coerce numbers to strings when passed to semver.coerce()
|
||||
* Add `rtl` option to coerce from right to left
|
||||
|
||||
## 6.1.3
|
||||
|
||||
* Handle X-ranges properly in includePrerelease mode
|
||||
|
||||
## 6.1.2
|
||||
|
||||
* Do not throw when testing invalid version strings
|
||||
|
||||
## 6.1.1
|
||||
|
||||
* Add options support for semver.coerce()
|
||||
* Handle undefined version passed to Range.test
|
||||
|
||||
## 6.1.0
|
||||
|
||||
* Add semver.compareBuild function
|
||||
* Support `*` in semver.intersects
|
||||
|
||||
## 6.0
|
||||
|
||||
* Fix `intersects` logic.
|
||||
|
|
|
@ -60,6 +60,12 @@ Options:
|
|||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
|
@ -399,19 +405,26 @@ range, use the `satisfies(version, range)` function.
|
|||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version)`: Coerces a string to semver if possible
|
||||
* `coerce(version, options)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver
|
||||
string to semver. It looks for the first digit in a string, and
|
||||
consumes all remaining characters which satisfy at least a partial semver
|
||||
(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters).
|
||||
Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).
|
||||
All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`).
|
||||
Only text which lacks digits will fail coercion (`version one` is not valid).
|
||||
The maximum length for any semver component considered for coercion is 16 characters;
|
||||
longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`).
|
||||
The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;
|
||||
higher value components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string, and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
|
||||
coercible tuple that does not share an ending index with a longer coercible
|
||||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
|
||||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
|
||||
any other overlapping SemVer tuple.
|
||||
|
||||
### Clean
|
||||
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
|
||||
var versions = []
|
||||
|
||||
var range = []
|
||||
|
||||
var inc = null
|
||||
|
||||
var version = require('../package.json').version
|
||||
|
||||
var loose = false
|
||||
|
||||
var includePrerelease = false
|
||||
|
||||
var coerce = false
|
||||
|
||||
var rtl = false
|
||||
|
||||
var identifier
|
||||
|
||||
var semver = require('../semver')
|
||||
|
||||
var reverse = false
|
||||
|
||||
var options = {}
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(a.slice(indexOfEqualSign + 1))
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '--rtl':
|
||||
rtl = true
|
||||
break
|
||||
case '--ltr':
|
||||
rtl = false
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
||||
}).filter(function (v) {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
|
||||
|
||||
for (var i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? 'rcompare' : 'compare'
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, options)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, options)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach(function (v, i, _) { console.log(v) })
|
||||
}
|
||||
|
||||
function help () {
|
||||
console.log(['SemVer ' + version,
|
||||
'',
|
||||
'A JavaScript implementation of the https://semver.org/ specification',
|
||||
'Copyright Isaac Z. Schlueter',
|
||||
'',
|
||||
'Usage: semver [options] <version> [<version> [...]]',
|
||||
'Prints valid versions sorted by SemVer precedence',
|
||||
'',
|
||||
'Options:',
|
||||
'-r --range <range>',
|
||||
' Print versions that match the specified range.',
|
||||
'',
|
||||
'-i --increment [<level>]',
|
||||
' Increment a version by the specified level. Level can',
|
||||
' be one of: major, minor, patch, premajor, preminor,',
|
||||
" prepatch, or prerelease. Default level is 'patch'.",
|
||||
' Only one version may be specified.',
|
||||
'',
|
||||
'--preid <identifier>',
|
||||
' Identifier to be used to prefix premajor, preminor,',
|
||||
' prepatch or prerelease version increments.',
|
||||
'',
|
||||
'-l --loose',
|
||||
' Interpret versions and ranges loosely',
|
||||
'',
|
||||
'-p --include-prerelease',
|
||||
' Always include prerelease versions in range matching',
|
||||
'',
|
||||
'-c --coerce',
|
||||
' Coerce a string into SemVer if possible',
|
||||
' (does not imply --loose)',
|
||||
'',
|
||||
'--rtl',
|
||||
' Coerce version strings right to left',
|
||||
'',
|
||||
'--ltr',
|
||||
' Coerce version strings left to right (default)',
|
||||
'',
|
||||
'Program exits successfully if any valid version satisfies',
|
||||
'all supplied ranges, and prints all satisfying versions.',
|
||||
'',
|
||||
'If no satisfying versions are found, then exits failure.',
|
||||
'',
|
||||
'Versions are printed in ascending order, so supplying',
|
||||
'multiple versions to the utility will just sort them.'
|
||||
].join('\n'))
|
||||
}
|
|
@ -1,43 +1,40 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"semver@6.1.2",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_from": "semver@6.1.2",
|
||||
"_id": "semver@6.1.2",
|
||||
"_from": "semver@^6.1.1",
|
||||
"_id": "semver@6.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ==",
|
||||
"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"_location": "/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "semver@6.1.2",
|
||||
"raw": "semver@^6.1.1",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "6.1.2",
|
||||
"rawSpec": "^6.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.1.2"
|
||||
"fetchSpec": "^6.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache",
|
||||
"/istanbul-lib-instrument"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz",
|
||||
"_spec": "6.1.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"_shasum": "ee0a64c8af5e8ceea67687b133761e1becbd1d3d",
|
||||
"_spec": "semver@^6.1.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
"semver": "./bin/semver.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^14.1.6"
|
||||
"tap": "^14.3.1"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
|
@ -61,5 +58,5 @@
|
|||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"version": "6.1.2"
|
||||
"version": "6.3.0"
|
||||
}
|
||||
|
|
|
@ -29,75 +29,80 @@ var MAX_SAFE_COMPONENT_LENGTH = 16
|
|||
// The actual regexps go on exports.re
|
||||
var re = exports.re = []
|
||||
var src = exports.src = []
|
||||
var t = exports.tokens = {}
|
||||
var R = 0
|
||||
|
||||
function tok (n) {
|
||||
t[n] = R++
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
// ## Numeric Identifier
|
||||
// A single `0`, or a non-zero digit followed by zero or more digits.
|
||||
|
||||
var NUMERICIDENTIFIER = R++
|
||||
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
var NUMERICIDENTIFIERLOOSE = R++
|
||||
src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
tok('NUMERICIDENTIFIER')
|
||||
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
tok('NUMERICIDENTIFIERLOOSE')
|
||||
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
var NONNUMERICIDENTIFIER = R++
|
||||
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
tok('NONNUMERICIDENTIFIER')
|
||||
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
|
||||
var MAINVERSION = R++
|
||||
src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIER] + ')'
|
||||
tok('MAINVERSION')
|
||||
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIER] + ')'
|
||||
|
||||
var MAINVERSIONLOOSE = R++
|
||||
src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIERLOOSE] + ')'
|
||||
tok('MAINVERSIONLOOSE')
|
||||
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'
|
||||
|
||||
// ## Pre-release Version Identifier
|
||||
// A numeric identifier, or a non-numeric identifier.
|
||||
|
||||
var PRERELEASEIDENTIFIER = R++
|
||||
src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
|
||||
'|' + src[NONNUMERICIDENTIFIER] + ')'
|
||||
tok('PRERELEASEIDENTIFIER')
|
||||
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
|
||||
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
||||
|
||||
var PRERELEASEIDENTIFIERLOOSE = R++
|
||||
src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
|
||||
'|' + src[NONNUMERICIDENTIFIER] + ')'
|
||||
tok('PRERELEASEIDENTIFIERLOOSE')
|
||||
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
|
||||
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
||||
|
||||
// ## Pre-release Version
|
||||
// Hyphen, followed by one or more dot-separated pre-release version
|
||||
// identifiers.
|
||||
|
||||
var PRERELEASE = R++
|
||||
src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
|
||||
'(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'
|
||||
tok('PRERELEASE')
|
||||
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
|
||||
'(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'
|
||||
|
||||
var PRERELEASELOOSE = R++
|
||||
src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
|
||||
'(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'
|
||||
tok('PRERELEASELOOSE')
|
||||
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
||||
'(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'
|
||||
|
||||
// ## Build Metadata Identifier
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
var BUILDIDENTIFIER = R++
|
||||
src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
tok('BUILDIDENTIFIER')
|
||||
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
// identifiers.
|
||||
|
||||
var BUILD = R++
|
||||
src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
|
||||
'(?:\\.' + src[BUILDIDENTIFIER] + ')*))'
|
||||
tok('BUILD')
|
||||
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
|
||||
'(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'
|
||||
|
||||
// ## Full Version String
|
||||
// A main version, followed optionally by a pre-release version and
|
||||
|
@ -108,129 +113,133 @@ src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
|
|||
// capturing group, because it should not ever be used in version
|
||||
// comparison.
|
||||
|
||||
var FULL = R++
|
||||
var FULLPLAIN = 'v?' + src[MAINVERSION] +
|
||||
src[PRERELEASE] + '?' +
|
||||
src[BUILD] + '?'
|
||||
tok('FULL')
|
||||
tok('FULLPLAIN')
|
||||
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
|
||||
src[t.PRERELEASE] + '?' +
|
||||
src[t.BUILD] + '?'
|
||||
|
||||
src[FULL] = '^' + FULLPLAIN + '$'
|
||||
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'
|
||||
|
||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
||||
// common in the npm registry.
|
||||
var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
|
||||
src[PRERELEASELOOSE] + '?' +
|
||||
src[BUILD] + '?'
|
||||
tok('LOOSEPLAIN')
|
||||
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
|
||||
src[t.PRERELEASELOOSE] + '?' +
|
||||
src[t.BUILD] + '?'
|
||||
|
||||
var LOOSE = R++
|
||||
src[LOOSE] = '^' + LOOSEPLAIN + '$'
|
||||
tok('LOOSE')
|
||||
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'
|
||||
|
||||
var GTLT = R++
|
||||
src[GTLT] = '((?:<|>)?=?)'
|
||||
tok('GTLT')
|
||||
src[t.GTLT] = '((?:<|>)?=?)'
|
||||
|
||||
// Something like "2.*" or "1.2.x".
|
||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||
// Only the first item is strictly required.
|
||||
var XRANGEIDENTIFIERLOOSE = R++
|
||||
src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
|
||||
var XRANGEIDENTIFIER = R++
|
||||
src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'
|
||||
tok('XRANGEIDENTIFIERLOOSE')
|
||||
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
|
||||
tok('XRANGEIDENTIFIER')
|
||||
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*'
|
||||
|
||||
var XRANGEPLAIN = R++
|
||||
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:' + src[PRERELEASE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
tok('XRANGEPLAIN')
|
||||
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:' + src[t.PRERELEASE] + ')?' +
|
||||
src[t.BUILD] + '?' +
|
||||
')?)?'
|
||||
|
||||
var XRANGEPLAINLOOSE = R++
|
||||
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:' + src[PRERELEASELOOSE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
tok('XRANGEPLAINLOOSE')
|
||||
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:' + src[t.PRERELEASELOOSE] + ')?' +
|
||||
src[t.BUILD] + '?' +
|
||||
')?)?'
|
||||
|
||||
var XRANGE = R++
|
||||
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'
|
||||
var XRANGELOOSE = R++
|
||||
src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('XRANGE')
|
||||
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$'
|
||||
tok('XRANGELOOSE')
|
||||
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// Coercion.
|
||||
// Extract anything that could conceivably be a part of a valid semver
|
||||
var COERCE = R++
|
||||
src[COERCE] = '(?:^|[^\\d])' +
|
||||
tok('COERCE')
|
||||
src[t.COERCE] = '(^|[^\\d])' +
|
||||
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:$|[^\\d])'
|
||||
tok('COERCERTL')
|
||||
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
var LONETILDE = R++
|
||||
src[LONETILDE] = '(?:~>?)'
|
||||
tok('LONETILDE')
|
||||
src[t.LONETILDE] = '(?:~>?)'
|
||||
|
||||
var TILDETRIM = R++
|
||||
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'
|
||||
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')
|
||||
tok('TILDETRIM')
|
||||
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
|
||||
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
|
||||
var tildeTrimReplace = '$1~'
|
||||
|
||||
var TILDE = R++
|
||||
src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'
|
||||
var TILDELOOSE = R++
|
||||
src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('TILDE')
|
||||
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'
|
||||
tok('TILDELOOSE')
|
||||
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// Caret ranges.
|
||||
// Meaning is "at least and backwards compatible with"
|
||||
var LONECARET = R++
|
||||
src[LONECARET] = '(?:\\^)'
|
||||
tok('LONECARET')
|
||||
src[t.LONECARET] = '(?:\\^)'
|
||||
|
||||
var CARETTRIM = R++
|
||||
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'
|
||||
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')
|
||||
tok('CARETTRIM')
|
||||
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
|
||||
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
|
||||
var caretTrimReplace = '$1^'
|
||||
|
||||
var CARET = R++
|
||||
src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'
|
||||
var CARETLOOSE = R++
|
||||
src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('CARET')
|
||||
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'
|
||||
tok('CARETLOOSE')
|
||||
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
||||
var COMPARATORLOOSE = R++
|
||||
src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'
|
||||
var COMPARATOR = R++
|
||||
src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'
|
||||
tok('COMPARATORLOOSE')
|
||||
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'
|
||||
tok('COMPARATOR')
|
||||
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'
|
||||
|
||||
// An expression to strip any whitespace between the gtlt and the thing
|
||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
||||
var COMPARATORTRIM = R++
|
||||
src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
|
||||
'\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'
|
||||
tok('COMPARATORTRIM')
|
||||
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
||||
'\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'
|
||||
|
||||
// this one has to use the /g flag
|
||||
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')
|
||||
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
|
||||
var comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
// Note that these all use the loose form, because they'll be
|
||||
// checked against either the strict or loose comparator form
|
||||
// later.
|
||||
var HYPHENRANGE = R++
|
||||
src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
|
||||
tok('HYPHENRANGE')
|
||||
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
|
||||
'\\s+-\\s+' +
|
||||
'(' + src[XRANGEPLAIN] + ')' +
|
||||
'(' + src[t.XRANGEPLAIN] + ')' +
|
||||
'\\s*$'
|
||||
|
||||
var HYPHENRANGELOOSE = R++
|
||||
src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
|
||||
tok('HYPHENRANGELOOSE')
|
||||
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
||||
'\\s+-\\s+' +
|
||||
'(' + src[XRANGEPLAINLOOSE] + ')' +
|
||||
'(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
||||
'\\s*$'
|
||||
|
||||
// Star ranges basically just allow anything at all.
|
||||
var STAR = R++
|
||||
src[STAR] = '(<|>)?=?\\s*\\*'
|
||||
tok('STAR')
|
||||
src[t.STAR] = '(<|>)?=?\\s*\\*'
|
||||
|
||||
// Compile to actual regexp objects.
|
||||
// All are flag-free, unless they were created above with a flag.
|
||||
|
@ -262,7 +271,7 @@ function parse (version, options) {
|
|||
return null
|
||||
}
|
||||
|
||||
var r = options.loose ? re[LOOSE] : re[FULL]
|
||||
var r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
|
@ -317,7 +326,7 @@ function SemVer (version, options) {
|
|||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
|
||||
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL])
|
||||
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError('Invalid Version: ' + version)
|
||||
|
@ -778,7 +787,7 @@ function Comparator (comp, options) {
|
|||
|
||||
var ANY = {}
|
||||
Comparator.prototype.parse = function (comp) {
|
||||
var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
|
@ -933,18 +942,18 @@ Range.prototype.parseRange = function (range) {
|
|||
var loose = this.options.loose
|
||||
range = range.trim()
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]
|
||||
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace)
|
||||
debug('hyphen replace', range)
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[COMPARATORTRIM])
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[TILDETRIM], tildeTrimReplace)
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[CARETTRIM], caretTrimReplace)
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
|
||||
// normalize spaces
|
||||
range = range.split(/\s+/).join(' ')
|
||||
|
@ -952,7 +961,7 @@ Range.prototype.parseRange = function (range) {
|
|||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var set = range.split(' ').map(function (comp) {
|
||||
return parseComparator(comp, this.options)
|
||||
}, this).join(' ').split(/\s+/)
|
||||
|
@ -1052,7 +1061,7 @@ function replaceTildes (comp, options) {
|
|||
}
|
||||
|
||||
function replaceTilde (comp, options) {
|
||||
var r = options.loose ? re[TILDELOOSE] : re[TILDE]
|
||||
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
|
@ -1093,7 +1102,7 @@ function replaceCarets (comp, options) {
|
|||
|
||||
function replaceCaret (comp, options) {
|
||||
debug('caret', comp, options)
|
||||
var r = options.loose ? re[CARETLOOSE] : re[CARET]
|
||||
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
|
@ -1152,7 +1161,7 @@ function replaceXRanges (comp, options) {
|
|||
|
||||
function replaceXRange (comp, options) {
|
||||
comp = comp.trim()
|
||||
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]
|
||||
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
var xM = isX(M)
|
||||
|
@ -1164,10 +1173,14 @@ function replaceXRange (comp, options) {
|
|||
gtlt = ''
|
||||
}
|
||||
|
||||
// if we're including prereleases in the match, then we need
|
||||
// to fix this to -0, the lowest possible prerelease value
|
||||
pr = options.includePrerelease ? '-0' : ''
|
||||
|
||||
if (xM) {
|
||||
if (gtlt === '>' || gtlt === '<') {
|
||||
// nothing is allowed
|
||||
ret = '<0.0.0'
|
||||
ret = '<0.0.0-0'
|
||||
} else {
|
||||
// nothing is forbidden
|
||||
ret = '*'
|
||||
|
@ -1204,11 +1217,12 @@ function replaceXRange (comp, options) {
|
|||
}
|
||||
}
|
||||
|
||||
ret = gtlt + M + '.' + m + '.' + p
|
||||
ret = gtlt + M + '.' + m + '.' + p + pr
|
||||
} else if (xm) {
|
||||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
|
||||
ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr
|
||||
} else if (xp) {
|
||||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
|
||||
ret = '>=' + M + '.' + m + '.0' + pr +
|
||||
' <' + M + '.' + (+m + 1) + '.0' + pr
|
||||
}
|
||||
|
||||
debug('xRange return', ret)
|
||||
|
@ -1222,10 +1236,10 @@ function replaceXRange (comp, options) {
|
|||
function replaceStars (comp, options) {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[STAR], '')
|
||||
return comp.trim().replace(re[t.STAR], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[HYPHENRANGE])
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
// M, m, patch, prerelease, build
|
||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
||||
|
@ -1536,17 +1550,47 @@ function coerce (version, options) {
|
|||
return version
|
||||
}
|
||||
|
||||
if (typeof version === 'number') {
|
||||
version = String(version)
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
var match = version.match(re[COERCE])
|
||||
options = options || {}
|
||||
|
||||
if (match == null) {
|
||||
var match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(re[t.COERCE])
|
||||
} else {
|
||||
// Find the right-most coercible string that does not share
|
||||
// a terminus with a more left-ward coercible string.
|
||||
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
||||
//
|
||||
// Walk through the string checking with a /g regexp
|
||||
// Manually set the index so as to pick up overlapping matches.
|
||||
// Stop when we get a match that ends at the string end, since no
|
||||
// coercible string can be more right-ward without the same terminus.
|
||||
var next
|
||||
while ((next = re[t.COERCERTL].exec(version)) &&
|
||||
(!match || match.index + match[0].length !== version.length)
|
||||
) {
|
||||
if (!match ||
|
||||
next.index + next[0].length !== match.index + match[0].length) {
|
||||
match = next
|
||||
}
|
||||
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
re[t.COERCERTL].lastIndex = -1
|
||||
}
|
||||
|
||||
if (match === null) {
|
||||
return null
|
||||
}
|
||||
|
||||
return parse(match[1] +
|
||||
'.' + (match[2] || '0') +
|
||||
'.' + (match[3] || '0'), options)
|
||||
return parse(match[2] +
|
||||
'.' + (match[3] || '0') +
|
||||
'.' + (match[4] || '0'), options)
|
||||
}
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"shebang-command@1.2.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "shebang-command@1.2.0",
|
||||
"_from": "shebang-command@^1.2.0",
|
||||
"_id": "shebang-command@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
|
||||
"_location": "/shebang-command",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "shebang-command@1.2.0",
|
||||
"raw": "shebang-command@^1.2.0",
|
||||
"name": "shebang-command",
|
||||
"escapedName": "shebang-command",
|
||||
"rawSpec": "1.2.0",
|
||||
"rawSpec": "^1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.2.0"
|
||||
"fetchSpec": "^1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cross-spawn"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
|
||||
"_spec": "1.2.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "44aac65b695b03398968c39f363fee5deafdf1ea",
|
||||
"_spec": "shebang-command@^1.2.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\cross-spawn",
|
||||
"author": {
|
||||
"name": "Kevin Martensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
|
@ -36,9 +30,11 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/kevva/shebang-command/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"shebang-regex": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get the command from a shebang",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"shebang-regex@1.0.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "shebang-regex@1.0.0",
|
||||
"_from": "shebang-regex@^1.0.0",
|
||||
"_id": "shebang-regex@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
|
||||
"_location": "/shebang-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "shebang-regex@1.0.0",
|
||||
"raw": "shebang-regex@^1.0.0",
|
||||
"name": "shebang-regex",
|
||||
"escapedName": "shebang-regex",
|
||||
"rawSpec": "1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/shebang-command"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "da42f49740c0b42db2ca9728571cb190c98efea3",
|
||||
"_spec": "shebang-regex@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\shebang-command",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -36,6 +30,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/shebang-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Regular expression for matching a shebang",
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4"
|
||||
|
|
|
@ -1,34 +1,28 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"signal-exit@3.0.2",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "signal-exit@3.0.2",
|
||||
"_from": "signal-exit@^3.0.0",
|
||||
"_id": "signal-exit@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||
"_location": "/signal-exit",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "signal-exit@3.0.2",
|
||||
"raw": "signal-exit@^3.0.0",
|
||||
"name": "signal-exit",
|
||||
"escapedName": "signal-exit",
|
||||
"rawSpec": "3.0.2",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/execa",
|
||||
"/write-file-atomic"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "b5fdc08f1287ea1178628e415e25132b73646c6d",
|
||||
"_spec": "signal-exit@^3.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Ben Coe",
|
||||
"email": "ben@npmjs.com"
|
||||
|
@ -36,6 +30,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/tapjs/signal-exit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "when you want to fire an event no matter how a process exits.",
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"strip-eof@1.0.0",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "strip-eof@1.0.0",
|
||||
"_from": "strip-eof@^1.0.0",
|
||||
"_id": "strip-eof@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
|
||||
"_location": "/strip-eof",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "strip-eof@1.0.0",
|
||||
"raw": "strip-eof@^1.0.0",
|
||||
"name": "strip-eof",
|
||||
"escapedName": "strip-eof",
|
||||
"rawSpec": "1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/execa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "bb43ff5598a6eb05d89b59fcd129c983313606bf",
|
||||
"_spec": "strip-eof@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
@ -36,6 +30,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/strip-eof/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Strip the End-Of-File (EOF) character from a string/buffer",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz",
|
||||
"_shasum": "2d3785a158c174c9a16dc2c046ec5fc5f1742213",
|
||||
"_spec": "tunnel@0.0.4",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\typed-rest-client",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\typed-rest-client",
|
||||
"author": {
|
||||
"name": "Koichi Kobayashi",
|
||||
"email": "koichik@improvement.jp"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.5.0.tgz",
|
||||
"_shasum": "c0dda6e775b942fd46a2d99f2160a94953206fc2",
|
||||
"_spec": "typed-rest-client@^1.4.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
||||
"_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",
|
||||
"_spec": "underscore@1.8.3",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\typed-rest-client",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\typed-rest-client",
|
||||
"author": {
|
||||
"name": "Jeremy Ashkenas",
|
||||
"email": "jeremy@documentcloud.org"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.1.0.tgz",
|
||||
"_shasum": "5abfbcc036a1ba490cb941f8fd68c46d3669e8e4",
|
||||
"_spec": "universal-user-agent@^2.0.3",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\graphql",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\graphql",
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz",
|
||||
"_shasum": "fc565a3cccbff7730c775f5641f9555791439f21",
|
||||
"_spec": "url-template@^2.0.8",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\@octokit\\endpoint",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\@octokit\\endpoint",
|
||||
"author": {
|
||||
"name": "Bram Stein",
|
||||
"email": "b.l.stein@gmail.com",
|
||||
|
|
|
@ -1,33 +1,28 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"uuid@3.3.2",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_from": "uuid@3.3.2",
|
||||
"_from": "uuid@^3.3.2",
|
||||
"_id": "uuid@3.3.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
|
||||
"_location": "/uuid",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "uuid@3.3.2",
|
||||
"raw": "uuid@^3.3.2",
|
||||
"name": "uuid",
|
||||
"escapedName": "uuid",
|
||||
"rawSpec": "3.3.2",
|
||||
"rawSpec": "^3.3.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.3.2"
|
||||
"fetchSpec": "^3.3.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache",
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"_spec": "3.3.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "1b4af4955eb3077c501c23872fc6513811587131",
|
||||
"_spec": "uuid@^3.3.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"bin": {
|
||||
"uuid": "./bin/uuid"
|
||||
},
|
||||
|
@ -39,6 +34,7 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/kelektiv/node-uuid/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
|
@ -66,6 +62,7 @@
|
|||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "7.0.0",
|
||||
|
|
|
@ -1,34 +1,28 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"which@1.3.1",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "which@1.3.1",
|
||||
"_from": "which@^1.2.9",
|
||||
"_id": "which@1.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
|
||||
"_location": "/which",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "which@1.3.1",
|
||||
"raw": "which@^1.2.9",
|
||||
"name": "which",
|
||||
"escapedName": "which",
|
||||
"rawSpec": "1.3.1",
|
||||
"rawSpec": "^1.2.9",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.3.1"
|
||||
"fetchSpec": "^1.2.9"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cross-spawn",
|
||||
"/node-notifier"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
"_spec": "1.3.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "a45043d54f5805316da8d62f9f50918d3da70b0a",
|
||||
"_spec": "which@^1.2.9",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\cross-spawn",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
|
@ -40,9 +34,11 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-which/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.0",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz",
|
||||
"_shasum": "8122dad5afc303d833422380680a79cdfa91785f",
|
||||
"_spec": "windows-release@^3.1.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template\\node_modules\\os-name",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\os-name",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
|
|
|
@ -1,34 +1,28 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"wrappy@1.0.2",
|
||||
"C:\\Users\\damccorm\\Documents\\node12-template"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "wrappy@1.0.2",
|
||||
"_from": "wrappy@1",
|
||||
"_id": "wrappy@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"_location": "/wrappy",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "wrappy@1.0.2",
|
||||
"raw": "wrappy@1",
|
||||
"name": "wrappy",
|
||||
"escapedName": "wrappy",
|
||||
"rawSpec": "1.0.2",
|
||||
"rawSpec": "1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.2"
|
||||
"fetchSpec": "1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/inflight",
|
||||
"/once"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"_spec": "1.0.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
|
||||
"_shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
|
||||
"_spec": "wrappy@1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot\\node_modules\\once",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
|
@ -37,7 +31,9 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/npm/wrappy/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Callback wrapping utility",
|
||||
"devDependencies": {
|
||||
"tap": "^2.3.1"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
184
src/main.ts
184
src/main.ts
|
@ -3,68 +3,90 @@ import * as github from '@actions/github';
|
|||
import * as Octokit from '@octokit/rest';
|
||||
|
||||
type Args = {
|
||||
token: string;
|
||||
repo_owner: string;
|
||||
repo_name: string;
|
||||
stale_age_days: number;
|
||||
wait_after_stale_days: number;
|
||||
max_operations_per_run: number;
|
||||
stale_label: string;
|
||||
stale_message: string;
|
||||
repoToken: string;
|
||||
staleIssueMessage: string;
|
||||
stalePrMessage: string;
|
||||
daysBeforeStale: number;
|
||||
daysBeforeClose: number;
|
||||
staleIssueLabel: string;
|
||||
stalePrLabel: string;
|
||||
operationsPerRun: number;
|
||||
};
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const args = getAndValidateArgs();
|
||||
|
||||
const octokit = new github.GitHub(args.token);
|
||||
const issues = await octokit.issues.listForRepo({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
state: 'open'
|
||||
});
|
||||
|
||||
let operationsLeft = args.max_operations_per_run - 1;
|
||||
|
||||
for (var issue of issues.data.values()) {
|
||||
core.debug(
|
||||
`found issue: ${issue.title} last updated ${issue.updated_at}`
|
||||
);
|
||||
|
||||
if (isLabeledStale(issue, args.stale_label)) {
|
||||
if (wasLastUpdatedBefore(issue, args.wait_after_stale_days)) {
|
||||
operationsLeft -= await closeIssue(octokit, issue, args);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if (wasLastUpdatedBefore(issue, args.stale_age_days)) {
|
||||
operationsLeft -= await markStale(octokit, issue, args);
|
||||
}
|
||||
|
||||
if (operationsLeft <= 0) {
|
||||
core.warning(
|
||||
`performed ${args.max_operations_per_run} operations, exiting to avoid rate limit`
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const client = new github.GitHub(args.repoToken);
|
||||
await processIssues(client, args, args.operationsPerRun);
|
||||
} catch (error) {
|
||||
core.error(error);
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function processIssues(
|
||||
client: github.GitHub,
|
||||
args: Args,
|
||||
operationsLeft: number,
|
||||
page: number = 1
|
||||
): Promise<number> {
|
||||
const issues = await client.issues.listForRepo({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
state: 'open',
|
||||
per_page: 100,
|
||||
page: page
|
||||
});
|
||||
|
||||
operationsLeft -= 1;
|
||||
|
||||
if (issues.data.length === 0 || operationsLeft === 0) {
|
||||
return operationsLeft;
|
||||
}
|
||||
|
||||
for (var issue of issues.data.values()) {
|
||||
core.debug(`found issue: ${issue.title} last updated ${issue.updated_at}`);
|
||||
let isPr = !!issue.pull_request;
|
||||
let staleMessage = isPr ? args.stalePrMessage : args.staleIssueMessage;
|
||||
let staleLabel = isPr ? args.stalePrLabel : args.staleIssueLabel;
|
||||
|
||||
if (isLabeledStale(issue, staleLabel)) {
|
||||
if (wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
|
||||
operationsLeft -= await closeIssue(client, issue);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if (wasLastUpdatedBefore(issue, args.daysBeforeStale)) {
|
||||
operationsLeft -= await markStale(
|
||||
client,
|
||||
issue,
|
||||
staleMessage,
|
||||
staleLabel
|
||||
);
|
||||
}
|
||||
|
||||
if (operationsLeft <= 0) {
|
||||
core.warning(
|
||||
`performed ${args.operationsPerRun} operations, exiting to avoid rate limit`
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return await processIssues(client, args, operationsLeft, page + 1);
|
||||
}
|
||||
|
||||
function isLabeledStale(
|
||||
issue: Octokit.IssuesListForRepoResponseItem,
|
||||
label: string
|
||||
) {
|
||||
): boolean {
|
||||
return issue.labels.filter(i => i.name === label).length > 0;
|
||||
}
|
||||
|
||||
function wasLastUpdatedBefore(
|
||||
issue: Octokit.IssuesListForRepoResponseItem,
|
||||
num_days: number
|
||||
) {
|
||||
): boolean {
|
||||
const daysInMillis = 1000 * 60 * 60 * num_days;
|
||||
const millisSinceLastUpdated =
|
||||
new Date().getTime() - new Date(issue.updated_at).getTime();
|
||||
|
@ -73,39 +95,39 @@ function wasLastUpdatedBefore(
|
|||
}
|
||||
|
||||
async function markStale(
|
||||
octokit: github.GitHub,
|
||||
client: github.GitHub,
|
||||
issue: Octokit.IssuesListForRepoResponseItem,
|
||||
args: Args
|
||||
) {
|
||||
staleMessage: string,
|
||||
staleLabel: string
|
||||
): Promise<number> {
|
||||
core.debug(`marking issue${issue.title} as stale`);
|
||||
|
||||
await octokit.issues.createComment({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
await client.issues.createComment({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: args.stale_message
|
||||
body: staleMessage
|
||||
});
|
||||
|
||||
await octokit.issues.addLabels({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
await client.issues.addLabels({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
labels: [args.stale_label]
|
||||
labels: [staleLabel]
|
||||
});
|
||||
|
||||
return 2; // operations performed
|
||||
}
|
||||
|
||||
async function closeIssue(
|
||||
octokit: github.GitHub,
|
||||
issue: Octokit.IssuesListForRepoResponseItem,
|
||||
args: Args
|
||||
) {
|
||||
client: github.GitHub,
|
||||
issue: Octokit.IssuesListForRepoResponseItem
|
||||
): Promise<number> {
|
||||
core.debug(`closing issue ${issue.title} for being stale`);
|
||||
|
||||
await octokit.issues.update({
|
||||
owner: args.repo_owner,
|
||||
repo: args.repo_name,
|
||||
await client.issues.update({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed'
|
||||
});
|
||||
|
@ -115,32 +137,28 @@ async function closeIssue(
|
|||
|
||||
function getAndValidateArgs(): Args {
|
||||
const args = {
|
||||
token: process.env.GITHUB_TOKEN || '',
|
||||
repo_owner: (process.env.GITHUB_REPOSITORY || '').split('/')[0],
|
||||
repo_name: (process.env.GITHUB_REPOSITORY || '').split('/')[1],
|
||||
stale_age_days: parseInt(core.getInput('stale_age_days')),
|
||||
wait_after_stale_days: parseInt(core.getInput('wait_after_stale_days')),
|
||||
max_operations_per_run: parseInt(core.getInput('max_operations_per_run')),
|
||||
stale_label: core.getInput('stale_label'),
|
||||
stale_message: core.getInput('stale_message')
|
||||
repoToken: core.getInput('repo-token', {required: true}),
|
||||
staleIssueMessage: core.getInput('stale-issue-message'),
|
||||
stalePrMessage: core.getInput('stale-pr-message', {required: true}),
|
||||
daysBeforeStale: parseInt(
|
||||
core.getInput('days-before-stale', {required: true})
|
||||
),
|
||||
daysBeforeClose: parseInt(
|
||||
core.getInput('days-before-close', {required: true})
|
||||
),
|
||||
staleIssueLabel: core.getInput('stale-issue-label', {required: true}),
|
||||
stalePrLabel: core.getInput('stale-pr-label', {required: true}),
|
||||
operationsPerRun: parseInt(
|
||||
core.getInput('operations-per-run', {required: true})
|
||||
)
|
||||
};
|
||||
|
||||
if (!args.token) {
|
||||
throw new Error('could not resolve token from GITHUB_TOKEN');
|
||||
}
|
||||
|
||||
if (!args.repo_owner || !args.repo_name) {
|
||||
throw new Error('could not resolve repo from GITHUB_REPOSITORY');
|
||||
}
|
||||
|
||||
for (var stringInput of ['stale_label', 'stale_message']) {
|
||||
if (!args[stringInput]) {
|
||||
throw Error(`input ${stringInput} was empty`);
|
||||
}
|
||||
}
|
||||
|
||||
for (var numberInput of [ 'stale_age_days', 'wait_after_stale_days', 'max_operations_per_run' ]) {
|
||||
if (isNaN(args[numberInput])) {
|
||||
for (var numberInput of [
|
||||
'days-before-stale',
|
||||
'days-before-close',
|
||||
'operations-per-run'
|
||||
]) {
|
||||
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
||||
throw Error(`input ${numberInput} did not parse to a valid integer`);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue