+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

feat(node-api): create a node.js wrapper library for the JSON-RPC workspace protocol #3070

Merged
merged 6 commits into from
Aug 23, 2022
Merged
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
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ format = "fmt --all --verbose"
codegen = "run -p xtask_codegen --"
codegen-configuration = "run -p xtask_codegen --features configuration -- configuration"
codegen-schema = "run -p xtask_codegen --features schema -- schema"
codegen-bindings = "run -p xtask_codegen --features schema -- bindings"
lintdoc = "run -p xtask_lintdoc --"
documentation = """
doc \
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ crates/rome_js_analyze/src/assists/*.rs linguist-generated=true text=auto eol=lf
crates/rome_js_analyze/src/semantic_analyzers/*.rs linguist-generated=true text=auto eol=lf
crates/rome_js_analyze/src/registry.rs linguist-generated=true text=auto eol=lf
crates/rome_service/src/configuration/linter/rules.rs linguist-generated=true text=auto eol=lf
npm/backend-jsonrpc/src/workspace.ts linguist-generated=true text=auto eol=lf
website/src/docs/lint/rules/**/*.md linguist-generated=true text=auto eol=lf


Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,46 @@ jobs:
command: test
args: --workspace --verbose

test-node-api:
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this is the correct place. Although neither the workflow for JS file is the correct place. I mean, we should run these tests when we change Rust files AND JS files.

Maybe we should have a workflow just for this package?

name: Test node.js API
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install toolchain
run: rustup show
- name: Cache
uses: Swatinem/rust-cache@v1
- name: Build main binary
uses: actions-rs/cargo@v1
with:
command: build
args: -p rome_bin --release

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.1.0
with:
version: 7
run_install: |
args: [--prefix npm/backend-jsonrpc]
- name: Build TypeScript code
run: pnpm --prefix npm/backend-jsonrpc run tsc
- name: Run JS tests
run: pnpm --prefix npm/backend-jsonrpc test:ci

documentation:
name: Documentation
runs-on: ubuntu-latest
Expand Down Expand Up @@ -127,6 +167,10 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: codegen-schema
- name: Run the schema codegen
uses: actions-rs/cargo@v1
with:
command: codegen-bindings
- name: Run the website codegen
uses: actions-rs/cargo@v1
with:
Expand Down
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/rome_service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rome_fs = { path = "../rome_fs", features = ["serde"] }
rome_js_analyze = { path = "../rome_js_analyze", features = ["serde"] }
rome_js_syntax = { path = "../rome_js_syntax", features = ["serde"] }
rome_js_parser = { path = "../rome_js_parser" }
rome_js_factory = { path = "../rome_js_factory", optional = true }
rome_js_formatter = { path = "../rome_js_formatter", features = ["serde"] }
rome_js_semantic = { path = "../rome_js_semantic" }
rome_rowan = { path = "../rome_rowan", features = ["serde"] }
Expand All @@ -28,4 +29,4 @@ indexmap = { version = "1.9.1", features = ["serde"] }
schemars = { version = "0.8.10", features = ["indexmap1"], optional = true }

[features]
schemars = ["dep:schemars", "rome_formatter/serde"]
schemars = ["dep:schemars", "rome_formatter/serde", "rome_js_factory"]
3 changes: 3 additions & 0 deletions crates/rome_service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ mod file_handlers;
pub mod settings;
pub mod workspace;

#[cfg(feature = "schemars")]
pub mod workspace_types;

pub use crate::configuration::{
create_config, load_config, Configuration, ConfigurationError, RuleConfiguration, Rules,
};
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载