@hagicode/hagiscript 0.1.0-dev.11.1.b082f16 → 0.1.0-dev.13.1.6d789f7

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.
package/README.md CHANGED
@@ -246,7 +246,7 @@ GitHub Actions provide three automation paths:
246
246
 
247
247
  - `ci.yml` installs dependencies with `npm ci`, then runs lint, format check, tests, build, and package verification.
248
248
  - `npm-publish.yml` resolves a unique prerelease version from `main`, stamps both `package.json` and `package-lock.json` with `npm version --no-git-tag-version`, then publishes to the `dev` dist-tag.
249
- - `npm-publish.yml` also publishes stable GitHub releases tagged as `vX.Y.Z` to the `latest` dist-tag after validating and stamping the stable version the same way.
249
+ - `npm-publish.yml` also publishes stable GitHub releases tagged as `vX.Y.Z` to the `latest` dist-tag after validating the tag format, rejecting tags older than the repository base version, and stamping the stable version the same way.
250
250
  - `release-drafter.yml` keeps a categorized release draft using `.github/release-drafter.yml`.
251
251
 
252
252
  Before the first publish, make sure the npm organization or user scope `hagicode` exists on npm and grant publish access for `@hagicode/hagiscript`. For GitHub Actions releases, configure npm trusted publishing with package `@hagicode/hagiscript`, owner `HagiCode-org`, repository `hagiscript`, and workflow filename `npm-publish.yml`. Do not enter the full workflow path as the filename; leave the npm environment field empty unless the workflow job explicitly declares an environment. If the scope is missing or the workflow identity cannot create packages under it, npm returns `E404 Not Found` during the final `PUT https://registry.npmjs.org/@hagicode%2fhagiscript` publish request.
package/README_cn.md CHANGED
@@ -237,7 +237,7 @@ GitHub Actions 提供三类自动化流程:
237
237
 
238
238
  - `ci.yml` 使用 `npm ci` 安装依赖,并执行 lint、格式检查、测试、构建和包内容校验。
239
239
  - `npm-publish.yml` 在 `main` 分支解析唯一预发布版本,用 `npm version --no-git-tag-version` 同步 `package.json` 和 `package-lock.json`,再发布到 `dev` dist-tag。
240
- - `npm-publish.yml` 也会在非草稿、非 prerelease 的 GitHub Release 发布时,校验 `vX.Y.Z` 标签,用同样方式写入稳定版本并发布到 `latest` dist-tag。
240
+ - `npm-publish.yml` 也会在非草稿、非 prerelease 的 GitHub Release 发布时,校验 `vX.Y.Z` 标签格式,拒绝早于仓库基础版本的标签,并用同样方式写入稳定版本再发布到 `latest` dist-tag。
241
241
  - `release-drafter.yml` 通过 `.github/release-drafter.yml` 维护分类清晰的发布草稿。
242
242
 
243
243
  首次发布前,需要先确保 npm 上已经存在组织或用户 scope `hagicode`,并且 `@hagicode/hagiscript` 已授权当前发布主体。GitHub Actions 发布时,需要在 npm trusted publishing 中配置:package `@hagicode/hagiscript`、owner `HagiCode-org`、repository `hagiscript`、workflow filename `npm-publish.yml`。不要把 workflow filename 填成完整路径;如果 npm 表单有 environment 字段,除非 workflow job 显式声明了 environment,否则保持为空。如果 scope 不存在,或 workflow 身份无权在该 scope 下创建包,npm 会在最后的 `PUT https://registry.npmjs.org/@hagicode%2fhagiscript` 发布请求中返回 `E404 Not Found`。
package/dist/version.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export declare const packageName = "@hagicode/hagiscript";
2
- export declare const packageVersion = "0.1.0";
3
1
  export interface PackageMetadata {
4
2
  name: string;
5
3
  version: string;
6
4
  }
5
+ export declare const packageName: string;
6
+ export declare const packageVersion: string;
7
7
  export declare function getPackageMetadata(): PackageMetadata;
package/dist/version.js CHANGED
@@ -1,9 +1,23 @@
1
- export const packageName = "@hagicode/hagiscript";
2
- export const packageVersion = "0.1.0";
3
- export function getPackageMetadata() {
1
+ import { readFileSync } from "node:fs";
2
+ function loadPackageMetadata() {
3
+ const packageJsonUrl = new URL("../package.json", import.meta.url);
4
+ const packageJson = JSON.parse(readFileSync(packageJsonUrl, "utf8"));
5
+ if (typeof packageJson.name !== "string" || packageJson.name.length === 0) {
6
+ throw new Error("package.json must define a non-empty string name.");
7
+ }
8
+ if (typeof packageJson.version !== "string" ||
9
+ packageJson.version.length === 0) {
10
+ throw new Error("package.json must define a non-empty string version.");
11
+ }
4
12
  return {
5
- name: packageName,
6
- version: packageVersion
13
+ name: packageJson.name,
14
+ version: packageJson.version
7
15
  };
8
16
  }
17
+ const packageMetadata = loadPackageMetadata();
18
+ export const packageName = packageMetadata.name;
19
+ export const packageVersion = packageMetadata.version;
20
+ export function getPackageMetadata() {
21
+ return { ...packageMetadata };
22
+ }
9
23
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAOtC,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,SAAS,mBAAmB;IAC1B,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAGlE,CAAC;IAEF,IAAI,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,IACE,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ;QACvC,WAAW,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAChC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,OAAO,EAAE,WAAW,CAAC,OAAO;KAC7B,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,mBAAmB,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC;AAChD,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC;AAEtD,MAAM,UAAU,kBAAkB;IAChC,OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;AAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hagicode/hagiscript",
3
- "version": "0.1.0-dev.11.1.b082f16",
3
+ "version": "0.1.0-dev.13.1.6d789f7",
4
4
  "description": "Scoped npm package foundation for Hagiscript language tooling.",
5
5
  "homepage": "https://github.com/HagiCode-org/hagiscript#readme",
6
6
  "bugs": {