reviewable-enterprise-tools 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ name: Publish to npm
2
+ on:
3
+ push:
4
+ branches:
5
+ - release
6
+
7
+ permissions:
8
+ id-token: write
9
+ contents: read
10
+
11
+ jobs:
12
+ publish:
13
+ uses: reviewable/actions/.github/workflows/publish.yaml@master
package/cleanup_refs.js CHANGED
@@ -81,7 +81,7 @@ async function main() {
81
81
  process.exit(1);
82
82
  }
83
83
  if (args.validateOnly) return;
84
- const pace = Pace(refs.length);
84
+ const pace = Pace(refs.length); // eslint-disable-line new-cap
85
85
  const maxDelay = ms(args.maxDelay);
86
86
  let saved = 0;
87
87
  await eachLimit(_.chunk(refs, UPDATE_SIZE), MAX_PARALLEL_UPDATES, async refsBatch => {
@@ -0,0 +1,18 @@
1
+ import reviewableConfigBaseline from 'reviewable-configs/eslint-config/baseline.js';
2
+ import reviewableConfigLodash from 'reviewable-configs/eslint-config/lodash.js';
3
+ import globals from 'globals';
4
+
5
+ export default [
6
+ ...reviewableConfigBaseline,
7
+ ...reviewableConfigLodash,
8
+ {
9
+ languageOptions: {
10
+ ecmaVersion: 'latest',
11
+ sourceType: 'module',
12
+ globals: {
13
+ ...globals.node,
14
+ db: false
15
+ }
16
+ }
17
+ }
18
+ ];
package/extract_data.js CHANGED
@@ -82,7 +82,8 @@ const out = new PromiseWritable(fs.createWriteStream(args.output));
82
82
  out.stream.setMaxListeners(Infinity);
83
83
 
84
84
  const pace = args.logging ?
85
- {op() {}, total: 0} :
85
+ {op: _.noop, total: 0} :
86
+ // eslint-disable-next-line new-cap
86
87
  Pace(1 + 2 + orgNames.length + 2 * repoNames.length + _.size(userMap));
87
88
 
88
89
  let reviewKeys = [];
@@ -420,7 +421,7 @@ async function extractUsers() {
420
421
  }
421
422
 
422
423
  async function writeItem(key, value, flags) {
423
- if (value === undefined || value === null) return;
424
+ if (_.isNil(value)) return;
424
425
  value = mapAllUserKeys(value, key);
425
426
  if (flags) {
426
427
  await out.write(
package/load_data.js CHANGED
@@ -74,7 +74,7 @@ async function load() {
74
74
  let sizeRead = 0;
75
75
  let fatalError;
76
76
 
77
- const pace = Pace(fs.statSync(args.input).size);
77
+ const pace = Pace(fs.statSync(args.input).size); // eslint-disable-line new-cap
78
78
  const reader = fs.createReadStream(args.input)
79
79
  .pipe(new Throttle({rate: 200000, chunksize: 50000}))
80
80
  .pipe(es.mapSync(chunk => {
@@ -84,7 +84,7 @@ async function load() {
84
84
  }))
85
85
  .pipe(es.split())
86
86
  .pipe(es.parse({error: true}))
87
- .pipe(es.map(async (item, callback) => {
87
+ .pipe(es.map(async (item, callback) => { // eslint-disable-line lodash/prefer-lodash-method
88
88
  await processLine(item);
89
89
  callback();
90
90
  }))
@@ -129,7 +129,7 @@ async function processLine([key, value, flags]) {
129
129
  await db.child(key).update(value);
130
130
  }
131
131
  } catch (e) {
132
- e.message + ` (at ${key})`;
132
+ e.message += ` (at ${key})`;
133
133
  throw e;
134
134
  }
135
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reviewable-enterprise-tools",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "description": "Admin tools for Reviewable Enterprise",
6
6
  "bin": {
@@ -11,26 +11,23 @@
11
11
  "scripts": {
12
12
  "extract_data": "node ./extract_data.js",
13
13
  "load_data": "node ./load_data.js",
14
- "test": "echo \"Error: no test specified\" && exit 1"
14
+ "lint": "eslint *.js lib/*.js"
15
15
  },
16
16
  "engines": {
17
17
  "node": ">=20"
18
18
  },
19
- "repository": {
20
- "type": "git",
21
- "url": "git://github.com/reviewable/enterprise-tools.git"
22
- },
19
+ "repository": "https://github.com/Reviewable/enterprise-tools",
23
20
  "keywords": [
24
21
  "firebase",
25
22
  "encryption",
26
23
  "reviewable"
27
24
  ],
28
- "author": "Piotr Kaminski <piotr@ideanest.com>",
25
+ "author": "Piotr Kaminski <piotr@reviewable.io>",
29
26
  "license": "MIT",
30
27
  "bugs": {
31
- "url": "https://github.com/reviewable/enterprise-tools/issues"
28
+ "url": "https://github.com/Reviewable/enterprise-tools/issues"
32
29
  },
33
- "homepage": "https://github.com/reviewable/enterprise-tools#readme",
30
+ "homepage": "https://github.com/Reviewable/enterprise-tools#readme",
34
31
  "dependencies": {
35
32
  "@types/async": "^3.2.18",
36
33
  "agentkeepalive": "^4.1.3",
@@ -42,8 +39,8 @@
42
39
  "download": "^8.0.0",
43
40
  "event-stream": "^4.0.1",
44
41
  "firebase-admin": "^12.0.0",
45
- "firecrypt": "^4.0.0",
46
- "hubkit": "^5.2.0",
42
+ "firecrypt": "^5.0.0",
43
+ "hubkit": "^6.0.0",
47
44
  "lodash": "^4.17.20",
48
45
  "ms": "^2.1.2",
49
46
  "nodefire": "^3.0.0",
@@ -51,12 +48,13 @@
51
48
  "promise-readable": "^6.0.0",
52
49
  "promise-writable": "^6.0.0",
53
50
  "request": "^2.88.2",
54
- "serialized-lru-cache": "^3.1.0",
55
51
  "stream-throttle": "^0.1.3",
56
52
  "yargs": "^17.7.2"
57
53
  },
58
54
  "devDependencies": {
59
- "eslint": "^8.10.0",
60
- "eslint-plugin-lodash": "^7.1.0"
55
+ "eslint": "^9.39.1",
56
+ "eslint-plugin-lodash": "^7.1.0",
57
+ "globals": "^16.5.0",
58
+ "reviewable-configs": "Reviewable/reviewable-configs"
61
59
  }
62
60
  }
package/read.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import commandLineArgs from 'command-line-args';
4
4
  import getUsage from 'command-line-usage';
5
5
  import {writeFileSync} from 'fs';
6
- import {inspect} from 'util';
6
+ // import {inspect} from 'util';
7
7
 
8
8
  const commandLineOptions = [
9
9
  {name: 'path', alias: 'p', type: String, defaultOption: true,
@@ -33,6 +33,11 @@
33
33
  "queues": {
34
34
  "github": {
35
35
  "$eventKey": {
36
+ "payload": {
37
+ ".encrypt": {
38
+ "value": "#"
39
+ }
40
+ },
36
41
  "statusSyncKey": {
37
42
  ".encrypt": {
38
43
  "value": "#"
package/.eslintrc.js DELETED
@@ -1,144 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- env: {
5
- node: true,
6
- es6: true
7
- },
8
- parserOptions: {
9
- ecmaVersion: 2020
10
- },
11
- plugins: ['lodash'],
12
- extends: ['eslint:recommended', 'plugin:lodash/canonical'],
13
- globals: {
14
- db: false,
15
- },
16
- rules: {
17
- 'accessor-pairs': 'error',
18
- 'array-bracket-spacing': 'warn',
19
- 'arrow-spacing': 'warn',
20
- 'block-spacing': ['warn', 'never'],
21
- 'brace-style': ['warn', '1tbs', {allowSingleLine: true}],
22
- 'camelcase': 'error',
23
- 'comma-spacing': 'warn',
24
- 'comma-style': 'warn',
25
- 'computed-property-spacing': 'warn',
26
- 'curly': ['error', 'multi-line'],
27
- 'dot-location': ['warn', 'property'],
28
- 'dot-notation': 'warn',
29
- 'eol-last': 'warn',
30
- 'eqeqeq': 'error',
31
- 'func-call-spacing': 'warn',
32
- 'generator-star-spacing': ['warn', {before: true, after: false, anonymous: 'neither'}],
33
- 'indent': ['warn', 2, {
34
- SwitchCase: 1,
35
- MemberExpression: 'off',
36
- FunctionDeclaration: {parameters: 'off'},
37
- FunctionExpression: {parameters: 'off'}
38
- }],
39
- 'key-spacing': ['warn', {mode: 'minimum'}],
40
- 'keyword-spacing': 'warn',
41
- 'linebreak-style': 'warn',
42
- 'lines-between-class-members': 'warn',
43
- 'lodash/chaining': ['error', 'implicit'],
44
- 'lodash/prefer-filter': 'off',
45
- 'lodash/prefer-invoke-map': 'off',
46
- 'lodash/prop-shorthand': 'off',
47
- 'lodash/matches-prop-shorthand': 'off',
48
- 'lodash/prefer-immutable-method': 'off',
49
- 'lodash/prefer-lodash-method': ['error', {ignoreMethods: ['split', 'replace']}],
50
- 'lodash/prefer-map': 'off',
51
- 'max-len': ['warn', {code: 100, ignoreUrls: true, ignoreRegExpLiterals: true}],
52
- 'new-cap': 'error',
53
- 'new-parens': 'error',
54
- 'no-alert': 'error',
55
- 'no-array-constructor': 'error',
56
- 'no-bitwise': ['error', {allow: ['~']}],
57
- 'no-buffer-constructor': 'error',
58
- 'no-caller': 'error',
59
- 'no-console': 'off',
60
- 'no-constant-condition': ['error', {checkLoops: false}],
61
- 'no-duplicate-imports': 'error',
62
- 'no-else-return': 'error',
63
- 'no-empty-function': 'error',
64
- 'no-eval': 'error',
65
- 'no-extend-native': 'error',
66
- 'no-extra-bind': 'error',
67
- 'no-extra-label': 'error',
68
- 'no-floating-decimal': 'error',
69
- 'no-implicit-globals': 'error',
70
- 'no-implied-eval': 'error',
71
- 'no-invalid-this': 'error',
72
- 'no-iterator': 'error',
73
- 'no-lone-blocks': 'error',
74
- 'no-lonely-if': 'error',
75
- 'no-loop-func': 'error',
76
- 'no-multi-spaces': ['warn', {ignoreEOLComments: true}],
77
- 'no-multi-str': 'warn',
78
- 'no-multiple-empty-lines': 'warn',
79
- 'no-negated-condition': 'error',
80
- 'no-new': 'error',
81
- 'no-new-func': 'error',
82
- 'no-new-object': 'error',
83
- 'no-new-require': 'error',
84
- 'no-new-wrappers': 'error',
85
- 'no-octal-escape': 'error',
86
- 'no-path-concat': 'error',
87
- 'no-proto': 'error',
88
- 'no-script-url': 'error',
89
- 'no-self-compare': 'error',
90
- 'no-sequences': 'error',
91
- 'no-shadow': 'error',
92
- 'no-shadow-restricted-names': 'error',
93
- 'no-tabs': 'warn',
94
- 'no-template-curly-in-string': 'error',
95
- 'no-throw-literal': 'error',
96
- 'no-trailing-spaces': 'warn',
97
- 'no-undef-init': 'error',
98
- 'no-unexpected-multiline': 'off',
99
- 'no-unmodified-loop-condition': 'error',
100
- 'no-unneeded-ternary': 'error',
101
- 'no-unused-expressions': 'error',
102
- 'no-unused-vars': ['error', {args: 'none'}],
103
- 'no-use-before-define': ['error', {functions: false}],
104
- 'no-useless-call': 'error',
105
- 'no-useless-computed-key': 'error',
106
- 'no-useless-concat': 'error',
107
- 'no-useless-constructor': 'error',
108
- 'no-useless-rename': 'error',
109
- 'no-useless-return': 'error',
110
- 'no-var': 'error',
111
- 'no-whitespace-before-property': 'warn',
112
- 'no-with': 'error',
113
- 'nonblock-statement-body-position': 'error',
114
- 'object-curly-spacing': 'warn',
115
- 'object-shorthand': 'error',
116
- 'operator-linebreak': ['warn', 'after'],
117
- 'prefer-arrow-callback': 'error',
118
- 'prefer-const': 'error',
119
- 'prefer-numeric-literals': 'error',
120
- 'prefer-promise-reject-errors': 'error',
121
- 'quotes': ['error', 'single', {allowTemplateLiterals: true}],
122
- 'radix': 'error',
123
- 'require-atomic-updates': 'off',
124
- 'rest-spread-spacing': 'warn',
125
- 'semi': 'error',
126
- 'semi-spacing': 'warn',
127
- 'semi-style': 'warn',
128
- 'space-before-blocks': 'warn',
129
- 'space-before-function-paren': [
130
- 'warn', {anonymous: 'never', named: 'never', asyncArrow: 'always'}
131
- ],
132
- 'space-in-parens': 'warn',
133
- 'space-infix-ops': 'warn',
134
- 'space-unary-ops': ['warn', {words: true, nonwords: false}],
135
- 'spaced-comment': 'warn',
136
- 'strict': ['error'],
137
- 'switch-colon-spacing': 'warn',
138
- 'template-curly-spacing': 'warn',
139
- 'template-tag-spacing': 'warn',
140
- 'unicode-bom': 'error',
141
- 'yoda': 'error',
142
- }
143
- };
144
-