**chore(release): bump version to 0.10.0 and refactor project structure**
- Updated version to `0.10.0` in `README.md`, `cli-package/package.json`, and `src/utils/version.ts`. - Removed `CHANGELOG.md` from the root and `cli-package`, as GitHub auto-generates release notes. - Refactored `brainy-wrapper.js` to simplify utility methods (`isFloat32Array` and `isTypedArray`) by moving them to instance-level definitions. - Standardized Node.js version requirement to `>= 24.3.0` across documentation and configuration files. - Improved `textEncoding.ts` by introducing a unified `Platform` class for cross-environment compatibility (Node.js and browser). - Restructured scripts: - Replaced outdated commands (e.g., `test-cli` -> `test:cli` and `test-all` -> `test:all`) for consistency. - Removed changelog updates from `scripts/create-github-release.js` as part of simplification. - Enhanced `patch-textencoder.js` to also patch `worker.js` for both `TextEncoder` and `TextDecoder`. This release improves compatibility with Node.js 24, simplifies the deployment/changelog process, and refines text encoding and worker functionalities.
This commit is contained in:
parent
0653d479ef
commit
04a33b9ae8
18 changed files with 183 additions and 292 deletions
|
|
@ -63,6 +63,28 @@ if (fs.existsSync(minifiedJsPath)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Also patch the worker.js file if it exists
|
||||
const workerJsPath = path.join(__dirname, '..', 'dist', 'worker.js')
|
||||
if (fs.existsSync(workerJsPath)) {
|
||||
console.log(`Reading ${workerJsPath}...`)
|
||||
const workerContent = fs.readFileSync(workerJsPath, 'utf8')
|
||||
|
||||
// Apply the same replacement to the worker file
|
||||
const patchedWorkerContent = workerContent.replace(pattern, replacement)
|
||||
|
||||
// Check if the patch was applied
|
||||
if (patchedWorkerContent === workerContent) {
|
||||
console.warn(
|
||||
'No instances of "new this.util.TextEncoder()" found in the worker file.'
|
||||
)
|
||||
} else {
|
||||
// Write the patched file
|
||||
console.log('Writing patched worker file...')
|
||||
fs.writeFileSync(workerJsPath, patchedWorkerContent, 'utf8')
|
||||
console.log('Worker file patched successfully!')
|
||||
}
|
||||
}
|
||||
|
||||
// Also patch TextDecoder
|
||||
console.log('Patching TextDecoder references...')
|
||||
content = fs.readFileSync(unifiedJsPath, 'utf8')
|
||||
|
|
@ -99,3 +121,21 @@ if (fs.existsSync(minifiedJsPath)) {
|
|||
console.log('TextDecoder patch applied to minified file successfully!')
|
||||
}
|
||||
}
|
||||
|
||||
// Patch the worker.js file for TextDecoder as well
|
||||
if (fs.existsSync(workerJsPath)) {
|
||||
const workerContent = fs.readFileSync(workerJsPath, 'utf8')
|
||||
const patchedWorkerDecoderContent = workerContent.replace(
|
||||
decoderPattern,
|
||||
decoderReplacement
|
||||
)
|
||||
|
||||
if (patchedWorkerDecoderContent === workerContent) {
|
||||
console.warn(
|
||||
'No instances of "new this.util.TextDecoder()" found in the worker file.'
|
||||
)
|
||||
} else {
|
||||
fs.writeFileSync(workerJsPath, patchedWorkerDecoderContent, 'utf8')
|
||||
console.log('TextDecoder patch applied to worker file successfully!')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue