-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Embeds] Create vite project and add to build pipeline (#3448)
* add bskyembed vite app * create build script (temp until embedr is ready)
- Loading branch information
Showing
15 changed files
with
3,946 additions
and
3 deletions.
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
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,20 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint", "simple-import-sort"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"preact", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking" | ||
], | ||
"rules": { | ||
"simple-import-sort/imports": "warn", | ||
"simple-import-sort/exports": "warn" | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaVersion": "latest", | ||
"project": "./tsconfig.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,5 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local |
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,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Vite 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,21 @@ | ||
{ | ||
"name": "bskyembed", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx src" | ||
}, | ||
"dependencies": { | ||
"preact": "^10.4.8" | ||
}, | ||
"devDependencies": { | ||
"@prefresh/vite": "^1.2.1", | ||
"eslint": "^8.19.0", | ||
"eslint-config-preact": "^1.3.0", | ||
"eslint-plugin-simple-import-sort": "^12.0.0", | ||
"typescript": "^4.0.5", | ||
"vite": "^1.0.0-rc.13", | ||
"vite-tsconfig-paths": "^4.3.2" | ||
} | ||
} |
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,18 @@ | ||
import {Fragment, h} from 'preact' | ||
|
||
export function App() { | ||
return ( | ||
<> | ||
<p>Hello Vite + Preact!</p> | ||
<p> | ||
<a | ||
className="link" | ||
href="https://preactjs.com/" | ||
target="_blank" | ||
rel="noopener noreferrer"> | ||
Learn Preact | ||
</a> | ||
</p> | ||
</> | ||
) | ||
} |
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,29 @@ | ||
html, body { | ||
height: 100%; | ||
width: 100%; | ||
padding: 0; | ||
margin: 0; | ||
background: #FAFAFA; | ||
font-family: 'Helvetica Neue', arial, sans-serif; | ||
font-weight: 400; | ||
color: #444; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
#app { | ||
height: 100%; | ||
text-align: center; | ||
background-color: #673ab8; | ||
color: #fff; | ||
font-size: 1.5em; | ||
padding-top: 100px; | ||
} | ||
|
||
.link { | ||
color: #fff; | ||
} |
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 @@ | ||
import './index.css' | ||
|
||
import {h, render} from 'preact' | ||
|
||
import {App} from './app' | ||
|
||
const root = document.getElementById('app') | ||
if (!root) throw new Error('No root element') | ||
render(<App />, root) |
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": "ES5", | ||
"lib": ["DOM", "DOM.Iterable", "ESNext"], | ||
"types": [], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"esModuleInterop": false, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react", | ||
"jsxFactory": "h", | ||
"jsxFragmentFactory": "Fragment" | ||
}, | ||
"include": ["src"] | ||
} |
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,18 @@ | ||
import {resolve} from 'node:path' | ||
|
||
// @ts-expect-error - not important | ||
import preactRefresh from '@prefresh/vite' | ||
import type {UserConfig} from 'vite' | ||
import paths from 'vite-tsconfig-paths' | ||
|
||
const config: UserConfig = { | ||
jsx: { | ||
factory: 'h', | ||
fragment: 'Fragment', | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
plugins: [preactRefresh(), paths()], | ||
assetsDir: 'static/embed/assets', | ||
} | ||
|
||
export default config |
Oops, something went wrong.