@leverege/build-tools 2.2.15 → 2.3.1
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/CHANGELOG.md +4 -0
- package/lib/web/packleate/Packleator.js +1 -1
- package/lib/web/packleate/index.js +1 -1
- package/package.json +3 -1
- package/src/circleate +95 -77
- package/src/npm-link +102 -0
- package/src/npm-unlink +54 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [2.3.1] = 2020-05-10
|
|
5
|
+
### Updated
|
|
6
|
+
- (Circleate) Updated support for UI circle config
|
|
7
|
+
|
|
4
8
|
## [2.2.3] = 2020-04-22
|
|
5
9
|
### Updated
|
|
6
10
|
- (Helmify) Added a CLI interface for Helmup
|
|
@@ -80,7 +80,7 @@ var Packleator = /*#__PURE__*/function () {
|
|
|
80
80
|
|
|
81
81
|
var args = options.args;
|
|
82
82
|
this.privatePackages = new Set();
|
|
83
|
-
this.args = args ? _objectSpread(
|
|
83
|
+
this.args = args ? _objectSpread({}, args, {
|
|
84
84
|
output: args.output.substr(-1) === '/' ? args.output.substr(0, args.output.length) : args.output
|
|
85
85
|
}) : {}; // args || {}
|
|
86
86
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
"helminit-scaler": "src/helminit-scaler",
|
|
30
30
|
"helmup": "src/helmup",
|
|
31
31
|
"k8x": "src/k8x",
|
|
32
|
+
"npm-link": "src/npm-link",
|
|
33
|
+
"npm-unlink": "src/npm-unlink",
|
|
32
34
|
"overwhelm": "src/overwhelm",
|
|
33
35
|
"packleate": "lib/web/packleate/index.js",
|
|
34
36
|
"pkgck": "src/pkgck",
|
package/src/circleate
CHANGED
|
@@ -475,73 +475,66 @@ EOCIRCLE
|
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
create_ui_config(){
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
478
|
+
cat<<FIREBASEINFO
|
|
479
|
+
|
|
480
|
+
You need to setup Firebase hosting using the cli tool before configuring CI.
|
|
481
|
+
Please make sure .firebaserc and firebase.json are configured with targets set like:
|
|
481
482
|
|
|
482
|
-
|
|
483
|
-
|
|
483
|
+
{
|
|
484
|
+
"projects": {
|
|
485
|
+
"default": "leverege-jumpstart"
|
|
486
|
+
},
|
|
487
|
+
"targets": {
|
|
488
|
+
"leverege-jumpstart": {
|
|
489
|
+
"hosting": {
|
|
490
|
+
"unique-target-name": [
|
|
491
|
+
"target-name-on-firebase-console"
|
|
492
|
+
]
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
484
497
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
498
|
+
You can add target using:
|
|
499
|
+
|
|
500
|
+
$ firebase target:apply hosting <unique-target-name> <target-name-on-firebase-console>
|
|
501
|
+
|
|
502
|
+
(See https://firebase.google.com/docs/hosting/quickstart for more info)
|
|
503
|
+
|
|
504
|
+
Enter "yes" if everything is set up & ready to go.
|
|
505
|
+
|
|
506
|
+
FIREBASEINFO
|
|
488
507
|
|
|
489
|
-
|
|
490
|
-
|
|
508
|
+
read ANS && [ "$ANS" != "yes" ] && exit 1
|
|
509
|
+
|
|
510
|
+
# Determine dev environment
|
|
511
|
+
printf "\n\nCommits to the dev branch will trigger deployment approval to the dev site.\n"
|
|
512
|
+
printf "\nPlease provide the Firebase Project name to be used for dev/testing UI: "
|
|
513
|
+
read DEV_PROJ
|
|
514
|
+
|
|
515
|
+
printf "\nPlease provide the host target for the dev site (target name in .firebaserc): "
|
|
516
|
+
read DEV_TARGET
|
|
517
|
+
|
|
518
|
+
# Determine prod environment
|
|
519
|
+
printf "\nPlease provide the Firebase Project name to be used for production UI: "
|
|
520
|
+
read PRD_PROJ
|
|
521
|
+
|
|
522
|
+
# Determine GCP project
|
|
523
|
+
printf "\nPlease provide the host target for the production site (target name in .firebaserc): "
|
|
524
|
+
read PRD_TARGET
|
|
491
525
|
|
|
492
526
|
# Build circle config based on variables
|
|
493
527
|
cat<<EOCIRCLE > config.yml
|
|
494
528
|
version: 2.1
|
|
495
529
|
orbs:
|
|
496
|
-
|
|
497
|
-
executors:
|
|
498
|
-
google:
|
|
499
|
-
description: The official Google docker container with gcloud SDK pre-installed
|
|
500
|
-
docker:
|
|
501
|
-
- image: google/cloud-sdk
|
|
530
|
+
slack: circleci/slack@3.4.2
|
|
502
531
|
|
|
503
532
|
jobs:
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
# https://gist.github.com/DarrenN/8c6a5b969481725a4413
|
|
510
|
-
- run: |
|
|
511
|
-
echo "export PACKAGE_VERSION=v\$(grep -m1 version package.json | awk -F: '{ print \$2 }' | sed 's/[", ]//g')" >> \$BASH_ENV
|
|
512
|
-
- gcp-gcr/initialize
|
|
513
|
-
- run: |
|
|
514
|
-
gsutil mb gs://\$PACKAGE_VERSION.$DEV_URL
|
|
515
|
-
gsutil -m cp -r ./project/image/* gs://\$PACKAGE_VERSION.$DEV_URL
|
|
516
|
-
gsutil setmeta -h "Content-Encoding:gzip" gs://\$PACKAGE_VERSION.$DEV_URL/bundle.js
|
|
517
|
-
gsutil iam ch allUsers:objectViewer gs://$DEV_URL
|
|
518
|
-
- run: |
|
|
519
|
-
gsutil mb gs://$DEV_URL
|
|
520
|
-
gsutil -m rm gs://$DEV_URL/**
|
|
521
|
-
gsutil -m cp -r gs://\$PACKAGE_VERSION.$DEV_URL/* gs://$DEV_URL
|
|
522
|
-
gsutil setmeta -h "Content-Encoding:gzip" gs://$DEV_URL/bundle.js
|
|
523
|
-
gsutil iam ch allUsers:objectViewer gs://$DEV_URL
|
|
524
|
-
|
|
525
|
-
gcs-prod:
|
|
526
|
-
executor: google
|
|
527
|
-
steps:
|
|
528
|
-
- attach_workspace:
|
|
529
|
-
at: ~/project
|
|
530
|
-
# https://gist.github.com/DarrenN/8c6a5b969481725a4413
|
|
531
|
-
- run: |
|
|
532
|
-
echo "export PACKAGE_VERSION=v\$(grep -m1 version package.json | awk -F: '{ print \$2 }' | sed 's/[", ]//g')" >> \$BASH_ENV
|
|
533
|
-
- gcp-gcr/initialize
|
|
534
|
-
- run: |
|
|
535
|
-
gsutil mb gs://\$PACKAGE_VERSION.$PROD_URL
|
|
536
|
-
gsutil -m cp -r ./project/image/* gs://\$PACKAGE_VERSION.$PROD_URL
|
|
537
|
-
gsutil setmeta -h "Content-Encoding:gzip" gs://\$PACKAGE_VERSION.$PROD_URL/bundle.js
|
|
538
|
-
gsutil iam ch allUsers:objectViewer gs://$PROD_URL
|
|
539
|
-
- run: |
|
|
540
|
-
gsutil mb gs://$PROD_URL
|
|
541
|
-
gsutil -m rm gs://$PROD_URL/**
|
|
542
|
-
gsutil -m cp -r gs://\$PACKAGE_VERSION.$PROD_URL/* gs://$PROD_URL
|
|
543
|
-
gsutil setmeta -h "Content-Encoding:gzip" gs://$PROD_URL/bundle.js
|
|
544
|
-
gsutil iam ch allUsers:objectViewer gs://$PROD_URL
|
|
533
|
+
status:
|
|
534
|
+
docker:
|
|
535
|
+
- image: cimg/base:2020.01
|
|
536
|
+
steps:
|
|
537
|
+
- slack/status
|
|
545
538
|
|
|
546
539
|
build:
|
|
547
540
|
docker:
|
|
@@ -564,30 +557,40 @@ jobs:
|
|
|
564
557
|
paths:
|
|
565
558
|
- ./node_modules
|
|
566
559
|
|
|
567
|
-
- run:
|
|
568
|
-
name: Install license-checker
|
|
569
|
-
command: npm install license-checker
|
|
570
|
-
|
|
571
|
-
- run:
|
|
572
|
-
name: Check for license violations (e.g. GPL)
|
|
573
|
-
command: npm run licenseCheck
|
|
574
|
-
|
|
575
560
|
- run:
|
|
576
561
|
name: Bundle using webpack
|
|
577
562
|
command: |
|
|
578
563
|
npm run clean
|
|
579
564
|
npm run build
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
cp -fr ./dist/* ./image/
|
|
583
|
-
gzip ./image/bundle.js
|
|
584
|
-
mv ./image/bundle.js.gz ./image/bundle.js
|
|
565
|
+
gzip ./dist/bundle.js
|
|
566
|
+
mv ./dist/bundle.js.gz ./dist/bundle.js
|
|
585
567
|
|
|
586
568
|
- persist_to_workspace:
|
|
587
569
|
root: ~/project
|
|
588
570
|
paths:
|
|
589
|
-
-
|
|
590
|
-
|
|
571
|
+
- dist
|
|
572
|
+
|
|
573
|
+
deploy-dev:
|
|
574
|
+
docker:
|
|
575
|
+
- image: circleci/node:erbium
|
|
576
|
+
steps:
|
|
577
|
+
- attach_workspace:
|
|
578
|
+
at: ~/project
|
|
579
|
+
- run: npm install -g firebase-tools
|
|
580
|
+
- run:
|
|
581
|
+
name: Deploy to dev site
|
|
582
|
+
command: firebase use $DEV_PROJ && firebase deploy --token "\$FIREBASE_TOKEN" --only hosting:$DEV_TARGET
|
|
583
|
+
|
|
584
|
+
deploy-prod:
|
|
585
|
+
docker:
|
|
586
|
+
- image: circleci/node:erbium
|
|
587
|
+
steps:
|
|
588
|
+
- attach_workspace:
|
|
589
|
+
at: ~/project
|
|
590
|
+
- run: npm install -g firebase-tools
|
|
591
|
+
- run:
|
|
592
|
+
name: Deploy to dev site
|
|
593
|
+
command: firebase use $PRD_PROJ && firebase deploy --token "\$FIREBASE_TOKEN" --only hosting:$PRD_TARGET
|
|
591
594
|
|
|
592
595
|
workflows:
|
|
593
596
|
version: 2.1
|
|
@@ -595,13 +598,21 @@ workflows:
|
|
|
595
598
|
jobs:
|
|
596
599
|
- build:
|
|
597
600
|
context: npm
|
|
598
|
-
-
|
|
599
|
-
context:
|
|
601
|
+
- slack/approval-notification:
|
|
602
|
+
context: slack
|
|
603
|
+
- deploy-dev:
|
|
604
|
+
context: firebase
|
|
605
|
+
type: approval
|
|
600
606
|
filters:
|
|
601
607
|
branches:
|
|
602
|
-
only:
|
|
608
|
+
only: development
|
|
603
609
|
requires:
|
|
604
610
|
- build
|
|
611
|
+
- status:
|
|
612
|
+
context: slack
|
|
613
|
+
requires:
|
|
614
|
+
- deploy-dev
|
|
615
|
+
|
|
605
616
|
build-deploy-prod:
|
|
606
617
|
jobs:
|
|
607
618
|
- build:
|
|
@@ -609,13 +620,20 @@ workflows:
|
|
|
609
620
|
filters:
|
|
610
621
|
branches:
|
|
611
622
|
only: master
|
|
612
|
-
-
|
|
613
|
-
context:
|
|
623
|
+
- slack/approval-notification:
|
|
624
|
+
context: slack
|
|
625
|
+
- deploy-prod:
|
|
626
|
+
context: firebase
|
|
627
|
+
type: approval
|
|
614
628
|
filters:
|
|
615
629
|
branches:
|
|
616
630
|
only: master
|
|
617
631
|
requires:
|
|
618
632
|
- build
|
|
633
|
+
- status:
|
|
634
|
+
context: slack
|
|
635
|
+
requires:
|
|
636
|
+
- deploy-prod
|
|
619
637
|
|
|
620
638
|
EOCIRCLE
|
|
621
639
|
}
|
package/src/npm-link
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Simple ANSI color coded string generator.
|
|
4
|
+
function color() {
|
|
5
|
+
local color=
|
|
6
|
+
case "$1" in
|
|
7
|
+
'g') color="92m" ;; # green
|
|
8
|
+
'c') color="96m" ;; # lt blue
|
|
9
|
+
'y') color="93m" ;; # yellow
|
|
10
|
+
'r') color="91m" ;; # red
|
|
11
|
+
'toast') color="1;3;7;91;103;5m" ;;
|
|
12
|
+
esac
|
|
13
|
+
printf "\e[$color$2\e[0m"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# Set LEVEREGE_MODULES to point to the directory containing the various
|
|
17
|
+
# local @leverege repositories that you want to link to for local testing.
|
|
18
|
+
#
|
|
19
|
+
[ -z "$LEVEREGE_MODULES" ] \
|
|
20
|
+
&& cat<<EXPECT && exit 1
|
|
21
|
+
|
|
22
|
+
Expecting the `color g "LEVEREGE_MODULES"` variable to be set to the location of the
|
|
23
|
+
directory containing the local `color y "@leverege"` git repositories to link to.
|
|
24
|
+
|
|
25
|
+
`color g "export LEVEREGE_MODULES=\""``color y "<your core @leverege repo directory>"``color g \"`
|
|
26
|
+
|
|
27
|
+
EXPECT
|
|
28
|
+
|
|
29
|
+
GITTOP=`git rev-parse --show-toplevel` && cd $GITTOP
|
|
30
|
+
HOLDING_CELL=".holding-cell"
|
|
31
|
+
|
|
32
|
+
MODULES="node_modules/@leverege"
|
|
33
|
+
[ ! -d $MODULES ] && \
|
|
34
|
+
cat<<NO_NODE_MODULES && exit 1
|
|
35
|
+
|
|
36
|
+
Missing $MODULES - maybe do an npm install first?
|
|
37
|
+
|
|
38
|
+
NO_NODE_MODULES
|
|
39
|
+
|
|
40
|
+
function linkTheModules() {
|
|
41
|
+
[ -z "$1" ] && return
|
|
42
|
+
MOVE_COUNT=0
|
|
43
|
+
for TARGET in $(find $MODULES -not \( -path \*$HOLDING_CELL -prune \) \
|
|
44
|
+
-type d -name $1)
|
|
45
|
+
do
|
|
46
|
+
# printf "`color y \"DEBUG: Linking $TARGET\"`\n"
|
|
47
|
+
|
|
48
|
+
LIBRARY=`basename $TARGET`
|
|
49
|
+
DUNGEON="`dirname $TARGET`/$HOLDING_CELL"
|
|
50
|
+
LOCALIB="$LEVEREGE_MODULES/$LIBRARY"
|
|
51
|
+
|
|
52
|
+
[ ! -d $LOCALIB ] && \
|
|
53
|
+
cat<<MISSING_LIB && continue
|
|
54
|
+
|
|
55
|
+
Skipping missing local library => $LOCALIB
|
|
56
|
+
You may need git clone it to link it.
|
|
57
|
+
|
|
58
|
+
MISSING_LIB
|
|
59
|
+
|
|
60
|
+
mkdir -p $DUNGEON
|
|
61
|
+
mv $TARGET $DUNGEON
|
|
62
|
+
ln -sf $LOCALIB $TARGET
|
|
63
|
+
MOVE_COUNT=$((MOVE_COUNT + 1 ))
|
|
64
|
+
done
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function showTheModules() {
|
|
68
|
+
if [ ! -d $MODULES/$HOLDING_CELL ];
|
|
69
|
+
then
|
|
70
|
+
cat<<NO_HOLDING_CELL
|
|
71
|
+
|
|
72
|
+
`color y "Zero linked libraries found."` Try using: `color g "npm-link <thing>"`
|
|
73
|
+
|
|
74
|
+
NO_HOLDING_CELL
|
|
75
|
+
return 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
cat<<IN_THE_CELLS
|
|
79
|
+
|
|
80
|
+
`color g "@leverege modules currently linked"`:
|
|
81
|
+
|
|
82
|
+
IN_THE_CELLS
|
|
83
|
+
|
|
84
|
+
for HELD in $(/bin/ls $MODULES/$HOLDING_CELL)
|
|
85
|
+
do
|
|
86
|
+
printf " => `color y $HELD`\n"
|
|
87
|
+
done
|
|
88
|
+
echo ""
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
echo ""
|
|
92
|
+
for LIBRARY in "$@"
|
|
93
|
+
do
|
|
94
|
+
if [ ! -d "$LEVEREGE_MODULES/$LIBRARY" ];
|
|
95
|
+
then
|
|
96
|
+
printf " Unknown library: `color r $LEVEREGE_MODULES/$LIBRARY`\n"
|
|
97
|
+
continue
|
|
98
|
+
fi
|
|
99
|
+
linkTheModules $LIBRARY
|
|
100
|
+
done
|
|
101
|
+
|
|
102
|
+
showTheModules
|
package/src/npm-unlink
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Simple ANSI color coded string generator.
|
|
4
|
+
function color() {
|
|
5
|
+
local color=
|
|
6
|
+
case "$1" in
|
|
7
|
+
'g') color="92m" ;; # green
|
|
8
|
+
'c') color="96m" ;; # lt blue
|
|
9
|
+
'y') color="93m" ;; # yellow
|
|
10
|
+
'r') color="91m" ;; # red
|
|
11
|
+
'toast') color="1;3;7;91;103;5m" ;;
|
|
12
|
+
esac
|
|
13
|
+
printf "\e[$color$2\e[0m"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# Set LEVEREGE_MODULES to point to the directory containing the various
|
|
17
|
+
# local @leverege repositories that you want to link to for local testing.
|
|
18
|
+
#
|
|
19
|
+
[ -z "$LEVEREGE_MODULES" ] \
|
|
20
|
+
&& cat<<EXPECT && exit 1
|
|
21
|
+
|
|
22
|
+
Expecting LEVEREGE_MODULES variable to be set to the directory containing
|
|
23
|
+
the local @leverege repositories to test with
|
|
24
|
+
|
|
25
|
+
export LEVEREGE_MODULES="<your @leverege subdir>".
|
|
26
|
+
|
|
27
|
+
EXPECT
|
|
28
|
+
|
|
29
|
+
GITTOP=`git rev-parse --show-toplevel` && cd $GITTOP
|
|
30
|
+
HOLDING_CELL=".holding-cell"
|
|
31
|
+
|
|
32
|
+
MODULES="node_modules/@leverege"
|
|
33
|
+
[ ! -d "$MODULES/$HOLDING_CELL" ] && exit 1
|
|
34
|
+
|
|
35
|
+
for CELLS in $(find $MODULES -type d -depth -name $HOLDING_CELL)
|
|
36
|
+
do
|
|
37
|
+
printf "\n Cleaning out cell: `color g $CELLS`\n"
|
|
38
|
+
for LIB in $CELLS/*
|
|
39
|
+
do
|
|
40
|
+
LIBRARY=`basename $LIB`
|
|
41
|
+
DUNGEON=`dirname $LIB`
|
|
42
|
+
[ ! -L "$DUNGEON/../$LIBRARY" ] && \
|
|
43
|
+
cat<<MISSING_LIB && continue
|
|
44
|
+
|
|
45
|
+
Not seeing a symlink for $LIBRARY - are you certain you linked it?
|
|
46
|
+
|
|
47
|
+
MISSING_LIB
|
|
48
|
+
printf " Unlinking library: `color y $LIB`\n"
|
|
49
|
+
rm -f "$DUNGEON/../$LIBRARY"
|
|
50
|
+
mv $LIB "$DUNGEON/.."
|
|
51
|
+
done
|
|
52
|
+
rmdir $DUNGEON
|
|
53
|
+
done
|
|
54
|
+
echo ""
|