@leverege/build-tools 2.38.2 → 2.39.0-beta.2
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/package.json +12 -16
- package/src/Utils.mjs +30 -0
- package/src/{build-tools.js → build-tools.mjs} +28 -12
- package/src/circle-lib.yml +150 -0
- package/src/circle-srv.yml +213 -0
- package/src/firebaseDeploy.mjs +2 -1
- package/src/firebaseServe.mjs +2 -1
- package/src/getjson.mjs +3 -3
- package/src/helm-charts/firebase-rules/.nohelm +0 -0
- package/src/helm-charts/firebase-rules/firebase.json +5 -0
- package/src/helm-charts/firebase-rules/firebaserc.ovh +24 -0
- package/src/helm-charts/firebase-rules/gitignore +2 -0
- package/src/helm-charts/firebase-rules/helmup.plugin +14 -0
- package/src/helm-charts/firebase-rules/leverege.rules.json +65 -0
- package/src/helm-charts/geotile-server/.nohelm +0 -0
- package/src/helm-charts/geotile-server/gitignore +1 -0
- package/src/helm-charts/geotile-server/helmup.plugin +6 -0
- package/src/helm-charts/velero/helmup.plugin +16 -0
- package/src/helmup.sh +47 -1
- package/src/overwhelm.mjs +55 -63
- package/src/push-my-chart.mjs +7 -6
- package/src/refresh-npm-token.mjs +142 -40
- package/src/unleash.mjs +4 -2
- package/leverege-build-tools-2.21.13.tgz +0 -0
- package/lib/server/build-tools.js +0 -138
- package/lib/server/firebaseDeploy.js +0 -195
- package/lib/server/firebaseServe.js +0 -116
- package/lib/server/getfbcfg.js +0 -25
- package/lib/server/getjson.js +0 -70
- package/lib/server/overwhelm.js +0 -447
- package/lib/server/push-my-chart.js +0 -18
- package/lib/server/refresh-npm-token.js +0 -135
- package/lib/server/tag-release.js +0 -681
- package/lib/server/unleash.js +0 -50
- package/lib/web/build-tools.js +0 -138
- package/lib/web/firebaseDeploy.js +0 -195
- package/lib/web/firebaseServe.js +0 -116
- package/lib/web/getfbcfg.js +0 -25
- package/lib/web/getjson.js +0 -70
- package/lib/web/overwhelm.js +0 -447
- package/lib/web/push-my-chart.js +0 -18
- package/lib/web/refresh-npm-token.js +0 -135
- package/lib/web/tag-release.js +0 -681
- package/lib/web/unleash.js +0 -50
- package/src/overwhelm.js +0 -396
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.39.0-beta.2",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"compile_server": "NODE_ENV=server babel -d lib/server src/",
|
|
15
15
|
"compile_web": "NODE_ENV=web babel -d lib/web src/",
|
|
16
16
|
"lint": "find ./src -name \\*.\\*js | xargs npx eslint --report-unused-disable-directives",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"xprepublintOnly": "npm run lint && npm run build",
|
|
18
|
+
"xprepublishOnly": "npm run compile",
|
|
19
19
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
|
-
"build-tools": "src/build-tools.
|
|
22
|
+
"build-tools": "src/build-tools.mjs",
|
|
23
23
|
"circleate": "src/circleate.sh",
|
|
24
24
|
"decrypt-secrets": "src/decrypt-secrets.sh",
|
|
25
25
|
"dirty-git": "src/dirty-git.sh",
|
|
@@ -55,17 +55,16 @@
|
|
|
55
55
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"ansi-colors": "^4.1.3",
|
|
58
|
-
"chalk": "^
|
|
58
|
+
"chalk": "^5.3.0",
|
|
59
59
|
"command-line-args": "^5.2.1",
|
|
60
|
-
"command-line-usage": "^
|
|
60
|
+
"command-line-usage": "^7.0.1",
|
|
61
61
|
"deepmerge": "^4.3.1",
|
|
62
|
-
"dotenv": "^16.3.1",
|
|
63
62
|
"enquirer": "^2.4.1",
|
|
64
|
-
"execa": "^
|
|
65
|
-
"
|
|
66
|
-
"glob": "^8.1.0",
|
|
63
|
+
"execa": "^8.0.1",
|
|
64
|
+
"glob": "^10.3.4",
|
|
67
65
|
"js-yaml": "^4.1.0",
|
|
68
|
-
"
|
|
66
|
+
"ms": "^2.1.3",
|
|
67
|
+
"npm-registry-fetch": "^16.0.0",
|
|
69
68
|
"parse-gitignore": "^2.0.0",
|
|
70
69
|
"read-pkg": "^8.1.0",
|
|
71
70
|
"readline-sync": "^1.4.10",
|
|
@@ -74,10 +73,7 @@
|
|
|
74
73
|
"zx": "^7.2.3"
|
|
75
74
|
},
|
|
76
75
|
"devDependencies": {
|
|
77
|
-
"@
|
|
78
|
-
"
|
|
79
|
-
"@leverege/babel-preset-leverege-node": "^2.0.0",
|
|
80
|
-
"@leverege/eslint-config-leverege": "^3.0.1",
|
|
81
|
-
"npm": "^9.8.1"
|
|
76
|
+
"@leverege/eslint-config-leverege": "^4.2.0",
|
|
77
|
+
"npm": "^10.0.0"
|
|
82
78
|
}
|
|
83
79
|
}
|
package/src/Utils.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
import { $ } from 'execa'
|
|
3
|
+
|
|
4
|
+
const debugEnabled = process.env.BUILD_TOOLS_DEBUG === '1'
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line no-console
|
|
7
|
+
export const log = console.log
|
|
8
|
+
export const debug = ( obj, text ) => {
|
|
9
|
+
if ( debugEnabled ) {
|
|
10
|
+
log( obj, `${chalk.yellow( '***DEBUG:' )} ${chalk.green( text )}` )
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const shellCmd = async ( cmdstr, opts = {} ) => {
|
|
15
|
+
try {
|
|
16
|
+
// due to the escaping rules we pull apart the cmdstr and invoke $ using
|
|
17
|
+
// the (command, argsArray) or the escaped command sent to spawn will have
|
|
18
|
+
// addition double quotes which causes fail
|
|
19
|
+
const [ command, ...args ] = cmdstr.split( ' ' )
|
|
20
|
+
|
|
21
|
+
debug( { command, args }, '<==execa $ invoke' )
|
|
22
|
+
const results = await $( opts )`${command} ${args}`
|
|
23
|
+
debug( { results }, '<==execa $ results' )
|
|
24
|
+
|
|
25
|
+
return results.stdout
|
|
26
|
+
} catch ( error ) {
|
|
27
|
+
debug( { error } )
|
|
28
|
+
throw error
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable security/detect-non-literal-fs-filename */
|
|
3
|
+
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import url from 'node:url'
|
|
7
|
+
|
|
8
|
+
import chalk from 'chalk'
|
|
9
|
+
import cliArgs from 'command-line-args'
|
|
10
|
+
import cliHelp from 'command-line-usage'
|
|
11
|
+
import npmRegistryFetch from 'npm-registry-fetch'
|
|
12
|
+
import { lt as semverLt } from 'semver'
|
|
13
|
+
|
|
14
|
+
// because __dirname goes away with ESM
|
|
15
|
+
const getFilename = () => {
|
|
16
|
+
const filename = url.fileURLToPath( import.meta.url )
|
|
17
|
+
return filename
|
|
18
|
+
}
|
|
2
19
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
20
|
+
const getDirname = () => {
|
|
21
|
+
const dirname = path.dirname( getFilename() )
|
|
22
|
+
return dirname
|
|
23
|
+
}
|
|
5
24
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const semverLt = require( 'semver/functions/lt' )
|
|
25
|
+
const repoRoot = path.dirname( getDirname() )
|
|
26
|
+
const thisVersion = JSON.parse(
|
|
27
|
+
fs.readFileSync( `${repoRoot}/package.json` )
|
|
28
|
+
).version
|
|
11
29
|
|
|
12
30
|
/* eslint-disable no-console */
|
|
13
31
|
|
|
@@ -65,10 +83,6 @@ const sections = [
|
|
|
65
83
|
const args = cliArgs( optionList, { partial : true } )
|
|
66
84
|
const help = cliHelp( sections )
|
|
67
85
|
|
|
68
|
-
const repoRoot = path.dirname( __dirname )
|
|
69
|
-
const thisPackage = require( `${repoRoot}/package.json` )
|
|
70
|
-
const thisVersion = thisPackage.version
|
|
71
|
-
|
|
72
86
|
if ( args.root ) {
|
|
73
87
|
console.log( repoRoot )
|
|
74
88
|
process.exit( 0 )
|
|
@@ -93,7 +107,7 @@ const checkForLatest = async ( pkg = '@leverege/build-tools' ) => {
|
|
|
93
107
|
}
|
|
94
108
|
try {
|
|
95
109
|
const tokenLine = fs.readFileSync( tokenFile ).toString()
|
|
96
|
-
const tokenRegX = new RegExp( '.*registry.npmjs.org\\/:\\w+=+(.*)' )
|
|
110
|
+
const tokenRegX = '.*registry.npmjs.org\\/:\\w+=+(.*)' // old => new RegExp( '.*registry.npmjs.org\\/:\\w+=+(.*)' )
|
|
97
111
|
const tokenStr = tokenLine.match( tokenRegX )
|
|
98
112
|
if ( !tokenStr ) {
|
|
99
113
|
console.error( `\n***ERROR: malformed npm token in ${tokenFile}\n` )
|
|
@@ -103,6 +117,7 @@ const checkForLatest = async ( pkg = '@leverege/build-tools' ) => {
|
|
|
103
117
|
} catch ( err ) {
|
|
104
118
|
console.error( err )
|
|
105
119
|
}
|
|
120
|
+
return undefined
|
|
106
121
|
}
|
|
107
122
|
|
|
108
123
|
try {
|
|
@@ -113,6 +128,7 @@ const checkForLatest = async ( pkg = '@leverege/build-tools' ) => {
|
|
|
113
128
|
} catch ( err ) {
|
|
114
129
|
console.log( err )
|
|
115
130
|
}
|
|
131
|
+
return undefined
|
|
116
132
|
}
|
|
117
133
|
|
|
118
134
|
const checkAndAnnounce = () => {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
jobs:
|
|
3
|
+
install:
|
|
4
|
+
docker:
|
|
5
|
+
- image: $CIRCLE_NODE_IMG
|
|
6
|
+
steps:
|
|
7
|
+
- checkout
|
|
8
|
+
- restore_cache:
|
|
9
|
+
keys:
|
|
10
|
+
- v1-npm-deps-{{ checksum "package-lock.json" }}
|
|
11
|
+
- v1-npm-deps-
|
|
12
|
+
|
|
13
|
+
- run:
|
|
14
|
+
name: Setup @leverege Token
|
|
15
|
+
command: echo \${NPMRC} > ~/.npmrc
|
|
16
|
+
|
|
17
|
+
- run: npm install
|
|
18
|
+
|
|
19
|
+
- save_cache:
|
|
20
|
+
key: v1-npm-deps-{{ checksum "package-lock.json" }}
|
|
21
|
+
paths:
|
|
22
|
+
- ./node_modules
|
|
23
|
+
|
|
24
|
+
- persist_to_workspace:
|
|
25
|
+
root: /home/circleci/project
|
|
26
|
+
paths:
|
|
27
|
+
- ./node_modules
|
|
28
|
+
|
|
29
|
+
security-check:
|
|
30
|
+
docker:
|
|
31
|
+
- image: $CIRCLE_NODE_IMG
|
|
32
|
+
steps:
|
|
33
|
+
- checkout
|
|
34
|
+
- attach_workspace:
|
|
35
|
+
at: ~/project
|
|
36
|
+
- run:
|
|
37
|
+
name: Check for vulnerabilities
|
|
38
|
+
command: npm audit --production --audit-level=moderate
|
|
39
|
+
|
|
40
|
+
license-check:
|
|
41
|
+
docker:
|
|
42
|
+
- image: $CIRCLE_NODE_IMG
|
|
43
|
+
steps:
|
|
44
|
+
- checkout
|
|
45
|
+
- attach_workspace:
|
|
46
|
+
at: ~/project
|
|
47
|
+
- run:
|
|
48
|
+
name: Check for LICENSE and README files
|
|
49
|
+
command: npm run pkglint
|
|
50
|
+
|
|
51
|
+
- run:
|
|
52
|
+
name: Check for license violations (e.g. GPL)
|
|
53
|
+
command: npx license-checker --production --summary --failOn GPL
|
|
54
|
+
|
|
55
|
+
lint:
|
|
56
|
+
docker:
|
|
57
|
+
- image: $CIRCLE_NODE_IMG
|
|
58
|
+
steps:
|
|
59
|
+
- checkout
|
|
60
|
+
- attach_workspace:
|
|
61
|
+
at: ~/project
|
|
62
|
+
- run:
|
|
63
|
+
name: Lint and save results
|
|
64
|
+
command: npm run lint-ci
|
|
65
|
+
|
|
66
|
+
- store_test_results:
|
|
67
|
+
path: reports
|
|
68
|
+
|
|
69
|
+
docs:
|
|
70
|
+
docker:
|
|
71
|
+
- image: $CIRCLE_NODE_IMG
|
|
72
|
+
steps:
|
|
73
|
+
- checkout
|
|
74
|
+
- attach_workspace:
|
|
75
|
+
at: ~/project
|
|
76
|
+
- run:
|
|
77
|
+
name: Generate docs
|
|
78
|
+
command: npx jsdoc -r src -R README.md -d docs
|
|
79
|
+
- store_artifacts:
|
|
80
|
+
path: docs
|
|
81
|
+
prefix: docs
|
|
82
|
+
|
|
83
|
+
coverage:
|
|
84
|
+
# coverage runs tests, generates coverage, and saves docs
|
|
85
|
+
environment:
|
|
86
|
+
TZ: 'America/New_York'
|
|
87
|
+
docker:
|
|
88
|
+
- image: $CIRCLE_NODE_IMG
|
|
89
|
+
# IF YOU NEED ANY OF THESE, UNCOMMENT TO USE
|
|
90
|
+
# - image: redis
|
|
91
|
+
# - image: circleci/mysql:5.7
|
|
92
|
+
# environment:
|
|
93
|
+
# MYSQL_USER: root
|
|
94
|
+
# MYSQL_ROOT_PASSWORD: root
|
|
95
|
+
# MYSQL_ALLOW_EMPTY_PASSWORD: true
|
|
96
|
+
# MYSQL_HOST: 127.0.0.1
|
|
97
|
+
# - image: nsqio/nsq
|
|
98
|
+
# command: /nsqlookupd -broadcast-address localhost:4160 -tcp-address 0.0.0.0:4160 -http-address 0.0.0.0:4161
|
|
99
|
+
|
|
100
|
+
# - image: nsqio/nsq
|
|
101
|
+
# command: >
|
|
102
|
+
# /nsqd
|
|
103
|
+
# -broadcast-address localhost:4150
|
|
104
|
+
# -tcp-address 0.0.0.0:4150
|
|
105
|
+
# -http-address 0.0.0.0:4151
|
|
106
|
+
# -lookupd-tcp-address localhost:4160
|
|
107
|
+
|
|
108
|
+
steps:
|
|
109
|
+
- checkout
|
|
110
|
+
- attach_workspace:
|
|
111
|
+
at: ~/project
|
|
112
|
+
|
|
113
|
+
# UNCOMMENT IF YOU NEED DECRYPTING SECRETS
|
|
114
|
+
# - run:
|
|
115
|
+
# name: Load secrets
|
|
116
|
+
# command: npm run decrypt
|
|
117
|
+
|
|
118
|
+
- run:
|
|
119
|
+
name: Run Tests and Generate Code Coverage
|
|
120
|
+
command: npm run coverage
|
|
121
|
+
|
|
122
|
+
- run:
|
|
123
|
+
name: Check if coverage meets at least 70%
|
|
124
|
+
command: npx c8 check-coverage --functions 70 --lines 70 --statements 70
|
|
125
|
+
|
|
126
|
+
- store_artifacts:
|
|
127
|
+
path: coverage
|
|
128
|
+
prefix: coverage
|
|
129
|
+
|
|
130
|
+
workflows:
|
|
131
|
+
version: 2.1
|
|
132
|
+
test-build-deploy:
|
|
133
|
+
jobs:
|
|
134
|
+
- install:
|
|
135
|
+
context: npm
|
|
136
|
+
- security-check:
|
|
137
|
+
requires:
|
|
138
|
+
- install
|
|
139
|
+
- license-check:
|
|
140
|
+
requires:
|
|
141
|
+
- install
|
|
142
|
+
- lint:
|
|
143
|
+
requires:
|
|
144
|
+
- install
|
|
145
|
+
- coverage:
|
|
146
|
+
requires:
|
|
147
|
+
- install
|
|
148
|
+
- docs:
|
|
149
|
+
requires:
|
|
150
|
+
- install
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
#orbs:
|
|
3
|
+
# gcp-gcr: circleci/gcp-gcr@0.6.1
|
|
4
|
+
executors:
|
|
5
|
+
default:
|
|
6
|
+
description: >
|
|
7
|
+
A debian-based machine executor.
|
|
8
|
+
machine: true
|
|
9
|
+
jobs:
|
|
10
|
+
install:
|
|
11
|
+
docker:
|
|
12
|
+
- image: $CIRCLE_NODE_IMG
|
|
13
|
+
steps:
|
|
14
|
+
- checkout
|
|
15
|
+
- restore_cache:
|
|
16
|
+
keys:
|
|
17
|
+
- v1-npm-deps-{{ checksum "package-lock.json" }}
|
|
18
|
+
- v1-npm-deps-
|
|
19
|
+
|
|
20
|
+
- run:
|
|
21
|
+
name: Setup @leverege Token
|
|
22
|
+
command: echo \${NPMRC} > ~/.npmrc
|
|
23
|
+
|
|
24
|
+
- run: npm install
|
|
25
|
+
|
|
26
|
+
- save_cache:
|
|
27
|
+
key: v1-npm-deps-{{ checksum "package-lock.json" }}
|
|
28
|
+
paths:
|
|
29
|
+
- ./node_modules
|
|
30
|
+
|
|
31
|
+
- persist_to_workspace:
|
|
32
|
+
root: /home/circleci/project
|
|
33
|
+
paths:
|
|
34
|
+
- ./node_modules
|
|
35
|
+
|
|
36
|
+
security-check:
|
|
37
|
+
docker:
|
|
38
|
+
- image: $CIRCLE_NODE_IMG
|
|
39
|
+
steps:
|
|
40
|
+
- checkout
|
|
41
|
+
- attach_workspace:
|
|
42
|
+
at: ~/project
|
|
43
|
+
- run:
|
|
44
|
+
name: Check for vulnerabilities
|
|
45
|
+
command: npm audit --production --audit-level=moderate
|
|
46
|
+
|
|
47
|
+
license-check:
|
|
48
|
+
docker:
|
|
49
|
+
- image: $CIRCLE_NODE_IMG
|
|
50
|
+
steps:
|
|
51
|
+
- checkout
|
|
52
|
+
- attach_workspace:
|
|
53
|
+
at: ~/project
|
|
54
|
+
- run:
|
|
55
|
+
name: Check for LICENSE and README files
|
|
56
|
+
command: npm run pkglint
|
|
57
|
+
|
|
58
|
+
- run:
|
|
59
|
+
name: Check for license violations (e.g. GPL)
|
|
60
|
+
command: npx license-checker --production --summary --failOn GPL
|
|
61
|
+
|
|
62
|
+
lint:
|
|
63
|
+
docker:
|
|
64
|
+
- image: $CIRCLE_NODE_IMG
|
|
65
|
+
steps:
|
|
66
|
+
- checkout
|
|
67
|
+
- attach_workspace:
|
|
68
|
+
at: ~/project
|
|
69
|
+
- run:
|
|
70
|
+
name: Lint and save results
|
|
71
|
+
command: npm run lint-ci
|
|
72
|
+
|
|
73
|
+
- store_test_results:
|
|
74
|
+
path: reports
|
|
75
|
+
|
|
76
|
+
docs:
|
|
77
|
+
docker:
|
|
78
|
+
- image: $CIRCLE_NODE_IMG
|
|
79
|
+
steps:
|
|
80
|
+
- checkout
|
|
81
|
+
- attach_workspace:
|
|
82
|
+
at: ~/project
|
|
83
|
+
- run:
|
|
84
|
+
name: Generate docs
|
|
85
|
+
command: npx jsdoc -r src -R README.md -d docs
|
|
86
|
+
- store_artifacts:
|
|
87
|
+
path: docs
|
|
88
|
+
prefix: docs
|
|
89
|
+
|
|
90
|
+
coverage:
|
|
91
|
+
# coverage runs tests, generates coverage, and saves docs
|
|
92
|
+
environment:
|
|
93
|
+
TZ: 'America/New_York'
|
|
94
|
+
docker:
|
|
95
|
+
- image: $CIRCLE_NODE_IMG
|
|
96
|
+
# IF YOU NEED ANY OF THESE, UNCOMMENT TO USE
|
|
97
|
+
# - image: redis
|
|
98
|
+
# - image: circleci/mysql:5.7
|
|
99
|
+
# environment:
|
|
100
|
+
# MYSQL_USER: root
|
|
101
|
+
# MYSQL_ROOT_PASSWORD: root
|
|
102
|
+
# MYSQL_ALLOW_EMPTY_PASSWORD: true
|
|
103
|
+
# MYSQL_HOST: 127.0.0.1
|
|
104
|
+
# - image: nsqio/nsq
|
|
105
|
+
# command: /nsqlookupd -broadcast-address localhost:4160 -tcp-address 0.0.0.0:4160 -http-address 0.0.0.0:4161
|
|
106
|
+
|
|
107
|
+
# - image: nsqio/nsq
|
|
108
|
+
# command: >
|
|
109
|
+
# /nsqd
|
|
110
|
+
# -broadcast-address localhost:4150
|
|
111
|
+
# -tcp-address 0.0.0.0:4150
|
|
112
|
+
# -http-address 0.0.0.0:4151
|
|
113
|
+
# -lookupd-tcp-address localhost:4160
|
|
114
|
+
|
|
115
|
+
steps:
|
|
116
|
+
- checkout
|
|
117
|
+
- attach_workspace:
|
|
118
|
+
at: ~/project
|
|
119
|
+
|
|
120
|
+
# UNCOMMENT IF YOU NEED DECRYPTING SECRETS
|
|
121
|
+
# - run:
|
|
122
|
+
# name: Load secrets
|
|
123
|
+
# command: npm run decrypt
|
|
124
|
+
|
|
125
|
+
- run:
|
|
126
|
+
name: Run Tests and Generate Code Coverage
|
|
127
|
+
command: npm run coverage
|
|
128
|
+
|
|
129
|
+
- run:
|
|
130
|
+
name: Check if coverage meets at least 70%
|
|
131
|
+
command: npx c8 check-coverage --functions 70 --lines 70 --statements 70
|
|
132
|
+
|
|
133
|
+
- store_artifacts:
|
|
134
|
+
path: coverage
|
|
135
|
+
prefix: coverage
|
|
136
|
+
|
|
137
|
+
build:
|
|
138
|
+
# build should make dist image and prepare docker file
|
|
139
|
+
docker:
|
|
140
|
+
- image: $CIRCLE_NODE_IMG
|
|
141
|
+
|
|
142
|
+
steps:
|
|
143
|
+
- checkout
|
|
144
|
+
- attach_workspace:
|
|
145
|
+
at: ~/project
|
|
146
|
+
|
|
147
|
+
- run:
|
|
148
|
+
name: Setup @leverege Token
|
|
149
|
+
command: echo \${NPMRC} > ~/.npmrc.ro
|
|
150
|
+
|
|
151
|
+
- run:
|
|
152
|
+
name: Determine version number and container name
|
|
153
|
+
command: |
|
|
154
|
+
container="\`node -p \"require('./package.json').leverege.container\"\`"
|
|
155
|
+
if [ "\$container" == "undefined" ];
|
|
156
|
+
then
|
|
157
|
+
container=\$CIRCLE_PROJECT_REPONAME
|
|
158
|
+
fi
|
|
159
|
+
NODE_IMAGE="\`node -p \"require('./package.json').leverege.nodeimg\"\`"
|
|
160
|
+
|
|
161
|
+
echo \$(git describe --tags) > package_version
|
|
162
|
+
echo \${container} > container_name
|
|
163
|
+
echo \${NODE_IMAGE} > node_img
|
|
164
|
+
|
|
165
|
+
- run:
|
|
166
|
+
name: Create Dockerfile and build dist directory
|
|
167
|
+
command: mkdir -p docker && npm run dockerize \$(git describe --tags)
|
|
168
|
+
|
|
169
|
+
- persist_to_workspace:
|
|
170
|
+
root: ~/project
|
|
171
|
+
paths:
|
|
172
|
+
- docker/*
|
|
173
|
+
- package_version
|
|
174
|
+
- container_name
|
|
175
|
+
- node_img
|
|
176
|
+
|
|
177
|
+
workflows:
|
|
178
|
+
version: 2.1
|
|
179
|
+
test-build-deploy:
|
|
180
|
+
jobs:
|
|
181
|
+
- install:
|
|
182
|
+
context: npm
|
|
183
|
+
- security-check:
|
|
184
|
+
requires:
|
|
185
|
+
- install
|
|
186
|
+
- license-check:
|
|
187
|
+
requires:
|
|
188
|
+
- install
|
|
189
|
+
- lint:
|
|
190
|
+
requires:
|
|
191
|
+
- install
|
|
192
|
+
- coverage:
|
|
193
|
+
requires:
|
|
194
|
+
- install
|
|
195
|
+
- docs:
|
|
196
|
+
requires:
|
|
197
|
+
- install
|
|
198
|
+
- build:
|
|
199
|
+
context: npm
|
|
200
|
+
filters:
|
|
201
|
+
branches:
|
|
202
|
+
only:
|
|
203
|
+
- development
|
|
204
|
+
- /release-.*/
|
|
205
|
+
- master
|
|
206
|
+
requires:
|
|
207
|
+
- install
|
|
208
|
+
- security-check
|
|
209
|
+
- license-check
|
|
210
|
+
- lint
|
|
211
|
+
- coverage
|
|
212
|
+
- docs
|
|
213
|
+
|
package/src/firebaseDeploy.mjs
CHANGED
|
@@ -78,6 +78,7 @@ const targets = Object
|
|
|
78
78
|
// Store the longest length of site id for formatting later on
|
|
79
79
|
maxSiteIdLength = Math.max( siteId.length, maxSiteIdLength )
|
|
80
80
|
|
|
81
|
+
// eslint-disable-next-line no-param-reassign
|
|
81
82
|
prev[alias] = {
|
|
82
83
|
projectId,
|
|
83
84
|
siteId,
|
|
@@ -209,7 +210,7 @@ try {
|
|
|
209
210
|
const deployType = CHANNEL ? `hosting:channel:deploy ${CHANNEL.name} ${CHANNEL.expiration ? `--expires ${CHANNEL.expiration}` : ''}`.split( ' ' ) : 'deploy'
|
|
210
211
|
const hostingPrefix = CHANNEL ? '' : 'hosting:'
|
|
211
212
|
|
|
212
|
-
await $`npm run clean && DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )}
|
|
213
|
+
await $`npm run clean && DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )} npm run build && firebase use ${TARGET.projectId} && firebase ${deployType} --only ${hostingPrefix}${TARGET.siteId}`
|
|
213
214
|
} catch ( err ) {
|
|
214
215
|
console.error( err )
|
|
215
216
|
}
|
package/src/firebaseServe.mjs
CHANGED
|
@@ -61,6 +61,7 @@ const targets = Object
|
|
|
61
61
|
.entries( config.hosting )
|
|
62
62
|
.forEach( ( [ siteId, aliases ] ) => {
|
|
63
63
|
aliases.forEach( ( alias ) => {
|
|
64
|
+
// eslint-disable-next-line no-param-reassign
|
|
64
65
|
prev[alias] = {
|
|
65
66
|
projectId,
|
|
66
67
|
siteId,
|
|
@@ -138,7 +139,7 @@ EXIT_EVENTS
|
|
|
138
139
|
await fs.writeFile( path.join( process.cwd(), '.env.temp' ), envFileContent )
|
|
139
140
|
|
|
140
141
|
try {
|
|
141
|
-
await $`DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )}
|
|
142
|
+
await $`DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )} npm run serve --colors`
|
|
142
143
|
} catch ( err ) {
|
|
143
144
|
console.error( err )
|
|
144
145
|
}
|
package/src/getjson.mjs
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
/**
|
|
19
19
|
* Get a command line switch parser.
|
|
20
20
|
*/
|
|
21
|
-
import fs from 'fs'
|
|
21
|
+
import fs from 'node:fs'
|
|
22
22
|
import cliArgs from 'command-line-args'
|
|
23
23
|
import cliHelp from 'command-line-usage'
|
|
24
24
|
|
|
@@ -64,9 +64,9 @@ if ( !args.file ) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
try {
|
|
67
|
-
const json = JSON.parse( fs.readFileSync( args.file, 'utf8' ) )
|
|
67
|
+
const json = JSON.parse( fs.readFileSync( args.file, 'utf8' ) ) // eslint-disable-line security/detect-non-literal-fs-filename
|
|
68
68
|
const value = json[args.key]
|
|
69
|
-
const match = new RegExp( args.regex || '.*' ).exec( value )
|
|
69
|
+
const match = new RegExp( args.regex || '.*' ).exec( value ) // eslint-disable-line security/detect-non-literal-regexp
|
|
70
70
|
|
|
71
71
|
console.log( match ? match[match.length - 1] : '' )
|
|
72
72
|
} catch ( e ) {
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projects": {
|
|
3
|
+
"default": "OVH:<PROJECT_ID>"
|
|
4
|
+
},
|
|
5
|
+
"targets": {
|
|
6
|
+
"OVH:<PROJECT_ID>": {
|
|
7
|
+
"database": {
|
|
8
|
+
"leverege": [
|
|
9
|
+
"OVH:<PROJECT_ID>",
|
|
10
|
+
"OVH:<PROJECT_ID>-rt-0",
|
|
11
|
+
"OVH:<PROJECT_ID>-rt-1",
|
|
12
|
+
"OVH:<PROJECT_ID>-rt-2",
|
|
13
|
+
"OVH:<PROJECT_ID>-rt-3",
|
|
14
|
+
"OVH:<PROJECT_ID>-rt-4",
|
|
15
|
+
"OVH:<PROJECT_ID>-rt-5",
|
|
16
|
+
"OVH:<PROJECT_ID>-rt-6",
|
|
17
|
+
"OVH:<PROJECT_ID>-rt-7",
|
|
18
|
+
"OVH:<PROJECT_ID>-rt-8",
|
|
19
|
+
"OVH:<PROJECT_ID>-rt-9"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# make sure we're running from the proper dir
|
|
4
|
+
cd $GITTOP/firebase-rules
|
|
5
|
+
|
|
6
|
+
# grab a copy of existing rules - date time stamp DTS comes from bash-funcs
|
|
7
|
+
firebase --project $GCP_PROJECT_ID \
|
|
8
|
+
database:get /.settings/rules > leverege.rules.previous.json
|
|
9
|
+
|
|
10
|
+
# copy the current ovh generated rc file to where firebase will find it
|
|
11
|
+
cp firebaserc .firebaserc
|
|
12
|
+
|
|
13
|
+
# Note: GCP_PROJECT_ID is passed down from helmup's environment.
|
|
14
|
+
firebase --project $GCP_PROJECT_ID deploy --only database
|