Skip to content

Commit

Permalink
feat(core): add support for local publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli authored and FrozenPandaz committed Jan 30, 2023
1 parent c1a84bb commit 3c7ab2d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
[build]
target-dir = 'build/target'

[target.x86_64-unknown-linux-musl]
rustflags = [
"-C",
"target-feature=-crt-static",
]

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Source code and documentation are included in the top-level folders listed below

## Building the Project

> Nx uses Rust to build native bindings for Node. Please make sure that you have Rust installed via [rustup.rs](https://rustup.rs)
After cloning the project to your machine, to install the dependencies, run:

```bash
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"inputs": ["production", "^production"]
},
"build-base": {
"dependsOn": ["^build-base"],
"dependsOn": ["^build-base", "build-native"],
"inputs": ["production", "^production"],
"executor": "@nrwl/js:tsc",
"options": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@babel/preset-typescript": "^7.15.0",
"@cypress/react": "^6.0.0",
"@floating-ui/react-dom": "^1.0.1",
"@monodon/rust": "0.4.0",
"@monodon/rust": "0.4.1",
"@napi-rs/cli": "2.14.0",
"@nestjs/cli": "^9.0.0",
"@nestjs/common": "^9.0.0",
Expand Down
10 changes: 8 additions & 2 deletions packages/nx/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
{
"input": "packages/nx",
"glob": "**/*.json",
"ignore": ["**/tsconfig*.json", "**/project.json"],
"ignore": [
"**/tsconfig*.json",
"**/project.json",
"native-packages"
],
"output": "/"
},
{
Expand All @@ -57,11 +61,13 @@
"command": "echo hi"
},
"build": {
"dependsOn": ["build-native"],
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/build/packages/nx"],
"options": {
"commands": [
{
"command": "node ./scripts/copy-local-native.js nx"
},
{
"command": "node ./scripts/copy-graph-client.js"
},
Expand Down
12 changes: 12 additions & 0 deletions scripts/copy-local-native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ts-check
const fs = require('fs');
const glob = require('fast-glob');

const p = process.argv[2];

// TODO(cammisuli): only run this script when publishing locally
const nativeFiles = glob.sync(`packages/${p}/**/*.node`);

nativeFiles.forEach((file) => {
fs.copyFileSync(file, `build/${file}`);
});
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4064,10 +4064,10 @@
"@monaco-editor/loader" "^1.3.2"
prop-types "^15.7.2"

"@monodon/rust@0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@monodon/rust/-/rust-0.4.0.tgz#74e501a3df6c5909ddd96c634f4eaef712fbfdb4"
integrity sha512-DmkWcm4ActBhXTAXpz98KXY6Kve13zLrIskBkXoyvQ75cPHNN5NRZBVML7NAnK+FXYZE95WdCqGA5TrzictvJA==
"@monodon/rust@0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@monodon/rust/-/rust-0.4.1.tgz#eb8c9bc6d1337490ad89687aa1567e58a61a87a1"
integrity sha512-0N6IzRSznA8qm7Hzhy6y98QWFEND9ys7Jnfz31gxg3ch2Y7CBjgb4HuclKLYq4xax9P8uYQ1KzZZmLXzzyv+lw==
dependencies:
"@ltd/j-toml" "1.24.0"
chalk "4.1.2"
Expand Down

0 comments on commit 3c7ab2d

Please sign in to comment.