Skip to content

Commit

Permalink
feat(crate): add split crate for direct usage
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed May 3, 2023
1 parent 28d3607 commit ba09caf
Show file tree
Hide file tree
Showing 20 changed files with 750 additions and 141 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install Crate"
run: cargo install --path .
- name: "Install rust-to-npm CLI"
run: cd cli && cargo install --path .
- name: "Run rust-to-npm"
run: rust-to-npm build
- name: "Test npm output"
run: cat ./package.json
run: cd rust-to-npm && rust-to-npm-cli build && cat ./package.json
69 changes: 45 additions & 24 deletions Cargo.lock

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

24 changes: 5 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
[package]

name = "rust-to-npm"
version = "0.4.9"
edition = "2021"
description = "deploy a rust project to npm in one command."
repository = "https://github.com/a11ywatch/rust-to-npm"
readme = "README.md"
keywords = ["rust-to-npm", "deploy-rust", "npm", "rust"]
categories = ["command-line-utilities", "development-tools::build-utils"]
license = "MIT"
homepage = "https://github.com/a11ywatch/rust-to-npm"
authors = ["Jeff Mendez <jeff@a11ywatch.com>"]

[dependencies]
clap = { version = "3.2.8", features = ["derive"] }
serde = { version = "1.0.138", features = ["derive"]}
serde_derive = "1.0.137"
toml = "0.5.9"
[workspace]
members = [
"rust-to-npm",
"cli",
]
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rust-to-npm
# rust-to-npm-cli

Deploy a Rust project to crates.io and npm in one command.

Expand Down Expand Up @@ -34,23 +34,25 @@ Installs can be handled with cargo or npm using the following:

```sh
# install with cargo
cargo install rust-to-npm
cargo install rust-to-npm-cli
# install with npm
npm i rust-to-npm -g
npm i rust-to-npm-cli -g
```

You can also use the crate directly at [rust-to-npm](./rust-to-npm/) with `cargo install rust-to-npm`.

## Usage

Run the command inside the repo with the Cargo.toml file to deploy to [crates.io](https://crates.io/) and [npm](https://www.npmjs.com/).

```sh
# to build locally without deploying
rust-to-npm build
rust-to-npm-cli build
# to build and deploy to cargo + npm
rust-to-npm deploy -b
rust-to-npm-cli deploy -b
```

You can also pass in the `-n` option on `build & deploy` in order to use a custom npm package name ex: `rust-to-npm build -n @myorg/rust-to-npm`
You can also pass in the `-n` option on `build & deploy` in order to use a custom npm package name ex: `rust-to-npm-cli build -n @myorg/rust-to-npm-cli`

### Consuming

Expand All @@ -77,13 +79,13 @@ Here is an example of the output from the Cargo.toml to package.json file in the
```toml
[package]

name = "rust-to-npm"
version = "0.4.3"
name = "rust-to-npm-cli"
version = "0.4.10"
edition = "2021"
description = "ship a rust project to npm on all operating systems leveraging cargo."
repository = "https://github.com/a11ywatch/rust-to-npm"
readme = "README.md"
keywords = ["rust-to-npm", "deploy-rust", "npm", "rust"]
keywords = ["rust-to-npm-cli", "deploy-rust", "npm", "rust"]
categories = ["command-line-utilities", "development-tools::build-utils"]
license = "MIT"
homepage = "https://github.com/a11ywatch/rust-to-npm"
Expand All @@ -98,8 +100,8 @@ toml = "0.5.9"

```json
{
"name": "rust-to-npm",
"version": "0.4.3",
"name": "rust-to-npm-cli",
"version": "0.4.10",
"description": "ship a rust project to npm on all operating systems leveraging cargo.",
"main": "start.js",
"directories": {
Expand All @@ -112,15 +114,15 @@ toml = "0.5.9"
},
"repository": {
"type": "git",
"url": "https://github.com/a11ywatch/rust-to-npm.git"
"url": "https://github.com/a11ywatch/rust-to-npm-cli.git"
},
"keywords": ["rust-to-npm", "deploy-rust", "npm", "rust"],
"keywords": ["rust-to-npm-cli", "deploy-rust", "npm", "rust"],
"author": "Jeff Mendez",
"license": "MIT",
"bugs": {
"url": "https://github.com/a11ywatch/rust-to-npm/issues"
"url": "https://github.com/a11ywatch/rust-to-npm-cli/issues"
},
"homepage": "https://github.com/a11ywatch/rust-to-npm",
"homepage": "https://github.com/a11ywatch/rust-to-npm-cli",
"files": [
"pre-install.js",
"start.js",
Expand Down
Loading

0 comments on commit ba09caf

Please sign in to comment.