@peterseibel/hug 0.1.6 → 0.1.7
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 +8 -3
- package/bin/hug +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,12 +104,17 @@ hug deployments
|
|
|
104
104
|
|
|
105
105
|
## Branch-per-environment pattern
|
|
106
106
|
|
|
107
|
-
Use `hug fork` with git branches to maintain separate
|
|
107
|
+
Use `hug fork` and `hug config` combined with git branches to maintain separate
|
|
108
|
+
Apps Script projects. Write code to use config values (e.g. using
|
|
109
|
+
`SPREADSHEET_ID` to a spreadsheet the script should use) rather than using
|
|
110
|
+
container-bound projects and then different branches can use different AppScript
|
|
111
|
+
projects each configured with separate resources as needed. And shared resources
|
|
112
|
+
can be shared by simply using the same config values.
|
|
108
113
|
|
|
109
114
|
```bash
|
|
110
|
-
git
|
|
115
|
+
git switch -c staging
|
|
111
116
|
hug fork # new Apps Script project, updates .clasp.json
|
|
112
117
|
hug config set SPREADSHEET_ID=1Bx.. # point at a staging spreadsheet
|
|
113
118
|
hug deploy # deploys to the staging project
|
|
114
|
-
git
|
|
119
|
+
git switch main # .clasp.json and config.js switch back to production
|
|
115
120
|
```
|
package/bin/hug
CHANGED
|
@@ -27,7 +27,7 @@ Project commands:
|
|
|
27
27
|
Development commands:
|
|
28
28
|
push Push local files to Apps Script
|
|
29
29
|
pull [-f|--force] Pull remote files (refuses if uncommitted changes)
|
|
30
|
-
open
|
|
30
|
+
open [--container] Open the project script (or container)
|
|
31
31
|
|
|
32
32
|
Configuration:
|
|
33
33
|
config List config values
|
|
@@ -287,6 +287,7 @@ _write_config() {
|
|
|
287
287
|
fi
|
|
288
288
|
|
|
289
289
|
cat > config.js <<EOF
|
|
290
|
+
// No need to export as all .gs files are loaded into the same namespace
|
|
290
291
|
const CONFIG = {
|
|
291
292
|
${entries}};
|
|
292
293
|
EOF
|
|
@@ -421,7 +422,16 @@ cmd_pull() {
|
|
|
421
422
|
|
|
422
423
|
cmd_open() {
|
|
423
424
|
local clasp; clasp=$(find_clasp)
|
|
424
|
-
|
|
425
|
+
if [[ "${1:-}" == "--container" ]]; then
|
|
426
|
+
shift
|
|
427
|
+
if ! grep -q '"parentId"' .clasp.json 2>/dev/null; then
|
|
428
|
+
echo "Error: this project is not container-bound (no parentId in .clasp.json)" >&2
|
|
429
|
+
exit 1
|
|
430
|
+
fi
|
|
431
|
+
run_clasp "$clasp" open-container "$@"
|
|
432
|
+
else
|
|
433
|
+
run_clasp "$clasp" open-script "$@"
|
|
434
|
+
fi
|
|
425
435
|
}
|
|
426
436
|
|
|
427
437
|
cmd_versions() {
|