oss-mariner
Advanced tools
Comparing version 0.7.0-beta to 0.8.0-beta
@@ -215,3 +215,3 @@ "use strict"; | ||
nextRequest = requestQueue.popRequest(); | ||
yield utils_1.sleep(REQUEST_DELAY_MS); | ||
yield (0, utils_1.sleep)(REQUEST_DELAY_MS); | ||
} | ||
@@ -218,0 +218,0 @@ ownerDataCollection.save(); |
@@ -83,3 +83,3 @@ "use strict"; | ||
} | ||
tab_level_logger_1.getLogger().info(`-----Fetched ${label}: ${edgeArray.length} matching issues`); | ||
(0, tab_level_logger_1.getLogger)().info(`-----Fetched ${label}: ${edgeArray.length} matching issues`); | ||
const issues = edgeArray.map((edge) => { | ||
@@ -120,9 +120,9 @@ return edge.node; | ||
while (result.pageInfo.hasNextPage) { | ||
tab_level_logger_1.getLogger().info(`Calling: ${queryId}`); | ||
(0, tab_level_logger_1.getLogger)().info(`Calling: ${queryId}`); | ||
const response = (yield graphqlWithAuth(query, variables)); | ||
const issueCountsAndIssues = response.search; | ||
tab_level_logger_1.getLogger().info(`Fetched: ${queryId} => ` + | ||
(0, tab_level_logger_1.getLogger)().info(`Fetched: ${queryId} => ` + | ||
`${issueCountsAndIssues.edges.length}/${issueCountsAndIssues.issueCount} (${issueCountsAndIssues.pageInfo.hasNextPage})`); | ||
const rateLimit = response.rateLimit; | ||
tab_level_logger_1.getLogger().info(`Rate limits: ${JSON.stringify(rateLimit)}`); | ||
(0, tab_level_logger_1.getLogger)().info(`Rate limits: ${JSON.stringify(rateLimit)}`); | ||
variables.after = issueCountsAndIssues.pageInfo.endCursor; | ||
@@ -134,3 +134,3 @@ result.pageInfo.hasNextPage = issueCountsAndIssues.pageInfo.hasNextPage; | ||
if (!edge.node.repository) { | ||
tab_level_logger_1.getLogger().info(`\nNo repository for an edge in ${JSON.stringify(variables)}`); | ||
(0, tab_level_logger_1.getLogger)().info(`\nNo repository for an edge in ${JSON.stringify(variables)}`); | ||
} | ||
@@ -140,3 +140,3 @@ return edge.node.repository; | ||
result.issueCount = result.edges.length; | ||
tab_level_logger_1.getLogger().info(`Returning: ${queryId} => ${result.issueCount}`); | ||
(0, tab_level_logger_1.getLogger)().info(`Returning: ${queryId} => ${result.issueCount}`); | ||
return result.edges; | ||
@@ -143,0 +143,0 @@ }); |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.FetchHttpClient = void 0; | ||
const node_fetch_1 = __importDefault(require("node-fetch")); | ||
const axios_1 = __importDefault(require("axios")); | ||
const tab_level_logger_1 = require("./tab-level-logger"); | ||
@@ -18,5 +18,5 @@ class FetchHttpClient { | ||
get(url) { | ||
return node_fetch_1.default(url, { headers: this.headers }).then((resp) => { | ||
return (0, axios_1.default)(url, { headers: this.headers }).then((resp) => { | ||
this.checkForRateLimiting(resp); | ||
return resp.text(); | ||
return resp.data(); | ||
}); | ||
@@ -23,0 +23,0 @@ } |
@@ -10,2 +10,4 @@ import { Config } from './config'; | ||
} | ||
export declare type RepoName = string; | ||
export declare type IssuesByRepoName = Map<RepoName, Issue[]>; | ||
export declare class IssueFinder { | ||
@@ -15,3 +17,3 @@ private readonly config; | ||
constructor(config: Config); | ||
findIssues(token: string, repositoryIdentifiers: string[]): Promise<Map<string, Issue[]>>; | ||
findIssues(token: string, repositoryIdentifiers: string[]): Promise<IssuesByRepoName>; | ||
private convertFromGitHubIssue; | ||
@@ -18,0 +20,0 @@ private convertFromGitHubLabels; |
@@ -5,3 +5,4 @@ export { DependencyDetailsRetriever } from '../dependency-details-retriever'; | ||
export { Logger, getLogger, setLogger } from '../tab-level-logger'; | ||
export { generateConfluenceMarkup as generateConfluenceMarkdown } from '../Utilities/generateConfluenceMarkup'; | ||
export { generateConfluenceMarkup } from '../Utilities/generateConfluenceMarkup'; | ||
export { generateHtml } from '../Utilities/generateHtml'; | ||
export { generateGitHubMarkdown } from '../Utilities/generateGitHubMarkdown'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateHtml = exports.generateConfluenceMarkdown = exports.setLogger = exports.getLogger = exports.IssueFinder = exports.readConfigFile = exports.DependencyDetailsRetriever = void 0; | ||
exports.generateGitHubMarkdown = exports.generateHtml = exports.generateConfluenceMarkup = exports.setLogger = exports.getLogger = exports.IssueFinder = exports.readConfigFile = exports.DependencyDetailsRetriever = void 0; | ||
var dependency_details_retriever_1 = require("../dependency-details-retriever"); | ||
@@ -14,4 +14,6 @@ Object.defineProperty(exports, "DependencyDetailsRetriever", { enumerable: true, get: function () { return dependency_details_retriever_1.DependencyDetailsRetriever; } }); | ||
var generateConfluenceMarkup_1 = require("../Utilities/generateConfluenceMarkup"); | ||
Object.defineProperty(exports, "generateConfluenceMarkdown", { enumerable: true, get: function () { return generateConfluenceMarkup_1.generateConfluenceMarkup; } }); | ||
Object.defineProperty(exports, "generateConfluenceMarkup", { enumerable: true, get: function () { return generateConfluenceMarkup_1.generateConfluenceMarkup; } }); | ||
var generateHtml_1 = require("../Utilities/generateHtml"); | ||
Object.defineProperty(exports, "generateHtml", { enumerable: true, get: function () { return generateHtml_1.generateHtml; } }); | ||
var generateGitHubMarkdown_1 = require("../Utilities/generateGitHubMarkdown"); | ||
Object.defineProperty(exports, "generateGitHubMarkdown", { enumerable: true, get: function () { return generateGitHubMarkdown_1.generateGitHubMarkdown; } }); |
@@ -1,5 +0,2 @@ | ||
import { DateTime } from 'luxon'; | ||
import { Issue } from '../mariner'; | ||
export declare function generateConfluenceMarkup(issuesByDependency: Map<string, Issue[]>, maxIssuesAge?: number): string; | ||
export declare function calculateAgeInWholeDays(isoDateString: string, now: DateTime): number; | ||
export declare function cleanMarkup(issueTitle: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.cleanMarkup = exports.calculateAgeInWholeDays = exports.generateConfluenceMarkup = void 0; | ||
exports.generateConfluenceMarkup = void 0; | ||
const luxon_1 = require("luxon"); | ||
const outputHelpers_1 = require("../Utilities/outputHelpers"); | ||
function generateConfluenceMarkup(issuesByDependency, maxIssuesAge = 30) { | ||
const now = luxon_1.DateTime.utc(); | ||
const markupArray = []; | ||
markupArray.push(`## Updated: ${now.toISO()}`); | ||
markupArray.push(`h2. Updated: ${now.toISO()}`); | ||
for (const [dependency, issues] of issuesByDependency) { | ||
@@ -14,3 +15,3 @@ if (!issues || !issues.length) { | ||
const relevantIssues = issues.filter((issue) => { | ||
const ageInWholeDays = calculateAgeInWholeDays(issue.createdAt, now); | ||
const ageInWholeDays = (0, outputHelpers_1.calculateAgeInWholeDays)(issue.createdAt, now); | ||
return ageInWholeDays < maxIssuesAge; | ||
@@ -25,4 +26,4 @@ }); | ||
relevantIssues.forEach((issue) => { | ||
const ageInWholeDays = calculateAgeInWholeDays(issue.createdAt, now); | ||
const cleanedTitleMarkup = cleanMarkup(issue.title); | ||
const ageInWholeDays = (0, outputHelpers_1.calculateAgeInWholeDays)(issue.createdAt, now); | ||
const cleanedTitleMarkup = (0, outputHelpers_1.removeBracesAndBrackets)(issue.title); | ||
markupArray.push(`|[${cleanedTitleMarkup}|${issue.url}]|${ageInWholeDays} days|`); | ||
@@ -34,17 +35,1 @@ }); | ||
exports.generateConfluenceMarkup = generateConfluenceMarkup; | ||
function calculateAgeInWholeDays(isoDateString, now) { | ||
const createdAt = luxon_1.DateTime.fromISO(isoDateString); | ||
const ageInDays = now.diff(createdAt, 'days').days; | ||
const ageInWholeDays = Math.round(ageInDays); | ||
return ageInWholeDays; | ||
} | ||
exports.calculateAgeInWholeDays = calculateAgeInWholeDays; | ||
function cleanMarkup(issueTitle) { | ||
const withoutBracesOrBrackets = issueTitle | ||
.replace(/{/g, '(') | ||
.replace(/}/g, ')') | ||
.replace(/\[/g, '(') | ||
.replace(/\]/g, ')'); | ||
return withoutBracesOrBrackets; | ||
} | ||
exports.cleanMarkup = cleanMarkup; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const luxon_1 = require("luxon"); | ||
const generateConfluenceMarkup_1 = require("./generateConfluenceMarkup"); | ||
const outputHelpers_1 = require("../Utilities/outputHelpers"); | ||
function generateHtml(issuesByDependency, maxIssuesAge = 30) { | ||
@@ -16,3 +16,3 @@ const now = luxon_1.DateTime.utc(); | ||
const relevantIssues = issues.filter((issue) => { | ||
const ageInWholeDays = generateConfluenceMarkup_1.calculateAgeInWholeDays(issue.createdAt, now); | ||
const ageInWholeDays = (0, outputHelpers_1.calculateAgeInWholeDays)(issue.createdAt, now); | ||
return ageInWholeDays < maxIssuesAge; | ||
@@ -31,3 +31,3 @@ }); | ||
const arrayOfHtmlFragments = []; | ||
const encodedDependencyName = html_entities_1.encode(dependencyName); | ||
const encodedDependencyName = (0, html_entities_1.encode)(dependencyName); | ||
arrayOfHtmlFragments.push(`<h3 class="dependency-name">${encodedDependencyName}</h3>`); | ||
@@ -37,5 +37,5 @@ arrayOfHtmlFragments.push('<table class="issue-list">'); | ||
relevantIssues.forEach((issue) => { | ||
const ageInWholeDays = generateConfluenceMarkup_1.calculateAgeInWholeDays(issue.createdAt, now); | ||
const title = html_entities_1.encode(issue.title); | ||
const url = html_entities_1.encode(issue.url); | ||
const ageInWholeDays = (0, outputHelpers_1.calculateAgeInWholeDays)(issue.createdAt, now); | ||
const title = (0, html_entities_1.encode)(issue.title); | ||
const url = (0, html_entities_1.encode)(issue.url); | ||
arrayOfHtmlFragments.push('<tr class="issue-row">'); | ||
@@ -42,0 +42,0 @@ arrayOfHtmlFragments.push(`<td class="issue-title"><a href="${url}">${title}</a></td>`); |
{ | ||
"name": "oss-mariner", | ||
"version": "0.7.0-beta", | ||
"version": "0.8.0-beta", | ||
"description": "A node.js library for analyzing open source library dependencies", | ||
@@ -11,5 +11,5 @@ "main": "dist/src/mariner/index.js", | ||
"test": "jest", | ||
"check": "npx eslint --print-config src/* | npx eslint-config-prettier-check", | ||
"lint": "npx eslint src/ --ext .js,.ts && echo 'Lint complete'", | ||
"lint:fix": "npx eslint src/ --fix --ext .js,.ts && echo 'Fixed errors'", | ||
"check": "tsc -noEmit true --project tsconfig.json", | ||
"lint": "eslint src/ --ext .js,.ts", | ||
"lint:fix": "eslint src/ --fix --ext .js,.ts", | ||
"build": "tsc", | ||
@@ -27,8 +27,7 @@ "prepublish": "tsc", | ||
"dependencies": { | ||
"@octokit/graphql": "^4.6.1", | ||
"@types/luxon": "^1.26.2", | ||
"@types/node-fetch": "^2.5.8", | ||
"@octokit/graphql": "^4.8.0", | ||
"@types/luxon": "^1.27.1", | ||
"axios": "^0.25.0", | ||
"html-entities": "^2.3.2", | ||
"luxon": "^1.26.0", | ||
"node-fetch": "^2.6.1" | ||
"luxon": "^1.28.0" | ||
}, | ||
@@ -39,15 +38,15 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^14.14.35", | ||
"@typescript-eslint/eslint-plugin": "^4.18.0", | ||
"@typescript-eslint/parser": "^4.18.0", | ||
"eslint": "^7.22.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"husky": "^5.1.3", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^14.18.10", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^5.18.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"husky": "^7.0.0", | ||
"jest": "^26.6.3", | ||
"pinst": "^2.1.6", | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.5.3", | ||
"typescript": "^4.2.3" | ||
"prettier": "^2.5.1", | ||
"ts-jest": "^26.5.6", | ||
"typescript": "^4.5.5" | ||
}, | ||
@@ -54,0 +53,0 @@ "keywords": [ |
@@ -57,6 +57,32 @@ # Mariner | ||
### Optional: Generating HTML | ||
- You can generate HTML | ||
- The `generateHtml()` creates the html based on two parameters: `maxIssuesAge` and `issuesByDependency` | ||
- `maxIssueAge` defaults to 30 days, anything over 30 days won't get written, You can edit this number. | ||
- Example of HTML output: | ||
```html | ||
<h3 class="dependency-name">facebook/jest</h3> | ||
<table class="issue-list"> | ||
<tr class="issue-header-row"><th>Title</th><th>Age</th></tr> | ||
<tr class="issue-row"> | ||
<td class="issue-title"><a href="https://github.com/facebook/jest/issues/12522">Rework asynchronous tests documentation</a></td> | ||
<td class="issue-age">15 days</td> | ||
</tr> | ||
<tr class="issue-row"> | ||
<td class="issue-title"><a href="https://github.com/facebook/jest/issues/12495">Use Admonitions on website</a></td> | ||
<td class="issue-age">22 days</td> | ||
</tr> | ||
<tr class="issue-row"> | ||
<td class="issue-title"><a href="https://github.com/facebook/jest/issues/12592">[Bug]: test `notify › does not report --notify flag` is flaky</a></td> | ||
<td class="issue-age">17 days</td> | ||
</tr> | ||
</table> | ||
``` | ||
### Optional: Generating Markup | ||
- You can generate markup for use in Confluence/jira | ||
- The generateConfluenceMarkup() creates the markup based on two parameters: `maxIssuesAge` and `issuesByDependency` | ||
- The `generateConfluenceMarkup()` creates the markup based on two parameters: `maxIssuesAge` and `issuesByDependency` | ||
- `maxIssueAge` defaults to 30 days, anything over 30 days won't get written, You can edit this number. | ||
@@ -67,5 +93,4 @@ - Square brackets and curly braces in issue titles will be replaced by parentheses. | ||
```md | ||
## Updated: February 22, 2021, 5:38 PM PST | ||
h2. Updated: February 22, 2021, 5:38 PM PST | ||
h3. babel/babel | ||
@@ -81,2 +106,19 @@ ||*Title*||*Age*|| | ||
### Optional: Generating Markdown | ||
- You can generate markdown for use in GitHub | ||
- The `generateGitHubMarkdown()` creates the markdown based on two parameters: `maxIssuesAge` and `issuesByDependency` | ||
- `maxIssueAge` defaults to 30 days, anything over 30 days won't get written, You can edit this number. | ||
- Example of GitHub markdown output: | ||
```md | ||
## Updated: 2022-01-18T22:53:35.522Z | ||
### babel/babel | ||
|**Title**|**Age**| | ||
|:----|:----| | ||
|[[Bug]: Typescript plugin fails on named tuple positions where the name is a reserved word in JS|https://github.com/babel/babel/issues/13702]|147 days| | ||
|[[preset-env] all the core-js imports are removed|https://github.com/babel/babel/issues/12545]|392 days| | ||
|[[Bug]: TypeError: Error while loading config - yield* (intermediate value) is not iterable|https://github.com/babel/babel/issues/13462]|218 days| | ||
``` | ||
### Config.json Format | ||
@@ -99,6 +141,6 @@ | ||
- Each dependency can be identified by a complete URL or just the owner/repo string. | ||
- Example complete url: "https://api.github.com/repos/spring-projects/spring-framework": 19805, | ||
- Example owner/repo strings: "square/retrofit": 5023, | ||
- Example complete url: `"https://api.github.com/repos/spring-projects/spring-framework"`: 19805, | ||
- Example owner/repo strings: `"square/retrofit": 5023`, | ||
- The project count value is mostly ignored, but is used by the "abbreviated" feature. | ||
- See examples/exampleData.json for a complete example. | ||
- See `examples/exampleData.json` for a complete example. | ||
@@ -169,8 +211,8 @@ ### Output File Format | ||
To invoke mariner using the new GraphQL code, Invoke the finder(), passing the | ||
appropiate parameters in finder.findIssues() you can see an example here: | ||
To invoke mariner using the new GraphQL code, Invoke the `finder()`, passing the | ||
appropiate parameters in `finder.findIssues()` you can see an example here: | ||
<https://github.com/indeedeng/Mariner/blob/master/examples/runExample.ts> | ||
If you are using the `examples/runOldCode.ts file`, (using the old REST code that is very slow) | ||
invoke the DependencyDetailsRetriever.run() method, passing appropriate parameters. Please | ||
invoke the `DependencyDetailsRetriever.run()` method, passing appropriate parameters. Please | ||
see the [examples/runOldCode.ts](https://github.com/indeedeng/Mariner/blob/master/examples/runOldCode.ts) file | ||
@@ -199,3 +241,3 @@ for more information. | ||
Follow the instructions in examples/runExample.ts or examples/runOldCode.ts to configure the input and output files. NOTE: An example input file is included, in the examples directory. | ||
Follow the instructions in `examples/runExample.ts` or `examples/runOldCode.ts` to configure the input and output files. NOTE: An example input file is included, in the examples directory. | ||
@@ -238,4 +280,4 @@ Run `nvm use` to use the appropiate version of Node specified in the .nvmrc file. | ||
1. Switch to main branch and pull the new changes | ||
1. Do a dry run to make sure the package looks good: `npm publish --dry-run` | ||
1. Login to npm if you haven’t already: `npm login` | ||
1. Do a dry run to make sure the package looks good: `npm publish --dry-run` | ||
1. Publish: `npm publish` | ||
@@ -246,2 +288,3 @@ 1. Verify that the new version appears at: <https://www.npmjs.com/package/oss-mariner> | ||
1. Click the `Draft a new release` button | ||
1. Enter the version number in the "tag version" field | ||
1. Enter a release title like `v2.1.3` | ||
@@ -248,0 +291,0 @@ 1. In the description list the major changes |
76669
5
37
1154
293
+ Addedaxios@^0.25.0
+ Addedaxios@0.25.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
- Removed@types/node-fetch@^2.5.8
- Removednode-fetch@^2.6.1
- Removed@types/node@22.13.4(transitive)
- Removed@types/node-fetch@2.6.12(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedcall-bind-apply-helpers@1.0.2(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedes-set-tostringtag@2.1.0(transitive)
- Removedform-data@4.0.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.7(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedundici-types@6.20.0(transitive)
Updated@octokit/graphql@^4.8.0
Updated@types/luxon@^1.27.1
Updatedluxon@^1.28.0