From fd95936219b309716d526ed972b9f9db17b5ba24 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 24 Feb 2022 00:30:33 +0100 Subject: [PATCH] feat: 11ty buildpack --- src/lib/buildPacks/index.ts | 4 +- src/lib/components/templates.ts | 40 ++++++++++++++----- .../[id]/configuration/buildpack.svelte | 4 ++ 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/lib/buildPacks/index.ts b/src/lib/buildPacks/index.ts index 4cdbaccce..41a7655f9 100644 --- a/src/lib/buildPacks/index.ts +++ b/src/lib/buildPacks/index.ts @@ -11,6 +11,7 @@ import vuejs from './vuejs'; import php from './php'; import rust from './rust'; import astro from './static'; +import eleventy from './static'; export { node, @@ -25,5 +26,6 @@ export { vuejs, php, rust, - astro + astro, + eleventy }; diff --git a/src/lib/components/templates.ts b/src/lib/components/templates.ts index 56b72a250..46998ab10 100644 --- a/src/lib/components/templates.ts +++ b/src/lib/components/templates.ts @@ -136,6 +136,16 @@ export function findBuildPack(pack, packageManager = 'npm') { port: 80 }; } + if (pack === 'eleventy') { + return { + ...metaData, + installCommand: `yarn install`, + buildCommand: `yarn build`, + startCommand: null, + publishDirectory: `_site`, + port: 80 + }; + } return { name: 'node', fancyName: 'Node.js', @@ -191,6 +201,12 @@ export const buildPacks = [ hoverColor: 'hover:bg-green-700', color: 'bg-green-700' }, + { + name: 'gatsby', + fancyName: 'Gatsby', + hoverColor: 'hover:bg-blue-700', + color: 'bg-blue-700' + }, { name: 'astro', fancyName: 'Astro', @@ -198,11 +214,12 @@ export const buildPacks = [ color: 'bg-pink-700' }, { - name: 'gatsby', - fancyName: 'Gatsby', - hoverColor: 'hover:bg-blue-700', - color: 'bg-blue-700' + name: 'eleventy', + fancyName: 'Eleventy', + hoverColor: 'hover:bg-red-700', + color: 'bg-red-700' }, + { name: 'react', fancyName: 'React', @@ -215,18 +232,18 @@ export const buildPacks = [ hoverColor: 'hover:bg-blue-700', color: 'bg-blue-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: 'nestjs', + fancyName: 'NestJS', + hoverColor: 'hover:bg-red-700', + color: 'bg-red-700' + }, { name: 'rust', fancyName: 'Rust', @@ -238,6 +255,9 @@ export const scanningTemplates = { astro: { buildPack: 'astro' }, + '@11ty/eleventy': { + buildPack: 'eleventy' + }, svelte: { buildPack: 'svelte' }, diff --git a/src/routes/applications/[id]/configuration/buildpack.svelte b/src/routes/applications/[id]/configuration/buildpack.svelte index 7bed31e06..d1612ea49 100644 --- a/src/routes/applications/[id]/configuration/buildpack.svelte +++ b/src/routes/applications/[id]/configuration/buildpack.svelte @@ -37,6 +37,8 @@ import { gitTokens } from '$lib/store'; import { browser } from '$app/env'; + const { id } = $page.params; + let scanning = true; let foundConfig = null; let packageManager = 'npm'; @@ -176,6 +178,8 @@ } } if (error.message === 'Bad credentials') { + const { token } = await get(`/applications/${id}/configuration/githubToken.json`); + $gitTokens.githubToken = token; browser && window.location.reload(); } return errorNotification(error);