diff --git a/.gitignore b/.gitignore index a9cc178..4229134 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,20 @@ .DS_Store node_modules +# Builds dist +# Capacitor ios android +# Tests +coverage + +# Docs +.vitepress + +# Version Control *.lock *-lock.json diff --git a/README.md b/README.md index 780b6e0..41d5fff 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,7 @@ A complete example of a COMMONERS application that connects to peripheral devices using Bluetooth and Serial across multiple platforms is available at our [commoners-starter-kit](https://github.com/garrettmflynn/commoners-starter-kit) repository. -## Why Commoners? -- 🖥️ 📲 Publish for web, mobile, and desktop from a single repository -- 📜 Only native web technologies (i.e. HTML, CSS, and JavaScript) required -- ⚡️ Built on Vite for lightning-fast development speeds +Read the [documentation](https://commoners.dev) to learn more. ## Getting started - `commoners start` - Start your project in an Electron application. diff --git a/docs/api-examples.md b/docs/api-examples.md new file mode 100644 index 0000000..6bd8bb5 --- /dev/null +++ b/docs/api-examples.md @@ -0,0 +1,49 @@ +--- +outline: deep +--- + +# Runtime API Examples + +This page demonstrates usage of some of the runtime APIs provided by VitePress. + +The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files: + +```md + + +## Results + +### Theme Data +
{{ theme }}
+ +### Page Data +
{{ page }}
+ +### Page Frontmatter +
{{ frontmatter }}
+``` + + + +## Results + +### Theme Data +
{{ theme }}
+ +### Page Data +
{{ page }}
+ +### Page Frontmatter +
{{ frontmatter }}
+ +## More + +Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..a7ac91e --- /dev/null +++ b/docs/index.md @@ -0,0 +1,31 @@ +--- +# https://vitepress.dev/reference/default-theme-home-page +layout: home + +hero: + name: "Commoners" + text: "Building Solidarity across Platforms" + tagline: Write your application for web, desktop, and mobile—without the fuss. + image: + src: /logo.png + alt: Commoners + actions: + - theme: brand + text: Markdown Examples + link: /markdown-examples + - theme: alt + text: API Examples + link: /api-examples + +features: + - icon: 🌐 + title: Simple Cross-Platform Builds + details: Publish for web, mobile, and desktop from a single repository. + - icon: 📜 + title: Web Native + details: Only native web technologies (i.e. HTML, CSS, and JavaScript) required. + - icon: ⚡️ + title: Built on Vite + details: Lightning-fast development speeds based on reliable tooling. +--- + diff --git a/docs/logo.png b/docs/logo.png new file mode 100644 index 0000000..9af394a Binary files /dev/null and b/docs/logo.png differ diff --git a/docs/markdown-examples.md b/docs/markdown-examples.md new file mode 100644 index 0000000..8e55eb8 --- /dev/null +++ b/docs/markdown-examples.md @@ -0,0 +1,85 @@ +# Markdown Extension Examples + +This page demonstrates some of the built-in markdown extensions provided by VitePress. + +## Syntax Highlighting + +VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting: + +**Input** + +```` +```js{4} +export default { + data () { + return { + msg: 'Highlighted!' + } + } +} +``` +```` + +**Output** + +```js{4} +export default { + data () { + return { + msg: 'Highlighted!' + } + } +} +``` + +## Custom Containers + +**Input** + +```md +::: info +This is an info box. +::: + +::: tip +This is a tip. +::: + +::: warning +This is a warning. +::: + +::: danger +This is a dangerous warning. +::: + +::: details +This is a details block. +::: +``` + +**Output** + +::: info +This is an info box. +::: + +::: tip +This is a tip. +::: + +::: warning +This is a warning. +::: + +::: danger +This is a dangerous warning. +::: + +::: details +This is a details block. +::: + +## More + +Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown). diff --git a/package.json b/package.json index 4c1bbf9..929dde3 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,10 @@ "build:library": "vite build --config ./packages/core/vite.config.ts", "watch": "vite build --watch", "watch:library": "vite build --watch --config ./packages/core/vite.library.config.ts", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "vitest", + "coverage": "vitest run --coverage", + "docs": "vitepress dev docs", + "docs:build": "vitepress build docs" }, "dependencies": { "@electron-toolkit/tsconfig": "^1.0.1", @@ -48,7 +51,10 @@ "devDependencies": { "@electron/remote": "^2.0.11", "@types/node": "16.18.21", + "@vitest/coverage-v8": "^0.34.5", "typescript": "^4.9.5", - "vite-plugin-static-copy": "^0.16.0" + "vite-plugin-static-copy": "^0.16.0", + "vitepress": "^1.0.0-rc.20", + "vitest": "^0.34.5" } } diff --git a/packages/core/tests/index.test.ts b/packages/core/tests/index.test.ts new file mode 100644 index 0000000..6e1c42a --- /dev/null +++ b/packages/core/tests/index.test.ts @@ -0,0 +1,9 @@ +// sum.test.js +import { expect, test } from 'vitest' + +function sum(a, b) { + return a + b + } +test('adds 1 + 2 to equal 3', () => { + expect(sum(1, 2)).toBe(3) +}) \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 3065ef1..2282a46 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,3 +1,5 @@ +/// + import { defineConfig, normalizePath } from "vite"; import { viteStaticCopy } from 'vite-plugin-static-copy' @@ -26,6 +28,9 @@ const toCopy = [ ] export default defineConfig({ + test: { + + }, plugins: [ { name: 'add-bin-shebang',