-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: template built-in search settings, optimize the home page and t…
…ab page styles
- Loading branch information
Showing
62 changed files
with
3,083 additions
and
1,257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
import linter from '@hacxy/eslint-config/vue'; | ||
import linter from '@hacxy/eslint-config'; | ||
|
||
export default linter({ | ||
typescript: { | ||
parserOptions: { | ||
project: ['./tsconfig.json', 'packages/theme/tsconfig.json'] | ||
} | ||
}, | ||
rules: { | ||
'regexp/no-unused-capturing-group': 0, | ||
'no-restricted-globals': 0, | ||
'vue/custom-event-name-casing': 0 | ||
}, | ||
ignores: [ | ||
'packages/demo/**/*', | ||
'packages/theme/node.js' | ||
], | ||
yaml: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# CLI Unbuild Template | ||
|
||
This is a CLI application project template with TypeScript as the main development language and [unbuild](https://github.com/unjs/unbuild) as the packaging and building tool. It allows you to quickly set up a CLI application project without the need for `watch` and `build`. You do not need to use any other build tools to monitor the `ts` code construction. | ||
|
||
English | [简体中文](https://github.com/hacxy/cli-template/blob/main/README_zh.md) | ||
|
||
## Prerequisites | ||
|
||
requires Node.js version 18+, 20+ | ||
|
||
## Using Templates | ||
|
||
### Create Template Locally | ||
|
||
- You can quickly create a project locally using [create-ts-frame](https://github.com/hacxy/create-ts-frame) | ||
|
||
When executing the creation command, you can specify the project name and template name through options. | ||
|
||
```sh | ||
# npm 7+, extra double-dash is needed: | ||
npm create ts-frame@latest my-cli-app -- --template cli-unbuild | ||
|
||
# yarn | ||
yarn create ts-frame my-cli-app --template cli-unbuild | ||
|
||
# pnpm | ||
pnpm create ts-frame my-cli-app --template cli-unbuild | ||
|
||
# Bun | ||
bun create ts-frame my-cli-app --template cli-unbuild | ||
``` | ||
|
||
## Install dependencies. | ||
|
||
```sh | ||
cd my-cli-project | ||
npm install | ||
``` | ||
|
||
### Development | ||
|
||
By default, when you run `npm run dev`, [unbuild](https://github.com/unjs/unbuild) will be used to stub the `dist` folder. You can learn about this mode at [jiti](https://github.com/unjs/jiti). Even if you modify the code, there is no need to execute the `dev` command again or use other build tools' `watch` mode to recompile the `ts` code. When you need to modify the configuration of `unbuild`, you can do other configurations for it in the file named `build.config.ts`. | ||
|
||
- Development Mode | ||
|
||
```sh | ||
npm run dev | ||
``` | ||
|
||
- Build Production Environment Code | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
- Output Build Artifacts with Sourcemap to Out Folder | ||
|
||
```sh | ||
npm run build:out | ||
``` | ||
|
||
- Type Check. | ||
|
||
```sh | ||
npm run typecheck | ||
``` | ||
|
||
## Debugging Program Execution | ||
|
||
As I use VSCode to develop CLI applications, a corresponding debug configuration file `.vscode/launch.json` is provided. When you need to debug this project, first add breakpoints and then press F5 key to start Debugger mode. The Debugger mode will automatically exit when your CLI application finishes executing. | ||
|
||
> [!TIP] | ||
> When running in Debugger mode, artifacts used for debugging are outputted under directory 'out'. After that, your application will automatically start running. | ||
### Global Link Package: | ||
|
||
You can also create a global link for this package so that it's easier for you test or debug code using real environment: | ||
|
||
```sh | ||
npm link | ||
``` | ||
|
||
Afterwards, you can execute command "hello-cli" at any path under all terminals of your operating system which corresponds with value of option "bin" in file "package.json" under this project. | ||
|
||
When you no longer need this global link anymore, manually remove it by executing below command under project directory: | ||
|
||
```sh | ||
npm unlink -g | ||
``` | ||
|
||
### Dependency Description | ||
|
||
When your third-party library is installed as DevDependencies during development , these dependencies will be packaged into production environment codes after executing ' npm run build '. If program works abnormally after installing via such way and building completed afterwards , try installing them as production environment dependencies(Dependencies). They won't be packaged into production environment codes when installed as production environment dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# CLI Unbuild Template | ||
|
||
这是一个由 TypeScript 作为默认开发语言, 由 [unbuild](https://github.com/unjs/unbuild) 作为打包构建工具的 CLI 应用程序项目模板,方便您快速的搭建一个 CLI 应用程序项目. | ||
|
||
[English](https://github.com/hacxy/cli-template/blob/main/README.md) | 简体中文 | ||
|
||
- [x] Eslint 格式化, 无需 Prettier | ||
- [x] Git 提交信息校验, 参考规范: [commit convention](./.github/COMMIT_CONVENTION.md) | ||
- [x] 一键发布npm, 自动创建github release | ||
- [x] vitest单元测试 | ||
- [x] vscode debug | ||
|
||
## 先决条件 | ||
|
||
需要 Node.js 版本 18+、20+ | ||
|
||
## 使用模板 | ||
|
||
### 将模板创建至本地 | ||
|
||
- 您可以使用 [create-ts-frame](https://github.com/hacxy/create-ts-frame) 快速的将项目创建至您的本地 | ||
|
||
执行创建命令时可以通过选项指定项目名称和模板名称 | ||
|
||
```sh | ||
# npm 7+, 需要额外的双破折号: | ||
npm create ts-frame@latest my-cli-app -- --template cli-unbuild | ||
|
||
# yarn | ||
yarn create ts-frame my-cli-app --template cli-unbuild | ||
|
||
# pnpm | ||
pnpm create ts-frame my-cli-app --template cli-unbuild | ||
|
||
# Bun | ||
bun create ts-frame my-cli-app --template cli-unbuild | ||
``` | ||
|
||
### 安装依赖 | ||
|
||
```sh | ||
cd my-cli-project | ||
npm install | ||
``` | ||
|
||
### 开发 | ||
|
||
默认情况下, 当您执行 `npm run dev` 时, 将使用 [unbuild](https://github.com/unjs/unbuild) 对 `dist` 文件夹进行存根, 您可以前往[jiti](https://github.com/unjs/jiti)了解这个模式,之后即使您修改了代码, 也无需再执行 `dev` 命令, 或者使用其他构建工具的 `watch` 模式来对 `ts` 代码重新编译。当您需要修改 `unbuild` 配置时, 您可以在 `build.config.ts` 文件中对 `unbuild` 做[其他配置](https://github.com/unjs/unbuild/blob/main/src/types.ts)。 | ||
|
||
- 开发模式 | ||
|
||
```sh | ||
npm run dev | ||
``` | ||
|
||
- 构建生产环境代码 | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
- 输出包含 sourcemap 的构建产物至 out 文件夹中 | ||
|
||
```sh | ||
npm run build:out | ||
``` | ||
|
||
- 类型检查。 | ||
|
||
```sh | ||
npm run typecheck | ||
``` | ||
|
||
## 调试程序运行 | ||
|
||
由于我使用 `vscode` 来开发 CLI 应用程序, 所以提供了其对应的 debug 配置文件: `.vscode/launch.json`, 当您需要调试这个项目时, 首先添加断点, 之后可以按 `F5` 键来启动 Debugger 模式, 当您的 CLI 应用程序执行结束时, Debugger 模式会自动退出. | ||
|
||
> [!TIP] | ||
> 运行 Debugger 模式时会将用于 debug 的构建产物输出至 `out` 目录下, 之后应用程序将自动运行. | ||
### 全局链接包: | ||
|
||
您还可以为这个包建立一个全局链接, 方便您使用真实环境来测试或者调试代码: | ||
|
||
```sh | ||
npm link | ||
``` | ||
|
||
之后您就可以在您的操作系统的所有终端下任意路径下去执行命令: `hello-cli`, 这个命令对应的是该项目下的 `package.json` 文件中 `bin` 选项的值. | ||
|
||
当您不再需要这个全局链接时, 您可以手动移除它, 在项目下执行: | ||
|
||
```sh | ||
npm unlink -g | ||
``` | ||
|
||
### 依赖性说明 | ||
|
||
当您的第三方库以开发时依赖 (DevDependencies) 进行安装时, 执行`npm run build` 会将这些依赖打包进生产环境代码中, 如果您使用此方式安装并构建完成后, 发现程序工作异常, 则应该尝试将其作为生产环境依赖 (Dependencies) 进行安装, 当作为生产环境依赖进行安装时, 它们不会被打包进生产环境代码中. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineBuildConfig } from 'unbuild'; | ||
|
||
export default defineBuildConfig({ | ||
entries: ['src/index'], | ||
clean: true, | ||
declaration: false, | ||
sourcemap: false, | ||
rollup: { esbuild: { target: 'node18', minify: true } }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineConfig } from 'bumpp'; | ||
|
||
export default defineConfig({ | ||
tag: false | ||
}); |
Oops, something went wrong.