@bushizhanghan/dsh-publish-gate 0.11.0 → 0.12.0
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/CHANGELOG.md +6 -0
- package/README.md +2 -1
- package/lib/engine.js +17 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
- `pack-ships-junk` (warn): the tarball carries `.bak-*`, `.orig`, `.swp`, `.log`, `~` or `.DS_Store` debris.
|
|
6
|
+
Naming a directory in `files` takes everything inside it, so a `lib/client.js.bak-20261026` left behind
|
|
7
|
+
during a fix ships to every consumer and stays on npm permanently. Both weapp-loop and page-monitor had
|
|
8
|
+
exactly that file during this session; both were deleted by hand before this rule existed.
|
|
3
9
|
## 0.11.0
|
|
4
10
|
|
|
5
11
|
- `tool-no-description` (error), `tool-description-thin` (warn), `tool-no-parameters` (error): the host
|
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ dsh plugin --profile desktop add @bushizhanghan/dsh-publish-gate
|
|
|
87
87
|
| `pack-oversize` | 解包 >5 MB 是 error、>1 MB 是 warn,并点名最大的三个文件。测试 fixture 是常见元凶——我的一个插件曾把 20 MB 的算例目录发上去,装了它的人每次都要下 20 MB |
|
|
88
88
|
| `pack-ships-secret` | tarball 里有 `.env` / `.npmrc` / `*.pem` / `*.key` / `id_rsa`。没写 `files` 字段时 npm 会把 `.gitignore` 没排除的一切都打包,而包一发布就是公开的、npm 不会帮你撤回 |
|
|
89
89
|
| `pack-unexpected-dir` | `fixtures` / `test` / `tests` / `src` 被打进包里 |
|
|
90
|
+
| `pack-ships-junk` | 包里带上了 `.bak-20261026` 这类备份或编辑器残留。`files: ["lib"]` 会把 `lib/` 里所有东西都打进去——包括你自己源码的上一版,而且发上去就永久公开 |
|
|
90
91
|
| `pack-script-build` | 有 `prepack` / `prepare`:dry run 用了 `--ignore-scripts`,这次清单**不代表**真正发布时的产物 |
|
|
91
92
|
| `pack-unavailable` | npm 跑不起来(warn)——产物层没跑,别把它当干净 |
|
|
92
93
|
|
|
@@ -220,7 +221,7 @@ dsh plugin --profile desktop add @bushizhanghan/dsh-publish-gate
|
|
|
220
221
|
## 开发
|
|
221
222
|
|
|
222
223
|
```sh
|
|
223
|
-
node --test #
|
|
224
|
+
node --test # 104 个引擎单测
|
|
224
225
|
node test/integration.test.mjs # 27 条集成断言(9 个真实插件作 fixture)
|
|
225
226
|
```
|
|
226
227
|
|
package/lib/engine.js
CHANGED
|
@@ -1145,6 +1145,22 @@ export async function checkPack(dir, opts = {}) {
|
|
|
1145
1145
|
if (has(d)) out.push(F('pack-unexpected-dir', 'warn', `the tarball includes ${d}/`, 'A development directory is being published: it bloats the install and ships code nobody runs.', `Add "!${d}" to files if it is not meant to ship.`))
|
|
1146
1146
|
}
|
|
1147
1147
|
|
|
1148
|
+
// Editor and backup debris rides along whenever "files" names a directory:
|
|
1149
|
+
// `files: ["lib"]` ships lib/client.js.bak-20261026 without asking. npm keeps
|
|
1150
|
+
// it forever, and it is the previous version of your code, in public.
|
|
1151
|
+
const junk = files.map((f) => f.path).filter((p) => /\.(?:bak|orig|rej|swp|tmp|log)$|\.bak[-.]|~$|(?:^|\/)\.DS_Store$|(?:^|\/)node_modules\//i.test(p))
|
|
1152
|
+
if (junk.length > 0) {
|
|
1153
|
+
out.push(
|
|
1154
|
+
F(
|
|
1155
|
+
'pack-ships-junk',
|
|
1156
|
+
'warn',
|
|
1157
|
+
`the tarball contains ${junk.length} backup or editor file(s)`,
|
|
1158
|
+
`${junk.slice(0, 3).join(', ')} — naming a directory in "files" takes everything in it, so a .bak copy of your own source ships to every consumer and stays on npm forever.`,
|
|
1159
|
+
'Delete the backups, or add "!lib/**/*.bak*" to files.',
|
|
1160
|
+
),
|
|
1161
|
+
)
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1148
1164
|
const scripts = json?.scripts || {}
|
|
1149
1165
|
const buildHook = scripts.prepack ? 'prepack' : scripts.prepare ? 'prepare' : null
|
|
1150
1166
|
if (buildHook) {
|
|
@@ -2320,7 +2336,7 @@ const RULE_ORDER = [
|
|
|
2320
2336
|
'lib-debugger', 'lib-console-log', 'lib-hardcoded-path', 'lib-url-pathname', 'node-too-old', 'stale-build', 'hand-edited-build',
|
|
2321
2337
|
'undeclared-import', 'dep-in-dev-only', 'unused-dependency',
|
|
2322
2338
|
'pack-omits-lib', 'pack-omits-patch', 'pack-omits-client', 'pack-oversize', 'pack-omits-readme', 'pack-omits-license', 'pack-ships-secret',
|
|
2323
|
-
'pack-unexpected-dir', 'pack-script-build', 'pack-unavailable',
|
|
2339
|
+
'pack-unexpected-dir', 'pack-ships-junk', 'pack-script-build', 'pack-unavailable',
|
|
2324
2340
|
'no-license', 'license-mismatch', 'version-taken', 'version-behind-latest', 'npm-not-logged-in', 'npm-scope-mismatch', 'npm-whoami-unavailable', 'registry-unreachable', 'publish-not-served',
|
|
2325
2341
|
'publish-served-mismatch', 'publish-served', 'market-empty', 'market-no-url', 'market-url-not-github',
|
|
2326
2342
|
'market-no-name', 'market-name-shape', 'market-no-category', 'market-bad-category', 'market-no-desc', 'market-no-en', 'market-no-zh', 'unscoped-name', 'no-git', 'no-readme', 'readme-no-install', 'readme-no-profile', 'readme-wrong-package',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bushizhanghan/dsh-publish-gate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Pre-publish gate for DSH plugins: manifest, dependencies, artifact, runtime, browser half, traceability and market readiness — plus an input fuzzer that drives every declared parameter with the wrong type. 发布前的七层门禁 + 入参模糊测试。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|