@regardio/dev 1.24.0 → 2.0.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/README.md +2 -2
- package/dist/bin/ship/hotfix.bin.mjs +140 -0
- package/dist/bin/ship/production.bin.mjs +120 -0
- package/dist/bin/ship/staging.bin.mjs +70 -0
- package/dist/bin/ship/utils-BQ-JZ2D5.mjs +45 -0
- package/dist/playwright/index.d.mts +24 -0
- package/dist/playwright/index.mjs +61 -0
- package/dist/vitest/node.d.mts +22 -0
- package/dist/vitest/node.mjs +28 -0
- package/dist/vitest/react.d.mts +22 -0
- package/dist/vitest/react.mjs +28 -0
- package/docs/en/README.md +95 -0
- package/docs/en/agents.md +57 -0
- package/docs/en/standards/api.md +324 -0
- package/docs/en/standards/coding.md +144 -0
- package/docs/en/standards/commits.md +111 -0
- package/docs/en/standards/documentation.md +173 -0
- package/docs/en/standards/naming.md +180 -0
- package/docs/en/standards/principles.md +84 -0
- package/docs/en/standards/react.md +246 -0
- package/docs/en/standards/sql.md +258 -0
- package/docs/en/standards/testing.md +139 -0
- package/docs/en/standards/writing.md +119 -0
- package/docs/en/tools/biome.md +89 -0
- package/docs/en/tools/commitlint.md +92 -0
- package/docs/en/tools/dependencies.md +116 -0
- package/docs/en/tools/husky.md +90 -0
- package/docs/en/tools/markdownlint.md +84 -0
- package/docs/en/tools/playwright.md +117 -0
- package/docs/en/tools/releases.md +242 -0
- package/docs/en/tools/typescript.md +89 -0
- package/docs/en/tools/vitest.md +146 -0
- package/package.json +57 -70
- package/src/biome/preset.json +3 -0
- package/templates/changeset/README.md +14 -0
- package/templates/changeset/config.json +11 -0
- package/templates/github/release.yml +77 -0
- package/dist/bin/exec/clean.d.ts +0 -3
- package/dist/bin/exec/clean.d.ts.map +0 -1
- package/dist/bin/exec/clean.js +0 -25
- package/dist/bin/exec/clean.test.d.ts +0 -2
- package/dist/bin/exec/clean.test.d.ts.map +0 -1
- package/dist/bin/exec/clean.test.js +0 -45
- package/dist/bin/exec/husky.d.ts +0 -3
- package/dist/bin/exec/husky.d.ts.map +0 -1
- package/dist/bin/exec/husky.js +0 -9
- package/dist/bin/exec/p.d.ts +0 -3
- package/dist/bin/exec/p.d.ts.map +0 -1
- package/dist/bin/exec/p.js +0 -8
- package/dist/bin/exec/s.d.ts +0 -3
- package/dist/bin/exec/s.d.ts.map +0 -1
- package/dist/bin/exec/s.js +0 -8
- package/dist/bin/exec/tsc.d.ts +0 -3
- package/dist/bin/exec/tsc.d.ts.map +0 -1
- package/dist/bin/exec/tsc.js +0 -8
- package/dist/bin/lint/biome.d.ts +0 -3
- package/dist/bin/lint/biome.d.ts.map +0 -1
- package/dist/bin/lint/biome.js +0 -8
- package/dist/bin/lint/commit.d.ts +0 -3
- package/dist/bin/lint/commit.d.ts.map +0 -1
- package/dist/bin/lint/commit.js +0 -8
- package/dist/bin/lint/md.d.ts +0 -3
- package/dist/bin/lint/md.d.ts.map +0 -1
- package/dist/bin/lint/md.js +0 -16
- package/dist/bin/lint/package.d.ts +0 -4
- package/dist/bin/lint/package.d.ts.map +0 -1
- package/dist/bin/lint/package.js +0 -81
- package/dist/bin/lint/package.test.d.ts +0 -2
- package/dist/bin/lint/package.test.d.ts.map +0 -1
- package/dist/bin/lint/package.test.js +0 -65
- package/dist/bin/ship/hotfix.d.ts +0 -3
- package/dist/bin/ship/hotfix.d.ts.map +0 -1
- package/dist/bin/ship/hotfix.js +0 -141
- package/dist/bin/ship/production.d.ts +0 -3
- package/dist/bin/ship/production.d.ts.map +0 -1
- package/dist/bin/ship/production.js +0 -124
- package/dist/bin/ship/staging.d.ts +0 -3
- package/dist/bin/ship/staging.d.ts.map +0 -1
- package/dist/bin/ship/staging.js +0 -51
- package/dist/bin/ship/utils.d.ts +0 -9
- package/dist/bin/ship/utils.d.ts.map +0 -1
- package/dist/bin/ship/utils.js +0 -63
- package/dist/bin/ship/utils.test.d.ts +0 -2
- package/dist/bin/ship/utils.test.d.ts.map +0 -1
- package/dist/bin/ship/utils.test.js +0 -127
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -101
- package/dist/playwright/index.d.ts +0 -10
- package/dist/playwright/index.d.ts.map +0 -1
- package/dist/playwright/index.js +0 -42
- package/dist/playwright/index.test.d.ts +0 -2
- package/dist/playwright/index.test.d.ts.map +0 -1
- package/dist/playwright/index.test.js +0 -55
- package/dist/testing/setup-react.d.ts +0 -2
- package/dist/testing/setup-react.d.ts.map +0 -1
- package/dist/testing/setup-react.js +0 -1
- package/dist/vitest/node.d.ts +0 -22
- package/dist/vitest/node.d.ts.map +0 -1
- package/dist/vitest/node.js +0 -16
- package/dist/vitest/react.d.ts +0 -17
- package/dist/vitest/react.d.ts.map +0 -1
- package/dist/vitest/react.js +0 -12
- package/src/bin/exec/clean.test.ts +0 -63
- package/src/bin/exec/clean.ts +0 -36
- package/src/bin/exec/husky.ts +0 -14
- package/src/bin/exec/p.ts +0 -13
- package/src/bin/exec/s.ts +0 -13
- package/src/bin/exec/tsc.ts +0 -13
- package/src/bin/lint/biome.ts +0 -13
- package/src/bin/lint/commit.ts +0 -13
- package/src/bin/lint/md.ts +0 -28
- package/src/bin/lint/package.test.ts +0 -83
- package/src/bin/lint/package.ts +0 -108
- package/src/bin/ship/hotfix.ts +0 -241
- package/src/bin/ship/production.ts +0 -240
- package/src/bin/ship/staging.ts +0 -108
- package/src/bin/ship/utils.test.ts +0 -178
- package/src/bin/ship/utils.ts +0 -109
- package/src/config.test.ts +0 -129
- package/src/markdownlint/markdownlint-cli2.jsonc +0 -9
- package/src/playwright/index.test.ts +0 -73
- package/src/playwright/index.ts +0 -63
- package/src/templates/release.yml +0 -128
- package/src/testing/setup-react.ts +0 -8
- package/src/vitest/node.ts +0 -25
- package/src/vitest/react.ts +0 -19
- /package/{src → templates}/sqlfluff/setup.cfg +0 -0
package/dist/bin/ship/utils.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { execFileSync, execSync } from 'node:child_process';
|
|
2
|
-
import { closeSync, existsSync, openSync, readFileSync, readSync, writeFileSync } from 'node:fs';
|
|
3
|
-
export const git = (...args) => {
|
|
4
|
-
console.log(`$ git ${args.join(' ')}`);
|
|
5
|
-
execFileSync('git', args, { stdio: 'inherit' });
|
|
6
|
-
};
|
|
7
|
-
export const gitRead = (...args) => execFileSync('git', args, { encoding: 'utf-8' }).trim();
|
|
8
|
-
export const runScript = (script) => {
|
|
9
|
-
console.log(`$ pnpm ${script}`);
|
|
10
|
-
execSync(`pnpm ${script}`, { stdio: 'inherit' });
|
|
11
|
-
};
|
|
12
|
-
export const bumpVersion = (current, bump) => {
|
|
13
|
-
const parts = current.split('.').map(Number);
|
|
14
|
-
if (parts.length !== 3 || parts.some(Number.isNaN)) {
|
|
15
|
-
throw new Error(`Invalid semver: ${current}`);
|
|
16
|
-
}
|
|
17
|
-
const [major, minor, patch] = parts;
|
|
18
|
-
if (bump === 'major')
|
|
19
|
-
return `${major + 1}.0.0`;
|
|
20
|
-
if (bump === 'minor')
|
|
21
|
-
return `${major}.${minor + 1}.0`;
|
|
22
|
-
return `${major}.${minor}.${patch + 1}`;
|
|
23
|
-
};
|
|
24
|
-
export const insertChangelog = (changelogPath, entry) => {
|
|
25
|
-
if (existsSync(changelogPath)) {
|
|
26
|
-
const existing = readFileSync(changelogPath, 'utf-8');
|
|
27
|
-
const insertAt = existing.indexOf('\n## ');
|
|
28
|
-
if (insertAt === -1) {
|
|
29
|
-
writeFileSync(changelogPath, `${existing.trimEnd()}\n\n${entry}`);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
writeFileSync(changelogPath, `${existing.slice(0, insertAt)}\n\n${entry}${existing.slice(insertAt + 1)}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
writeFileSync(changelogPath, `# Changelog\n\n${entry}`);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const runQualityChecks = () => {
|
|
40
|
-
runScript('build');
|
|
41
|
-
runScript('typecheck');
|
|
42
|
-
runScript('test');
|
|
43
|
-
};
|
|
44
|
-
export const branchExists = (name) => gitRead('branch', '--list', name) !== ''
|
|
45
|
-
|| gitRead('branch', '--list', '--remotes', `origin/${name}`) !== '';
|
|
46
|
-
export const confirm = (prompt, ttyPath = '/dev/tty') => {
|
|
47
|
-
process.stdout.write(`${prompt} (y/N) `);
|
|
48
|
-
const buf = Buffer.alloc(1024);
|
|
49
|
-
let fd;
|
|
50
|
-
let shouldClose = false;
|
|
51
|
-
try {
|
|
52
|
-
fd = openSync(ttyPath, 'r');
|
|
53
|
-
shouldClose = true;
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
fd = process.stdin.fd;
|
|
57
|
-
}
|
|
58
|
-
const bytesRead = readSync(fd, buf, 0, buf.length, null);
|
|
59
|
-
if (shouldClose)
|
|
60
|
-
closeSync(fd);
|
|
61
|
-
const answer = buf.slice(0, bytesRead).toString().trim();
|
|
62
|
-
return answer === 'y' || answer === 'Y';
|
|
63
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../src/bin/ship/utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
-
import { bumpVersion, confirm, insertChangelog } from './utils.js';
|
|
6
|
-
describe('bumpVersion', () => {
|
|
7
|
-
it('bumps patch', () => {
|
|
8
|
-
expect(bumpVersion('1.2.3', 'patch')).toBe('1.2.4');
|
|
9
|
-
});
|
|
10
|
-
it('bumps minor and resets patch', () => {
|
|
11
|
-
expect(bumpVersion('1.2.3', 'minor')).toBe('1.3.0');
|
|
12
|
-
});
|
|
13
|
-
it('bumps major and resets minor + patch', () => {
|
|
14
|
-
expect(bumpVersion('1.2.3', 'major')).toBe('2.0.0');
|
|
15
|
-
});
|
|
16
|
-
it('handles zero components', () => {
|
|
17
|
-
expect(bumpVersion('0.0.0', 'patch')).toBe('0.0.1');
|
|
18
|
-
expect(bumpVersion('0.0.0', 'minor')).toBe('0.1.0');
|
|
19
|
-
expect(bumpVersion('0.0.0', 'major')).toBe('1.0.0');
|
|
20
|
-
});
|
|
21
|
-
it('defaults to patch for unknown bump type', () => {
|
|
22
|
-
expect(bumpVersion('1.2.3', 'unknown')).toBe('1.2.4');
|
|
23
|
-
});
|
|
24
|
-
it('throws for invalid semver', () => {
|
|
25
|
-
expect(() => bumpVersion('not-semver', 'patch')).toThrow('Invalid semver');
|
|
26
|
-
expect(() => bumpVersion('1.2', 'patch')).toThrow('Invalid semver');
|
|
27
|
-
expect(() => bumpVersion('1.2.x', 'patch')).toThrow('Invalid semver');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe('insertChangelog', () => {
|
|
31
|
-
let tmpDir;
|
|
32
|
-
let changelogPath;
|
|
33
|
-
beforeEach(() => {
|
|
34
|
-
tmpDir = join(tmpdir(), `flow-utils-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
35
|
-
mkdirSync(tmpDir, { recursive: true });
|
|
36
|
-
changelogPath = join(tmpDir, 'CHANGELOG.md');
|
|
37
|
-
});
|
|
38
|
-
afterEach(() => {
|
|
39
|
-
rmSync(tmpDir, { force: true, recursive: true });
|
|
40
|
-
});
|
|
41
|
-
it('creates a new file when none exists', () => {
|
|
42
|
-
insertChangelog(changelogPath, '## [1.0.0] - 2025-01-01\n\n- initial release\n');
|
|
43
|
-
expect(existsSync(changelogPath)).toBe(true);
|
|
44
|
-
const content = readFileSync(changelogPath, 'utf-8');
|
|
45
|
-
expect(content).toContain('# Changelog');
|
|
46
|
-
expect(content).toContain('## [1.0.0] - 2025-01-01');
|
|
47
|
-
});
|
|
48
|
-
it('inserts before the first existing ## section', () => {
|
|
49
|
-
writeFileSync(changelogPath, '# Changelog\n\n## [1.0.0] - 2025-01-01\n\n- old entry\n');
|
|
50
|
-
insertChangelog(changelogPath, '## [1.1.0] - 2025-02-01\n\n- new entry\n');
|
|
51
|
-
const content = readFileSync(changelogPath, 'utf-8');
|
|
52
|
-
const newIdx = content.indexOf('## [1.1.0]');
|
|
53
|
-
const oldIdx = content.indexOf('## [1.0.0]');
|
|
54
|
-
expect(newIdx).toBeLessThan(oldIdx);
|
|
55
|
-
});
|
|
56
|
-
it('appends when no ## section exists yet', () => {
|
|
57
|
-
writeFileSync(changelogPath, '# Changelog\n');
|
|
58
|
-
insertChangelog(changelogPath, '## [1.0.0] - 2025-01-01\n\n- initial\n');
|
|
59
|
-
const content = readFileSync(changelogPath, 'utf-8');
|
|
60
|
-
expect(content).toContain('## [1.0.0]');
|
|
61
|
-
});
|
|
62
|
-
it('preserves existing entries when inserting', () => {
|
|
63
|
-
writeFileSync(changelogPath, '# Changelog\n\n## [1.0.0] - 2025-01-01\n\n- old entry\n');
|
|
64
|
-
insertChangelog(changelogPath, '## [1.1.0] - 2025-02-01\n\n- new entry\n');
|
|
65
|
-
const content = readFileSync(changelogPath, 'utf-8');
|
|
66
|
-
expect(content).toContain('## [1.0.0]');
|
|
67
|
-
expect(content).toContain('- old entry');
|
|
68
|
-
expect(content).toContain('## [1.1.0]');
|
|
69
|
-
expect(content).toContain('- new entry');
|
|
70
|
-
});
|
|
71
|
-
it('appends when file exists but has no title line', () => {
|
|
72
|
-
writeFileSync(changelogPath, '## [1.0.0] - 2025-01-01\n\n- old entry\n');
|
|
73
|
-
insertChangelog(changelogPath, '## [1.1.0] - 2025-02-01\n\n- new entry\n');
|
|
74
|
-
const content = readFileSync(changelogPath, 'utf-8');
|
|
75
|
-
expect(content).toContain('## [1.0.0]');
|
|
76
|
-
expect(content).toContain('## [1.1.0]');
|
|
77
|
-
});
|
|
78
|
-
it('handles multiple existing entries in the correct order', () => {
|
|
79
|
-
writeFileSync(changelogPath, '# Changelog\n\n## [1.1.0] - 2025-02-01\n\n- second\n\n## [1.0.0] - 2025-01-01\n\n- first\n');
|
|
80
|
-
insertChangelog(changelogPath, '## [1.2.0] - 2025-03-01\n\n- third\n');
|
|
81
|
-
const content = readFileSync(changelogPath, 'utf-8');
|
|
82
|
-
const idx120 = content.indexOf('## [1.2.0]');
|
|
83
|
-
const idx110 = content.indexOf('## [1.1.0]');
|
|
84
|
-
const idx100 = content.indexOf('## [1.0.0]');
|
|
85
|
-
expect(idx120).toBeLessThan(idx110);
|
|
86
|
-
expect(idx110).toBeLessThan(idx100);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe('confirm', () => {
|
|
90
|
-
let tmpDir;
|
|
91
|
-
let inputFile;
|
|
92
|
-
beforeEach(() => {
|
|
93
|
-
tmpDir = join(tmpdir(), `confirm-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
94
|
-
mkdirSync(tmpDir, { recursive: true });
|
|
95
|
-
inputFile = join(tmpDir, 'input');
|
|
96
|
-
vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
|
|
97
|
-
});
|
|
98
|
-
afterEach(() => {
|
|
99
|
-
rmSync(tmpDir, { force: true, recursive: true });
|
|
100
|
-
vi.restoreAllMocks();
|
|
101
|
-
});
|
|
102
|
-
it('returns true for "y"', () => {
|
|
103
|
-
writeFileSync(inputFile, 'y\n');
|
|
104
|
-
expect(confirm('Continue?', inputFile)).toBe(true);
|
|
105
|
-
});
|
|
106
|
-
it('returns true for "Y"', () => {
|
|
107
|
-
writeFileSync(inputFile, 'Y\n');
|
|
108
|
-
expect(confirm('Continue?', inputFile)).toBe(true);
|
|
109
|
-
});
|
|
110
|
-
it('returns false for "n"', () => {
|
|
111
|
-
writeFileSync(inputFile, 'n\n');
|
|
112
|
-
expect(confirm('Continue?', inputFile)).toBe(false);
|
|
113
|
-
});
|
|
114
|
-
it('returns false for empty input', () => {
|
|
115
|
-
writeFileSync(inputFile, '\n');
|
|
116
|
-
expect(confirm('Continue?', inputFile)).toBe(false);
|
|
117
|
-
});
|
|
118
|
-
it('returns false for any other input', () => {
|
|
119
|
-
writeFileSync(inputFile, 'yes\n');
|
|
120
|
-
expect(confirm('Continue?', inputFile)).toBe(false);
|
|
121
|
-
});
|
|
122
|
-
it('writes the prompt to stdout', () => {
|
|
123
|
-
writeFileSync(inputFile, 'y\n');
|
|
124
|
-
confirm('Ship it?', inputFile);
|
|
125
|
-
expect(process.stdout.write).toHaveBeenCalledWith('Ship it? (y/N) ');
|
|
126
|
-
});
|
|
127
|
-
});
|
package/dist/config.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../src/config.test.ts"],"names":[],"mappings":""}
|
package/dist/config.test.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
const srcDir = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
function readJson(filePath) {
|
|
7
|
-
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
8
|
-
}
|
|
9
|
-
describe('Config Structure Validation', () => {
|
|
10
|
-
describe('biome/preset.json', () => {
|
|
11
|
-
const configPath = path.join(srcDir, 'biome/preset.json');
|
|
12
|
-
const config = readJson(configPath);
|
|
13
|
-
it('has $schema defined', () => {
|
|
14
|
-
expect(config.$schema).toContain('biomejs.dev');
|
|
15
|
-
});
|
|
16
|
-
it('has linter enabled', () => {
|
|
17
|
-
expect(config.linter?.enabled).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
it('has formatter enabled', () => {
|
|
20
|
-
expect(config.formatter?.enabled).toBe(true);
|
|
21
|
-
});
|
|
22
|
-
it('has recommended rules enabled', () => {
|
|
23
|
-
expect(config.linter?.rules?.recommended).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it('disallows explicit any', () => {
|
|
26
|
-
expect(config.linter?.rules?.suspicious?.noExplicitAny).toBe('error');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
describe('typescript/base.json', () => {
|
|
30
|
-
const configPath = path.join(srcDir, 'typescript/base.json');
|
|
31
|
-
const config = readJson(configPath);
|
|
32
|
-
it('has $schema defined', () => {
|
|
33
|
-
expect(config.$schema).toContain('schemastore.org');
|
|
34
|
-
});
|
|
35
|
-
it('has strict mode enabled', () => {
|
|
36
|
-
expect(config.compilerOptions?.strict).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
it('has noUncheckedIndexedAccess enabled', () => {
|
|
39
|
-
expect(config.compilerOptions?.noUncheckedIndexedAccess).toBe(true);
|
|
40
|
-
});
|
|
41
|
-
it('has strictNullChecks enabled', () => {
|
|
42
|
-
expect(config.compilerOptions?.strictNullChecks).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
it('has noImplicitAny enabled', () => {
|
|
45
|
-
expect(config.compilerOptions?.noImplicitAny).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
it('targets ES2022', () => {
|
|
48
|
-
expect(config.compilerOptions?.target).toBe('ES2022');
|
|
49
|
-
});
|
|
50
|
-
it('uses ESNext module', () => {
|
|
51
|
-
expect(config.compilerOptions?.module).toBe('ESNext');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('typescript/react.json', () => {
|
|
55
|
-
const configPath = path.join(srcDir, 'typescript/react.json');
|
|
56
|
-
const config = readJson(configPath);
|
|
57
|
-
it('extends base.json', () => {
|
|
58
|
-
expect(config.extends).toContain('./base.json');
|
|
59
|
-
});
|
|
60
|
-
it('has jsx set to react-jsx', () => {
|
|
61
|
-
expect(config.compilerOptions?.jsx).toBe('react-jsx');
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe('markdownlint/markdownlint.json', () => {
|
|
65
|
-
const configPath = path.join(srcDir, 'markdownlint/markdownlint.json');
|
|
66
|
-
const config = readJson(configPath);
|
|
67
|
-
it('is a valid JSON object', () => {
|
|
68
|
-
expect(typeof config).toBe('object');
|
|
69
|
-
expect(config).not.toBeNull();
|
|
70
|
-
});
|
|
71
|
-
it('has MD013 (line-length) rule configured', () => {
|
|
72
|
-
expect(config.MD013).toBeDefined();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
describe('commitlint/commitlint.cjs', () => {
|
|
76
|
-
const configPath = path.join(srcDir, 'commitlint/commitlint.cjs');
|
|
77
|
-
it('file exists', () => {
|
|
78
|
-
expect(fs.existsSync(configPath)).toBe(true);
|
|
79
|
-
});
|
|
80
|
-
it('exports extends with conventional config', () => {
|
|
81
|
-
const content = fs.readFileSync(configPath, 'utf8');
|
|
82
|
-
expect(content).toContain('@commitlint/config-conventional');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
describe('Vitest Configs', () => {
|
|
87
|
-
describe('vitest/node', () => {
|
|
88
|
-
it('exports vitestNodeConfig', async () => {
|
|
89
|
-
const { vitestNodeConfig } = await import('./vitest/node.js');
|
|
90
|
-
expect(vitestNodeConfig).toBeDefined();
|
|
91
|
-
expect(vitestNodeConfig.environment).toBe('node');
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe('vitest/react', () => {
|
|
95
|
-
it('exports vitestReactConfig', async () => {
|
|
96
|
-
const { vitestReactConfig } = await import('./vitest/react.js');
|
|
97
|
-
expect(vitestReactConfig).toBeDefined();
|
|
98
|
-
expect(vitestReactConfig.environment).toBe('jsdom');
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PlaywrightTestConfig } from '@playwright/test';
|
|
2
|
-
export interface BuildPlaywrightBaseConfigParams {
|
|
3
|
-
appPort: number;
|
|
4
|
-
appUrl: string;
|
|
5
|
-
ci?: boolean;
|
|
6
|
-
devices: typeof import('@playwright/test').devices;
|
|
7
|
-
webServerCommand: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function buildPlaywrightBaseConfig({ appUrl, appPort, devices, ci, webServerCommand, }: BuildPlaywrightBaseConfigParams): PlaywrightTestConfig;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/playwright/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,cAAc,kBAAkB,EAAE,OAAO,CAAC;IACnD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAMD,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,OAAO,EACP,OAAO,EACP,EAAqB,EACrB,gBAAgB,GACjB,EAAE,+BAA+B,GAAG,oBAAoB,CA0CxD"}
|
package/dist/playwright/index.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export function buildPlaywrightBaseConfig({ appUrl, appPort, devices, ci = !!process.env.CI, webServerCommand, }) {
|
|
2
|
-
if (!appUrl || typeof appUrl !== 'string') {
|
|
3
|
-
throw new Error('[playwright] appUrl must be a non-empty string');
|
|
4
|
-
}
|
|
5
|
-
if (!appPort || typeof appPort !== 'number') {
|
|
6
|
-
throw new Error('[playwright] appPort must be a number');
|
|
7
|
-
}
|
|
8
|
-
if (!devices) {
|
|
9
|
-
throw new Error('[playwright] devices must be provided from "@playwright/test"');
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
forbidOnly: ci,
|
|
13
|
-
fullyParallel: true,
|
|
14
|
-
outputDir: './tests/test-results',
|
|
15
|
-
projects: [
|
|
16
|
-
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
|
17
|
-
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
|
|
18
|
-
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
|
|
19
|
-
{
|
|
20
|
-
name: 'iPad Pro 11 landscape',
|
|
21
|
-
use: { ...devices['iPad Pro 11 landscape'] },
|
|
22
|
-
},
|
|
23
|
-
{ name: 'iPhone 14 portrait', use: { ...devices['iPhone 14'] } },
|
|
24
|
-
{ name: 'Pixel 7 portrait', use: { ...devices['Pixel 7'] } },
|
|
25
|
-
],
|
|
26
|
-
reporter: [['html', { open: 'never', outputFolder: './tests/playwright-report' }]],
|
|
27
|
-
retries: ci ? 2 : 0,
|
|
28
|
-
testDir: './tests',
|
|
29
|
-
testMatch: '**/*.e2e.ts',
|
|
30
|
-
use: {
|
|
31
|
-
baseURL: appUrl,
|
|
32
|
-
trace: 'on-first-retry',
|
|
33
|
-
},
|
|
34
|
-
webServer: {
|
|
35
|
-
command: webServerCommand,
|
|
36
|
-
ignoreHTTPSErrors: true,
|
|
37
|
-
reuseExistingServer: !ci,
|
|
38
|
-
url: appUrl,
|
|
39
|
-
},
|
|
40
|
-
...(ci ? { workers: 1 } : {}),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/playwright/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { devices } from '@playwright/test';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import { buildPlaywrightBaseConfig } from './index.js';
|
|
4
|
-
describe('buildPlaywrightBaseConfig', () => {
|
|
5
|
-
const validParams = {
|
|
6
|
-
appPort: 3000,
|
|
7
|
-
appUrl: 'http://localhost:3000',
|
|
8
|
-
devices,
|
|
9
|
-
webServerCommand: 'pnpm dev',
|
|
10
|
-
};
|
|
11
|
-
describe('validation', () => {
|
|
12
|
-
it('throws if appUrl is missing', () => {
|
|
13
|
-
expect(() => buildPlaywrightBaseConfig({ ...validParams, appUrl: '' })).toThrow('[playwright] appUrl must be a non-empty string');
|
|
14
|
-
});
|
|
15
|
-
it('throws if appPort is not a number', () => {
|
|
16
|
-
expect(() => buildPlaywrightBaseConfig({ ...validParams, appPort: '3000' })).toThrow('[playwright] appPort must be a number');
|
|
17
|
-
});
|
|
18
|
-
it('throws if devices is missing', () => {
|
|
19
|
-
expect(() => buildPlaywrightBaseConfig({
|
|
20
|
-
...validParams,
|
|
21
|
-
devices: undefined,
|
|
22
|
-
})).toThrow('[playwright] devices must be provided');
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
describe('config output', () => {
|
|
26
|
-
it('returns valid Playwright config structure', () => {
|
|
27
|
-
const config = buildPlaywrightBaseConfig(validParams);
|
|
28
|
-
expect(config).toHaveProperty('projects');
|
|
29
|
-
expect(config).toHaveProperty('testDir', './tests');
|
|
30
|
-
expect(config).toHaveProperty('testMatch', '**/*.e2e.ts');
|
|
31
|
-
expect(config).toHaveProperty('webServer');
|
|
32
|
-
expect(config).toHaveProperty('use.baseURL', 'http://localhost:3000');
|
|
33
|
-
});
|
|
34
|
-
it('configures 6 browser projects', () => {
|
|
35
|
-
const config = buildPlaywrightBaseConfig(validParams);
|
|
36
|
-
expect(config.projects).toHaveLength(6);
|
|
37
|
-
});
|
|
38
|
-
it('sets retries to 0 when not in CI', () => {
|
|
39
|
-
const config = buildPlaywrightBaseConfig({ ...validParams, ci: false });
|
|
40
|
-
expect(config.retries).toBe(0);
|
|
41
|
-
});
|
|
42
|
-
it('sets retries to 2 in CI', () => {
|
|
43
|
-
const config = buildPlaywrightBaseConfig({ ...validParams, ci: true });
|
|
44
|
-
expect(config.retries).toBe(2);
|
|
45
|
-
});
|
|
46
|
-
it('sets workers to 1 in CI', () => {
|
|
47
|
-
const config = buildPlaywrightBaseConfig({ ...validParams, ci: true });
|
|
48
|
-
expect(config.workers).toBe(1);
|
|
49
|
-
});
|
|
50
|
-
it('sets forbidOnly to true in CI', () => {
|
|
51
|
-
const config = buildPlaywrightBaseConfig({ ...validParams, ci: true });
|
|
52
|
-
expect(config.forbidOnly).toBe(true);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup-react.d.ts","sourceRoot":"","sources":["../../src/testing/setup-react.ts"],"names":[],"mappings":"AAOA,OAAO,kCAAkC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom/vitest';
|
package/dist/vitest/node.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const coverageThresholds: {
|
|
2
|
-
branches: number;
|
|
3
|
-
functions: number;
|
|
4
|
-
lines: number;
|
|
5
|
-
statements: number;
|
|
6
|
-
};
|
|
7
|
-
export declare const vitestNodeConfig: {
|
|
8
|
-
coverage: {
|
|
9
|
-
provider: "v8";
|
|
10
|
-
thresholds: {
|
|
11
|
-
branches: number;
|
|
12
|
-
functions: number;
|
|
13
|
-
lines: number;
|
|
14
|
-
statements: number;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
environment: string;
|
|
18
|
-
exclude: string[];
|
|
19
|
-
globals: boolean;
|
|
20
|
-
include: string[];
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/vitest/node.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAC;AAMF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;CAS5B,CAAC"}
|
package/dist/vitest/node.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const coverageThresholds = {
|
|
2
|
-
branches: 80,
|
|
3
|
-
functions: 80,
|
|
4
|
-
lines: 80,
|
|
5
|
-
statements: 80,
|
|
6
|
-
};
|
|
7
|
-
export const vitestNodeConfig = {
|
|
8
|
-
coverage: {
|
|
9
|
-
provider: 'v8',
|
|
10
|
-
thresholds: coverageThresholds,
|
|
11
|
-
},
|
|
12
|
-
environment: 'node',
|
|
13
|
-
exclude: ['node_modules', 'dist', 'build', '.turbo', '.react-router'],
|
|
14
|
-
globals: true,
|
|
15
|
-
include: ['**/*.test.ts', '**/*.test.tsx'],
|
|
16
|
-
};
|
package/dist/vitest/react.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const vitestReactConfig: {
|
|
2
|
-
coverage: {
|
|
3
|
-
provider: "v8";
|
|
4
|
-
thresholds: {
|
|
5
|
-
branches: number;
|
|
6
|
-
functions: number;
|
|
7
|
-
lines: number;
|
|
8
|
-
statements: number;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
environment: string;
|
|
12
|
-
exclude: string[];
|
|
13
|
-
globals: boolean;
|
|
14
|
-
include: string[];
|
|
15
|
-
setupFiles: string[];
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=react.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/vitest/react.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;CAU7B,CAAC"}
|
package/dist/vitest/react.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { coverageThresholds } from './node';
|
|
2
|
-
export const vitestReactConfig = {
|
|
3
|
-
coverage: {
|
|
4
|
-
provider: 'v8',
|
|
5
|
-
thresholds: coverageThresholds,
|
|
6
|
-
},
|
|
7
|
-
environment: 'jsdom',
|
|
8
|
-
exclude: ['node_modules', 'dist', 'build', '.turbo', '.react-router'],
|
|
9
|
-
globals: true,
|
|
10
|
-
include: ['**/*.test.ts', '**/*.test.tsx'],
|
|
11
|
-
setupFiles: ['./src/test-setup.ts'],
|
|
12
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
|
|
5
|
-
import { resolveRimrafBin } from './clean.js';
|
|
6
|
-
|
|
7
|
-
function makeRequire(pkgPath: string, pkg: unknown): NodeRequire {
|
|
8
|
-
const req = (id: string): unknown => (id === pkgPath ? pkg : undefined);
|
|
9
|
-
req.resolve = (_id: string) => pkgPath;
|
|
10
|
-
return req as unknown as NodeRequire;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe('resolveRimrafBin', () => {
|
|
14
|
-
it('resolves when bin is a plain string', () => {
|
|
15
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
16
|
-
const req = makeRequire(pkgPath, { bin: './dist/esm/bin.js' });
|
|
17
|
-
|
|
18
|
-
const result = resolveRimrafBin(req);
|
|
19
|
-
|
|
20
|
-
expect(result).toBe(path.join('/node_modules/rimraf', 'dist/esm/bin.js'));
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('strips leading ./ from the bin path', () => {
|
|
24
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
25
|
-
const req = makeRequire(pkgPath, { bin: './bin/rimraf' });
|
|
26
|
-
|
|
27
|
-
const result = resolveRimrafBin(req);
|
|
28
|
-
|
|
29
|
-
expect(result).toBe(path.join('/node_modules/rimraf', 'bin/rimraf'));
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('resolves when bin is an object with a rimraf key', () => {
|
|
33
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
34
|
-
const req = makeRequire(pkgPath, { bin: { rimraf: './dist/esm/bin.js' } });
|
|
35
|
-
|
|
36
|
-
const result = resolveRimrafBin(req);
|
|
37
|
-
|
|
38
|
-
expect(result).toBe(path.join('/node_modules/rimraf', 'dist/esm/bin.js'));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('returns null when bin field is missing', () => {
|
|
42
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
43
|
-
const req = makeRequire(pkgPath, {});
|
|
44
|
-
|
|
45
|
-
expect(resolveRimrafBin(req)).toBeNull();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('returns null when bin object has no rimraf key', () => {
|
|
49
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
50
|
-
const req = makeRequire(pkgPath, { bin: { other: './dist/other.js' } });
|
|
51
|
-
|
|
52
|
-
expect(resolveRimrafBin(req)).toBeNull();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('resolves against the real rimraf package', () => {
|
|
56
|
-
const req = createRequire(import.meta.url);
|
|
57
|
-
|
|
58
|
-
const result = resolveRimrafBin(req);
|
|
59
|
-
|
|
60
|
-
expect(result).not.toBeNull();
|
|
61
|
-
expect(path.isAbsolute(result ?? '')).toBe(true);
|
|
62
|
-
});
|
|
63
|
-
});
|
package/src/bin/exec/clean.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* exec-clean: Thin wrapper around rimraf for cleaning paths.
|
|
4
|
-
* Usage: exec-clean <path> [morePaths...]
|
|
5
|
-
*/
|
|
6
|
-
import { spawn } from 'node:child_process';
|
|
7
|
-
import { createRequire } from 'node:module';
|
|
8
|
-
import path from 'node:path';
|
|
9
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Resolve the absolute path to the rimraf binary from its package.json bin field.
|
|
13
|
-
* Returns the resolved path, or null if it cannot be determined.
|
|
14
|
-
*/
|
|
15
|
-
export function resolveRimrafBin(require: NodeRequire): string | null {
|
|
16
|
-
const pkgPath = require.resolve('rimraf/package.json');
|
|
17
|
-
const pkg = require(pkgPath) as { bin?: unknown };
|
|
18
|
-
const binRel =
|
|
19
|
-
typeof pkg.bin === 'string' ? pkg.bin : (pkg.bin as Record<string, string>)?.rimraf;
|
|
20
|
-
if (!binRel) return null;
|
|
21
|
-
const normalized = binRel.startsWith('./') ? binRel.slice(2) : binRel;
|
|
22
|
-
return path.join(path.dirname(pkgPath), normalized);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
26
|
-
const require = createRequire(import.meta.url);
|
|
27
|
-
const bin = resolveRimrafBin(require);
|
|
28
|
-
if (!bin) {
|
|
29
|
-
console.error('Unable to locate rimraf binary from package.json bin field');
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const args = process.argv.slice(2);
|
|
34
|
-
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
35
|
-
child.on('exit', (code) => process.exit(code ?? 0));
|
|
36
|
-
}
|
package/src/bin/exec/husky.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* exec-husky: Initializes Husky git hooks (delegates to husky's bin).
|
|
4
|
-
* Usage: exec-husky
|
|
5
|
-
*/
|
|
6
|
-
import { spawn } from 'node:child_process';
|
|
7
|
-
import { createRequire } from 'node:module';
|
|
8
|
-
import { dirname, resolve } from 'node:path';
|
|
9
|
-
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
|
-
const bin = resolve(dirname(require.resolve('husky')), 'bin.js');
|
|
12
|
-
const args = process.argv.slice(2);
|
|
13
|
-
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
14
|
-
child.on('exit', (code) => process.exit(code ?? 0));
|
package/src/bin/exec/p.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* exec-p: Run npm scripts in parallel via npm-run-all's run-p.
|
|
4
|
-
* Usage: exec-p <script-patterns>
|
|
5
|
-
*/
|
|
6
|
-
import { spawn } from 'node:child_process';
|
|
7
|
-
import { createRequire } from 'node:module';
|
|
8
|
-
|
|
9
|
-
const require = createRequire(import.meta.url);
|
|
10
|
-
const bin = require.resolve('npm-run-all/bin/run-p/index.js');
|
|
11
|
-
const args = process.argv.slice(2);
|
|
12
|
-
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
13
|
-
child.on('exit', (code) => process.exit(code ?? 0));
|