Skip to content

Commit

Permalink
Polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jan 8, 2025
1 parent fe2c4b4 commit 4b1c98c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .yarn/versions/ddd51f72.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
releases:
"@moonrepo/cli": patch
"@moonrepo/core-linux-arm64-gnu": patch
"@moonrepo/core-linux-arm64-musl": patch
"@moonrepo/core-linux-x64-gnu": patch
"@moonrepo/core-linux-x64-musl": patch
"@moonrepo/core-macos-arm64": patch
"@moonrepo/core-macos-x64": patch
"@moonrepo/core-windows-x64-msvc": patch
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#### ⚙️ Internal

- Updated proto to v0.44.4 (from 0.44.2).
- Updated proto to [v0.44.4](https://github.com/moonrepo/proto/releases/tag/v0.44.4) (from 0.44.2).

## 1.31.0

Expand Down
2 changes: 0 additions & 2 deletions crates/cli/tests/run_node_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,8 +1260,6 @@ mod non_js_bins {
cmd.arg("run").arg("esbuild:build");
});

assert.debug();

assert_eq!(
fs::read_to_string(sandbox.path().join("esbuild/output.js")).unwrap(),
"(() => {\n // input.js\n var ESBUILD = \"esbuild\";\n})();\n"
Expand Down
4 changes: 2 additions & 2 deletions crates/project-builder/src/project_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ impl<'app> ProjectBuilder<'app> {

#[allow(deprecated)]
if let Some(default_id) = &config.toolchain.default {
toolchains.extend(get_project_toolchains(default_id));
toolchains.extend(get_project_toolchains(default_id, &self.language));
} else if let Some(platform) = &config.platform {
let default_id = platform.get_toolchain_id();

toolchains.extend(get_project_toolchains(&default_id));
toolchains.extend(get_project_toolchains(&default_id, &self.language));

debug!(
project_id = self.id.as_str(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
platform: bun
language: typescript

tasks:
bun:
command: bun
platform: bun
16 changes: 16 additions & 0 deletions crates/project-graph/tests/project_graph_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,22 @@ mod project_graph {
);
}

#[tokio::test]
async fn inherits_ts_tasks_instead_of_js() {
let graph = generate_inheritance_project_graph("inheritance/scoped").await;

assert_eq!(
map_ids_from_target(
graph
.get_project("bun-with-ts")
.unwrap()
.task_targets
.clone()
),
["bun", "global", "global-typescript"]
);
}

#[tokio::test]
async fn inherits_tagged_tasks() {
let graph = generate_inheritance_project_graph("inheritance/tagged").await;
Expand Down
10 changes: 7 additions & 3 deletions crates/toolchain/src/detect/project_toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ use std::convert::TryFrom;
use std::path::Path;

/// Return a list of toolchains based on the provided ID.
pub fn get_project_toolchains(id: &Id) -> Vec<Id> {
pub fn get_project_toolchains(id: &Id, language: &LanguageType) -> Vec<Id> {
let mut toolchains = vec![id.to_owned()];

// Since JS has multiple runtimes, we should inherit JS also
// Since JS has multiple runtimes, we should inherit JS/TS also
if id == "bun" || id == "deno" || id == "node" {
toolchains.push(Id::raw("javascript"));
toolchains.push(if matches!(language, LanguageType::TypeScript) {
Id::raw("typescript")
} else {
Id::raw("javascript")
});
}
// Otherwise check if we're a supported language, if not, inherit system
else if LanguageType::try_from(id.as_str()).is_err() {
Expand Down

0 comments on commit 4b1c98c

Please sign in to comment.