-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Integrate framework detection in build info (#4876)
* feat: integrate framework detection inside build-info * chore: add rest of package managers + logos * chore: fix gatsby5 + order frameworks correctly and make workspace detection working * chore: updates * chore: updates * chore: update * chore: updates * chore: sort detection based on accuracy and type * chore: drop less accurate detection results * chore: get all possible commands for nx * chore: add nxignore * chore: updates * chore: remove logos as it's probably good to have them in a follow up PR * chore: windows path fixes * chore: full compatibility * chore: fix e2e * chore: update * chore: update * chore: pr feedback from daniel * chore: update * chore: updates * chore: fix windows tests
- Loading branch information
Lukas Holzer
authored
Mar 28, 2023
1 parent
7081ca9
commit 0df38c0
Showing
117 changed files
with
4,121 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# this contains fixtures like an nx workspace that would infer with the root one. | ||
packages/build-info/tests |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Build Info</title> | ||
</head> | ||
<body></body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,60 @@ | ||
import { PollingStrategy } from '../frameworks/framework.js' | ||
import { Project } from '../project.js' | ||
|
||
export type Command = { | ||
type: 'build' | 'dev' | 'unknown' | ||
command: string | ||
} | ||
|
||
export interface BuildSystem { | ||
id: string | ||
name: string | ||
project: Project | ||
version?: string | ||
|
||
detect(project: Project): Promise<BuildSystem | undefined> | ||
build?: { | ||
command: string | ||
directory?: string | ||
} | ||
|
||
dev?: { | ||
command: string | ||
port?: number | ||
pollingStrategies?: PollingStrategy[] | ||
} | ||
|
||
getCommands?(path: string): Promise<Command[]> | ||
|
||
detect(): Promise<BuildSystem | undefined> | ||
} | ||
|
||
export abstract class BaseBuildTool implements BuildSystem { | ||
export abstract class BaseBuildTool { | ||
id: string | ||
name: string | ||
version?: string | ||
configFiles: string[] = [] | ||
|
||
async detect(project: Project) { | ||
const config = await project.fs.findUp(this.configFiles, { cwd: project.baseDirectory, stopAt: project.root }) | ||
constructor(public project: Project) {} | ||
|
||
async detect(): Promise<this | undefined> { | ||
const config = await this.project.fs.findUp(this.configFiles, { | ||
cwd: this.project.baseDirectory, | ||
stopAt: this.project.root, | ||
}) | ||
|
||
if (config) { | ||
const pkgJson = await project.getPackageJSON(project.fs.dirname(config)) | ||
const pkgJson = await this.project.getPackageJSON(this.project.fs.dirname(config)) | ||
this.version = pkgJson.devDependencies?.[this.id] | ||
return this | ||
} | ||
} | ||
|
||
/** Gets a JSON from the class information */ | ||
toJSON() { | ||
return { id: this.id, name: this.name, version: this.version } | ||
return { | ||
id: this.id, | ||
name: this.name, | ||
version: this.version, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.