-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reincorporated Preact and PreactTS templates. #145
Merged
Merged
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
bd67853
Reincorporated Preact and PreactTS templates.
extrordinaire b8914eb
Update README.md
extrordinaire 2ab7a4a
Added the templates inside .scripts for testing and added that step i…
extrordinaire e877b7e
Merge remote-tracking branch 'refs/remotes/origin/dev' into dev
extrordinaire 9e79f25
Formatted with cargo fmt --all and added missing dependency babel/core
extrordinaire 3a37a70
Formatted with prettier
extrordinaire dcbc64f
Fixed scripts in preact vanilla
extrordinaire a42f63d
Update .github/CONTRIBUTING.md
extrordinaire ff0873c
Update packages/cli/fragments/fragment-preact-ts/index.html
extrordinaire e2c55fe
Update packages/cli/fragments/fragment-preact-ts/src/app.tsx
extrordinaire c76ef96
Update packages/cli/fragments/fragment-preact/src/app.jsx
extrordinaire 607c5fd
Update packages/cli/fragments/fragment-preact/src/app.jsx
extrordinaire 35682da
Done all revision request and modified every which is more concise
extrordinaire a76e4ce
Modified every Click on Tauri, Vite, and {Framework} logos to learn m…
extrordinaire 33db40f
Formatted with Cargo and Prettier, fixed misspelled stylesheet index …
extrordinaire 3e850e5
Update packages/cli/fragments/fragment-preact-ts/src/app.tsx
extrordinaire 72c09da
Update packages/cli/fragments/fragment-preact/src/app.jsx
extrordinaire 6dfb7af
Merge branch 'dev' into dev2
amrbashir 3027e3f
update beforedev/buildCommands in manifest
amrbashir 4be78f4
inscrease preact logo shadow
amrbashir 1112701
add @types/node to preact-ts
amrbashir 9c07acc
fmt
amrbashir cae0b35
changefile
amrbashir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ const nodeJsTemplates = [ | |
"vanilla", | ||
"next", | ||
"next-ts", | ||
"preact", | ||
"preact-ts", | ||
]; | ||
|
||
const matrix = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/cli/fragments/fragment-preact-ts/.vscode/extensions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Tauri + Preact + Typescript | ||
|
||
This template should help get you started developing with Tauri, Preact and Typescript in Vite. | ||
|
||
## Recommended IDE Setup | ||
|
||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# SPDX-License-Identifier: MIT | ||
|
||
devCommand = {{pkg_manager_run_command}} dev | ||
buildCommand = {{pkg_manager_run_command}} build | ||
devPath = http://localhost:1420 | ||
distDir = ../dist | ||
|
||
[files] | ||
preact.svg = src/assets/preact.svg | ||
vite.svg = public/vite.svg | ||
tauri.svg = public/tauri.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tauri + Preact + TS App</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "{{package_name}}", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview", | ||
"tauri": "tauri" | ||
}, | ||
"dependencies": { | ||
"@tauri-apps/api": "^1.0.2", | ||
"preact": "^10.10.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.10", | ||
"@preact/preset-vite": "^2.3.0", | ||
"@tauri-apps/cli": "^1.0.5", | ||
"typescript": "^4.6.4", | ||
"vite": "^3.0.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.logo.vite:hover { | ||
filter: drop-shadow(0 0 2em #747bff); | ||
} | ||
|
||
.logo.preact:hover { | ||
filter: drop-shadow(0 0 1em #673ab8aa); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useState } from "preact/hooks"; | ||
import preactLogo from "./assets/preact.svg"; | ||
import { invoke } from "@tauri-apps/api/tauri"; | ||
import "./app.css"; | ||
|
||
export function App<FC>() { | ||
const [greetMsg, setGreetMsg] = useState<string>(""); | ||
const [name, setName] = useState<string>(""); | ||
|
||
const greet = async () => { | ||
setGreetMsg(await invoke("greet", { name })); | ||
}; | ||
|
||
return ( | ||
<div class="container"> | ||
<h1>Welcome to Tauri!</h1> | ||
<div class="row"> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src="/vite.svg" class="logo vite" alt="Vite logo" /> | ||
</a> | ||
<a href="https://tauri.app" target="_blank"> | ||
<img src="/tauri.svg" class="logo tauri" alt="Tauri logo" /> | ||
</a> | ||
<a href="https://preactjs.com" target="_blank"> | ||
<img src={preactLogo} class="logo preact" alt="Preact logo" /> | ||
</a> | ||
</div> | ||
|
||
<p>Click on the Tauri, Vite, and Preact logos to learn more.</p> | ||
|
||
<div className="row"> | ||
extrordinaire marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div> | ||
<input | ||
id="greet-input" | ||
onChange={(e) => setName(e.currentTarget.value)} | ||
placeholder="Enter a name..." | ||
/> | ||
<button type="button" onClick={() => greet()}> | ||
Greet | ||
</button> | ||
</div> | ||
</div> | ||
<p>{greetMsg}</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { render } from "preact"; | ||
import { App } from "./app"; | ||
import "./style.css"; | ||
|
||
render(<App />, document.getElementById("app") as HTMLElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import JSX = preact.JSX; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"useDefineForClassFields": true, | ||
"lib": ["DOM", "DOM.Iterable", "ESNext"], | ||
"allowJs": false, | ||
"skipLibCheck": true, | ||
"esModuleInterop": false, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "preserve", | ||
"jsxFactory": "h", | ||
"jsxFragmentFactory": "Fragment" | ||
}, | ||
"include": ["src"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { defineConfig } from "vite"; | ||
import preact from "@preact/preset-vite"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [preact()], | ||
|
||
// Vite optons tailored for Tauri development and only applied in `tauri dev` or `tauri build` | ||
// prevent vite from obscuring rust errors | ||
clearScreen: false, | ||
// tauri expects a fixed port, fail if that port is not available | ||
server: { | ||
port: 1420, | ||
strictPort: true, | ||
}, | ||
// to make use of `TAURI_DEBUG` and other env variables | ||
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand | ||
envPrefix: ["VITE_", "TAURI_"], | ||
build: { | ||
// Tauri supports es2021 | ||
target: ["es2021", "chrome100", "safari13"], | ||
// don't minify for debug builds | ||
minify: !process.env.TAURI_DEBUG ? "esbuild" : false, | ||
// produce sourcemaps for debug builds | ||
sourcemap: !!process.env.TAURI_DEBUG, | ||
}, | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/cli/fragments/fragment-preact/.vscode/extensions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Tauri + Preact | ||
|
||
This template should help get you started developing with Tauri and Preact in Vite. | ||
|
||
## Recommended IDE Setup | ||
|
||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# SPDX-License-Identifier: MIT | ||
|
||
devCommand = {{pkg_manager_run_command}} dev | ||
buildCommand = {{pkg_manager_run_command}} build | ||
devPath = http://localhost:1420 | ||
distDir = ../dist | ||
|
||
[files] | ||
preact.svg = src/assets/preact.svg | ||
vite.svg = public/vite.svg | ||
tauri.svg = public/tauri.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tauri + Preact App</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "{{package_name}}", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"tauri": "tauri" | ||
}, | ||
"dependencies": { | ||
"@tauri-apps/api": "^1.0.2", | ||
"preact": "^10.10.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.10", | ||
"@preact/preset-vite": "^2.3.0", | ||
"@tauri-apps/cli": "^1.0.5", | ||
"vite": "^3.0.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.logo.vite:hover { | ||
filter: drop-shadow(0 0 2em #747bff); | ||
} | ||
.logo.preact:hover { | ||
filter: drop-shadow(0 0 1em #673ab8aa); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
@types/node
to devDependenciesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is not resolved yet.