File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
create-turbo/src/transforms Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { isDefaultExample } from "../utils/isDefaultExample";
5
5
import type { TransformInput , TransformResult , MetaJson } from "./types" ;
6
6
import { TransformError } from "./errors" ;
7
7
8
+ const REPO_NAMES = [ "turbo" , "turborepo" ] ;
9
+
8
10
const meta = {
9
11
name : "official-starter" ,
10
12
} ;
@@ -18,10 +20,10 @@ export async function transform(args: TransformInput): TransformResult {
18
20
const { prompts, example, opts } = args ;
19
21
20
22
const defaultExample = isDefaultExample ( example . name ) ;
21
- const isThisRepo =
22
- example . repo &&
23
- ( example . repo . name === "turborepo" || example . repo . name === "turbo" ) ;
24
- const isOfficialStarter = example . repo ?. username === "vercel" && isThisRepo ;
23
+ const isOfficialStarter =
24
+ ! example . repo ||
25
+ ( example . repo . username === "vercel" &&
26
+ REPO_NAMES . includes ( example . repo . name ) ) ;
25
27
26
28
if ( ! isOfficialStarter ) {
27
29
return { result : "not-applicable" , ...meta } ;
@@ -43,7 +45,7 @@ export async function transform(args: TransformInput): TransformResult {
43
45
}
44
46
45
47
if ( hasPackageJson ) {
46
- let packageJsonContent ;
48
+ let packageJsonContent : PackageJson | undefined ;
47
49
try {
48
50
packageJsonContent = fs . readJsonSync ( rootPackageJsonPath ) as
49
51
| PackageJson
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export async function createProject({
47
47
if ( isDefaultExample ) {
48
48
repoInfo = {
49
49
username : "vercel" ,
50
- name : "turbo " ,
50
+ name : "turborepo " ,
51
51
branch : "main" ,
52
52
filePath : "examples/basic" ,
53
53
} ;
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ export function existsInRepo(nameOrUrl: string): Promise<boolean> {
91
91
return isUrlOk ( url . href ) ;
92
92
} catch {
93
93
return isUrlOk (
94
- `https://api.github.com/repos/vercel/turbo /contents/examples/${ encodeURIComponent (
94
+ `https://api.github.com/repos/vercel/turborepo /contents/examples/${ encodeURIComponent (
95
95
nameOrUrl
96
96
) } `
97
97
) ;
You can’t perform that action at this time.
0 commit comments