@git.zone/cli 9.2.2 → 10.0.0
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/assets/templates/asset_binary_installer/install.sh +109 -34
- package/assets/templates/asset_binary_release_gitea/.gitea/workflows/release.yml +17 -4
- package/assets/templates/ci_rust/.gitea/workflows/rust_nottags.yaml +29 -0
- package/assets/templates/ci_rust/.gitea/workflows/rust_tags.yaml +32 -0
- package/assets/templates/gitignore/_gitignore +1 -1
- package/assets/templates/gitignore_rust/_gitignore +31 -0
- package/assets/templates/license_mit/license +4 -1
- package/assets/templates/rust/.smartscaf.yml +16 -0
- package/assets/templates/rust/_Cargo.toml +12 -0
- package/assets/templates/rust/_crate_Cargo.toml +10 -0
- package/assets/templates/rust/_crate_lib.rs +19 -0
- package/assets/templates/rust/_smartconfig.json +27 -0
- package/assets/templates/rust/readme.md +23 -0
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/classes.gitzoneconfig.d.ts +3 -1
- package/dist_ts/classes.gitzoneconfig.js +9 -1
- package/dist_ts/helpers.managedassets.d.ts +1 -1
- package/dist_ts/helpers.managedassets.js +58 -14
- package/dist_ts/helpers.releasetargets.d.ts +6 -0
- package/dist_ts/helpers.releasetargets.js +13 -0
- package/dist_ts/helpers.smartconfigmigrations.js +42 -1
- package/dist_ts/helpers.toolconfig.d.ts +50 -0
- package/dist_ts/helpers.toolconfig.js +212 -0
- package/dist_ts/helpers.tssea.d.ts +9 -2
- package/dist_ts/helpers.tssea.js +47 -17
- package/dist_ts/helpers.tstest.d.ts +27 -8
- package/dist_ts/helpers.tstest.js +64 -26
- package/dist_ts/helpers.versionsource.d.ts +37 -0
- package/dist_ts/helpers.versionsource.js +112 -0
- package/dist_ts/helpers.workflow.d.ts +45 -1
- package/dist_ts/helpers.workflow.js +120 -5
- package/dist_ts/mod_commit/mod.helpers.d.ts +0 -24
- package/dist_ts/mod_commit/mod.helpers.js +1 -94
- package/dist_ts/mod_config/index.js +131 -18
- package/dist_ts/mod_format/formatters/assets.formatter.js +29 -27
- package/dist_ts/mod_format/formatters/gitignore.formatter.d.ts +4 -2
- package/dist_ts/mod_format/formatters/gitignore.formatter.js +10 -7
- package/dist_ts/mod_format/formatters/license.formatter.d.ts +8 -0
- package/dist_ts/mod_format/formatters/license.formatter.js +25 -2
- package/dist_ts/mod_format/formatters/packagejson.formatter.js +14 -3
- package/dist_ts/mod_format/formatters/rustfmt.formatter.d.ts +19 -0
- package/dist_ts/mod_format/formatters/rustfmt.formatter.js +97 -0
- package/dist_ts/mod_format/formatters/smartconfig.formatter.js +5 -2
- package/dist_ts/mod_format/index.js +3 -1
- package/dist_ts/mod_format/interfaces.format.js +2 -1
- package/dist_ts/mod_release/classes.releasejournal.d.ts +38 -2
- package/dist_ts/mod_release/classes.releasejournal.js +238 -66
- package/dist_ts/mod_release/helpers.cargorelease.d.ts +52 -0
- package/dist_ts/mod_release/helpers.cargorelease.js +195 -0
- package/dist_ts/mod_release/helpers.npmpackages.d.ts +18 -0
- package/dist_ts/mod_release/helpers.npmpackages.js +40 -2
- package/dist_ts/mod_release/helpers.releasecheck.d.ts +73 -0
- package/dist_ts/mod_release/helpers.releasecheck.js +269 -0
- package/dist_ts/mod_release/helpers.releasepreparation.d.ts +22 -8
- package/dist_ts/mod_release/helpers.releasepreparation.js +74 -26
- package/dist_ts/mod_release/helpers.releasepublication.d.ts +21 -1
- package/dist_ts/mod_release/helpers.releasepublication.js +249 -4
- package/dist_ts/mod_release/helpers.releaseversionsource.d.ts +10 -0
- package/dist_ts/mod_release/helpers.releaseversionsource.js +18 -0
- package/dist_ts/mod_release/helpers.rsrepoengine.d.ts +192 -0
- package/dist_ts/mod_release/helpers.rsrepoengine.js +457 -0
- package/dist_ts/mod_release/index.d.ts +3 -0
- package/dist_ts/mod_release/index.js +177 -65
- package/dist_ts/mod_template/index.js +6 -2
- package/package.json +1 -1
- package/readme.md +237 -21
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.gitzoneconfig.ts +10 -1
- package/ts/helpers.managedassets.ts +64 -14
- package/ts/helpers.releasetargets.ts +13 -0
- package/ts/helpers.smartconfigmigrations.ts +48 -0
- package/ts/helpers.toolconfig.ts +280 -0
- package/ts/helpers.tssea.ts +59 -16
- package/ts/helpers.tstest.ts +105 -35
- package/ts/helpers.versionsource.ts +169 -0
- package/ts/helpers.workflow.ts +197 -5
- package/ts/mod_commit/mod.helpers.ts +0 -119
- package/ts/mod_config/index.ts +169 -19
- package/ts/mod_format/formatters/assets.formatter.ts +28 -27
- package/ts/mod_format/formatters/gitignore.formatter.ts +10 -6
- package/ts/mod_format/formatters/license.formatter.ts +26 -1
- package/ts/mod_format/formatters/packagejson.formatter.ts +14 -2
- package/ts/mod_format/formatters/rustfmt.formatter.ts +107 -0
- package/ts/mod_format/formatters/smartconfig.formatter.ts +8 -1
- package/ts/mod_format/index.ts +2 -0
- package/ts/mod_format/interfaces.format.ts +1 -0
- package/ts/mod_release/classes.releasejournal.ts +312 -39
- package/ts/mod_release/helpers.cargorelease.ts +289 -0
- package/ts/mod_release/helpers.npmpackages.ts +76 -1
- package/ts/mod_release/helpers.releasecheck.ts +409 -0
- package/ts/mod_release/helpers.releasepreparation.ts +116 -36
- package/ts/mod_release/helpers.releasepublication.ts +462 -1
- package/ts/mod_release/helpers.releaseversionsource.ts +29 -0
- package/ts/mod_release/helpers.rsrepoengine.ts +790 -0
- package/ts/mod_release/index.ts +277 -84
- package/ts/mod_template/index.ts +5 -1
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Managed by @git.zone/cli from assets/templates/asset_binary_installer. Do not edit by hand.
|
|
3
3
|
|
|
4
|
+
# The installer is the function main, called only by the last line. Bash defines a function only once it has
|
|
5
|
+
# read its closing brace, and runs the { ...; } group of the last line only once it has read that group's brace,
|
|
6
|
+
# so a download that ends early (curl piping a truncated file into sudo bash) runs nothing.
|
|
7
|
+
main() {
|
|
4
8
|
set -euo pipefail
|
|
5
9
|
|
|
6
10
|
SHOW_HELP=0
|
|
7
11
|
DRY_RUN=0
|
|
8
12
|
SPECIFIED_VERSION=""
|
|
13
|
+
{{#if installer.supportsMajor}}
|
|
9
14
|
SPECIFIED_MAJOR=""
|
|
15
|
+
{{/if}}
|
|
10
16
|
INSTALL_DIR="{{installer.installDir}}"
|
|
11
17
|
BIN_DIR="{{installer.binDir}}"
|
|
12
18
|
INSTALL_MODE="{{installer.defaultMode}}"
|
|
@@ -14,6 +20,11 @@ GITEA_BASE_URL="https://{{repository.host}}"
|
|
|
14
20
|
GITEA_REPO="{{repository.path}}"
|
|
15
21
|
REPO_URL="{{{repository.gitUrl}}}"
|
|
16
22
|
SERVICE_RESTART_NAME="{{installer.service.restartName}}"
|
|
23
|
+
{{#if installer.service.hasRefreshCommand}}
|
|
24
|
+
# Runs after an update while the service was running, with $BIN_DIR first on PATH; it is expanded only then.
|
|
25
|
+
# shellcheck disable=SC2016
|
|
26
|
+
REFRESH_COMMAND={{{installer.service.refreshCommandShellWord}}}
|
|
27
|
+
{{/if}}
|
|
17
28
|
PRIMARY_PRESERVE_PATH="{{installer.primaryPreservePath}}"
|
|
18
29
|
|
|
19
30
|
# Every transfer is an HTTPS release asset or the Gitea API: no other protocol, also not on a redirect,
|
|
@@ -147,16 +158,36 @@ elif [[ -n "$SPECIFIED_VERSION" ]]; then
|
|
|
147
158
|
SPECIFIED_VERSION=$(normalize_release_tag "$SPECIFIED_VERSION" "--version argument") || exit 1
|
|
148
159
|
fi
|
|
149
160
|
|
|
161
|
+
{{#if installer.supportsMajor}}
|
|
150
162
|
if [[ -n "$SPECIFIED_VERSION" && -n "$SPECIFIED_MAJOR" ]]; then
|
|
151
163
|
echo "Error: --version and --major are mutually exclusive"
|
|
152
164
|
exit 1
|
|
153
165
|
fi
|
|
154
166
|
|
|
155
|
-
if [[ -n "$SPECIFIED_MAJOR" ]] && ! matches_ascii_pattern "$SPECIFIED_MAJOR" '^[0-9]
|
|
156
|
-
echo "Error: --major must be a
|
|
167
|
+
if [[ -n "$SPECIFIED_MAJOR" ]] && ! matches_ascii_pattern "$SPECIFIED_MAJOR" '^(0|[1-9][0-9]*)$'; then
|
|
168
|
+
echo "Error: --major must be a major version number, for example: --major 1"
|
|
157
169
|
exit 1
|
|
158
170
|
fi
|
|
159
171
|
|
|
172
|
+
{{/if}}
|
|
173
|
+
# Git Bash, MSYS2 and Cygwin have no root, no systemd and no Windows PATH entry for /usr/local/bin, so this
|
|
174
|
+
# installer cannot install there; the release carries the Windows executable as a download of its own.
|
|
175
|
+
case "$(uname -s)" in
|
|
176
|
+
MINGW*|MSYS*|CYGWIN*)
|
|
177
|
+
echo "Error: install.sh installs {{displayName}} on Linux and macOS only; it does not install on Windows." >&2
|
|
178
|
+
{{#if binary.hasWindowsTargets}}
|
|
179
|
+
echo "Download the Windows executable from the release page instead: ${GITEA_BASE_URL}/${GITEA_REPO}/releases" >&2
|
|
180
|
+
{{#each binary.windowsTargets}}
|
|
181
|
+
echo " ${GITEA_BASE_URL}/${GITEA_REPO}/releases/download/${SPECIFIED_VERSION:-latest}/{{name}}" >&2
|
|
182
|
+
{{/each}}
|
|
183
|
+
echo "Compare its SHA-256 with the release's SHA256SUMS.txt before running it." >&2
|
|
184
|
+
{{else}}
|
|
185
|
+
echo "{{displayName}} releases carry no Windows executable. Supported platforms: {{binary.installerPlatformText}}" >&2
|
|
186
|
+
{{/if}}
|
|
187
|
+
exit 1
|
|
188
|
+
;;
|
|
189
|
+
esac
|
|
190
|
+
|
|
160
191
|
if [[ $DRY_RUN -eq 0 && "$EUID" -ne 0 ]]; then
|
|
161
192
|
echo "Please run as root (sudo bash install.sh or pipe to sudo bash)"
|
|
162
193
|
exit 1
|
|
@@ -209,24 +240,38 @@ get_latest_version() {
|
|
|
209
240
|
}
|
|
210
241
|
|
|
211
242
|
{{#if installer.supportsMajor}}
|
|
243
|
+
# Prints the tag of the newest published release (no draft, no pre-release) of a major version. The releases
|
|
244
|
+
# API lists the newest first, 50 per page; one tag_name field per release, JSON-escaped quotes never match.
|
|
212
245
|
get_latest_major_version() {
|
|
213
246
|
local major="$1"
|
|
214
|
-
|
|
215
|
-
local api_url
|
|
247
|
+
local page=1
|
|
248
|
+
local api_url
|
|
216
249
|
local response
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
250
|
+
local tags
|
|
251
|
+
local tag
|
|
252
|
+
echo "Fetching the newest v${major}.x release from Gitea..." >&2
|
|
253
|
+
while [[ $page -le 100 ]]; do
|
|
254
|
+
api_url="${GITEA_BASE_URL}/api/v1/repos/${GITEA_REPO}/releases?draft=false&pre-release=false&limit=50&page=${page}"
|
|
255
|
+
if ! response=$(curl "${CURL_OPTS[@]}" -fsSL "$api_url" 2>/dev/null); then
|
|
256
|
+
echo "Error: Failed to fetch the release list from the Gitea API" >&2
|
|
257
|
+
echo "URL: $api_url" >&2
|
|
258
|
+
exit 1
|
|
259
|
+
fi
|
|
260
|
+
tags=$(printf '%s' "$response" | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"\([^"]*\)"$/\1/') || true
|
|
261
|
+
if [[ -z "$tags" ]]; then
|
|
262
|
+
break
|
|
263
|
+
fi
|
|
264
|
+
while IFS= read -r tag; do
|
|
265
|
+
if matches_ascii_pattern "$tag" "^v?${major}\\."; then
|
|
266
|
+
normalize_release_tag "$tag" "tag_name from the Gitea releases API"
|
|
267
|
+
return 0
|
|
268
|
+
fi
|
|
269
|
+
done <<< "$tags"
|
|
270
|
+
page=$((page + 1))
|
|
271
|
+
done
|
|
272
|
+
echo "Error: no published v${major}.x release found" >&2
|
|
273
|
+
echo "URL: ${GITEA_BASE_URL}/${GITEA_REPO}/releases" >&2
|
|
274
|
+
exit 1
|
|
230
275
|
}
|
|
231
276
|
|
|
232
277
|
{{/if}}
|
|
@@ -241,10 +286,9 @@ detect_binary_name() {
|
|
|
241
286
|
case "$os" in
|
|
242
287
|
Linux) os_name="linux" ;;
|
|
243
288
|
Darwin) os_name="macos" ;;
|
|
244
|
-
MINGW*|MSYS*|CYGWIN*) os_name="windows" ;;
|
|
245
289
|
*)
|
|
246
290
|
echo "Error: Unsupported operating system: $os" >&2
|
|
247
|
-
echo "Supported platforms: {{binary.
|
|
291
|
+
echo "Supported platforms: {{binary.installerPlatformText}}" >&2
|
|
248
292
|
{{#if installer.source.enabled}}
|
|
249
293
|
echo "Use --source to build locally on this platform." >&2
|
|
250
294
|
{{/if}}
|
|
@@ -257,7 +301,7 @@ detect_binary_name() {
|
|
|
257
301
|
aarch64|arm64) arch_name="arm64" ;;
|
|
258
302
|
*)
|
|
259
303
|
echo "Error: Unsupported architecture: $arch" >&2
|
|
260
|
-
echo "Supported platforms: {{binary.
|
|
304
|
+
echo "Supported platforms: {{binary.installerPlatformText}}" >&2
|
|
261
305
|
{{#if installer.source.enabled}}
|
|
262
306
|
echo "Use --source to build locally on this architecture." >&2
|
|
263
307
|
{{/if}}
|
|
@@ -266,12 +310,12 @@ detect_binary_name() {
|
|
|
266
310
|
esac
|
|
267
311
|
|
|
268
312
|
case "${os_name}-${arch_name}" in
|
|
269
|
-
{{#each binary.
|
|
313
|
+
{{#each binary.installerTargets}}
|
|
270
314
|
{{os}}-{{arch}}) echo "{{name}}" ;;
|
|
271
315
|
{{/each}}
|
|
272
316
|
*)
|
|
273
317
|
echo "Error: Unsupported platform: ${os_name}-${arch_name}" >&2
|
|
274
|
-
echo "Supported platforms: {{binary.
|
|
318
|
+
echo "Supported platforms: {{binary.installerPlatformText}}" >&2
|
|
275
319
|
{{#if installer.source.enabled}}
|
|
276
320
|
echo "Use --source to build locally on this platform." >&2
|
|
277
321
|
{{/if}}
|
|
@@ -284,7 +328,7 @@ detect_binary_name() {
|
|
|
284
328
|
select_notice_files() {
|
|
285
329
|
NOTICE_FILES=()
|
|
286
330
|
case "$1" in
|
|
287
|
-
{{#each binary.
|
|
331
|
+
{{#each binary.installerTargets}}
|
|
288
332
|
"{{name}}")
|
|
289
333
|
{{#each noticeFiles}}
|
|
290
334
|
NOTICE_FILES+=("{{this}}")
|
|
@@ -407,7 +451,10 @@ echo "Install mode: $INSTALL_MODE"
|
|
|
407
451
|
echo ""
|
|
408
452
|
|
|
409
453
|
TEMP_DIR=$(mktemp -d)
|
|
454
|
+
{{#if installer.source.enabled}}
|
|
410
455
|
SOURCE_DIR="$TEMP_DIR/source"
|
|
456
|
+
{{/if}}
|
|
457
|
+
BACKUP_PARENT=""
|
|
411
458
|
BACKUP_DIR=""
|
|
412
459
|
INSTALL_REPLACED=0
|
|
413
460
|
SERVICE_WAS_RUNNING=0
|
|
@@ -458,6 +505,7 @@ restore_previous_installation() {
|
|
|
458
505
|
echo "Error: could not restore $BACKUP_DIR to $INSTALL_DIR; restore it by hand" >&2
|
|
459
506
|
return 1
|
|
460
507
|
fi
|
|
508
|
+
rmdir "$BACKUP_PARENT" || true
|
|
461
509
|
if [[ -f "$INSTALL_DIR/{{binary.installFileName}}" ]]; then
|
|
462
510
|
mkdir -p "$BIN_DIR" || true
|
|
463
511
|
ln -sf "$INSTALL_DIR/{{binary.installFileName}}" "$BIN_DIR/{{cliName}}" || true
|
|
@@ -546,7 +594,10 @@ remove_legacy_services() {
|
|
|
546
594
|
move_previous_installation() {
|
|
547
595
|
mkdir -p "$(dirname "$INSTALL_DIR")" || abort_update "could not create the parent directory of $INSTALL_DIR"
|
|
548
596
|
if [[ -d "$INSTALL_DIR" ]]; then
|
|
549
|
-
|
|
597
|
+
# A directory of its own, so an earlier run's leftover backup (a crash, a reused pid) is never merged into
|
|
598
|
+
# or deleted with this one; it sits beside the installation, on the same file system.
|
|
599
|
+
BACKUP_PARENT=$(mktemp -d "${INSTALL_DIR}.previous.XXXXXX") || abort_update "could not create a backup directory beside $INSTALL_DIR"
|
|
600
|
+
BACKUP_DIR="$BACKUP_PARENT/$(basename "$INSTALL_DIR")"
|
|
550
601
|
echo "Moving previous installation to $BACKUP_DIR"
|
|
551
602
|
mv "$INSTALL_DIR" "$BACKUP_DIR" || abort_update "could not move $INSTALL_DIR aside"
|
|
552
603
|
fi
|
|
@@ -669,6 +720,8 @@ install_release_binary() {
|
|
|
669
720
|
move_previous_installation
|
|
670
721
|
|
|
671
722
|
echo "Installing binary to $INSTALL_DIR"
|
|
723
|
+
# abort_update exits, so the chain is an if-then.
|
|
724
|
+
# shellcheck disable=SC2015
|
|
672
725
|
mkdir -p "$INSTALL_DIR" \
|
|
673
726
|
&& install -m 0755 "$temp_file" "$INSTALL_DIR/{{binary.installFileName}}" \
|
|
674
727
|
&& install_notice_files "$notice_dir" \
|
|
@@ -692,10 +745,10 @@ install_source_build() {
|
|
|
692
745
|
(
|
|
693
746
|
trap 'echo "Error: building or checking {{displayName}} $VERSION from source failed; the current installation is untouched" >&2' ERR
|
|
694
747
|
cd "$SOURCE_DIR"
|
|
695
|
-
{{#each installer.source.
|
|
696
|
-
{{{this}}}
|
|
748
|
+
{{#each installer.source.commandShellWords}}
|
|
749
|
+
eval {{{this}}}
|
|
697
750
|
{{/each}}
|
|
698
|
-
{{{installer.source.
|
|
751
|
+
eval {{{installer.source.validateCommandShellWord}}}
|
|
699
752
|
)
|
|
700
753
|
|
|
701
754
|
stop_service_if_running
|
|
@@ -704,6 +757,8 @@ install_source_build() {
|
|
|
704
757
|
echo "Installing source build to $INSTALL_DIR"
|
|
705
758
|
mv "$SOURCE_DIR" "$INSTALL_DIR" || abort_update "could not install the source build to $INSTALL_DIR"
|
|
706
759
|
# Every listed executable must exist in the build: a missing one is a configuration or build defect.
|
|
760
|
+
# The configured list may have a single entry.
|
|
761
|
+
# shellcheck disable=SC2043
|
|
707
762
|
for executable_file in{{#each installer.source.executableFiles}} "{{this}}"{{/each}}; do
|
|
708
763
|
if [[ ! -f "$INSTALL_DIR/$executable_file" ]]; then
|
|
709
764
|
abort_update "the source build has no $executable_file, which installer.modes.source.executableFiles lists"
|
|
@@ -733,6 +788,7 @@ install_source_build() {
|
|
|
733
788
|
fi
|
|
734
789
|
chmod "${extra_rest%%:*}" "$INSTALL_DIR/$extra_name" || abort_update "could not set the mode of $INSTALL_DIR/$extra_name"
|
|
735
790
|
done
|
|
791
|
+
# shellcheck disable=SC2015
|
|
736
792
|
mkdir -p "$BIN_DIR" \
|
|
737
793
|
&& ln -sf "$INSTALL_DIR/{{installer.source.executable}}" "$BIN_DIR/{{cliName}}" \
|
|
738
794
|
|| abort_update "could not link $BIN_DIR/{{cliName}}"
|
|
@@ -765,7 +821,8 @@ fi
|
|
|
765
821
|
if [[ $SERVICE_WAS_RUNNING -eq 1 && $SYSTEMD_AVAILABLE -eq 1 ]]; then
|
|
766
822
|
{{#if installer.service.hasRefreshCommand}}
|
|
767
823
|
echo "Refreshing systemd service..."
|
|
768
|
-
|
|
824
|
+
# The configured command line runs in a subshell that finds the CLI just installed first on PATH.
|
|
825
|
+
( PATH="$BIN_DIR:$PATH"; eval "$REFRESH_COMMAND" ) || abort_update "refreshing the service failed: $REFRESH_COMMAND"
|
|
769
826
|
{{/if}}
|
|
770
827
|
if [[ -n "$SERVICE_RESTART_NAME" ]]; then
|
|
771
828
|
echo "Restarting service: $SERVICE_RESTART_NAME"
|
|
@@ -779,8 +836,8 @@ fi
|
|
|
779
836
|
trap - ERR
|
|
780
837
|
|
|
781
838
|
# The backup goes only once the new installation runs.
|
|
782
|
-
if [[ -n "$
|
|
783
|
-
rm -rf "$
|
|
839
|
+
if [[ -n "$BACKUP_PARENT" && -d "$BACKUP_PARENT" ]]; then
|
|
840
|
+
rm -rf "$BACKUP_PARENT"
|
|
784
841
|
fi
|
|
785
842
|
|
|
786
843
|
echo "================================================"
|
|
@@ -794,18 +851,36 @@ echo " Version: $VERSION"
|
|
|
794
851
|
echo " Mode: $INSTALL_MODE"
|
|
795
852
|
echo ""
|
|
796
853
|
|
|
854
|
+
# The CLI is linked into $BIN_DIR only, never into another directory: say so when the PATH this installer runs
|
|
855
|
+
# with (under sudo, root's PATH) finds no {{cliName}} or another copy first. The installation itself succeeded.
|
|
856
|
+
CLI_ON_PATH=$(command -v "{{cliName}}" || true)
|
|
857
|
+
if [[ -z "$CLI_ON_PATH" ]]; then
|
|
858
|
+
echo "Warning: $BIN_DIR is not on PATH, so '{{cliName}}' alone does not run {{displayName}} here; run $BIN_DIR/{{cliName}} or add $BIN_DIR to PATH." >&2
|
|
859
|
+
echo "" >&2
|
|
860
|
+
elif [[ ! "$CLI_ON_PATH" -ef "$BIN_DIR/{{cliName}}" ]]; then
|
|
861
|
+
echo "Warning: '{{cliName}}' on PATH runs $CLI_ON_PATH, not the $BIN_DIR/{{cliName}} just installed; remove the other copy or put $BIN_DIR before it on PATH." >&2
|
|
862
|
+
echo "" >&2
|
|
863
|
+
fi
|
|
864
|
+
|
|
797
865
|
if [[ $PRESERVE_PATH_EXISTS -eq 1 ]]; then
|
|
798
866
|
echo "Existing data/configuration preserved: $PRIMARY_PRESERVE_PATH"
|
|
799
867
|
echo ""
|
|
800
868
|
if [[ $SERVICE_WAS_RUNNING -eq 1 ]]; then
|
|
801
869
|
echo "The service has been restarted with your current settings."
|
|
802
870
|
else
|
|
803
|
-
|
|
871
|
+
# The configured hint is printed literally.
|
|
872
|
+
# shellcheck disable=SC2016
|
|
873
|
+
printf 'Start the service with: %s\n' {{{installer.service.startHintShellWord}}}
|
|
804
874
|
fi
|
|
805
875
|
else
|
|
806
876
|
echo "Get started:"
|
|
807
|
-
{{#
|
|
808
|
-
|
|
809
|
-
|
|
877
|
+
{{#if installer.successHintShellWords}}
|
|
878
|
+
# The configured hints are printed literally, one per line.
|
|
879
|
+
# shellcheck disable=SC2016
|
|
880
|
+
printf ' %s\n'{{#each installer.successHintShellWords}} {{{this}}}{{/each}}
|
|
881
|
+
{{/if}}
|
|
810
882
|
fi
|
|
811
883
|
echo ""
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
{ main "$@"; }
|
|
@@ -179,15 +179,28 @@ jobs:
|
|
|
179
179
|
ARTIFACTS+=("$artifact")
|
|
180
180
|
done
|
|
181
181
|
{{/if}}
|
|
182
|
+
# The asset list must be a JSON array of named assets: an answer jq cannot read is an error, never "no asset".
|
|
183
|
+
if ! jq -e 'type == "array" and all(.[]; type == "object" and (.name | type) == "string")' /tmp/release_assets.json > /dev/null; then
|
|
184
|
+
echo "ERROR: the asset list of release ${-{ steps.version.outputs.version }-} is not a JSON array of named assets:" >&2
|
|
185
|
+
head -c 2000 /tmp/release_assets.json >&2
|
|
186
|
+
exit 1
|
|
187
|
+
fi
|
|
182
188
|
# A published asset is never replaced: any same-named asset on the release stops the job before
|
|
183
189
|
# anything uploads. Delete it in Gitea first when a run must upload it again.
|
|
184
190
|
EXISTING=0
|
|
185
191
|
for artifact in "${ARTIFACTS[@]}"; do
|
|
186
192
|
filename=$(basename "$artifact")
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
193
|
+
# jq -e exits 0 for true and 1 for false; any other status is a failure, not an answer.
|
|
194
|
+
FOUND=0
|
|
195
|
+
jq -e --arg name "$filename" 'any(.[]; .name == $name)' /tmp/release_assets.json > /dev/null || FOUND=$?
|
|
196
|
+
case "$FOUND" in
|
|
197
|
+
0)
|
|
198
|
+
echo "ERROR: release ${-{ steps.version.outputs.version }-} already has an asset named $filename; refusing to replace it" >&2
|
|
199
|
+
EXISTING=1
|
|
200
|
+
;;
|
|
201
|
+
1) ;;
|
|
202
|
+
*) echo "ERROR: jq could not check the asset list for $filename (exit $FOUND)" >&2; exit 1 ;;
|
|
203
|
+
esac
|
|
191
204
|
done
|
|
192
205
|
[ "$EXISTING" -eq 0 ] || exit 1
|
|
193
206
|
for artifact in "${ARTIFACTS[@]}"; do
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Rust (not tags)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags-ignore:
|
|
6
|
+
- '**'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
check:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
container:
|
|
12
|
+
image: code.foss.global/host.today/ht-docker-node:latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
|
|
20
|
+
# The image ships rustup's default toolchain with rustfmt and clippy.
|
|
21
|
+
- name: Show the toolchain
|
|
22
|
+
run: |
|
|
23
|
+
cargo --version
|
|
24
|
+
pnpm --version
|
|
25
|
+
|
|
26
|
+
# fmt --check, clippy with -D warnings, tests with doctests, docs with
|
|
27
|
+
# -Dwarnings; every Cargo step runs with --locked.
|
|
28
|
+
- name: rsrepo check
|
|
29
|
+
run: pnpm --package=@git.zone/rsrepo@^1 dlx rsrepo check
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Rust (tags)
|
|
2
|
+
|
|
3
|
+
# gitzone release publishes this repository. A tag only verifies the tagged
|
|
4
|
+
# commit; this workflow never publishes.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags:
|
|
9
|
+
- '*'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
container:
|
|
15
|
+
image: code.foss.global/host.today/ht-docker-node:latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout
|
|
19
|
+
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
20
|
+
with:
|
|
21
|
+
persist-credentials: false
|
|
22
|
+
|
|
23
|
+
# The image ships rustup's default toolchain with rustfmt and clippy.
|
|
24
|
+
- name: Show the toolchain
|
|
25
|
+
run: |
|
|
26
|
+
cargo --version
|
|
27
|
+
pnpm --version
|
|
28
|
+
|
|
29
|
+
# fmt --check, clippy with -D warnings, tests with doctests, docs with
|
|
30
|
+
# -Dwarnings; every Cargo step runs with --locked.
|
|
31
|
+
- name: rsrepo check
|
|
32
|
+
run: pnpm --package=@git.zone/rsrepo@^1 dlx rsrepo check
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
fileName: .gitignore
|
|
3
|
+
---
|
|
4
|
+
.nogit/
|
|
5
|
+
|
|
6
|
+
# artifacts
|
|
7
|
+
coverage/
|
|
8
|
+
public/
|
|
9
|
+
|
|
10
|
+
# installs
|
|
11
|
+
node_modules/
|
|
12
|
+
|
|
13
|
+
# caches
|
|
14
|
+
.yarn/
|
|
15
|
+
.cache/
|
|
16
|
+
.rpt2_cache
|
|
17
|
+
|
|
18
|
+
# builds
|
|
19
|
+
dist/
|
|
20
|
+
dist_*/
|
|
21
|
+
|
|
22
|
+
# rust
|
|
23
|
+
/target/
|
|
24
|
+
rust/target/
|
|
25
|
+
dist_rust/
|
|
26
|
+
|
|
27
|
+
# AI
|
|
28
|
+
.claude/
|
|
29
|
+
.serena/
|
|
30
|
+
|
|
31
|
+
#------# custom
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
fileName: license.md
|
|
3
|
+
---
|
|
1
4
|
Copyright (c) {{date.year}} {{module.author}} ({{module.contact}})
|
|
2
5
|
|
|
3
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
@@ -16,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
16
19
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
20
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
SOFTWARE.
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
module.description: a smart description
|
|
3
|
+
module.author: Anonymous
|
|
4
|
+
module.contact: anonymous
|
|
5
|
+
module.githost: code.foss.global
|
|
6
|
+
module.crateName: smartcrate
|
|
7
|
+
projectType: rust
|
|
8
|
+
|
|
9
|
+
dependencies:
|
|
10
|
+
merge:
|
|
11
|
+
- ../gitignore_rust
|
|
12
|
+
- ../ci_rust
|
|
13
|
+
- ../license_mit
|
|
14
|
+
|
|
15
|
+
runafter:
|
|
16
|
+
- cargo generate-lockfile
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
fileName: crates/{{module.crateName}}/src/lib.rs
|
|
3
|
+
---
|
|
4
|
+
//! {{module.description}}
|
|
5
|
+
|
|
6
|
+
/// Returns the greeting of this crate.
|
|
7
|
+
pub fn greeting() -> &'static str {
|
|
8
|
+
"hello from {{module.crateName}}"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[cfg(test)]
|
|
12
|
+
mod tests {
|
|
13
|
+
use super::*;
|
|
14
|
+
|
|
15
|
+
#[test]
|
|
16
|
+
fn greets() {
|
|
17
|
+
assert_eq!(greeting(), "hello from {{module.crateName}}");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
fileName: .smartconfig.json
|
|
3
|
+
---
|
|
4
|
+
{
|
|
5
|
+
"@git.zone/cli": {
|
|
6
|
+
"schemaVersion": 2,
|
|
7
|
+
"projectType": "rust",
|
|
8
|
+
"module": {
|
|
9
|
+
"githost": "{{module.githost}}",
|
|
10
|
+
"gitscope": "{{module.gitscope}}",
|
|
11
|
+
"gitrepo": "{{module.gitrepo}}",
|
|
12
|
+
"description": "{{module.description}}",
|
|
13
|
+
"license": "MIT"
|
|
14
|
+
},
|
|
15
|
+
"release": {
|
|
16
|
+
"targets": {
|
|
17
|
+
"git": {
|
|
18
|
+
"enabled": true
|
|
19
|
+
},
|
|
20
|
+
"cargo": {
|
|
21
|
+
"enabled": false,
|
|
22
|
+
"registries": ["crates-io"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# {{module.gitrepo}}
|
|
2
|
+
|
|
3
|
+
{{module.description}}
|
|
4
|
+
|
|
5
|
+
A Cargo workspace whose library crate `{{module.crateName}}` lives in `crates/{{module.crateName}}/`. Every crate inherits the version, edition, license and repository of `[workspace.package]` in the root `Cargo.toml`.
|
|
6
|
+
|
|
7
|
+
## Development
|
|
8
|
+
|
|
9
|
+
[`@git.zone/rsrepo`](https://code.foss.global/git.zone/rsrepo) drives Cargo:
|
|
10
|
+
|
|
11
|
+
- `rsrepo check`: `cargo fmt --check`, clippy with `-D warnings`, the tests with doctests, and the docs with `-Dwarnings`, in that order.
|
|
12
|
+
- `rsrepo build`: `cargo build --release --locked`.
|
|
13
|
+
- `rsrepo package`: `cargo package` for the publishable crates, with their contents and metadata checks.
|
|
14
|
+
|
|
15
|
+
Commit `Cargo.lock`: checks, packages and releases run with `--locked`.
|
|
16
|
+
|
|
17
|
+
## Releases
|
|
18
|
+
|
|
19
|
+
`gitzone release` versions the workspace (`[workspace.package].version`) from the Pending section of `changelog.md`. The `cargo` release target in `.smartconfig.json` is disabled until you configure its registries and enable it. `gitzone release check` builds and packs the crates without tagging or publishing anything.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT, see [license.md](license.md).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@git.zone/cli',
|
|
6
|
-
version: '
|
|
6
|
+
version: '10.0.0',
|
|
7
7
|
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxlQUFlO0lBQ3JCLE9BQU8sRUFBRSxRQUFRO0lBQ2pCLFdBQVcsRUFBRSwrTEFBK0w7Q0FDN00sQ0FBQSJ9
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { IPackageFilesConfig } from './helpers.packagefiles.js';
|
|
2
|
-
export type TGitzoneProjectType = 'npm' | 'service' | 'wcc' | 'website';
|
|
2
|
+
export type TGitzoneProjectType = 'npm' | 'service' | 'wcc' | 'website' | 'rust';
|
|
3
|
+
/** Every project type, in the order prompts offer them. */
|
|
4
|
+
export declare const gitzoneProjectTypes: readonly TGitzoneProjectType[];
|
|
3
5
|
/**
|
|
4
6
|
* type of the actual gitzone data
|
|
5
7
|
*/
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import * as paths from './paths.js';
|
|
3
|
+
/** Every project type, in the order prompts offer them. */
|
|
4
|
+
export const gitzoneProjectTypes = [
|
|
5
|
+
'npm',
|
|
6
|
+
'service',
|
|
7
|
+
'wcc',
|
|
8
|
+
'website',
|
|
9
|
+
'rust',
|
|
10
|
+
];
|
|
3
11
|
/**
|
|
4
12
|
* gitzone config
|
|
5
13
|
*/
|
|
@@ -16,4 +24,4 @@ export class GitzoneConfig {
|
|
|
16
24
|
}
|
|
17
25
|
constructor() { }
|
|
18
26
|
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5naXR6b25lY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvY2xhc3Nlcy5naXR6b25lY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBQ3hDLE9BQU8sS0FBSyxLQUFLLE1BQU0sWUFBWSxDQUFDO0FBS3BDLDJEQUEyRDtBQUMzRCxNQUFNLENBQUMsTUFBTSxtQkFBbUIsR0FBbUM7SUFDakUsS0FBSztJQUNMLFNBQVM7SUFDVCxLQUFLO0lBQ0wsU0FBUztJQUNULE1BQU07Q0FDUCxDQUFDO0FBdUJGOztHQUVHO0FBQ0gsTUFBTSxPQUFPLGFBQWE7SUFDakIsTUFBTSxDQUFDLEtBQUssQ0FBQyxPQUFPO1FBQ3pCLE1BQU0sYUFBYSxHQUFHLElBQUksYUFBYSxFQUFFLENBQUM7UUFDMUMsTUFBTSxhQUFhLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztRQUN4QyxPQUFPLGFBQWEsQ0FBQztJQUN2QixDQUFDO0lBRU0sSUFBSSxDQUFzQjtJQUUxQixLQUFLLENBQUMsaUJBQWlCO1FBQzVCLE1BQU0sbUJBQW1CLEdBQUcsSUFBSSxPQUFPLENBQUMsV0FBVyxDQUFDLFdBQVcsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDM0UsSUFBSSxDQUFDLElBQUksR0FBRyxtQkFBbUIsQ0FBQyxPQUFPLENBQXFCLGVBQWUsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUNuRixDQUFDO0lBRUQsZ0JBQWUsQ0FBQztDQUNqQiJ9
|
|
@@ -69,7 +69,7 @@ export interface IBinaryExtrasContext {
|
|
|
69
69
|
export declare const readBinaryExtras: (assetsArg: Record<string, unknown>, contextArg: IBinaryExtrasContext) => Promise<IBinaryExtras>;
|
|
70
70
|
/**
|
|
71
71
|
* The configuration errors of an enabled `@git.zone/cli.assets` object that come from
|
|
72
|
-
* keys @git.zone/cli 9 removed or renamed. Each message names the migration.
|
|
72
|
+
* keys @git.zone/cli 9 or 10 removed or renamed. Each message names the migration.
|
|
73
73
|
*/
|
|
74
74
|
export declare const getManagedAssetsMigrationErrors: (assetsArg: Record<string, unknown>) => string[];
|
|
75
75
|
/**
|