Skip to content

Commit

Permalink
refactor: use lit element to refactor search component (#18)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <[email protected]>
  • Loading branch information
ruibaby committed Oct 25, 2023
1 parent 7761498 commit 9a07617
Show file tree
Hide file tree
Showing 47 changed files with 2,557 additions and 5,143 deletions.
43 changes: 12 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"name": "@halo-dev/plugin-search-widget",
"private": true,
"scripts": {
"build:packages": "pnpm --filter \"./packages/**\" build",
"example:dev": "pnpm --filter \"./packages/example\" dev",
"release:packages": "pnpm --filter \"./packages/**\" release"
},
"license": "GPL-3.0",
"author": {
"name": "Halo OSS Team",
"url": "https://github.com/halo-dev"
Expand All @@ -17,32 +11,19 @@
"url": "https://github.com/ruibaby"
}
],
"keywords": [],
"license": "GPL-3.0",
"dependencies": {
"pinia": "^2.1.3",
"vue": "^3.3.4",
"vue-router": "^4.2.2"
"scripts": {
"build:packages": "pnpm --filter \"./packages/**\" build",
"example:dev": "pnpm --filter \"./packages/example\" dev",
"release:packages": "pnpm --filter \"./packages/**\" release"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.0",
"@types/jsdom": "^20.0.1",
"@types/node": "^18.16.16",
"@vitejs/plugin-vue": "^2.3.4",
"@vue/compiler-sfc": "^3.3.4",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/test-utils": "^2.3.2",
"@vue/tsconfig": "^0.1.3",
"eslint": "^8.41.0",
"eslint-plugin-vue": "^9.14.1",
"jsdom": "^19.0.0",
"npm-run-all": "^4.1.5",
"@rushstack/eslint-patch": "^1.5.1",
"@types/node": "^18.18.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.3.0",
"typescript": "~4.7.4",
"vite": "^4.3.9",
"vitest": "^0.28.5",
"vue-tsc": "^1.6.5"
"typescript": "^5.2.2",
"vite": "^4.5.0"
}
}
24 changes: 0 additions & 24 deletions packages/example/.eslintrc.cjs

This file was deleted.

26 changes: 20 additions & 6 deletions packages/example/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<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 + Lit + TS</title>
<script type="module" src="/src/main.ts"></script>
<style>
:root {
--halo-bg: #000;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<search-modal baseUrl="https://ryanc.cc"></search-modal>
<search-form baseUrl="http://127.0.0.1:8090"></search-form>
<button id="btn">点开</button>
<script>
const btn = document.getElementById("btn");
btn.addEventListener("click", () => {
const searchModal = document.querySelector("search-modal");
searchModal.open = true;
});
</script>
</body>
</html>
7 changes: 1 addition & 6 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"name": "@halo-dev/search-widget-example",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"type-check": "vue-tsc --noEmit",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
"dev": "vite"
},
"dependencies": {
"@halo-dev/search-widget": "workspace:*"
Expand Down
6 changes: 0 additions & 6 deletions packages/example/postcss.config.cjs

This file was deleted.

Binary file removed packages/example/public/favicon.ico
Binary file not shown.
14 changes: 0 additions & 14 deletions packages/example/src/App.vue

This file was deleted.

5 changes: 1 addition & 4 deletions packages/example/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
import { createApp } from "vue";
import App from "./App.vue";

createApp(App).mount("#app");
import "@halo-dev/search-widget";
8 changes: 0 additions & 8 deletions packages/example/tailwind.config.cjs

This file was deleted.

8 changes: 0 additions & 8 deletions packages/example/tsconfig.config.json

This file was deleted.

16 changes: 2 additions & 14 deletions packages/example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},

"references": [
{
"path": "./tsconfig.config.json"
}
]
"extends": "../../tsconfig.json",
"include": ["src"]
}
3 changes: 0 additions & 3 deletions packages/example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import Vue from "@vitejs/plugin-vue";

export default defineConfig({
plugins: [Vue()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down
24 changes: 0 additions & 24 deletions packages/search-widget/.eslintrc.cjs

This file was deleted.

17 changes: 17 additions & 0 deletions packages/search-widget/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"env": {
"browser": true
}
}
7 changes: 7 additions & 0 deletions packages/search-widget/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true,
"bracketSpacing": true,
"arrowParens": "always"
}
48 changes: 18 additions & 30 deletions packages/search-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,31 @@
{
"name": "@halo-dev/search-widget",
"version": "1.0.0",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"type": "module",
"main": "./dist/halo-search-widget.es.js",
"module": "./dist/halo-search-widget.es.js",
"unpkg": "./dist/halo-search-widget.iife.js",
"jsdelivr": "./dist/halo-search-widget.iife.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite build --watch",
"build": "run-p type-check build-only",
"preview": "vite preview",
"test:unit": "vitest --environment jsdom --root src/",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"release": "release-it"
"dev": "tsc -w",
"build": "tsc",
"lint": "lit-analyzer && eslint 'src/**/*.ts'",
"prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.gitignore --write"
},
"dependencies": {
"@halo-dev/components": "^1.5.0",
"@vueuse/core": "^9.13.0",
"axios": "^1.4.0",
"lodash.debounce": "^4.0.8"
"lit": "^3.0.0",
"lodash-es": "^4.17.21"
},
"devDependencies": {
"@types/lodash.debounce": "^4.0.7",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.24",
"release-it": "^15.10.3",
"tailwindcss": "^3.3.2"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/halo-search-widget.es.js"
},
"./dist/style.css": "./dist/style.css"
"@types/lodash-es": "^4.17.10",
"lit-analyzer": "^1.2.1"
}
}
6 changes: 0 additions & 6 deletions packages/search-widget/postcss.config.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions packages/search-widget/prettier.config.cjs

This file was deleted.

0 comments on commit 9a07617

Please sign in to comment.