Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,15 @@ jobs:
run: |
cd cli/npm
bin="envio"
internal_name="core"
node_os=$(echo "${NAME}" | cut -d '-' -f1)
export node_os
node_arch=$(echo "${NAME}" | cut -d '-' -f2)
export node_arch
if [ "${OS}" = "windows-2022" ]; then
export node_pkg="${bin}-windows-${node_arch}"
export node_pkg="${internal_name}-windows-${node_arch}"
else
export node_pkg="${bin}-${node_os}-${node_arch}"
export node_pkg="${internal_name}-${node_os}-${node_arch}"
fi
mkdir -p "${node_pkg}/bin"
envsubst < package.json.tmpl > "${node_pkg}/package.json"
Expand Down
8 changes: 4 additions & 4 deletions codegenerator/cli/npm/envio/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const require = createRequire(import.meta.url);

/**
* Returns the executable path for envio located inside node_modules
* The naming convention is envio-${os}-${arch}
* The naming convention is @envio-dev/envio-${os}-${arch}
* If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
* @see https://nodejs.org/api/os.html#osarch
* @see https://nodejs.org/api/os.html#osplatform
* @example "x/xx/node_modules/envio-darwin-arm64"
* @example "x/xx/node_modules/@envio-dev/envio-darwin-arm64"
Comment on lines +11 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

JSDoc comments are inconsistent with the actual code.

Lines 11 and 15 still reference @envio-dev/envio-${os}-${arch}, but the actual require.resolve on line 31 uses @envio-dev/core-${os}-${arch}. These comments should be updated to match.

📝 Proposed fix
-  * The naming convention is `@envio-dev/envio-`${os}-${arch}
+  * The naming convention is `@envio-dev/core-`${os}-${arch}
   * If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
   * `@see` https://nodejs.org/api/os.html#osarch
   * `@see` https://nodejs.org/api/os.html#osplatform
-  * `@example` "x/xx/node_modules/@envio-dev/envio-darwin-arm64"
+  * `@example` "x/xx/node_modules/@envio-dev/core-darwin-arm64"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* The naming convention is @envio-dev/envio-${os}-${arch}
* If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
* @see https://nodejs.org/api/os.html#osarch
* @see https://nodejs.org/api/os.html#osplatform
* @example "x/xx/node_modules/envio-darwin-arm64"
* @example "x/xx/node_modules/@envio-dev/envio-darwin-arm64"
* The naming convention is `@envio-dev/core-`${os}-${arch}
* If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
* `@see` https://nodejs.org/api/os.html#osarch
* `@see` https://nodejs.org/api/os.html#osplatform
* `@example` "x/xx/node_modules/@envio-dev/core-darwin-arm64"
🤖 Prompt for AI Agents
In `@codegenerator/cli/npm/envio/bin.js` around lines 11 - 15, Update the JSDoc to
match the actual package naming used in the code: replace references to
"@envio-dev/envio-${os}-${arch}" with "@envio-dev/core-${os}-${arch}" and adjust
the example accordingly so it aligns with the string passed to require.resolve
in bin.js (the require.resolve call that constructs the platform-specific
package name). Ensure the note about Windows `.exe` behavior and the os/arch
`@see` links remain accurate.

*/
function getExePath() {
const arch = process.arch;
Expand All @@ -28,10 +28,10 @@ function getExePath() {

try {
// Since the bin will be located inside `node_modules`, we can simply call require.resolve
return require.resolve(`envio-${os}-${arch}/bin/envio${extension}`);
return require.resolve(`@envio-dev/core-${os}-${arch}/bin/envio${extension}`);
} catch (e) {
throw new Error(
`Couldn't find envio binary inside node_modules for ${os}-${arch}`
`Couldn't find envio binary (@envio-dev/core-${os}-${arch}) inside node_modules for ${os}-${arch}`
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions codegenerator/cli/npm/envio/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"node": ">=22.0.0"
},
"optionalDependencies": {
"envio-linux-x64": "${version}",
"envio-linux-arm64": "${version}",
"envio-darwin-x64": "${version}",
"envio-darwin-arm64": "${version}"
"@envio-dev/core-linux-x64": "${version}",
"@envio-dev/core-linux-arm64": "${version}",
"@envio-dev/core-darwin-x64": "${version}",
"@envio-dev/core-darwin-arm64": "${version}"
},
"dependencies": {
"@clickhouse/client": "1.12.1",
Expand Down
2 changes: 1 addition & 1 deletion codegenerator/cli/npm/package.json.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "${node_pkg}",
"name": "@envio-dev/${node_pkg}",
"version": "${version}",
"description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
"repository": {
Expand Down