Skip to content

Commit

Permalink
Merge pull request #34 from rycont/create-document
Browse files Browse the repository at this point in the history
Create document
  • Loading branch information
rycont authored Nov 3, 2024
2 parents fee4fb4 + 16cab5c commit cbe2ff6
Show file tree
Hide file tree
Showing 92 changed files with 1,407 additions and 285 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
yaksok.js
runtest.ts
.vscode
cov
cov
docs/api/
node_modules/
docs/.vitepress/cache/
docs/.vitepress/dist/
69 changes: 0 additions & 69 deletions README.md

This file was deleted.

16 changes: 0 additions & 16 deletions bundle.ts

This file was deleted.

68 changes: 68 additions & 0 deletions create-docs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import typedoc from 'typedoc'

const app = await typedoc.Application.bootstrapWithPlugins({
entryPoints: ['./src/index.ts'],
name: 'yaksok.ts',
})

const outputDir = 'docs/api'
const VALID_OPERATIONS = ['create', 'modify', 'rename', 'remove']

const isWatch = Deno.args.includes('--watch')
const CWD = Deno.cwd()

async function buildMarkdownDocs() {
const project = await app.convert()
if (project) {
await app.generateDocs(project, outputDir)
}
}

await buildMarkdownDocs()

if (!isWatch) {
Deno.exit(0)
}

console.log('Waiting for file changes...')

const watcher = Deno.watchFs('./src', {
recursive: true,
})

for await (const event of watcher) {
const type = event.kind
const isValidOperation = VALID_OPERATIONS.includes(type)

const paths = event.paths.map(clarifyPath)
const message = `[${type}] ${paths.join(', ')}`

if (!isValidOperation) {
continue
}

console.log(message)
buildMarkdownDocs()
}

function clarifyPath(path: string) {
if (path.startsWith(CWD)) {
path = path.slice(CWD.length)
}

while (true) {
if (path.startsWith('/')) {
path = path.slice(1)
continue
}

if (path.startsWith('./')) {
path = path.slice(1)
continue
}

break
}

return path
}
106 changes: 0 additions & 106 deletions demo/index.html

This file was deleted.

24 changes: 19 additions & 5 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"imports": {
"assert": "https://deno.land/[email protected]/assert/mod.ts"
"@vue/runtime-dom": "npm:@vue/runtime-dom@^3.5.12",
"@vueuse/core": "npm:@vueuse/core@^11.2.0",
"ansi-to-html": "npm:ansi-to-html@^0.7.2",
"assert": "https://deno.land/[email protected]/assert/mod.ts",
"quickjs-emscripten": "npm:quickjs-emscripten@^0.31.0",
"quickjs-emscripten-core": "npm:quickjs-emscripten-core@^0.31.0",
"typedoc": "npm:[email protected]",
"typedoc-plugin-markdown": "npm:typedoc-plugin-markdown@^4.2.10",
"vitepress": "npm:vitepress@^1.4.3",
"vitepress-plugin-auto-sidebar": "npm:vitepress-plugin-auto-sidebar@^1.2.0",
"vue": "npm:vue@^3.5.12"
},
"tasks": {
"coverage": "rm -rf ./cov && deno test --allow-read --parallel --coverage=cov && deno coverage --detailed ./cov && rm -rf ./cov",
"coverage-list": "rm -rf ./cov && deno test --allow-read --parallel --coverage=cov && deno coverage ./cov && rm -rf ./cov",
"build": "deno run --allow-net --allow-write --allow-read --allow-env --allow-run ./bundle.ts",
"build-demo": "deno task build && mv ./dist/index.js ./demo/yaksok.js"
"typedoc": "deno run --allow-read --allow-write --allow-env --allow-run ./create-docs.ts",
"vitepress-dev": "deno run -A npm:vitepress dev docs",
"vitepress-build": "deno run -A npm:vitepress build docs",
"docs-dev": "deno task typedoc --watch & deno task vitepress-dev",
"docs-build": "deno task typedoc && deno task vitepress-build"
},
"lint": {
"rules": {
Expand All @@ -16,6 +29,7 @@
}
},
"name": "@yaksok-ts/core",
"version": "0.1.10",
"exports": "./index.ts"
"version": "0.1.11",
"exports": "./src/index.ts",
"nodeModulesDir": "auto"
}
Loading

0 comments on commit cbe2ff6

Please sign in to comment.