mirror of
https://github.com/sst/opencode.git
synced 2025-09-02 19:27:34 +00:00
chore: generate sdk into packages/sdk
This commit is contained in:
parent
500cea5ce7
commit
10c8b49590
110 changed files with 12576 additions and 201 deletions
20
packages/sdk/scripts/utils/check-version.cjs
Normal file
20
packages/sdk/scripts/utils/check-version.cjs
Normal file
|
@ -0,0 +1,20 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const main = () => {
|
||||
const pkg = require('../../package.json');
|
||||
const version = pkg['version'];
|
||||
if (!version) throw 'The version property is not set in the package.json file';
|
||||
if (typeof version !== 'string') {
|
||||
throw `Unexpected type for the package.json version field; got ${typeof version}, expected string`;
|
||||
}
|
||||
|
||||
const versionFile = path.resolve(__dirname, '..', '..', 'src', 'version.ts');
|
||||
const contents = fs.readFileSync(versionFile, 'utf8');
|
||||
const output = contents.replace(/(export const VERSION = ')(.*)(')/g, `$1${version}$3`);
|
||||
fs.writeFileSync(versionFile, output);
|
||||
};
|
||||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue