@regardio/dev 1.5.0 → 1.6.1

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { execSync } from 'node:child_process';
3
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
5
  const args = process.argv.slice(2);
6
6
  const bumpType = args[0];
@@ -28,6 +28,12 @@ catch {
28
28
  process.exit(1);
29
29
  }
30
30
  const changesetDir = join(process.cwd(), '.changeset');
31
+ mkdirSync(changesetDir, { recursive: true });
32
+ const existingChangesets = readdirSync(changesetDir).filter((f) => f.endsWith('.md') && f !== 'README.md');
33
+ for (const file of existingChangesets) {
34
+ unlinkSync(join(changesetDir, file));
35
+ console.log(`Removed existing changeset: ${file}`);
36
+ }
31
37
  const changesetId = `release-${Date.now()}`;
32
38
  const changesetFile = join(changesetDir, `${changesetId}.md`);
33
39
  const changesetContent = `---
@@ -36,7 +42,6 @@ const changesetContent = `---
36
42
 
37
43
  ${message}
38
44
  `;
39
- mkdirSync(changesetDir, { recursive: true });
40
45
  writeFileSync(changesetFile, changesetContent);
41
46
  console.log(`Created changeset: .changeset/${changesetId}.md`);
42
47
  run('pnpm changeset version');
package/package.json CHANGED
@@ -113,5 +113,5 @@
113
113
  },
114
114
  "sideEffects": false,
115
115
  "type": "module",
116
- "version": "1.5.0"
116
+ "version": "1.6.1"
117
117
  }
@@ -14,7 +14,7 @@
14
14
  * The GitHub Action will then publish to npm automatically.
15
15
  */
16
16
  import { execSync } from 'node:child_process';
17
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
17
+ import { mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
18
18
  import { join } from 'node:path';
19
19
 
20
20
  const args = process.argv.slice(2);
@@ -47,8 +47,19 @@ try {
47
47
  process.exit(1);
48
48
  }
49
49
 
50
- // Generate a unique changeset filename
50
+ // Clean up existing changesets to ensure only our bump type is applied
51
51
  const changesetDir = join(process.cwd(), '.changeset');
52
+ mkdirSync(changesetDir, { recursive: true });
53
+
54
+ const existingChangesets = readdirSync(changesetDir).filter(
55
+ (f) => f.endsWith('.md') && f !== 'README.md',
56
+ );
57
+ for (const file of existingChangesets) {
58
+ unlinkSync(join(changesetDir, file));
59
+ console.log(`Removed existing changeset: ${file}`);
60
+ }
61
+
62
+ // Generate a unique changeset filename
52
63
  const changesetId = `release-${Date.now()}`;
53
64
  const changesetFile = join(changesetDir, `${changesetId}.md`);
54
65
 
@@ -60,7 +71,6 @@ const changesetContent = `---
60
71
  ${message}
61
72
  `;
62
73
 
63
- mkdirSync(changesetDir, { recursive: true });
64
74
  writeFileSync(changesetFile, changesetContent);
65
75
  console.log(`Created changeset: .changeset/${changesetId}.md`);
66
76