mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-11 07:55:34 +03:00
remove create-tauri-app (#3493)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
parent
a975551461
commit
53e4dd8c2d
@ -213,49 +213,34 @@
|
||||
"tauri-bundler": {
|
||||
"path": "./tooling/bundler",
|
||||
"manager": "rust",
|
||||
"dependencies": [
|
||||
"tauri-utils"
|
||||
]
|
||||
"dependencies": ["tauri-utils"]
|
||||
},
|
||||
"tauri-runtime": {
|
||||
"path": "./core/tauri-runtime",
|
||||
"manager": "rust",
|
||||
"dependencies": [
|
||||
"tauri-utils"
|
||||
],
|
||||
"dependencies": ["tauri-utils"],
|
||||
"postversion": "node ../../.scripts/covector/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
},
|
||||
"tauri-runtime-wry": {
|
||||
"path": "./core/tauri-runtime-wry",
|
||||
"manager": "rust",
|
||||
"dependencies": [
|
||||
"tauri-utils",
|
||||
"tauri-runtime"
|
||||
],
|
||||
"dependencies": ["tauri-utils", "tauri-runtime"],
|
||||
"postversion": "node ../../.scripts/covector/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
},
|
||||
"tauri-codegen": {
|
||||
"path": "./core/tauri-codegen",
|
||||
"manager": "rust",
|
||||
"dependencies": [
|
||||
"tauri-utils"
|
||||
]
|
||||
"dependencies": ["tauri-utils"]
|
||||
},
|
||||
"tauri-macros": {
|
||||
"path": "./core/tauri-macros",
|
||||
"manager": "rust",
|
||||
"dependencies": [
|
||||
"tauri-codegen",
|
||||
"tauri-utils"
|
||||
]
|
||||
"dependencies": ["tauri-codegen", "tauri-utils"]
|
||||
},
|
||||
"tauri-build": {
|
||||
"path": "./core/tauri-build",
|
||||
"manager": "rust",
|
||||
"dependencies": [
|
||||
"tauri-codegen",
|
||||
"tauri-utils"
|
||||
],
|
||||
"dependencies": ["tauri-codegen", "tauri-utils"],
|
||||
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
||||
},
|
||||
"tauri": {
|
||||
@ -272,9 +257,7 @@
|
||||
"cli.js": {
|
||||
"path": "./tooling/cli/node",
|
||||
"manager": "javascript",
|
||||
"dependencies": [
|
||||
"cli.rs"
|
||||
],
|
||||
"dependencies": ["cli.rs"],
|
||||
"postversion": "node ../../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
|
||||
"prepublish": [],
|
||||
"publish": [],
|
||||
@ -283,10 +266,7 @@
|
||||
"cli.rs": {
|
||||
"path": "./tooling/cli",
|
||||
"manager": "rust",
|
||||
"dependencies": [
|
||||
"tauri-bundler",
|
||||
"tauri-utils"
|
||||
],
|
||||
"dependencies": ["tauri-bundler", "tauri-utils"],
|
||||
"postversion": "cargo check",
|
||||
"assets": [
|
||||
{
|
||||
@ -295,10 +275,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"create-tauri-app": {
|
||||
"path": "./tooling/create-tauri-app",
|
||||
"manager": "javascript"
|
||||
},
|
||||
"tauri-driver": {
|
||||
"path": "./tooling/webdriver",
|
||||
"manager": "rust",
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
"create-tauri-app": patch
|
||||
---
|
||||
|
||||
Add empty description to Cargo.toml in dominator recipe.
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
"create-tauri-app": patch
|
||||
---
|
||||
|
||||
`create-tauri-app` should now be fully compatiable with CI environments.
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
"create-tauri-app": patch
|
||||
---
|
||||
|
||||
Fix crash when using `create-react-app` recipe.
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
"create-tauri-app": patch
|
||||
---
|
||||
|
||||
Fix `create-tauri-app` failing to bootstrap projects.
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
"create-tauri-app": patch
|
||||
---
|
||||
|
||||
Stop react recipe from opening in browser by default.
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
'create-tauri-app': patch
|
||||
---
|
||||
|
||||
Add SolidJS recipe using the official template.
|
@ -8,7 +8,6 @@
|
||||
'tauri-codegen': major
|
||||
'tauri-macros': major
|
||||
'tauri-build': major
|
||||
'create-tauri-app': major
|
||||
'tauri-driver': patch
|
||||
---
|
||||
|
||||
|
@ -67,12 +67,6 @@
|
||||
".changes/core-path-endpoint-path-doesnt-exist-error.md",
|
||||
".changes/create-window-return-window.md",
|
||||
".changes/csp-nonces.md",
|
||||
".changes/cta-add-empty-description-for-rust-dominator.md",
|
||||
".changes/cta-ci-compatible.md",
|
||||
".changes/cta-cli-install.md",
|
||||
".changes/cta-crash.md",
|
||||
".changes/cta-react-disable-open-browser.md",
|
||||
".changes/cta-solid-recipe.md",
|
||||
".changes/current-binary-caching.md",
|
||||
".changes/custom-invoke-system.md",
|
||||
".changes/data-url-csp.md",
|
||||
|
11
.github/workflows/lint-js.yml
vendored
11
.github/workflows/lint-js.yml
vendored
@ -10,7 +10,6 @@ on:
|
||||
- '.github/workflows/lint-js.yml'
|
||||
- 'tooling/cli/node/**'
|
||||
- 'tooling/api/**'
|
||||
- 'tooling/create-tauri-app/**'
|
||||
|
||||
jobs:
|
||||
eslint-check:
|
||||
@ -42,13 +41,3 @@ jobs:
|
||||
- name: run api format
|
||||
working-directory: ./tooling/api/
|
||||
run: yarn format:check
|
||||
|
||||
- name: install create-tauri-app deps via yarn
|
||||
working-directory: ./tooling/create-tauri-app/
|
||||
run: yarn
|
||||
- name: run create-tauri-app lint
|
||||
working-directory: ./tooling/create-tauri-app/
|
||||
run: yarn lint
|
||||
- name: run create-tauri-app format
|
||||
working-directory: ./tooling/create-tauri-app/
|
||||
run: yarn format:check
|
||||
|
99
.github/workflows/test-cta.yml
vendored
99
.github/workflows/test-cta.yml
vendored
@ -1,99 +0,0 @@
|
||||
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
name: test create-tauri-app
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
CARGO_INCREMENTAL: 0 # This is set to 0 by the https://github.com/Swatinem/rust-cache
|
||||
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
|
||||
TAURI_RECIPE: 'vanillajs,cra,vite,ngcli,solid'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
platform:
|
||||
default: 'ubuntu'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'tooling/create-tauri-app/**'
|
||||
|
||||
jobs:
|
||||
create-recipe-with-npm:
|
||||
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']
|
||||
exclude:
|
||||
- node: '16'
|
||||
manager: '6'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: install stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- uses: volta-cli/action@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
npm-version: ${{ matrix.manager }}
|
||||
yarn-version: 1.22.5
|
||||
- name: install webkit2gtk
|
||||
if: (github.event.inputs.platform || 'ubuntu') == 'ubuntu'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
||||
#- run: yarn
|
||||
# working-directory: tooling/cli/node
|
||||
#- run: yarn build
|
||||
# working-directory: tooling/cli/node
|
||||
- run: yarn
|
||||
working-directory: tooling/api
|
||||
- run: yarn build
|
||||
working-directory: tooling/api
|
||||
- run: yarn
|
||||
working-directory: tooling/create-tauri-app
|
||||
- run: yarn build
|
||||
working-directory: tooling/create-tauri-app
|
||||
- run: yarn test
|
||||
working-directory: tooling/create-tauri-app
|
||||
env:
|
||||
TAURI_RUN_MANAGER: 'npm'
|
||||
|
||||
# create-recipe-with-yarn:
|
||||
# name: "node@${{ matrix.node }} + yarn@1"
|
||||
# runs-on: ${{ github.event.inputs.platform || 'ubuntu' }}-latest
|
||||
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
# matrix:
|
||||
# node: ["14", "16"]
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - name: install stable
|
||||
# uses: actions-rs/toolchain@v1
|
||||
# with:
|
||||
# toolchain: stable
|
||||
# - uses: volta-cli/action@v1
|
||||
# with:
|
||||
# node-version: ${{ matrix.node }}
|
||||
# yarn-version: 1.22.5
|
||||
# - name: install webkit2gtk
|
||||
# if: (github.event.inputs.platform || 'ubuntu') == 'ubuntu'
|
||||
# run: |
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
||||
# - run: yarn
|
||||
# working-directory: tooling/create-tauri-app
|
||||
# - run: yarn build
|
||||
# working-directory: tooling/create-tauri-app
|
||||
# - run: yarn test
|
||||
# working-directory: tooling/create-tauri-app
|
||||
# env:
|
||||
# TAURI_RUN_MANAGER: "yarn"
|
@ -22,12 +22,3 @@ else
|
||||
yarn format
|
||||
cd ../../..
|
||||
fi
|
||||
|
||||
if [ -z "$(git diff --name-only tooling/create-tauri-app)" ]; then
|
||||
echo "skipping create-tauri-app - no changes detected"
|
||||
else
|
||||
cd tooling/create-tauri-app
|
||||
yarn format
|
||||
yarn lint-fix
|
||||
cd ../..
|
||||
fi
|
||||
|
@ -50,7 +50,7 @@ It is a wrapper around [cli.rs](https://github.com/tauri-apps/tauri/blob/dev/too
|
||||
#### [cli.rs](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) [RUST]
|
||||
This rust executable provides the full interface to all of the required activities for which the CLI is required. It will run on macOS, Windows, and Linux.
|
||||
|
||||
#### [create-tauri-app](https://github.com/tauri-apps/tauri/tree/dev/tooling/create-tauri-app) [JS]
|
||||
#### [create-tauri-app](https://github.com/tauri-apps/create-tauri-app) [JS]
|
||||
This is a toolkit that will enable engineering teams to rapidly scaffold out a new tauri-apps project using the frontend framework of their choice (as long as it has been configured).
|
||||
|
||||
# External Crates
|
||||
|
18
README.md
18
README.md
@ -13,15 +13,15 @@
|
||||
|
||||
## Current Releases
|
||||
|
||||
| Component | Description | Version | Lin | Win | Mac |
|
||||
| --------------------------------------------------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | --- | --- | --- |
|
||||
| [**cli.rs**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
|
||||
| [**cli.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) | Node.js CLI wrapper for cli.rs | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
|
||||
| [**api.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
|
||||
| [**create-tauri-app**](https://github.com/tauri-apps/tauri/tree/dev/tooling/create-tauri-app) | Get started with your first Tauri app | [![](https://img.shields.io/npm/v/create-tauri-app.svg)](https://www.npmjs.com/package/create-tauri-app) | ✅ | ✅ | ✅ |
|
||||
| [**vue-cli-plugin-tauri**](https://github.com/tauri-apps/vue-cli-plugin-tauri/) | Vue CLI plugin for Tauri | [![](https://img.shields.io/npm/v/vue-cli-plugin-tauri.svg)](https://www.npmjs.com/package/vue-cli-plugin-tauri) | ✅ | ✅ | ✅ |
|
||||
| [**core**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri) | runtime core | [![](https://img.shields.io/crates/v/tauri.svg)](https://crates.io/crates/tauri) | ✅ | ✅ | ✅ |
|
||||
| [**bundler**](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) | manufacture the final binaries | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) | ✅ | ✅ | ✅ |
|
||||
| Component | Description | Version | Lin | Win | Mac |
|
||||
| ------------------------------------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | --- | --- | --- |
|
||||
| [**cli.rs**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
|
||||
| [**cli.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) | Node.js CLI wrapper for cli.rs | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
|
||||
| [**api.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
|
||||
| [**create-tauri-app**](https://github.com/tauri-apps/create-tauri-app) | Get started with your first Tauri app | [![](https://img.shields.io/npm/v/create-tauri-app.svg)](https://www.npmjs.com/package/create-tauri-app) | ✅ | ✅ | ✅ |
|
||||
| [**vue-cli-plugin-tauri**](https://github.com/tauri-apps/vue-cli-plugin-tauri/) | Vue CLI plugin for Tauri | [![](https://img.shields.io/npm/v/vue-cli-plugin-tauri.svg)](https://www.npmjs.com/package/vue-cli-plugin-tauri) | ✅ | ✅ | ✅ |
|
||||
| [**core**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri) | runtime core | [![](https://img.shields.io/crates/v/tauri.svg)](https://crates.io/crates/tauri) | ✅ | ✅ | ✅ |
|
||||
| [**bundler**](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) | manufacture the final binaries | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) | ✅ | ✅ | ✅ |
|
||||
|
||||
## Introduction
|
||||
Tauri is a framework for building tiny, blazing fast binaries for all major desktop platforms. Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface. The backend of the application is a rust-sourced binary with an API that the front-end can interact with.
|
||||
|
3
core/tauri/tests/restart/Cargo.lock
generated
3
core/tauri/tests/restart/Cargo.lock
generated
@ -2534,8 +2534,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"cfg_aliases",
|
||||
"dirs-next",
|
||||
|
@ -1,31 +1,20 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"extends": ["config:base"],
|
||||
"schedule": "after 3am on Wednesday",
|
||||
"ignorePaths": [],
|
||||
"labels": [
|
||||
"chore"
|
||||
],
|
||||
"enabledManagers": [
|
||||
"cargo",
|
||||
"npm"
|
||||
],
|
||||
"labels": ["chore"],
|
||||
"enabledManagers": ["cargo", "npm"],
|
||||
"cargo": {
|
||||
"enabled": true
|
||||
},
|
||||
"packageRules": [
|
||||
{
|
||||
"packagePatterns": [
|
||||
"*"
|
||||
],
|
||||
"packagePatterns": ["*"],
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"core/tauri/**"
|
||||
],
|
||||
"paths": ["core/tauri/**"],
|
||||
"groupName": "Tauri Core",
|
||||
"groupSlug": "allTauriCore",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -36,9 +25,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"core/tauri-build/**"
|
||||
],
|
||||
"paths": ["core/tauri-build/**"],
|
||||
"groupName": "Tauri Build",
|
||||
"groupSlug": "allTauriBuild",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -49,9 +36,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"core/tauri-codegen/**"
|
||||
],
|
||||
"paths": ["core/tauri-codegen/**"],
|
||||
"groupName": "Tauri Codegen",
|
||||
"groupSlug": "allTauriCodegen",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -62,9 +47,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"core/tauri-macros/**"
|
||||
],
|
||||
"paths": ["core/tauri-macros/**"],
|
||||
"groupName": "Tauri Macros",
|
||||
"groupSlug": "allTauriMacros",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -75,9 +58,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"core/tauri-utils/**"
|
||||
],
|
||||
"paths": ["core/tauri-utils/**"],
|
||||
"groupName": "Tauri Utils",
|
||||
"groupSlug": "allTauriUtils",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -88,9 +69,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"tooling/cli/**"
|
||||
],
|
||||
"paths": ["tooling/cli/**"],
|
||||
"groupName": "Tauri CLI",
|
||||
"groupSlug": "allTauriCLI",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -101,9 +80,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"tooling/bundler/**"
|
||||
],
|
||||
"paths": ["tooling/bundler/**"],
|
||||
"groupName": "Tauri Bundler",
|
||||
"groupSlug": "allTauriBundler",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -114,9 +91,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"tooling/cli/node"
|
||||
],
|
||||
"paths": ["tooling/cli/node"],
|
||||
"groupName": "Tauri JS CLI",
|
||||
"groupSlug": "allTauriJSCLI",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -127,9 +102,7 @@
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"tooling/api/**"
|
||||
],
|
||||
"paths": ["tooling/api/**"],
|
||||
"groupName": "Tauri API Definitions",
|
||||
"groupSlug": "allTauriAPIDefinitions",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
@ -137,19 +110,6 @@
|
||||
"enabled": true
|
||||
},
|
||||
"rebaseConflictedPrs": false
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"paths": [
|
||||
"tooling/create-tauri-app/**"
|
||||
],
|
||||
"groupName": "create-tauri-app",
|
||||
"groupSlug": "allCTA",
|
||||
"commitMessagePrefix": "chore(deps)",
|
||||
"lockFileMaintenance": {
|
||||
"enabled": true
|
||||
},
|
||||
"rebaseConflictedPrs": false
|
||||
}
|
||||
]
|
||||
}
|
760
tooling/cli.js/dist/api/cli.js
vendored
Normal file
760
tooling/cli.js/dist/api/cli.js
vendored
Normal file
@ -0,0 +1,760 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["tauri"] = factory();
|
||||
else
|
||||
root["tauri"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (() => { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "../cli.rs/Cargo.toml":
|
||||
/*!****************************!*\
|
||||
!*** ../cli.rs/Cargo.toml ***!
|
||||
\****************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = {
|
||||
"workspace": {},
|
||||
"package": {
|
||||
"name": "tauri-cli",
|
||||
"version": "1.0.0-beta.5",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"edition": "2018",
|
||||
"categories": [
|
||||
"gui",
|
||||
"web-programming"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"homepage": "https://tauri.studio",
|
||||
"repository": "https://github.com/tauri-apps/tauri",
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"include": [
|
||||
"src/",
|
||||
"/templates",
|
||||
"MergeModules/",
|
||||
"*.json",
|
||||
"*.rs"
|
||||
]
|
||||
},
|
||||
"bin": [
|
||||
{
|
||||
"name": "cargo-tauri",
|
||||
"path": "src/main.rs"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"clap": {
|
||||
"version": "3.0.0-beta.2",
|
||||
"features": [
|
||||
"yaml"
|
||||
]
|
||||
},
|
||||
"anyhow": "1.0",
|
||||
"tauri-bundler": {
|
||||
"version": "1.0.0-beta.3",
|
||||
"path": "../bundler"
|
||||
},
|
||||
"colored": "2.0",
|
||||
"once_cell": "1.8",
|
||||
"serde": {
|
||||
"version": "1.0",
|
||||
"features": [
|
||||
"derive"
|
||||
]
|
||||
},
|
||||
"serde_json": "1.0",
|
||||
"serde_with": "1.9",
|
||||
"notify": "4.0",
|
||||
"shared_child": "0.3",
|
||||
"toml_edit": "0.2",
|
||||
"json-patch": "0.2",
|
||||
"schemars": "0.8",
|
||||
"toml": "0.5",
|
||||
"valico": "3.6",
|
||||
"handlebars": "4.1",
|
||||
"include_dir": "0.6",
|
||||
"minisign": "0.6",
|
||||
"base64": "0.13.0",
|
||||
"ureq": "2.1",
|
||||
"os_info": "3.0",
|
||||
"semver": "1.0",
|
||||
"regex": "1.5",
|
||||
"lazy_static": "1",
|
||||
"libc": "0.2",
|
||||
"terminal_size": "0.1",
|
||||
"unicode-width": "0.1",
|
||||
"tempfile": "3",
|
||||
"zeroize": "1.3"
|
||||
},
|
||||
"target": {
|
||||
"cfg(windows)": {
|
||||
"dependencies": {
|
||||
"winapi": {
|
||||
"version": "0.3",
|
||||
"features": [
|
||||
"winbase",
|
||||
"winuser",
|
||||
"consoleapi",
|
||||
"processenv",
|
||||
"wincon"
|
||||
]
|
||||
},
|
||||
"encode_unicode": "0.3"
|
||||
}
|
||||
},
|
||||
"cfg(target_os = \"linux\")": {
|
||||
"dependencies": {
|
||||
"heck": "0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"build-dependencies": {
|
||||
"schemars": "0.8",
|
||||
"serde": {
|
||||
"version": "1.0",
|
||||
"features": [
|
||||
"derive"
|
||||
]
|
||||
},
|
||||
"serde_json": "1.0",
|
||||
"serde_with": "1.9"
|
||||
}
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/api/cli.ts":
|
||||
/*!************************!*\
|
||||
!*** ./src/api/cli.ts ***!
|
||||
\************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.build = exports.dev = exports.init = void 0;
|
||||
var rust_cli_1 = __webpack_require__(/*! ../helpers/rust-cli */ "./src/helpers/rust-cli.ts");
|
||||
function toKebabCase(value) {
|
||||
return value
|
||||
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
||||
.replace(/\s+/g, '-')
|
||||
.toLowerCase();
|
||||
}
|
||||
function runCliCommand(command, args) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var argsArray, _i, _a, _b, argName, argValue;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
argsArray = [];
|
||||
for (_i = 0, _a = Object.entries(args !== null && args !== void 0 ? args : {}); _i < _a.length; _i++) {
|
||||
_b = _a[_i], argName = _b[0], argValue = _b[1];
|
||||
if (argValue === false) {
|
||||
continue;
|
||||
}
|
||||
argsArray.push("--" + toKebabCase(argName));
|
||||
if (argValue === true) {
|
||||
continue;
|
||||
}
|
||||
argsArray.push(typeof argValue === 'string' ? argValue : JSON.stringify(argValue));
|
||||
}
|
||||
return [4 /*yield*/, rust_cli_1.runOnRustCli(command, argsArray)];
|
||||
case 1: return [2 /*return*/, _c.sent()];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
var init = function (args) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, runCliCommand('init', args)];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
}); }); };
|
||||
exports.init = init;
|
||||
var dev = function (args) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, runCliCommand('dev', args)];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
}); }); };
|
||||
exports.dev = dev;
|
||||
var build = function (args) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, runCliCommand('build', args)];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
}); }); };
|
||||
exports.build = build;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/download-binary.ts":
|
||||
/*!****************************************!*\
|
||||
!*** ./src/helpers/download-binary.ts ***!
|
||||
\****************************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.downloadRustup = exports.downloadCli = void 0;
|
||||
var stream_1 = __importDefault(__webpack_require__(/*! stream */ "stream"));
|
||||
var util_1 = __webpack_require__(/*! util */ "util");
|
||||
var fs_1 = __importDefault(__webpack_require__(/*! fs */ "fs"));
|
||||
var got_1 = __importDefault(__webpack_require__(/*! got */ "got"));
|
||||
var path_1 = __importDefault(__webpack_require__(/*! path */ "path"));
|
||||
var pipeline = util_1.promisify(stream_1.default.pipeline);
|
||||
// Webpack reads the file at build-time, so this becomes a static var
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
||||
var tauriCliManifest = __webpack_require__(/*! ../../../cli.rs/Cargo.toml */ "../cli.rs/Cargo.toml");
|
||||
var downloads = {};
|
||||
function downloadBinaryRelease(tag, asset, outPath) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var url, removeDownloadedCliIfNeeded;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
url = "https://github.com/tauri-apps/binary-releases/releases/download/" + tag + "/" + asset;
|
||||
removeDownloadedCliIfNeeded = function () {
|
||||
try {
|
||||
if (!(url in downloads)) {
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.unlinkSync(outPath);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
process.exit();
|
||||
}
|
||||
};
|
||||
// on exit, we remove the `tauri-cli` file if the download didn't complete
|
||||
process.on('exit', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGINT', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGTERM', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGHUP', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGBREAK', removeDownloadedCliIfNeeded);
|
||||
// TODO: Check hash of download
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-fs-filename
|
||||
return [4 /*yield*/, pipeline(got_1.default.stream(url), fs_1.default.createWriteStream(outPath)).catch(function (e) {
|
||||
try {
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.unlinkSync(outPath);
|
||||
}
|
||||
catch (_a) { }
|
||||
throw e;
|
||||
})
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
];
|
||||
case 1:
|
||||
// TODO: Check hash of download
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-fs-filename
|
||||
_a.sent();
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
downloads[url] = true;
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.chmodSync(outPath, 448);
|
||||
console.log('Download Complete');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function downloadCli() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var version, platform, extension, outPath;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
version = tauriCliManifest.package.version;
|
||||
platform = process.platform;
|
||||
if (platform === 'win32') {
|
||||
platform = 'windows';
|
||||
}
|
||||
else if (platform === 'linux') {
|
||||
platform = 'linux';
|
||||
}
|
||||
else if (platform === 'darwin') {
|
||||
platform = 'macos';
|
||||
}
|
||||
else {
|
||||
throw Error('Unsupported platform');
|
||||
}
|
||||
extension = platform === 'windows' ? '.exe' : '';
|
||||
outPath = path_1.default.join(__dirname, "../../bin/tauri-cli" + extension);
|
||||
console.log('Downloading Rust CLI...');
|
||||
return [4 /*yield*/, downloadBinaryRelease("tauri-cli-v" + version, "tauri-cli_" + platform + extension, outPath)];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.downloadCli = downloadCli;
|
||||
function downloadRustup() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var assetName;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
assetName = process.platform === 'win32' ? 'rustup-init.exe' : 'rustup-init.sh';
|
||||
console.log('Downloading Rustup...');
|
||||
return [4 /*yield*/, downloadBinaryRelease('rustup', assetName, path_1.default.join(__dirname, "../../bin/" + assetName))];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.downloadRustup = downloadRustup;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/logger.ts":
|
||||
/*!*******************************!*\
|
||||
!*** ./src/helpers/logger.ts ***!
|
||||
\*******************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
|
||||
var ms_1 = __importDefault(__webpack_require__(/*! ms */ "ms"));
|
||||
var prevTime;
|
||||
exports.default = (function (banner, color) {
|
||||
if (color === void 0) { color = chalk_1.default.green; }
|
||||
return function (msg) {
|
||||
var curr = +new Date();
|
||||
var diff = curr - (prevTime || curr);
|
||||
prevTime = curr;
|
||||
if (msg) {
|
||||
console.log(
|
||||
// TODO: proper typings for color and banner
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
|
||||
" " + color(String(banner)) + " " + msg + " " + chalk_1.default.green("+" + ms_1.default(diff)));
|
||||
}
|
||||
else {
|
||||
console.log();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/rust-cli.ts":
|
||||
/*!*********************************!*\
|
||||
!*** ./src/helpers/rust-cli.ts ***!
|
||||
\*********************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.runOnRustCli = void 0;
|
||||
var fs_1 = __webpack_require__(/*! fs */ "fs");
|
||||
var path_1 = __webpack_require__(/*! path */ "path");
|
||||
var spawn_1 = __webpack_require__(/*! ./spawn */ "./src/helpers/spawn.ts");
|
||||
var download_binary_1 = __webpack_require__(/*! ./download-binary */ "./src/helpers/download-binary.ts");
|
||||
var currentTauriCliVersion = function () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
var tauriCliManifest =
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
__webpack_require__(/*! ../../../cli.rs/Cargo.toml */ "../cli.rs/Cargo.toml");
|
||||
return tauriCliManifest.package.version;
|
||||
};
|
||||
function runOnRustCli(command, args) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var targetPath, targetCliPath, resolveCb, rejectCb, pid, promise, onClose, cliPath, localCliPath;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
targetPath = path_1.resolve(__dirname, '../..');
|
||||
targetCliPath = path_1.join(targetPath, 'bin/tauri-cli' + (process.platform === 'win32' ? '.exe' : ''));
|
||||
promise = new Promise(function (resolve, reject) {
|
||||
resolveCb = resolve;
|
||||
rejectCb = function () { return reject(new Error()); };
|
||||
});
|
||||
onClose = function (code, pid) {
|
||||
if (code === 0) {
|
||||
resolveCb();
|
||||
}
|
||||
else {
|
||||
rejectCb();
|
||||
}
|
||||
};
|
||||
if (!fs_1.existsSync(targetCliPath)) return [3 /*break*/, 1];
|
||||
pid = spawn_1.spawn(targetCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
return [3 /*break*/, 4];
|
||||
case 1:
|
||||
if (true) return [3 /*break*/, 3];
|
||||
return [4 /*yield*/, download_binary_1.downloadCli()];
|
||||
case 2:
|
||||
_a.sent();
|
||||
pid = spawn_1.spawn(targetCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
if (fs_1.existsSync(path_1.resolve(targetPath, '../bundler'))) {
|
||||
cliPath = path_1.resolve(targetPath, '../cli.rs');
|
||||
spawn_1.spawnSync('cargo', ['build', '--release'], cliPath);
|
||||
localCliPath = path_1.resolve(targetPath, '../cli.rs/target/release/cargo-tauri');
|
||||
pid = spawn_1.spawn(localCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
}
|
||||
else {
|
||||
spawn_1.spawnSync('cargo', [
|
||||
'install',
|
||||
'--root',
|
||||
targetPath,
|
||||
'tauri-cli',
|
||||
'--version',
|
||||
currentTauriCliVersion()
|
||||
], process.cwd());
|
||||
pid = spawn_1.spawn(targetCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
}
|
||||
_a.label = 4;
|
||||
case 4: return [2 /*return*/, { pid: pid, promise: promise }];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.runOnRustCli = runOnRustCli;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/spawn.ts":
|
||||
/*!******************************!*\
|
||||
!*** ./src/helpers/spawn.ts ***!
|
||||
\******************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.spawnSync = exports.spawn = void 0;
|
||||
var cross_spawn_1 = __importDefault(__webpack_require__(/*! cross-spawn */ "cross-spawn"));
|
||||
var logger_1 = __importDefault(__webpack_require__(/*! ./logger */ "./src/helpers/logger.ts"));
|
||||
var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
|
||||
var log = logger_1.default('app:spawn');
|
||||
var warn = logger_1.default('app:spawn', chalk_1.default.red);
|
||||
/*
|
||||
Returns pid, takes onClose
|
||||
*/
|
||||
var spawn = function (cmd, params, cwd, onClose) {
|
||||
var _a;
|
||||
log("Running \"" + cmd + " " + params.join(' ') + "\"");
|
||||
log();
|
||||
// TODO: move to execa?
|
||||
var runner = cross_spawn_1.default(cmd, params, {
|
||||
stdio: 'inherit',
|
||||
cwd: cwd,
|
||||
env: process.env
|
||||
});
|
||||
runner.on('close', function (code) {
|
||||
var _a;
|
||||
log();
|
||||
if (code) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log("Command \"" + cmd + "\" failed with exit code: " + code);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
onClose && onClose(code !== null && code !== void 0 ? code : 0, (_a = runner.pid) !== null && _a !== void 0 ? _a : 0);
|
||||
});
|
||||
return (_a = runner.pid) !== null && _a !== void 0 ? _a : 0;
|
||||
};
|
||||
exports.spawn = spawn;
|
||||
/*
|
||||
Returns nothing, takes onFail
|
||||
*/
|
||||
var spawnSync = function (cmd, params, cwd, onFail) {
|
||||
log("[sync] Running \"" + cmd + " " + params.join(' ') + "\"");
|
||||
log();
|
||||
var runner = cross_spawn_1.default.sync(cmd, params, {
|
||||
stdio: 'inherit',
|
||||
cwd: cwd
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
if (runner.status || runner.error) {
|
||||
warn();
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
warn("\u26A0\uFE0F Command \"" + cmd + "\" failed with exit code: " + runner.status);
|
||||
if (runner.status === null) {
|
||||
warn("\u26A0\uFE0F Please globally install \"" + cmd + "\"");
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
onFail && onFail();
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
exports.spawnSync = spawnSync;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "chalk":
|
||||
/*!************************!*\
|
||||
!*** external "chalk" ***!
|
||||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("chalk");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "cross-spawn":
|
||||
/*!******************************!*\
|
||||
!*** external "cross-spawn" ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("cross-spawn");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "fs":
|
||||
/*!*********************!*\
|
||||
!*** external "fs" ***!
|
||||
\*********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("fs");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "got":
|
||||
/*!**********************!*\
|
||||
!*** external "got" ***!
|
||||
\**********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("got");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "ms":
|
||||
/*!*********************!*\
|
||||
!*** external "ms" ***!
|
||||
\*********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("ms");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "path":
|
||||
/*!***********************!*\
|
||||
!*** external "path" ***!
|
||||
\***********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("path");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "stream":
|
||||
/*!*************************!*\
|
||||
!*** external "stream" ***!
|
||||
\*************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("stream");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "util":
|
||||
/*!***********************!*\
|
||||
!*** external "util" ***!
|
||||
\***********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("util");;
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module is referenced by other modules so it can't be inlined
|
||||
/******/ var __webpack_exports__ = __webpack_require__("./src/api/cli.ts");
|
||||
/******/
|
||||
/******/ return __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
});
|
||||
//# sourceMappingURL=cli.js.map
|
1
tooling/cli.js/dist/api/cli.js.map
vendored
Normal file
1
tooling/cli.js/dist/api/cli.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1655
tooling/cli.js/dist/api/dependency-manager.js
vendored
Normal file
1655
tooling/cli.js/dist/api/dependency-manager.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
tooling/cli.js/dist/api/dependency-manager.js.map
vendored
Normal file
1
tooling/cli.js/dist/api/dependency-manager.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3106
tooling/cli.js/dist/api/tauricon.js
vendored
Normal file
3106
tooling/cli.js/dist/api/tauricon.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
tooling/cli.js/dist/api/tauricon.js.map
vendored
Normal file
1
tooling/cli.js/dist/api/tauricon.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
384
tooling/cli.js/dist/helpers/download-binary.js
vendored
Normal file
384
tooling/cli.js/dist/helpers/download-binary.js
vendored
Normal file
@ -0,0 +1,384 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["tauri"] = factory();
|
||||
else
|
||||
root["tauri"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (() => { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "../cli.rs/Cargo.toml":
|
||||
/*!****************************!*\
|
||||
!*** ../cli.rs/Cargo.toml ***!
|
||||
\****************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = {
|
||||
"workspace": {},
|
||||
"package": {
|
||||
"name": "tauri-cli",
|
||||
"version": "1.0.0-beta.5",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"edition": "2018",
|
||||
"categories": [
|
||||
"gui",
|
||||
"web-programming"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"homepage": "https://tauri.studio",
|
||||
"repository": "https://github.com/tauri-apps/tauri",
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"include": [
|
||||
"src/",
|
||||
"/templates",
|
||||
"MergeModules/",
|
||||
"*.json",
|
||||
"*.rs"
|
||||
]
|
||||
},
|
||||
"bin": [
|
||||
{
|
||||
"name": "cargo-tauri",
|
||||
"path": "src/main.rs"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"clap": {
|
||||
"version": "3.0.0-beta.2",
|
||||
"features": [
|
||||
"yaml"
|
||||
]
|
||||
},
|
||||
"anyhow": "1.0",
|
||||
"tauri-bundler": {
|
||||
"version": "1.0.0-beta.3",
|
||||
"path": "../bundler"
|
||||
},
|
||||
"colored": "2.0",
|
||||
"once_cell": "1.8",
|
||||
"serde": {
|
||||
"version": "1.0",
|
||||
"features": [
|
||||
"derive"
|
||||
]
|
||||
},
|
||||
"serde_json": "1.0",
|
||||
"serde_with": "1.9",
|
||||
"notify": "4.0",
|
||||
"shared_child": "0.3",
|
||||
"toml_edit": "0.2",
|
||||
"json-patch": "0.2",
|
||||
"schemars": "0.8",
|
||||
"toml": "0.5",
|
||||
"valico": "3.6",
|
||||
"handlebars": "4.1",
|
||||
"include_dir": "0.6",
|
||||
"minisign": "0.6",
|
||||
"base64": "0.13.0",
|
||||
"ureq": "2.1",
|
||||
"os_info": "3.0",
|
||||
"semver": "1.0",
|
||||
"regex": "1.5",
|
||||
"lazy_static": "1",
|
||||
"libc": "0.2",
|
||||
"terminal_size": "0.1",
|
||||
"unicode-width": "0.1",
|
||||
"tempfile": "3",
|
||||
"zeroize": "1.3"
|
||||
},
|
||||
"target": {
|
||||
"cfg(windows)": {
|
||||
"dependencies": {
|
||||
"winapi": {
|
||||
"version": "0.3",
|
||||
"features": [
|
||||
"winbase",
|
||||
"winuser",
|
||||
"consoleapi",
|
||||
"processenv",
|
||||
"wincon"
|
||||
]
|
||||
},
|
||||
"encode_unicode": "0.3"
|
||||
}
|
||||
},
|
||||
"cfg(target_os = \"linux\")": {
|
||||
"dependencies": {
|
||||
"heck": "0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"build-dependencies": {
|
||||
"schemars": "0.8",
|
||||
"serde": {
|
||||
"version": "1.0",
|
||||
"features": [
|
||||
"derive"
|
||||
]
|
||||
},
|
||||
"serde_json": "1.0",
|
||||
"serde_with": "1.9"
|
||||
}
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/download-binary.ts":
|
||||
/*!****************************************!*\
|
||||
!*** ./src/helpers/download-binary.ts ***!
|
||||
\****************************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.downloadRustup = exports.downloadCli = void 0;
|
||||
var stream_1 = __importDefault(__webpack_require__(/*! stream */ "stream"));
|
||||
var util_1 = __webpack_require__(/*! util */ "util");
|
||||
var fs_1 = __importDefault(__webpack_require__(/*! fs */ "fs"));
|
||||
var got_1 = __importDefault(__webpack_require__(/*! got */ "got"));
|
||||
var path_1 = __importDefault(__webpack_require__(/*! path */ "path"));
|
||||
var pipeline = util_1.promisify(stream_1.default.pipeline);
|
||||
// Webpack reads the file at build-time, so this becomes a static var
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
||||
var tauriCliManifest = __webpack_require__(/*! ../../../cli.rs/Cargo.toml */ "../cli.rs/Cargo.toml");
|
||||
var downloads = {};
|
||||
function downloadBinaryRelease(tag, asset, outPath) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var url, removeDownloadedCliIfNeeded;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
url = "https://github.com/tauri-apps/binary-releases/releases/download/" + tag + "/" + asset;
|
||||
removeDownloadedCliIfNeeded = function () {
|
||||
try {
|
||||
if (!(url in downloads)) {
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.unlinkSync(outPath);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
process.exit();
|
||||
}
|
||||
};
|
||||
// on exit, we remove the `tauri-cli` file if the download didn't complete
|
||||
process.on('exit', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGINT', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGTERM', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGHUP', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGBREAK', removeDownloadedCliIfNeeded);
|
||||
// TODO: Check hash of download
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-fs-filename
|
||||
return [4 /*yield*/, pipeline(got_1.default.stream(url), fs_1.default.createWriteStream(outPath)).catch(function (e) {
|
||||
try {
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.unlinkSync(outPath);
|
||||
}
|
||||
catch (_a) { }
|
||||
throw e;
|
||||
})
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
];
|
||||
case 1:
|
||||
// TODO: Check hash of download
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-fs-filename
|
||||
_a.sent();
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
downloads[url] = true;
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.chmodSync(outPath, 448);
|
||||
console.log('Download Complete');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function downloadCli() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var version, platform, extension, outPath;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
version = tauriCliManifest.package.version;
|
||||
platform = process.platform;
|
||||
if (platform === 'win32') {
|
||||
platform = 'windows';
|
||||
}
|
||||
else if (platform === 'linux') {
|
||||
platform = 'linux';
|
||||
}
|
||||
else if (platform === 'darwin') {
|
||||
platform = 'macos';
|
||||
}
|
||||
else {
|
||||
throw Error('Unsupported platform');
|
||||
}
|
||||
extension = platform === 'windows' ? '.exe' : '';
|
||||
outPath = path_1.default.join(__dirname, "../../bin/tauri-cli" + extension);
|
||||
console.log('Downloading Rust CLI...');
|
||||
return [4 /*yield*/, downloadBinaryRelease("tauri-cli-v" + version, "tauri-cli_" + platform + extension, outPath)];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.downloadCli = downloadCli;
|
||||
function downloadRustup() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var assetName;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
assetName = process.platform === 'win32' ? 'rustup-init.exe' : 'rustup-init.sh';
|
||||
console.log('Downloading Rustup...');
|
||||
return [4 /*yield*/, downloadBinaryRelease('rustup', assetName, path_1.default.join(__dirname, "../../bin/" + assetName))];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.downloadRustup = downloadRustup;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "fs":
|
||||
/*!*********************!*\
|
||||
!*** external "fs" ***!
|
||||
\*********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("fs");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "got":
|
||||
/*!**********************!*\
|
||||
!*** external "got" ***!
|
||||
\**********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("got");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "path":
|
||||
/*!***********************!*\
|
||||
!*** external "path" ***!
|
||||
\***********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("path");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "stream":
|
||||
/*!*************************!*\
|
||||
!*** external "stream" ***!
|
||||
\*************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("stream");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "util":
|
||||
/*!***********************!*\
|
||||
!*** external "util" ***!
|
||||
\***********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("util");;
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module is referenced by other modules so it can't be inlined
|
||||
/******/ var __webpack_exports__ = __webpack_require__("./src/helpers/download-binary.ts");
|
||||
/******/
|
||||
/******/ return __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
});
|
||||
//# sourceMappingURL=download-binary.js.map
|
1
tooling/cli.js/dist/helpers/download-binary.js.map
vendored
Normal file
1
tooling/cli.js/dist/helpers/download-binary.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
655
tooling/cli.js/dist/helpers/rust-cli.js
vendored
Normal file
655
tooling/cli.js/dist/helpers/rust-cli.js
vendored
Normal file
@ -0,0 +1,655 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["tauri"] = factory();
|
||||
else
|
||||
root["tauri"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (() => { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "../cli.rs/Cargo.toml":
|
||||
/*!****************************!*\
|
||||
!*** ../cli.rs/Cargo.toml ***!
|
||||
\****************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = {
|
||||
"workspace": {},
|
||||
"package": {
|
||||
"name": "tauri-cli",
|
||||
"version": "1.0.0-beta.5",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"edition": "2018",
|
||||
"categories": [
|
||||
"gui",
|
||||
"web-programming"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"homepage": "https://tauri.studio",
|
||||
"repository": "https://github.com/tauri-apps/tauri",
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"include": [
|
||||
"src/",
|
||||
"/templates",
|
||||
"MergeModules/",
|
||||
"*.json",
|
||||
"*.rs"
|
||||
]
|
||||
},
|
||||
"bin": [
|
||||
{
|
||||
"name": "cargo-tauri",
|
||||
"path": "src/main.rs"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"clap": {
|
||||
"version": "3.0.0-beta.2",
|
||||
"features": [
|
||||
"yaml"
|
||||
]
|
||||
},
|
||||
"anyhow": "1.0",
|
||||
"tauri-bundler": {
|
||||
"version": "1.0.0-beta.3",
|
||||
"path": "../bundler"
|
||||
},
|
||||
"colored": "2.0",
|
||||
"once_cell": "1.8",
|
||||
"serde": {
|
||||
"version": "1.0",
|
||||
"features": [
|
||||
"derive"
|
||||
]
|
||||
},
|
||||
"serde_json": "1.0",
|
||||
"serde_with": "1.9",
|
||||
"notify": "4.0",
|
||||
"shared_child": "0.3",
|
||||
"toml_edit": "0.2",
|
||||
"json-patch": "0.2",
|
||||
"schemars": "0.8",
|
||||
"toml": "0.5",
|
||||
"valico": "3.6",
|
||||
"handlebars": "4.1",
|
||||
"include_dir": "0.6",
|
||||
"minisign": "0.6",
|
||||
"base64": "0.13.0",
|
||||
"ureq": "2.1",
|
||||
"os_info": "3.0",
|
||||
"semver": "1.0",
|
||||
"regex": "1.5",
|
||||
"lazy_static": "1",
|
||||
"libc": "0.2",
|
||||
"terminal_size": "0.1",
|
||||
"unicode-width": "0.1",
|
||||
"tempfile": "3",
|
||||
"zeroize": "1.3"
|
||||
},
|
||||
"target": {
|
||||
"cfg(windows)": {
|
||||
"dependencies": {
|
||||
"winapi": {
|
||||
"version": "0.3",
|
||||
"features": [
|
||||
"winbase",
|
||||
"winuser",
|
||||
"consoleapi",
|
||||
"processenv",
|
||||
"wincon"
|
||||
]
|
||||
},
|
||||
"encode_unicode": "0.3"
|
||||
}
|
||||
},
|
||||
"cfg(target_os = \"linux\")": {
|
||||
"dependencies": {
|
||||
"heck": "0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"build-dependencies": {
|
||||
"schemars": "0.8",
|
||||
"serde": {
|
||||
"version": "1.0",
|
||||
"features": [
|
||||
"derive"
|
||||
]
|
||||
},
|
||||
"serde_json": "1.0",
|
||||
"serde_with": "1.9"
|
||||
}
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/download-binary.ts":
|
||||
/*!****************************************!*\
|
||||
!*** ./src/helpers/download-binary.ts ***!
|
||||
\****************************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.downloadRustup = exports.downloadCli = void 0;
|
||||
var stream_1 = __importDefault(__webpack_require__(/*! stream */ "stream"));
|
||||
var util_1 = __webpack_require__(/*! util */ "util");
|
||||
var fs_1 = __importDefault(__webpack_require__(/*! fs */ "fs"));
|
||||
var got_1 = __importDefault(__webpack_require__(/*! got */ "got"));
|
||||
var path_1 = __importDefault(__webpack_require__(/*! path */ "path"));
|
||||
var pipeline = util_1.promisify(stream_1.default.pipeline);
|
||||
// Webpack reads the file at build-time, so this becomes a static var
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
|
||||
var tauriCliManifest = __webpack_require__(/*! ../../../cli.rs/Cargo.toml */ "../cli.rs/Cargo.toml");
|
||||
var downloads = {};
|
||||
function downloadBinaryRelease(tag, asset, outPath) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var url, removeDownloadedCliIfNeeded;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
url = "https://github.com/tauri-apps/binary-releases/releases/download/" + tag + "/" + asset;
|
||||
removeDownloadedCliIfNeeded = function () {
|
||||
try {
|
||||
if (!(url in downloads)) {
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.unlinkSync(outPath);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
process.exit();
|
||||
}
|
||||
};
|
||||
// on exit, we remove the `tauri-cli` file if the download didn't complete
|
||||
process.on('exit', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGINT', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGTERM', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGHUP', removeDownloadedCliIfNeeded);
|
||||
process.on('SIGBREAK', removeDownloadedCliIfNeeded);
|
||||
// TODO: Check hash of download
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-fs-filename
|
||||
return [4 /*yield*/, pipeline(got_1.default.stream(url), fs_1.default.createWriteStream(outPath)).catch(function (e) {
|
||||
try {
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.unlinkSync(outPath);
|
||||
}
|
||||
catch (_a) { }
|
||||
throw e;
|
||||
})
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
];
|
||||
case 1:
|
||||
// TODO: Check hash of download
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-fs-filename
|
||||
_a.sent();
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
downloads[url] = true;
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs_1.default.chmodSync(outPath, 448);
|
||||
console.log('Download Complete');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function downloadCli() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var version, platform, extension, outPath;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
version = tauriCliManifest.package.version;
|
||||
platform = process.platform;
|
||||
if (platform === 'win32') {
|
||||
platform = 'windows';
|
||||
}
|
||||
else if (platform === 'linux') {
|
||||
platform = 'linux';
|
||||
}
|
||||
else if (platform === 'darwin') {
|
||||
platform = 'macos';
|
||||
}
|
||||
else {
|
||||
throw Error('Unsupported platform');
|
||||
}
|
||||
extension = platform === 'windows' ? '.exe' : '';
|
||||
outPath = path_1.default.join(__dirname, "../../bin/tauri-cli" + extension);
|
||||
console.log('Downloading Rust CLI...');
|
||||
return [4 /*yield*/, downloadBinaryRelease("tauri-cli-v" + version, "tauri-cli_" + platform + extension, outPath)];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.downloadCli = downloadCli;
|
||||
function downloadRustup() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var assetName;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
assetName = process.platform === 'win32' ? 'rustup-init.exe' : 'rustup-init.sh';
|
||||
console.log('Downloading Rustup...');
|
||||
return [4 /*yield*/, downloadBinaryRelease('rustup', assetName, path_1.default.join(__dirname, "../../bin/" + assetName))];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.downloadRustup = downloadRustup;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/logger.ts":
|
||||
/*!*******************************!*\
|
||||
!*** ./src/helpers/logger.ts ***!
|
||||
\*******************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
|
||||
var ms_1 = __importDefault(__webpack_require__(/*! ms */ "ms"));
|
||||
var prevTime;
|
||||
exports.default = (function (banner, color) {
|
||||
if (color === void 0) { color = chalk_1.default.green; }
|
||||
return function (msg) {
|
||||
var curr = +new Date();
|
||||
var diff = curr - (prevTime || curr);
|
||||
prevTime = curr;
|
||||
if (msg) {
|
||||
console.log(
|
||||
// TODO: proper typings for color and banner
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
|
||||
" " + color(String(banner)) + " " + msg + " " + chalk_1.default.green("+" + ms_1.default(diff)));
|
||||
}
|
||||
else {
|
||||
console.log();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/rust-cli.ts":
|
||||
/*!*********************************!*\
|
||||
!*** ./src/helpers/rust-cli.ts ***!
|
||||
\*********************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.runOnRustCli = void 0;
|
||||
var fs_1 = __webpack_require__(/*! fs */ "fs");
|
||||
var path_1 = __webpack_require__(/*! path */ "path");
|
||||
var spawn_1 = __webpack_require__(/*! ./spawn */ "./src/helpers/spawn.ts");
|
||||
var download_binary_1 = __webpack_require__(/*! ./download-binary */ "./src/helpers/download-binary.ts");
|
||||
var currentTauriCliVersion = function () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
var tauriCliManifest =
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
__webpack_require__(/*! ../../../cli.rs/Cargo.toml */ "../cli.rs/Cargo.toml");
|
||||
return tauriCliManifest.package.version;
|
||||
};
|
||||
function runOnRustCli(command, args) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var targetPath, targetCliPath, resolveCb, rejectCb, pid, promise, onClose, cliPath, localCliPath;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
targetPath = path_1.resolve(__dirname, '../..');
|
||||
targetCliPath = path_1.join(targetPath, 'bin/tauri-cli' + (process.platform === 'win32' ? '.exe' : ''));
|
||||
promise = new Promise(function (resolve, reject) {
|
||||
resolveCb = resolve;
|
||||
rejectCb = function () { return reject(new Error()); };
|
||||
});
|
||||
onClose = function (code, pid) {
|
||||
if (code === 0) {
|
||||
resolveCb();
|
||||
}
|
||||
else {
|
||||
rejectCb();
|
||||
}
|
||||
};
|
||||
if (!fs_1.existsSync(targetCliPath)) return [3 /*break*/, 1];
|
||||
pid = spawn_1.spawn(targetCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
return [3 /*break*/, 4];
|
||||
case 1:
|
||||
if (true) return [3 /*break*/, 3];
|
||||
return [4 /*yield*/, download_binary_1.downloadCli()];
|
||||
case 2:
|
||||
_a.sent();
|
||||
pid = spawn_1.spawn(targetCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
if (fs_1.existsSync(path_1.resolve(targetPath, '../bundler'))) {
|
||||
cliPath = path_1.resolve(targetPath, '../cli.rs');
|
||||
spawn_1.spawnSync('cargo', ['build', '--release'], cliPath);
|
||||
localCliPath = path_1.resolve(targetPath, '../cli.rs/target/release/cargo-tauri');
|
||||
pid = spawn_1.spawn(localCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
}
|
||||
else {
|
||||
spawn_1.spawnSync('cargo', [
|
||||
'install',
|
||||
'--root',
|
||||
targetPath,
|
||||
'tauri-cli',
|
||||
'--version',
|
||||
currentTauriCliVersion()
|
||||
], process.cwd());
|
||||
pid = spawn_1.spawn(targetCliPath, __spreadArray(['tauri', command], args), process.cwd(), onClose);
|
||||
}
|
||||
_a.label = 4;
|
||||
case 4: return [2 /*return*/, { pid: pid, promise: promise }];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.runOnRustCli = runOnRustCli;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/spawn.ts":
|
||||
/*!******************************!*\
|
||||
!*** ./src/helpers/spawn.ts ***!
|
||||
\******************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.spawnSync = exports.spawn = void 0;
|
||||
var cross_spawn_1 = __importDefault(__webpack_require__(/*! cross-spawn */ "cross-spawn"));
|
||||
var logger_1 = __importDefault(__webpack_require__(/*! ./logger */ "./src/helpers/logger.ts"));
|
||||
var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
|
||||
var log = logger_1.default('app:spawn');
|
||||
var warn = logger_1.default('app:spawn', chalk_1.default.red);
|
||||
/*
|
||||
Returns pid, takes onClose
|
||||
*/
|
||||
var spawn = function (cmd, params, cwd, onClose) {
|
||||
var _a;
|
||||
log("Running \"" + cmd + " " + params.join(' ') + "\"");
|
||||
log();
|
||||
// TODO: move to execa?
|
||||
var runner = cross_spawn_1.default(cmd, params, {
|
||||
stdio: 'inherit',
|
||||
cwd: cwd,
|
||||
env: process.env
|
||||
});
|
||||
runner.on('close', function (code) {
|
||||
var _a;
|
||||
log();
|
||||
if (code) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log("Command \"" + cmd + "\" failed with exit code: " + code);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
onClose && onClose(code !== null && code !== void 0 ? code : 0, (_a = runner.pid) !== null && _a !== void 0 ? _a : 0);
|
||||
});
|
||||
return (_a = runner.pid) !== null && _a !== void 0 ? _a : 0;
|
||||
};
|
||||
exports.spawn = spawn;
|
||||
/*
|
||||
Returns nothing, takes onFail
|
||||
*/
|
||||
var spawnSync = function (cmd, params, cwd, onFail) {
|
||||
log("[sync] Running \"" + cmd + " " + params.join(' ') + "\"");
|
||||
log();
|
||||
var runner = cross_spawn_1.default.sync(cmd, params, {
|
||||
stdio: 'inherit',
|
||||
cwd: cwd
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
if (runner.status || runner.error) {
|
||||
warn();
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
warn("\u26A0\uFE0F Command \"" + cmd + "\" failed with exit code: " + runner.status);
|
||||
if (runner.status === null) {
|
||||
warn("\u26A0\uFE0F Please globally install \"" + cmd + "\"");
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
onFail && onFail();
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
exports.spawnSync = spawnSync;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "chalk":
|
||||
/*!************************!*\
|
||||
!*** external "chalk" ***!
|
||||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("chalk");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "cross-spawn":
|
||||
/*!******************************!*\
|
||||
!*** external "cross-spawn" ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("cross-spawn");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "fs":
|
||||
/*!*********************!*\
|
||||
!*** external "fs" ***!
|
||||
\*********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("fs");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "got":
|
||||
/*!**********************!*\
|
||||
!*** external "got" ***!
|
||||
\**********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("got");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "ms":
|
||||
/*!*********************!*\
|
||||
!*** external "ms" ***!
|
||||
\*********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("ms");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "path":
|
||||
/*!***********************!*\
|
||||
!*** external "path" ***!
|
||||
\***********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("path");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "stream":
|
||||
/*!*************************!*\
|
||||
!*** external "stream" ***!
|
||||
\*************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("stream");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "util":
|
||||
/*!***********************!*\
|
||||
!*** external "util" ***!
|
||||
\***********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("util");;
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module is referenced by other modules so it can't be inlined
|
||||
/******/ var __webpack_exports__ = __webpack_require__("./src/helpers/rust-cli.ts");
|
||||
/******/
|
||||
/******/ return __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
});
|
||||
//# sourceMappingURL=rust-cli.js.map
|
1
tooling/cli.js/dist/helpers/rust-cli.js.map
vendored
Normal file
1
tooling/cli.js/dist/helpers/rust-cli.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
194
tooling/cli.js/dist/helpers/spawn.js
vendored
Normal file
194
tooling/cli.js/dist/helpers/spawn.js
vendored
Normal file
@ -0,0 +1,194 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["tauri"] = factory();
|
||||
else
|
||||
root["tauri"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "./src/helpers/logger.ts":
|
||||
/*!*******************************!*\
|
||||
!*** ./src/helpers/logger.ts ***!
|
||||
\*******************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
|
||||
var ms_1 = __importDefault(__webpack_require__(/*! ms */ "ms"));
|
||||
var prevTime;
|
||||
exports.default = (function (banner, color) {
|
||||
if (color === void 0) { color = chalk_1.default.green; }
|
||||
return function (msg) {
|
||||
var curr = +new Date();
|
||||
var diff = curr - (prevTime || curr);
|
||||
prevTime = curr;
|
||||
if (msg) {
|
||||
console.log(
|
||||
// TODO: proper typings for color and banner
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
|
||||
" " + color(String(banner)) + " " + msg + " " + chalk_1.default.green("+" + ms_1.default(diff)));
|
||||
}
|
||||
else {
|
||||
console.log();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/helpers/spawn.ts":
|
||||
/*!******************************!*\
|
||||
!*** ./src/helpers/spawn.ts ***!
|
||||
\******************************/
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.spawnSync = exports.spawn = void 0;
|
||||
var cross_spawn_1 = __importDefault(__webpack_require__(/*! cross-spawn */ "cross-spawn"));
|
||||
var logger_1 = __importDefault(__webpack_require__(/*! ./logger */ "./src/helpers/logger.ts"));
|
||||
var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
|
||||
var log = logger_1.default('app:spawn');
|
||||
var warn = logger_1.default('app:spawn', chalk_1.default.red);
|
||||
/*
|
||||
Returns pid, takes onClose
|
||||
*/
|
||||
var spawn = function (cmd, params, cwd, onClose) {
|
||||
var _a;
|
||||
log("Running \"" + cmd + " " + params.join(' ') + "\"");
|
||||
log();
|
||||
// TODO: move to execa?
|
||||
var runner = cross_spawn_1.default(cmd, params, {
|
||||
stdio: 'inherit',
|
||||
cwd: cwd,
|
||||
env: process.env
|
||||
});
|
||||
runner.on('close', function (code) {
|
||||
var _a;
|
||||
log();
|
||||
if (code) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log("Command \"" + cmd + "\" failed with exit code: " + code);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
onClose && onClose(code !== null && code !== void 0 ? code : 0, (_a = runner.pid) !== null && _a !== void 0 ? _a : 0);
|
||||
});
|
||||
return (_a = runner.pid) !== null && _a !== void 0 ? _a : 0;
|
||||
};
|
||||
exports.spawn = spawn;
|
||||
/*
|
||||
Returns nothing, takes onFail
|
||||
*/
|
||||
var spawnSync = function (cmd, params, cwd, onFail) {
|
||||
log("[sync] Running \"" + cmd + " " + params.join(' ') + "\"");
|
||||
log();
|
||||
var runner = cross_spawn_1.default.sync(cmd, params, {
|
||||
stdio: 'inherit',
|
||||
cwd: cwd
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
if (runner.status || runner.error) {
|
||||
warn();
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
warn("\u26A0\uFE0F Command \"" + cmd + "\" failed with exit code: " + runner.status);
|
||||
if (runner.status === null) {
|
||||
warn("\u26A0\uFE0F Please globally install \"" + cmd + "\"");
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
onFail && onFail();
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
exports.spawnSync = spawnSync;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "chalk":
|
||||
/*!************************!*\
|
||||
!*** external "chalk" ***!
|
||||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("chalk");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "cross-spawn":
|
||||
/*!******************************!*\
|
||||
!*** external "cross-spawn" ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("cross-spawn");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "ms":
|
||||
/*!*********************!*\
|
||||
!*** external "ms" ***!
|
||||
\*********************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("ms");;
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module is referenced by other modules so it can't be inlined
|
||||
/******/ var __webpack_exports__ = __webpack_require__("./src/helpers/spawn.ts");
|
||||
/******/
|
||||
/******/ return __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
});
|
||||
//# sourceMappingURL=spawn.js.map
|
1
tooling/cli.js/dist/helpers/spawn.js.map
vendored
Normal file
1
tooling/cli.js/dist/helpers/spawn.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,55 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
|
||||
env: {
|
||||
node: true,
|
||||
jest: true
|
||||
},
|
||||
|
||||
parser: '@typescript-eslint/parser',
|
||||
ignorePatterns: ['.eslintrc.js', '*.config.js', 'test', 'bin'],
|
||||
extends: [
|
||||
'standard-with-typescript',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
'plugin:lodash-template/recommended',
|
||||
// TODO: make this work with typescript
|
||||
// 'plugin:node/recommended'
|
||||
'prettier'
|
||||
],
|
||||
|
||||
plugins: ['@typescript-eslint', 'node', 'security'],
|
||||
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
},
|
||||
|
||||
globals: {
|
||||
__statics: true,
|
||||
process: true
|
||||
},
|
||||
|
||||
// add your custom rules here
|
||||
rules: {
|
||||
// allow console.log during development only
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
// allow debugger during development only
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
'no-process-exit': 'off',
|
||||
'security/detect-non-literal-fs-filename': 'warn',
|
||||
'security/detect-unsafe-regex': 'error',
|
||||
'security/detect-buffer-noassert': 'error',
|
||||
'security/detect-child-process': 'warn',
|
||||
'security/detect-disable-mustache-escape': 'error',
|
||||
'security/detect-eval-with-expression': 'error',
|
||||
'security/detect-no-csrf-before-method-override': 'error',
|
||||
'security/detect-non-literal-regexp': 'error',
|
||||
'security/detect-non-literal-require': 'warn',
|
||||
'security/detect-object-injection': 'warn',
|
||||
'security/detect-possible-timing-attacks': 'error',
|
||||
'security/detect-pseudoRandomBytes': 'error',
|
||||
'space-before-function-paren': 'off',
|
||||
'@typescript-eslint/default-param-last': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': 0
|
||||
}
|
||||
}
|
64
tooling/create-tauri-app/.gitignore
vendored
64
tooling/create-tauri-app/.gitignore
vendored
@ -1,64 +0,0 @@
|
||||
# Build output
|
||||
/dist
|
||||
|
||||
# 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
|
@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
singleQuote: true,
|
||||
semi: false,
|
||||
trailingComma: 'none'
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## \[1.0.0-rc.2]
|
||||
|
||||
- Fix crash when using `create-react-app` recipe.
|
||||
- [c0103604](https://www.github.com/tauri-apps/tauri/commit/c01036043dcec52ba360fc38268b8b4ae4c470a1) fix(cta): fix cli install with other deps, fixes [#3417](https://www.github.com/tauri-apps/tauri/pull/3417) ([#3420](https://www.github.com/tauri-apps/tauri/pull/3420)) on 2022-02-12
|
||||
|
||||
## \[1.0.0-rc.1]
|
||||
|
||||
- Fix `create-tauri-app` failing to bootstrap projects.
|
||||
- [536c0cd7](https://www.github.com/tauri-apps/tauri/commit/536c0cd7d40b838765016e1554901dea8720d9af) fix(cta): filter out empty args, fixes [#3393](https://www.github.com/tauri-apps/tauri/pull/3393) ([#3396](https://www.github.com/tauri-apps/tauri/pull/3396)) on 2022-02-11
|
||||
|
||||
## \[1.0.0-rc.0]
|
||||
|
||||
- Add empty description to Cargo.toml in dominator recipe.
|
||||
- [97edb3ac](https://www.github.com/tauri-apps/tauri/commit/97edb3ac49d59c5c95ad8486c17b3c333f4f86a2) Fix: [#2508](https://www.github.com/tauri-apps/tauri/pull/2508). Update dominator recipe description. ([#2514](https://www.github.com/tauri-apps/tauri/pull/2514)) on 2021-08-24
|
||||
- `create-tauri-app` should now be fully compatiable with CI environments.
|
||||
- [f5e77ff4](https://www.github.com/tauri-apps/tauri/commit/f5e77ff48f00e14476f95cce257d091377ba987c) refactor(cta): use `commander` instead of `minimst` ([#2551](https://www.github.com/tauri-apps/tauri/pull/2551)) on 2022-01-01
|
||||
- Stop react recipe from opening in browser by default.
|
||||
- [ea51504e](https://www.github.com/tauri-apps/tauri/commit/ea51504e3a57eedc28e40573fbcc899b8a5c358c) fix(cta): stop react recipe from opening in browser, closes [#2793](https://www.github.com/tauri-apps/tauri/pull/2793) ([#2988](https://www.github.com/tauri-apps/tauri/pull/2988)) on 2021-11-30
|
||||
- Add SolidJS recipe using the official template.
|
||||
- [71ea86a4](https://www.github.com/tauri-apps/tauri/commit/71ea86a443f2585fa98edd79f2361bd85b380f0c) feat(cta): add SolidJS recipe ([#2619](https://www.github.com/tauri-apps/tauri/pull/2619)) on 2021-09-22
|
||||
|
||||
## \[1.0.0-beta.4]
|
||||
|
||||
- [`pnpm`](https://pnpm.io) package manager is now officially supported, either run `pnpx create-tauri-app` or explicitly specifiy it `npx create-tauri-app --manager pnpm`.
|
||||
- [235e0f67](https://www.github.com/tauri-apps/tauri/commit/235e0f6785b87dc83cc6ebb6f5b022a82fa18eec) feat(CTA): add official support for `pnpm` package manager ([#2348](https://www.github.com/tauri-apps/tauri/pull/2348)) on 2021-08-06
|
||||
- `create-tauri-app` will prompt users to install `@tauri-apps/api` npm package.
|
||||
- [c0f42ad0](https://www.github.com/tauri-apps/tauri/commit/c0f42ad0e3d30623b83cfcd692eb1bcb4c4391a2) feat(cta): prompt users to install `@tauri-apps/api` package ([#2251](https://www.github.com/tauri-apps/tauri/pull/2251)) on 2021-07-29
|
||||
- Add Svelte recipe using the official template.
|
||||
- [151c3157](https://www.github.com/tauri-apps/tauri/commit/151c3157bef28c267592ebdf717e4ff66a5b27e1) Add svelte recipe to create-tauri-app ([#2276](https://www.github.com/tauri-apps/tauri/pull/2276)) ([#2279](https://www.github.com/tauri-apps/tauri/pull/2279)) on 2021-07-22
|
||||
- Adjust check for `dev` mode and switch CTA test to a script runner. The script gives us more control and better output into any failures.
|
||||
- [c410e034](https://www.github.com/tauri-apps/tauri/commit/c410e034f74d0624c8465b1f30bb7af58eb98b34) convert jest tests to child_process run script ([#2308](https://www.github.com/tauri-apps/tauri/pull/2308)) on 2021-08-08
|
||||
- Update vite recipe to use the new vite npm [package](https://github.com/vitejs/vite/tree/main/packages/create-vite).
|
||||
- [718d9513](https://www.github.com/tauri-apps/tauri/commit/718d9513ce8013594a21c7fedb2dcb3dcd7bbad8) refactor(cta): update `vite` recipe to use their new npm package ([#2220](https://www.github.com/tauri-apps/tauri/pull/2220)) on 2021-07-29
|
||||
|
||||
## \[1.0.0-beta.3]
|
||||
|
||||
- Added Angular CLI recipe.
|
||||
- [489fad55](https://www.github.com/tauri-apps/tauri/commit/489fad55242b3489c7c551fdfdd031ebad2d9b9c) Angular create tauri app \[[#1934](https://www.github.com/tauri-apps/tauri/pull/1934)] ([#2203](https://www.github.com/tauri-apps/tauri/pull/2203)) on 2021-07-14
|
||||
|
||||
## \[1.0.0-beta.2]
|
||||
|
||||
- Fixes the `beforeDevCommand` on vite recipe.
|
||||
- [3c21ddc7](https://www.github.com/tauri-apps/tauri/commit/3c21ddc73cd7ab8141b730ceade46fc2dfadd996) fix(cta): use correct `beforeDevCommand` for vite recipe ([#1931](https://www.github.com/tauri-apps/tauri/pull/1931)) on 2021-06-01
|
||||
|
||||
## \[1.0.0-beta.1]
|
||||
|
||||
- Work around bugs between esbuild and npm by installing directly at the end of the sequence. Also default to using the latest on all of the installs instead of npx's cache.
|
||||
- [8a164d0](https://www.github.com/tauri-apps/tauri/commit/8a164d0a1f8eb69bdcec7ae4362d26b2f3c7ff55) fix: CTA cache and vite build ([#1806](https://www.github.com/tauri-apps/tauri/pull/1806)) on 2021-05-12
|
||||
|
||||
## \[1.0.0-beta.0]
|
||||
|
||||
- Explicitly install deps after a vite recipe.
|
||||
- [397b7af](https://www.github.com/tauri-apps/tauri/commit/397b7af395a213bf826aa52398467b7b3352b666) chore: CTA defaults in CI mode ([#1671](https://www.github.com/tauri-apps/tauri/pull/1671)) on 2021-05-05
|
||||
- Shift everything out of the `bin` and into `.ts` so we can apply Typescript types.
|
||||
- [c3acbd6](https://www.github.com/tauri-apps/tauri/commit/c3acbd68ec169188c782cbaf7d100d80b3a4f39a) chore: shift CTA from bin to .ts ([#1651](https://www.github.com/tauri-apps/tauri/pull/1651)) on 2021-04-29
|
||||
- We setup an e2e type test suite for CTA. It is mostly an internal change, but should help with stability moving forward.
|
||||
- [af6411d](https://www.github.com/tauri-apps/tauri/commit/af6411d5f8c9fd1c3d9b4f3c2d79e8f1bd0efbf2) feat: setup testing for CTA ([#1615](https://www.github.com/tauri-apps/tauri/pull/1615)) on 2021-04-27
|
||||
- Add support for all vite templates
|
||||
- [cea3ba9](https://www.github.com/tauri-apps/tauri/commit/cea3ba9f97de9d0181a84ad085a852517bd33a65) feat(cta): add support for all vite templates ([#1670](https://www.github.com/tauri-apps/tauri/pull/1670)) on 2021-05-07
|
||||
- Add a welcome prompt to let the user know about the process and links to more info including prerequisite setup steps. Also add links to each of the templates to give the user more context what they are getting into.
|
||||
- [ea28d01](https://www.github.com/tauri-apps/tauri/commit/ea28d0169168953e11416231e50b08061413a27e) create-tauri-app welcome prompt and recipes links ([#1748](https://www.github.com/tauri-apps/tauri/pull/1748)) on 2021-05-09
|
||||
|
||||
## \[1.0.0-beta-rc.4]
|
||||
|
||||
- Manually set `tauri` script instead of using `npm set-script` for compatabilty with older npm versions
|
||||
- [f708ff8](https://www.github.com/tauri-apps/tauri/commit/f708ff824e7933341536aecb49f6ee35eea621da) fix(CTA): [#1569](https://www.github.com/tauri-apps/tauri/pull/1569), manually set tauri script for compatability with older npm ([#1572](https://www.github.com/tauri-apps/tauri/pull/1572)) on 2021-04-22
|
||||
|
||||
## \[1.0.0-beta-rc.3]
|
||||
|
||||
- Remove `lodash` dependency and replace with es6 builtins
|
||||
- [edab7a6](https://www.github.com/tauri-apps/tauri/commit/edab7a66864d21b51694bf8771d21627b526c2b9) chore(deps): remove lodash from create-tauri-app ([#1532](https://www.github.com/tauri-apps/tauri/pull/1532)) on 2021-04-18
|
||||
- Remove `tauri` dependency from vanilla recipe
|
||||
- [3998046](https://www.github.com/tauri-apps/tauri/commit/399804648924139c6240351a76812a3071b51f65) fix(cta): remove `tauri` dep from vanilla recipe ([#1502](https://www.github.com/tauri-apps/tauri/pull/1502)) on 2021-04-15
|
||||
- Fix adding `tauri` script to package.json
|
||||
- [6c00e88](https://www.github.com/tauri-apps/tauri/commit/6c00e88e0ffa10eb7eecc312d66c5dde7dc03d0b) fix(cta): fix adding `tauri` script to package.json ([#1501](https://www.github.com/tauri-apps/tauri/pull/1501)) on 2021-04-15
|
||||
- [345f2db](https://www.github.com/tauri-apps/tauri/commit/345f2dbfc545427750c08351d1b98e966b2436c0) Apply Version Updates From Current Changes ([#1499](https://www.github.com/tauri-apps/tauri/pull/1499)) on 2021-04-14
|
||||
- [098b729](https://www.github.com/tauri-apps/tauri/commit/098b729e677dc5dc322f22a6cbd5a652a8dfa1b0) chore: CTA version was decremented, fix and adjust changelog to compensate ([#1530](https://www.github.com/tauri-apps/tauri/pull/1530)) on 2021-04-18
|
||||
|
||||
## \[1.0.0-beta-rc.2]
|
||||
|
||||
- CTA also needs the template directory published as it doesn't get bundled into the `dist` directory.
|
||||
- [7b6108e](https://www.github.com/tauri-apps/tauri/commit/7b6108e37be652a1efa4018fc1908aa0a2cdacd6) fix: cta templates dir missing ([#1496](https://www.github.com/tauri-apps/tauri/pull/1496)) on 2021-04-14
|
||||
|
||||
## \[1.0.0-beta-rc.1]
|
||||
|
||||
- CTA was missing the `files` property in the package.json which mean that the `dist` directory was not published and used.
|
||||
- [414f9a7](https://www.github.com/tauri-apps/tauri/commit/414f9a78c9b636933fd741d1b6fe7f097f496fc9) fix: cta dist publish ([#1493](https://www.github.com/tauri-apps/tauri/pull/1493)) on 2021-04-14
|
||||
|
||||
## \[1.0.0-beta-rc.0]
|
||||
|
||||
- Add vanilla javascript option to `create-tauri-app` through templating.
|
||||
- [c580338](https://www.github.com/tauri-apps/tauri/commit/c580338f07b71551f7fd2712e13ad0acef100095) feat(cli): add create-tauri-app ([#1106](https://www.github.com/tauri-apps/tauri/pull/1106)) on 2021-03-07
|
||||
- Use a test based on an npm env var to determine which package manager to use.
|
||||
- [6e0598c](https://www.github.com/tauri-apps/tauri/commit/6e0598c807ce02a3964788c06ec1025abc1fb250) feat: derive package manager from env var on 2021-04-12
|
||||
- Add initial `vite` support starting with `vue` and `vue-ts`
|
||||
- [80b7bd7](https://www.github.com/tauri-apps/tauri/commit/80b7bd7de86f59e0cafaa0efdc6e82a0db7d7ba2) feat(CTA): add initial vite support with `vue` and `vue-ts` ([#1467](https://www.github.com/tauri-apps/tauri/pull/1467)) on 2021-04-13
|
||||
- Revert `tauri create` deletion and shift remaining pieces that weren't deleted to `create-tauri-app`.
|
||||
- [4ec20a4](https://www.github.com/tauri-apps/tauri/commit/4ec20a4a28823614186365c5a90512d77170cff2) feat: shift tauri create \[not wired up] ([#1330](https://www.github.com/tauri-apps/tauri/pull/1330)) on 2021-03-07
|
||||
- [aea6145](https://www.github.com/tauri-apps/tauri/commit/aea614587bddab930d552512b54e18624fbf573e) refactor(repo): add /tooling folder ([#1457](https://www.github.com/tauri-apps/tauri/pull/1457)) on 2021-04-12
|
@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const { createTauriApp } = require('../dist/')
|
||||
|
||||
createTauriApp(process.argv.slice(2)).catch((err) => {
|
||||
console.error(err)
|
||||
})
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
modulePathIgnorePatterns: ['__fixtures__'],
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: 'tsconfig.json'
|
||||
}
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
{
|
||||
"name": "create-tauri-app",
|
||||
"version": "1.0.0-rc.2",
|
||||
"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 OR Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"main": "bin/create-tauri-app.js",
|
||||
"files": [
|
||||
"bin",
|
||||
"dist",
|
||||
"src/templates"
|
||||
],
|
||||
"scripts": {
|
||||
"create-tauri-app": "create-tauri-app",
|
||||
"build": "rollup --config",
|
||||
"prepublishOnly": "yarn build",
|
||||
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
||||
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
||||
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
||||
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||
"test": "node ./test/spawn.test.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "4.1.2",
|
||||
"commander": "8.3.0",
|
||||
"execa": "5.1.1",
|
||||
"inquirer": "8.2.0",
|
||||
"scaffe": "1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effection/process": "2.0.4",
|
||||
"@rollup/plugin-commonjs": "21.0.1",
|
||||
"@rollup/plugin-node-resolve": "13.1.3",
|
||||
"@rollup/plugin-typescript": "8.3.0",
|
||||
"@types/cross-spawn": "6.0.2",
|
||||
"@types/inquirer": "8.2.0",
|
||||
"@types/semver": "7.3.9",
|
||||
"@typescript-eslint/eslint-plugin": "5.12.0",
|
||||
"@typescript-eslint/parser": "5.12.0",
|
||||
"effection": "2.0.4",
|
||||
"eslint": "8.9.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-config-standard-with-typescript": "21.0.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-lodash-template": "0.19.0",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "5.2.0",
|
||||
"eslint-plugin-security": "1.4.0",
|
||||
"prettier": "2.5.1",
|
||||
"rollup": "2.67.2",
|
||||
"temp-dir": "2.0.0",
|
||||
"tslib": "2.3.1",
|
||||
"typescript": "4.5.5"
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
# create-tauri-app
|
||||
|
||||
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" height="128" width="128">
|
||||
|
||||
[![status](https://img.shields.io/badge/Status-Beta-green.svg)](https://github.com/tauri-apps/tauri)
|
||||
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
|
||||
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
|
||||
|
||||
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library
|
||||
)
|
||||
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.studio)
|
||||
|
||||
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
|
||||
[![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri)
|
||||
|
||||
| Component | Version |
|
||||
| --------- | ------------------------------------------- |
|
||||
| create-tauri-app | ![](https://img.shields.io/npm/v/create-tauri-app.svg) |
|
||||
|
||||
## About Tauri
|
||||
Tauri is a polyglot and generic system that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily.
|
||||
|
||||
Tauri apps can have custom menus and have tray-type interfaces. They can be updated, and are managed by the user's operating system as expected. They are very small, because they use the system's webview. They do not ship a runtime, since the final binary is compiled from rust. This makes the reversing of Tauri apps not a trivial task.
|
||||
|
||||
## This module
|
||||
This is a toolkit that will enable engineering teams to rapidly scaffold out a new tauri-apps project using the frontend framework of their choice (as long as it has been configured).
|
||||
|
||||
To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.
|
||||
|
||||
## Usage
|
||||
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
|
||||
```
|
||||
|
||||
## Semver
|
||||
**tauri** is following [Semantic Versioning 2.0](https://semver.org/).
|
||||
## Licenses
|
||||
Code: (c) 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
Logo: CC-BY-NC-ND
|
||||
- Original Tauri Logo Designs by [Daniel Thompson-Yvetot](https://github.com/nothingismagick) and [Guillaume Chau](https://github.com/akryum)
|
@ -1,28 +0,0 @@
|
||||
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: [
|
||||
'fs',
|
||||
'path',
|
||||
'os',
|
||||
...Object.keys(pkg.dependencies || {}),
|
||||
...Object.keys(pkg.peerDependencies || {})
|
||||
],
|
||||
watch: {
|
||||
chokidar: true,
|
||||
include: 'src/**',
|
||||
exclude: 'node_modules/**'
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { ManagementType, Result } from './types/deps'
|
||||
import { shell } from './shell'
|
||||
|
||||
export type PackageManager = 'npm' | 'yarn' | 'pnpm'
|
||||
|
||||
export async function install({
|
||||
appDir,
|
||||
dependencies,
|
||||
devDependencies,
|
||||
packageManager
|
||||
}: {
|
||||
appDir: string
|
||||
dependencies: string[]
|
||||
devDependencies: string[]
|
||||
packageManager: PackageManager
|
||||
}): Promise<Result> {
|
||||
const result: Result = new Map<ManagementType, string[]>()
|
||||
await installNpmDevPackage(devDependencies, packageManager, appDir)
|
||||
result.set(ManagementType.Install, devDependencies)
|
||||
|
||||
await installNpmPackage(dependencies, packageManager, appDir)
|
||||
result.set(ManagementType.Install, dependencies)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
export async function checkPackageManager({
|
||||
cwd,
|
||||
packageManager
|
||||
}: {
|
||||
cwd: string
|
||||
packageManager: PackageManager
|
||||
}): Promise<boolean> {
|
||||
try {
|
||||
await shell(packageManager, ['--version'], { stdio: 'pipe', cwd })
|
||||
return true
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Must have ${packageManager} installed to manage dependencies. Is either in your PATH? We tried running in ${cwd}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async function installNpmPackage(
|
||||
packageNames: string[],
|
||||
packageManager: PackageManager,
|
||||
appDir: string
|
||||
): Promise<void> {
|
||||
const packages = packageNames.filter((p) => p !== '')
|
||||
if (packages.length !== 0) {
|
||||
console.log(`- Installing ${packages.join(', ')}...`)
|
||||
switch (packageManager) {
|
||||
case 'pnpm':
|
||||
case 'yarn':
|
||||
await shell(packageManager, ['add', packageNames.join(' ')], {
|
||||
cwd: appDir
|
||||
})
|
||||
break
|
||||
case 'npm':
|
||||
await shell('npm', ['install', packageNames.join(' ')], {
|
||||
cwd: appDir
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function installNpmDevPackage(
|
||||
packageNames: string[],
|
||||
packageManager: PackageManager,
|
||||
appDir: string
|
||||
): Promise<void> {
|
||||
const packages = packageNames.filter((p) => p !== '')
|
||||
if (packages.length !== 0) {
|
||||
console.log(`- Installing ${packages.join(', ')}...`)
|
||||
|
||||
switch (packageManager) {
|
||||
case 'pnpm':
|
||||
case 'yarn':
|
||||
await shell(
|
||||
packageManager,
|
||||
['add', '-D', '--ignore-scripts', ...packages],
|
||||
{
|
||||
cwd: appDir
|
||||
}
|
||||
)
|
||||
break
|
||||
case 'npm':
|
||||
await shell(
|
||||
'npm',
|
||||
['install', '--save-dev', '--ignore-scripts', ...packages],
|
||||
{
|
||||
cwd: appDir
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import { existsSync, readdirSync, lstatSync, rmdirSync, unlinkSync } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
|
||||
export function emptyDir(dir: string): void {
|
||||
if (!existsSync(dir)) return
|
||||
|
||||
for (const file of readdirSync(dir)) {
|
||||
const abs = resolve(dir, file)
|
||||
// baseline is Node 12 so can't use rmSync :(
|
||||
if (lstatSync(abs).isDirectory()) {
|
||||
emptyDir(abs)
|
||||
rmdirSync(abs)
|
||||
} else {
|
||||
unlinkSync(abs)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
export function pkgManagerFromUserAgent(userAgent: string | undefined):
|
||||
| {
|
||||
name: string
|
||||
version: string
|
||||
}
|
||||
| undefined {
|
||||
if (!userAgent) return undefined
|
||||
const pkgSpec = userAgent.split(' ')[0]
|
||||
const pkgSpecArr = pkgSpec.split('/')
|
||||
return {
|
||||
name: pkgSpecArr[0],
|
||||
version: pkgSpecArr[1]
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
||||
interface PackageJSON {
|
||||
name?: string
|
||||
scripts?: Record<string, string>
|
||||
}
|
||||
|
||||
export function updatePackageJson(
|
||||
f: (pkg: PackageJSON) => PackageJSON,
|
||||
cwd: string = process.cwd()
|
||||
): void {
|
||||
const pkgPath = join(cwd, 'package.json')
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as PackageJSON
|
||||
const output = f(pkg)
|
||||
writeFileSync(pkgPath, JSON.stringify(output, undefined, 2))
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
||||
interface TauriConfJSON {
|
||||
build?: {
|
||||
beforeDevCommand?: string
|
||||
beforeBuildCommand?: string
|
||||
distDir?: string
|
||||
devPath?: string
|
||||
withGlobalTauri?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export function updateTauriConf(
|
||||
f: (tauriConf: TauriConfJSON) => TauriConfJSON,
|
||||
cwd: string = process.cwd()
|
||||
): void {
|
||||
const tauriConfPath = join(cwd, 'src-tauri', 'tauri.conf.json')
|
||||
const tauriConf = JSON.parse(
|
||||
readFileSync(tauriConfPath, 'utf8')
|
||||
) as TauriConfJSON
|
||||
const output = f(tauriConf)
|
||||
writeFileSync(tauriConfPath, JSON.stringify(output, undefined, 2))
|
||||
}
|
@ -1,404 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import inquirer from 'inquirer'
|
||||
import { program, createOption } from 'commander'
|
||||
import { bold, cyan, green, reset, yellow } from 'chalk'
|
||||
import { platform } from 'os'
|
||||
import { resolve, join, relative } from 'path'
|
||||
import { cra } from './recipes/react'
|
||||
import { vuecli } from './recipes/vue-cli'
|
||||
import { vanillajs } from './recipes/vanilla'
|
||||
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 { cljs } from './recipes/cljs'
|
||||
import {
|
||||
install,
|
||||
checkPackageManager,
|
||||
PackageManager
|
||||
} from './dependency-manager'
|
||||
import { shell } from './shell'
|
||||
import { updatePackageJson } from './helpers/update-package-json'
|
||||
import { Recipe } from './types/recipe'
|
||||
import { updateTauriConf } from './helpers/update-tauri-conf'
|
||||
import { pkgManagerFromUserAgent } from './helpers/package-manager'
|
||||
|
||||
const allRecipes: Recipe[] = [
|
||||
vanillajs,
|
||||
cra,
|
||||
vite,
|
||||
vuecli,
|
||||
ngcli,
|
||||
svelte,
|
||||
solid,
|
||||
dominator,
|
||||
cljs
|
||||
]
|
||||
const recipeShortNames = allRecipes.map((r) => r.shortName)
|
||||
const recipeDescriptiveNames = allRecipes.map((r) => r.descriptiveName)
|
||||
const recipeByShortName = (name: string): Recipe | undefined =>
|
||||
allRecipes.find((r) => r.shortName === name)
|
||||
const recipeByDescriptiveName = (name: string): Recipe | undefined =>
|
||||
allRecipes.find((r) => r.descriptiveName.value === name)
|
||||
|
||||
interface Argv {
|
||||
help: boolean
|
||||
version: string
|
||||
ci: boolean
|
||||
dev: boolean
|
||||
binary: string
|
||||
force: string
|
||||
log: boolean
|
||||
manager: string
|
||||
directory: string
|
||||
appName: string
|
||||
windowTitle: string
|
||||
distDir: string
|
||||
devPath: string
|
||||
recipe: string
|
||||
}
|
||||
|
||||
export const createTauriApp = async (cliArgs: string[]): Promise<any> => {
|
||||
program
|
||||
.description(
|
||||
'Bootstrap a new tauri app from a "recipe" or a pre-built template.'
|
||||
)
|
||||
.addOption(
|
||||
createOption(
|
||||
'-r, --recipe <recipe>',
|
||||
'Specify UI framework recipe'
|
||||
).choices(recipeShortNames)
|
||||
)
|
||||
.option(' --ci', 'Skip prompts')
|
||||
.option(' --dev', 'Use local development packages')
|
||||
.addOption(
|
||||
createOption('-f, --force [option]', 'Force init to overwrite')
|
||||
.choices(['conf', 'template', 'all'])
|
||||
.default('all')
|
||||
)
|
||||
.option('-d, --directory <path>', 'Set target directory for init')
|
||||
.option('-A, --app-name <name>', 'Name of your Tauri application')
|
||||
.option(
|
||||
'-W, --window-title <title>',
|
||||
'Title of your Tauri application window'
|
||||
)
|
||||
.option(
|
||||
'-D, --dist-dir <path>',
|
||||
'Web assets location, relative to "<project-dir>/src-tauri/tauri.conf.json"'
|
||||
)
|
||||
.option('-p, --dev-path <path>', 'Url of your dev server')
|
||||
.addOption(
|
||||
createOption(
|
||||
'-m, --manager <package-manager>',
|
||||
'Set package manager to use'
|
||||
).choices(['npm', 'yarn', 'pnpm'])
|
||||
)
|
||||
.addOption(
|
||||
createOption('-b, --binary <path>', 'Use a prebuilt Tauri CLI binary')
|
||||
)
|
||||
.option('-l, --log', 'Add log messages')
|
||||
.version(
|
||||
// eslint-disable-next-line
|
||||
require('../package.json').version,
|
||||
'-v, --version',
|
||||
'Displays create-tauri-app version'
|
||||
)
|
||||
.helpOption('-h, --help', 'Displays this message')
|
||||
.showHelpAfterError('For more information try --help')
|
||||
.configureHelp({
|
||||
optionTerm: (option) => cyan(option.flags),
|
||||
commandUsage: (command) => cyan(command.name()) + ' [options]',
|
||||
commandDescription: (command) => yellow(command.description())
|
||||
})
|
||||
.parse(process.argv)
|
||||
|
||||
const argv = program.opts()
|
||||
return await runInit(argv as Argv)
|
||||
}
|
||||
|
||||
interface Responses {
|
||||
appName: string
|
||||
tauri: { window: { title: string } }
|
||||
recipeName: string
|
||||
installApi: boolean
|
||||
}
|
||||
|
||||
const keypress = async (skip: boolean): Promise<void> => {
|
||||
if (skip) return
|
||||
process.stdin.setRawMode(true)
|
||||
return await new Promise((resolve, reject) => {
|
||||
console.log('Press any key to continue...')
|
||||
process.stdin.once('data', (data) => {
|
||||
const byteArray = [...data]
|
||||
if (byteArray.length > 0 && byteArray[0] === 3) {
|
||||
console.log('^C')
|
||||
process.exit(1)
|
||||
}
|
||||
process.stdin.setRawMode(false)
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const runInit = async (argv: Argv): Promise<void> => {
|
||||
const setupLink =
|
||||
platform() === 'win32'
|
||||
? 'https://tauri.studio/en/docs/get-started/setup-windows/'
|
||||
: platform() === 'darwin'
|
||||
? 'https://tauri.studio/en/docs/get-started/setup-macos/'
|
||||
: 'https://tauri.studio/en/docs/get-started/setup-linux/'
|
||||
|
||||
// prettier-ignore
|
||||
console.log(
|
||||
`
|
||||
We hope to help you create something special with ${bold(yellow('Tauri'))}!
|
||||
You will have a choice of one of the UI frameworks supported by the greater web tech community.
|
||||
This tool should get you quickly started. See our docs at ${cyan('https://tauri.studio/')}
|
||||
|
||||
If you haven't already, please take a moment to setup your system.
|
||||
You may find the requirements here: ${cyan(setupLink)}
|
||||
`
|
||||
)
|
||||
|
||||
await keypress(argv.ci)
|
||||
|
||||
const defaults = {
|
||||
appName: 'tauri-app',
|
||||
tauri: { window: { title: 'Tauri App' } },
|
||||
recipeName: 'Vanilla.js',
|
||||
installApi: true
|
||||
}
|
||||
|
||||
// prompt initial questions
|
||||
const answers = (await inquirer
|
||||
.prompt([
|
||||
{
|
||||
type: 'input',
|
||||
name: 'appName',
|
||||
message: 'What is your app name?',
|
||||
default: defaults.appName,
|
||||
when: !argv.ci && !argv.appName
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'tauri.window.title',
|
||||
message: 'What should the window title be?',
|
||||
default: defaults.tauri.window.title,
|
||||
when: !argv.ci && !argv.windowTitle
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'recipeName',
|
||||
message: 'What UI recipe would you like to add?',
|
||||
choices: recipeDescriptiveNames,
|
||||
default: defaults.recipeName,
|
||||
when: !argv.ci && !argv.recipe
|
||||
},
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'installApi',
|
||||
message: 'Add "@tauri-apps/api" npm package?',
|
||||
default: true,
|
||||
when: !argv.ci
|
||||
}
|
||||
])
|
||||
.catch((error: { isTtyError: boolean }) => {
|
||||
if (error.isTtyError) {
|
||||
// Prompt couldn't be rendered in the current environment
|
||||
console.warn(
|
||||
'It appears your terminal does not support interactive prompts. Using default values.'
|
||||
)
|
||||
} else {
|
||||
// Something else went wrong
|
||||
console.error('An unknown error occurred:', error)
|
||||
}
|
||||
})) as Responses
|
||||
|
||||
const {
|
||||
appName,
|
||||
recipeName,
|
||||
installApi,
|
||||
tauri: {
|
||||
window: { title }
|
||||
}
|
||||
} = { ...defaults, ...answers }
|
||||
|
||||
let recipe: Recipe | undefined
|
||||
if (argv.recipe) {
|
||||
recipe = recipeByShortName(argv.recipe)
|
||||
} else if (recipeName !== undefined) {
|
||||
recipe = recipeByDescriptiveName(recipeName)
|
||||
}
|
||||
|
||||
// throw if recipe is not set
|
||||
if (!recipe) {
|
||||
throw new Error('Could not find the recipe specified.')
|
||||
}
|
||||
|
||||
const pkgManagerInfo = pkgManagerFromUserAgent(
|
||||
process.env.npm_config_user_agent
|
||||
)
|
||||
const packageManager = (pkgManagerInfo?.name ?? 'npm') as PackageManager
|
||||
|
||||
const buildConfig = {
|
||||
distDir: argv.distDir,
|
||||
devPath: argv.devPath,
|
||||
appName: argv.appName || appName,
|
||||
windowTitle: argv.windowTitle || title
|
||||
}
|
||||
|
||||
const directory = argv.directory || process.cwd()
|
||||
|
||||
// prompt additional recipe questions
|
||||
let recipeAnswers
|
||||
if (recipe.extraQuestions) {
|
||||
recipeAnswers = await inquirer
|
||||
.prompt(
|
||||
recipe.extraQuestions({
|
||||
cfg: buildConfig,
|
||||
packageManager,
|
||||
ci: argv.ci,
|
||||
cwd: directory
|
||||
})
|
||||
)
|
||||
.catch((error: { isTtyError: boolean }) => {
|
||||
if (error.isTtyError) {
|
||||
// Prompt couldn't be rendered in the current environment
|
||||
console.warn(
|
||||
'It appears your terminal does not support interactive prompts. Using default values.'
|
||||
)
|
||||
} else {
|
||||
// Something else went wrong
|
||||
console.error('An unknown error occurred:', error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let updatedConfig
|
||||
if (recipe.configUpdate) {
|
||||
updatedConfig = recipe.configUpdate({
|
||||
cfg: buildConfig,
|
||||
packageManager,
|
||||
ci: argv.ci,
|
||||
cwd: directory,
|
||||
answers: recipeAnswers ?? {}
|
||||
})
|
||||
}
|
||||
const cfg = {
|
||||
...buildConfig,
|
||||
...(updatedConfig ?? {})
|
||||
}
|
||||
|
||||
// note that our app directory is reliant on the appName and
|
||||
// generally there are issues if the path has spaces (see Windows)
|
||||
// TODO: prevent app names with spaces or escape here?
|
||||
const appDirectory = join(directory, cfg.appName)
|
||||
|
||||
// this throws an error if we can't run the package manager they requested
|
||||
await checkPackageManager({ cwd: directory, packageManager })
|
||||
|
||||
if (recipe.preInit) {
|
||||
logStep('Running initial command(s)')
|
||||
await recipe.preInit({
|
||||
cwd: directory,
|
||||
cfg,
|
||||
packageManager,
|
||||
ci: argv.ci,
|
||||
answers: recipeAnswers ?? {}
|
||||
})
|
||||
}
|
||||
|
||||
const initArgs = [
|
||||
['--app-name', cfg.appName],
|
||||
['--window-title', cfg.windowTitle],
|
||||
['--dist-dir', cfg.distDir],
|
||||
['--dev-path', cfg.devPath]
|
||||
].reduce((final: string[], argSet) => {
|
||||
if (argSet[1]) {
|
||||
return final.concat(argSet)
|
||||
} else {
|
||||
return final
|
||||
}
|
||||
}, [])
|
||||
// TODO: const tauriCLIVersion = !argv.dev ?
|
||||
// 'latest'
|
||||
// :`file:${relative(appDirectory, join(__dirname, '../../cli.js'))}`
|
||||
const tauriCLIVersion = 'latest'
|
||||
const apiVersion = !argv.dev
|
||||
? 'latest'
|
||||
: `file:${relative(appDirectory, join(__dirname, '../../api/dist'))}`
|
||||
|
||||
// Vue CLI plugin automatically runs these
|
||||
if (recipe.shortName !== 'vuecli') {
|
||||
logStep('Installing any additional needed dependencies')
|
||||
await install({
|
||||
appDir: appDirectory,
|
||||
dependencies: [installApi ? `@tauri-apps/api@${apiVersion}` : ''].concat(
|
||||
recipe.extraNpmDependencies
|
||||
),
|
||||
devDependencies: [`@tauri-apps/cli@${tauriCLIVersion}`].concat(
|
||||
recipe.extraNpmDevDependencies
|
||||
),
|
||||
packageManager
|
||||
})
|
||||
|
||||
logStep(`Updating ${reset(yellow('"package.json"'))}`)
|
||||
updatePackageJson((pkg) => {
|
||||
return {
|
||||
...pkg,
|
||||
name: appName,
|
||||
scripts: {
|
||||
...pkg.scripts,
|
||||
tauri: 'tauri'
|
||||
}
|
||||
}
|
||||
}, appDirectory)
|
||||
|
||||
logStep(`Running ${reset(yellow('"tauri init"'))}`)
|
||||
const binary = !argv.binary
|
||||
? packageManager
|
||||
: resolve(appDirectory, argv.binary)
|
||||
// "pnpm" is mostly interchangable with "yarn" but due to this bug https://github.com/pnpm/pnpm/issues/2764
|
||||
// we need to pass "--" to pnpm or arguments won't be parsed correctly so we treat "pnpm" here like "npm"
|
||||
const runTauriArgs =
|
||||
packageManager === 'yarn' || argv.binary
|
||||
? ['tauri', 'init']
|
||||
: ['run', 'tauri', '--', 'init']
|
||||
|
||||
await shell(binary, [...runTauriArgs, ...initArgs, '--ci'], {
|
||||
cwd: appDirectory
|
||||
})
|
||||
|
||||
logStep(`Updating ${reset(yellow('"tauri.conf.json"'))}`)
|
||||
updateTauriConf((tauriConf) => {
|
||||
return {
|
||||
...tauriConf,
|
||||
build: {
|
||||
...tauriConf.build,
|
||||
beforeDevCommand: cfg.beforeDevCommand,
|
||||
beforeBuildCommand: cfg.beforeBuildCommand
|
||||
}
|
||||
}
|
||||
}, appDirectory)
|
||||
}
|
||||
|
||||
if (recipe.postInit) {
|
||||
logStep('Running final command(s)')
|
||||
await recipe.postInit({
|
||||
cwd: appDirectory,
|
||||
cfg,
|
||||
packageManager,
|
||||
ci: argv.ci,
|
||||
answers: recipeAnswers ?? {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function logStep(msg: string): void {
|
||||
const out = `${green('>>')} ${bold(cyan(msg))}`
|
||||
console.log(out)
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { join } from 'path'
|
||||
import { shell } from '../shell'
|
||||
import { Recipe } from '../types/recipe'
|
||||
import { unlinkSync, existsSync } from 'fs'
|
||||
import { emptyDir } from '../helpers/empty-dir'
|
||||
|
||||
const cljs: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'ClojureScript (https://github.com/filipesilva/create-cljs-app)',
|
||||
value: 'cljs'
|
||||
},
|
||||
shortName: 'cljs',
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
configUpdate: ({ cfg, packageManager }) => ({
|
||||
...cfg,
|
||||
distDir: `../public`,
|
||||
devPath: 'http://localhost:3000',
|
||||
beforeDevCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} start`,
|
||||
beforeBuildCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} build`
|
||||
}),
|
||||
preInit: async ({ cwd, cfg, packageManager, ci }) => {
|
||||
const npmLock = join(cwd, cfg.appName, 'package-lock.json')
|
||||
const yarnLock = join(cwd, cfg.appName, 'yarn.lock')
|
||||
const nodeModules = join(cwd, cfg.appName, 'node_modules')
|
||||
|
||||
switch (packageManager) {
|
||||
case 'yarn':
|
||||
await shell('yarn', ['create', 'cljs-app', `${cfg.appName}`], {
|
||||
cwd
|
||||
})
|
||||
|
||||
// `create-cljs-app` has both a `package-lock.json` and a `yarn.lock`
|
||||
// so it is better to remove conflicting lock files and install fresh node_modules
|
||||
if (existsSync(npmLock)) unlinkSync(npmLock)
|
||||
emptyDir(nodeModules)
|
||||
|
||||
await shell('yarn', ['install'], { cwd: join(cwd, cfg.appName) })
|
||||
break
|
||||
|
||||
case 'npm':
|
||||
await shell(
|
||||
'npx',
|
||||
[ci ? '--yes' : '', 'create-cljs-app@latest', `${cfg.appName}`],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
|
||||
if (existsSync(yarnLock)) unlinkSync(yarnLock)
|
||||
emptyDir(nodeModules)
|
||||
|
||||
await shell('npm', ['install'], { cwd: join(cwd, cfg.appName) })
|
||||
break
|
||||
|
||||
case 'pnpm':
|
||||
await shell(
|
||||
'npx',
|
||||
[ci ? '--yes' : '', 'create-cljs-app@latest', `${cfg.appName}`],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
|
||||
if (existsSync(npmLock)) unlinkSync(npmLock)
|
||||
emptyDir(nodeModules)
|
||||
|
||||
await shell('pnpm', ['install'], { cwd: join(cwd, cfg.appName) })
|
||||
break
|
||||
}
|
||||
},
|
||||
postInit: async ({ cfg, packageManager }) => {
|
||||
console.log(`
|
||||
Your installation completed.
|
||||
|
||||
$ cd ${cfg.appName}
|
||||
$ ${packageManager === 'npm' ? 'npm run' : packageManager} tauri dev
|
||||
`)
|
||||
return await Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
export { cljs }
|
@ -1,57 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { join } from 'path'
|
||||
// @ts-expect-error
|
||||
import scaffe from 'scaffe'
|
||||
import { Recipe } from '../types/recipe'
|
||||
|
||||
export const dominator: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'Dominator (https://crates.io/crates/dominator/)',
|
||||
value: 'Dominator'
|
||||
},
|
||||
shortName: 'dominator',
|
||||
configUpdate: ({ cfg, packageManager }) => ({
|
||||
...cfg,
|
||||
distDir: `../dist`,
|
||||
devPath: 'http://localhost:10001/',
|
||||
beforeDevCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} start`,
|
||||
beforeBuildCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} build`
|
||||
}),
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
preInit: async ({ cwd, cfg }) => {
|
||||
const { appName, windowTitle } = cfg
|
||||
const templateDir = join(__dirname, '../src/templates/dominator')
|
||||
const variables = {
|
||||
name: appName,
|
||||
title: windowTitle
|
||||
}
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
||||
await scaffe.generate(templateDir, join(cwd, appName), {
|
||||
overwrite: true,
|
||||
variables
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
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()
|
||||
}
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
import { PackageManager } from '../dependency-manager'
|
||||
import { shell } from '../shell'
|
||||
import { Recipe } from '../types/recipe'
|
||||
import { join } from 'path'
|
||||
|
||||
const addAdditionalPackage = async (
|
||||
packageManager: PackageManager,
|
||||
cwd: string,
|
||||
appName: string,
|
||||
packageName: string
|
||||
): Promise<void> => {
|
||||
const ngCommand = ['ng', 'add', packageName, '--skip-confirmation']
|
||||
|
||||
switch (packageManager) {
|
||||
case 'pnpm':
|
||||
case 'yarn':
|
||||
await shell(packageManager, ngCommand, {
|
||||
cwd: join(cwd, appName)
|
||||
})
|
||||
break
|
||||
|
||||
case 'npm':
|
||||
await shell('npm', ['run', ...ngCommand], {
|
||||
cwd: join(cwd, appName)
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const ngcli: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'Angular CLI (https://angular.io/cli)',
|
||||
value: 'ng-cli'
|
||||
},
|
||||
shortName: 'ngcli',
|
||||
extraNpmDependencies: [],
|
||||
extraNpmDevDependencies: [],
|
||||
configUpdate: ({ cfg, packageManager }) => ({
|
||||
...cfg,
|
||||
distDir: `../dist/${cfg.appName}`,
|
||||
devPath: 'http://localhost:4200',
|
||||
beforeDevCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} start`,
|
||||
beforeBuildCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} build`
|
||||
}),
|
||||
extraQuestions: ({ ci }) => {
|
||||
return [
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'material',
|
||||
message: 'Add Angular Material (https://material.angular.io/)?',
|
||||
when: !ci
|
||||
},
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'eslint',
|
||||
message:
|
||||
'Add Angular ESLint (https://github.com/angular-eslint/angular-eslint)?',
|
||||
when: !ci
|
||||
}
|
||||
]
|
||||
},
|
||||
preInit: async ({ cwd, cfg, answers, packageManager, ci }) => {
|
||||
await shell(
|
||||
'npx',
|
||||
[
|
||||
ci ? '--yes' : '',
|
||||
'-p',
|
||||
'@angular/cli',
|
||||
'ng',
|
||||
'new',
|
||||
`${cfg.appName}`,
|
||||
`--package-manager=${packageManager}`
|
||||
],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
|
||||
if (answers?.material) {
|
||||
await addAdditionalPackage(
|
||||
packageManager,
|
||||
cwd,
|
||||
cfg.appName,
|
||||
'@angular/material'
|
||||
)
|
||||
}
|
||||
|
||||
if (answers?.eslint) {
|
||||
await addAdditionalPackage(
|
||||
packageManager,
|
||||
cwd,
|
||||
cfg.appName,
|
||||
'@angular-eslint/schematics'
|
||||
)
|
||||
}
|
||||
},
|
||||
postInit: async ({ packageManager, cfg }) => {
|
||||
console.log(`
|
||||
Your installation completed.
|
||||
|
||||
$ cd ${cfg.appName}
|
||||
$ ${packageManager === 'npm' ? 'npm run' : packageManager} tauri dev
|
||||
`)
|
||||
|
||||
return await Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
export { ngcli }
|
@ -1,137 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { join } from 'path'
|
||||
// @ts-expect-error
|
||||
import scaffe from 'scaffe'
|
||||
import { shell } from '../shell'
|
||||
import { Recipe } from '../types/recipe'
|
||||
import { unlinkSync, existsSync } from 'fs'
|
||||
import { emptyDir } from '../helpers/empty-dir'
|
||||
import { updatePackageJson } from '../helpers/update-package-json'
|
||||
|
||||
const afterCra = async (
|
||||
cwd: string,
|
||||
appName: string,
|
||||
typescript: boolean = false
|
||||
): Promise<void> => {
|
||||
const templateDir = join(
|
||||
__dirname,
|
||||
`../src/templates/react/${typescript ? 'react-ts' : 'react'}`
|
||||
)
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
||||
await scaffe.generate(templateDir, join(cwd, appName), {
|
||||
overwrite: true
|
||||
})
|
||||
updatePackageJson((pkg) => {
|
||||
return {
|
||||
...pkg,
|
||||
scripts: {
|
||||
...pkg.scripts,
|
||||
start: `${'cross-env BROWSER=none '}${pkg.scripts?.start as string}`
|
||||
}
|
||||
}
|
||||
}, join(cwd, appName))
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
export const cra: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'create-react-app (https://create-react-app.dev/)',
|
||||
value: 'create-react-app'
|
||||
},
|
||||
shortName: 'cra',
|
||||
configUpdate: ({ cfg, packageManager }) => ({
|
||||
...cfg,
|
||||
distDir: `../build`,
|
||||
devPath: 'http://localhost:3000',
|
||||
beforeDevCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} start`,
|
||||
beforeBuildCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} build`
|
||||
}),
|
||||
extraNpmDevDependencies: ['cross-env'],
|
||||
extraNpmDependencies: [],
|
||||
extraQuestions: ({ ci }) => {
|
||||
return [
|
||||
{
|
||||
type: 'list',
|
||||
name: 'template',
|
||||
message: 'Which create-react-app template would you like to use?',
|
||||
choices: [
|
||||
{ name: 'create-react-app (JavaScript)', value: 'cra.js' },
|
||||
{ name: 'create-react-app (Typescript)', value: 'cra.ts' }
|
||||
],
|
||||
default: 'cra.js',
|
||||
loop: false,
|
||||
when: !ci
|
||||
}
|
||||
]
|
||||
},
|
||||
preInit: async ({ cwd, cfg, packageManager, answers, ci }) => {
|
||||
const template = (answers?.template as string) ?? 'cra.js'
|
||||
switch (packageManager) {
|
||||
case 'yarn':
|
||||
await shell(
|
||||
'yarn',
|
||||
[
|
||||
ci ? '--non-interactive' : '',
|
||||
'create',
|
||||
'react-app',
|
||||
...(template === 'cra.ts' ? ['--template', 'typescript'] : []),
|
||||
`${cfg.appName}`
|
||||
],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
break
|
||||
case 'npm':
|
||||
case 'pnpm':
|
||||
await shell(
|
||||
'npx',
|
||||
[
|
||||
ci ? '--yes' : '',
|
||||
'create-react-app@latest',
|
||||
...(template === 'cra.ts' ? ['--template', 'typescript'] : []),
|
||||
`${cfg.appName}`,
|
||||
'--use-npm'
|
||||
],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
|
||||
// create-react-app doesn't support pnpm, so we remove `node_modules` and any lock files then install them again using pnpm
|
||||
if (packageManager === 'pnpm') {
|
||||
const npmLock = join(cwd, cfg.appName, 'package-lock.json')
|
||||
const yarnLock = join(cwd, cfg.appName, 'yarn.lock')
|
||||
const nodeModules = join(cwd, cfg.appName, 'node_modules')
|
||||
if (existsSync(npmLock)) unlinkSync(npmLock)
|
||||
if (existsSync(yarnLock)) unlinkSync(yarnLock)
|
||||
emptyDir(nodeModules)
|
||||
await shell('pnpm', ['install'], { cwd: join(cwd, cfg.appName) })
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
await afterCra(cwd, cfg.appName, template === 'cra.ts')
|
||||
},
|
||||
postInit: async ({ packageManager, cfg }) => {
|
||||
console.log(`
|
||||
Your installation completed.
|
||||
|
||||
$ cd ${cfg.appName}
|
||||
$ ${packageManager === 'npm' ? 'npm run' : packageManager} tauri dev
|
||||
`)
|
||||
return await Promise.resolve()
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
// 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, ci }) => {
|
||||
await shell(
|
||||
'npx',
|
||||
[
|
||||
ci ? '--yes' : '',
|
||||
'degit',
|
||||
`solidjs/templates/${(answers?.template as string) ?? 'js'}`,
|
||||
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 }
|
@ -1,73 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { join } from 'path'
|
||||
import { shell } from '../shell'
|
||||
import { Recipe } from '../types/recipe'
|
||||
|
||||
const svelte: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'Svelte (https://github.com/sveltejs/template)',
|
||||
value: 'svelte'
|
||||
},
|
||||
shortName: 'svelte',
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
extraQuestions: ({ ci }) => {
|
||||
return [
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'typescript',
|
||||
message: 'Enable Typescript?',
|
||||
default: true,
|
||||
loop: false,
|
||||
when: !ci
|
||||
}
|
||||
]
|
||||
},
|
||||
configUpdate: ({ cfg, packageManager }) => ({
|
||||
...cfg,
|
||||
distDir: `../public`,
|
||||
devPath: 'http://localhost:8080',
|
||||
beforeDevCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} dev`,
|
||||
beforeBuildCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} build`
|
||||
}),
|
||||
preInit: async ({ cwd, cfg, answers, ci }) => {
|
||||
let typescript = false
|
||||
if (answers) {
|
||||
typescript = !!answers.typescript
|
||||
}
|
||||
|
||||
await shell(
|
||||
'npx',
|
||||
[ci ? '--yes' : '', 'degit', 'sveltejs/template', `${cfg.appName}`],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
|
||||
if (typescript) {
|
||||
await shell('node', ['scripts/setupTypeScript.js'], {
|
||||
cwd: join(cwd, cfg.appName)
|
||||
})
|
||||
}
|
||||
},
|
||||
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 { svelte }
|
@ -1,52 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { join } from 'path'
|
||||
// @ts-expect-error
|
||||
import scaffe from 'scaffe'
|
||||
import { Recipe } from '../types/recipe'
|
||||
|
||||
export const vanillajs: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'Vanilla.js (html, css, and js without the bundlers)',
|
||||
value: 'Vanilla.js'
|
||||
},
|
||||
shortName: 'vanillajs',
|
||||
configUpdate: ({ cfg }) => ({
|
||||
...cfg,
|
||||
distDir: `../dist`,
|
||||
devPath: `../dist`,
|
||||
beforeDevCommand: '',
|
||||
beforeBuildCommand: ''
|
||||
}),
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
preInit: async ({ cwd, cfg }) => {
|
||||
const { appName } = cfg
|
||||
const templateDir = join(__dirname, '../src/templates/vanilla')
|
||||
const variables = {
|
||||
name: appName
|
||||
}
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
||||
await scaffe.generate(templateDir, join(cwd, appName), {
|
||||
overwrite: true,
|
||||
variables
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
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()
|
||||
}
|
||||
}
|
@ -1,127 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// import { join } from 'path'
|
||||
/// import scaffe from 'scaffe'
|
||||
import { shell } from '../shell'
|
||||
import { Recipe } from '../types/recipe'
|
||||
|
||||
const vite: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'create-vite (vanilla, vue, react, svelte, preact, lit) (https://vitejs.dev/guide/#scaffolding-your-first-vite-project)',
|
||||
value: 'create-vite'
|
||||
},
|
||||
shortName: 'vite',
|
||||
configUpdate: ({ cfg, packageManager }) => ({
|
||||
...cfg,
|
||||
distDir: `../dist`,
|
||||
devPath: 'http://localhost:3000',
|
||||
beforeDevCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} dev`,
|
||||
beforeBuildCommand: `${
|
||||
packageManager === 'npm' ? 'npm run' : packageManager
|
||||
} build`
|
||||
}),
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
extraQuestions: ({ ci }) => {
|
||||
return [
|
||||
{
|
||||
type: 'list',
|
||||
name: 'template',
|
||||
message: 'Which vite template would you like to use?',
|
||||
choices: [
|
||||
'vanilla',
|
||||
'vanilla-ts',
|
||||
'vue',
|
||||
'vue-ts',
|
||||
'react',
|
||||
'react-ts',
|
||||
'preact',
|
||||
'preact-ts',
|
||||
'lit-element',
|
||||
'lit-element-ts',
|
||||
'svelte',
|
||||
'svelte-ts'
|
||||
],
|
||||
default: 'vue',
|
||||
loop: false,
|
||||
when: !ci
|
||||
}
|
||||
]
|
||||
},
|
||||
preInit: async ({ cwd, cfg, packageManager, answers, ci }) => {
|
||||
const template = (answers?.template as string) ?? 'vue'
|
||||
|
||||
switch (packageManager) {
|
||||
case 'yarn':
|
||||
await shell(
|
||||
'yarn',
|
||||
[
|
||||
ci ? '--non-interactive' : '',
|
||||
'create',
|
||||
'vite',
|
||||
`${cfg.appName}`,
|
||||
'--template',
|
||||
`${template}`
|
||||
],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
break
|
||||
|
||||
case 'npm':
|
||||
await shell(
|
||||
'npx',
|
||||
[
|
||||
ci ? '--yes' : '',
|
||||
'create-vite@latest',
|
||||
`${cfg.appName}`,
|
||||
'--template',
|
||||
`${template}`
|
||||
],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
break
|
||||
|
||||
case 'pnpm':
|
||||
await shell(
|
||||
'pnpm',
|
||||
['create', 'vite', `${cfg.appName}`, '--template', `${template}`],
|
||||
{
|
||||
cwd
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
},
|
||||
postInit: async ({ cwd, packageManager, cfg }) => {
|
||||
// we don't have a consistent way to rebuild and
|
||||
// esbuild has hit all the bugs and struggles to install on the postinstall
|
||||
await shell('node', ['./node_modules/esbuild/install.js'], { cwd })
|
||||
switch (packageManager) {
|
||||
case 'pnpm':
|
||||
case 'yarn':
|
||||
await shell(packageManager, ['build'], { cwd })
|
||||
break
|
||||
case 'npm':
|
||||
await shell('npm', ['run', 'build'], { cwd })
|
||||
break
|
||||
}
|
||||
|
||||
console.log(`
|
||||
Your installation completed.
|
||||
|
||||
$ cd ${cfg.appName}
|
||||
$ ${packageManager === 'npm' ? 'npm run' : packageManager} tauri dev
|
||||
`)
|
||||
return await Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
export { vite }
|
@ -1,60 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { join } from 'path'
|
||||
import { shell } from '../shell'
|
||||
import { Recipe } from '../types/recipe'
|
||||
|
||||
const vuecli: Recipe = {
|
||||
descriptiveName: {
|
||||
name: 'Vue CLI (https://cli.vuejs.org/)',
|
||||
value: 'vue-cli'
|
||||
},
|
||||
shortName: 'vuecli',
|
||||
extraNpmDevDependencies: [],
|
||||
extraNpmDependencies: [],
|
||||
configUpdate: ({ cfg }) => cfg,
|
||||
preInit: async ({ cwd, cfg, ci, packageManager }) => {
|
||||
await shell(
|
||||
'npx',
|
||||
[
|
||||
ci ? '--yes' : '',
|
||||
'@vue/cli@latest',
|
||||
'create',
|
||||
`${cfg.appName}`,
|
||||
'--packageManager',
|
||||
packageManager,
|
||||
ci ? '--default' : ''
|
||||
],
|
||||
{ cwd }
|
||||
)
|
||||
await shell(
|
||||
'npx',
|
||||
[
|
||||
ci ? '--yes' : '',
|
||||
'@vue/cli',
|
||||
'add',
|
||||
'tauri',
|
||||
'--appName',
|
||||
`${cfg.appName}`,
|
||||
'--windowTitle',
|
||||
`${cfg.windowTitle}`
|
||||
],
|
||||
{
|
||||
cwd: join(cwd, cfg.appName)
|
||||
}
|
||||
)
|
||||
},
|
||||
postInit: async ({ cfg, packageManager }) => {
|
||||
console.log(`
|
||||
Your installation completed.
|
||||
|
||||
$ cd ${cfg.appName}
|
||||
$ ${packageManager === 'npm' ? 'npm run' : packageManager} tauri:serve
|
||||
`)
|
||||
return await Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
export { vuecli }
|
@ -1,40 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import execa, { Options, ExecaChildProcess } from 'execa'
|
||||
|
||||
export const shell = async (
|
||||
command: string,
|
||||
args?: string[],
|
||||
options?: Options,
|
||||
log: boolean = false
|
||||
): Promise<ExecaChildProcess> => {
|
||||
try {
|
||||
if (options && options.shell === true) {
|
||||
const stringCommand = [command, ...(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 ?? []).filter((e) => e !== ''),
|
||||
{
|
||||
stdio: 'inherit',
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
...options
|
||||
}
|
||||
)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error with command: %s', command)
|
||||
throw new Error(error)
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
node_modules
|
||||
/dist/js
|
||||
/target
|
||||
/wasm-pack.log
|
||||
/yarn-error.log
|
@ -1,25 +0,0 @@
|
||||
[package]
|
||||
name = "<%= name %>"
|
||||
version = "1.0.0"
|
||||
categories = ["wasm"]
|
||||
edition = "2021"
|
||||
rust-version = "1.57"
|
||||
description = ""
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"src-tauri"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
console_error_panic_hook = "0.1.6"
|
||||
dominator = "0.5.17"
|
||||
wasm-bindgen = "0.2.74"
|
||||
futures-signals = "0.3.20"
|
||||
once_cell = "1.7.2"
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "<%= name %>",
|
||||
"scripts": {
|
||||
"tauri": "tauri",
|
||||
"build": "rimraf dist/js && rollup --config",
|
||||
"start": "rimraf dist/js && rollup --config --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wasm-tool/rollup-plugin-rust": "^1.0.6",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.50.2",
|
||||
"rollup-plugin-livereload": "^2.0.0",
|
||||
"rollup-plugin-serve": "^1.1.0",
|
||||
"rollup-plugin-terser": "^7.0.2"
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title><%= title %></title>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1><%= name %></h1>
|
||||
<script src="js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,32 +0,0 @@
|
||||
import rust from '@wasm-tool/rollup-plugin-rust'
|
||||
import serve from 'rollup-plugin-serve'
|
||||
import livereload from 'rollup-plugin-livereload'
|
||||
import { terser } from 'rollup-plugin-terser'
|
||||
|
||||
const is_watch = !!process.env.ROLLUP_WATCH
|
||||
|
||||
export default {
|
||||
input: {
|
||||
index: './Cargo.toml'
|
||||
},
|
||||
output: {
|
||||
dir: 'dist/js',
|
||||
format: 'iife',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
rust({
|
||||
serverPath: 'js/'
|
||||
}),
|
||||
|
||||
is_watch &&
|
||||
serve({
|
||||
contentBase: 'dist',
|
||||
open: true
|
||||
}),
|
||||
|
||||
is_watch && livereload('dist'),
|
||||
|
||||
!is_watch && terser()
|
||||
]
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
use std::sync::Arc;
|
||||
use once_cell::sync::Lazy;
|
||||
use futures_signals::signal::{Mutable, SignalExt};
|
||||
use dominator::{Dom, html, class, clone, events};
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
struct App {
|
||||
message: Mutable<String>,
|
||||
}
|
||||
|
||||
impl App {
|
||||
fn new() -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
message: Mutable::new("Hello world!".to_string()),
|
||||
})
|
||||
}
|
||||
|
||||
fn render(app: Arc<Self>) -> Dom {
|
||||
// Define CSS styles
|
||||
static CLASS: Lazy<String> = Lazy::new(|| class! {
|
||||
.style("font-size", "20px")
|
||||
.style("color", "hsl(110, 70%, 70%)")
|
||||
});
|
||||
|
||||
// Create the DOM nodes
|
||||
html!("div", {
|
||||
.class(&*CLASS)
|
||||
|
||||
.text_signal(app.message.signal_cloned().map(|message| {
|
||||
format!("Message: {}", message)
|
||||
}))
|
||||
|
||||
.event(clone!(app => move |_: events::Click| {
|
||||
app.message.set_neq("Goodbye!".to_string());
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[wasm_bindgen(start)]
|
||||
pub fn main_js() -> Result<(), JsValue> {
|
||||
#[cfg(debug_assertions)]
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
let app = App::new();
|
||||
dominator::append_dom(&dominator::body(), App::render(app));
|
||||
|
||||
Ok(())
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
.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);
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
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.tsx</code> and save to reload.
|
||||
</p>
|
||||
</header>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
@ -1 +0,0 @@
|
||||
<svg width="1031" height="1160" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M719.4 421.6a110.5 110.5 0 11-221-.1 110.5 110.5 0 01221 .1z" fill="#FFC131"/><ellipse cx="422.9" cy="737.9" rx="110.6" ry="110.4" transform="rotate(180 422.9 737.9)" fill="#24C8DB"/><path fill-rule="evenodd" clip-rule="evenodd" d="M838 775.8a422.5 422.5 0 01-145.7 59.1 295.4 295.4 0 0014.1-133.5 296.7 296.7 0 00173-158 296 296 0 00-190.7-407.1 297 297 0 00-321 112.7A493 493 0 00206 296 421.5 421.5 0 01483.7 19 422.7 422.7 0 01925 142.3a421.4 421.4 0 01-87 633.5zm-627.1-403l103.5 12.7c2.5-20 7-39.6 13.4-58.6-41.1 9.4-80.5 24.9-116.9 46z" fill="#FFC131"/><path fill-rule="evenodd" clip-rule="evenodd" d="M193 383.8c45-29 94.8-49.1 146.8-59.5a295.2 295.2 0 00-16.5 134.2 296.8 296.8 0 00-171.6 157.7 296 296 0 00190.6 407 297 297 0 00321-112.7 493 493 0 00162-47.3 421.5 421.5 0 01-278 277.3A422.7 422.7 0 01106 1017.2a421.4 421.4 0 0187-633.4zm626.5 402.8zm-99.3 41.5a422.2 422.2 0 000 0z" fill="#24C8DB"/></svg>
|
Before Width: | Height: | Size: 1005 B |
@ -1 +0,0 @@
|
||||
<svg width="475" height="117" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M37.7 115c-1 0-2-.4-2.9-1.1a4.3 4.3 0 01-1.1-3V26.5h-29c-1.1 0-2.1-.4-3-1.1a4.3 4.3 0 01-1.1-3V5a4 4 0 011.1-3c.9-.7 1.9-1.1 3-1.1h87.6a4 4 0 013 1.1 4 4 0 011.1 3v17.4a4 4 0 01-1.1 3 4 4 0 01-3 1h-29V111c0 1.1-.4 2-1.1 3a4 4 0 01-3 1.1H37.7zM93 115c-.8 0-1.6-.3-2.4-1-.6-.7-1-1.6-1-2.4l.2-1.5L128.1 5.5a6 6 0 012.1-3.3c1.1-.9 2.5-1.3 4.3-1.3h24.1c1.7 0 3.2.4 4.2 1.3a6 6 0 012.2 3.3L203 110l.3 1.5c0 .8-.3 1.7-1.1 2.4-.7.7-1.5 1-2.5 1h-20c-2.6 0-4.3-1.1-5.2-3.4L168.2 95h-43.5l-6.2 16.6c-.9 2.3-2.7 3.4-5.4 3.4h-20zm68.7-43.5l-15.2-43-15.1 43h30.3zM261.7 116.6a53.4 53.4 0 01-36-11.2c-8.7-7.5-13-18.8-13-34V5a4 4 0 011.2-3c.9-.7 1.8-1.1 3-1.1h21a4 4 0 012.9 1.1c.9.8 1.3 1.8 1.3 3v66.3c0 7 1.6 12.4 4.9 16 3.4 3.5 8.2 5.2 14.5 5.2 6.2 0 11-1.8 14.3-5.4 3.4-3.6 5-8.8 5-15.8V5a4 4 0 011.2-3c.9-.7 1.9-1.1 3-1.1h21.2A4 4 0 01309 2a4 4 0 011.1 3v66.5c0 15-4.3 26.4-13 33.9a52.2 52.2 0 01-35.5 11.2zM336 115c-1.2 0-2.1-.4-3-1.1a4.3 4.3 0 01-1.2-3V5A4 4 0 01333 2c.9-.7 1.8-1.1 3-1.1h44.3a51 51 0 0133.2 9.8 33 33 0 0112 27.4 34 34 0 01-5.3 19.4 34.4 34.4 0 01-14.8 12.2l22.3 40c.3.7.5 1.3.5 1.9 0 .8-.4 1.7-1.2 2.4-.6.7-1.4 1-2.2 1H403a6.8 6.8 0 01-6.7-4.4l-18.6-35.9h-16.6V111c0 1.2-.4 2.2-1.3 3a4 4 0 01-3 1.1h-21zm44-63.4c5 0 8.7-1.2 11.3-3.6 2.6-2.5 4-6 4-10.3 0-4.3-1.4-7.7-4-10.2-2.5-2.6-6.3-4-11.4-4h-18.7v28h18.7zM448.6 115c-1 0-2-.4-3-1.1a4.3 4.3 0 01-1-3V5a4 4 0 011-2.9c1-.7 2-1.1 3-1.1h21.9a4 4 0 012.9 1.1c.9.8 1.3 1.8 1.3 3v106c0 1.1-.4 2.1-1.3 2.9a4 4 0 01-3 1.1h-21.8z" fill="#F7F7F7"/></svg>
|
Before Width: | Height: | Size: 1.6 KiB |
@ -1,54 +0,0 @@
|
||||
.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);
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
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
|
@ -1 +0,0 @@
|
||||
<svg width="1031" height="1160" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M719.4 421.6a110.5 110.5 0 11-221-.1 110.5 110.5 0 01221 .1z" fill="#FFC131"/><ellipse cx="422.9" cy="737.9" rx="110.6" ry="110.4" transform="rotate(180 422.9 737.9)" fill="#24C8DB"/><path fill-rule="evenodd" clip-rule="evenodd" d="M838 775.8a422.5 422.5 0 01-145.7 59.1 295.4 295.4 0 0014.1-133.5 296.7 296.7 0 00173-158 296 296 0 00-190.7-407.1 297 297 0 00-321 112.7A493 493 0 00206 296 421.5 421.5 0 01483.7 19 422.7 422.7 0 01925 142.3a421.4 421.4 0 01-87 633.5zm-627.1-403l103.5 12.7c2.5-20 7-39.6 13.4-58.6-41.1 9.4-80.5 24.9-116.9 46z" fill="#FFC131"/><path fill-rule="evenodd" clip-rule="evenodd" d="M193 383.8c45-29 94.8-49.1 146.8-59.5a295.2 295.2 0 00-16.5 134.2 296.8 296.8 0 00-171.6 157.7 296 296 0 00190.6 407 297 297 0 00321-112.7 493 493 0 00162-47.3 421.5 421.5 0 01-278 277.3A422.7 422.7 0 01106 1017.2a421.4 421.4 0 0187-633.4zm626.5 402.8zm-99.3 41.5a422.2 422.2 0 000 0z" fill="#24C8DB"/></svg>
|
Before Width: | Height: | Size: 1005 B |
@ -1 +0,0 @@
|
||||
<svg width="475" height="117" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M37.7 115c-1 0-2-.4-2.9-1.1a4.3 4.3 0 01-1.1-3V26.5h-29c-1.1 0-2.1-.4-3-1.1a4.3 4.3 0 01-1.1-3V5a4 4 0 011.1-3c.9-.7 1.9-1.1 3-1.1h87.6a4 4 0 013 1.1 4 4 0 011.1 3v17.4a4 4 0 01-1.1 3 4 4 0 01-3 1h-29V111c0 1.1-.4 2-1.1 3a4 4 0 01-3 1.1H37.7zM93 115c-.8 0-1.6-.3-2.4-1-.6-.7-1-1.6-1-2.4l.2-1.5L128.1 5.5a6 6 0 012.1-3.3c1.1-.9 2.5-1.3 4.3-1.3h24.1c1.7 0 3.2.4 4.2 1.3a6 6 0 012.2 3.3L203 110l.3 1.5c0 .8-.3 1.7-1.1 2.4-.7.7-1.5 1-2.5 1h-20c-2.6 0-4.3-1.1-5.2-3.4L168.2 95h-43.5l-6.2 16.6c-.9 2.3-2.7 3.4-5.4 3.4h-20zm68.7-43.5l-15.2-43-15.1 43h30.3zM261.7 116.6a53.4 53.4 0 01-36-11.2c-8.7-7.5-13-18.8-13-34V5a4 4 0 011.2-3c.9-.7 1.8-1.1 3-1.1h21a4 4 0 012.9 1.1c.9.8 1.3 1.8 1.3 3v66.3c0 7 1.6 12.4 4.9 16 3.4 3.5 8.2 5.2 14.5 5.2 6.2 0 11-1.8 14.3-5.4 3.4-3.6 5-8.8 5-15.8V5a4 4 0 011.2-3c.9-.7 1.9-1.1 3-1.1h21.2A4 4 0 01309 2a4 4 0 011.1 3v66.5c0 15-4.3 26.4-13 33.9a52.2 52.2 0 01-35.5 11.2zM336 115c-1.2 0-2.1-.4-3-1.1a4.3 4.3 0 01-1.2-3V5A4 4 0 01333 2c.9-.7 1.8-1.1 3-1.1h44.3a51 51 0 0133.2 9.8 33 33 0 0112 27.4 34 34 0 01-5.3 19.4 34.4 34.4 0 01-14.8 12.2l22.3 40c.3.7.5 1.3.5 1.9 0 .8-.4 1.7-1.2 2.4-.6.7-1.4 1-2.2 1H403a6.8 6.8 0 01-6.7-4.4l-18.6-35.9h-16.6V111c0 1.2-.4 2.2-1.3 3a4 4 0 01-3 1.1h-21zm44-63.4c5 0 8.7-1.2 11.3-3.6 2.6-2.5 4-6 4-10.3 0-4.3-1.4-7.7-4-10.2-2.5-2.6-6.3-4-11.4-4h-18.7v28h18.7zM448.6 115c-1 0-2-.4-3-1.1a4.3 4.3 0 01-1-3V5a4 4 0 011-2.9c1-.7 2-1.1 3-1.1h21.9a4 4 0 012.9 1.1c.9.8 1.3 1.8 1.3 3v106c0 1.1-.4 2.1-1.3 2.9a4 4 0 01-3 1.1h-21.8z" fill="#F7F7F7"/></svg>
|
Before Width: | Height: | Size: 1.6 KiB |
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "<%= name %>",
|
||||
"scripts": {
|
||||
"tauri": "tauri"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<!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>
|
@ -1,26 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// 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
|
||||
/**
|
||||
* the app's dev server URL, or the path to the directory containing an index.html to open
|
||||
*/
|
||||
devPath: string
|
||||
/**
|
||||
* a shell command to run before `tauri dev` kicks in
|
||||
*/
|
||||
beforeDevCommand?: string
|
||||
/**
|
||||
* a shell command to run before `tauri build` kicks in
|
||||
*/
|
||||
beforeBuildCommand?: string
|
||||
withGlobalTauri?: boolean
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export enum ManagementType {
|
||||
Install,
|
||||
InstallDev,
|
||||
Update
|
||||
}
|
||||
|
||||
export type Result = Map<ManagementType, string[]>
|
@ -1,22 +0,0 @@
|
||||
import { Answers, QuestionCollection } from 'inquirer'
|
||||
import { PackageManager } from '../dependency-manager'
|
||||
import { TauriBuildConfig } from './config'
|
||||
|
||||
export interface RecipeArgs {
|
||||
cwd: string
|
||||
cfg: TauriBuildConfig
|
||||
packageManager: PackageManager
|
||||
ci: boolean
|
||||
answers?: Answers
|
||||
}
|
||||
|
||||
export interface Recipe {
|
||||
descriptiveName: { name: string; value: string }
|
||||
shortName: string
|
||||
configUpdate?: (args: RecipeArgs) => TauriBuildConfig
|
||||
extraNpmDependencies: string[]
|
||||
extraNpmDevDependencies: string[]
|
||||
extraQuestions?: (args: RecipeArgs) => QuestionCollection[]
|
||||
preInit?: (args: RecipeArgs) => Promise<void>
|
||||
postInit?: (args: RecipeArgs) => Promise<void>
|
||||
}
|
@ -1,194 +0,0 @@
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { main, spawn, sleep } from 'effection'
|
||||
import { exec } from '@effection/process'
|
||||
import fs from 'fs/promises'
|
||||
import path from 'path'
|
||||
import crypto from 'crypto'
|
||||
import tempDirectory from 'temp-dir'
|
||||
|
||||
let assert
|
||||
const nodeVersion = process.versions.node.split('.')[0]
|
||||
if (nodeVersion === '14') {
|
||||
assert = await import('assert')
|
||||
} else {
|
||||
assert = await import('assert/strict')
|
||||
}
|
||||
|
||||
const ctaBinary = path.resolve('./bin/create-tauri-app.js')
|
||||
//const clijs = path.resolve('../cli.js/')
|
||||
//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', 'solid', 'cljs']
|
||||
const parallelize = process.env.TAURI_RECIPE_PARALLELIZE || false
|
||||
|
||||
main(function* start() {
|
||||
const tauriTemp = path.join(
|
||||
tempDirectory,
|
||||
`tauri_${crypto.randomBytes(16).toString('hex')}`
|
||||
)
|
||||
|
||||
try {
|
||||
const appName = 'tauri-app'
|
||||
let output = {}
|
||||
for (let i = 0; i < recipes.length; i++) {
|
||||
const recipe = recipes[i]
|
||||
console.log(`::group::recipe ${recipe}`)
|
||||
console.log(`------------------ ${recipe} started -------------------`)
|
||||
const recipeFolder = path.join(tauriTemp, recipe)
|
||||
const appFolder = path.join(recipeFolder, appName)
|
||||
yield fs.mkdir(recipeFolder, { recursive: true })
|
||||
console.log(`${recipeFolder} created.`)
|
||||
|
||||
// runs CTA with all args set to avoid any prompts
|
||||
const run = `node '${ctaBinary}' --manager ${manager} --recipe ${recipe} --ci --dev`
|
||||
console.log(`[running] ${run}`)
|
||||
|
||||
let opts = []
|
||||
if (manager === 'npm') {
|
||||
opts =
|
||||
recipe == 'vuecli'
|
||||
? ['run', 'tauri:build']
|
||||
: ['run', 'tauri', '--', 'build']
|
||||
} else if (manager === 'yarn') {
|
||||
opts = recipe == 'vuecli' ? ['tauri:build'] : ['tauri', 'build']
|
||||
}
|
||||
|
||||
if (!parallelize) {
|
||||
const cta = yield exec(run, { cwd: recipeFolder })
|
||||
yield streamLogs(cta)
|
||||
// now it is finished, assert on some things
|
||||
yield assertCTAState({ appFolder, appName })
|
||||
|
||||
const tauriBuild = yield exec(manager, {
|
||||
arguments: opts,
|
||||
cwd: appFolder
|
||||
})
|
||||
yield streamLogs(tauriBuild)
|
||||
// build is complete, assert on some things
|
||||
yield assertTauriBuildState({ appFolder, appName })
|
||||
} else {
|
||||
console.log('running CTA recipe in parallel')
|
||||
output[recipe] = yield spawn(function* () {
|
||||
const childCTA = yield exec(run, { cwd: recipeFolder })
|
||||
const cta = yield captureLogs(childCTA)
|
||||
const childTauriBuild = yield exec(manager, {
|
||||
arguments: opts,
|
||||
cwd: appFolder
|
||||
})
|
||||
const tauriBuild = yield captureLogs(childTauriBuild)
|
||||
return { cta, tauriBuild }
|
||||
})
|
||||
}
|
||||
|
||||
console.log(`------------------ ${recipe} complete -------------------`)
|
||||
console.log('::endgroup::')
|
||||
// sometimes it takes a moment to flush all of the logs
|
||||
// to the console, let things catch up here
|
||||
yield sleep(1000)
|
||||
}
|
||||
|
||||
if (parallelize) {
|
||||
for (let i = 0; i < recipes.length; i++) {
|
||||
const recipe = recipes[i]
|
||||
console.log(`::group::recipe ${recipe} logs`)
|
||||
console.log(
|
||||
`------------------ ${recipe} output start -------------------`
|
||||
)
|
||||
const out = yield output[recipe]
|
||||
console.log(out.cta)
|
||||
console.log(out.tauriBuild)
|
||||
console.log(
|
||||
`------------------ ${recipe} output end -------------------`
|
||||
)
|
||||
console.log('::endgroup::')
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
throw Error(e)
|
||||
} finally {
|
||||
console.log('\nstopping process...')
|
||||
// wait a tick for file locks to be release
|
||||
yield sleep(5000)
|
||||
yield fs.rm(tauriTemp, { recursive: true, force: true })
|
||||
console.log(`${tauriTemp} deleted.`)
|
||||
}
|
||||
})
|
||||
|
||||
function* streamLogs(child) {
|
||||
yield child.stdout.forEach((data) => {
|
||||
process.stdout.write(data)
|
||||
})
|
||||
yield child.stderr.forEach((data) => {
|
||||
process.stderr.write(data)
|
||||
})
|
||||
}
|
||||
|
||||
function* captureLogs(child) {
|
||||
let log = ''
|
||||
yield child.stdout.forEach((data) => {
|
||||
log += data
|
||||
})
|
||||
yield child.stderr.forEach((data) => {
|
||||
log += data
|
||||
})
|
||||
|
||||
return log
|
||||
}
|
||||
|
||||
function* assertCTAState({ appFolder, appName }) {
|
||||
const packageFileInitial = JSON.parse(
|
||||
yield fs.readFile(path.join(appFolder, 'package.json'), 'utf-8')
|
||||
)
|
||||
assert.strictEqual(
|
||||
packageFileInitial.name,
|
||||
appName,
|
||||
`The package.json did not have the name "${appName}".`
|
||||
)
|
||||
assert.strictEqual(
|
||||
packageFileInitial.scripts.tauri,
|
||||
'tauri',
|
||||
`The package.json did not have the tauri script.`
|
||||
)
|
||||
}
|
||||
|
||||
function* assertTauriBuildState({ appFolder, appName }) {
|
||||
const packageFileOutput = JSON.parse(
|
||||
yield fs.readFile(path.join(appFolder, 'package.json'), 'utf-8')
|
||||
)
|
||||
assert.strictEqual(
|
||||
packageFileOutput.name,
|
||||
appName,
|
||||
`The package.json did not have the name "${appName}".`
|
||||
)
|
||||
assert.strictEqual(
|
||||
packageFileOutput.scripts.tauri,
|
||||
'tauri',
|
||||
`The package.json did not have the tauri script.`
|
||||
)
|
||||
|
||||
const cargoFileOutput = yield fs.readFile(
|
||||
path.join(appFolder, 'src-tauri', 'Cargo.toml'),
|
||||
'utf-8'
|
||||
)
|
||||
assert.strictEqual(
|
||||
cargoFileOutput.startsWith(`[package]\nname = "app"`),
|
||||
true,
|
||||
`The Cargo.toml did not have the name "app".`
|
||||
)
|
||||
|
||||
const tauriTarget = yield fs.readdir(
|
||||
path.join(appFolder, 'src-tauri', 'target')
|
||||
)
|
||||
assert.strictEqual(
|
||||
tauriTarget.includes('release'),
|
||||
true,
|
||||
`The Tauri build does not have a target/release directory.`
|
||||
)
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"module": "esnext",
|
||||
"target": "es6",
|
||||
"allowJs": true,
|
||||
"pretty": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node",
|
||||
"checkJs": false,
|
||||
"preserveSymlinks": true,
|
||||
"skipLibCheck": true,
|
||||
"typeRoots": ["types", "node_modules/@types"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["src/templates", "types", "test", "__fixtures__"]
|
||||
}
|
@ -1 +0,0 @@
|
||||
declare module 'fixturez'
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user