fix(cta): remove tauri dep from vanilla recipe (#1502)

This commit is contained in:
Amr Bashir 2021-04-15 03:05:16 +02:00 committed by GitHub
parent 345f2dbfc5
commit 3998046489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 32 deletions

View File

@ -0,0 +1,5 @@
---
"create-tauri-app": patch
---
Remove `tauri` dependency from vanilla recipe

View File

@ -3,11 +3,9 @@
// SPDX-License-Identifier: MIT
import { Recipe } from "..";
import { TauriBuildConfig } from "../types/config";
import { join } from "path";
//@ts-ignore
import scaffe from "scaffe";
import { shell } from "../shell";
export const vanillajs: Recipe = {
descriptiveName: "Vanilla.js",
@ -24,11 +22,20 @@ export const vanillajs: Recipe = {
extraNpmDevDependencies: [],
extraNpmDependencies: [],
preInit: async ({ cwd, cfg }) => {
const version = await shell("npm", ["view", "tauri", "version"], {
stdio: "pipe",
});
const versionNumber = version.stdout.trim();
await run(cfg, cwd, versionNumber);
const { appName } = cfg;
const templateDir = join(__dirname, "../src/templates/vanilla");
const variables = {
name: appName,
};
try {
await scaffe.generate(templateDir, join(cwd, appName), {
overwrite: true,
variables,
});
} catch (err) {
console.log(err);
}
},
postInit: async ({ cfg, packageManager }) => {
const setApp =
@ -53,25 +60,3 @@ run the app:
`);
},
};
export const run = async (
args: TauriBuildConfig,
cwd: string,
version: string
) => {
const { appName } = args;
const templateDir = join(__dirname, "../src/templates/vanilla");
const variables = {
name: appName,
tauri_version: version,
};
try {
await scaffe.generate(templateDir, join(cwd, appName), {
overwrite: true,
variables,
});
} catch (err) {
console.log(err);
}
};

View File

@ -2,8 +2,5 @@
"name": "<%= name %>",
"scripts": {
"tauri": "tauri"
},
"dependencies": {
"tauri": "<%= tauri_version %>"
}
}