Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
changesets: remove ignores, add cleanup script, improve version command
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLeiter committed Aug 19, 2023
1 parent 8137cbc commit cacea99
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 14 deletions.
13 changes: 1 addition & 12 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,5 @@
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"next-langchain",
"next-openai",
"next-huggingface",
"sveltekit-openai",
"nuxt-openai",
"nuxt-langchain",
"solidstart-openai",
"next-openai-rate-limits",
"next-replicate"
]
"updateInternalDependencies": "patch"
}
2 changes: 1 addition & 1 deletion .changeset/mean-schools-help.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'next-openai': patch
'ai': patch
---

react/use-chat: fix experimental functions returning proper function messages
Expand Down
41 changes: 41 additions & 0 deletions .github/scripts/cleanup-examples-changesets.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* `changeset version` updates the version and adds a changelog file in
* the example apps, but we don't want to do that. So this script reverts
* any "version" field changes and deletes the `CHANGELOG.md` file.
*
* Source: https://github.com/TooTallNate/nx.js/blob/main/.github/scripts/cleanup-examples.mjs
*/

import {
readFileSync,
writeFileSync,
unlinkSync,
readdirSync,
statSync
} from 'node:fs'
import { fileURLToPath } from 'url';
import { join, dirname } from 'path';

const __dirname = dirname(fileURLToPath(import.meta.url));

const examplesUrl = new URL('../../examples', import.meta.url);
const examplesDir = fileURLToPath(examplesUrl);

console.log('Cleaning up examples...', examplesDir);

for (const app of readdirSync(examplesDir)) {
const appPath = join(examplesDir, app);
if (statSync(appPath).isDirectory()) {
const packageJsonPath = join(appPath, 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
packageJson.version = '0.0.0'
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n')

try {
const changelogUrl = new URL(`${app}/CHANGELOG.md`, examplesUrl)
unlinkSync(changelogUrl)
} catch (err) {
if (err.code !== 'ENOENT') throw err
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"publint": "turbo publint",
"release": "turbo clean && turbo build --filter=ai... && changeset publish",
"test": "turbo test --filter=ai...",
"version-packages": "changeset version"
"version-packages": "changeset version && node .github/scripts/cleanup-examples-changesets.mjs && pnpm install --no-frozen-lockfile"
},
"lint-staged": {
"*": [
Expand Down

0 comments on commit cacea99

Please sign in to comment.