coolify/apps/ui/src/lib/templates.ts

402 lines
7.4 KiB
TypeScript
Raw Normal View History

2022-07-06 09:02:36 +00:00
function defaultBuildAndDeploy(packageManager: string) {
return {
installCommand:
2022-02-28 08:50:47 +00:00
packageManager === 'npm' ? `${packageManager} install` : `${packageManager} install`,
buildCommand:
packageManager === 'npm' ? `${packageManager} run build` : `${packageManager} build`,
startCommand:
packageManager === 'npm' ? `${packageManager} run start` : `${packageManager} start`
};
}
2022-07-06 09:02:36 +00:00
export function findBuildPack(pack: string, packageManager = 'npm') {
const metaData = buildPacks.find((b) => b.name === pack);
if (pack === 'node') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
buildCommand: null,
publishDirectory: null,
port: null
};
}
if (pack === 'static') {
return {
...metaData,
installCommand: null,
buildCommand: null,
startCommand: null,
publishDirectory: null,
port: 80
};
}
if (pack === 'docker') {
return {
...metaData,
installCommand: null,
buildCommand: null,
startCommand: null,
publishDirectory: null,
port: null
};
}
if (pack === 'svelte') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
publishDirectory: 'public',
port: 80
};
}
if (pack === 'nestjs') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
startCommand:
packageManager === 'npm' ? 'npm run start:prod' : `${packageManager} run start:prod`,
publishDirectory: null,
port: 3000
};
}
if (pack === 'react') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
publishDirectory: 'build',
port: 80
};
}
if (pack === 'nextjs') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
publishDirectory: null,
port: 3000,
deploymentType: 'node'
};
}
if (pack === 'gatsby') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
publishDirectory: 'public',
port: 80
};
}
if (pack === 'vuejs') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
publishDirectory: 'dist',
port: 80
};
}
if (pack === 'nuxtjs') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
publishDirectory: null,
port: 3000,
deploymentType: 'node'
};
}
if (pack === 'preact') {
return {
...metaData,
...defaultBuildAndDeploy(packageManager),
publishDirectory: 'build',
port: 80
};
}
if (pack === 'php') {
return {
...metaData,
installCommand: null,
buildCommand: null,
startCommand: null,
publishDirectory: null,
port: 80
};
}
if (pack === 'rust') {
return {
...metaData,
installCommand: null,
buildCommand: null,
startCommand: null,
publishDirectory: null,
port: 3000
};
}
2022-02-23 21:07:06 +00:00
if (pack === 'astro') {
return {
...metaData,
2022-05-09 07:12:21 +00:00
...defaultBuildAndDeploy(packageManager),
2022-02-23 21:07:06 +00:00
publishDirectory: `dist`,
port: 80
};
}
2022-02-23 23:30:33 +00:00
if (pack === 'eleventy') {
return {
...metaData,
2022-05-09 07:12:21 +00:00
...defaultBuildAndDeploy(packageManager),
2022-02-23 23:30:33 +00:00
publishDirectory: `_site`,
port: 80
};
}
2022-04-02 14:22:51 +00:00
if (pack === 'python') {
return {
...metaData,
startCommand: null,
port: 8000
};
}
2022-04-19 20:08:42 +00:00
if (pack === 'deno') {
return {
...metaData,
2022-04-20 20:23:25 +00:00
installCommand: null,
buildCommand: null,
2022-04-19 20:08:42 +00:00
startCommand: null,
2022-04-20 20:23:25 +00:00
publishDirectory: null,
port: 8000
2022-04-19 20:08:42 +00:00
};
}
2022-04-28 13:10:45 +00:00
if (pack === 'laravel') {
return {
...metaData,
installCommand: null,
buildCommand: null,
startCommand: null,
publishDirectory: null,
port: 80
};
}
2022-08-16 11:58:37 +00:00
if (pack === 'heroku') {
return {
...metaData,
installCommand: null,
buildCommand: null,
startCommand: null,
publishDirectory: null,
port: 5000
};
}
return {
2022-02-10 14:47:44 +00:00
name: 'node',
fancyName: 'Node.js',
hoverColor: 'hover:bg-green-700',
color: 'bg-green-700',
2022-02-10 14:47:44 +00:00
installCommand: null,
buildCommand: null,
startCommand: null,
publishDirectory: null,
port: null
};
}
export const buildPacks = [
{
name: 'node',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-02-10 14:47:44 +00:00
fancyName: 'Node.js',
hoverColor: 'hover:bg-green-700',
2022-08-16 11:58:37 +00:00
color: 'bg-green-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
{
name: 'static',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-02-10 14:47:44 +00:00
fancyName: 'Static',
hoverColor: 'hover:bg-orange-700',
2022-08-16 11:58:37 +00:00
color: 'bg-orange-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
2022-04-28 13:10:45 +00:00
2022-02-23 21:07:06 +00:00
{
name: 'php',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-02-23 21:07:06 +00:00
fancyName: 'PHP',
hoverColor: 'hover:bg-indigo-700',
2022-08-16 11:58:37 +00:00
color: 'bg-indigo-700',
isCoolifyBuildPack: true,
2022-02-23 21:07:06 +00:00
},
2022-04-28 13:10:45 +00:00
{
name: 'laravel',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'php',
2022-04-28 13:10:45 +00:00
fancyName: 'Laravel',
hoverColor: 'hover:bg-indigo-700',
2022-08-16 11:58:37 +00:00
color: 'bg-indigo-700',
isCoolifyBuildPack: true,
2022-04-28 13:10:45 +00:00
},
{
name: 'docker',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-04-28 13:10:45 +00:00
fancyName: 'Docker',
hoverColor: 'hover:bg-sky-700',
2022-08-16 11:58:37 +00:00
color: 'bg-sky-700',
isCoolifyBuildPack: true,
2022-04-28 13:10:45 +00:00
},
2022-02-10 14:47:44 +00:00
{
name: 'svelte',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-10 14:47:44 +00:00
fancyName: 'Svelte',
hoverColor: 'hover:bg-orange-700',
2022-08-16 11:58:37 +00:00
color: 'bg-orange-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
{
2022-02-23 21:07:06 +00:00
name: 'vuejs',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 21:07:06 +00:00
fancyName: 'VueJS',
hoverColor: 'hover:bg-green-700',
2022-08-16 11:58:37 +00:00
color: 'bg-green-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
{
2022-02-23 21:07:06 +00:00
name: 'nuxtjs',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 21:07:06 +00:00
fancyName: 'NuxtJS',
hoverColor: 'hover:bg-green-700',
2022-08-16 11:58:37 +00:00
color: 'bg-green-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
2022-02-23 23:30:33 +00:00
{
name: 'gatsby',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 23:30:33 +00:00
fancyName: 'Gatsby',
hoverColor: 'hover:bg-blue-700',
2022-08-16 11:58:37 +00:00
color: 'bg-blue-700',
isCoolifyBuildPack: true,
2022-02-23 23:30:33 +00:00
},
2022-02-10 14:47:44 +00:00
{
2022-02-23 21:07:06 +00:00
name: 'astro',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 21:07:06 +00:00
fancyName: 'Astro',
hoverColor: 'hover:bg-pink-700',
2022-08-16 11:58:37 +00:00
color: 'bg-pink-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
{
2022-02-23 23:30:33 +00:00
name: 'eleventy',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 23:30:33 +00:00
fancyName: 'Eleventy',
hoverColor: 'hover:bg-red-700',
2022-08-16 11:58:37 +00:00
color: 'bg-red-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
{
2022-02-23 21:07:06 +00:00
name: 'react',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 21:07:06 +00:00
fancyName: 'React',
hoverColor: 'hover:bg-blue-700',
2022-08-16 11:58:37 +00:00
color: 'bg-blue-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
{
name: 'preact',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-10 14:47:44 +00:00
fancyName: 'Preact',
hoverColor: 'hover:bg-blue-700',
2022-08-16 11:58:37 +00:00
color: 'bg-blue-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
2022-02-23 21:07:06 +00:00
{
name: 'nextjs',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 21:07:06 +00:00
fancyName: 'NextJS',
hoverColor: 'hover:bg-blue-700',
2022-08-16 11:58:37 +00:00
color: 'bg-blue-700',
isCoolifyBuildPack: true,
2022-02-10 14:47:44 +00:00
},
2022-02-23 23:30:33 +00:00
{
name: 'nestjs',
2022-09-23 20:01:30 +00:00
type: 'specific',
base: 'node',
2022-02-23 23:30:33 +00:00
fancyName: 'NestJS',
hoverColor: 'hover:bg-red-700',
2022-08-16 11:58:37 +00:00
color: 'bg-red-700',
isCoolifyBuildPack: true,
2022-02-23 23:30:33 +00:00
},
2022-02-10 14:47:44 +00:00
{
name: 'rust',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-02-10 14:47:44 +00:00
fancyName: 'Rust',
hoverColor: 'hover:bg-pink-700',
2022-08-16 11:58:37 +00:00
color: 'bg-pink-700',
isCoolifyBuildPack: true,
2022-04-02 14:22:51 +00:00
},
{
name: 'python',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-04-02 14:22:51 +00:00
fancyName: 'Python',
hoverColor: 'hover:bg-green-700',
2022-08-16 11:58:37 +00:00
color: 'bg-green-700',
isCoolifyBuildPack: true,
2022-04-19 20:08:42 +00:00
},
{
name: 'deno',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-04-19 20:08:42 +00:00
fancyName: 'Deno',
hoverColor: 'hover:bg-green-700',
2022-08-16 11:58:37 +00:00
color: 'bg-green-700',
isCoolifyBuildPack: true,
2022-08-15 11:23:21 +00:00
},
2022-08-16 11:58:37 +00:00
{
name: 'heroku',
2022-09-23 20:01:30 +00:00
type: 'base',
2022-08-16 11:58:37 +00:00
fancyName: 'Heroku',
hoverColor: 'hover:bg-purple-700',
color: 'bg-purple-700',
isHerokuBuildPack: true,
}
2022-02-10 14:47:44 +00:00
];
export const scanningTemplates = {
2022-04-01 12:41:38 +00:00
'@sveltejs/kit': {
buildPack: 'nodejs'
},
2022-02-23 21:07:06 +00:00
astro: {
buildPack: 'astro'
},
2022-02-23 23:30:33 +00:00
'@11ty/eleventy': {
buildPack: 'eleventy'
},
2022-02-10 14:47:44 +00:00
svelte: {
buildPack: 'svelte'
},
'@nestjs/core': {
buildPack: 'nestjs'
},
next: {
buildPack: 'nextjs'
},
nuxt: {
buildPack: 'nuxtjs'
},
'react-scripts': {
buildPack: 'react'
},
'parcel-bundler': {
buildPack: 'static'
},
'@vue/cli-service': {
buildPack: 'vuejs'
},
vuejs: {
buildPack: 'vuejs'
},
gatsby: {
buildPack: 'gatsby'
},
'preact-cli': {
buildPack: 'react'
}
};