@leverege/build-tools 2.93.0-beta.12 → 2.93.0-beta.14

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/README.md CHANGED
@@ -18,7 +18,15 @@ npm install -g @leverege/build-tools
18
18
  ```bash
19
19
  . `build-tools --bashfun`
20
20
  ```
21
- * **docker-to-registry**: used to build and deploy docker images to the GCP image area
21
+ * **docker-to-registry**: used to build and deploy application docker images to the GCP artifact registry
22
+ * **pull-artifact**: used to pull generic artifacts from the GCP artifact registry
23
+ ```bash
24
+ Usage: pull-artifact -f <artifact schema file path> -n <package name> -v <package version>
25
+ ```
26
+ * **push-artifact**: used to push generic artifacts to the GCP artifact registry
27
+ ```bash
28
+ Usage: push-artifact -f <artifact schema file path> -n <package name> -v <package version>
29
+ ```
22
30
 
23
31
  ### Helm Helpers:
24
32
  * **overwhelm**: a k8s context helper and yaml replacer *${REPLACE_ME}*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.93.0-beta.12",
3
+ "version": "2.93.0-beta.14",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable security/detect-non-literal-fs-filename */
2
- import fs from 'fs'
2
+ import fs from 'node:fs'
3
3
 
4
4
  import { shellCmd, log, debug, err } from '../Utils.mjs'
5
5
 
@@ -1,4 +1,4 @@
1
- import fs from 'fs'
1
+ import fs from 'node:fs'
2
2
  import crypto from 'crypto'
3
3
 
4
4
  import { validate } from 'superstruct'
@@ -1,24 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { warning, err, log } from '../Utils.mjs'
3
+ import { program } from 'commander'
4
+
5
+ import { warning, log } from '../Utils.mjs'
4
6
 
5
7
  import { getArtifactsSchema, flattenArtifactsSchema } from './Utils.mjs'
6
8
  import { ArtifactTypeEnum } from './Structs.mjs'
7
9
  import { GenericArtifactPuller } from './ArtifactPuller.mjs'
8
10
 
9
- async function main() {
11
+ program
12
+ .name( 'pull-artifact' )
13
+ .description( 'Pull artifacts from GCP Artifact Registry' )
14
+ .requiredOption( '-f, --file-path <path>', 'Path to artifacts.yaml file' )
15
+ .option( '-n, --package-name <name>', 'Filter by artifact package name' )
16
+ .option( '-v, --package-version <version>', 'Filter by artifact package version' )
17
+ .parse()
10
18
 
11
- if ( process.argv.length < 3 ) {
12
- err( 'Usage:' )
13
- err( ' pull-artifact.mjs <artifacts.yml>' )
14
- err( ' pull-artifact.mjs <artifacts.yml> <artifact package name>' )
15
- err( ' pull-artifact.mjs <artifacts.yml> <artifact package name> <artifact package version>' )
16
- process.exit( 1 )
17
- }
19
+ const options = program.opts()
18
20
 
19
- const artifactsYmlPath = process.argv[2]
20
- const artifactPackageName = process.argv.length > 3 ? process.argv[3] : null
21
- const artifactPackageVersion = process.argv.length > 4 ? process.argv[4] : null
21
+ async function main() {
22
+ const artifactsYmlPath = options.artifactsFilePath
23
+ const artifactPackageName = options.packageName || null
24
+ const artifactPackageVersion = options.packageVersion || null
22
25
 
23
26
  const artifactsSchema = await getArtifactsSchema( artifactsYmlPath )
24
27
  const flattenedArtifactsSchema = flattenArtifactsSchema( artifactsSchema )
@@ -65,7 +68,7 @@ async function main() {
65
68
 
66
69
  counter = pullResults.filter( Boolean ).length
67
70
 
68
- log( `Successfully pushed ${counter}/${filteredArtifactsSchema.length} artifacts` )
71
+ log( `Successfully pulled ${counter}/${filteredArtifactsSchema.length} artifacts` )
69
72
  }
70
73
 
71
74
  main()
@@ -1,24 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { warning, err, log } from '../Utils.mjs'
3
+ import { program } from 'commander'
4
+
5
+ import { warning, log } from '../Utils.mjs'
4
6
 
5
7
  import { getArtifactsSchema, flattenArtifactsSchema } from './Utils.mjs'
6
8
  import { ArtifactTypeEnum } from './Structs.mjs'
7
9
  import { GenericArtifactPusher } from './ArtifactPusher.mjs'
8
10
 
9
- async function main() {
11
+ program
12
+ .name( 'push-artifact' )
13
+ .description( 'Push artifacts to GCP Artifact Registry' )
14
+ .requiredOption( '-f, --file-path <path>', 'Path to artifacts.yaml file' )
15
+ .option( '-n, --package-name <name>', 'Filter by artifact package name' )
16
+ .option( '-v, --package-version <version>', 'Filter by artifact package version' )
17
+ .parse()
10
18
 
11
- if ( process.argv.length < 3 ) {
12
- err( 'Usage:' )
13
- err( ' push-artifact.mjs <artifacts.yml>' )
14
- err( ' push-artifact.mjs <artifacts.yml> <artifact package name>' )
15
- err( ' push-artifact.mjs <artifacts.yml> <artifact package name> <artifact package version>' )
16
- process.exit( 1 )
17
- }
19
+ const options = program.opts()
18
20
 
19
- const artifactsYmlPath = process.argv[2]
20
- const artifactPackageName = process.argv.length > 3 ? process.argv[3] : null
21
- const artifactPackageVersion = process.argv.length > 4 ? process.argv[4] : null
21
+ async function main() {
22
+ const artifactsYmlPath = options.artifactsFilePath
23
+ const artifactPackageName = options.packageName || null
24
+ const artifactPackageVersion = options.packageVersion || null
22
25
 
23
26
  const artifactsSchema = await getArtifactsSchema( artifactsYmlPath )
24
27
  const flattenedArtifactsSchema = flattenArtifactsSchema( artifactsSchema )