-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support build_from_source config in npmrc
- Loading branch information
Showing
11 changed files
with
70 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
--- | ||
Checks: "*, -abseil-*, -altera-*, -android-*, -fuchsia-*, google-*, | ||
Checks: | ||
"*, -abseil-*, -altera-*, -android-*, -fuchsia-*, google-*, | ||
-google-runtime-int, -llvm*, -modernize-use-trailing-return-type, -zircon-*, | ||
readability-else-after-return, readability-static-accessed-through-instance, | ||
readability-avoid-const-params-in-decls, | ||
cppcoreguidelines-non-private-member-variables-in-classes, | ||
misc-non-private-member-variables-in-classes, -*-non-private-member-variables-in-classes,-misc-include-cleaner" | ||
misc-non-private-member-variables-in-classes, | ||
-*-non-private-member-variables-in-classes,-misc-include-cleaner" | ||
WarningsAsErrors: "" | ||
HeaderFilterRegex: "" | ||
FormatStyle: none |
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 |
---|---|---|
|
@@ -5,5 +5,3 @@ | |
/node_modules | ||
pnpm-lock.yaml | ||
/build | ||
/script/*.js | ||
/script/*.mjs |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,16 +1,28 @@ | ||
try { | ||
require("../lib/load-addon.js") | ||
} catch (error) { | ||
const cp = require("child_process") | ||
function cmakeTs() { | ||
const cp = require("child_process") | ||
|
||
console.error("Failed to load ZMQ addon:", error) | ||
// Run the build script to generate the addon.node file | ||
console.log( | ||
"Building addon node via cmake-ts (requires cmake, ninja, and the vcpkg dependencies)", | ||
) | ||
const cmakeTsPath = require.resolve("cmake-ts/build/main.js") | ||
|
||
// Run the build script to generate the addon.node file | ||
console.log("Building addon node via cmake-ts (requires cmake, ninja, and the vcpkg dependencies)") | ||
const cmakeTsPath = require.resolve("cmake-ts/build/main.js") | ||
cp.execFileSync(process.execPath, [cmakeTsPath, "nativeonly"], { | ||
stdio: "inherit", | ||
}) | ||
} | ||
|
||
cp.execFileSync( | ||
process.execPath, [cmakeTsPath, "nativeonly"], | ||
{ stdio: "inherit" }, | ||
) | ||
function main() { | ||
if (process.env.npm_config_build_from_source === "true") { | ||
cmakeTs() | ||
} else { | ||
try { | ||
require("../lib/load-addon.js") | ||
} catch (error) { | ||
console.error("Failed to load ZMQ addon:", error) | ||
cmakeTs() | ||
} | ||
} | ||
} | ||
|
||
main() |
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