Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Rename runFasterCode to runExample
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindigo committed Sep 2, 2021
1 parent b25a2d1 commit 96869b5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ even if the version number does not indicate that.
The first couple alpha versions of Mariner only supported calls via GitHub's REST API. More
recently, we added the ability to invoke GitHub's GraphQL API. The GraphQL API is hundreds of
times faster, so the REST-related calls are now deprecated, and will be removed "soon". The
GraphQL approach is shown in the `runFasterCode.ts` example.
GraphQL approach is shown in the `runExample.ts` example.

### Plans to rename the default branch from master

Expand All @@ -36,15 +36,15 @@ You'll also need a GitHub token and a config file. (Keep reading for more info o
### Step-by-step instructions for creating a project that uses Mariner

1. Create a new project folder and use `npm init` to make it a node project.
1. Copy the contents of `runFasterCode.ts` into `index.js`.
- <https://github.com/indeedeng/Mariner/blob/master/examples/runFasterCode.ts>
1. Copy the contents of `runExample.ts` into `index.js`.
- <https://github.com/indeedeng/Mariner/blob/master/examples/runExample.ts>
1. In `index.js` comment out the existing line that imports mariner.
1. Also in `index.js`, uncomment the line saying how mariner would normally be imported.
1. Next, create a folder named `examples` and create two new files inside of it: `exampleData.json` and `config.json`. You can copy the contents of our examples into those new files or you can use the examples as a template for your own data and config choices. The `exampleData.json` should contain the repos that you're interested in getting issues from. For more info on the format of this file, look at[the Input File Format section](https://github.com/indeedeng/Mariner#input-file-format). More info on config.json can also be found [below](https://github.com/indeedeng/Mariner/blob/master/README.md#config.json-format) and the example files can be found here:
- <https://github.com/indeedeng/Mariner/blob/master/examples/exampleData.json>
- <https://github.com/indeedeng/Mariner/blob/master/examples/config.json>
1. Mariner supports TypeScript, but we don't have step-by-step instructions for the TypeScript example.
For now, you can convert the runFasterCode.ts example code to JavaScript:
For now, you can convert the runExample.ts example code to JavaScript:
- Remove the `public` keywords from class members.
- Remove the `implements Xxxx` from the FancyLogger class declaration.
- Remove all the type declarations (like `: string`).
Expand All @@ -59,7 +59,7 @@ You'll also need a GitHub token and a config file. (Keep reading for more info o
- The generateConfluenceMarkdown() 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.
- Square brackets and curly braces in issue titles will be replaced by parentheses.
- You can see an example of how to use in the `runFasterCode.ts` file.
- You can see an example of how to use in the `runExample.ts` file.
Example of confluenceMarkdown.md output:
```md
## Updated: February 22, 2021, 5:38 PM PST
Expand All @@ -74,8 +74,8 @@ h3. facebook/jest
||*Title*||*Age*||
|[Lost of context between tests when using dynamic ESM import|https://github.com/facebook/jest/issues/10944]|72&nbsp;days|
```
- The `runFasterCode.ts` example now demonstrates how to call this new function
- <https://github.com/indeedeng/Mariner/blob/master/examples/runFasterCode.ts>
- The `runExample.ts` example now demonstrates how to call this new function
- <https://github.com/indeedeng/Mariner/blob/master/examples/runExample.ts>

### Config.json Format

Expand Down Expand Up @@ -163,7 +163,7 @@ Mariner is in transition from the old way of accessing GitHub data (REST) to the

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/runFasterCode.ts>
<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
Expand All @@ -190,13 +190,13 @@ Clone the repository from GitHub.

Run `npm ci` to install the libraries used in the project. Read more about [npm ci here.](https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable)

Follow the instructions in examples/runFasterCode.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.

Run `nvm use` to use the appropiate version of Node specified in the .nvmrc file.

Run `npm run build` to compile the code to Javascript.

Run `node dist/examples/runFasterCode.js` (to use GraphQL) or `node dist/examples/runOldCode.ts` (to use REST calls), to run the example program. It requires internet access, since it calls the GitHub API. It will take a couple minutes to complete. Some of the output includes the word "ERROR", so don't panic.
Run `node dist/examples/runExample.js` (to use GraphQL) or `node dist/examples/runOldCode.ts` (to use REST calls), to run the example program. It requires internet access, since it calls the GitHub API. It will take a couple minutes to complete. Some of the output includes the word "ERROR", so don't panic.

Ensure to lint your code by running `npm run lint` before submitting any code for review. Either manually fix the errors or run `npm run lint:fix` to automatically fix any errors.

Expand Down
2 changes: 1 addition & 1 deletion examples/runFasterCode.ts → examples/runExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Optionally, you can have environment variables for INPUT_FILE_PATH and OUTPUT_FILE_PATH,
but they have defaults that will work with the standard development environment.
Then, run `npm run build`
Finally, run `node dist/examples/runFasterCode.js`
Finally, run `node dist/examples/runExample.js`
You'll know it's run correctly if you have a new file
examples/output.json with some GitHub issues in it.
Expand Down
23 changes: 14 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
/* Basic Options */
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": ["es2019", "ES6"] /* Specify library files to be included in the compilation. */,
"lib": [
"es2019",
"ES6"
] /* Specify library files to be included in the compilation. */,
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
Expand All @@ -17,7 +20,6 @@
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
Expand All @@ -26,13 +28,11 @@
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */

/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
Expand All @@ -43,17 +43,22 @@
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"include": ["src", "examples/runFasterCode.ts", "examples/runOldCode.ts"],
"exclude": ["node_modules", "**/__tests__/*"]
}
"include": [
"src",
"examples/runExample.ts",
"examples/runOldCode.ts"
],
"exclude": [
"node_modules",
"**/__tests__/*"
]
}

0 comments on commit 96869b5

Please sign in to comment.