@leverege/build-tools 2.51.2 → 2.51.4
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.
- package/leverege-build-tools-2.21.13.tgz +0 -0
- package/lib/server/build-tools.js +138 -0
- package/lib/server/firebaseDeploy.js +195 -0
- package/lib/server/firebaseServe.js +116 -0
- package/lib/server/getfbcfg.js +25 -0
- package/lib/server/getjson.js +70 -0
- package/lib/server/overwhelm.js +447 -0
- package/lib/server/push-my-chart.js +18 -0
- package/lib/server/refresh-npm-token.js +135 -0
- package/lib/server/tag-release.js +681 -0
- package/lib/server/unleash.js +50 -0
- package/lib/web/build-tools.js +138 -0
- package/lib/web/firebaseDeploy.js +195 -0
- package/lib/web/firebaseServe.js +116 -0
- package/lib/web/getfbcfg.js +25 -0
- package/lib/web/getjson.js +70 -0
- package/lib/web/overwhelm.js +447 -0
- package/lib/web/push-my-chart.js +18 -0
- package/lib/web/refresh-npm-token.js +135 -0
- package/lib/web/tag-release.js +681 -0
- package/lib/web/unleash.js +50 -0
- package/package.json +2 -2
- package/src/Utils.mjs +1 -1
- package/src/build-tools.mjs +4 -5
- package/src/firebaseDeploy.mjs +0 -1
- package/src/firebaseServe.mjs +3 -2
- package/registry-compass.yaml +0 -20
- package/src/chart-compass.mjs +0 -96
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _execa = _interopRequireDefault(require("execa"));
|
|
5
|
+
var _simpleGit = _interopRequireDefault(require("simple-git"));
|
|
6
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
|
+
const git = new _simpleGit.default();
|
|
8
|
+
const getCurrentBranchName = async () => {
|
|
9
|
+
const branchInfo = await git.branch();
|
|
10
|
+
|
|
11
|
+
// first check to see if there are no branches - new repo?
|
|
12
|
+
if (Object.keys(branchInfo.branches).length === 0) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
return Object.entries(branchInfo.branches).find(([name, info]) => info.current)[0];
|
|
16
|
+
};
|
|
17
|
+
const isProtected = async () => {
|
|
18
|
+
const theBranch = await getCurrentBranchName();
|
|
19
|
+
const protectedBranches = ['main', 'master', 'development'];
|
|
20
|
+
const additionalProtectedBranches = [...process.argv.slice(2)];
|
|
21
|
+
|
|
22
|
+
// Check if the current branch starts with any of the additional
|
|
23
|
+
// protected branch name
|
|
24
|
+
let matchesAdditionalBranch = false;
|
|
25
|
+
for (let i = 0; i < additionalProtectedBranches.length; i++) {
|
|
26
|
+
matchesAdditionalBranch = matchesAdditionalBranch || theBranch.startsWith(additionalProtectedBranches[i]);
|
|
27
|
+
}
|
|
28
|
+
return protectedBranches.includes(theBranch) || matchesAdditionalBranch;
|
|
29
|
+
};
|
|
30
|
+
const npmRunner = async script => {
|
|
31
|
+
try {
|
|
32
|
+
const results = await (0, _execa.default)('npm', ['run', script], {
|
|
33
|
+
stdio: 'inherit'
|
|
34
|
+
});
|
|
35
|
+
return results;
|
|
36
|
+
} catch (err) {
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
};
|
|
41
|
+
(async () => {
|
|
42
|
+
if (await isProtected()) {
|
|
43
|
+
const script = ['test', 'lint'];
|
|
44
|
+
for (let i = 0; i < script.length; i++) {
|
|
45
|
+
await npmRunner(script[i]); // eslint-disable-line no-await-in-loop
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.51.
|
|
3
|
+
"version": "2.51.4",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"readline-sync": "^1.4.10",
|
|
75
75
|
"semver": "^7.6.3",
|
|
76
76
|
"simple-git": "^3.26.0",
|
|
77
|
-
"zx": "^8.1.
|
|
77
|
+
"zx": "^8.1.7"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@leverege/eslint-config-leverege": "^4.2.0",
|
package/src/Utils.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import YAML from 'js-yaml'
|
|
|
9
9
|
|
|
10
10
|
let debugEnabled = process.env.BUILD_TOOLS_DEBUG === '1'
|
|
11
11
|
|
|
12
|
-
export const disableDebug = () => debugEnabled = false
|
|
12
|
+
export const disableDebug = () => { debugEnabled = false }
|
|
13
13
|
|
|
14
14
|
/* eslint-disable no-console */
|
|
15
15
|
export const err = console.error
|
package/src/build-tools.mjs
CHANGED
|
@@ -135,11 +135,10 @@ const checkAndAnnounce = () => {
|
|
|
135
135
|
checkForLatest()
|
|
136
136
|
.then( ( latestVersion ) => {
|
|
137
137
|
if ( semverLt( thisVersion, latestVersion ) ) {
|
|
138
|
-
console.log( chalk.white
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)
|
|
138
|
+
console.log( chalk.white( '\n' +
|
|
139
|
+
` Update available ${chalk.yellow( thisVersion )} \u2b62 ${chalk.green( latestVersion )}\n` +
|
|
140
|
+
` Run ${chalk.cyan( 'npm i -g @leverege/build-tools' )} to update\n`
|
|
141
|
+
) )
|
|
143
142
|
process.exit( 1 )
|
|
144
143
|
} else {
|
|
145
144
|
process.exit( 0 )
|
package/src/firebaseDeploy.mjs
CHANGED
|
@@ -213,7 +213,6 @@ try {
|
|
|
213
213
|
const hostingPrefix = CHANNEL ? '' : 'hosting:'
|
|
214
214
|
|
|
215
215
|
await $( { ac } )`npm run clean && DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )} DEPLOYMENT_TARGET=${TARGET.siteId} npm run build && firebase use ${TARGET.projectId} && firebase ${deployType} --only ${hostingPrefix}${TARGET.siteId}`
|
|
216
|
-
.pipe( process.stdout )
|
|
217
216
|
} catch ( err ) {
|
|
218
217
|
console.error( err )
|
|
219
218
|
}
|
package/src/firebaseServe.mjs
CHANGED
|
@@ -130,8 +130,9 @@ const ac = new AbortController()
|
|
|
130
130
|
|
|
131
131
|
EXIT_EVENTS
|
|
132
132
|
.forEach( ( event ) => {
|
|
133
|
-
process.on( event, () => {
|
|
133
|
+
process.on( event, ( d ) => {
|
|
134
134
|
if ( !exited ) {
|
|
135
|
+
console.error( d )
|
|
135
136
|
exited = true
|
|
136
137
|
fs.removeSync( path.join( process.cwd(), '.env.temp' ) )
|
|
137
138
|
ac.abort()
|
|
@@ -142,7 +143,7 @@ EXIT_EVENTS
|
|
|
142
143
|
await fs.writeFile( path.join( process.cwd(), '.env.temp' ), envFileContent )
|
|
143
144
|
|
|
144
145
|
try {
|
|
145
|
-
await $( { ac } )`DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )} DEPLOYMENT_TARGET=${TARGET.siteId} npm run serve --colors
|
|
146
|
+
await $( { ac } )`DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )} DEPLOYMENT_TARGET=${TARGET.siteId} npm run serve --colors`
|
|
146
147
|
} catch ( err ) {
|
|
147
148
|
console.error( err )
|
|
148
149
|
}
|
package/registry-compass.yaml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
registry:
|
|
2
|
-
- root: us-docker.pkg.dev
|
|
3
|
-
- repositories:
|
|
4
|
-
- name: stack
|
|
5
|
-
charts:
|
|
6
|
-
- api-server
|
|
7
|
-
- authz-server
|
|
8
|
-
- emailer
|
|
9
|
-
- message-processor
|
|
10
|
-
- name: leverege
|
|
11
|
-
charts:
|
|
12
|
-
- pubsub-pulse
|
|
13
|
-
- pusher
|
|
14
|
-
- overdose
|
|
15
|
-
- name: cox-health
|
|
16
|
-
charts:
|
|
17
|
-
- actions-server
|
|
18
|
-
- analytics-server
|
|
19
|
-
- centrak-healthz
|
|
20
|
-
- centrak-ingestor
|
package/src/chart-compass.mjs
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* chart-to-registry will...
|
|
4
|
-
*/
|
|
5
|
-
import fs from 'node:fs'
|
|
6
|
-
|
|
7
|
-
import chalk from 'chalk'
|
|
8
|
-
import commandLineArgs from 'command-line-args'
|
|
9
|
-
import commandLineUsage from 'command-line-usage'
|
|
10
|
-
import { lt as semverLt } from 'semver'
|
|
11
|
-
import YAML from 'js-yaml'
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
condir,
|
|
15
|
-
debug,
|
|
16
|
-
errorExit,
|
|
17
|
-
log,
|
|
18
|
-
warning,
|
|
19
|
-
getGitRootDirectory,
|
|
20
|
-
parsePackageJson,
|
|
21
|
-
parseHelmChart,
|
|
22
|
-
shellCmd } from './Utils.mjs'
|
|
23
|
-
|
|
24
|
-
const commandLineOptions = [ // Use commandLineOptions to tie into the Usage statements
|
|
25
|
-
/* eslint-disable max-len */
|
|
26
|
-
{
|
|
27
|
-
name : 'location',
|
|
28
|
-
type : String,
|
|
29
|
-
description : '{green the location of the artifact registry the chart will be pushed to (default us-docker.pkg.dev)}',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name : 'project',
|
|
33
|
-
type : String,
|
|
34
|
-
description : '{green the name of the google project containing the npmrc and slack config secrets (default leverege-registry)}',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name : 'repository',
|
|
38
|
-
type : String,
|
|
39
|
-
description : '{green the target repository to receive the pushed chart}',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name : 'dry-run',
|
|
43
|
-
type : Boolean,
|
|
44
|
-
description : '{yellow perform everything except the actual chart push}',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name : 'help',
|
|
48
|
-
type : Boolean,
|
|
49
|
-
description : '{green display this help screen}',
|
|
50
|
-
},
|
|
51
|
-
/* eslint-enable max-len */
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
const sections = [
|
|
55
|
-
{
|
|
56
|
-
header : 'Leverege Helm Chart Compass (for helmup)',
|
|
57
|
-
content : `{green This tool helps helmup navigate the helm charts stored in the
|
|
58
|
-
artifact-registries.}`
|
|
59
|
-
},
|
|
60
|
-
{ header : 'Options',
|
|
61
|
-
optionList : commandLineOptions,
|
|
62
|
-
},
|
|
63
|
-
]
|
|
64
|
-
|
|
65
|
-
const args = commandLineArgs( commandLineOptions, { camelCase : true, partial : true } )
|
|
66
|
-
const usage = commandLineUsage( sections )
|
|
67
|
-
|
|
68
|
-
if ( args.help ) {
|
|
69
|
-
log( usage )
|
|
70
|
-
process.exit( 0 )
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/* eslint-disable no-underscore-dangle */
|
|
74
|
-
if ( args._unknown ) {
|
|
75
|
-
log( usage )
|
|
76
|
-
log( `\nUnrecognized argument [${chalk.bold.red( args._unknown )}]\n` )
|
|
77
|
-
process.exit( 1 )
|
|
78
|
-
}
|
|
79
|
-
/* eslint-enable no-underscore-dangle */
|
|
80
|
-
|
|
81
|
-
const minNodejsVersion = '18.0.0'
|
|
82
|
-
if ( semverLt( process.version, minNodejsVersion ) ) {
|
|
83
|
-
errorExit( `\n***ERROR: must be running at least node ${minNodejsVersion}\n` )
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// First of all, fail if we are not in a git repository
|
|
87
|
-
let gitRoot
|
|
88
|
-
try {
|
|
89
|
-
gitRoot = await getGitRootDirectory()
|
|
90
|
-
} catch ( error ) {
|
|
91
|
-
errorExit( chalk.red.bold( error ), { errorCode : 5 } )
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const chartCompass = YAML.load( fs.readFileSync( './registry-compass.yaml', 'utf8' ) )
|
|
95
|
-
|
|
96
|
-
condir( { chartCompass }, '<==Navigation' )
|