mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
feat(cta): add SolidJS recipe (#2619)
Co-authored-by: Amr Bashir <48618675+amrbashir@users.noreply.github.com>
This commit is contained in:
5
.changes/cta-solid-recipe.md
Normal file
5
.changes/cta-solid-recipe.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'create-tauri-app': patch
|
||||
---
|
||||
|
||||
Add SolidJS recipe using the official template.
|
||||
18
.github/workflows/test-cta.yml
vendored
18
.github/workflows/test-cta.yml
vendored
@@ -5,30 +5,30 @@
|
||||
name: test create-tauri-app
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
TAURI_RECIPE: 'vanillajs,cra,vite,ngcli'
|
||||
TAURI_RECIPE: 'vanillajs,cra,vite,ngcli,solid'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
platform:
|
||||
default: "ubuntu"
|
||||
default: 'ubuntu'
|
||||
pull_request:
|
||||
paths:
|
||||
- "tooling/create-tauri-app/**"
|
||||
- 'tooling/create-tauri-app/**'
|
||||
|
||||
jobs:
|
||||
create-recipe-with-npm:
|
||||
name: "node@${{ matrix.node }} + npm@${{ matrix.manager }}"
|
||||
name: 'node@${{ matrix.node }} + npm@${{ matrix.manager }}'
|
||||
runs-on: ${{ github.event.inputs.platform || 'ubuntu' }}-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: ["14", "16"]
|
||||
manager: ["7"]
|
||||
node: ['14', '16']
|
||||
manager: ['7']
|
||||
exclude:
|
||||
- node: "16"
|
||||
manager: "6"
|
||||
- node: '16'
|
||||
manager: '6'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
- run: yarn test
|
||||
working-directory: tooling/create-tauri-app
|
||||
env:
|
||||
TAURI_RUN_MANAGER: "npm"
|
||||
TAURI_RUN_MANAGER: 'npm'
|
||||
|
||||
# create-recipe-with-yarn:
|
||||
# name: "node@${{ matrix.node }} + yarn@1"
|
||||
|
||||
@@ -14,6 +14,7 @@ import { vite } from './recipes/vite'
|
||||
import { dominator } from './recipes/dominator'
|
||||
import { ngcli } from './recipes/ng-cli'
|
||||
import { svelte } from './recipes/svelte'
|
||||
import { solid } from './recipes/solid'
|
||||
import { install, checkPackageManager } from './dependency-manager'
|
||||
import { shell } from './shell'
|
||||
import { updatePackageJson } from './helpers/update-package-json'
|
||||
@@ -124,6 +125,7 @@ const allRecipes: Recipe[] = [
|
||||
vuecli,
|
||||
ngcli,
|
||||
svelte,
|
||||
solid,
|
||||
dominator
|
||||
]
|
||||
|
||||
|
||||
70
tooling/create-tauri-app/src/recipes/solid.ts
Normal file
70
tooling/create-tauri-app/src/recipes/solid.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { shell } from '../shell'
|
||||
import { Recipe } from '../types/recipe'
|
||||
|
||||
const solid: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'Solid (https://github.com/solidjs/templates)',
|
||||
value: 'solid'
|
||||
},
|
||||
shortName: 'solid',
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
extraQuestions: ({ ci }) => {
|
||||
return [
|
||||
{
|
||||
type: 'list',
|
||||
name: 'template',
|
||||
message: 'Which Solid template would you like to use?',
|
||||
choices: [
|
||||
'js',
|
||||
'ts-bootstrap',
|
||||
'ts-minimal',
|
||||
'ts-router',
|
||||
'ts-windicss',
|
||||
'ts'
|
||||
],
|
||||
default: 'ts',
|
||||
loop: false,
|
||||
when: !ci
|
||||
}
|
||||
]
|
||||
},
|
||||
configUpdate: ({ cfg, packageManager }) => ({
|
||||
...cfg,
|
||||
distDir: `../public`,
|
||||
devPath: 'http://localhost:3000',
|
||||
beforeDevCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} dev`,
|
||||
beforeBuildCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} build`
|
||||
}),
|
||||
preInit: async ({ cwd, cfg, answers }) => {
|
||||
let template = 'js'
|
||||
if (answers) {
|
||||
template = answers.template ? (answers.template as string) : 'js'
|
||||
}
|
||||
await shell(
|
||||
'npx',
|
||||
['degit', `solidjs/templates/${template}`, cfg.appName],
|
||||
{ cwd }
|
||||
)
|
||||
},
|
||||
postInit: async ({ cfg, packageManager }) => {
|
||||
console.log(`
|
||||
Your installation completed.
|
||||
$ cd ${cfg.appName}
|
||||
$ ${packageManager} install
|
||||
$ ${packageManager === 'npm' ? 'npm run' : packageManager} tauri dev
|
||||
`)
|
||||
|
||||
return await Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
export { solid }
|
||||
@@ -24,7 +24,7 @@ const api = path.resolve('../api/')
|
||||
const manager = process.env.TAURI_RUN_MANAGER || 'yarn'
|
||||
const recipes = process.env.TAURI_RECIPE
|
||||
? process.env.TAURI_RECIPE.split(',')
|
||||
: ['vanillajs', 'cra', 'vite', 'ngcli']
|
||||
: ['vanillajs', 'cra', 'vite', 'ngcli', 'solid']
|
||||
const parallelize = process.env.TAURI_RECIPE_PARALLELIZE || false
|
||||
|
||||
main(function* start() {
|
||||
|
||||
Reference in New Issue
Block a user