From bda4e20a62004449f355001cc3f1d78e11344c11 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sun, 23 Jun 2024 17:12:13 +0000 Subject: [PATCH] feat: detect purescript projects --- src/detect.ts | 72 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/detect.ts b/src/detect.ts index de6fdad..85c1656 100644 --- a/src/detect.ts +++ b/src/detect.ts @@ -78,6 +78,35 @@ export default async function detect(src: string): Promise { 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`)) @@ -438,35 +467,6 @@ export default async function detect(src: string): Promise { 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; - } - await actions.save(project.id, [ { id: createId(), @@ -489,6 +489,13 @@ export async function detectProjectType(src: string): Promise { 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`)) @@ -554,12 +561,5 @@ export async function detectProjectType(src: string): Promise { return "haskell"; } - if ( - (await fileExists(`${src}/spago.yaml`)) || - (await fileExists(`${src}/spago.dhall`)) - ) { - return "purescript"; - } - return "base"; }