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

Split crate into a library and a binary #206

Merged
merged 5 commits into from
Nov 13, 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
22 changes: 21 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Calculate next semantic-release version
id: calculate
run: echo "::set-output name=next-version::$(npx standard-version --dry-run | grep "tagging release" | awk '{ print $NF }')"
run: echo "next-version=$(npx standard-version --dry-run | grep "tagging release" | awk '{ print $NF }')" >> $GITHUB_OUTPUT

# Room for improvement regarding caching/work-skipping. One example here
# https://github.com/ClementTsang/bottom/blob/92ec3599363c710815c286e975bbb6cc748708dd/.github/workflows/ci.yml#L195
Expand Down Expand Up @@ -197,9 +197,29 @@ jobs:
- name: Combine checksums
run: cat dist/**/typescript-tools-*-SHASUMS256.txt | tee npm/SHASUMS256.txt

- name: Cache cargo
uses: actions/cache@v3
id: cache-cargo
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install semantic-release-rust
uses: actions-rs/cargo@v1
if: steps.cache-cargo.outputs.cache-hit != 'true'
with:
command: install
args: semantic-release-rust --version 1.0.0-alpha.8

- name: Invoke semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm ci --ignore-scripts
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.direnv/
/.pre-commit-config.yaml
/target
/node_modules/
/result
/target/
8 changes: 8 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
}
]
}
],
[
"@semantic-release/exec",
{
"verifyContitionsCmd": "semantic-release-rust verify-conditions",
"prepareCmd": "semantic-release-rust prepare ${nextRelease.version}",
"publishCmd": "semantic-release-rust publish"
}
]
]
}
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@
name = "typescript_tools"
version = "0.0.0-semantically-released"
edition = "2021"
authors = ["Eric Crosson <eric.s.crosson@utexas.edu>"]
license = "ISC"
description = "Tools for working with TypeScript monorepos"
readme = "README.md"
homepage = "https://github.com/typescript-tools/rust-implementation"
keywords = ["cli", "typescript", "monorepo"]
categories = ["command-line-utilities"]

[[bin]]
name = "monorepo"
path = "src/main.rs"

[lib]
name = "typescript_tools"
path = "src/lib.rs"

[dependencies]
anyhow = "1.0.57"
askama = "0.11.1"
Expand Down
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ from rust:1.65.0@sha256:b0f2a9e48df82f009fda8ae777119e7983104a1b4dc47026653b6cda
# create a dummy project
RUN apt-get update && \
apt-get install --yes musl-tools curl llvm clang && \
rustup target add x86_64-unknown-linux-musl && \
USER=root cargo new --bin rust-implementation
rustup target add x86_64-unknown-linux-musl
WORKDIR /rust-implementation

# copy over manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml

# cache build dependencies
RUN cargo build --release --target x86_64-unknown-linux-musl && \
rm -r src/

# copy over project source
COPY ./templates ./templates
COPY ./src ./src
Expand Down
4 changes: 1 addition & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
# doCheck = true;
buildInputs = with pkgs; [
fenix-channel.rustc
fenix-channel.clippy
nodePackages.typescript
];

nativeBuildInputs = with pkgs; [
Expand Down Expand Up @@ -122,8 +120,8 @@
fenix-toolchain
fenix.packages.${system}.rust-analyzer

# Nix
pkgs.cargo-watch
pkgs.nodejs
pkgs.rnix-lsp
];

Expand Down
35 changes: 35 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"devDependencies": {
"@codedependant/semantic-release-docker": "4.1.0",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "8.0.6",
"@semantic-release/npm": "9.0.1",
Expand All @@ -31,4 +32,4 @@
"bin/",
"npm/"
]
}
}
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#![forbid(unsafe_code)]

mod configuration_file;
mod io;
mod monorepo_manifest;
mod package_manifest;
mod typescript_config;

pub mod configuration_file;
pub mod link;
pub mod lint;
pub mod make_depend;
pub mod monorepo_manifest;
pub mod opts;
pub mod package_manifest;
pub mod pin;
pub mod query;
5 changes: 1 addition & 4 deletions src/monorepo_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};

use anyhow::{Context, Result};

use globwalk::{FileType, GlobWalkerBuilder};

use indoc::formatdoc;
use serde::Deserialize;

use pariter::IteratorExt;
use serde::Deserialize;

use crate::configuration_file::ConfigurationFile;
use crate::io::read_json_from_file;
Expand Down