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

Commit 33d3e5d

Browse files
authored
Merge pull request #206 from typescript-tools/beta
Split crate into a library and a binary
2 parents ac5b866 + c5e4978 commit 33d3e5d

File tree

10 files changed

+86
-19
lines changed

10 files changed

+86
-19
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

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

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

200+
- name: Cache cargo
201+
uses: actions/cache@v3
202+
id: cache-cargo
203+
with:
204+
path: |
205+
~/.cargo/bin/
206+
~/.cargo/registry/index/
207+
~/.cargo/registry/cache/
208+
~/.cargo/git/db/
209+
target/
210+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
211+
212+
- name: Install semantic-release-rust
213+
uses: actions-rs/cargo@v1
214+
if: steps.cache-cargo.outputs.cache-hit != 'true'
215+
with:
216+
command: install
217+
args: semantic-release-rust --version 1.0.0-alpha.8
218+
200219
- name: Invoke semantic-release
201220
env:
202221
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
203223
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
204224
run: |
205225
npm ci --ignore-scripts

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/.direnv/
22
/.pre-commit-config.yaml
3-
/target
3+
/node_modules/
4+
/result
5+
/target/

.releaserc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
}
6060
]
6161
}
62+
],
63+
[
64+
"@semantic-release/exec",
65+
{
66+
"verifyContitionsCmd": "semantic-release-rust verify-conditions",
67+
"prepareCmd": "semantic-release-rust prepare ${nextRelease.version}",
68+
"publishCmd": "semantic-release-rust publish"
69+
}
6270
]
6371
]
6472
}

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@
22
name = "typescript_tools"
33
version = "0.0.0-semantically-released"
44
edition = "2021"
5+
authors = ["Eric Crosson <eric.s.crosson@utexas.edu>"]
6+
license = "ISC"
7+
description = "Tools for working with TypeScript monorepos"
8+
readme = "README.md"
9+
homepage = "https://github.com/typescript-tools/rust-implementation"
10+
keywords = ["cli", "typescript", "monorepo"]
11+
categories = ["command-line-utilities"]
512

613
[[bin]]
714
name = "monorepo"
815
path = "src/main.rs"
916

17+
[lib]
18+
name = "typescript_tools"
19+
path = "src/lib.rs"
20+
1021
[dependencies]
1122
anyhow = "1.0.57"
1223
askama = "0.11.1"

Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ from rust:1.65.0@sha256:b0f2a9e48df82f009fda8ae777119e7983104a1b4dc47026653b6cda
33
# create a dummy project
44
RUN apt-get update && \
55
apt-get install --yes musl-tools curl llvm clang && \
6-
rustup target add x86_64-unknown-linux-musl && \
7-
USER=root cargo new --bin rust-implementation
6+
rustup target add x86_64-unknown-linux-musl
87
WORKDIR /rust-implementation
98

109
# copy over manifests
1110
COPY ./Cargo.lock ./Cargo.lock
1211
COPY ./Cargo.toml ./Cargo.toml
1312

14-
# cache build dependencies
15-
RUN cargo build --release --target x86_64-unknown-linux-musl && \
16-
rm -r src/
17-
1813
# copy over project source
1914
COPY ./templates ./templates
2015
COPY ./src ./src

flake.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
# doCheck = true;
5252
buildInputs = with pkgs; [
5353
fenix-channel.rustc
54-
fenix-channel.clippy
55-
nodePackages.typescript
5654
];
5755

5856
nativeBuildInputs = with pkgs; [
@@ -122,8 +120,8 @@
122120
fenix-toolchain
123121
fenix.packages.${system}.rust-analyzer
124122

125-
# Nix
126123
pkgs.cargo-watch
124+
pkgs.nodejs
127125
pkgs.rnix-lsp
128126
];
129127

package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"devDependencies": {
2323
"@codedependant/semantic-release-docker": "4.1.0",
24+
"@semantic-release/exec": "6.0.3",
2425
"@semantic-release/git": "10.0.1",
2526
"@semantic-release/github": "8.0.6",
2627
"@semantic-release/npm": "9.0.1",
@@ -31,4 +32,4 @@
3132
"bin/",
3233
"npm/"
3334
]
34-
}
35+
}

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#![forbid(unsafe_code)]
22

3-
mod configuration_file;
43
mod io;
5-
mod monorepo_manifest;
6-
mod package_manifest;
74
mod typescript_config;
85

6+
pub mod configuration_file;
97
pub mod link;
108
pub mod lint;
119
pub mod make_depend;
10+
pub mod monorepo_manifest;
1211
pub mod opts;
12+
pub mod package_manifest;
1313
pub mod pin;
1414
pub mod query;

src/monorepo_manifest.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ use std::collections::HashMap;
22
use std::path::{Path, PathBuf};
33

44
use anyhow::{Context, Result};
5-
65
use globwalk::{FileType, GlobWalkerBuilder};
7-
86
use indoc::formatdoc;
9-
use serde::Deserialize;
10-
117
use pariter::IteratorExt;
8+
use serde::Deserialize;
129

1310
use crate::configuration_file::ConfigurationFile;
1411
use crate::io::read_json_from_file;

0 commit comments

Comments
 (0)