|
1 |
| -# node-typescript-boilerplate |
| 1 | +# Collecting GHAS Unique Active Committers |
2 | 2 |
|
3 |
| -[![Sponsor][sponsor-badge]][sponsor] |
4 |
| -[![TypeScript version][ts-badge]][typescript-4-9] |
5 |
| -[![Node.js version][nodejs-badge]][nodejs] |
6 |
| -[![APLv2][license-badge]][license] |
7 |
| -[![Build Status - GitHub Actions][gha-badge]][gha-ci] |
| 3 | +## Purpose |
8 | 4 |
|
9 |
| -👩🏻💻 Developer Ready: A comprehensive template. Works out of the box for most [Node.js][nodejs] projects. |
| 5 | +The purpose of this repository is to help enterprise administrators who maintain multiple GHE instances work out unique developers across multiple GHE instances. This script works for both maximum committers and currently consumed GHAS committers. |
10 | 6 |
|
11 |
| -🏃🏽 Instant Value: All basic tools included and configured: |
| 7 | +## Prerequisites |
12 | 8 |
|
13 |
| -- [TypeScript][typescript] [4.9][typescript-4-9] |
14 |
| -- [ESM][esm] |
15 |
| -- [ESLint][eslint] with some initial rules recommendation |
16 |
| -- [Jest][jest] for fast unit testing and code coverage |
17 |
| -- Type definitions for Node.js and Jest |
18 |
| -- [Prettier][prettier] to enforce consistent code style |
19 |
| -- NPM [scripts](#available-scripts) for common operations |
20 |
| -- [EditorConfig][editorconfig] for consistent coding style |
21 |
| -- Reproducible environments thanks to [Volta][volta] |
22 |
| -- Example configuration for [GitHub Actions][gh-actions] |
23 |
| -- Simple example of TypeScript code and unit test |
| 9 | +- [Node v18](https://nodejs.org/en/download/) or higher installed. |
| 10 | +- [Git](https://git-scm.com/downloads) installed on the (user's) machine running this tool. |
24 | 11 |
|
25 |
| -🤲 Free as in speech: available under the APLv2 license. |
| 12 | +## Set up Instructions |
26 | 13 |
|
27 |
| -## Getting Started |
| 14 | +1. Clone this repository onto your local machine. |
28 | 15 |
|
29 |
| -This project is intended to be used with the latest Active LTS release of [Node.js][nodejs]. |
| 16 | + ```bash |
| 17 | + git clone https://github.com/advanced-security/ghes-cross-instance-committers.git |
| 18 | + ``` |
30 | 19 |
|
31 |
| -### Use as a repository template |
| 20 | +2. Change the directory to the repository you have just installed. |
32 | 21 |
|
33 |
| -To start, just click the **[Use template][repo-template-action]** link (or the green button). Start adding your code in the `src` and unit tests in the `__tests__` directories. |
| 22 | + ```bash |
| 23 | + cd ghes-cross-instance-committers |
| 24 | + ``` |
34 | 25 |
|
35 |
| -### Clone repository |
| 26 | +4. Copy the `.env.sample` to `.env`. On a Mac, this can be done via the following terminal command: |
36 | 27 |
|
37 |
| -To clone the repository, use the following commands: |
| 28 | + ```bash |
| 29 | + cp .env.sample .env |
| 30 | + ``` |
38 | 31 |
|
39 |
| -```sh |
40 |
| -git clone https://github.com/jsynowiec/node-typescript-boilerplate |
41 |
| -cd node-typescript-boilerplate |
42 |
| -npm install |
43 |
| -``` |
44 |
| - |
45 |
| -### Download latest release |
| 32 | +## Collecting the content |
46 | 33 |
|
47 |
| -Download and unzip the current **main** branch or one of the tags: |
| 34 | +Head to the following URL in each of your GHES instances: |
48 | 35 |
|
49 |
| -```sh |
50 |
| -wget https://github.com/jsynowiec/node-typescript-boilerplate/archive/main.zip -O node-typescript-boilerplate.zip |
51 |
| -unzip node-typescript-boilerplate.zip && rm node-typescript-boilerplate.zip |
| 36 | +``` |
| 37 | +https://${ghes-url}.com/stafftools/ghas_committers |
52 | 38 | ```
|
53 | 39 |
|
54 |
| -## Available Scripts |
55 |
| - |
56 |
| -- `clean` - remove coverage data, Jest cache and transpiled files, |
57 |
| -- `prebuild` - lint source files and tests before building, |
58 |
| -- `build` - transpile TypeScript to ES6, |
59 |
| -- `build:watch` - interactive watch mode to automatically transpile source files, |
60 |
| -- `lint` - lint source files and tests, |
61 |
| -- `prettier` - reformat files, |
62 |
| -- `test` - run tests, |
63 |
| -- `test:watch` - interactive watch mode to automatically re-run tests |
64 |
| - |
65 |
| -## Additional Information |
| 40 | +If you are interested in knowing your maximum committer number (e.g. the total number of unique developers across your whole GHE instance), click the download button next to the `Total billable committers if GHAS is enabled for all repositories` option. |
66 | 41 |
|
67 |
| -### Why include Volta |
| 42 | +If you are interested in knowing your current committer number (e.g. the total number of unique developers across your whole GHE instance who are curently consuming a GHAS licence), click the download button next to the `Current active committer count` option. |
68 | 43 |
|
69 |
| -[Volta][volta]’s toolchain always keeps track of where you are, it makes sure the tools you use always respect the settings of the project you’re working on. This means you don’t have to worry about changing the state of your installed software when switching between projects. For example, it's [used by engineers at LinkedIn][volta-tomdale] to standardize tools and have reproducible development environments. |
| 44 | +Once that's downloaded, create a new folder and drop the CSV into that folder. |
70 | 45 |
|
71 |
| -I recommend to [install][volta-getting-started] Volta and use it to manage your project's toolchain. |
| 46 | +Repeat the steps above across all your GHES instances. Make sure you drop the content **into the same folder**, you do not need to create a new folder every time. |
72 | 47 |
|
73 |
| -### ES Modules |
| 48 | +## Running the script |
74 | 49 |
|
75 |
| -This template uses native [ESM][esm]. Make sure to read [this][nodejs-esm], and [this][ts47-esm] first. |
| 50 | +1. Install dependencies |
76 | 51 |
|
77 |
| -If your project requires CommonJS, you will have to [convert to ESM][sindresorhus-esm]. |
| 52 | + ```bash |
| 53 | + npm install |
| 54 | + ``` |
78 | 55 |
|
79 |
| -Please do not open issues for questions regarding CommonJS or ESM on this repo. |
| 56 | +3. Update the `.env. (Replace the XXX with the relative directory of the csv content you created above) |
80 | 57 |
|
81 |
| -## Backers & Sponsors |
| 58 | + ```bash |
| 59 | + DIRECTORY_OF_CSV_CONTENT=XXX |
| 60 | + ``` |
82 | 61 |
|
83 |
| -Support this project by becoming a [sponsor][sponsor]. |
| 62 | +2. Run the script |
84 | 63 |
|
85 |
| -## License |
| 64 | + ```bash |
| 65 | + npm run start |
| 66 | + ``` |
86 | 67 |
|
87 |
| -Licensed under the APLv2. See the [LICENSE](https://github.com/jsynowiec/node-typescript-boilerplate/blob/main/LICENSE) file for details. |
| 68 | +The above script should output something like: |
88 | 69 |
|
89 |
| -[ts-badge]: https://img.shields.io/badge/TypeScript-4.9-blue.svg |
90 |
| -[nodejs-badge]: https://img.shields.io/badge/Node.js->=%2018.12-blue.svg |
91 |
| -[nodejs]: https://nodejs.org/dist/latest-v18.x/docs/api/ |
92 |
| -[gha-badge]: https://github.com/jsynowiec/node-typescript-boilerplate/actions/workflows/nodejs.yml/badge.svg |
93 |
| -[gha-ci]: https://github.com/jsynowiec/node-typescript-boilerplate/actions/workflows/nodejs.yml |
94 |
| -[typescript]: https://www.typescriptlang.org/ |
95 |
| -[typescript-4-9]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/ |
96 |
| -[license-badge]: https://img.shields.io/badge/license-APLv2-blue.svg |
97 |
| -[license]: https://github.com/jsynowiec/node-typescript-boilerplate/blob/main/LICENSE |
98 |
| -[sponsor-badge]: https://img.shields.io/badge/♥-Sponsor-fc0fb5.svg |
99 |
| -[sponsor]: https://github.com/sponsors/jsynowiec |
100 |
| -[jest]: https://facebook.github.io/jest/ |
101 |
| -[eslint]: https://github.com/eslint/eslint |
102 |
| -[wiki-js-tests]: https://github.com/jsynowiec/node-typescript-boilerplate/wiki/Unit-tests-in-plain-JavaScript |
103 |
| -[prettier]: https://prettier.io |
104 |
| -[volta]: https://volta.sh |
105 |
| -[volta-getting-started]: https://docs.volta.sh/guide/getting-started |
106 |
| -[volta-tomdale]: https://twitter.com/tomdale/status/1162017336699838467?s=20 |
107 |
| -[gh-actions]: https://github.com/features/actions |
108 |
| -[repo-template-action]: https://github.com/jsynowiec/node-typescript-boilerplate/generate |
109 |
| -[esm]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules |
110 |
| -[sindresorhus-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c |
111 |
| -[nodejs-esm]: https://nodejs.org/docs/latest-v16.x/api/esm.html |
112 |
| -[ts47-esm]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#esm-nodejs |
113 |
| -[editorconfig]: https://editorconfig.org |
| 70 | +``` |
| 71 | +You have a total of XX unique developers across your GitHub instances. |
| 72 | +``` |
0 commit comments