Skip to content

Commit

Permalink
Merge branch 'vercel:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
X-oss-byte committed Jul 26, 2023
2 parents b43e9b6 + 32b6e5b commit 0220754
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 32 deletions.
2 changes: 1 addition & 1 deletion cli/cmd/turbo/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

const turboVersion = "1.10.10-canary.0"
const turboVersion = "1.10.12"
37 changes: 29 additions & 8 deletions crates/turborepo-lib/src/commands/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ pub enum Error {

// Files that should be copied from root and if they're required for install
lazy_static! {
static ref ADDITIONAL_FILES: Vec<(&'static RelativeUnixPath, bool)> = vec![
(RelativeUnixPath::new(".gitignore").unwrap(), false),
(RelativeUnixPath::new(".npmrc").unwrap(), true),
static ref ADDITIONAL_FILES: Vec<(&'static RelativeUnixPath, Option<CopyDestination>)> = vec![
(RelativeUnixPath::new(".gitignore").unwrap(), None),
(
RelativeUnixPath::new(".npmrc").unwrap(),
Some(CopyDestination::Docker)
),
];
}

Expand Down Expand Up @@ -81,7 +84,7 @@ pub fn prune(
{
prune.copy_file(
&AnchoredSystemPathBuf::from_raw(workspace_config_path)?,
true,
Some(CopyDestination::All),
)?;
}

Expand Down Expand Up @@ -181,10 +184,10 @@ pub fn prune(
}

for patch in pruned_patches {
prune.copy_file(&patch.to_system_path(), true)?;
prune.copy_file(&patch.to_system_path(), Some(CopyDestination::Docker))?;
}
} else {
prune.copy_file(package_json(), true)?;
prune.copy_file(package_json(), Some(CopyDestination::Docker))?;
}

Ok(())
Expand All @@ -199,6 +202,15 @@ struct Prune<'a> {
scope: &'a [String],
}

#[derive(Copy, Clone, PartialEq, Eq)]
enum CopyDestination {
// Copies to full and json
Docker,
// Copies to out, full, and json
// This behavior comes from a bug in the Go impl that people depend on.
All,
}

impl<'a> Prune<'a> {
fn new(
base: &CommandBase,
Expand Down Expand Up @@ -271,7 +283,7 @@ impl<'a> Prune<'a> {
fn copy_file(
&self,
path: &AnchoredSystemPath,
required_for_install: bool,
destination: Option<CopyDestination>,
) -> Result<(), Error> {
let from_path = self.root.resolve(path);
if !from_path.try_exists()? {
Expand All @@ -280,7 +292,16 @@ impl<'a> Prune<'a> {
}
let full_to = self.full_directory.resolve(path);
turborepo_fs::copy_file(&from_path, full_to)?;
if self.docker && required_for_install {
if matches!(destination, Some(CopyDestination::All)) {
let out_to = self.out_directory.resolve(path);
turborepo_fs::copy_file(&from_path, out_to)?;
}
if self.docker
&& matches!(
destination,
Some(CopyDestination::Docker) | Some(CopyDestination::All)
)
{
let docker_to = self.docker_directory().resolve(path);
turborepo_fs::copy_file(&from_path, docker_to)?;
}
Expand Down
24 changes: 24 additions & 0 deletions crates/turborepo-lib/src/config/turbo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,4 +790,28 @@ mod tests {

assert_eq!(pruned_json, expected);
}

#[test_case("full", Some(TaskOutputMode::Full) ; "full")]
#[test_case("hash-only", Some(TaskOutputMode::HashOnly) ; "hash-only")]
#[test_case("new-only", Some(TaskOutputMode::NewOnly) ; "new-only")]
#[test_case("errors-only", Some(TaskOutputMode::ErrorsOnly) ; "errors-only")]
#[test_case("none", Some(TaskOutputMode::None) ; "none")]
#[test_case("junk", None ; "invalid value")]
fn test_parsing_output_mode(output_mode: &str, expected: Option<TaskOutputMode>) {
let json: Result<RawTurboJSON, _> = serde_json::from_value(serde_json::json!({
"pipeline": {
"build": {
"outputMode": output_mode,
}
}
}));

let actual = json
.as_ref()
.ok()
.and_then(|j| j.pipeline.as_ref())
.and_then(|pipeline| pipeline.0.get("build"))
.and_then(|build| build.output_mode);
assert_eq!(actual, expected);
}
}
10 changes: 5 additions & 5 deletions crates/turborepo-lib/src/task_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ pub struct TaskOutputs {
}

// TaskOutputMode defines the ways turbo can display task output during a run
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "kebab-case")]
pub enum TaskOutputMode {
// FullTaskOutput will show all task output
#[default]
Full,
// None will hide all task output
None,
// Hash will display turbo-computed task hashes
Hash,
HashOnly,
// New will show all new task output and turbo-computed task hashes for cached
// output
New,
NewOnly,
// Error will show task output for failures only; no cache miss/hit messages are
// emitted
Error,
ErrorsOnly,
}

// taskDefinitionHashable exists as a definition for PristinePipeline, which is
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MPL-2.0"
# This is for the convenience of running daily dev workflows, i.e running
# `cargo xxx` without explicitly specifying features, not that we want to
# promote this as default backend.
default = ["rustls-tls"]
default = ["rustls-tls", "go-daemon"]
native-tls = ["turborepo-lib/native-tls"]
rustls-tls = ["turborepo-lib/rustls-tls"]
http = ["turborepo-lib/http"]
Expand Down
2 changes: 1 addition & 1 deletion packages/create-turbo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-turbo",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "Create a new Turborepo",
"homepage": "https://turbo.build/repo",
"license": "MPL-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-turbo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-turbo",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "ESLint config for Turborepo",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-turbo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-turbo",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "ESLint plugin for Turborepo",
"keywords": [
"turbo",
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turbo/codemod",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "Provides Codemod transformations to help upgrade your Turborepo codebase when a feature is deprecated.",
"homepage": "https://turbo.build/repo",
"license": "MPL-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-gen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turbo/gen",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "Extend a Turborepo",
"homepage": "https://turbo.build/repo",
"license": "MPL-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-ignore/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "turbo-ignore",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "",
"homepage": "https://turbo.build/repo",
"keywords": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turbo/types",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "Turborepo types",
"homepage": "https://turbo.build/repo",
"license": "MPL-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-workspaces/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turbo/workspaces",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "Tools for working with package managers",
"homepage": "https://turbo.build/repo",
"license": "MPL-2.0",
Expand Down
14 changes: 7 additions & 7 deletions packages/turbo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "turbo",
"version": "1.10.10-canary.0",
"version": "1.10.12",
"description": "Turborepo is a high-performance build system for JavaScript and TypeScript codebases.",
"repository": "https://github.com/vercel/turbo",
"bugs": "https://github.com/vercel/turbo/issues",
Expand All @@ -20,11 +20,11 @@
"install.js"
],
"optionalDependencies": {
"turbo-darwin-64": "1.10.10-canary.0",
"turbo-darwin-arm64": "1.10.10-canary.0",
"turbo-linux-64": "1.10.10-canary.0",
"turbo-linux-arm64": "1.10.10-canary.0",
"turbo-windows-64": "1.10.10-canary.0",
"turbo-windows-arm64": "1.10.10-canary.0"
"turbo-darwin-64": "1.10.12",
"turbo-darwin-arm64": "1.10.12",
"turbo-linux-64": "1.10.12",
"turbo-linux-arm64": "1.10.12",
"turbo-windows-64": "1.10.12",
"turbo-windows-arm64": "1.10.12"
}
}
7 changes: 7 additions & 0 deletions turborepo-tests/integration/tests/prune/docker.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ Make sure patches are part of the json output
patches
pnpm-lock.yaml
pnpm-workspace.yaml
Make sure that pnpm-workspace.yaml is in the top out directory
$ ls out
full
json
package.json
pnpm-lock.yaml
pnpm-workspace.yaml

Make sure the pnpm patches section is present
$ cat out/json/package.json | jq '.pnpm.patchedDependencies'
Expand Down
4 changes: 2 additions & 2 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.10.10-canary.0
canary
1.10.12
latest

0 comments on commit 0220754

Please sign in to comment.