添加nodejs库模块
This commit is contained in:
@@ -37,7 +37,7 @@ jobs:
|
||||
|
||||
# 打包成静态文件
|
||||
- name: Build
|
||||
run: pnpm install && pnpm run build:docs
|
||||
run: pnpm install && pnpm run docs:build
|
||||
|
||||
# 部署到GitHub Pages - 也就是将打包内容发布到GitHub Pages
|
||||
- name: Deploy
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
test/*/
|
||||
dist/
|
||||
dist/
|
||||
cache/
|
||||
+28
-7
@@ -1,29 +1,50 @@
|
||||
{
|
||||
"hash": "6ec9580f",
|
||||
"configHash": "63f53f9c",
|
||||
"lockfileHash": "977d219f",
|
||||
"browserHash": "82248257",
|
||||
"hash": "3043a3a4",
|
||||
"configHash": "33e5bd4c",
|
||||
"lockfileHash": "5441c587",
|
||||
"browserHash": "ca4cc7bc",
|
||||
"optimized": {
|
||||
"vue": {
|
||||
"src": "../../../../node_modules/.pnpm/vue@3.4.37_typescript@5.5.4/node_modules/vue/dist/vue.runtime.esm-bundler.js",
|
||||
"file": "vue.js",
|
||||
"fileHash": "0ade658a",
|
||||
"fileHash": "010c3b5d",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vue/devtools-api": {
|
||||
"src": "../../../../node_modules/.pnpm/@vue+devtools-api@7.3.8/node_modules/@vue/devtools-api/dist/index.js",
|
||||
"file": "vitepress___@vue_devtools-api.js",
|
||||
"fileHash": "ee5e47e7",
|
||||
"fileHash": "23d68367",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vueuse/core": {
|
||||
"src": "../../../../node_modules/.pnpm/@vueuse+core@10.11.1_vue@3.4.37_typescript@5.5.4_/node_modules/@vueuse/core/index.mjs",
|
||||
"file": "vitepress___@vueuse_core.js",
|
||||
"fileHash": "5de7d56b",
|
||||
"fileHash": "ac973a09",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vueuse/integrations/useFocusTrap": {
|
||||
"src": "../../../../node_modules/.pnpm/@vueuse+integrations@10.11.1_focus-trap@7.5.4_vue@3.4.37_typescript@5.5.4_/node_modules/@vueuse/integrations/useFocusTrap.mjs",
|
||||
"file": "vitepress___@vueuse_integrations_useFocusTrap.js",
|
||||
"fileHash": "ce3e21ae",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > mark.js/src/vanilla.js": {
|
||||
"src": "../../../../node_modules/.pnpm/mark.js@8.11.1/node_modules/mark.js/src/vanilla.js",
|
||||
"file": "vitepress___mark__js_src_vanilla__js.js",
|
||||
"fileHash": "ea25cf40",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > minisearch": {
|
||||
"src": "../../../../node_modules/.pnpm/minisearch@7.1.0/node_modules/minisearch/dist/es/index.js",
|
||||
"file": "vitepress___minisearch.js",
|
||||
"fileHash": "f477f570",
|
||||
"needsInterop": false
|
||||
}
|
||||
},
|
||||
"chunks": {
|
||||
"chunk-Y4BZYF5F": {
|
||||
"file": "chunk-Y4BZYF5F.js"
|
||||
},
|
||||
"chunk-NNKZBCFC": {
|
||||
"file": "chunk-NNKZBCFC.js"
|
||||
}
|
||||
|
||||
+277
-8894
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,12 +1,8 @@
|
||||
import topNav from "./topNav/index";
|
||||
import { sideBar } from "./sideBar";
|
||||
const config = {
|
||||
// themeConfig: {
|
||||
// sidebar,
|
||||
// },
|
||||
// Layout,
|
||||
base: "/lz-space/",
|
||||
|
||||
description: "个人学习、分享、记录",
|
||||
markdown: {
|
||||
container: {
|
||||
tipLabel: "提示",
|
||||
@@ -18,8 +14,12 @@ const config = {
|
||||
},
|
||||
|
||||
themeConfig: {
|
||||
siteTitle: "lambert 的文档",
|
||||
nav: topNav,
|
||||
sidebar: sideBar,
|
||||
search: {
|
||||
provider: "local",
|
||||
},
|
||||
docFooter: {
|
||||
prev: "上一篇",
|
||||
next: "下一篇",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { vitePress } from "./note/vitePress.ts";
|
||||
export const sideBar = {
|
||||
"/": [
|
||||
{ text: "快速开始", link: "/" },
|
||||
{ text: "Button 按钮", link: "/components/button/" },
|
||||
],
|
||||
import { nodejs } from "./note/nodejs.ts";
|
||||
|
||||
export const sideBar = {
|
||||
"/components": [{ text: "Button 按钮", link: "/components/button/" }],
|
||||
"/note/vitePress": vitePress,
|
||||
"/note/nodejs": nodejs,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// VitePress技术笔记左侧导航栏
|
||||
export const nodejs = [
|
||||
{
|
||||
text: "nodejs 相关库",
|
||||
items: [
|
||||
{
|
||||
text: "1. prompt 库",
|
||||
link: "/note/nodejs/prompts",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -1,72 +0,0 @@
|
||||
<!-- .vitepress/theme/Layout.vue -->
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useData } from "vitepress";
|
||||
import DefaultTheme from "vitepress/theme";
|
||||
import { nextTick, provide } from "vue";
|
||||
|
||||
const { isDark } = useData();
|
||||
|
||||
const enableTransitions = () =>
|
||||
"startViewTransition" in document &&
|
||||
window.matchMedia("(prefers-reduced-motion: no-preference)").matches;
|
||||
|
||||
provide("toggle-appearance", async ({ clientX: x, clientY: y }: MouseEvent) => {
|
||||
if (!enableTransitions()) {
|
||||
isDark.value = !isDark.value;
|
||||
return;
|
||||
}
|
||||
|
||||
const clipPath = [
|
||||
`circle(0px at ${x}px ${y}px)`,
|
||||
`circle(${Math.hypot(
|
||||
Math.max(x, innerWidth - x),
|
||||
Math.max(y, innerHeight - y)
|
||||
)}px at ${x}px ${y}px)`,
|
||||
];
|
||||
|
||||
await document.startViewTransition(async () => {
|
||||
isDark.value = !isDark.value;
|
||||
await nextTick();
|
||||
}).ready;
|
||||
|
||||
document.documentElement.animate(
|
||||
{ clipPath: isDark.value ? clipPath.reverse() : clipPath },
|
||||
{
|
||||
duration: 300,
|
||||
easing: "ease-in",
|
||||
pseudoElement: `::view-transition-${isDark.value ? "old" : "new"}(root)`,
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DefaultTheme.Layout />
|
||||
</template>
|
||||
|
||||
<style>
|
||||
::view-transition-old(root),
|
||||
::view-transition-new(root) {
|
||||
animation: none;
|
||||
mix-blend-mode: normal;
|
||||
}
|
||||
|
||||
::view-transition-old(root),
|
||||
.dark::view-transition-new(root) {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
::view-transition-new(root),
|
||||
.dark::view-transition-old(root) {
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.VPSwitchAppearance {
|
||||
width: 22px !important;
|
||||
}
|
||||
|
||||
.VPSwitchAppearance .check {
|
||||
transform: none !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,9 @@
|
||||
export default [
|
||||
{
|
||||
text: "组件展示",
|
||||
items: [{ text: "按钮", link: "/components/button" }],
|
||||
},
|
||||
|
||||
{
|
||||
text: "前端网聚",
|
||||
items: [
|
||||
@@ -9,11 +14,11 @@ export default [
|
||||
},
|
||||
{
|
||||
text: "技术笔记",
|
||||
items: [
|
||||
{ text: "VitePress", link: "/note/vitePress" },
|
||||
{ text: "Vue", link: "/note/vue" },
|
||||
{ text: "react", link: "/note/react" },
|
||||
],
|
||||
items: [{ text: "VitePress", link: "/note/vitePress" }],
|
||||
},
|
||||
{
|
||||
text: "nodejs",
|
||||
items: [{ text: "prompt", link: "/note/nodejs/prompts" }],
|
||||
},
|
||||
{
|
||||
text: "关于我们",
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# prompts nodejs环境下的输入交互工具
|
||||
|
||||
1. 安装
|
||||
npm install --save prompts
|
||||
|
||||
[npm 主页](https://www.npmjs.com/package/prompts)
|
||||
|
||||
[中文文档](https://chinabigpan.github.io/prompts_docs_cn/routes/examples.html)
|
||||
|
||||
[输入类型](https://chinabigpan.github.io/prompts_docs_cn/routes/types.html)
|
||||
Types
|
||||
文本 (text)
|
||||
密码 (password)
|
||||
隐藏 (invisible)
|
||||
数字 (number)
|
||||
是非 (confirm)
|
||||
清单 (list)
|
||||
切换 (toggle)
|
||||
选择 (select)
|
||||
多选 (multiselect)
|
||||
自动填充 (autoComplete)
|
||||
日期 (data)
|
||||
|
||||
<<< @/.vitepress/sideBar/note/vitePress.ts
|
||||
@@ -1 +1,43 @@
|
||||
# vitePress 搭建项目
|
||||
|
||||
1. 初始化项目
|
||||
|
||||
```bash
|
||||
npm i -D vitepress
|
||||
mkdir docs
|
||||
cd docs
|
||||
npx vitepress init
|
||||
```
|
||||
|
||||
2. 启动项目
|
||||
|
||||
```bash
|
||||
npm run docs:dev
|
||||
```
|
||||
|
||||
3. 打包项目
|
||||
|
||||
```bash
|
||||
npm run docs:build
|
||||
```
|
||||
|
||||
4. 初始化首页配置
|
||||
|
||||
```bash
|
||||
# 初始化导航栏
|
||||
mkdir topNav
|
||||
# 初始化侧边栏
|
||||
mkdir sideBar
|
||||
# 初始化主题
|
||||
mkdir theme
|
||||
```
|
||||
|
||||
- topNav 目录下创建 `index.ts` 文件
|
||||
|
||||
<<< @/.vitepress/topNav/index.ts
|
||||
|
||||
- sideBar 目录下创建 `index.ts` 文件
|
||||
|
||||
<<< @/.vitepress/sideBar/index.ts
|
||||
|
||||
<<< @/.vitepress/sideBar/note/vitePress.ts
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# vitePress markdown 扩展
|
||||
|
||||
## 自定义容器
|
||||
|
||||
::: danger STOP
|
||||
危险区域,请勿继续
|
||||
:::
|
||||
|
||||
::: details 点我查看代码
|
||||
|
||||
```js
|
||||
console.log('Hello, VitePress!')
|
||||
```
|
||||
|
||||
:::
|
||||
+2
-1
@@ -13,7 +13,8 @@
|
||||
"postinstall": "husky install",
|
||||
"commit": "cz",
|
||||
"commitlint": "commitlint --config commitlint.config.js -e -V",
|
||||
"build:docs": "pnpm run --filter=books docs:build"
|
||||
"docs:build": "pnpm run --filter=books docs:build",
|
||||
"docs:dev": "pnpm run --filter=books docs:dev"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@lz-space/nodejslibs",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"prompts": "^2.4.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
const prompts = require('prompts');
|
||||
|
||||
// 单个问题
|
||||
// (async () => {
|
||||
// const response = await prompts({
|
||||
// type: 'number',
|
||||
// name: 'value',
|
||||
// message: 'How old are you?',
|
||||
// validate: value => value < 18 ? `Nightclub is 18+ only` : true
|
||||
// });
|
||||
|
||||
// console.log(response); // => { value: 24 }
|
||||
// })();
|
||||
|
||||
// 问题链(Prompt Chain)
|
||||
|
||||
// const questions = [
|
||||
// {
|
||||
// type: 'text',
|
||||
// name: 'username',
|
||||
// message: 'What is your GitHub username?'
|
||||
// },
|
||||
// {
|
||||
// type: 'number',
|
||||
// name: 'age',
|
||||
// message: 'How old are you?'
|
||||
// },
|
||||
// {
|
||||
// type: 'text',
|
||||
// name: 'about',
|
||||
// message: 'Tell something about yourself',
|
||||
// initial: 'Why should I?'
|
||||
// }
|
||||
// ];
|
||||
|
||||
// (async () => {
|
||||
// const response = await prompts(questions);
|
||||
// console.log(response)
|
||||
// // => response => { username, age, about }
|
||||
// })();
|
||||
|
||||
|
||||
const questions = [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'dish',
|
||||
message: 'Do you like pizza?'
|
||||
},
|
||||
{
|
||||
type: prev => prev == 'pizza' ? 'text' : null,
|
||||
name: 'topping',
|
||||
message: 'Name a topping'
|
||||
}
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const response = await prompts(questions);
|
||||
console.log(response)
|
||||
})();
|
||||
Generated
+26
@@ -55,6 +55,12 @@ importers:
|
||||
|
||||
packages/components: {}
|
||||
|
||||
packages/nodejsLibs:
|
||||
dependencies:
|
||||
prompts:
|
||||
specifier: ^2.4.2
|
||||
version: 2.4.2
|
||||
|
||||
packages:
|
||||
|
||||
'@algolia/autocomplete-core@1.9.3':
|
||||
@@ -1224,6 +1230,10 @@ packages:
|
||||
resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==}
|
||||
engines: {'0': node >= 0.2.0}
|
||||
|
||||
kleur@3.0.3:
|
||||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
lines-and-columns@1.2.4:
|
||||
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
|
||||
|
||||
@@ -1408,6 +1418,10 @@ packages:
|
||||
preact@10.23.2:
|
||||
resolution: {integrity: sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==}
|
||||
|
||||
prompts@2.4.2:
|
||||
resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
readable-stream@3.6.2:
|
||||
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
|
||||
engines: {node: '>= 6'}
|
||||
@@ -1487,6 +1501,9 @@ packages:
|
||||
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
sisteransi@1.0.5:
|
||||
resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
|
||||
|
||||
source-map-js@1.2.0:
|
||||
resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -2952,6 +2969,8 @@ snapshots:
|
||||
|
||||
jsonparse@1.3.1: {}
|
||||
|
||||
kleur@3.0.3: {}
|
||||
|
||||
lines-and-columns@1.2.4: {}
|
||||
|
||||
locate-path@7.2.0:
|
||||
@@ -3105,6 +3124,11 @@ snapshots:
|
||||
|
||||
preact@10.23.2: {}
|
||||
|
||||
prompts@2.4.2:
|
||||
dependencies:
|
||||
kleur: 3.0.3
|
||||
sisteransi: 1.0.5
|
||||
|
||||
readable-stream@3.6.2:
|
||||
dependencies:
|
||||
inherits: 2.0.4
|
||||
@@ -3184,6 +3208,8 @@ snapshots:
|
||||
|
||||
signal-exit@4.1.0: {}
|
||||
|
||||
sisteransi@1.0.5: {}
|
||||
|
||||
source-map-js@1.2.0: {}
|
||||
|
||||
speakingurl@14.0.1: {}
|
||||
|
||||
Reference in New Issue
Block a user