chore(repo): format codebase and refine docs
This commit is contained in:
1 parent
638b3169eb
commit
de296d39d8
100 files changed
+23934
-21005
No files matched your search
@@ -1,33 +1,41 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { spawnSync } = require('node:child_process');
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const { spawnSync } = require("node:child_process");
|
||||
|
||||
const projectRoot = path.resolve(__dirname, '..');
|
||||
const projectRoot = path.resolve(__dirname, "..");
|
||||
|
||||
test('src/shared is a real directory in the repository', () => {
|
||||
const sharedPath = path.join(projectRoot, 'src', 'shared');
|
||||
test("src/shared is a real directory in the repository", () => {
|
||||
const sharedPath = path.join(projectRoot, "src", "shared");
|
||||
const stat = fs.statSync(sharedPath);
|
||||
|
||||
assert.equal(stat.isDirectory(), true);
|
||||
});
|
||||
|
||||
test('default build script uses standard TypeScript compiler', () => {
|
||||
const packageJson = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
||||
test("default build script uses standard TypeScript compiler", () => {
|
||||
const packageJson = JSON.parse(
|
||||
fs.readFileSync(path.join(projectRoot, "package.json"), "utf8"),
|
||||
);
|
||||
|
||||
assert.match(packageJson.scripts.build, /\btsc\b/);
|
||||
assert.doesNotMatch(packageJson.scripts.build, /scripts\/transpile\.cjs/);
|
||||
});
|
||||
|
||||
test('project type-check build passes with tsc', () => {
|
||||
const tscJsPath = path.join(projectRoot, 'node_modules', 'typescript', 'lib', 'tsc.js');
|
||||
test("project type-check build passes with tsc", () => {
|
||||
const tscJsPath = path.join(
|
||||
projectRoot,
|
||||
"node_modules",
|
||||
"typescript",
|
||||
"lib",
|
||||
"tsc.js",
|
||||
);
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[tscJsPath, '-p', '.', '--pretty', 'false'],
|
||||
[tscJsPath, "-p", ".", "--pretty", "false"],
|
||||
{
|
||||
cwd: projectRoot,
|
||||
encoding: 'utf8',
|
||||
encoding: "utf8",
|
||||
shell: false,
|
||||
},
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user