Skip to content

Commit

Permalink
new example build
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardocavazza committed Jan 29, 2024
1 parent 0dfa0b5 commit c12ddba
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 24 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,14 @@ jobs:
- name: Install project dependencies
run: yarn install

- name: Run build script
run: yarn build

- name: Prepare
run: |
mkdir public
cp -rf examples public
cp -rf dist public
- name: Run build pages
run: yarn example:build

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v2
with:
path: 'public'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v2
28 changes: 15 additions & 13 deletions examples/navigation/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
content="width=device-width, initial-scale=1.0" />
<title>Synapse</title>
<script src="https://cdn.tailwindcss.com"></script>
<script type="importmap">
{
"imports": {
"@chialab/dna": "https://unpkg.com/@chialab/[email protected]/dist/esm/dna.js",
"@chialab/dna/jsx-runtime": "https://unpkg.com/@chialab/[email protected]/jsx-runtime.js",
"@chialab/synapse": "../../dist/esm/synapse.js"
}
}
</script>
<script
type="module"
src="index.js"></script>
<style>
html,
body {
Expand All @@ -43,5 +31,19 @@
}
</style>
</head>
<body> </body>
<body></body>
<script type="module">
import { document, html, render, window } from '@chialab/dna';
import { BrowserHistory } from './src/index.ts';
import './examples/navigation/App.js';

const app = render(
html`<demo-app
base=${`${window.location.pathname}#!/`}
history=${new BrowserHistory()} />`,
document.body
);

app.start();
</script>
</html>
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"test:browser": "vitest run --config vitest.browser.ts",
"test:node": "vitest run --config vitest.node.ts",
"lint": "prettier --check . && eslint src test",
"example:serve": "vite",
"example:build": "vite build",
"prepack": "yarn build && publint"
},
"files": [
Expand Down Expand Up @@ -60,6 +62,7 @@
"publint": "^0.2.7",
"rimraf": "^5.0.0",
"typescript": "^5.0.0",
"vite": "^5.0.12",
"vitest": "^1.2.2"
}
}
14 changes: 14 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';

export default defineConfig({
base: 'synapse',
build: {
outDir: 'public',
},
resolve: {
alias: {
'@chialab/synapse': fileURLToPath(new URL('./src/index.ts', import.meta.url)),
},
},
});
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5560,7 +5560,7 @@ [email protected]:
picocolors "^1.0.0"
vite "^5.0.0"

vite@^5.0.0:
vite@^5.0.0, vite@^5.0.12:
version "5.0.12"
resolved "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz#8a2ffd4da36c132aec4adafe05d7adde38333c47"
integrity sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==
Expand Down

0 comments on commit c12ddba

Please sign in to comment.