diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 82297c5..fdca817 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -5,6 +5,14 @@ on: branches: [main] paths: - 'site/**' + - 'docs/**' + - 'scripts/site/**' + - '.github/workflows/pages.yml' + pull_request: + paths: + - 'site/**' + - 'docs/**' + - 'scripts/site/**' - '.github/workflows/pages.yml' workflow_dispatch: @@ -12,20 +20,24 @@ permissions: contents: read concurrency: - group: github-pages + group: pages-${{ github.ref }} cancel-in-progress: false jobs: upload: - if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 - - uses: actions/upload-pages-artifact@v5.0.0 + - run: python3 -m pip install -r scripts/site/requirements.txt + - run: python3 scripts/site/build.py + - run: python3 scripts/site/check.py + - if: github.ref == 'refs/heads/main' + uses: actions/upload-pages-artifact@v5.0.0 with: - path: site + path: .site-build deploy: + if: github.ref == 'refs/heads/main' needs: upload runs-on: ubuntu-latest permissions: diff --git a/.gitignore b/.gitignore index 09584dc..0f857ec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ coverage/ .DS_Store *.tgz dist/ +/.site-build/ +__pycache__/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7222f78..5674c4d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,6 +34,19 @@ npm pack `npm test` builds before running Node's test runner. Tests import the built modules and use temporary directories, fake JDKs, and mocked downloads. `npm ci` needs access to dependencies; the test suite itself should not require internet access or a preinstalled JDK. A real Java smoke test needs an appropriate JDK and network/cache access. +## Preview the product site + +From the repository root, run the following with Python 3.10+ in a virtual environment. The build renders both languages, the shared navigation, the sitemap and Markdown copies of the reference pages into `.site-build/`. + +```sh +python -m pip install -r scripts/site/requirements.txt +python scripts/site/build.py +python scripts/site/check.py +python -m http.server --directory .site-build +``` + +The published sitemap is at `/java-npm/sitemap.xml`. Documentation pages expose an equivalent `index.md`, indexed in `/java-npm/llms.txt`. Crawlers read robots policy at the host root (`/robots.txt`), which is outside this project’s Pages deployment. + ## Branches and PR titles Use short-lived branches named `/`, such as `feat/jdk-selection`, `fix/pom-validation`, or `docs/quick-start`. diff --git a/README.md b/README.md index 2a121fb..36a3fec 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

Website & demo · Quick start · - All commands · + All commands · 简体中文

@@ -22,7 +22,7 @@ Declare Maven dependencies in `package.json`. Run `jpm dev`, edit a Java control Install the [npm alpha](https://www.npmjs.com/package/java-npm-cli) on Windows, macOS or Linux with Node.js 22 or later. -In PowerShell, use `npm.cmd` and `jpm.cmd` if script execution is restricted. [Windows quick start](https://github.com/CoderSerio/java-npm/blob/main/docs/cli.md#windows-powershell) +In PowerShell, use `npm.cmd` and `jpm.cmd` if script execution is restricted. [Windows quick start](https://coderserio.github.io/java-npm/docs/#windows-powershell) ```sh npm install --global java-npm-cli @@ -86,7 +86,7 @@ If you edit the manifest yourself, run `jpm install` to synchronize the POM. jpm | Develop and ship | `jpm dev`, `jpm test`, `jpm build` | | Set up Java and check the project | `jpm jdk list`, `jpm jdk install`, `jpm jdk use`, `jpm jdk env`, `jpm doctor` | -[All commands, aliases and options](https://github.com/CoderSerio/java-npm/blob/main/docs/cli.md#command-overview) +[All commands, aliases and options](https://coderserio.github.io/java-npm/docs/#command-overview) ## Working with the alpha @@ -95,8 +95,8 @@ This release targets **new, single-module Spring MVC projects on Windows, macOS | When you want to… | Start here | | --- | --- | | Explore commands in your terminal | Run `jpm` for the interactive menu, or `jpm --help` for a list. | -| See which JDK and dependencies a project uses | Run `jpm jdk` and `jpm tree`. [Configuration guide](https://github.com/CoderSerio/java-npm/blob/main/docs/configuration.md) | -| Diagnose a setup problem | Run `jpm doctor`. [Troubleshooting](https://github.com/CoderSerio/java-npm/blob/main/docs/troubleshooting.md) | +| See which JDK and dependencies a project uses | Run `jpm jdk` and `jpm tree`. [Configuration guide](https://coderserio.github.io/java-npm/docs/configuration/) | +| Diagnose a setup problem | Run `jpm doctor`. [Troubleshooting](https://coderserio.github.io/java-npm/docs/troubleshooting/) | | Report a bug or contribute a fix | English and Chinese are both welcome. [Issues](https://github.com/CoderSerio/java-npm/issues) · [Contributing](https://github.com/CoderSerio/java-npm/blob/main/CONTRIBUTING.md) · [Security](https://github.com/CoderSerio/java-npm/blob/main/SECURITY.md) | An independent open-source project by Carbon and contributors. [MIT license](https://github.com/CoderSerio/java-npm/blob/main/LICENSE) diff --git a/README.zh-CN.md b/README.zh-CN.md index c978a9b..b60ce2d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -10,7 +10,7 @@

官网与演示 · 快速开始 · - 命令速查 · + 命令速查 · English

@@ -22,7 +22,7 @@ 在 Windows、macOS 或 Linux 上准备好 Node.js 22 或更高版本,然后安装 [npm 上的 alpha 版](https://www.npmjs.com/package/java-npm-cli)。 -如果 PowerShell 提示禁止运行脚本,可以直接使用 `npm.cmd` 和 `jpm.cmd`。[Windows 快速开始](https://github.com/CoderSerio/java-npm/blob/main/docs/cli.zh-CN.md#windows-powershell) +如果 PowerShell 提示禁止运行脚本,可以直接使用 `npm.cmd` 和 `jpm.cmd`。[Windows 快速开始](https://coderserio.github.io/java-npm/zh/docs/#windows-powershell) ```sh npm install --global java-npm-cli @@ -86,7 +86,7 @@ jpm build | 开发、测试和打包 | `jpm dev`、`jpm test`、`jpm build` | | 选择 Java 和检查项目 | `jpm jdk list`、`jpm jdk install`、`jpm jdk use`、`jpm jdk env`、`jpm doctor` | -[完整命令、别名和选项](https://github.com/CoderSerio/java-npm/blob/main/docs/cli.zh-CN.md) +[完整命令、别名和选项](https://coderserio.github.io/java-npm/zh/docs/) ## 使用 alpha 版 @@ -95,8 +95,8 @@ jpm build | 想做什么 | 从这里开始 | | --- | --- | | 在终端里浏览命令 | 运行 `jpm` 打开交互菜单,或用 `jpm --help` 查看列表。 | -| 查看项目选用的 JDK 和依赖树 | 运行 `jpm jdk` 和 `jpm tree`。[配置指南](https://github.com/CoderSerio/java-npm/blob/main/docs/configuration.md) | -| 排查环境问题 | 运行 `jpm doctor`。[故障排查](https://github.com/CoderSerio/java-npm/blob/main/docs/troubleshooting.md) | +| 查看项目选用的 JDK 和依赖树 | 运行 `jpm jdk` 和 `jpm tree`。[配置指南](https://coderserio.github.io/java-npm/zh/docs/configuration/) | +| 排查环境问题 | 运行 `jpm doctor`。[故障排查](https://coderserio.github.io/java-npm/zh/docs/troubleshooting/) | | 报告问题或提交修复 | 欢迎用中文或英文交流。[反馈问题](https://github.com/CoderSerio/java-npm/issues) · [贡献指南](https://github.com/CoderSerio/java-npm/blob/main/CONTRIBUTING.md) · [安全问题报告](https://github.com/CoderSerio/java-npm/blob/main/SECURITY.md) | 由 Carbon 与贡献者共同维护的独立开源项目。[MIT 许可证](https://github.com/CoderSerio/java-npm/blob/main/LICENSE) diff --git a/docs/cli.zh-CN.md b/docs/cli.zh-CN.md index 0ad5728..10020cf 100644 --- a/docs/cli.zh-CN.md +++ b/docs/cli.zh-CN.md @@ -31,4 +31,4 @@ 如果 PowerShell 提示禁止运行脚本,可直接使用 `npm.cmd` 和 `jpm.cmd`。例如,`npm.cmd install -g java-npm-cli` 安装工具,`jpm.cmd --version` 查看版本。进入项目后,`jpm.cmd jdk use 21` 为 jpm 选择 Java 21,随后可用 `jpm.cmd dev` 启动应用。 -[中文快速开始](https://coderserio.github.io/java-npm/zh/guide/) · [完整参数说明(英文)](cli.md) · [配置指南(英文)](configuration.md) +[中文快速开始](https://coderserio.github.io/java-npm/zh/guide/) · [完整参数说明(英文)](cli.md) · [项目配置](configuration.zh-CN.md) diff --git a/docs/configuration.zh-CN.md b/docs/configuration.zh-CN.md new file mode 100644 index 0000000..0c54dc5 --- /dev/null +++ b/docs/configuration.zh-CN.md @@ -0,0 +1,31 @@ +# 项目配置 + +## Maven 依赖与 POM + +在项目根目录的 `package.json` 中,`java.version` 是编译目标,`java.springBoot` 是 Spring Boot 版本,`java.dependencies` 记录直接依赖。创建项目后保留生成的坐标和版本。例如,下面这段写在 `java.dependencies` 中,版本交给 Spring Boot 管理。 + +```json +{ + "org.springframework.boot:spring-boot-starter-validation": {} +} +``` + +指定版本时可用精确版本字符串,或带有 `version`、`scope` 和 `optional` 的对象。`scope` 支持 `compile`、`runtime`、`provided` 和 `test`。 + +运行 `jpm sync` 可从清单生成 `pom.xml`,`jpm install` 还会调用 Maven 解析依赖。若生成的 POM 被手动修改,jpm 会停止并提示检查。Maven 的仓库镜像和认证仍使用 Maven settings。 + +## 选择 JDK + +在项目目录运行 `jpm jdk use 21`,jpm 会优先复用本机的 JDK 21,必要时下载 Temurin,并把 `java=21` 写入项目的 `.jpmrc`。只想安装时可运行 `jpm jdk install 21`。设置用户默认版本使用 `jpm jdk use 21 --global`。 + +查找版本时依次使用命令显式指定的版本、项目配置、项目的 Java 编译目标、用户配置。JDK 可以高于编译目标。要让当前终端也使用同一个 JDK,先查看 `jpm jdk env` 输出。PowerShell 用法见[命令速查](cli.zh-CN.md#windows-powershell)。 + +## 下载镜像 + +| 环境变量 | 用途 | 默认地址 | +| --- | --- | --- | +| `JPM_INITIALIZR_URL` | Spring Initializr 元数据和项目模板 | `https://start.spring.io` | +| `JPM_ADOPTIUM_API` | Temurin 版本信息、归档大小和 SHA-256 摘要 | `https://api.adoptium.net` | +| `JPM_ADOPTIUM_DOWNLOAD` | JDK 压缩包下载 | `https://github.com/adoptium` | + +镜像地址使用 HTTPS。单次创建可以用 `--initializr ` 覆盖环境变量。只设置下载镜像时,jpm 仍使用 Adoptium 官方 API 的摘要校验文件;同时替换 API 后,摘要也来自所配置的镜像。 diff --git a/docs/troubleshooting.zh-CN.md b/docs/troubleshooting.zh-CN.md new file mode 100644 index 0000000..0f5612d --- /dev/null +++ b/docs/troubleshooting.zh-CN.md @@ -0,0 +1,22 @@ +# 故障排查 + +在生成的项目根目录运行 `jpm doctor --json`,查看 Node、JDK、Maven Wrapper 和 POM 的检查结果。 + +| 现象 | 可以怎么查 | +| --- | --- | +| 找不到 jpm,或 PowerShell 禁止运行脚本 | 用 `npm.cmd install -g java-npm-cli` 安装,再运行 `jpm.cmd --version`。Windows 的 PATH 应包含 `npm.cmd prefix -g` 所显示的目录。macOS 和 Linux 检查 `npm prefix -g` 下的 `bin`。 | +| 找不到项目清单 | 进入 `jpm create` 生成的目录,确认有 `package.json`。 | +| JDK 缺失或版本过低 | 用 `jpm jdk list` 查看本机安装,再用 `jpm jdk use 21` 选择项目所需的主版本。完整 JDK 同时提供 java 和 javac。 | +| POM 有手动改动 | 备份并检查 `pom.xml`,把要保留的依赖声明写入 `package.json`。确认后移走旧 POM,再运行 `jpm sync`。 | +| 添加依赖后 Maven 报错 | 声明可能已保存。检查坐标、版本与 Maven 仓库连通性,再运行 `jpm install`。 | +| 8080 端口被占用 | 运行 `jpm dev -- -Dspring-boot.run.arguments=--server.port=8081`,然后访问 8081 端口。 | +| 保存后没有看到变化 | 先检查 Maven 编译日志。编译错误修复后重新保存;修改依赖、JDK 或构建配置后重新启动 `jpm dev`。 | +| 请求成功但示例测试失败 | 生成的 HTTP 测试断言初始问候语。改了 Controller 后,在运行测试前恢复问候语或同步修改测试预期。 | + +## 首次下载 + +npm 分发 CLI,Spring Initializr 提供模板,Adoptium 提供 JDK,Maven 仓库提供 Java 依赖和插件。检查失败请求对应的服务。模板或 JDK 的镜像设置见[项目配置](configuration.zh-CN.md),Maven 仓库使用自己的 settings。 + +## 报告问题 + +附上 jpm、Node 和 JDK 版本、系统和 CPU 架构、执行的命令,以及移除凭据和隐私信息的报错。可以通过 [GitHub Issues](https://github.com/CoderSerio/java-npm/issues) 反馈。 diff --git a/scripts/site/build.py b/scripts/site/build.py new file mode 100644 index 0000000..d50802a --- /dev/null +++ b/scripts/site/build.py @@ -0,0 +1,222 @@ +"""Build the GitHub Pages site from its HTML and the repository's Markdown docs.""" + +import json +from pathlib import Path +import re +import shutil +from string import Template +from xml.etree import ElementTree as ET + +import markdown + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +OUT = ROOT / ".site-build" +BASE = "https://coderserio.github.io/java-npm/" +LANGS = ("en", "zh-CN") +TOPICS = { + "docs/": ( + "cli", + ("Command reference", "命令速查"), + ( + "Look up jpm commands, aliases and options for Spring Boot development.", + "查看 jpm 的全部命令、别名、常用参数及 PowerShell 用法。", + ), + ), + "docs/configuration/": ( + "configuration", + ("Configuration", "项目配置"), + ( + "Configure Maven dependencies, the project JDK and HTTPS download mirrors.", + "配置 Maven 依赖、项目使用的 JDK 和 HTTPS 下载镜像。", + ), + ), + "docs/troubleshooting/": ( + "troubleshooting", + ("Troubleshooting", "故障排查"), + ( + "Diagnose installation, Java selection, Maven and development server errors.", + "排查安装、JDK 选择、Maven 构建和开发服务的问题。", + ), + ), +} +ROUTES = ("", "guide/", *TOPICS) +HEADER = Template((HERE / "header.html").read_text()) +DOCS = Template((HERE / "docs.html").read_text()) + + +def route(lang, section): + return ("zh/" if lang == "zh-CN" else "") + section + + +def absolute(lang, section): + return BASE + route(lang, section) + + +def current(active): + return ' aria-current="page"' if active else "" + + +def header(lang, section, assets): + zh = lang == "zh-CN" + home = assets + route(lang, "") + return HEADER.substitute( + assets=assets, + home=home, + guide=home + "guide/", + docs=home + "docs/", + home_label="jpm 首页" if zh else "jpm home", + navigation="主导航" if zh else "Main navigation", + github_label="GitHub 仓库" if zh else "GitHub repository", + language_label="选择语言" if zh else "Select language", + guide_label="快速上手" if zh else "Quick start", + docs_label="文档" if zh else "Docs", + guide_current=current(section == "guide/"), + docs_current=( + ' aria-current="location"' + if section.startswith("docs/") and section != "docs/" + else current(section == "docs/") + ), + en=assets + route("en", section), + zh=assets + route("zh-CN", section), + en_current=current(not zh), + zh_current=current(zh), + ) + + +def markdown_file(stem, lang): + return stem + (".zh-CN" if lang == "zh-CN" else "") + ".md" + + +def render_docs(lang, section, assets, directory): + idx = LANGS.index(lang) + stem, titles, summaries = TOPICS[section] + source = (ROOT / "docs" / markdown_file(stem, lang)).read_text() + # Relative links in the repo are sibling Markdown files. Publish absolute + # documentation URLs so links also work when a reader downloads index.md. + links = { + markdown_file(data[0], language): absolute(language, path) + for path, data in TOPICS.items() + for language in LANGS + } + links["../SECURITY.md"] = "https://github.com/CoderSerio/java-npm/security/policy" + + def published_link(match): + return "](" + links.get(match[1], match[1]) + match[2] + ")" + + source = re.sub(r"\]\(([^\s)#]+)(#[^\s)]*|)\)", published_link, source) + (directory / "index.md").write_text(source) + local_source = source.replace(BASE, assets) + body = markdown.markdown(local_source, extensions=["tables", "fenced_code", "toc"]) + topics = "".join( + f'
  • ' + f"{data[1][idx]}
  • " + for path, data in TOPICS.items() + ) + alternates = "".join( + f'' + for code, language in [("en", "en"), ("zh-CN", "zh-CN"), ("x-default", "en")] + ) + return DOCS.substitute( + lang=lang, + title=titles[idx], + description=summaries[idx], + canonical=absolute(lang, section), + base=BASE, + assets=assets, + alternates=alternates, + topics=topics, + content=body, + skip=("Skip to content", "跳到正文")[idx], + docs_label=("Docs", "文档")[idx], + ) + + +def build(): + shutil.copytree(ROOT / "site", OUT, dirs_exist_ok=True) + sitemap = ET.Element( + "urlset", + { + "xmlns": "http://www.sitemaps.org/schemas/sitemap/0.9", + "xmlns:xhtml": "http://www.w3.org/1999/xhtml", + }, + ) + index = [ + "# jpm", + "", + "> An npm-style CLI for new single-module Spring Boot MVC projects. " + "Install java-npm-cli with Node.js 22+ on Windows, macOS or Linux. " + "Maven resolves Java dependencies and builds the executable JAR.", + ] + for lang in LANGS: + idx = LANGS.index(lang) + index += [ + "", + "## " + ("English", "简体中文")[idx], + "", + f"- [{('Quick start', '快速上手')[idx]}]({absolute(lang, 'guide/')})", + ] + for section in ROUTES: + path = route(lang, section) + directory = OUT / path + directory.mkdir(parents=True, exist_ok=True) + assets = "../" * path.count("/") or "./" + page = directory / "index.html" + if section in TOPICS: + html = render_docs(lang, section, assets, directory) + _, names, summaries = TOPICS[section] + index.append( + f"- [{names[idx]}]({absolute(lang, section)}index.md): {summaries[idx]}" + ) + else: + html = page.read_text() + assert html.count("") == 1 + html = html.replace("", header(lang, section, assets)) + url = absolute(lang, section) + schema = {"@context": "https://schema.org", "url": url, "inLanguage": lang} + if not section: + schema.update( + { + "@type": ["SoftwareApplication", "SoftwareSourceCode"], + "name": "jpm", + "applicationCategory": "DeveloperApplication", + "operatingSystem": ["Windows", "macOS", "Linux"], + "softwareRequirements": "Node.js >=22", + "codeRepository": "https://github.com/CoderSerio/java-npm", + } + ) + else: + schema.update( + { + "@type": "TechArticle", + "headline": re.search(r"(.*?)", html)[1], + } + ) + metadata = ( + f'\n' + f'' + ) + page.write_text(html.replace("", metadata + "\n")) + node = ET.SubElement(sitemap, "url") + ET.SubElement(node, "loc").text = url + for code, language in [ + ("en", "en"), + ("zh-CN", "zh-CN"), + ("x-default", "en"), + ]: + ET.SubElement( + node, + "xhtml:link", + rel="alternate", + hreflang=code, + href=absolute(language, section), + ) + ET.indent(sitemap) + ET.ElementTree(sitemap).write( + OUT / "sitemap.xml", encoding="utf-8", xml_declaration=True + ) + (OUT / "llms.txt").write_text("\n".join(index) + "\n") + + +if __name__ == "__main__": + build() diff --git a/scripts/site/check.py b/scripts/site/check.py new file mode 100644 index 0000000..29f033a --- /dev/null +++ b/scripts/site/check.py @@ -0,0 +1,85 @@ +"""Check the published navigation, fragment links and crawler entry points.""" + +from html.parser import HTMLParser +import re +from urllib.parse import urldefrag, urljoin +from xml.etree import ElementTree as ET + +from build import BASE, OUT + + +class Page(HTMLParser): + def __init__(self, path): + super().__init__() + self.links = [] + self.ids = set() + self.canonical = [] + self.alternates = {} + self.menu = [] + self.in_header = False + self.feed(path.read_text()) + + def handle_starttag(self, tag, attrs): + attrs = dict(attrs) + if "id" in attrs: + self.ids.add(attrs["id"]) + if tag == "header" and attrs.get("class") == "site-header": + self.in_header = True + if tag == "a" and self.in_header: + self.menu.append(attrs["href"]) + if tag == "link" and attrs.get("rel") == "canonical": + self.canonical.append(attrs["href"]) + if tag == "link" and "hreflang" in attrs: + self.alternates[attrs["hreflang"]] = attrs["href"] + self.links.extend(attrs[key] for key in ("href", "src") if key in attrs) + + def handle_endtag(self, tag): + if tag == "header": + self.in_header = False + + +pages = {} +for path in OUT.rglob("index.html"): + url = urljoin(BASE, path.relative_to(OUT).as_posix().removesuffix("index.html")) + pages[url] = Page(path) +sitemap = ET.parse(OUT / "sitemap.xml") +urls = sitemap.findall("{*}url") +assert {node.findtext("{*}loc") for node in urls} == set(pages) +for node in urls: + url = node.findtext("{*}loc") + page = pages[url] + assert page.canonical == [url], url + assert page.alternates == { + link.get("hreflang"): link.get("href") for link in node.findall("{*}link") + }, url + assert set(page.alternates) == {"en", "zh-CN", "x-default"}, url + for alternate in page.alternates.values(): + assert pages[alternate].alternates == page.alternates, alternate + home = BASE + ("zh/" if url.startswith(BASE + "zh/") else "") + assert [urljoin(url, link) for link in page.menu] == [ + home, + home + "guide/", + home + "docs/", + "https://github.com/CoderSerio/java-npm", + page.alternates["en"], + page.alternates["zh-CN"], + ], url + for link in page.links: + target, fragment = urldefrag(urljoin(url, link)) + assert "/blob/HEAD/docs/" not in target and "/blob/main/docs/" not in target, ( + url, + link, + ) + if not target.startswith(BASE): + continue + if target in pages: + assert not fragment or fragment in pages[target].ids, (url, link) + else: + assert (OUT / target.removeprefix(BASE)).is_file(), (url, link) +for link in re.findall(r"\]\((.*?)\)", (OUT / "llms.txt").read_text()): + assert link in pages or ( + link.startswith(BASE) and (OUT / link.removeprefix(BASE)).is_file() + ), link +print( + f"Checked {len(pages)} pages, their shared navigation, internal links, sitemap and llms.txt." +) diff --git a/scripts/site/docs.html b/scripts/site/docs.html new file mode 100644 index 0000000..fe62687 --- /dev/null +++ b/scripts/site/docs.html @@ -0,0 +1,20 @@ + + + + + $title · jpm + + + $alternates + + + + +$skip + +
    + +
    $content
    +
    + + diff --git a/scripts/site/header.html b/scripts/site/header.html new file mode 100644 index 0000000..a9d3ab0 --- /dev/null +++ b/scripts/site/header.html @@ -0,0 +1,21 @@ + diff --git a/scripts/site/requirements.txt b/scripts/site/requirements.txt new file mode 100644 index 0000000..e925b48 --- /dev/null +++ b/scripts/site/requirements.txt @@ -0,0 +1 @@ +Markdown==3.8.2 diff --git a/site/guide.css b/site/guide.css index 5bc6b87..0d187c0 100644 --- a/site/guide.css +++ b/site/guide.css @@ -39,3 +39,11 @@ .guide-index li + li { margin: 0; } .guide-index a { text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: .2em; } } + +.reference { min-width: 0; overflow-wrap: anywhere; } +.reference h2 { margin-top: 2.5rem; } +.reference table { width: 100%; border-collapse: collapse; font-size: .94rem; } +.reference th, .reference td { padding: .7rem .55rem; border-bottom: 1px solid var(--rule); text-align: start; vertical-align: top; } +.reference td code, .reference li code { color: var(--ink); font: .9em var(--mono); } +.reference :is(ol, ul) { padding-inline-start: 1.5rem; } +.reference li { margin: .5rem 0; } diff --git a/site/guide/index.html b/site/guide/index.html index 3b25d6e..de1cac3 100644 --- a/site/guide/index.html +++ b/site/guide/index.html @@ -13,26 +13,7 @@ Skip to guide - +
    + MIT licenseSitemap diff --git a/site/index.html b/site/index.html index 00699f7..8d7a47d 100644 --- a/site/index.html +++ b/site/index.html @@ -29,27 +29,7 @@ - +
    @@ -106,7 +86,7 @@

    Spring Boot, the n

    Familiar commands

    Commands you already know.

    jpm keeps the npm verbs you use every day. Underneath, Spring Initializr supplies the template, the Maven Wrapper resolves dependencies, and each project selects a JDK major version.

    - See all commands + See all commands
    With npmWith jpm
    @@ -174,7 +154,7 @@

    An empty folder to a runnable JAR.

    Dependencies

    Java dependencies, in JSON.

    Declare a Maven dependency in your project’s package.json. Run jpm install to sync the POM and resolve dependencies with the project’s Maven Wrapper.

    - Read the configuration guide + Read the configuration guide
    package.json excerpt
    @@ -195,7 +175,7 @@

    Java dependencies, in JSON.

    Alpha scope

    Before you install.

    - Troubleshooting + Troubleshooting
    @@ -238,7 +218,8 @@

    Start with one command.

    MIT-licensed open source
    diff --git a/site/style.css b/site/style.css index 8d62a57..3855a03 100644 --- a/site/style.css +++ b/site/style.css @@ -247,14 +247,12 @@ html:not(.js) .channels { display: none; } .js:not(.hero-done) #steamWipe { transform: translateY(880px); } .js:not(.hero-running):not(.hero-done) .mark { visibility: hidden; } .js .hero .reveal { transition: opacity .7s ease, transform .9s var(--ease-out); } -.js:not(.hero-done) .hero .reveal, .js:not(.hero-done) .site-header { opacity: 0; transform: translateY(18px); } -.js .site-header { transition: opacity .7s ease, transform .9s var(--ease-out), background-color .3s ease, border-color .3s ease; } -.js:not(.hero-done) .site-header { transform: translateY(-10px); } +.js:not(.hero-done) .hero .reveal { opacity: 0; transform: translateY(18px); } .hero-done:not(.hero-skipped) .hero .reveal:nth-child(2) { transition-delay: .08s; } .hero-done:not(.hero-skipped) .hero .reveal:nth-child(3) { transition-delay: .16s; } .hero-done:not(.hero-skipped) .hero .reveal:nth-child(4) { transition-delay: .24s; } .hero-done:not(.hero-skipped) .hero .reveal:nth-child(5) { transition-delay: .32s; } -.hero-skipped .hero .reveal, .hero-skipped .site-header { transition-duration: .35s; } +.hero-skipped .hero .reveal { transition-duration: .35s; } /* ---------- tool chips ---------- */ .chip { position: absolute; left: 0; top: 0; will-change: transform; } @@ -453,7 +451,6 @@ h2 em { display: block; } .wrap { width: calc(100% - 2.5rem); } .navlinks { gap: 1rem; font-size: .86rem; } .language-picker { margin-left: -.65rem; } - .navlinks .hide-sm { display: none; } .hero { padding-bottom: 3.5rem; } .chip.optional { display: none; } .chip .tile { width: 2.5rem; height: 2.5rem; border-radius: .75rem; } diff --git a/site/zh/guide/index.html b/site/zh/guide/index.html index 0603f98..97681a3 100644 --- a/site/zh/guide/index.html +++ b/site/zh/guide/index.html @@ -13,26 +13,7 @@ 跳到正文 - +
    + MIT 许可证站点地图 diff --git a/site/zh/index.html b/site/zh/index.html index 7fbd3bb..5f53f28 100644 --- a/site/zh/index.html +++ b/site/zh/index.html @@ -29,27 +29,7 @@ - +
    @@ -106,7 +86,7 @@

    用 npm 的方式

    熟悉的命令

    这些命令,你早就会了。

    jpm 沿用你每天在用的 npm 动词。底层由 Spring Initializr 提供模板,Maven Wrapper 解析依赖,每个项目可以选择自己的 JDK 主版本。

    - 查看命令速查 + 查看命令速查
    用 npm用 jpm
    @@ -174,7 +154,7 @@

    从空目录,到可运行的 JAR。

    依赖管理

    把 Java 依赖 写进 JSON。

    在项目的 package.json 里声明 Maven 依赖。运行 jpm install,jpm 会同步 POM,再通过项目自带的 Maven Wrapper 解析依赖。

    - 查看配置指南(英文) + 查看配置指南
    package.json 节选
    @@ -195,7 +175,7 @@

    把 Java 依赖 写进 JSON。

    alpha 范围

    安装前,你可能想知道。

    - 常见问题排查(英文) + 常见问题排查
    @@ -238,7 +218,8 @@

    一条命令,就能开始。

    采用 MIT 许可证的开源项目