@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.
Files changed (128) hide show
  1. package/README.md +2 -2
  2. package/dist/bin/ship/hotfix.bin.mjs +140 -0
  3. package/dist/bin/ship/production.bin.mjs +120 -0
  4. package/dist/bin/ship/staging.bin.mjs +70 -0
  5. package/dist/bin/ship/utils-BQ-JZ2D5.mjs +45 -0
  6. package/dist/playwright/index.d.mts +24 -0
  7. package/dist/playwright/index.mjs +61 -0
  8. package/dist/vitest/node.d.mts +22 -0
  9. package/dist/vitest/node.mjs +28 -0
  10. package/dist/vitest/react.d.mts +22 -0
  11. package/dist/vitest/react.mjs +28 -0
  12. package/docs/en/README.md +95 -0
  13. package/docs/en/agents.md +57 -0
  14. package/docs/en/standards/api.md +324 -0
  15. package/docs/en/standards/coding.md +144 -0
  16. package/docs/en/standards/commits.md +111 -0
  17. package/docs/en/standards/documentation.md +173 -0
  18. package/docs/en/standards/naming.md +180 -0
  19. package/docs/en/standards/principles.md +84 -0
  20. package/docs/en/standards/react.md +246 -0
  21. package/docs/en/standards/sql.md +258 -0
  22. package/docs/en/standards/testing.md +139 -0
  23. package/docs/en/standards/writing.md +119 -0
  24. package/docs/en/tools/biome.md +89 -0
  25. package/docs/en/tools/commitlint.md +92 -0
  26. package/docs/en/tools/dependencies.md +116 -0
  27. package/docs/en/tools/husky.md +90 -0
  28. package/docs/en/tools/markdownlint.md +84 -0
  29. package/docs/en/tools/playwright.md +117 -0
  30. package/docs/en/tools/releases.md +242 -0
  31. package/docs/en/tools/typescript.md +89 -0
  32. package/docs/en/tools/vitest.md +146 -0
  33. package/package.json +57 -70
  34. package/src/biome/preset.json +3 -0
  35. package/templates/changeset/README.md +14 -0
  36. package/templates/changeset/config.json +11 -0
  37. package/templates/github/release.yml +77 -0
  38. package/dist/bin/exec/clean.d.ts +0 -3
  39. package/dist/bin/exec/clean.d.ts.map +0 -1
  40. package/dist/bin/exec/clean.js +0 -25
  41. package/dist/bin/exec/clean.test.d.ts +0 -2
  42. package/dist/bin/exec/clean.test.d.ts.map +0 -1
  43. package/dist/bin/exec/clean.test.js +0 -45
  44. package/dist/bin/exec/husky.d.ts +0 -3
  45. package/dist/bin/exec/husky.d.ts.map +0 -1
  46. package/dist/bin/exec/husky.js +0 -9
  47. package/dist/bin/exec/p.d.ts +0 -3
  48. package/dist/bin/exec/p.d.ts.map +0 -1
  49. package/dist/bin/exec/p.js +0 -8
  50. package/dist/bin/exec/s.d.ts +0 -3
  51. package/dist/bin/exec/s.d.ts.map +0 -1
  52. package/dist/bin/exec/s.js +0 -8
  53. package/dist/bin/exec/tsc.d.ts +0 -3
  54. package/dist/bin/exec/tsc.d.ts.map +0 -1
  55. package/dist/bin/exec/tsc.js +0 -8
  56. package/dist/bin/lint/biome.d.ts +0 -3
  57. package/dist/bin/lint/biome.d.ts.map +0 -1
  58. package/dist/bin/lint/biome.js +0 -8
  59. package/dist/bin/lint/commit.d.ts +0 -3
  60. package/dist/bin/lint/commit.d.ts.map +0 -1
  61. package/dist/bin/lint/commit.js +0 -8
  62. package/dist/bin/lint/md.d.ts +0 -3
  63. package/dist/bin/lint/md.d.ts.map +0 -1
  64. package/dist/bin/lint/md.js +0 -16
  65. package/dist/bin/lint/package.d.ts +0 -4
  66. package/dist/bin/lint/package.d.ts.map +0 -1
  67. package/dist/bin/lint/package.js +0 -81
  68. package/dist/bin/lint/package.test.d.ts +0 -2
  69. package/dist/bin/lint/package.test.d.ts.map +0 -1
  70. package/dist/bin/lint/package.test.js +0 -65
  71. package/dist/bin/ship/hotfix.d.ts +0 -3
  72. package/dist/bin/ship/hotfix.d.ts.map +0 -1
  73. package/dist/bin/ship/hotfix.js +0 -141
  74. package/dist/bin/ship/production.d.ts +0 -3
  75. package/dist/bin/ship/production.d.ts.map +0 -1
  76. package/dist/bin/ship/production.js +0 -124
  77. package/dist/bin/ship/staging.d.ts +0 -3
  78. package/dist/bin/ship/staging.d.ts.map +0 -1
  79. package/dist/bin/ship/staging.js +0 -51
  80. package/dist/bin/ship/utils.d.ts +0 -9
  81. package/dist/bin/ship/utils.d.ts.map +0 -1
  82. package/dist/bin/ship/utils.js +0 -63
  83. package/dist/bin/ship/utils.test.d.ts +0 -2
  84. package/dist/bin/ship/utils.test.d.ts.map +0 -1
  85. package/dist/bin/ship/utils.test.js +0 -127
  86. package/dist/config.test.d.ts +0 -2
  87. package/dist/config.test.d.ts.map +0 -1
  88. package/dist/config.test.js +0 -101
  89. package/dist/playwright/index.d.ts +0 -10
  90. package/dist/playwright/index.d.ts.map +0 -1
  91. package/dist/playwright/index.js +0 -42
  92. package/dist/playwright/index.test.d.ts +0 -2
  93. package/dist/playwright/index.test.d.ts.map +0 -1
  94. package/dist/playwright/index.test.js +0 -55
  95. package/dist/testing/setup-react.d.ts +0 -2
  96. package/dist/testing/setup-react.d.ts.map +0 -1
  97. package/dist/testing/setup-react.js +0 -1
  98. package/dist/vitest/node.d.ts +0 -22
  99. package/dist/vitest/node.d.ts.map +0 -1
  100. package/dist/vitest/node.js +0 -16
  101. package/dist/vitest/react.d.ts +0 -17
  102. package/dist/vitest/react.d.ts.map +0 -1
  103. package/dist/vitest/react.js +0 -12
  104. package/src/bin/exec/clean.test.ts +0 -63
  105. package/src/bin/exec/clean.ts +0 -36
  106. package/src/bin/exec/husky.ts +0 -14
  107. package/src/bin/exec/p.ts +0 -13
  108. package/src/bin/exec/s.ts +0 -13
  109. package/src/bin/exec/tsc.ts +0 -13
  110. package/src/bin/lint/biome.ts +0 -13
  111. package/src/bin/lint/commit.ts +0 -13
  112. package/src/bin/lint/md.ts +0 -28
  113. package/src/bin/lint/package.test.ts +0 -83
  114. package/src/bin/lint/package.ts +0 -108
  115. package/src/bin/ship/hotfix.ts +0 -241
  116. package/src/bin/ship/production.ts +0 -240
  117. package/src/bin/ship/staging.ts +0 -108
  118. package/src/bin/ship/utils.test.ts +0 -178
  119. package/src/bin/ship/utils.ts +0 -109
  120. package/src/config.test.ts +0 -129
  121. package/src/markdownlint/markdownlint-cli2.jsonc +0 -9
  122. package/src/playwright/index.test.ts +0 -73
  123. package/src/playwright/index.ts +0 -63
  124. package/src/templates/release.yml +0 -128
  125. package/src/testing/setup-react.ts +0 -8
  126. package/src/vitest/node.ts +0 -25
  127. package/src/vitest/react.ts +0 -19
  128. /package/{src → templates}/sqlfluff/setup.cfg +0 -0
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import { createRequire } from 'node:module';
4
- const require = createRequire(import.meta.url);
5
- const bin = require.resolve('npm-run-all/bin/run-s/index.js');
6
- const args = process.argv.slice(2);
7
- const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
8
- child.on('exit', (code) => process.exit(code ?? 0));
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=tsc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tsc.d.ts","sourceRoot":"","sources":["../../../src/bin/exec/tsc.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import { createRequire } from 'node:module';
4
- const require = createRequire(import.meta.url);
5
- const bin = require.resolve('typescript/bin/tsc');
6
- const args = process.argv.slice(2);
7
- const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
8
- child.on('exit', (code) => process.exit(code ?? 0));
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=biome.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"biome.d.ts","sourceRoot":"","sources":["../../../src/bin/lint/biome.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import { createRequire } from 'node:module';
4
- const require = createRequire(import.meta.url);
5
- const bin = require.resolve('@biomejs/biome/bin/biome');
6
- const args = process.argv.slice(2);
7
- const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
8
- child.on('exit', (code) => process.exit(code ?? 0));
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=commit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../../src/bin/lint/commit.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import { createRequire } from 'node:module';
4
- const require = createRequire(import.meta.url);
5
- const bin = require.resolve('@commitlint/cli/cli.js');
6
- const args = process.argv.slice(2);
7
- const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
8
- child.on('exit', (code) => process.exit(code ?? 0));
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=md.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"md.d.ts","sourceRoot":"","sources":["../../../src/bin/lint/md.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import { createRequire } from 'node:module';
4
- import { dirname, join } from 'node:path';
5
- const require = createRequire(import.meta.url);
6
- const packageDir = dirname(require.resolve('markdownlint-cli2'));
7
- const bin = join(packageDir, 'markdownlint-cli2-bin.mjs');
8
- const DEFAULT_GLOBS = ['**/*.md', '**/*.mdx'];
9
- const DEFAULT_EXCLUSIONS = ['!**/dist/**', '!**/node_modules/**'];
10
- const rawArgs = process.argv.slice(2);
11
- const fixFlag = rawArgs.includes('--fix');
12
- const userGlobs = rawArgs.filter((arg) => arg !== '--fix');
13
- const globs = userGlobs.length > 0 ? userGlobs : DEFAULT_GLOBS;
14
- const args = [...(fixFlag ? ['--fix'] : []), ...globs, ...DEFAULT_EXCLUSIONS];
15
- const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
16
- child.on('exit', (code) => process.exit(code ?? 0));
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- export declare function reorderConditions(obj: Record<string, unknown>): Record<string, unknown>;
3
- export declare function fixExportsOrder(filePath: string, fix: boolean): boolean;
4
- //# sourceMappingURL=package.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../../src/bin/lint/package.ts"],"names":[],"mappings":";AAcA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBvF;AAMD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAiBvE"}
@@ -1,81 +0,0 @@
1
- #!/usr/bin/env node
2
- import { execSync } from 'node:child_process';
3
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
4
- import { dirname, join, resolve } from 'node:path';
5
- import { fileURLToPath } from 'node:url';
6
- export function reorderConditions(obj) {
7
- if (typeof obj !== 'object' || obj === null)
8
- return obj;
9
- const processed = {};
10
- for (const [key, value] of Object.entries(obj)) {
11
- processed[key] =
12
- typeof value === 'object' && value !== null && !Array.isArray(value)
13
- ? reorderConditions(value)
14
- : value;
15
- }
16
- if ('types' in processed && 'default' in processed) {
17
- const keys = Object.keys(processed);
18
- if (keys.indexOf('default') < keys.indexOf('types')) {
19
- const reordered = { types: processed.types };
20
- for (const key of keys) {
21
- if (key !== 'types')
22
- reordered[key] = processed[key];
23
- }
24
- return reordered;
25
- }
26
- }
27
- return processed;
28
- }
29
- export function fixExportsOrder(filePath, fix) {
30
- const fullPath = resolve(process.cwd(), filePath);
31
- if (!existsSync(fullPath))
32
- return false;
33
- const content = readFileSync(fullPath, 'utf-8');
34
- const pkg = JSON.parse(content);
35
- if (!pkg.exports || typeof pkg.exports !== 'object')
36
- return false;
37
- const fixed = reorderConditions(pkg.exports);
38
- const changed = JSON.stringify(fixed) !== JSON.stringify(pkg.exports);
39
- if (changed && fix) {
40
- writeFileSync(fullPath, `${JSON.stringify({ ...pkg, exports: fixed }, null, 2)}\n`);
41
- }
42
- return changed;
43
- }
44
- if (fileURLToPath(import.meta.url) === resolve(process.argv[1] ?? '')) {
45
- const __dirname = dirname(fileURLToPath(import.meta.url));
46
- const devRoot = resolve(__dirname, '../../..');
47
- const sortPkgBin = join(devRoot, 'node_modules/.bin/sort-package-json');
48
- const sortPkgBinAlt = join(devRoot, 'node_modules/sort-package-json/cli.js');
49
- let bin = '';
50
- if (existsSync(sortPkgBin)) {
51
- bin = sortPkgBin;
52
- }
53
- else if (existsSync(sortPkgBinAlt)) {
54
- bin = `node ${sortPkgBinAlt}`;
55
- }
56
- else {
57
- bin = 'npx sort-package-json';
58
- }
59
- const args = process.argv.slice(2);
60
- const fixMode = args.includes('--fix');
61
- const files = args.filter((arg) => arg !== '--fix');
62
- const targets = files.length > 0 ? files : ['package.json'];
63
- try {
64
- const checkFlag = fixMode ? '' : '--check';
65
- execSync(`${bin} ${checkFlag} ${targets.join(' ')}`.trim(), { stdio: 'inherit' });
66
- }
67
- catch {
68
- process.exit(1);
69
- }
70
- let hasExportsIssues = false;
71
- for (const file of targets) {
72
- const needsFix = fixExportsOrder(file, fixMode);
73
- if (needsFix && !fixMode) {
74
- console.error(`${file}: exports condition order is incorrect (types must come before default)`);
75
- hasExportsIssues = true;
76
- }
77
- }
78
- if (hasExportsIssues) {
79
- process.exit(1);
80
- }
81
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=package.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.test.d.ts","sourceRoot":"","sources":["../../../src/bin/lint/package.test.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { reorderConditions } from './package.js';
3
- describe('lint-package', () => {
4
- describe('reorderConditions', () => {
5
- it('reorders types before default when default comes first', () => {
6
- const input = {
7
- './foo': {
8
- default: './dist/foo.js',
9
- types: './dist/foo.d.ts',
10
- },
11
- };
12
- const result = reorderConditions(input);
13
- expect(Object.keys(result['./foo'])).toEqual(['types', 'default']);
14
- });
15
- it('does not modify when types already comes before default', () => {
16
- const input = {
17
- './foo': {
18
- default: './dist/foo.js',
19
- types: './dist/foo.d.ts',
20
- },
21
- };
22
- const result = reorderConditions(input);
23
- expect(Object.keys(result['./foo'])).toEqual(['types', 'default']);
24
- });
25
- it('handles multiple exports with mixed order', () => {
26
- const input = {
27
- './a': { default: './dist/a.js', types: './dist/a.d.ts' },
28
- './b': { default: './dist/b.js', types: './dist/b.d.ts' },
29
- };
30
- const result = reorderConditions(input);
31
- expect(Object.keys(result['./a'])[0]).toBe('types');
32
- expect(Object.keys(result['./b'])[0]).toBe('types');
33
- });
34
- it('preserves other keys after types', () => {
35
- const input = {
36
- './foo': {
37
- default: './dist/foo.js',
38
- import: './dist/foo.mjs',
39
- require: './dist/foo.cjs',
40
- types: './dist/foo.d.ts',
41
- },
42
- };
43
- const result = reorderConditions(input);
44
- const keys = Object.keys(result['./foo']);
45
- expect(keys[0]).toBe('types');
46
- expect(keys.slice(1)).toEqual(['default', 'import', 'require']);
47
- });
48
- it('handles exports without types or default', () => {
49
- const input = { './styles.css': './dist/styles.css' };
50
- expect(reorderConditions(input)).toEqual(input);
51
- });
52
- it('handles deeply nested condition objects', () => {
53
- const input = {
54
- './foo': {
55
- browser: { default: './dist/foo.browser.js', types: './dist/foo.browser.d.ts' },
56
- node: { default: './dist/foo.node.js', types: './dist/foo.node.d.ts' },
57
- },
58
- };
59
- const result = reorderConditions(input);
60
- const foo = result['./foo'];
61
- expect(Object.keys(foo.node)[0]).toBe('types');
62
- expect(Object.keys(foo.browser)[0]).toBe('types');
63
- });
64
- });
65
- });
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=hotfix.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hotfix.d.ts","sourceRoot":"","sources":["../../../src/bin/ship/hotfix.ts"],"names":[],"mappings":""}
@@ -1,141 +0,0 @@
1
- #!/usr/bin/env node
2
- import { execSync } from 'node:child_process';
3
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
4
- import { join } from 'node:path';
5
- import { branchExists, bumpVersion, git, gitRead, insertChangelog, runQualityChecks, runScript, } from './utils.js';
6
- const subcommand = process.argv[2];
7
- const subArgs = process.argv.slice(3);
8
- if (subcommand === 'start') {
9
- const name = subArgs[0];
10
- if (!name) {
11
- console.error('Usage: ship-hotfix start <name>');
12
- process.exit(1);
13
- }
14
- const hotfixBranch = `hotfix/${name}`;
15
- const status = gitRead('status', '--porcelain');
16
- if (status) {
17
- console.error('Working directory has uncommitted changes. Commit or stash them first.');
18
- process.exit(1);
19
- }
20
- console.log('\nFetching latest state from origin...');
21
- git('fetch', 'origin');
22
- if (!branchExists('production')) {
23
- console.error('Branch "production" does not exist. Create it first:\n'
24
- + ' git checkout -b production && git push -u origin production');
25
- process.exit(1);
26
- }
27
- git('checkout', 'production');
28
- git('pull', '--ff-only', 'origin', 'production');
29
- git('checkout', '-b', hotfixBranch);
30
- console.log(`\n✅ Hotfix branch "${hotfixBranch}" created from production.`);
31
- console.log('Apply your fix, then run: ship-hotfix finish <patch|minor> "description"');
32
- process.exit(0);
33
- }
34
- if (subcommand === 'finish') {
35
- const bumpType = subArgs[0];
36
- const message = subArgs.slice(1).join(' ');
37
- if (!bumpType || !['patch', 'minor'].includes(bumpType)) {
38
- console.error('Usage: ship-hotfix finish <patch|minor> "description"');
39
- console.error('Hotfixes use patch or minor bumps only.');
40
- process.exit(1);
41
- }
42
- if (!message) {
43
- console.error('A description is required.');
44
- console.error('Example: ship-hotfix finish patch "Fix critical auth bug"');
45
- process.exit(1);
46
- }
47
- const currentBranch = gitRead('branch', '--show-current');
48
- if (!currentBranch.startsWith('hotfix/')) {
49
- console.error(`Must be on a hotfix/* branch. Currently on: ${currentBranch}`);
50
- process.exit(1);
51
- }
52
- const status = gitRead('status', '--porcelain');
53
- if (status) {
54
- console.error('Working directory has uncommitted changes. Commit or stash them first.');
55
- process.exit(1);
56
- }
57
- console.log('\nRunning quality checks...');
58
- try {
59
- runQualityChecks();
60
- }
61
- catch {
62
- console.error('\nQuality checks failed. Fix all issues before finishing the hotfix.');
63
- process.exit(1);
64
- }
65
- console.log('✅ Quality checks passed');
66
- const packageJsonPath = join(process.cwd(), 'package.json');
67
- if (!existsSync(packageJsonPath)) {
68
- console.error('No package.json found in current directory.');
69
- process.exit(1);
70
- }
71
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
72
- const packageName = packageJson.name;
73
- const oldVersion = packageJson.version;
74
- const newVersion = bumpVersion(oldVersion, bumpType);
75
- console.log(`\nBumping ${packageName}: ${oldVersion} → ${newVersion}`);
76
- writeFileSync(packageJsonPath, `${JSON.stringify({ ...packageJson, version: newVersion }, null, 2)}\n`);
77
- const changelogPath = join(process.cwd(), 'CHANGELOG.md');
78
- const today = new Date().toISOString().slice(0, 10);
79
- insertChangelog(changelogPath, `## [${newVersion}] - ${today} (hotfix)\n\n${message}\n`);
80
- try {
81
- runScript('fix:pkg');
82
- }
83
- catch {
84
- }
85
- try {
86
- git('add', '-A');
87
- const changedFiles = gitRead('diff', '--cached', '--name-only').split('\n').filter(Boolean);
88
- for (const file of changedFiles) {
89
- if (file.endsWith('.json')) {
90
- try {
91
- execSync(`npx biome check --write ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
92
- }
93
- catch {
94
- }
95
- }
96
- }
97
- for (const file of changedFiles) {
98
- if (file.endsWith('.md')) {
99
- try {
100
- execSync(`npx markdownlint-cli2 --fix ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
101
- }
102
- catch {
103
- }
104
- }
105
- }
106
- }
107
- catch {
108
- }
109
- git('add', '-A');
110
- git('commit', '-m', `chore(hotfix): ${packageName}@${newVersion}`, '-m', message);
111
- console.log('\nFetching latest state from origin...');
112
- git('fetch', 'origin');
113
- console.log('\nMerging hotfix into production...');
114
- git('checkout', 'production');
115
- git('pull', '--ff-only', 'origin', 'production');
116
- git('merge', '--no-ff', currentBranch, '-m', `chore(hotfix): merge ${currentBranch} into production`);
117
- git('push', 'origin', 'production');
118
- console.log('\nPropagating hotfix to staging...');
119
- git('checkout', 'staging');
120
- git('pull', '--ff-only', 'origin', 'staging');
121
- git('merge', '--no-ff', 'production', '-m', 'chore(hotfix): merge production into staging');
122
- git('push', 'origin', 'staging');
123
- console.log('\nPropagating hotfix to main...');
124
- git('checkout', 'main');
125
- git('pull', '--ff-only', 'origin', 'main');
126
- git('merge', '--no-ff', 'staging', '-m', 'chore(hotfix): merge staging into main');
127
- git('push', 'origin', 'main');
128
- git('branch', '-d', currentBranch);
129
- try {
130
- git('push', 'origin', '--delete', currentBranch);
131
- }
132
- catch {
133
- }
134
- console.log(`\n✅ Hotfix ${packageName}@${newVersion} shipped to production → staging → main`);
135
- console.log('You are on main and ready to keep working.');
136
- process.exit(0);
137
- }
138
- console.error('Usage:');
139
- console.error(' ship-hotfix start <name>');
140
- console.error(' ship-hotfix finish <patch|minor> "description"');
141
- process.exit(1);
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=production.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../../../src/bin/ship/production.ts"],"names":[],"mappings":""}
@@ -1,124 +0,0 @@
1
- #!/usr/bin/env node
2
- import { execSync } from 'node:child_process';
3
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
4
- import { join } from 'node:path';
5
- import { branchExists, bumpVersion, confirm, git, gitRead, insertChangelog, runQualityChecks, runScript, } from './utils.js';
6
- const args = process.argv.slice(2);
7
- const bumpType = args[0];
8
- if (!bumpType || !['patch', 'minor', 'major'].includes(bumpType)) {
9
- console.error('Usage: ship-production <patch|minor|major>');
10
- console.error('Example: ship-production minor');
11
- process.exit(1);
12
- }
13
- const currentBranch = gitRead('branch', '--show-current');
14
- if (currentBranch !== 'main') {
15
- console.error(`Must be on the main branch to ship. Currently on: ${currentBranch}`);
16
- process.exit(1);
17
- }
18
- const status = gitRead('status', '--porcelain');
19
- if (status) {
20
- console.error('Working directory has uncommitted changes. Commit or stash them first.');
21
- process.exit(1);
22
- }
23
- console.log('\nFetching latest state from origin...');
24
- git('fetch', 'origin');
25
- if (!branchExists('staging')) {
26
- console.error('Branch "staging" does not exist. Create it first:\n'
27
- + ' git checkout -b staging && git push -u origin staging');
28
- process.exit(1);
29
- }
30
- if (!branchExists('production')) {
31
- console.error('Branch "production" does not exist. Create it first:\n'
32
- + ' git checkout -b production && git push -u origin production');
33
- process.exit(1);
34
- }
35
- git('pull', '--ff-only', 'origin', 'main');
36
- const ahead = gitRead('log', 'origin/production..HEAD', '--oneline');
37
- if (!ahead) {
38
- console.error('main is already in sync with production. Nothing to ship.');
39
- process.exit(1);
40
- }
41
- console.log('\nCommits to be shipped to production:');
42
- console.log(ahead);
43
- const packageJsonPath = join(process.cwd(), 'package.json');
44
- if (!existsSync(packageJsonPath)) {
45
- console.error('No package.json found in current directory.');
46
- process.exit(1);
47
- }
48
- const { name: packageName } = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
49
- if (!confirm(`\nShip ${packageName} as a ${bumpType} release?`)) {
50
- console.log('Aborted.');
51
- process.exit(0);
52
- }
53
- console.log('\nRunning quality checks on main...');
54
- try {
55
- runQualityChecks();
56
- }
57
- catch {
58
- console.error('\nQuality checks failed on main. Fix issues before shipping.');
59
- process.exit(1);
60
- }
61
- console.log('✅ Quality checks passed');
62
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
63
- const oldVersion = packageJson.version;
64
- const newVersion = bumpVersion(oldVersion, bumpType);
65
- console.log(`\nBumping ${packageName}: ${oldVersion} → ${newVersion}`);
66
- writeFileSync(packageJsonPath, `${JSON.stringify({ ...packageJson, version: newVersion }, null, 2)}\n`);
67
- const logOutput = gitRead('log', 'origin/production..HEAD', '--pretty=format:%s');
68
- const changeLines = logOutput
69
- ? logOutput
70
- .split('\n')
71
- .map((s) => s.trim())
72
- .filter((s) => s.length > 0)
73
- : [];
74
- const changeBody = changeLines.length > 0
75
- ? changeLines.map((c) => `- ${c.length > 98 ? `${c.slice(0, 95)}...` : c}`).join('\n')
76
- : `${bumpType} release`;
77
- const changelogPath = join(process.cwd(), 'CHANGELOG.md');
78
- const today = new Date().toISOString().slice(0, 10);
79
- insertChangelog(changelogPath, `## [${newVersion}] - ${today}\n\n${changeBody}\n`);
80
- try {
81
- runScript('fix:pkg');
82
- }
83
- catch {
84
- }
85
- try {
86
- git('add', '-A');
87
- const changedFiles = gitRead('diff', '--cached', '--name-only').split('\n').filter(Boolean);
88
- for (const file of changedFiles) {
89
- if (file.endsWith('.json')) {
90
- try {
91
- execSync(`npx biome check --write ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
92
- }
93
- catch {
94
- }
95
- }
96
- }
97
- for (const file of changedFiles) {
98
- if (file.endsWith('.md')) {
99
- try {
100
- execSync(`npx markdownlint-cli2 --fix ${file}`, { cwd: process.cwd(), stdio: 'inherit' });
101
- }
102
- catch {
103
- }
104
- }
105
- }
106
- }
107
- catch {
108
- }
109
- git('add', '-A');
110
- git('commit', '-m', `chore(release): ${packageName}@${newVersion}`, '-m', changeBody);
111
- console.log('\nMerging main into production...');
112
- git('checkout', 'production');
113
- git('pull', '--ff-only', 'origin', 'production');
114
- git('merge', '--ff-only', 'main');
115
- git('push', 'origin', 'production');
116
- console.log('\nSyncing staging with production...');
117
- git('checkout', 'staging');
118
- git('pull', '--ff-only', 'origin', 'staging');
119
- git('merge', '--ff-only', 'production');
120
- git('push', 'origin', 'staging');
121
- git('checkout', 'main');
122
- git('push', 'origin', 'main');
123
- console.log(`\n✅ Shipped ${packageName}@${newVersion} to production`);
124
- console.log('You are on main and ready to keep working.');
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=staging.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../../../src/bin/ship/staging.ts"],"names":[],"mappings":""}
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import { existsSync, readFileSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { branchExists, git, gitRead, runQualityChecks } from './utils.js';
5
- const currentBranch = gitRead('branch', '--show-current');
6
- if (currentBranch !== 'main') {
7
- console.error(`Must be on the main branch to release. Currently on: ${currentBranch}`);
8
- process.exit(1);
9
- }
10
- const status = gitRead('status', '--porcelain');
11
- if (status) {
12
- console.error('Working directory has uncommitted changes. Commit or stash them first.');
13
- process.exit(1);
14
- }
15
- console.log('\nFetching latest state from origin...');
16
- git('fetch', 'origin');
17
- git('pull', '--ff-only', 'origin', 'main');
18
- const packageJsonPath = join(process.cwd(), 'package.json');
19
- if (!existsSync(packageJsonPath)) {
20
- console.error('No package.json found in current directory.');
21
- process.exit(1);
22
- }
23
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
24
- const packageName = packageJson.name;
25
- if (!packageName) {
26
- console.error('No "name" field found in package.json.');
27
- process.exit(1);
28
- }
29
- if (!branchExists('staging')) {
30
- console.error('Branch "staging" does not exist locally or on origin. Create it first:\n'
31
- + ' git checkout -b staging && git push -u origin staging');
32
- process.exit(1);
33
- }
34
- console.log('\nRunning quality checks...');
35
- try {
36
- runQualityChecks();
37
- }
38
- catch {
39
- console.error('\nQuality checks failed. Fix all issues before releasing.');
40
- process.exit(1);
41
- }
42
- console.log('✅ Quality checks passed');
43
- console.log('\nMerging main into staging...');
44
- git('checkout', 'staging');
45
- git('merge', '--ff-only', 'main');
46
- git('push', 'origin', 'staging');
47
- git('checkout', 'main');
48
- git('push', 'origin', 'main');
49
- console.log('\n✅ Changes deployed to staging');
50
- console.log('Run ship-production <patch|minor|major> when ready to ship to production.');
51
- console.log('(Or ship directly from main to production without using ship-staging first.)');
@@ -1,9 +0,0 @@
1
- export declare const git: (...args: string[]) => void;
2
- export declare const gitRead: (...args: string[]) => string;
3
- export declare const runScript: (script: string) => void;
4
- export declare const bumpVersion: (current: string, bump: string) => string;
5
- export declare const insertChangelog: (changelogPath: string, entry: string) => void;
6
- export declare const runQualityChecks: () => void;
7
- export declare const branchExists: (name: string) => boolean;
8
- export declare const confirm: (prompt: string, ttyPath?: string) => boolean;
9
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/bin/ship/utils.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,MAAM,EAAE,KAAG,IAGvC,CAAC;AAMF,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,MAAM,EAAE,KAAG,MACa,CAAC;AAM1D,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,KAAG,IAG1C,CAAC;AAKF,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MAS3D,CAAC;AAMF,eAAO,MAAM,eAAe,GAAI,eAAe,MAAM,EAAE,OAAO,MAAM,KAAG,IAetE,CAAC;AAKF,eAAO,MAAM,gBAAgB,QAAO,IAInC,CAAC;AAMF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAE0B,CAAC;AAOvE,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,EAAE,gBAAoB,KAAG,OAe9D,CAAC"}