From a40f72aac7764144eab5b74cf3643a5cd22edc0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 13 Sep 2023 18:33:27 +0200 Subject: [PATCH] PoC: All runtimes support --- src/lib/stores/marketplace.ts | 66 +++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 5c95eb771..11bc1256b 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -1,3 +1,28 @@ +const Runtimes = { + NODE: { name: 'node', versions: ['20.0', '19.0', '18.0', '16.0', '14.5'] }, + PHP: { name: 'php', versions: ['8.2', '8.1', '8.0'] }, + RUBY: { name: 'ruby', versions: ['3.2', '3.1', '3.0'] }, + PYTHON: { name: 'python', versions: ['3.11', '3.10', '3.9', '3.8'] }, + DART: { name: 'dart', versions: ['3.0', '2.19', '2.18', '2.17', '2.16', '2.16'] }, + BUN: { name: 'bun', versions: ['1.0'] } +}; + +const getRuntimes = ( + runtime: any, + commands: string, + entrypoint: string, + providerRootDirectory: string +) => { + return runtime.versions.map((version) => { + return { + name: `${runtime.name}-${version}`, + commands, + entrypoint, + providerRootDirectory + }; + }); +}; + export const marketplace: MarketplaceTemplate[] = [ { icon: 'icon-lightning-bolt', @@ -11,36 +36,17 @@ export const marketplace: MarketplaceTemplate[] = [ timeout: 15, usecases: ['Starter'], runtimes: [ - { - name: 'node-18.0', - commands: 'npm install', - entrypoint: 'src/main.js', - providerRootDirectory: 'node/starter' - }, - { - name: 'php-8.0', - commands: 'composer install', - entrypoint: 'src/index.php', - providerRootDirectory: 'php/starter' - }, - { - name: 'ruby-3.0', - commands: 'bundle install', - entrypoint: 'lib/main.rb', - providerRootDirectory: 'ruby/starter' - }, - { - name: 'python-3.9', - commands: 'pip install -r requirements.txt', - entrypoint: 'src/main.py', - providerRootDirectory: 'python/starter' - }, - { - name: 'dart-2.17', - commands: 'dart pub get', - entrypoint: 'lib/main.dart', - providerRootDirectory: 'dart/starter' - } + ...getRuntimes(Runtimes.NODE, 'npm install', 'src/main.js', 'node/starter'), + ...getRuntimes(Runtimes.PHP, 'composer install', 'src/index.php', 'php/starter'), + ...getRuntimes(Runtimes.RUBY, 'bundle install', 'lib/main.rb', 'ruby/starter'), + ...getRuntimes( + Runtimes.PYTHON, + 'pip install -r requirements.txt', + 'src/main.py', + 'python/starter' + ), + ...getRuntimes(Runtimes.DART, 'dart pub get', 'lib/main.dart', 'dart/starter'), + ...getRuntimes(Runtimes.BUN, 'bun install', 'src/main.ts', 'bun/starter') ], instructions: `For documentation and instructions check out file.`, vcsProvider: 'github',