This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
forked from vercel/ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changesets: remove ignores, add cleanup script, improve version command
- Loading branch information
Showing
4 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters