PortalJS部署
安装方式
先用 Prompt 核对来源,也可切换到安装命令或下载可用的安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "portaljs-deploy":https://skillpi.com/zh/skills/deepskill-8067faebe88d588eedb90fe04829382895ba95d8aabbe1cc3b8d1b5d43dfc4ba。安装前核对上游来源和版本:https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/community/portaljs/skills/portaljs-deploy/SKILL.md。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
此命令从 GitHub 来源仓库获取指定技能。运行前请先查看源文件。
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace/tree/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/community/portaljs/skills/portaljs-deploy --skill portaljs-deploy来源与配置
查看 GitHub 源码jeremylongshore/tons-of-skills-marketplace固定提交 6ea46b08dce892944db7c16f28d0b5308d402402
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
本条目介绍 PortalJS部署 的公开用途。DeepSkill 当前公开目录说明:“将 PortalJS 门户部署到 PortalJS Arc —— 由 Datopian 管理的 Cloudflare 静态托管服务。构建静态导出文件,上传后返回一个可访问的 SLUG.arc.portaljs.com 链接。只需一条命令,一个目标。适用于门户准备发布或重新部署到线上环境时使用。” 适用场景包括部署发布与上云。本页根据公开目录资料和固定版本的上游仓库整理,建议使用前核对该版本的环境、工具、权限及数据处理要求。Skillπ 提供站方用途介绍与原站链接;原始 SKILL.md 和附件仅在对应许可允许时开放。
文件浏览
---
name: portaljs-deploy
description: Deploy a PortalJS portal to PortalJS Arc — Datopian-managed static hosting on Cloudflare. Builds a static export, uploads it, and returns a live SLUG.arc.portaljs.com URL. One command, one target. Use when a portal is ready to publish or redeploy to a live URL.
allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(npx:*), Bash(curl:*)
version: 1.0.0
author: Datopian <hello@datopian.com>
license: MIT
compatibility: Claude Code with PortalJS portals (Next.js 14, React 18, Node 18+). Runs from any project via the plugin, a personal ~/.claude/commands install, or a portaljs clone.
tags:
- portaljs
- data-portal
- deploy
- hosting
- cloudflare
- static
---
# PortalJS — Deploy
## Overview
Publish an existing PortalJS portal to **PortalJS Arc** — Datopian's managed static
hosting on Cloudflare. Build a static export, upload it to the Arc API, and print a live
`https://SLUG.arc.portaljs.com` URL. Re-running redeploys the same portal (idempotent on
the slug). This is a single-target skill — it deploys to Arc only. For self-hosting, run
`npm run build` and upload `out/` to any static host; no skill required for that path.
Arc serves static exports only — SSR is not hosted on Arc yet.
## Prerequisites
- A PortalJS portal directory with a `package.json` that lists `next` as a dependency.
- Node 18+ and npm on PATH (the Arc device-login flow uses Node's global `fetch`).
- `curl` and `tar` available for packaging and upload.
- A PortalJS Arc token — read from `PORTALJS_TOKEN`, or `~/.portaljs/credentials`
(`{"token":"…"}`). If neither exists, the skill signs in on demand via a device-code
flow; no manual token copying required.
- If the portal stores large data in Git LFS/R2, do not run `git lfs pull` before
deploying — large datasets are served from Cloudflare R2 via absolute URLs in
`datasets.json`, not copied into the export.
## Instructions
The canonical, full step-by-step workflow is
[`.claude/commands/portaljs-deploy.md`](https://github.com/datopian/portaljs/blob/main/.claude/commands/portaljs-deploy.md) — the
single source of truth. Read and follow it when executing. Summary:
1. Gather input — portal directory (default `.`) and slug (default from `package.json`
name or directory name, slugified). Confirm the directory is a Next.js project; reject
reserved slugs (`www`, `api`, `admin`, `staging`, `arc`).
2. Resolve the Arc token: read `PORTALJS_TOKEN`, else `~/.portaljs/credentials`; if
missing, run the device-authorization sign-in flow and save the returned token.
3. Ensure `next.config.js` sets `output: 'export'` and `images: { unoptimized: true }`,
then run `npm run build`; stop if the build fails.
4. Verify the export carries no dataset bytes — run `npm run check-export` (or
`scripts/check-export.mjs`) to catch Git LFS pointer leaks and oversized data files.
5. Tar the `out/` directory and `POST` it to `$PORTALJS_ARC_API/v1/deploy?slug=<slug>`
with the bearer token; handle 200/401/409/400/413 responses distinctly.
6. Report the live URL, file count, upload size, and R2-vs-inline dataset counts.
## Output
- **Modified (if needed):** `next.config.js` — adds `output: 'export'` and
`images: { unoptimized: true }` when absent, preserving the rest of the config.
- **Created (on first sign-in):** `~/.portaljs/credentials` (mode `0600`).
- **Verified:** `npm run build` exits 0, `out/index.html` exists, the export-hygiene
check passes.
- **Result:** the portal is live at `https://SLUG.arc.portaljs.com`; re-running updates
the same slug in place.
## Error Handling
| Symptom | Cause | Fix |
| --- | --- | --- |
| `NOT_A_PORTAL` error | No `next` dependency found in `PORTAL_DIR/package.json` | Run from a valid portal directory, or pass the correct path. |
| Slug rejected | Derived slug is reserved (`www`, `api`, …) or not a valid DNS label | Pass an explicit `--slug <name>`. |
| Build fails (non-zero exit) | App/config error surfaced in `npm run build` | Print the log, fix the error, never deploy a failing build. |
| `check-export` fails | Git LFS pointer leaked into `out/`, or a data file exceeds the size budget | Reference large data by absolute R2 URL via `portaljs-add-dataset`; don't `git lfs pull` before building. |
| `401` on upload | Token invalid, expired, or revoked | Re-run the device sign-in flow once, retry the upload; stop if it 401s again. |
| `409` on upload | Slug already taken by another account | Choose a different `--slug`. |
| `400` / `413` on upload | Malformed slug or export too large | Read the JSON `error` field and address the specific cause. |
## Examples
### Example 1 — Deploy the current directory with the default slug
```
/portaljs-deploy
```
### Example 2 — Deploy with an explicit slug
```
/portaljs-deploy --slug my-open-data
```
### Example 3 — Non-interactive deploy from CI with a token env var
```bash
export PORTALJS_TOKEN=arc_live_xxxxxxxx
/portaljs-deploy ./portals/city-budget --slug city-budget
```
## Resources
- Full workflow: [`.claude/commands/portaljs-deploy.md`](https://github.com/datopian/portaljs/blob/main/.claude/commands/portaljs-deploy.md)
- Deploy internals reference: [`references/reference.md`](references/reference.md)
- Related skills: `portaljs-new-portal`, `portaljs-add-dataset`, `portaljs-connect-ckan`
- PortalJS Arc dashboard (sign in, manage tokens): <https://arc.portaljs.com>
当前收录版本
1.0.0
质量评测
满分 100。前四项来自 DeepSkill 收录的质量报告。
评分依据
为 PortalJS 开发者提供一键部署到 Cloudflare 静态托管的完整解决方案
评分依据
触发词精准完整,覆盖 portaljs-deploy、deploy 等关键词
评分依据
Phase/步骤清晰,包含6步完整工作流程
评分依据
工具来源明确,使用npm、curl、tar等标准工具
计算方式
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 4 行 -
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 34, 50, 64 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- arc.portaljs.com
- github.com
- slug.arc.portaljs.com
安全评级与访问范围
risk · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。