mirror of
https://github.com/sst/opencode.git
synced 2025-08-28 17:04:10 +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
21
packages/sdk/scripts/utils/make-dist-package-json.cjs
Normal file
21
packages/sdk/scripts/utils/make-dist-package-json.cjs
Normal file
|
@ -0,0 +1,21 @@
|
|||
const pkgJson = require(process.env['PKG_JSON_PATH'] || '../../package.json');
|
||||
|
||||
function processExportMap(m) {
|
||||
for (const key in m) {
|
||||
const value = m[key];
|
||||
if (typeof value === 'string') m[key] = value.replace(/^\.\/dist\//, './');
|
||||
else processExportMap(value);
|
||||
}
|
||||
}
|
||||
processExportMap(pkgJson.exports);
|
||||
|
||||
for (const key of ['types', 'main', 'module']) {
|
||||
if (typeof pkgJson[key] === 'string') pkgJson[key] = pkgJson[key].replace(/^(\.\/)?dist\//, './');
|
||||
}
|
||||
|
||||
delete pkgJson.devDependencies;
|
||||
delete pkgJson.scripts.prepack;
|
||||
delete pkgJson.scripts.prepublishOnly;
|
||||
delete pkgJson.scripts.prepare;
|
||||
|
||||
console.log(JSON.stringify(pkgJson, null, 2));
|
Loading…
Add table
Add a link
Reference in a new issue