@sovovs/bycli 2.1.0 → 2.1.2
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/cli-manifest.json +169 -0
- package/clis/weixin/_wechat/args.js +48 -0
- package/clis/weixin/_wechat/article-content.js +53 -0
- package/clis/weixin/_wechat/article-service.js +124 -0
- package/clis/weixin/_wechat/auth-session.js +142 -0
- package/clis/weixin/_wechat/fingerprint.js +443 -0
- package/clis/weixin/_wechat/fixtures/articles-auth-expired.json +3 -0
- package/clis/weixin/_wechat/fixtures/articles-page.json +4 -0
- package/clis/weixin/_wechat/fixtures/search-auth-expired.json +4 -0
- package/clis/weixin/_wechat/fixtures/search-success.json +7 -0
- package/clis/weixin/_wechat/markdown.js +29 -0
- package/clis/weixin/_wechat/redact.js +405 -0
- package/clis/weixin/_wechat/save-service.js +175 -0
- package/clis/weixin/_wechat/search-biz.js +102 -0
- package/clis/weixin/_wechat/wechat-api.js +133 -0
- package/clis/weixin/accounts.js +38 -0
- package/clis/weixin/articles.js +35 -0
- package/clis/weixin/download.js +5 -47
- package/clis/weixin/save-articles.js +175 -0
- package/dist/src/daemon-config.d.ts +2 -0
- package/dist/src/daemon-config.js +11 -0
- package/dist/src/daemon-config.test.d.ts +1 -0
- package/dist/src/daemon.d.ts +1 -1
- package/dist/src/daemon.js +5 -3
- package/dist/src/download/article-download.d.ts +6 -0
- package/dist/src/download/article-download.js +78 -17
- package/dist/src/download/wechat-article.d.ts +8 -0
- package/dist/src/download/wechat-article.js +137 -0
- package/dist/src/download/wechat-article.test.d.ts +1 -0
- package/dist/src/recorder/highlevel/verify.d.ts +3 -0
- package/dist/src/recorder/highlevel/verify.js +4 -0
- package/dist/src/recorder/highlevel/verify.test.d.ts +1 -0
- package/dist/src/recorder/http/handlers.js +27 -1
- package/dist/src/recorder/runner/runner-port.js +1 -0
- package/dist/src/recorder/runner/verify-runner-main.d.ts +17 -2
- package/dist/src/recorder/runner/verify-runner-main.js +70 -14
- package/dist/src/release-workflow.test.d.ts +1 -0
- package/dist/src/weixin-built-in-docs.test.d.ts +1 -0
- package/package.json +7 -3
- package/scripts/check-package-install.mjs +71 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
9
|
+
const temp = mkdtempSync(join(tmpdir(), 'bycli-package-install-'));
|
|
10
|
+
const artifacts = join(temp, 'artifacts');
|
|
11
|
+
const project = join(temp, 'project');
|
|
12
|
+
const mainStage = join(temp, 'main-package');
|
|
13
|
+
|
|
14
|
+
function run(command, args, cwd = root) {
|
|
15
|
+
return execFileSync(command, args, {
|
|
16
|
+
cwd,
|
|
17
|
+
encoding: 'utf8',
|
|
18
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function pack(cwd) {
|
|
23
|
+
const result = JSON.parse(run('npm', [
|
|
24
|
+
'pack', '--json', '--ignore-scripts', '--pack-destination', artifacts,
|
|
25
|
+
], cwd));
|
|
26
|
+
assert.equal(result.length, 1);
|
|
27
|
+
return {
|
|
28
|
+
tarball: join(artifacts, result[0].filename),
|
|
29
|
+
files: new Set(result[0].files.map(({ path }) => path)),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
mkdirSync(artifacts, { recursive: true });
|
|
35
|
+
mkdirSync(project, { recursive: true });
|
|
36
|
+
mkdirSync(mainStage, { recursive: true });
|
|
37
|
+
for (const path of [
|
|
38
|
+
'package.json', 'dist', 'clis', 'cli-manifest.json', 'scripts',
|
|
39
|
+
'README.md', 'README.zh-CN.md', 'LICENSE', 'NOTICE',
|
|
40
|
+
]) {
|
|
41
|
+
cpSync(join(root, path), join(mainStage, path), { recursive: true });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const core = pack(join(root, 'packages/recorder-core'));
|
|
45
|
+
const main = pack(mainStage);
|
|
46
|
+
|
|
47
|
+
for (const file of ['dist/index.js', 'dist/index.d.ts', 'README.md', 'LICENSE']) {
|
|
48
|
+
assert(core.files.has(file), `recorder-core tarball is missing ${file}`);
|
|
49
|
+
}
|
|
50
|
+
assert(![...core.files].some((file) => file.startsWith('src/')), 'recorder-core tarball includes src/');
|
|
51
|
+
|
|
52
|
+
writeFileSync(join(project, 'package.json'), JSON.stringify({ private: true, type: 'module' }));
|
|
53
|
+
run('npm', [
|
|
54
|
+
'install', '--ignore-scripts', '--no-audit', '--no-fund', core.tarball, main.tarball,
|
|
55
|
+
], project);
|
|
56
|
+
|
|
57
|
+
const mainManifest = JSON.parse(readFileSync(join(
|
|
58
|
+
project, 'node_modules/@sovovs/bycli/package.json',
|
|
59
|
+
), 'utf8'));
|
|
60
|
+
assert.equal(mainManifest.dependencies?.['@sovovs/bycli-recorder-core'], '^0.1.0');
|
|
61
|
+
|
|
62
|
+
const coreDirectory = join(project, 'node_modules/@sovovs/bycli-recorder-core');
|
|
63
|
+
const recorderEntry = join(
|
|
64
|
+
project, 'node_modules/@sovovs/bycli/dist/src/browser/analyze.js',
|
|
65
|
+
);
|
|
66
|
+
await import(pathToFileURL(recorderEntry).href);
|
|
67
|
+
await import(pathToFileURL(join(coreDirectory, 'dist/index.js')).href);
|
|
68
|
+
console.log('package install smoke test passed');
|
|
69
|
+
} finally {
|
|
70
|
+
rmSync(temp, { recursive: true, force: true });
|
|
71
|
+
}
|