Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: detect haskell projects #51

Merged
merged 2 commits into from
Jun 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions src/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,35 @@ export default async function detect(src: string): Promise<void> {
return;
}

if (
(await fileExists(`${src}/spago.yaml`)) ||
(await fileExists(`${src}/spago.dhall`))
) {
await actions.save(project.id, [
{
id: createId(),
name: "tests",
commands: "test",
enabled: true,
plugin: "purescript",
useWasm: true,
logo: "https://upload.wikimedia.org/wikipedia/commons/6/64/PureScript_Logo.png",
githubUrl: "https://github.com/fluentci-io/purescipt-plugin",
},
{
id: createId(),
name: "build",
commands: "build",
enabled: true,
plugin: "purescript",
useWasm: true,
logo: "https://upload.wikimedia.org/wikipedia/commons/6/64/PureScript_Logo.png",
githubUrl: "https://github.com/fluentci-io/purescript-plugin",
},
]);
return;
}

if (
(await fileExists(`${src}/package.json`)) &&
(await fileExists(`${src}/bun.lockb`))
Expand Down Expand Up @@ -409,7 +438,32 @@ export default async function detect(src: string): Promise<void> {
githubUrl: "https://github.com/fluent-ci-templates/swift-pipeline",
},
]);
return;
}

if (await fileExists(`${src}/cabal.project`)) {
await actions.save(project.id, [
{
id: createId(),
name: "tests",
commands: "test",
enabled: true,
plugin: "haskell",
useWasm: true,
logo: "https://upload.wikimedia.org/wikipedia/commons/1/1c/Haskell-Logo.svg",
githubUrl: "https://github.com/fluentci-io/haskell-plugin",
},
{
id: createId(),
name: "build",
commands: "build",
enabled: true,
plugin: "haskell",
useWasm: true,
logo: "https://upload.wikimedia.org/wikipedia/commons/1/1c/Haskell-Logo.svg",
githubUrl: "https://github.com/fluentci-io/haskell-plugin",
},
]);
return;
}

Expand All @@ -435,6 +489,13 @@ export async function detectProjectType(src: string): Promise<string> {
return "go";
}

if (
(await fileExists(`${src}/spago.yaml`)) ||
(await fileExists(`${src}/spago.dhall`))
) {
return "purescript";
}

if (
(await fileExists(`${src}/package.json`)) &&
(await fileExists(`${src}/bun.lockb`))
Expand Down Expand Up @@ -496,5 +557,9 @@ export async function detectProjectType(src: string): Promise<string> {
return "swift";
}

if (await fileExists(`${src}/cabal.project`)) {
return "haskell";
}

return "base";
}