mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-22 05:39:53 +03:00
Merge pull request #1331 from tauri-apps/feature/create-tauri-app
feat: create-tauri-app
This commit is contained in:
commit
8978c0bbfe
@ -169,6 +169,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"create-tauri-app": {
|
||||
"path": "./cli/create-tauri-app",
|
||||
"manager": "javascript",
|
||||
"dependencies": ["tauri.js"]
|
||||
},
|
||||
"tauri-utils": {
|
||||
"path": "./core/tauri-utils",
|
||||
"manager": "rust"
|
||||
|
5
.changes/create-vanilla-js-templated.md
Normal file
5
.changes/create-vanilla-js-templated.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"create-tauri-app": minor
|
||||
---
|
||||
|
||||
Add vanilla javascript option to `create-tauri-app` through templating.
|
6
.changes/revert-and-shift-tauri-create.md
Normal file
6
.changes/revert-and-shift-tauri-create.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"create-tauri-app": minor
|
||||
"tauri.js": patch
|
||||
---
|
||||
|
||||
Revert `tauri create` deletion and shift remaining pieces that weren't deleted to `create-tauri-app`.
|
0
cli/core/templates/src-tauri/src/main.rs
Executable file → Normal file
0
cli/core/templates/src-tauri/src/main.rs
Executable file → Normal file
69
cli/create-tauri-app/.gitignore
vendored
Normal file
69
cli/create-tauri-app/.gitignore
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
# Build output
|
||||
/dist
|
||||
/api
|
||||
|
||||
# lock for libs
|
||||
/Cargo.lock
|
||||
/yarn.lock
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Typescript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
/.vs
|
||||
.DS_Store
|
||||
.Thumbs.db
|
||||
*.sublime*
|
||||
.idea/
|
||||
debug.log
|
||||
package-lock.json
|
||||
.vscode/settings.json
|
218
cli/create-tauri-app/bin/create-tauri-app.js
Normal file
218
cli/create-tauri-app/bin/create-tauri-app.js
Normal file
@ -0,0 +1,218 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const parseArgs = require("minimist");
|
||||
const inquirer = require("inquirer");
|
||||
const { resolve, join } = require("path");
|
||||
const {
|
||||
recipeShortNames,
|
||||
recipeDescriptiveNames,
|
||||
recipeByDescriptiveName,
|
||||
recipeByShortName,
|
||||
install,
|
||||
shell,
|
||||
} = require("../dist/");
|
||||
const { dir } = require("console");
|
||||
|
||||
/**
|
||||
* @type {object}
|
||||
* @property {boolean} h
|
||||
* @property {boolean} help
|
||||
* @property {boolean} v
|
||||
* @property {boolean} version
|
||||
* @property {string|boolean} f
|
||||
* @property {string|boolean} force
|
||||
* @property {boolean} l
|
||||
* @property {boolean} log
|
||||
* @property {boolean} d
|
||||
* @property {boolean} directory
|
||||
* @property {string} r
|
||||
* @property {string} recipe
|
||||
*/
|
||||
const createTauriApp = async (cliArgs) => {
|
||||
const argv = parseArgs(cliArgs, {
|
||||
alias: {
|
||||
h: "help",
|
||||
v: "version",
|
||||
f: "force",
|
||||
l: "log",
|
||||
d: "directory",
|
||||
b: "binary",
|
||||
t: "tauri-path",
|
||||
A: "app-name",
|
||||
W: "window-title",
|
||||
D: "dist-dir",
|
||||
P: "dev-path",
|
||||
r: "recipe",
|
||||
},
|
||||
boolean: ["h", "l", "ci"],
|
||||
});
|
||||
|
||||
if (argv.help) {
|
||||
printUsage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argv.v) {
|
||||
console.log(require("../package.json").version);
|
||||
return false; // do this for node consumers and tests
|
||||
}
|
||||
|
||||
if (argv.ci) {
|
||||
return runInit(argv);
|
||||
} else {
|
||||
return getOptionsInteractive(argv).then((responses) =>
|
||||
runInit(argv, responses)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function printUsage() {
|
||||
console.log(`
|
||||
Description
|
||||
Starts a new tauri app from a "recipe" or pre-built template.
|
||||
Usage
|
||||
$ yarn create tauri-app <app-name> # npm create-tauri-app <app-name>
|
||||
Options
|
||||
--help, -h Displays this message
|
||||
-v, --version Displays the Tauri CLI version
|
||||
--ci Skip prompts
|
||||
--force, -f Force init to overwrite [conf|template|all]
|
||||
--log, -l Logging [boolean]
|
||||
--directory, -d Set target directory for init
|
||||
--binary, -b Optional path to a tauri binary from which to run init
|
||||
--app-name, -A Name of your Tauri application
|
||||
--window-title, -W Window title of your Tauri application
|
||||
--dist-dir, -D Web assets location, relative to <project-dir>/src-tauri
|
||||
--dev-path, -P Url of your dev server
|
||||
--recipe, -r Add UI framework recipe. None by default.
|
||||
Supported recipes: [${recipeShortNames.join("|")}]
|
||||
`);
|
||||
}
|
||||
|
||||
const getOptionsInteractive = (argv) => {
|
||||
let defaultAppName = argv.A || "tauri-app";
|
||||
|
||||
return inquirer
|
||||
.prompt([
|
||||
{
|
||||
type: "input",
|
||||
name: "appName",
|
||||
message: "What is your app name?",
|
||||
default: defaultAppName,
|
||||
when: !argv.A,
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "tauri.window.title",
|
||||
message: "What should the window title be?",
|
||||
default: "Tauri App",
|
||||
when: () => !argv.W,
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
name: "recipeName",
|
||||
message: "Would you like to add a UI recipe?",
|
||||
choices: recipeDescriptiveNames,
|
||||
default: "No recipe",
|
||||
when: () => !argv.r,
|
||||
},
|
||||
])
|
||||
.catch((error) => {
|
||||
if (error.isTtyError) {
|
||||
// Prompt couldn't be rendered in the current environment
|
||||
console.log(
|
||||
"It appears your terminal does not support interactive prompts. Using default values."
|
||||
);
|
||||
runInit();
|
||||
} else {
|
||||
// Something else when wrong
|
||||
console.error("An unknown error occurred:", error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async function runInit(argv, config = {}) {
|
||||
const {
|
||||
appName,
|
||||
recipeName,
|
||||
tauri: {
|
||||
window: { title },
|
||||
},
|
||||
} = config;
|
||||
|
||||
let recipe;
|
||||
|
||||
if (recipeName !== undefined) {
|
||||
recipe = recipeByDescriptiveName(recipeName);
|
||||
} else if (argv.r) {
|
||||
recipe = recipeByShortName(argv.r);
|
||||
}
|
||||
|
||||
let buildConfig = {
|
||||
distDir: argv.D,
|
||||
devPath: argv.P,
|
||||
};
|
||||
|
||||
if (recipe !== undefined) {
|
||||
buildConfig = recipe.configUpdate(buildConfig);
|
||||
}
|
||||
|
||||
const directory = argv.d || process.cwd();
|
||||
const cfg = {
|
||||
...buildConfig,
|
||||
appName: appName || argv.A,
|
||||
windowTitle: title || argv.w,
|
||||
};
|
||||
// note that our app directory is reliant on the appName and
|
||||
// generally there are issues if the path has spaces (see Windows)
|
||||
// future TODO prevent app names with spaces or escape here?
|
||||
const appDirectory = join(directory, cfg.appName);
|
||||
|
||||
if (recipe.preInit) {
|
||||
console.log("===== running initial command(s) =====");
|
||||
await recipe.preInit({ cwd: directory, cfg });
|
||||
}
|
||||
|
||||
const initArgs = [
|
||||
["--app-name", cfg.appName],
|
||||
["--window-title", cfg.windowTitle],
|
||||
["--dist-dir", cfg.distDir],
|
||||
["--dev-path", cfg.devPath],
|
||||
].reduce((final, argSet) => {
|
||||
if (argSet[1]) {
|
||||
return final.concat([argSet[0], `\"${argSet[1]}\"`]);
|
||||
} else {
|
||||
return final;
|
||||
}
|
||||
}, []);
|
||||
|
||||
const installed = await install({
|
||||
appDir: appDirectory,
|
||||
dependencies: recipe.extraNpmDependencies,
|
||||
devDependencies: ["tauri", ...recipe.extraNpmDevDependencies],
|
||||
});
|
||||
|
||||
console.log("===== running tauri init =====");
|
||||
const binary = !argv.b
|
||||
? installed.packageManager
|
||||
: resolve(appDirectory, argv.b);
|
||||
const runTauriArgs =
|
||||
installed.packageManager === "npm" && !argv.b
|
||||
? ["run", "tauri", "--", "init"]
|
||||
: ["tauri", "init"];
|
||||
await shell(binary, [...runTauriArgs, ...initArgs], {
|
||||
cwd: appDirectory,
|
||||
});
|
||||
|
||||
if (recipe.postInit) {
|
||||
console.log("===== running final command(s) =====");
|
||||
await recipe.postInit({
|
||||
cwd: appDirectory,
|
||||
cfg,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createTauriApp(process.argv.slice(2)).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
43
cli/create-tauri-app/package.json
Normal file
43
cli/create-tauri-app/package.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "create-tauri-app",
|
||||
"version": "0.0.0",
|
||||
"description": "Jump right into a Tauri App!",
|
||||
"bin": {
|
||||
"create-tauri-app": "./bin/create-tauri-app.js"
|
||||
},
|
||||
"repository": "git+https://github.com/tauri-apps/tauri.git",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Team <team@tauri-apps.org> (https://tauri.studio)",
|
||||
"Jacob Bolda <me@jacobbolda.com> (https://www.jacobbolda.com)"
|
||||
],
|
||||
"scripts": {
|
||||
"create-tauri-app": "create-tauri-app",
|
||||
"build": "rollup --config",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"dependencies": {
|
||||
"execa": "^5.0.0",
|
||||
"inquirer": "^8.0.0",
|
||||
"lodash": "4.17.21",
|
||||
"minimist": "^1.2.5",
|
||||
"scaffe": "1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-typescript": "^8.2.1",
|
||||
"@types/cross-spawn": "6.0.2",
|
||||
"@types/inquirer": "7.3.1",
|
||||
"@types/lodash": "4.14.168",
|
||||
"@types/semver": "7.3.4",
|
||||
"prettier": "^2.2.1",
|
||||
"rollup": "^2.45.1",
|
||||
"tslib": "^2.2.0",
|
||||
"typescript": "4.2.4"
|
||||
}
|
||||
}
|
25
cli/create-tauri-app/readme.md
Normal file
25
cli/create-tauri-app/readme.md
Normal file
@ -0,0 +1,25 @@
|
||||
# create-tauri-app
|
||||
|
||||
Run and answer the prompts to get started with your first Tauri app!
|
||||
|
||||
With npx:
|
||||
|
||||
```shell
|
||||
npx create-tauri-app
|
||||
```
|
||||
|
||||
With npm:
|
||||
|
||||
```shell
|
||||
npm x create-tauri-app
|
||||
```
|
||||
|
||||
With yarn:
|
||||
|
||||
```shell
|
||||
yarn create tauri-app
|
||||
```
|
||||
|
||||
# Additional Args
|
||||
|
||||
TODO
|
25
cli/create-tauri-app/rollup.config.js
Normal file
25
cli/create-tauri-app/rollup.config.js
Normal file
@ -0,0 +1,25 @@
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import pkg from "./package.json";
|
||||
|
||||
export default {
|
||||
treeshake: true,
|
||||
perf: true,
|
||||
input: "src/index.ts",
|
||||
output: {
|
||||
dir: "dist",
|
||||
format: "cjs",
|
||||
entryFileNames: "[name].js",
|
||||
exports: "named",
|
||||
},
|
||||
plugins: [typescript(), commonjs({ extensions: [".js"] })],
|
||||
external: [
|
||||
...Object.keys(pkg.dependencies || {}),
|
||||
...Object.keys(pkg.peerDependencies || {}),
|
||||
],
|
||||
watch: {
|
||||
chokidar: true,
|
||||
include: "src/**",
|
||||
exclude: "node_modules/**",
|
||||
},
|
||||
};
|
99
cli/create-tauri-app/src/dependency-manager.ts
Normal file
99
cli/create-tauri-app/src/dependency-manager.ts
Normal file
@ -0,0 +1,99 @@
|
||||
import { ManagementType, Result } from "./types/deps";
|
||||
import { shell } from "./shell";
|
||||
import { existsSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
export async function install({
|
||||
appDir,
|
||||
dependencies,
|
||||
devDependencies,
|
||||
}: {
|
||||
appDir: string;
|
||||
dependencies: string[];
|
||||
devDependencies?: string[];
|
||||
}) {
|
||||
return await manageDependencies(appDir, dependencies, devDependencies);
|
||||
}
|
||||
|
||||
async function manageDependencies(
|
||||
appDir: string,
|
||||
dependencies: string[] = [],
|
||||
devDependencies: string[] = []
|
||||
): Promise<{ result: Result; packageManager: string }> {
|
||||
const installedDeps = [...dependencies, ...devDependencies];
|
||||
console.log(`Installing ${installedDeps.join(", ")}...`);
|
||||
|
||||
const packageManager = await usePackageManager(appDir);
|
||||
|
||||
await installNpmDevPackage(devDependencies, packageManager, appDir);
|
||||
await installNpmPackage(dependencies, packageManager, appDir);
|
||||
|
||||
const result: Result = new Map<ManagementType, string[]>();
|
||||
result.set(ManagementType.Install, installedDeps);
|
||||
|
||||
return { result, packageManager };
|
||||
}
|
||||
|
||||
async function usePackageManager(appDir: string): Promise<"yarn" | "npm"> {
|
||||
const hasYarnLockfile = existsSync(join(appDir, "yarn.lock"));
|
||||
let yarnChild;
|
||||
// try yarn first if there is a lockfile
|
||||
if (hasYarnLockfile) {
|
||||
yarnChild = await shell("yarn", ["--version"], { stdio: "pipe" });
|
||||
if (!yarnChild.failed) return "yarn";
|
||||
}
|
||||
|
||||
// try npm then as the "default"
|
||||
const npmChild = await shell("npm", ["--version"], { stdio: "pipe" });
|
||||
if (!npmChild.failed) return "npm";
|
||||
|
||||
// try yarn as maybe only yarn is installed
|
||||
if (yarnChild && !yarnChild.failed) return "yarn";
|
||||
|
||||
// if we have reached here, we can't seem to run anything
|
||||
throw new Error(
|
||||
`Must have npm or yarn installed to manage dependencies. Is either in your PATH? We tried running in ${appDir}`
|
||||
);
|
||||
}
|
||||
|
||||
async function installNpmPackage(
|
||||
packageNames: string[],
|
||||
packageManager: string,
|
||||
appDir: string
|
||||
): Promise<void> {
|
||||
if (packageNames.length === 0) return;
|
||||
if (packageManager === "yarn") {
|
||||
await shell("yarn", ["add", packageNames.join(" ")], {
|
||||
cwd: appDir,
|
||||
});
|
||||
} else {
|
||||
await shell("npm", ["install", packageNames.join(" ")], {
|
||||
cwd: appDir,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function installNpmDevPackage(
|
||||
packageNames: string[],
|
||||
packageManager: string,
|
||||
appDir: string
|
||||
): Promise<void> {
|
||||
if (packageNames.length === 0) return;
|
||||
if (packageManager === "yarn") {
|
||||
await shell(
|
||||
"yarn",
|
||||
["add", "--dev", "--ignore-scripts", packageNames.join(" ")],
|
||||
{
|
||||
cwd: appDir,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
await shell(
|
||||
"npm",
|
||||
["install", "--save-dev", "--ignore-scripts", packageNames.join(" ")],
|
||||
{
|
||||
cwd: appDir,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
52
cli/create-tauri-app/src/index.ts
Normal file
52
cli/create-tauri-app/src/index.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { map, find } from "lodash";
|
||||
import { TauriBuildConfig } from "./types/config";
|
||||
import { reactjs, reactts } from "./recipes/react";
|
||||
import { vanillajs } from "./recipes/vanilla";
|
||||
|
||||
export { shell } from "./shell";
|
||||
export { install } from "./dependency-manager";
|
||||
|
||||
export interface Recipe {
|
||||
descriptiveName: string;
|
||||
shortName: string;
|
||||
configUpdate?: (cfg: TauriBuildConfig) => TauriBuildConfig;
|
||||
extraNpmDependencies: string[];
|
||||
extraNpmDevDependencies: string[];
|
||||
preInit?: ({
|
||||
cwd,
|
||||
cfg,
|
||||
}: {
|
||||
cwd: string;
|
||||
cfg: TauriBuildConfig;
|
||||
}) => Promise<void>;
|
||||
postInit?: ({
|
||||
cwd,
|
||||
cfg,
|
||||
}: {
|
||||
cwd: string;
|
||||
cfg: TauriBuildConfig;
|
||||
}) => Promise<void>;
|
||||
}
|
||||
|
||||
export const allRecipes: Recipe[] = [vanillajs, reactjs, reactts];
|
||||
|
||||
export const recipeNames: Array<[string, string]> = map(
|
||||
allRecipes,
|
||||
(r: Recipe) => [r.shortName, r.descriptiveName]
|
||||
);
|
||||
|
||||
export const recipeByShortName = (name: string): Recipe | undefined =>
|
||||
find(allRecipes, (r: Recipe) => r.shortName === name);
|
||||
|
||||
export const recipeByDescriptiveName = (name: string): Recipe | undefined =>
|
||||
find(allRecipes, (r: Recipe) => r.descriptiveName === name);
|
||||
|
||||
export const recipeShortNames: string[] = map(
|
||||
allRecipes,
|
||||
(r: Recipe) => r.shortName
|
||||
);
|
||||
|
||||
export const recipeDescriptiveNames: string[] = map(
|
||||
allRecipes,
|
||||
(r: Recipe) => r.descriptiveName
|
||||
);
|
73
cli/create-tauri-app/src/recipes/react.ts
Normal file
73
cli/create-tauri-app/src/recipes/react.ts
Normal file
@ -0,0 +1,73 @@
|
||||
import { Recipe } from "..";
|
||||
import { join } from "path";
|
||||
//@ts-ignore
|
||||
import scaffe from "scaffe";
|
||||
import { shell } from "../shell";
|
||||
|
||||
const completeLogMsg = `
|
||||
Your installation completed.
|
||||
To start, run yarn tauri dev
|
||||
`;
|
||||
|
||||
const afterCra = async (cwd: string, appName: string, version: string) => {
|
||||
const templateDir = join(__dirname, "../src/templates/react");
|
||||
const variables = {
|
||||
name: appName,
|
||||
tauri_version: version,
|
||||
};
|
||||
|
||||
try {
|
||||
await scaffe.generate(templateDir, join(cwd, appName), {
|
||||
overwrite: true,
|
||||
variables,
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
};
|
||||
|
||||
const reactjs: Recipe = {
|
||||
descriptiveName: "React.js",
|
||||
shortName: "reactjs",
|
||||
configUpdate: (cfg) => ({
|
||||
...cfg,
|
||||
distDir: `../build`,
|
||||
devPath: "http://localhost:3000",
|
||||
beforeDevCommand: `npm start`,
|
||||
beforeBuildCommand: `npm build`,
|
||||
}),
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
preInit: async ({ cwd, cfg }) => {
|
||||
// CRA creates the folder for you
|
||||
await shell("npx", ["create-react-app", `${cfg.appName}`], { cwd });
|
||||
const version = await shell("npm", ["view", "tauri", "version"], {
|
||||
stdio: "pipe",
|
||||
});
|
||||
const versionNumber = version.stdout.trim();
|
||||
await afterCra(cwd, cfg.appName, versionNumber);
|
||||
},
|
||||
postInit: async ({ cfg }) => {
|
||||
console.log(completeLogMsg);
|
||||
},
|
||||
};
|
||||
|
||||
const reactts: Recipe = {
|
||||
...reactjs,
|
||||
descriptiveName: "React with Typescript",
|
||||
shortName: "reactts",
|
||||
extraNpmDependencies: [],
|
||||
preInit: async ({ cwd, cfg }) => {
|
||||
// CRA creates the folder for you
|
||||
await shell(
|
||||
"npx",
|
||||
["create-react-app", "--template", "typescript", `${cfg.appName}`],
|
||||
{ cwd }
|
||||
);
|
||||
},
|
||||
postInit: async ({ cfg }) => {
|
||||
console.log(completeLogMsg);
|
||||
},
|
||||
};
|
||||
|
||||
export { reactjs, reactts };
|
61
cli/create-tauri-app/src/recipes/vanilla.ts
Normal file
61
cli/create-tauri-app/src/recipes/vanilla.ts
Normal file
@ -0,0 +1,61 @@
|
||||
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",
|
||||
shortName: "vanillajs",
|
||||
configUpdate: (cfg) => ({
|
||||
...cfg,
|
||||
distDir: `../dist`,
|
||||
devPath: `../dist`,
|
||||
beforeDevCommand: `yarn start`,
|
||||
beforeBuildCommand: `yarn build`,
|
||||
}),
|
||||
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);
|
||||
},
|
||||
postInit: async ({ cfg }) => {
|
||||
console.log(`
|
||||
change directory:
|
||||
$ cd ${cfg.appName}
|
||||
|
||||
install dependencies:
|
||||
$ yarn # npm install
|
||||
|
||||
run the app:
|
||||
$ yarn tauri dev # npm run tauri dev
|
||||
`);
|
||||
},
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
32
cli/create-tauri-app/src/shell.ts
Normal file
32
cli/create-tauri-app/src/shell.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import execa from "execa";
|
||||
|
||||
export const shell = async (
|
||||
command: string,
|
||||
args?: string[],
|
||||
options?: execa.Options,
|
||||
log: boolean = false
|
||||
) => {
|
||||
try {
|
||||
if (options && options.shell === true) {
|
||||
const stringCommand = [command, ...(!args ? [] : args)].join(" ");
|
||||
if (log) console.log(`[running]: ${stringCommand}`);
|
||||
return await execa(stringCommand, {
|
||||
stdio: "inherit",
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
...options,
|
||||
});
|
||||
} else {
|
||||
if (log) console.log(`[running]: ${command}`);
|
||||
return await execa(command, args, {
|
||||
stdio: "inherit",
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error with command: %s", command);
|
||||
throw new Error(error);
|
||||
}
|
||||
};
|
54
cli/create-tauri-app/src/templates/react/src/App.css
Normal file
54
cli/create-tauri-app/src/templates/react/src/App.css
Normal file
@ -0,0 +1,54 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 20vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo.rotate {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
div.inline-logo {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
div.inline-logo > img {
|
||||
margin-right: 3vw;
|
||||
}
|
||||
|
||||
div.inline-logo .smaller {
|
||||
height: 10vh;
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
margin-bottom: 5vh;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
40
cli/create-tauri-app/src/templates/react/src/App.js
Normal file
40
cli/create-tauri-app/src/templates/react/src/App.js
Normal file
@ -0,0 +1,40 @@
|
||||
import React from "react";
|
||||
import logo from "./logo.svg";
|
||||
import tauriCircles from "./tauri.svg";
|
||||
import tauriWord from "./wordmark.svg";
|
||||
import "./App.css";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<div className="inline-logo">
|
||||
<img src={tauriCircles} className="App-logo rotate" alt="logo" />
|
||||
<img src={tauriWord} className="App-logo smaller" alt="logo" />
|
||||
</div>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://tauri.studio"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn Tauri
|
||||
</a>
|
||||
<img src={logo} className="App-logo rotate" alt="logo" />
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
21
cli/create-tauri-app/src/templates/react/src/tauri.svg
Normal file
21
cli/create-tauri-app/src/templates/react/src/tauri.svg
Normal file
@ -0,0 +1,21 @@
|
||||
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 383.44479 435.98273" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(-703.62301,-1339.6611)">
|
||||
<g transform="rotate(-19.354322)">
|
||||
<circle cx="274.08301" cy="1813.09" r="32" fill="url(#d)"/>
|
||||
</g>
|
||||
<g transform="rotate(-19.354322)">
|
||||
<circle cx="382.97299" cy="1719.61" r="32" fill="url(#c)"/>
|
||||
</g>
|
||||
<path d="m796.022 1418.15c-21.659 37.92-27.401 84.66-11.828 129 4.38 12.47 10.212 24.01 17.214 34.55 1.051 1.88 2.59 3.45 4.455 4.53 5.701 3.29 13.101 1.31 16.392-4.39 2.286-3.97 2.104-8.92-0.468-12.72l0.027-0.02c-6.097-9.09-11.178-19.08-14.98-29.9-24.177-68.83 11.861-143.9 80.692-168.08s143.904 11.86 168.084 80.69-11.87 143.91-80.699 168.09c-17.276 6.06-34.942 8.32-52.099 7.23h-0.052c-4.759-0.57-9.423 1.76-11.82 5.91-3.291 5.71-1.309 13.1 4.392 16.4 1.905 1.09 4.073 1.64 6.268 1.59 20.21 1.28 40.988-1.37 61.264-8.49 81.066-28.48 123.866-117.61 95.386-198.68s-117.609-123.86-198.678-95.38c-36.734 12.9-65.607 38.26-83.553 69.67z" fill="url(#b)" fill-rule="nonzero"/>
|
||||
<path d="m724.265 1542.44c-21.659 37.92-27.397 84.66-11.824 129 28.476 81.07 117.602 123.86 198.67 95.39 81.069-28.48 123.859-117.61 95.389-198.68-4.33-12.34-10.09-23.77-16.991-34.21-1.05-2.05-2.668-3.75-4.659-4.91-5.701-3.29-13.101-1.31-16.392 4.39-2.287 3.98-2.105 8.93 0.467 12.72l-0.058 0.04c6.101 9.1 11.186 19.09 14.989 29.92 24.174 68.83-11.866 143.91-80.697 168.08-68.831 24.18-143.899-11.86-168.076-80.7-24.178-68.83 11.859-143.9 80.69-168.08 17.493-6.14 35.388-8.39 52.75-7.2l1e-3 -0.03c4.572 0.33 8.949-1.99 11.246-5.95 3.291-5.7 1.309-13.1-4.392-16.39-2.026-1.17-4.349-1.72-6.682-1.58-20.088-1.23-40.73 1.43-60.877 8.51-36.734 12.9-65.609 38.26-83.554 69.67z" fill="url(#a)" fill-rule="nonzero"/>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient id="d" x2="1" gradientTransform="matrix(48.6643,-41.7777,41.7777,48.6643,249.699,1834.02)" gradientUnits="userSpaceOnUse"><stop stop-color="#0096f2" offset="0"/><stop stop-color="#4cffc4" offset="1"/></linearGradient>
|
||||
<linearGradient id="c" x2="1" gradientTransform="matrix(-48.5635,41.6911,-41.6911,-48.5635,407.745,1699.34)" gradientUnits="userSpaceOnUse"><stop stop-color="#ff8a11" offset="0"/><stop stop-color="#fff550" offset="1"/></linearGradient>
|
||||
<linearGradient id="b" x2="1" gradientTransform="matrix(-150.612,260.867,-260.867,-150.612,960.685,1332.65)" gradientUnits="userSpaceOnUse"><stop stop-color="#ff8a11" offset="0"/><stop stop-color="#fff550" offset="1"/></linearGradient>
|
||||
<linearGradient id="a" x2="1" gradientTransform="matrix(150.613,-260.87,260.87,150.613,781.584,1754.69)" gradientUnits="userSpaceOnUse"><stop stop-color="#0096f2" offset="0"/><stop stop-color="#4cffc4" offset="1"/></linearGradient>
|
||||
|
||||
|
||||
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
16
cli/create-tauri-app/src/templates/react/src/wordmark.svg
Normal file
16
cli/create-tauri-app/src/templates/react/src/wordmark.svg
Normal file
@ -0,0 +1,16 @@
|
||||
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 496.52802 146.992" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(-558.0635,-156.504)"><g transform="translate(-92.0085,72.055)">
|
||||
<path d="m710.873 220.019c0 5.604-3.502 8.405-10.506 8.405-6.887 0-10.331-2.801-10.331-8.405v-114.342h-30.643c-4.203 0-6.421-2.977-6.654-8.93 0-5.837 2.218-8.756 6.654-8.756h82.123c4.436 0 6.538 2.919 6.304 8.756 0 5.953-2.101 8.93-6.304 8.93h-30.643z" fill="#fff" fill-rule="nonzero"/>
|
||||
<path d="m741.516 85.325c2.544 0 4.524 0.755 5.997 2.094 1.984 1.804 3.143 4.881 2.973 9.379l-3e-3 0.369c-0.093 3.733-0.99 7.993-4.455 10.042-0.556 0.328-1.153 0.583-1.772 0.765-0.892 0.261-30.2662 0.1428-31.1932 0.1528l0.4772 111.8922c-0.011 1.274-0.149 2.543-0.523 3.765-0.243 0.792-0.579 1.556-1.014 2.261-2.686 4.362-8.323 5.274-13.043 5.007-3.331-0.188-6.858-1.137-9.136-3.731-1.777-2.022-2.432-4.661-2.455-7.302v-111.675h-27.976c-2.428 0-4.375-0.749-5.886-2.124-1.975-1.799-3.256-4.873-3.433-9.369l-2e-3 -0.104c0-4.494 1.255-7.562 3.304-9.359 1.51-1.326 3.499-2.063 6.017-2.063zm0 20.352c4.203 0 6.304-2.977 6.304-8.93 0.234-5.837-1.868-8.756-6.304-8.756h-82.123c-4.436 0-6.654 2.919-6.654 8.756 0.233 5.953 2.451 8.93 6.654 8.93h30.643v114.342c0 5.604 3.444 8.405 10.331 8.405 7.004 0 10.506-2.801 10.506-8.405v-114.342z"/>
|
||||
</g><path d="m717.3435 177.207-38.347 117.669v-0.175c-0.701 1.751-1.693 3.21-2.977 4.377-1.167 1.051-2.626 1.576-4.378 1.576-0.933 0-1.867-0.116-2.801-0.35-0.817-0.117-1.693-0.292-2.627-0.525h0.175c-6.654-2.101-9.105-5.837-7.354-11.207l39.923-121.346c0.584-1.868 1.576-3.444 2.977-4.728 1.518-1.284 3.269-2.043 5.253-2.276 1.985-0.351 3.911-0.584 5.779-0.701 1.868-0.233 3.327-0.35 4.377-0.35 1.051 0 2.51 0.117 4.378 0.35 1.868 0.117 3.794 0.292 5.778 0.525 1.635 0.234 3.211 1.109 4.728 2.627 1.634 1.518 2.86 3.035 3.677 4.553 6.537 20.078 13.133 40.332 19.787 60.76 6.771 20.312 13.425 40.508 19.962 60.586 1.634 5.37-0.817 9.106-7.355 11.207-0.933 0.233-1.809 0.408-2.626 0.525-0.701 0.234-1.518 0.35-2.452 0.35-1.634 0-3.151-0.525-4.552-1.576-1.284-1.167-2.218-2.626-2.802-4.377v0.175z" fill="#fff" fill-rule="nonzero"/><path d="m712.7135 156.866c1.971-0.245 3.515-0.362 4.63-0.362s2.656 0.117 4.625 0.361c1.889 0.119 3.837 0.297 5.843 0.533 0.022 3e-3 0.044 5e-3 0.065 9e-3 2.132 0.304 4.222 1.377 6.202 3.346 1.86 1.732 3.241 3.476 4.174 5.208l0.188 0.439c6.537 20.078 13.133 40.332 19.781 60.743 6.772 20.318 13.428 40.519 19.983 60.653 0.858 2.82 0.781 5.297-0.077 7.431-1.221 3.034-4.13 5.521-9.013 7.091-0.055 0.018-0.112 0.034-0.169 0.048-0.946 0.236-1.837 0.418-2.674 0.545-0.886 0.265-1.902 0.41-3.051 0.41-2.206 0-4.261-0.691-6.152-2.109-0.067-0.051-0.132-0.104-0.194-0.16-15.82378-33.51193-39.49183-114.69811-39.49183-114.69811s-27.39519 86.12777-35.85117 109.34811c-0.094 0.268-0.217 0.511-0.379 0.744l-0.011 0.014c-0.832 1.807-1.947 3.336-3.338 4.601-1.647 1.482-3.692 2.26-6.162 2.26-1.1 0-2.201-0.131-3.302-0.396-0.865-0.127-1.79-0.313-2.772-0.559-0.249-0.062-0.482-0.158-0.694-0.281-4.542-1.578-7.257-3.982-8.402-6.87-0.85-2.145-0.897-4.635 0.028-7.469 0-3e-3 1e-3 -5e-3 2e-3 -7e-3 0 0 39.923-121.347 39.911-121.309 0.729-2.331 1.972-4.295 3.72-5.898 0.026-0.024 0.053-0.047 0.08-0.07 1.905-1.612 4.099-2.572 6.584-2.879 2.03-0.356 4.003-0.595 5.917-0.717zm4.63 20.341-38.347 117.669v-0.175c-0.701 1.751-1.693 3.21-2.977 4.377-1.167 1.051-2.626 1.576-4.378 1.576-0.933 0-1.867-0.116-2.801-0.35-0.817-0.117-1.693-0.292-2.627-0.525h0.175c-6.654-2.101-9.105-5.837-7.354-11.207l39.923-121.346c0.584-1.868 1.576-3.444 2.977-4.728 1.518-1.284 3.269-2.043 5.253-2.276 1.985-0.351 3.911-0.584 5.779-0.701 1.868-0.233 3.327-0.35 4.377-0.35 1.051 0 2.51 0.117 4.378 0.35 1.868 0.117 3.794 0.292 5.778 0.525 1.635 0.234 3.211 1.109 4.728 2.627 1.634 1.518 2.86 3.035 3.677 4.553 6.537 20.078 13.133 40.332 19.787 60.76 6.771 20.312 13.425 40.508 19.962 60.586 1.634 5.37-0.817 9.106-7.355 11.207-0.933 0.233-1.809 0.408-2.626 0.525-0.701 0.234-1.518 0.35-2.452 0.35-1.634 0-3.151-0.525-4.552-1.576-1.284-1.167-2.218-2.626-2.802-4.377v0.175z"/><g transform="translate(-92.0085,72.055)">
|
||||
<path d="m977.722 199.007c0 9.455-3.151 16.518-9.455 21.187-3.035 2.218-6.187 3.969-9.456 5.254-3.152 1.167-6.245 1.751-9.28 1.751h-38.173c-3.035 0-6.187-0.584-9.455-1.751-3.152-1.285-6.246-3.036-9.281-5.254-3.035-2.334-5.37-5.194-7.004-8.58-1.634-3.502-2.451-7.704-2.451-12.607v-103.486c0-5.603 3.443-8.405 10.331-8.405 7.004 0 10.506 2.802 10.506 8.405v102.085c0 3.035 0.876 5.778 2.627 8.23 1.751 2.451 4.786 3.677 9.105 3.677h29.417c4.319 0 7.355-1.226 9.106-3.677 1.751-2.452 2.626-5.195 2.626-8.23v-102.085c0-5.603 3.444-8.405 10.331-8.405 7.004 0 10.506 2.802 10.506 8.405z" fill="#fff" fill-rule="nonzero"/>
|
||||
<path d="m949.531 229.865h-38.173c-3.322 0-6.774-0.628-10.352-1.906l-0.109-0.042c-3.344-1.362-6.628-3.216-9.901-5.609-3.372-2.594-5.964-5.773-7.794-9.566-1.782-3.817-2.702-8.391-2.702-13.735v-103.486c0-2.956 0.804-5.296 2.257-7.069 2.062-2.516 5.587-4.003 10.741-4.003 5.217 0 8.787 1.482 10.874 3.986 1.481 1.777 2.299 4.123 2.299 7.086v102.085c0 2.463 0.708 4.69 2.13 6.68 1.318 1.846 3.683 2.56 6.935 2.56h29.417c3.252 0 5.617-0.714 6.936-2.56 1.421-1.99 2.13-4.217 2.13-6.68v-102.085c0-2.956 0.803-5.296 2.257-7.07 2.061-2.515 5.586-4.002 10.74-4.002 5.217 0 8.787 1.482 10.874 3.986 1.481 1.777 2.299 4.123 2.299 7.086v103.486c0 10.432-3.58 18.178-10.549 23.34-3.226 2.358-6.579 4.217-10.102 5.601-3.466 1.284-6.87 1.917-10.207 1.917zm0-2.666c3.035 0 6.128-0.584 9.28-1.751 3.269-1.285 6.421-3.036 9.456-5.254 6.304-4.669 9.455-11.732 9.455-21.187v-103.486c0-5.603-3.502-8.405-10.506-8.405-6.887 0-10.331 2.802-10.331 8.405v102.085c0 3.035-0.875 5.778-2.626 8.23-1.751 2.451-4.787 3.677-9.106 3.677h-29.417c-4.319 0-7.354-1.226-9.105-3.677-1.751-2.452-2.627-5.195-2.627-8.23v-102.085c0-5.603-3.502-8.405-10.506-8.405-6.888 0-10.331 2.802-10.331 8.405v103.486c0 4.903 0.817 9.105 2.451 12.607 1.634 3.386 3.969 6.246 7.004 8.58 3.035 2.218 6.129 3.969 9.281 5.254 3.268 1.167 6.42 1.751 9.455 1.751z"/>
|
||||
</g><g transform="translate(-92.0085,72.055)">
|
||||
<path d="m1053.96 169.414h-13.48c-1.98 0-3.56-0.758-4.73-2.276-1.05-1.634-1.57-3.794-1.57-6.479 0-5.953 2.45-8.93 7.35-8.93h20.49c4.32 0 7.35-1.226 9.1-3.677 1.76-2.452 2.63-5.137 2.63-8.055v-22.588c0-2.919-0.87-5.604-2.63-8.055-1.75-2.451-4.78-3.677-9.1-3.677h-36.95v114.167c0 5.604-3.44 8.405-10.33 8.405s-10.33-2.801-10.33-8.405v-121.346c0-4.203 1.05-7.005 3.15-8.405 2.22-1.401 4.85-2.102 7.88-2.102h50.96c3.03 0 6.18 0.642 9.45 1.927 3.27 1.284 6.42 2.918 9.46 4.902h-0.18c3.04 2.218 5.37 5.137 7.01 8.756 1.63 3.502 2.45 7.587 2.45 12.257v25.565c0 9.456-3.15 16.518-9.46 21.187-1.28 0.934-2.68 1.81-4.2 2.627-1.4 0.817-2.86 1.634-4.38 2.451l28.02 46.228c0.35 0.583 0.7 1.342 1.05 2.276s0.52 1.693 0.52 2.276c0 2.802-1.98 5.487-5.95 8.055v-0.175c-2.68 1.634-4.96 2.451-6.83 2.451-2.68 0-4.84-1.342-6.48-4.027l0.18 0.175z" fill="#fff" fill-rule="nonzero"/>
|
||||
<path d="m1027.74 108.344v111.5c0 2.956-0.81 5.296-2.26 7.07-2.06 2.515-5.59 4.002-10.74 4.002s-8.68-1.487-10.74-4.002c-1.45-1.774-2.26-4.114-2.26-7.07v-121.346c0-5.373 1.66-8.833 4.4-10.66 2.62-1.655 5.71-2.513 9.3-2.513h50.96c3.34 0 6.82 0.694 10.43 2.111 3.43 1.349 6.75 3.066 9.94 5.153 0.27 0.177 0.5 0.397 0.68 0.647 3.05 2.409 5.42 5.484 7.1 9.212 1.79 3.826 2.7 8.284 2.7 13.385v25.565c0 10.432-3.58 18.178-10.55 23.344-1.36 0.992-2.85 1.924-4.46 2.793l-1.05 0.604-0.92 0.52 26.59 43.86c0.98 1.7 1.89 3.764 1.95 5.767 0.03 1.178-0.22 2.365-0.66 3.452-0.33 0.812-0.77 1.576-1.29 2.286-0.68 0.941-1.48 1.788-2.35 2.556-0.63 0.554-1.29 1.068-1.97 1.55-0.55 0.386-1.07 0.78-1.72 0.96l-0.12 0.024c-2.84 1.6-5.31 2.327-7.34 2.327-3.6 0-6.56-1.703-8.75-5.307-0.11-0.173-0.19-0.353-0.25-0.538l-31.91-53.515h-11.97c-2.87 0-5.15-1.118-6.84-3.317-0.05-0.059-0.09-0.121-0.13-0.184-1.29-2.002-2-4.631-2-7.921 0-3.747 0.9-6.519 2.45-8.393 1.69-2.057 4.18-3.204 7.57-3.204h20.49c3.25 0 5.61-0.715 6.93-2.56 1.42-1.981 2.13-4.147 2.13-6.505v-22.588c0-2.358-0.71-4.525-2.13-6.505-1.32-1.846-3.68-2.56-6.93-2.56zm57.57-13.524c-3.04-1.984-6.19-3.618-9.46-4.902-3.27-1.285-6.42-1.927-9.45-1.927h-50.96c-3.03 0-5.66 0.701-7.88 2.102-2.1 1.4-3.15 4.202-3.15 8.405v121.346c0 5.604 3.44 8.405 10.33 8.405s10.33-2.801 10.33-8.405v-114.167h36.95c4.32 0 7.35 1.226 9.1 3.677 1.76 2.451 2.63 5.136 2.63 8.055v22.588c0 2.918-0.87 5.603-2.63 8.055-1.75 2.451-4.78 3.677-9.1 3.677h-20.49c-4.9 0-7.35 2.977-7.35 8.93 0 2.685 0.52 4.845 1.57 6.479 1.17 1.518 2.75 2.276 4.73 2.276h13.48l33.1 55.508-0.18-0.175c1.64 2.685 3.8 4.027 6.48 4.027 1.87 0 4.15-0.817 6.83-2.451v0.175c3.97-2.568 5.95-5.253 5.95-8.055 0-0.583-0.17-1.342-0.52-2.276s-0.7-1.693-1.05-2.276l-28.02-46.228c1.52-0.817 2.98-1.634 4.38-2.451 1.52-0.817 2.92-1.693 4.2-2.627 6.31-4.669 9.46-11.731 9.46-21.187v-25.565c0-4.67-0.82-8.755-2.45-12.257-1.64-3.619-3.97-6.538-7.01-8.756z"/>
|
||||
</g><g transform="translate(-92.0085,72.055)">
|
||||
<path d="m1143.94 219.669c0 5.603-3.51 8.405-10.51 8.405-6.89 0-10.33-2.802-10.33-8.405v-124.148c0-5.603 3.44-8.405 10.33-8.405 7 0 10.51 2.802 10.51 8.405z" fill="#fff" fill-rule="nonzero"/>
|
||||
<path d="m1146.6 219.669v-124.148c0-2.963-0.81-5.309-2.3-7.086-2.08-2.504-5.65-3.986-10.87-3.986-5.15 0-8.68 1.487-10.74 4.002-1.45 1.774-2.26 4.114-2.26 7.07v124.148c0 2.956 0.81 5.296 2.26 7.069 2.06 2.516 5.59 4.003 10.74 4.003 5.22 0 8.79-1.482 10.87-3.986 1.49-1.777 2.3-4.123 2.3-7.086zm-2.66 0c0 5.603-3.51 8.405-10.51 8.405-6.89 0-10.33-2.802-10.33-8.405v-124.148c0-5.603 3.44-8.405 10.33-8.405 7 0 10.51 2.802 10.51 8.405z"/>
|
||||
</g></g>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 9.6 KiB |
9
cli/create-tauri-app/src/templates/vanilla/_package.json
Normal file
9
cli/create-tauri-app/src/templates/vanilla/_package.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "<%= name %>",
|
||||
"scripts": {
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"tauri": "<%= tauri_version %>"
|
||||
}
|
||||
}
|
21
cli/create-tauri-app/src/templates/vanilla/dist/_index.html
vendored
Normal file
21
cli/create-tauri-app/src/templates/vanilla/dist/_index.html
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<h1><%= name %></h1>
|
||||
</body>
|
||||
</html>
|
@ -3,22 +3,24 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export interface TauriBuildConfig {
|
||||
appName: string;
|
||||
windowTitle: string;
|
||||
/**
|
||||
* the path to the app's dist dir
|
||||
* this path must contain your index.html file
|
||||
*/
|
||||
distDir: string
|
||||
distDir: string;
|
||||
/**
|
||||
* the app's dev server URL, or the path to the directory containing an index.html to open
|
||||
*/
|
||||
devPath: string
|
||||
devPath: string;
|
||||
/**
|
||||
* a shell command to run before `tauri dev` kicks in
|
||||
*/
|
||||
beforeDevCommand?: string
|
||||
beforeDevCommand?: string;
|
||||
/**
|
||||
* a shell command to run before `tauri build` kicks in
|
||||
*/
|
||||
beforeBuildCommand?: string
|
||||
withGlobalTauri?: boolean
|
||||
beforeBuildCommand?: string;
|
||||
withGlobalTauri?: boolean;
|
||||
}
|
7
cli/create-tauri-app/src/types/deps.ts
Normal file
7
cli/create-tauri-app/src/types/deps.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export enum ManagementType {
|
||||
Install,
|
||||
InstallDev,
|
||||
Update,
|
||||
}
|
||||
|
||||
export type Result = Map<ManagementType, string[]>;
|
13
cli/create-tauri-app/tsconfig.json
Normal file
13
cli/create-tauri-app/tsconfig.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"module": "esnext",
|
||||
"target": "es6",
|
||||
"allowJs": true,
|
||||
"pretty": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
BIN
core/tauri/test/fixture/src-tauri/icons/icon.ico~dev
Normal file
BIN
core/tauri/test/fixture/src-tauri/icons/icon.ico~dev
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
@ -3,7 +3,6 @@ name = "helloworld"
|
||||
version = "0.1.0"
|
||||
description = "A very simple Tauri Appplication"
|
||||
edition = "2018"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ]}
|
||||
|
Loading…
Reference in New Issue
Block a user