From 15a3fd4456169fbe4d8333bd9a9f64c00dda6256 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 23 Feb 2022 22:07:06 +0100 Subject: [PATCH] feat: Astro buildpack --- src/lib/buildPacks/index.ts | 4 +- src/lib/components/templates.ts | 76 ++++++++++++------- .../[id]/configuration/buildpack.svelte | 1 + 3 files changed, 51 insertions(+), 30 deletions(-) diff --git a/src/lib/buildPacks/index.ts b/src/lib/buildPacks/index.ts index c8b133b5c..4cdbaccce 100644 --- a/src/lib/buildPacks/index.ts +++ b/src/lib/buildPacks/index.ts @@ -10,6 +10,7 @@ import nuxtjs from './nuxtjs'; import vuejs from './vuejs'; import php from './php'; import rust from './rust'; +import astro from './static'; export { node, @@ -23,5 +24,6 @@ export { nuxtjs, vuejs, php, - rust + rust, + astro }; diff --git a/src/lib/components/templates.ts b/src/lib/components/templates.ts index bea552812..56b72a250 100644 --- a/src/lib/components/templates.ts +++ b/src/lib/components/templates.ts @@ -126,6 +126,16 @@ export function findBuildPack(pack, packageManager = 'npm') { port: 3000 }; } + if (pack === 'astro') { + return { + ...metaData, + installCommand: `yarn install`, + buildCommand: `yarn build`, + startCommand: null, + publishDirectory: `dist`, + port: 80 + }; + } return { name: 'node', fancyName: 'Node.js', @@ -145,7 +155,6 @@ export const buildPacks = [ hoverColor: 'hover:bg-green-700', color: 'bg-green-700' }, - { name: 'static', fancyName: 'Static', @@ -158,36 +167,18 @@ export const buildPacks = [ hoverColor: 'hover:bg-sky-700', color: 'bg-sky-700' }, + { + name: 'php', + fancyName: 'PHP', + hoverColor: 'hover:bg-indigo-700', + color: 'bg-indigo-700' + }, { name: 'svelte', fancyName: 'Svelte', hoverColor: 'hover:bg-orange-700', color: 'bg-orange-700' }, - { - name: 'nestjs', - fancyName: 'NestJS', - hoverColor: 'hover:bg-red-700', - color: 'bg-red-700' - }, - { - name: 'react', - fancyName: 'React', - hoverColor: 'hover:bg-blue-700', - color: 'bg-blue-700' - }, - { - name: 'nextjs', - fancyName: 'NextJS', - hoverColor: 'hover:bg-blue-700', - color: 'bg-blue-700' - }, - { - name: 'gatsby', - fancyName: 'Gatsby', - hoverColor: 'hover:bg-blue-700', - color: 'bg-blue-700' - }, { name: 'vuejs', fancyName: 'VueJS', @@ -200,6 +191,24 @@ export const buildPacks = [ hoverColor: 'hover:bg-green-700', color: 'bg-green-700' }, + { + name: 'astro', + fancyName: 'Astro', + hoverColor: 'hover:bg-pink-700', + color: 'bg-pink-700' + }, + { + name: 'gatsby', + fancyName: 'Gatsby', + hoverColor: 'hover:bg-blue-700', + color: 'bg-blue-700' + }, + { + name: 'react', + fancyName: 'React', + hoverColor: 'hover:bg-blue-700', + color: 'bg-blue-700' + }, { name: 'preact', fancyName: 'Preact', @@ -207,10 +216,16 @@ export const buildPacks = [ color: 'bg-blue-700' }, { - name: 'php', - fancyName: 'PHP', - hoverColor: 'hover:bg-indigo-700', - color: 'bg-indigo-700' + name: 'nestjs', + fancyName: 'NestJS', + hoverColor: 'hover:bg-red-700', + color: 'bg-red-700' + }, + { + name: 'nextjs', + fancyName: 'NextJS', + hoverColor: 'hover:bg-blue-700', + color: 'bg-blue-700' }, { name: 'rust', @@ -220,6 +235,9 @@ export const buildPacks = [ } ]; export const scanningTemplates = { + astro: { + buildPack: 'astro' + }, svelte: { buildPack: 'svelte' }, diff --git a/src/routes/applications/[id]/configuration/buildpack.svelte b/src/routes/applications/[id]/configuration/buildpack.svelte index d2250be18..7bed31e06 100644 --- a/src/routes/applications/[id]/configuration/buildpack.svelte +++ b/src/routes/applications/[id]/configuration/buildpack.svelte @@ -35,6 +35,7 @@ import { get } from '$lib/api'; import { errorNotification } from '$lib/form'; import { gitTokens } from '$lib/store'; + import { browser } from '$app/env'; let scanning = true; let foundConfig = null;