Skip to content

Commit 0893af7

Browse files
vintaclaude
andcommitted
chore: update publish script to sync README versions and improve docs
- Add README.md version updates to publish-package.js script - Update README to use unpkg as alternative CDN - Change npm install example to use --save-exact flag - Remove outdated cdnjs references that require manual updates - Improve CDN section with clearer labeling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 57a1a20 commit 0893af7

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

README.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
### For Users
1818

19-
- [Google Chrome](https://chrome.google.com/webstore/detail/paphcfdffjnbcgkokihcdjliihicmbpd) (**2025-06-16 UPDATED**)
20-
- [Mozilla Firefox](https://github.com/vinta/pangu.js/blob/master/browser_extensions/firefox/paranoid-auto-spacing.user.js) (**2019-02-09 UPDATED**)
19+
- [Google Chrome](https://chrome.google.com/webstore/detail/paphcfdffjnbcgkokihcdjliihicmbpd) (**2025-06-24 UPDATED**)
20+
- [Mozilla Firefox](https://github.com/vinta/pangu.js/blob/master/browser_extensions/firefox/paranoid-auto-spacing.user.js)
2121

2222
### For Developers
2323

@@ -43,17 +43,15 @@
4343
## Usage
4444

4545
```bash
46-
$ npm install pangu --save
47-
# or
48-
$ yarn add pangu
46+
npm install pangu --save-exact
4947
```
5048

51-
### Browser
49+
Learn more on [npm](https://www.npmjs.com/package/pangu).
5250

53-
Files are located in `./node_modules/pangu/dist/`.
51+
### Browser
5452

5553
```html
56-
<script src="dist/browser/pangu.umd.js"></script>
54+
<script src="pangu/dist/browser/pangu.umd.js"></script>
5755
<script>
5856
const text = pangu.spacing('當你凝視著bug,bug也凝視著你');
5957
// text = '當你凝視著 bug,bug 也凝視著你'
@@ -69,20 +67,15 @@ Files are located in `./node_modules/pangu/dist/`.
6967
</script>
7068
```
7169

72-
`pangu.js` is also available on [jsDelivr](https://www.jsdelivr.com/package/npm/pangu) and [cdnjs](https://cdnjs.com/libraries/pangu):
70+
`pangu.js` is also available on some popular npm CDNs:
7371

7472
```html
75-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/pangu.js"></script>
76-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/pangu.min.js"></script>
77-
78-
<script src="https://cdnjs.cloudflare.com/ajax/libs/pangu/4.0.7/pangu.js"></script>
79-
<script src="https://cdnjs.cloudflare.com/ajax/libs/pangu/4.0.7/pangu.min.js"></script>
73+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/pangu.umd.js"></script>
74+
<script src="https://unpkg.com/[email protected]/dist/browser/pangu.umd.js"></script>
8075
```
8176

8277
### Node.js
8378

84-
Learn more on [npm](https://www.npmjs.com/package/pangu).
85-
8679
```js
8780
import pangu from 'pangu';
8881
// or

scripts/publish-package.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,18 @@ const updatedIndex = indexContent.replace(/this\.version\s*=\s*['"][^'"]+['"]/,
5252
writeFileSync(sharedIndexPath, updatedIndex, 'utf8');
5353
console.log(`Updated ${sharedIndexPath}`);
5454

55+
// Build
5556
execSync('npm run build', { stdio: 'inherit' });
5657

5758
// Copy updated pangu.umd.js to Chrome extension
5859
console.log('Copying updated pangu.umd.js to Chrome extension...');
5960
execSync('cp -f dist/browser/pangu.umd.js browser_extensions/chrome/vendors/pangu/pangu.umd.js', { stdio: 'inherit' });
6061

62+
// Update README.md
63+
const readmePath = join(projectRoot, 'README.md');
64+
const readmeContent = readFileSync(readmePath, 'utf8');
65+
const updatedReadme = readmeContent.replace(/pangu@[\d.]+/g, `pangu@${newVersion}`).replace(/pangu\/[\d.]+/g, `pangu/${newVersion}`);
66+
writeFileSync(readmePath, updatedReadme, 'utf8');
67+
console.log(`Updated ${readmePath}`);
68+
6169
console.log(`\nVersion bumped to ${newVersion}`);

0 commit comments

Comments
 (0)