@ykdz/template 0.0.40 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -688,8 +688,8 @@ function contributedDevcontainerComposition(options) {
688
688
  baseLayer: {
689
689
  identity: "node-pnpm",
690
690
  dockerfile: {
691
- source: templateSources.sharedDevcontainer,
692
- from: "node-pnpm.Dockerfile",
691
+ source: templateSources.foundation,
692
+ from: "devcontainer/base.Dockerfile",
693
693
  },
694
694
  buildArguments: [
695
695
  {
@@ -701,6 +701,37 @@ function contributedDevcontainerComposition(options) {
701
701
  probes: [
702
702
  { identity: "procps", command: "ps", args: ["--version"] },
703
703
  { identity: "bubblewrap", command: "bwrap", args: ["--version"] },
704
+ {
705
+ identity: "awk",
706
+ command: "awk",
707
+ args: ["BEGIN { exit (6 * 7 != 42) }"],
708
+ },
709
+ { identity: "ripgrep", command: "rg", args: ["--version"] },
710
+ {
711
+ identity: "jq",
712
+ command: "jq",
713
+ args: ["--exit-status", "--null-input", "{ ready: true } | .ready"],
714
+ },
715
+ {
716
+ identity: "python3",
717
+ command: "python3",
718
+ args: [
719
+ "-c",
720
+ 'import json, pathlib, sqlite3, urllib.request; assert json.loads("true") is True',
721
+ ],
722
+ },
723
+ {
724
+ identity: "python",
725
+ command: "python",
726
+ args: [
727
+ "-c",
728
+ 'import os, shutil, sys; assert sys.version_info.major == 3; assert os.path.samefile(sys.executable, shutil.which("python3"))',
729
+ ],
730
+ },
731
+ { identity: "openssh-client", command: "ssh", args: ["-V"] },
732
+ { identity: "unzip", command: "unzip", args: ["-v"] },
733
+ { identity: "file", command: "file", args: ["--version"] },
734
+ { identity: "iproute2", command: "ss", args: ["--version"] },
704
735
  ],
705
736
  mounts: [
706
737
  {
@@ -6,7 +6,7 @@
6
6
 
7
7
  若这些限制与 Spec、Ticket、ADR 等权威本地文档冲突,应该以权威本地文档为准。
8
8
 
9
- - 开发自动化:非临时维护脚本必须使用 `scripts/**/*.ts` 中可擦除的 TypeScript,而不是 `.mjs` 等 JavaScript 脚本;归所属非构建 TypeScript 项目并受 format、lint、typecheck 覆盖,防止腐化;产品 build 不产出这些脚本。普通 Node 自动化使用原生 TypeScript 执行链。
9
+ - 开发自动化:非临时维护脚本必须使用 `scripts/**/*.ts` 中可擦除的 TypeScript,而不是 `.mjs` 等 JavaScript 脚本;归所属非构建 TypeScript 项目并受 format、lint、typecheck 覆盖,防止腐化;产品 build 不产出这些脚本。普通 Node 自动化使用原生 TypeScript 执行链
10
10
  - 临时脚本:编写临时脚本时,应该将其放到有临时目录语义的位置
11
11
  - 任务归属:优先使用工具原生配置;直接命令与简单 `&&` 编排写在所属 package manifest;只有复杂逻辑才新增 TypeScript script
12
12
  - 包边界:本地文件系统访问留在所属包内;跨包代码与资源通过声明依赖和公开 exports 获取,跨包任务交根 Turbo/pnpm 编排。不要以根目录定位器、跨包物理路径或 `@boundaries-ignore` 绕过边界
@@ -15,3 +15,5 @@
15
15
  - 正式处理链路:开发、回放和端到端验收应复用生产的正式处理链路与制品,入口和配置可不同;同类流程只保留一份实现,迁移后删除旧链路,局部测试不得冒充全链路验收
16
16
  - 用户界面:不要将任何技术细节泄漏到用户可见的 UI 中
17
17
  - 逐步验收:先通过改动相关的局部门禁,交付前再执行较重的验收任务
18
+ - 减少持久文档:以代码和少量权威文档作为事实依据;只有任务明确要求时,才新增或修改持久文档。过程记录、临时方案等放入临时目录
19
+ - 彻底迁移:迁移或迭代替换旧实现时,同步删除已失效的文档、逻辑和代码。只有任务明确要求兼容或临时绕行时,才保留相应旧内容
@@ -6,7 +6,20 @@ ENV PNPM_HOME="/pnpm"
6
6
  ENV PATH="$PNPM_HOME/bin:$PNPM_HOME:$PATH"
7
7
  ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
8
8
  RUN apt-get update \
9
- && apt-get install -y --no-install-recommends ca-certificates git procps bubblewrap \
9
+ && apt-get install -y --no-install-recommends \
10
+ bubblewrap \
11
+ ca-certificates \
12
+ curl \
13
+ file \
14
+ git \
15
+ iproute2 \
16
+ jq \
17
+ openssh-client \
18
+ procps \
19
+ python-is-python3 \
20
+ python3 \
21
+ ripgrep \
22
+ unzip \
10
23
  && rm -rf /var/lib/apt/lists/* \
11
24
  && git config --system init.defaultBranch main \
12
25
  && install -d -m 0755 "$PNPM_HOME" "$PNPM_HOME/bin" \
@@ -3,13 +3,9 @@ ENV RUSTUP_HOME=/usr/local/rustup
3
3
  ENV CARGO_HOME=/usr/local/cargo
4
4
 
5
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
- ca-certificates \
7
- curl \
8
6
  gcc \
9
- git \
10
7
  libc6-dev \
11
- && rm -rf /var/lib/apt/lists/* \
12
- && git config --system init.defaultBranch main
8
+ && rm -rf /var/lib/apt/lists/*
13
9
  RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
14
10
  sh -s -- -y --profile minimal --default-toolchain none \
15
11
  && "${CARGO_HOME}/bin/rustup" toolchain install ${RUST_TOOLCHAIN} --profile minimal --component rustfmt --component clippy \
@@ -1,6 +1,4 @@
1
- RUN apt-get update \
2
- && apt-get install -y --no-install-recommends curl \
3
- && install -m 0755 -d /etc/apt/keyrings \
1
+ RUN install -m 0755 -d /etc/apt/keyrings \
4
2
  && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg -o /etc/apt/keyrings/githubcli-archive-keyring.gpg \
5
3
  && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
6
4
  && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list \
@@ -28,7 +28,6 @@ export declare function renderCargoLockForPackage(options: {
28
28
  }): string;
29
29
  export declare function selectTemplateCargoDependencyVersions(dependencies: readonly string[], catalog?: TemplateCargoDependencyVersions): TemplateCargoDependencyVersions;
30
30
  export declare function renderCargoDependencyTomlEntries(dependencies: readonly string[], catalog?: TemplateCargoDependencyVersions): string[];
31
- export declare function collectGeneratedManifestCatalogDependencies(manifests: readonly GeneratedPackageManifestDependencies[]): string[];
32
31
  export declare function collectGeneratedManifestCatalogReferences(manifests: readonly GeneratedPackageManifestDependencies[]): string[];
33
32
  export declare function pnpmWorkspaceYamlWithCatalogDependencies(workspaceYaml: string, dependencies: readonly string[], templateCatalog?: TemplateDependencyCatalog): string;
34
33
  export declare function renderGeneratedPnpmWorkspaceYaml(options: GeneratedDependencyCatalogOptions): string;
@@ -127,25 +127,6 @@ export function renderCargoDependencyTomlEntries(dependencies, catalog = loadTem
127
127
  return `${renderTomlKey(dependency)} = ${JSON.stringify(version)}`;
128
128
  });
129
129
  }
130
- export function collectGeneratedManifestCatalogDependencies(manifests) {
131
- const dependencies = new Set();
132
- for (const manifest of manifests) {
133
- for (const dependencyMap of [
134
- manifest.dependencies,
135
- manifest.devDependencies,
136
- manifest.optionalDependencies,
137
- manifest.peerDependencies,
138
- ]) {
139
- for (const [dependency, specifier] of Object.entries(dependencyMap ?? {})) {
140
- if (specifier !== "catalog:") {
141
- throw new Error(`Generated manifest dependency ${dependency} must use catalog:, got ${specifier}`);
142
- }
143
- dependencies.add(dependency);
144
- }
145
- }
146
- }
147
- return [...dependencies].toSorted();
148
- }
149
130
  export function collectGeneratedManifestCatalogReferences(manifests) {
150
131
  const dependencies = new Set();
151
132
  for (const manifest of manifests) {
@@ -25,7 +25,7 @@ catalog:
25
25
  "@valibot/to-json-schema": ^1.8.0
26
26
  "@devcontainers/cli": 0.89.0
27
27
  "@hono/node-server": ^2.0.12
28
- "@playwright/test": ^1.62.1
28
+ "@playwright/test": 1.64.0
29
29
  "@tailwindcss/vite": ^4.3.3
30
30
  "@types/node": ^24.13.3
31
31
  "@types/web-bluetooth": ^0.0.21
@@ -1,52 +1,4 @@
1
- import { type CiDiagnosticArtifactDeclaration } from "./ci-diagnostic-artifact.ts";
2
1
  import type { DeploymentEnvironmentNeed } from "./module-graph.ts";
3
- export type CiCapability = {
4
- readonly workflowName: "Check";
5
- readonly jobName: "check";
6
- readonly jobDisplayName: "Root Check";
7
- readonly runner: "ubuntu-latest";
8
- readonly timeoutMinutes: 30;
9
- };
10
- export type CiEnvironmentPreparation = {
11
- readonly nodeFromPackageMetadata: boolean;
12
- readonly packageManagerFromPackageMetadata: boolean;
13
- readonly pnpmStoreCache: boolean;
14
- };
15
- export type PnpmTaskLayer = {
16
- readonly installCommand: "pnpm install --frozen-lockfile";
17
- readonly checkCommand: "pnpm run check";
18
- };
19
- export type CiCheckMatrixEntry = {
20
- readonly capability: "root" | "deployment";
21
- readonly jobDisplayName: "Root Check" | "Deployment Check";
22
- readonly taskEntrypoint: "pnpm run check" | "pnpm run check:deployment";
23
- readonly timeoutMinutes: 30 | 45;
24
- readonly requiresDocker: boolean;
25
- };
26
- export type ProjectCheckWorkflowPlan = {
27
- readonly workflowName: "Check";
28
- readonly triggers: {
29
- readonly pullRequest: true;
30
- readonly pushBranches: readonly ["main"];
31
- };
32
- readonly permissions: {
33
- readonly contents: "read";
34
- };
35
- readonly concurrency: {
36
- readonly group: "${{ github.workflow }}-${{ github.ref }}";
37
- readonly cancelInProgress: true;
38
- };
39
- readonly rootCheck: CiCapability;
40
- readonly matrix: {
41
- readonly failFast: false;
42
- readonly include: readonly CiCheckMatrixEntry[];
43
- } | undefined;
44
- readonly environmentPreparation: CiEnvironmentPreparation;
45
- readonly taskLayer: PnpmTaskLayer;
46
- /** Actual Package Boundaries allowed to own retained native diagnostics. */
47
- readonly packagePaths: readonly string[];
48
- readonly diagnosticArtifacts: readonly CiDiagnosticArtifactDeclaration[];
49
- };
50
2
  export type DependencyEcosystem = "npm" | "cargo" | "github-actions" | "docker" | "devcontainers" | "rust-toolchain";
51
3
  export type DependabotDirectory = `/${string}`;
52
4
  export type DependencyMaintenancePolicy = {
@@ -60,16 +12,6 @@ export type ProjectCheckWorkflowDiagnosticOptions = {
60
12
  readonly packagePaths: readonly string[];
61
13
  readonly diagnosticArtifacts?: readonly unknown[] | undefined;
62
14
  };
63
- type ProjectCheckWorkflowOptions = ProjectCheckWorkflowDiagnosticOptions & {
64
- readonly deploymentCheck?: {
65
- readonly environmentNeeds: readonly DeploymentEnvironmentNeed[];
66
- } | undefined;
67
- readonly capability?: CiCapability | undefined;
68
- readonly environmentPreparation?: Partial<CiEnvironmentPreparation> | undefined;
69
- readonly taskLayer?: PnpmTaskLayer | undefined;
70
- };
71
- /** Capability facts for the Foundation-owned GitHub Actions Template Source. */
72
- export declare function projectCheckWorkflowPlan(options: ProjectCheckWorkflowOptions): ProjectCheckWorkflowPlan;
73
15
  /** Selects a complete Foundation-owned workflow Template Source. */
74
16
  export declare function projectCheckWorkflowTemplateSource(options: ProjectCheckWorkflowDiagnosticOptions & {
75
17
  readonly deploymentCheck?: {
@@ -81,4 +23,3 @@ export declare function projectCheckWorkflowTemplateReplacements(options: Projec
81
23
  export declare function projectDependabotConfig(policy: DependencyMaintenancePolicy): string;
82
24
  /** Limited substitution for the Foundation-owned Dependabot Template Source. */
83
25
  export declare function projectDependabotTemplateReplacements(policy: DependencyMaintenancePolicy): Record<string, string>;
84
- export {};
@@ -5,73 +5,6 @@ function validatedDiagnosticArtifacts(options) {
5
5
  declarations: options.artifacts,
6
6
  });
7
7
  }
8
- const defaultCiCapability = {
9
- workflowName: "Check",
10
- jobName: "check",
11
- jobDisplayName: "Root Check",
12
- runner: "ubuntu-latest",
13
- timeoutMinutes: 30,
14
- };
15
- const pnpmTaskLayer = {
16
- installCommand: "pnpm install --frozen-lockfile",
17
- checkCommand: "pnpm run check",
18
- };
19
- /** Capability facts for the Foundation-owned GitHub Actions Template Source. */
20
- export function projectCheckWorkflowPlan(options) {
21
- const capability = options.capability ?? defaultCiCapability;
22
- const environmentPreparation = {
23
- nodeFromPackageMetadata: true,
24
- packageManagerFromPackageMetadata: true,
25
- pnpmStoreCache: true,
26
- ...options.environmentPreparation,
27
- };
28
- const taskLayer = options.taskLayer ?? pnpmTaskLayer;
29
- const hasDeploymentTask = options.deploymentCheck !== undefined;
30
- const needsDocker = (options.deploymentCheck?.environmentNeeds ?? []).some((need) => need.kind === "docker-engine");
31
- if (hasDeploymentTask && !needsDocker) {
32
- throw new Error("Deployment Check requires a Docker environment need");
33
- }
34
- const packagePaths = [...options.packagePaths];
35
- const diagnosticArtifacts = validatedDiagnosticArtifacts({
36
- packagePaths,
37
- artifacts: options.diagnosticArtifacts ?? [],
38
- });
39
- return {
40
- workflowName: capability.workflowName,
41
- triggers: { pullRequest: true, pushBranches: ["main"] },
42
- permissions: { contents: "read" },
43
- concurrency: {
44
- group: "${{ github.workflow }}-${{ github.ref }}",
45
- cancelInProgress: true,
46
- },
47
- rootCheck: capability,
48
- matrix: hasDeploymentTask
49
- ? {
50
- failFast: false,
51
- include: [
52
- {
53
- capability: "root",
54
- jobDisplayName: capability.jobDisplayName,
55
- taskEntrypoint: taskLayer.checkCommand,
56
- timeoutMinutes: capability.timeoutMinutes,
57
- requiresDocker: false,
58
- },
59
- {
60
- capability: "deployment",
61
- jobDisplayName: "Deployment Check",
62
- taskEntrypoint: "pnpm run check:deployment",
63
- timeoutMinutes: 45,
64
- requiresDocker: true,
65
- },
66
- ],
67
- }
68
- : undefined,
69
- environmentPreparation,
70
- taskLayer,
71
- packagePaths,
72
- diagnosticArtifacts,
73
- };
74
- }
75
8
  /** Selects a complete Foundation-owned workflow Template Source. */
76
9
  export function projectCheckWorkflowTemplateSource(options) {
77
10
  const hasDeploymentTask = options.deploymentCheck !== undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ykdz/template",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "private": false,
5
5
  "description": "Project template generator for YKDZ starter projects.",
6
6
  "keywords": [