33// SPDX-License-Identifier: MIT
44
55import { Recipe } from ".." ;
6- import { TauriBuildConfig } from "../types/config" ;
76import { join } from "path" ;
87//@ts -ignore
98import scaffe from "scaffe" ;
10- import { shell } from "../shell" ;
119
1210export const vanillajs : Recipe = {
1311 descriptiveName : "Vanilla.js" ,
@@ -24,11 +22,20 @@ export const vanillajs: Recipe = {
2422 extraNpmDevDependencies : [ ] ,
2523 extraNpmDependencies : [ ] ,
2624 preInit : async ( { cwd, cfg } ) => {
27- const version = await shell ( "npm" , [ "view" , "tauri" , "version" ] , {
28- stdio : "pipe" ,
29- } ) ;
30- const versionNumber = version . stdout . trim ( ) ;
31- await run ( cfg , cwd , versionNumber ) ;
25+ const { appName } = cfg ;
26+ const templateDir = join ( __dirname , "../src/templates/vanilla" ) ;
27+ const variables = {
28+ name : appName ,
29+ } ;
30+
31+ try {
32+ await scaffe . generate ( templateDir , join ( cwd , appName ) , {
33+ overwrite : true ,
34+ variables,
35+ } ) ;
36+ } catch ( err ) {
37+ console . log ( err ) ;
38+ }
3239 } ,
3340 postInit : async ( { cfg, packageManager } ) => {
3441 const setApp =
@@ -53,25 +60,3 @@ run the app:
5360 ` ) ;
5461 } ,
5562} ;
56-
57- export const run = async (
58- args : TauriBuildConfig ,
59- cwd : string ,
60- version : string
61- ) => {
62- const { appName } = args ;
63- const templateDir = join ( __dirname , "../src/templates/vanilla" ) ;
64- const variables = {
65- name : appName ,
66- tauri_version : version ,
67- } ;
68-
69- try {
70- await scaffe . generate ( templateDir , join ( cwd , appName ) , {
71- overwrite : true ,
72- variables,
73- } ) ;
74- } catch ( err ) {
75- console . log ( err ) ;
76- }
77- } ;
0 commit comments