Skip to content

Commit

Permalink
docs: add projects (#216)
Browse files Browse the repository at this point in the history
* docs: add projects

* docs(projects): add vue-router

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
kagol and autofix-ci[bot] committed Jan 25, 2025
1 parent fd66bb3 commit 909e161
Show file tree
Hide file tree
Showing 21 changed files with 387 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/auto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: [main]
paths:
- 'packages/docs/**'
- 'packages/projects/**'
- '!packages/docs/**/*.spec.ts'

# Allows you to run this workflow manually from the Actions tab
Expand Down Expand Up @@ -38,6 +39,8 @@ jobs:
run: pnpm i --no-frozen-lockfile
- name: Build site
run: pnpm build
- name: Build projects
run: pnpm build:projects
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Build with Jekyll
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
],
"scripts": {
"dev": "pnpm -F docs dev",
"dev:projects": "pnpm -F projects dev",
"build": "pnpm -F docs build",
"build:projects": "pnpm -F projects build",
"build:lib": "pnpm -F @opentiny/fluent-editor build",
"lint": "eslint . --cache",
"lint:fix": "eslint . --fix",
Expand Down
24 changes: 24 additions & 0 deletions packages/projects/.gitignore
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?
3 changes: 3 additions & 0 deletions packages/projects/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
5 changes: 5 additions & 0 deletions packages/projects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
13 changes: 13 additions & 0 deletions packages/projects/index.html
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>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions packages/projects/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "projects",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@opentiny/fluent-editor": "workspace:^",
"vue": "^3.5.13",
"vue-router": "4"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
"@vue/tsconfig": "^0.7.0",
"typescript": "~5.6.2",
"vite": "^6.0.5",
"vue-tsc": "^2.2.0"
}
}
1 change: 1 addition & 0 deletions packages/projects/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/projects/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<RouterView />
</template>
1 change: 1 addition & 0 deletions packages/projects/src/assets/vue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/projects/src/components/NotFound.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div>Not Found</div>
</template>
22 changes: 22 additions & 0 deletions packages/projects/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createApp } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'
import App from './App.vue'
import NotFoundComponent from './components/NotFound.vue'
import HomeView from './views/home/Home.vue'
import YuQueView from './views/yuque/YuQue.vue'
import './style.css'

const routes = [
{ path: '/', component: HomeView },
{ path: '/yuque', component: YuQueView },
{ path: '/:pathMatch(.*)', component: NotFoundComponent },
]

const router = createRouter({
history: createWebHistory('/tiny-editor/projects'),
routes,
})

router.addRoute({ path: '/', component: HomeView })

createApp(App).use(router).mount('#app')
1 change: 1 addition & 0 deletions packages/projects/src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import '@opentiny/fluent-editor/style.scss';
9 changes: 9 additions & 0 deletions packages/projects/src/views/home/Home.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<ul>
<li>
<RouterLink to="/yuque">
语雀
</RouterLink>
</li>
</ul>
</template>
21 changes: 21 additions & 0 deletions packages/projects/src/views/yuque/YuQue.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang="ts">
import FluentEditor from '@opentiny/fluent-editor'
import { onMounted } from 'vue'
let editor
onMounted(() => {
editor = new FluentEditor('#editor', {
theme: 'snow',
})
})
</script>

<template>
<RouterLink to="/">
&lt;返回
</RouterLink>
<div id="editor">
<p>Hello <strong>TinyEditor</strong>!</p>
</div>
</template>
1 change: 1 addition & 0 deletions packages/projects/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
14 changes: 14 additions & 0 deletions packages/projects/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUncheckedSideEffectImports": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
}
7 changes: 7 additions & 0 deletions packages/projects/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
],
"files": []
}
24 changes: 24 additions & 0 deletions packages/projects/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"moduleDetection": "force",
"module": "ESNext",

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noEmit": true,
"isolatedModules": true,
"skipLibCheck": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}
20 changes: 20 additions & 0 deletions packages/projects/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import path from 'node:path'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'

const fluentEditorRoot = path.resolve(__dirname, '../fluent-editor')
export default defineConfig({
base: '/tiny-editor/projects/',
plugins: [vue()],
resolve: {
alias: [
{
find: '@opentiny/fluent-editor/style.scss',
replacement: path.resolve(fluentEditorRoot, 'src/assets/style.scss'),
},
],
},
build: {
outDir: '../docs/fluent-editor/.vitepress/dist/projects',
},
})
Loading

0 comments on commit 909e161

Please sign in to comment.