From bcd0d1fe58732be5d14db76220e20d7fb530b0d8 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Mon, 18 Nov 2024 19:58:07 +0100 Subject: [PATCH 1/3] build: add --skip-check to release:package Signed-off-by: Grigorii K. Shartsev --- scripts/prepare-release-packages.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/prepare-release-packages.mjs b/scripts/prepare-release-packages.mjs index c521f33..1c33739 100644 --- a/scripts/prepare-release-packages.mjs +++ b/scripts/prepare-release-packages.mjs @@ -42,6 +42,7 @@ function help() { --mac-x64 - build macOS package using x64 architecture --mac-arm64 - build macOS package using arm64 architecture --skip-install - skip npm ci in both repositories + --skip-check - skip checking for uncommitted changes in talk-desktop (use for debug only) ` exit('', 0) } @@ -67,7 +68,7 @@ async function prepareRelease() { // Check Talk Desktop repository echo`[1/5] Check for uncommitted changes in Talk Desktop` - if ((await $`git status -s`).stdout) { + if (!argv['skip-check'] && (await $`git status -s`).stdout) { exit('❌ You have uncommitted changes in the Talk Desktop repository', 1) } From d067ee581cea59f3da59535dfbfe256de9071f0a Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Mon, 18 Nov 2024 19:58:36 +0100 Subject: [PATCH 2/3] chore: minor release:package script improvements Signed-off-by: Grigorii K. Shartsev --- scripts/prepare-release-packages.mjs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/scripts/prepare-release-packages.mjs b/scripts/prepare-release-packages.mjs index 1c33739..207e415 100644 --- a/scripts/prepare-release-packages.mjs +++ b/scripts/prepare-release-packages.mjs @@ -35,13 +35,13 @@ function help() { Args: --help - show help - --version - Optionally a specific Talk version/branch to build with, for example, v20.0.0-rc.1 or main. Default to stable in package.json. + --version - Optionally a specific Talk version/branch to build with, for example, v20.0.0-rc.1 or main. Default is package.json/talk.stable. --windows - build Windows package --linux - build Linux package --mac - build macOS package using universal architecture (recommended) --mac-x64 - build macOS package using x64 architecture --mac-arm64 - build macOS package using arm64 architecture - --skip-install - skip npm ci in both repositories + --skip-install - skip installing dependencies in both repositories (use for debug only) --skip-check - skip checking for uncommitted changes in talk-desktop (use for debug only) ` exit('', 0) @@ -67,22 +67,22 @@ async function prepareRelease() { const gitSpreed = (command) => $`git --git-dir=${talkDotGit} --work-tree=${TALK_PATH} ${command}` // Check Talk Desktop repository - echo`[1/5] Check for uncommitted changes in Talk Desktop` + echo`[1/5] Checking for uncommitted changes in Talk Desktop${argv['skip-check'] ? ' (SKIPPED)' : '...'}` if (!argv['skip-check'] && (await $`git status -s`).stdout) { exit('❌ You have uncommitted changes in the Talk Desktop repository', 1) } // Check and prepare Talk repository - echo`[2/5] Check for Talk repository in ${TALK_PATH}` + echo`[2/5] Checking for Talk repository in ${TALK_PATH}` if (fs.existsSync(TALK_PATH)) { echo`- Talk has been found in ${TALK_PATH}` - echo`[3.1/5] Check for uncommitted changes in Talk repository` + echo`[3.1/5] Checking for uncommitted changes in Talk repository` if ((await gitSpreed(['status', '-s'])).stdout) { exit('❌ You have uncommitted changes in the Talk repository', 1) } - echo`[3.2/5] Fetch Talk ${version} from origin` + echo`[3.2/5] Fetching Talk ${version} from origin` await spinner( - `Fetch Talk ${version} from origin`, + `Fetching Talk ${version} from origin`, () => gitSpreed(['fetch', '--no-tags', '--depth=1', 'origin', 'tag', version]), ) echo`[3.3/5] Checkout Talk ${version}` @@ -92,7 +92,7 @@ async function prepareRelease() { ) } else { echo`- No Talk has been found in ${TALK_PATH}` - echo`[3/5] Clone Talk@${version} to ${TALK_PATH}` + echo`[3/5] Cloning Talk@${version} to ${TALK_PATH}` await spinner( `Cloning Talk@${version} to ${TALK_PATH}`, () => $`git clone --branch=${version} --depth=1 -- https://github.com/nextcloud/spreed ${TALK_PATH}`, @@ -100,23 +100,21 @@ async function prepareRelease() { } // (Re)-install Talk dependencies + echo`[4/5] Installing dependencies${argv['skip-install'] ? ' (SKIPPED)' : '...'}` if (!argv['skip-install']) { - echo`[4/5] Install dependencies` await spinner( - 'Installing dependencies in Talk Desktop', + '[4.1/5] Installing dependencies in Talk Desktop', () => $`npm ci`, ) await spinner( - 'Installing dependencies in Talk', + '[4.2/5] Installing dependencies in Talk', () => $`npm ci --prefix ${TALK_PATH}`, ) - } else { - echo`SKIPPED [5/5] Install dependencies` } - // Package with Talk from TALK_PATH - echo`[5/5] Package with Talk from ${TALK_PATH}` + // Build and package + echo`[5/5] Packaging...` $.env.TALK_PATH = TALK_PATH argv.windows && await spinner('Package Windows', () => $`npm run build:windows && npm run package:windows`) argv.linux && await spinner('Package Linux', () => $`npm run build:linux && npm run package:linux`) From 1042e1ebcd44c2514627c1df31b4e0127a20de17 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Thu, 19 Dec 2024 17:11:13 +0100 Subject: [PATCH 3/3] build: allow running `release:package` without `npm install` Signed-off-by: Grigorii K. Shartsev --- package.json | 2 +- scripts/prepare-release-packages.mjs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 800956d..d5fcb1c 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "package:mac:x64": "electron-forge make --skip-package --platform=darwin --arch=x64", "package:mac:arm64": "electron-forge make --skip-package --platform=darwin --arch=arm64", "package:windows": "electron-forge make --skip-package --platform=win32", - "release:package": "zx ./scripts/prepare-release-packages.mjs", + "release:package": "npx -y zx ./scripts/prepare-release-packages.mjs", "generate-icons": "node ./scripts/generate-icons.js", "download-vue-devtools": "node ./scripts/download-vue-devtools.mjs", "lint": "eslint --ext .js,.vue src/ --fix", diff --git a/scripts/prepare-release-packages.mjs b/scripts/prepare-release-packages.mjs index 207e415..5254cae 100644 --- a/scripts/prepare-release-packages.mjs +++ b/scripts/prepare-release-packages.mjs @@ -3,8 +3,9 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { $, echo, spinner, argv, fs, os, usePwsh } from 'zx' -// eslint-disable-next-line no-undef +/// +/* eslint-disable no-undef */ + const packageJson = require('../package.json') const TALK_PATH = './out/.temp/spreed/'