@skip-go/widget 2.1.2-alpha.0.3 → 2.1.2-alpha.0.4

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 (2) hide show
  1. package/package.json +3 -3
  2. package/preinstall.cjs +16 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@skip-go/widget",
3
3
  "description": "Swap widget",
4
- "version": "2.1.2-alpha.0.3",
4
+ "version": "2.1.2-alpha.0.4",
5
5
  "repository": "https://github.com/skip-mev/widget",
6
6
  "type": "module",
7
7
  "exports": {
@@ -21,7 +21,7 @@
21
21
  "files": [
22
22
  "build",
23
23
  "README.md",
24
- ".npmrc"
24
+ "preinstall.cjs"
25
25
  ],
26
26
  "peerDependencies": {
27
27
  "react": "17.x || 18.x",
@@ -93,4 +93,4 @@
93
93
  "scripts": {
94
94
  "preinstall": "node preinstall.js"
95
95
  }
96
- }
96
+ }
package/preinstall.cjs ADDED
@@ -0,0 +1,16 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const npmrcPath = path.resolve(__dirname, '.npmrc');
5
+ const registryConfig = '@buf:registry=https://buf.build/gen/npm/v1/';
6
+
7
+ if (!fs.existsSync(npmrcPath)) {
8
+ fs.writeFileSync(npmrcPath, registryConfig);
9
+ } else {
10
+ const npmrcContent = fs.readFileSync(npmrcPath, 'utf-8');
11
+ if (!npmrcContent.includes(registryConfig)) {
12
+ fs.appendFileSync(npmrcPath, `\n${registryConfig}`);
13
+ }
14
+ }
15
+
16
+ console.log('.npmrc configured for @buf registry');