Skip to content

Commit

Permalink
Merge branch 'main' into blog_author_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman authored Nov 12, 2022
2 parents 8af8e4a + 6aff6f5 commit 94b1526
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/examples @vercel/turbo-oss
/shim @vercel/turbo-oss
/docs/pages/repo @vercel/turbo-oss
.github/workflows/pr-go-*.yml @vercel/turbo-oss
.github/workflows/pr-js-tests-*.yml @vercel/turbo-oss

# Turbopack-specific things

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Follow [@turborepo](https://twitter.com/turborepo) on Twitter and for project up

- Jared Palmer ([@jaredpalmer](https://twitter.com/jaredpalmer))

**Turbopack and Turboengine**
**Turbopack and the Turbo engine**

- Tobias Koppers ([@wSokra](https://twitter.com/wSokra))
- Maia Teegarden ([@padmaia](https://twitter.com/padmaia))
Expand Down
4 changes: 4 additions & 0 deletions cli/internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ func (c *Context) parsePackageJSON(repoRoot turbopath.AbsoluteSystemPath, pkgJSO
c.TopologicalGraph.Add(pkg.Name)
pkg.PackageJSONPath = turbopath.AnchoredSystemPathFromUpstream(relativePkgJSONPath)
pkg.Dir = turbopath.AnchoredSystemPathFromUpstream(filepath.Dir(relativePkgJSONPath))
if c.PackageInfos[pkg.Name] != nil {
existing := c.PackageInfos[pkg.Name]
return fmt.Errorf("Failed to add workspace \"%s\" from %s, it already exists at %s", pkg.Name, pkg.Dir, existing.Dir)
}
c.PackageInfos[pkg.Name] = pkg
c.PackageNames = append(c.PackageNames, pkg.Name)
}
Expand Down
39 changes: 39 additions & 0 deletions cli/internal/context/context_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package context

import (
"os"
"path/filepath"
"regexp"
"testing"

testifyAssert "github.com/stretchr/testify/assert"
"github.com/vercel/turbo/cli/internal/fs"
"github.com/vercel/turbo/cli/internal/turbopath"
)

func Test_isWorkspaceReference(t *testing.T) {
Expand Down Expand Up @@ -121,3 +127,36 @@ func Test_isWorkspaceReference(t *testing.T) {
})
}
}

func TestBuildPackageGraph_DuplicateNames(t *testing.T) {
path := getTestDir(t, "repo-with-dupe-workspaces")
pkgJSON := &fs.PackageJSON{
Name: "repo-with-dupe-workspaces",
PackageManager: "npm@8.1.2",
}

_, actualErr := BuildPackageGraph(path, pkgJSON)

// Not asserting the full error message, because it includes a path with slashes and backslashes
// getting the regex incantation to check that is not worth it.
// We have to use regex because the actual error may be different depending on which workspace was
// added first and which one was second, causing the error.
testifyAssert.Regexp(t, regexp.MustCompile("^Failed to add workspace \"same-name\".+$"), actualErr)
}

// This is duplicated from fs.turbo_json_test.go.
// I wasn't able to pull it into a helper file/package because
// it requires the `fs` package and it would cause cyclical dependencies
// when used in turbo_json_test.go and would require more changes to fix that.
func getTestDir(t *testing.T, testName string) turbopath.AbsoluteSystemPath {
defaultCwd, err := os.Getwd()
if err != nil {
t.Errorf("failed to get cwd: %v", err)
}
cwd, err := fs.CheckedToAbsoluteSystemPath(defaultCwd)
if err != nil {
t.Fatalf("cwd is not an absolute directory %v: %v", defaultCwd, err)
}

return cwd.UntypedJoin("testdata", testName)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "same-name"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "same-name"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "repo-with-dupe-workspaces",
"workspaces": [
"apps/*"
],
"packageManager": "pnpm@7.15.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- "apps/*"
15 changes: 10 additions & 5 deletions crates/next-dev/src/devserver_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,23 @@ pub struct DevServerOptions {
pub log_detail: bool,

// Inherited options from next-dev, need revisit later.
// These are not supported by CLI yet.
#[cfg(feature = "serializable")]
#[cfg_attr(feature = "cli", clap(long))]
#[cfg_attr(feature = "serializable", serde(default))]
/// If port is not explicitly specified, use different port if it's already
/// in use.
pub allow_retry: bool,
#[cfg(feature = "serializable")]
#[cfg_attr(feature = "cli", clap(long))]
#[cfg_attr(feature = "serializable", serde(default))]
/// Internal for next.js, no specific usage yet.
pub dev: bool,
#[cfg(feature = "serializable")]
#[cfg_attr(feature = "cli", clap(long))]
#[cfg_attr(feature = "serializable", serde(default))]
/// Internal for next.js, no specific usage yet.
pub is_next_dev_command: bool,
#[cfg(feature = "serializable")]
#[cfg_attr(feature = "cli", clap(long))]
#[cfg_attr(feature = "serializable", serde(default))]
/// Specify server component external packages explicitly. This is an
/// experimental flag.
pub server_components_external_packages: Vec<String>,
}

Expand Down
6 changes: 6 additions & 0 deletions docs/components/clients/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,10 @@ export const users: Array<TurboUser> = [
width: 175,
},
},
{
caption: "SolanaFM",
image: "/images/logos/solanafm.svg",
infoLink: "https://solana.fm/",
pinned: true,
},
];
5 changes: 3 additions & 2 deletions docs/pages/repo/docs/reference/codemods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ For example:
}
```

````diff
```diff
// After, turbo.json
{
"$schema": "https://turbo.build/schema.json",
Expand All @@ -171,14 +171,15 @@ For example:
}
}
}
```

#### Usage

Go to your project:

```sh
cd path-to-your-turborepo/
````
```

Run the codemod:

Expand Down
8 changes: 8 additions & 0 deletions docs/public/images/logos/color/solanafm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 94b1526

Please sign in to comment.