# @adobe/helix-onedrive-cli 中文文档

规范地址：https://npmcn.com/package/%40adobe/helix-onedrive-cli/

版本：1\.11\.443
npm 元数据更新时间：2026-10-27T07:32:00.452Z
中文译文更新时间：2026-11-06T16:08:19.769Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40adobe/helix-onedrive-cli
原文对照：https://npmcn.com/package/%40adobe/helix-onedrive-cli/?lang=original
项目主页：https://github.com/adobe/helix-onedrive-cli#readme
源码仓库：https://github.com/adobe/helix-onedrive-cli

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：275 kB，30 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：10 个
- 首次发布：2020-02-05T02:06:12.383Z
- 最新版本发布：2026-10-27T07:31:59.891Z
- 近 30 天下载量：2777（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：557（近 12 个月 72 个）

## 中文简介

螺旋一驱 CLI

## 安装

```sh
npm install @adobe/helix-onedrive-cli
```

也可以使用：`pnpm add @adobe/helix-onedrive-cli`、`yarn add @adobe/helix-onedrive-cli`、`bun add @adobe/helix-onedrive-cli`

## README

# 螺旋一驱 CLI

> Helix 单驱动命令行接口工具

## 状态

[![codecov](https://img.shields.io/codecov/c/github/adobe/helix-onedrive-cli.svg)](https://codecov.io/gh/adobe/helix-onedrive-cli) [![CircleCI](https://img.shields.io/circleci/project/github/adobe/helix-onedrive-cli.svg)](https://circleci.com/gh/adobe/helix-onedrive-cli) [![GitHub license](https://img.shields.io/github/license/adobe/helix-onedrive-cli.svg)](https://github.com/adobe/helix-onedrive-cli/blob/main/LICENSE.txt) [![GitHub issues](https://img.shields.io/github/issues/adobe/helix-onedrive-cli.svg)](https://github.com/adobe/helix-onedrive-cli/issues) [![LGTM Code Quality Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/helix-onedrive-cli.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/adobe/helix-onedrive-cli) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

## 安装

```bash
$ npm install @adobe/helix-onedrive-cli
```

## 使用量

```
Usage: 1d <command>

Commands:
  1d me                   Show information about the logged in user.
  1d login                Start the login interactive flow or ROPC flow with username / password.
  1d logout               Logout be removing the authorization file.
  1d resolve <link>       Resolves a share link to the respective drive item.
  1d ls [path]            Lists the contents of the [path]
  1d get <path> [local]   downloads the file at path
  1d put <local> [path]]  upload the local file.

Options:
  --version      Show version number
  --verbose, -v  Run with verbose logging
  --help         Show help
```

## 设置

1d 客户端使用默认客户端ID运行,该客户端支持交互登录. 走开 `1d login`,复制在浏览器中粘贴授权代码并唱入微软.

如果您想要以不同的参数运行客户端, 您可以提供 (单位:千美元) `.env` 包含您的应用程序的 azure 客户端身份和客户端机密的文件 .

```dotenv
# azure app oauth secrets
AZURE_APP_CLIENT_ID="11111111-1111-1111-1111-11111111111"
AZURE_APP_CLIENT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

之后 `.env` 设置,启动 _dev 服务器_ 改为:

```console
$ npm start
```

并打开浏览器 http://localhost:4502/.

点击链接登录。 在成功登录到微软后, 服务器会写一个 `.auth.json` 在磁盘上. 之后可以停止服务器,并使用 cli, 如:

```console
$ 1d me
Logged in as: John Doe (john@example.com)
```

要重设认证,只需删除 `.auth.json` 文件,并以私人模式打开浏览器.

### 登录设备令牌

要登录设备符号, 请运行 :

```console
$ 1d login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code HNGP5CAF8 to authenticate.
updated .auth.json file.
$ 1d me
Logged in as: John Doe (john@doe.com)
```

### 登录用户名/ 密码

一些账户和app允许登录用户名和密码(ROPC流量). 通常联邦账户需要外交部, 禁止使用ROPC.

```console
$ 1d login --username=john@doe.com
password: ****
updated .auth.json file.
Logged in as: John Doe (john@doe.com)
```

## 发展

### 构建

```bash
$ npm install
```

### 测试

```bash
$ npm test
```

### 林特

```bash
$ npm run lint
```

## 常见问题

### @adobe/helix-onedrive-cli 是什么？

螺旋一驱 CLI

### 如何安装 @adobe/helix-onedrive-cli？

在项目目录运行 npm install @adobe/helix-onedrive-cli，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 1d，可以用 npx 1d 直接运行。

### @adobe/helix-onedrive-cli 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/adobe\_\_helix-onedrive-cli 是否存在。

### @adobe/helix-onedrive-cli 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @adobe/helix-onedrive-cli 可以商用吗？

@adobe/helix-onedrive-cli 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @adobe/helix-onedrive-cli 的下载量有多少？

根据 npm 官方下载统计，@adobe/helix-onedrive-cli 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,777 次，日均约 93 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @adobe/helix-onedrive-cli 还在维护吗？

最新版本 1\.11\.443 发布于 2026/10/27（11 天前）；至今共发布 557 个版本，其中过去 12 个月发布了 72 个；首次发布于 2020/02/05。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

