Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
eb2a9a8
feat(installer): add standalone archive installation
yiliang114 Apr 30, 2026
d2e5b1b
fix(installer): harden standalone archive installs
yiliang114 May 2, 2026
d7277a6
fix(installer): address standalone review findings
yiliang114 May 2, 2026
5719595
chore(installer): clarify review followups
yiliang114 May 2, 2026
472e51e
fix(installer): stabilize standalone script checks
yiliang114 May 2, 2026
47fdfbc
chore(installer): remove internal planning docs
yiliang114 May 2, 2026
2b40bad
chore(installer): simplify standalone release review fixes
yiliang114 May 2, 2026
a4a15e1
test(installer): add Windows batch install smoke
yiliang114 May 2, 2026
fee13e4
test(installer): fix Windows batch smoke quoting
yiliang114 May 2, 2026
69e22f9
test(installer): preserve Windows cmd quotes
yiliang114 May 2, 2026
faa9087
fix(installer): use robust Windows checksum hashing
yiliang114 May 2, 2026
66dec5f
ci: narrow installer debug matrix
yiliang114 May 2, 2026
1ca86fe
fix(installer): address standalone review hardening
yiliang114 May 4, 2026
0eb58a8
fix(installer): avoid Windows validation parse errors
yiliang114 May 4, 2026
e7e3f90
fix(installer): simplify Windows option validation
yiliang114 May 4, 2026
fee51d1
fix(installer): harden standalone review fixes
yiliang114 May 4, 2026
ec654dd
feat(installer): publish release installer assets
yiliang114 May 4, 2026
ccf83e9
fix(installer): address release asset review feedback
yiliang114 May 5, 2026
b078ade
fix(installer): avoid prerelease installer asset links
yiliang114 May 5, 2026
668c006
test(installer): isolate standalone dist fixture
yiliang114 May 5, 2026
a205e6c
feat(installer): add hosted install release alias
yiliang114 May 5, 2026
bbaa8ff
chore: no changes - code review requested
Copilot May 5, 2026
6534e6f
fix(installer): pin versioned installer assets
yiliang114 May 5, 2026
5983d11
fix: parallelize Node.js binary downloads in standalone release build
wenshao May 5, 2026
6c80ef8
fix(installer): address release asset review followups
yiliang114 May 5, 2026
bca4a7f
refactor(installer): share release CLI parsing
yiliang114 May 5, 2026
3570f93
fix(installer): address release asset review followups
yiliang114 May 6, 2026
51c14f4
fix(installer): unblock Windows CI for standalone install path
yiliang114 May 7, 2026
44ac229
fix(installer): address release asset review findings
yiliang114 May 7, 2026
f9d9a3b
fix(installer): keep installer entrypoint hosted
yiliang114 May 7, 2026
587dc1f
feat(installer): stage hosted installation assets
yiliang114 May 7, 2026
27a1bbe
fix(installer): reject stale hosted assets
yiliang114 May 7, 2026
51778f9
fix(installer): refine hosted asset staging
yiliang114 May 7, 2026
2e4086a
fix(installer): tighten hosted default-version check, flag legacy URL
yiliang114 May 7, 2026
4100b8e
feat(installer): verify installation release assets
yiliang114 May 7, 2026
362bf58
fix(installer): tighten verifier base-url + clarify test helper
yiliang114 May 7, 2026
4eb3108
chore(installer): merge main after standalone installer landed
yiliang114 May 11, 2026
1917316
fix(installer): address standalone review follow-ups
yiliang114 May 11, 2026
1502f72
fix(installer): repair Windows installer tests
yiliang114 May 11, 2026
fddbfdc
fix(release): tighten standalone asset checks
yiliang114 May 11, 2026
1f1f5cd
fix(installer): stabilize Windows managed install checks
yiliang114 May 11, 2026
7d4fc13
test(installer): relax Windows installer timeout
yiliang114 May 11, 2026
f6696e8
feat(installer): fold hosted release checks into installer flow
yiliang114 May 11, 2026
a244a2e
fix(test): escape release asset regex
yiliang114 May 11, 2026
9bde745
test(cli): avoid POSIX node path in relaunch test
yiliang114 May 11, 2026
728b35f
fix(installer): align npm fallback node gate with engines
yiliang114 May 11, 2026
bb8b810
test(installer): allow Windows archive validation more time
yiliang114 May 11, 2026
55f28b6
Merge remote-tracking branch 'origin/main' into codex/installer-relea…
yiliang114 May 11, 2026
d2acf7f
fix(installer): remove stale node 20 installer references
yiliang114 May 11, 2026
725a06e
docs(installer): clarify hosted endpoint sync requirement
yiliang114 May 11, 2026
a10bd1c
refactor(installer): reuse standaloneArchiveName in release verifier
yiliang114 May 11, 2026
d0bd8c6
fix(scripts): address release verifier review feedback
yiliang114 May 11, 2026
926c10a
feat(installer): add standalone archive installer with multi-platform…
yiliang114 May 12, 2026
2ae9d0c
feat(installer): support QWEN_INSTALL_GITHUB_REPO env var for custom …
yiliang114 May 12, 2026
02e5706
chore(installer): exclude local-only staging tools from PR
yiliang114 May 12, 2026
34a86bd
fix(installer): enforce CRLF line endings for .bat files via gitattri…
yiliang114 May 12, 2026
2ca9dcd
fix(installer): store .bat files with CRLF in git blob for raw GitHub…
yiliang114 May 12, 2026
3549a34
fix(installer): follow HTTP redirects in UrlExists and RaceMirrorHead…
yiliang114 May 12, 2026
bd7602b
fix(installer): surface download errors and add MaximumRedirection 10
yiliang114 May 12, 2026
68f05db
feat(installer): add hosted install-qwen.ps1 shim for irm|iex one-liner
yiliang114 May 13, 2026
439092e
Merge branch 'main' of https://github.com/QwenLM/qwen-code into codex…
yiliang114 May 13, 2026
eeabd1b
fix(installer): stage direct hosted install scripts
yiliang114 May 13, 2026
7b9817a
Merge branch 'main' of https://github.com/QwenLM/qwen-code into codex…
yiliang114 May 13, 2026
b8e5490
chore(installer): trim hosted release diff scope
yiliang114 May 13, 2026
fedcbae
chore(installer): narrow hosted release diff
yiliang114 May 13, 2026
af64da8
feat(installer): restore hosted PowerShell entrypoint
yiliang114 May 13, 2026
5f649c9
chore(installer): stage standalone hosted entrypoints
yiliang114 May 13, 2026
984b1a9
fix(installer): address hosted installer review followups
yiliang114 May 13, 2026
9093577
fix(installer): stabilize Windows installer tests
yiliang114 May 13, 2026
72a5efe
fix(installer): make Windows option validation readable
yiliang114 May 13, 2026
7d328be
feat(installer): wire Aliyun OSS sync, address review followups
yiliang114 May 13, 2026
b0ae7f8
ci(installer): add temporary OSS smoke test
yiliang114 May 13, 2026
48977ae
fix(installer): make OSS release assets public-readable
yiliang114 May 13, 2026
645edb8
chore(installer): remove temporary OSS smoke workflow
yiliang114 May 13, 2026
0c8022d
fix(installer): address hosted installer review gaps
yiliang114 May 13, 2026
c6005a7
feat(installer): refactor argument parsing and utility functions for …
yiliang114 May 13, 2026
540bcb8
fix(installer): harden hosted release script checks
yiliang114 May 14, 2026
4095171
fix(installer): suppress PowerShell progress bar in hosted entrypoint…
yiliang114 May 14, 2026
4b950ab
fix(installer): suppress PowerShell progress bar in bat installer dow…
yiliang114 May 14, 2026
01e9767
fix(installer): use curl.exe -# progress bar in Windows downloads
yiliang114 May 14, 2026
046d200
fix(installer): suppress progress bars for small downloads and Expand…
yiliang114 May 14, 2026
ccbdd34
fix(installer): auto-backup non-qwen directories and simplify output
yiliang114 May 14, 2026
24cb1c7
fix(installer): revert Expand-Archive progress suppression in bat
yiliang114 May 14, 2026
31e3c43
fix(installer): fix cmd.exe parsing error in backup fallback code
yiliang114 May 14, 2026
b7f190a
fix(installer): always persist install bin to user PATH
yiliang114 May 14, 2026
c3b488f
fix(installer): persist PATH to current terminal session on Windows
yiliang114 May 14, 2026
bdf101b
docs(installer): document cmd.exe one-liner for immediate PATH availa…
yiliang114 May 14, 2026
38c4706
feat(installer): make qwen usable immediately from PowerShell after i…
yiliang114 May 14, 2026
564f899
fix(installer): remove non-functional doskey approach for cmd parent
yiliang114 May 14, 2026
74130fc
fix(installer): make Windows standalone shim available in cmd
yiliang114 May 14, 2026
75e5b58
feat(installer): add standalone uninstall scripts
yiliang114 May 14, 2026
d2ebed9
fix(uninstall): match shell-quoted paths when removing the wrapper
yiliang114 May 14, 2026
db0a44d
fix(installer): update download commands to use progress indicators f…
yiliang114 May 14, 2026
8fb2bc1
fix(installer): resolve Aliyun latest via version pointer
yiliang114 May 14, 2026
db8677f
fix(installer): cleanup mirror probe temp dirs
yiliang114 May 14, 2026
40ac124
fix(installer): harden standalone release fallback
yiliang114 May 14, 2026
bae9333
fix(installer): address standalone review feedback
yiliang114 May 15, 2026
a79745b
style(installer): align standalone install output
yiliang114 May 15, 2026
7fd314a
fix(installer): print standalone uninstall commands
yiliang114 May 15, 2026
7d665f3
fix(installer): address release review follow-ups
yiliang114 May 15, 2026
c959913
fix(installer): harden Windows target detection
yiliang114 May 15, 2026
b2b43b5
test(installer): stabilize Windows fake tool path
yiliang114 May 15, 2026
308fe4d
fix(installer): allow explicit Windows curl path
yiliang114 May 15, 2026
1d272f6
test(installer): use cmd fake curl on Windows
yiliang114 May 15, 2026
778919f
test(installer): cover Windows fake curl helper
yiliang114 May 15, 2026
ecfad99
test(installer): inject Windows arch overrides in cmd
yiliang114 May 15, 2026
ce45abd
test(cli): wait for prompt suggestion render
yiliang114 May 15, 2026
78d0c86
test(cli): revert prompt suggestion wait tweak
yiliang114 May 15, 2026
b3e21a5
fix(installer): harden hosted release publishing
yiliang114 May 15, 2026
0994a80
fix(installer): harden Windows latest pointer parsing
yiliang114 May 16, 2026
63ec525
fix(installer): bound Windows download timeouts
yiliang114 May 16, 2026
0155a4f
fix(installer): bound hosted installer probes
yiliang114 May 16, 2026
308358d
fix(release): make ossutil download configurable
yiliang114 May 16, 2026
c2a3e5c
Merge remote-tracking branch 'origin/main' into codex/pr-3828-install…
yiliang114 May 17, 2026
3eb6d6c
fix(installer): address hosted release review feedback
yiliang114 May 17, 2026
625dfbf
test(installer): keep dist backup on same filesystem
yiliang114 May 17, 2026
3f60c2c
fix(installer): address remaining review feedback on PR #3828
yiliang114 May 17, 2026
273a012
fix(release): correct OSS credentials lifetime and mirror probe fallback
yiliang114 May 17, 2026
a1ef869
fix(installer): address review feedback round 2
yiliang114 May 17, 2026
0a5d308
fix(installer): address review feedback round 3
yiliang114 May 17, 2026
89b272d
test(installer): add parseUploadArgs unit tests and align verify deri…
yiliang114 May 17, 2026
547713a
test(installer): add uploadAssets integration tests with fake ossutil
yiliang114 May 17, 2026
bab96dc
revert(installer): drop over-engineered ossutil/upload changes
yiliang114 May 17, 2026
3caf3e2
test(installer): cover Windows release script regressions
yiliang114 May 18, 2026
4a8fea5
test(release): avoid Windows shim lookup in oss upload tests
yiliang114 May 18, 2026
98315b2
test(installer): use stable fake Aliyun version on Windows
yiliang114 May 18, 2026
584bb59
fix(installer): parse Aliyun latest version in batch
yiliang114 May 18, 2026
62ab5f4
fix(installer): validate Aliyun latest version without findstr
yiliang114 May 18, 2026
b69af67
fix(installer): normalize Aliyun latest version via PowerShell
yiliang114 May 18, 2026
f832d33
fix(installer): avoid captured PowerShell output in batch latest parsing
yiliang114 May 18, 2026
994f2f4
fix(installer): normalize Aliyun latest pointer from file
yiliang114 May 18, 2026
ba695a8
test(installer): fix fake Windows curl output parsing
yiliang114 May 18, 2026
09b04d6
fix(installer): print checksum path on miss, gate hardcoded version p…
yiliang114 May 20, 2026
89d58aa
fix: stamp release version in hosted installers and add Zip Slip prot…
yiliang114 May 20, 2026
cb3f356
fix(installer): add SOURCE to PowerShell unsafe-character validation …
yiliang114 May 20, 2026
18525b3
fix: correct copyright year 2025 -> 2026 in new files [skip ci]
yiliang114 May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,14 @@ jobs:
npm run bundle
npm run prepare:package

- name: 'Build Standalone Archives'
env:
RELEASE_VERSION: '${{ needs.prepare.outputs.release_version }}'
run: 'npm run package:standalone:release -- --version "${RELEASE_VERSION}" --out-dir dist/standalone'

- name: 'Build Installation Assets'
run: 'npm run package:installation-assets -- --out-dir dist/standalone'

Comment thread
yiliang114 marked this conversation as resolved.
Resolved
- name: 'Publish @qwen-code/qwen-code'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] npm publish(第 444 行)在 OSS 同步(第 533 行)之前执行。如果 OSS 上传失败,npm 用户已获得新版本,而 OSS latest 仍指向旧版本——跨渠道版本偏移,无自动恢复机制。

建议:将 OSS 同步移到 npm publish 之前,或至少添加一个验证步骤:在 npm publish 后确认 OSS 资产已可用,否则回滚 npm 发布。

— DeepSeek/deepseek-v4-pro via Qwen Code /review

working-directory: 'dist'
run: |-
Expand Down Expand Up @@ -411,6 +419,10 @@ jobs:

gh release create "${RELEASE_TAG}" \
dist/cli.js \
dist/standalone/qwen-code-* \
dist/standalone/install-qwen.sh \
dist/standalone/install-qwen.bat \
dist/standalone/SHA256SUMS \
--target "${RELEASE_BRANCH}" \
--title "Release ${RELEASE_TAG}" \
--notes-start-tag "${PREVIOUS_RELEASE_TAG}" \
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ storybook-static

# Dev symlink: qc-helper bundled skill docs (created by scripts/dev.js)
packages/core/src/skills/bundled/qc-helper/docs
tmp/
tmp/
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,39 @@ Qwen Code is an open-source AI agent for the terminal, optimized for Qwen series

### Quick Install (Recommended)

The installer uses a standalone Qwen Code archive when one is available for
your platform, so the default path does not require a preinstalled Node.js
runtime. If a standalone archive is not available, it falls back to npm and then
requires Node.js 20 or later with npm on PATH.

#### Linux / macOS

```bash
bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)"
curl -fsSL https://github.com/QwenLM/qwen-code/releases/latest/download/install-qwen.sh | bash
```

#### Windows (Run as Administrator)
#### Windows

Works in both Command Prompt and PowerShell:

```cmd
powershell -Command "Invoke-WebRequest 'https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')"
powershell -Command "Invoke-WebRequest 'https://github.com/QwenLM/qwen-code/releases/latest/download/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')"
```

> **Note**: It's recommended to restart your terminal after installation to ensure environment variables take effect.
> **Note**: It's recommended to restart your terminal after installation if
> `qwen` is not immediately available on PATH. For offline installation, download
> a release archive such as `qwen-code-linux-x64.tar.gz` or
> `qwen-code-win-x64.zip` plus `SHA256SUMS`, then run the installer with
> `--archive PATH`. The installer scripts are also published as release assets
> for each version. Pass `--version vX.Y.Z` to pin a standalone release instead
> of installing `latest`.

### Manual Installation

#### Prerequisites

Make sure you have Node.js 20 or later installed. Download it from [nodejs.org](https://nodejs.org/en/download).
Manual npm installation requires Node.js 20 or later. Download it from
[nodejs.org](https://nodejs.org/en/download).

#### NPM

Expand Down
18 changes: 14 additions & 4 deletions docs/users/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,31 @@

### Install Qwen Code:

The recommended installer uses a standalone archive when one is available for
your platform. If it falls back to npm, Node.js 20 or later with npm must be
available on PATH.

**Linux / macOS**

```sh
curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash
curl -fsSL https://github.com/QwenLM/qwen-code/releases/latest/download/install-qwen.sh | bash
```

**Windows (Run as Administrator)**
**Windows**

```cmd
powershell -Command "Invoke-WebRequest 'https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')"
powershell -Command "Invoke-WebRequest 'https://github.com/QwenLM/qwen-code/releases/latest/download/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')"
```

> [!note]
>
> It's recommended to restart your terminal after installation to ensure environment variables take effect. If the installation fails, please refer to [Manual Installation](./quickstart#manual-installation) in the Quickstart guide.
> It's recommended to restart your terminal after installation if `qwen` is not
> immediately available on PATH. If the installation fails, please refer to
> [Manual Installation](./quickstart#manual-installation) in the Quickstart
> guide. For offline installation, download a release archive and run the
> installer with `--archive PATH`; keep `SHA256SUMS` next to the archive. The
> installer scripts are published as release assets for each version. Pass
> `--version vX.Y.Z` to pin a standalone release instead of installing `latest`.

### Start using Qwen Code:

Expand Down
20 changes: 15 additions & 5 deletions docs/users/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Make sure you have:
- A code project to work with
- An API key from Alibaba Cloud Model Studio ([Beijing](https://bailian.console.aliyun.com/) / [intl](https://modelstudio.console.alibabacloud.com/)), or an Alibaba Cloud Coding Plan ([Beijing](https://bailian.console.aliyun.com/cn-beijing/?tab=coding-plan#/efm/coding-plan-index) / [intl](https://modelstudio.console.alibabacloud.com/?tab=coding-plan#/efm/coding-plan-index)) subscription

The recommended installer uses a standalone archive when one is available for
your platform. If it falls back to npm, you will need Node.js 20 or later with
npm available on PATH.

## Step 1: Install Qwen Code

To install Qwen Code, use one of the following methods:
Expand All @@ -21,24 +25,30 @@ To install Qwen Code, use one of the following methods:
**Linux / macOS**

```sh
curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash
curl -fsSL https://github.com/QwenLM/qwen-code/releases/latest/download/install-qwen.sh | bash
```

**Windows (Run as Administrator)**
**Windows**

```cmd
powershell -Command "Invoke-WebRequest 'https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')"
powershell -Command "Invoke-WebRequest 'https://github.com/QwenLM/qwen-code/releases/latest/download/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')"
```

> [!note]
>
> It's recommended to restart your terminal after installation to ensure environment variables take effect.
> It's recommended to restart your terminal after installation if `qwen` is not
> immediately available on PATH. For offline installation, download a release
> archive such as `qwen-code-linux-x64.tar.gz` or `qwen-code-win-x64.zip` plus
> `SHA256SUMS`, then run the installer with `--archive PATH`. The installer
> scripts are published as release assets for each version. Pass
> `--version vX.Y.Z` to pin a standalone release instead of installing `latest`.

### Manual Installation

**Prerequisites**

Make sure you have Node.js 20 or later installed. Download it from [nodejs.org](https://nodejs.org/en/download).
Manual npm installation requires Node.js 20 or later. Download it from
[nodejs.org](https://nodejs.org/en/download).

**NPM**

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
"preflight": "npm run clean && npm ci && npm run format && npm run lint:ci && npm run build && npm run typecheck && npm run test:ci",
"prepare": "husky && npm run build && npm run bundle",
"prepare:package": "node scripts/prepare-package.js",
"package:installation-assets": "node scripts/build-installation-assets.js",
"package:standalone": "node scripts/create-standalone-package.js",
"package:standalone:release": "node scripts/build-standalone-release.js",
"release:version": "node scripts/version.js",
"telemetry": "node scripts/telemetry.js",
"check:lockfile": "node scripts/check-lockfile.js",
Expand Down
125 changes: 125 additions & 0 deletions scripts/build-installation-assets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#!/usr/bin/env node

/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/

import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { writeSha256Sums } from './create-standalone-package.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const rootDir = path.resolve(__dirname, '..');

const INSTALLATION_ASSETS = [
{
source: path.join(
rootDir,
'scripts',
'installation',
'install-qwen-with-source.sh',
),
output: 'install-qwen.sh',
mode: 0o755,
},
{
source: path.join(
rootDir,
'scripts',
'installation',
'install-qwen-with-source.bat',
),
output: 'install-qwen.bat',
},
];

if (isMainModule()) {
try {
const args = parseArgs(process.argv.slice(2));
if (args.help) {
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
printUsage();
} else {
await buildInstallationAssets(
path.resolve(args.outDir || path.join(rootDir, 'dist', 'standalone')),
);
}
} catch (error) {
console.error(error instanceof Error ? error.message : error);
process.exitCode = 1;
}
}

function isMainModule() {
return process.argv[1] && path.resolve(process.argv[1]) === __filename;
}

async function buildInstallationAssets(outDir) {
fs.mkdirSync(outDir, { recursive: true });

for (const asset of INSTALLATION_ASSETS) {
if (!fs.existsSync(asset.source)) {
fail(`Installation source asset not found: ${asset.source}`);
}

const destination = path.join(outDir, asset.output);
fs.copyFileSync(asset.source, destination);
if (asset.mode !== undefined && process.platform !== 'win32') {
fs.chmodSync(destination, asset.mode);
}
}

await writeSha256Sums(outDir);
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
}

function parseArgs(argv) {
const args = {
help: false,
outDir: undefined,
};
Comment thread
yiliang114 marked this conversation as resolved.
Resolved

for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
switch (arg) {
case '--help':
case '-h':
args.help = true;
break;
case '--out-dir':
args.outDir = readOptionValue(argv, index, arg);
index += 1;
break;
default:
fail(`Unknown option: ${arg}`);
}
}

return args;
}

function readOptionValue(argv, index, optionName) {
const value = argv[index + 1];
if (!value || value.startsWith('-')) {
fail(`${optionName} requires a value`);
}
return value;
}

function printUsage() {
console.log(`
Usage:
npm run package:installation-assets -- [OPTIONS]

Options:
--out-dir PATH Output directory. Defaults to dist/standalone.
`);
}

function fail(message) {
throw new Error(`ERROR: ${message}`);
}

export { buildInstallationAssets, INSTALLATION_ASSETS };
Loading