-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from terwer/dev
feat: add picgo siyuan lib
- Loading branch information
Showing
21 changed files
with
1,152 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ["./node_modules/@terwer/eslint-config-custom/typescript/index.cjs"], | ||
} |
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,2 @@ | ||
.idea | ||
.DS_Store |
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,11 @@ | ||
# platform | ||
|
||
# Ignore artifacts: | ||
dist | ||
node_modules | ||
|
||
# Ignore all dts files: | ||
*.d.ts | ||
|
||
# lib | ||
/pnpm-lock.yaml |
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,30 @@ | ||
/* | ||
* Copyright (c) 2023, Terwer . All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Terwer designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Terwer in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com | ||
* or visit www.terwer.space if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
module.exports = { | ||
semi: false, | ||
singleQuote: false, | ||
printWidth: 120 | ||
} |
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,41 @@ | ||
# zhi-picgo-siyuan | ||
|
||
picgo lib for siyuan-note | ||
|
||
## Usage | ||
|
||
```js | ||
// usage | ||
``` | ||
|
||
## Deps | ||
|
||
``` | ||
## Congregations! zhi-picgo-siyuan need no deps, it is just pure js code 🎉 | ||
``` | ||
|
||
## Dev | ||
|
||
```bash | ||
pnpm dev -F zhi-picgo-siyuan | ||
``` | ||
|
||
## Build | ||
|
||
```bash | ||
pnpm build -F zhi-picgo-siyuan | ||
``` | ||
|
||
## Test | ||
|
||
Execute the unit tests via [vitest](https://vitest.dev) | ||
|
||
```bash | ||
pnpm test -F zhi-picgo-siyuan | ||
``` | ||
|
||
## Publish | ||
|
||
```bash | ||
pnpm publish -F zhi-picgo-siyuan --tag latest | ||
``` |
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,41 @@ | ||
# zhi-picgo-siyuan | ||
|
||
picgo lib for siyuan-note | ||
|
||
## Usage | ||
|
||
```js | ||
// usage | ||
``` | ||
|
||
## Deps | ||
|
||
``` | ||
## Congregations! zhi-picgo-siyuan need no deps, it is just pure js code 🎉 | ||
``` | ||
|
||
## Dev | ||
|
||
```bash | ||
pnpm dev -F zhi-picgo-siyuan | ||
``` | ||
|
||
## Build | ||
|
||
```bash | ||
pnpm build -F zhi-picgo-siyuan | ||
``` | ||
|
||
## Test | ||
|
||
Execute the unit tests via [vitest](https://vitest.dev) | ||
|
||
```bash | ||
pnpm test -F zhi-picgo-siyuan | ||
``` | ||
|
||
## Publish | ||
|
||
```bash | ||
pnpm publish -F zhi-picgo-siyuan --tag latest | ||
``` |
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,8 @@ | ||
import { MainFunction } from "zhi-lib-base"; | ||
/** | ||
* 初始化入口 | ||
* | ||
* @param args | ||
*/ | ||
declare const main: MainFunction; | ||
export default main; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
export {}; |
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,37 @@ | ||
{ | ||
"name": "zhi-picgo-siyuan", | ||
"version": "1.5.1", | ||
"type": "module", | ||
"description": "picgo lib for siyuan-note", | ||
"main": "./dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"repository": "terwer/zhi", | ||
"homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-picgo-siyuan", | ||
"author": "terwer", | ||
"license": "MIT", | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"keywords": [ | ||
"zhi", | ||
"lib" | ||
], | ||
"scripts": { | ||
"serve": "vite", | ||
"dev": "vite build --watch", | ||
"build": "vite build", | ||
"start": "vite preview", | ||
"test": "npx vitest --watch" | ||
}, | ||
"devDependencies": { | ||
"@terwer/eslint-config-custom": "^1.3.6", | ||
"@terwer/vite-config-custom": "^0.7.6" | ||
}, | ||
"dependencies": { | ||
"zhi-lib-base": "^0.8.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + TS</title> | ||
</head> | ||
<body> | ||
This file is for lib hot load test only, see <a href="/src/index.ts">/src/index.ts</a> | ||
<script type="module" src="/src/index.ts"></script> | ||
</body> | ||
</html> |
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,37 @@ | ||
{ | ||
"name": "zhi-picgo-siyuan", | ||
"version": "1.5.1", | ||
"type": "module", | ||
"description": "picgo lib for siyuan-note", | ||
"main": "./dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"repository": "terwer/zhi", | ||
"homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-picgo-siyuan", | ||
"author": "terwer", | ||
"license": "MIT", | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"keywords": [ | ||
"zhi", | ||
"lib" | ||
], | ||
"scripts": { | ||
"serve": "vite", | ||
"dev": "vite build --watch", | ||
"build": "vite build", | ||
"start": "vite preview", | ||
"test": "npx vitest --watch" | ||
}, | ||
"devDependencies": { | ||
"@terwer/eslint-config-custom": "^1.3.6", | ||
"@terwer/vite-config-custom": "^0.7.6" | ||
}, | ||
"dependencies": { | ||
"zhi-lib-base": "^0.8.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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,7 @@ | ||
import { describe, it } from "vitest" | ||
|
||
describe("index", () => { | ||
it("test index", () => { | ||
console.log("hello") | ||
}) | ||
}) |
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,14 @@ | ||
import { simpleLogger, MainFunction } from "zhi-lib-base" | ||
|
||
/** | ||
* 初始化入口 | ||
* | ||
* @param args | ||
*/ | ||
const main: MainFunction = async (args: any[]) => { | ||
const logger = simpleLogger("main", "zhi", false) | ||
logger.info(`main start ${args}`) | ||
return "ok" | ||
} | ||
|
||
export default main |
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,42 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"module": "ESNext", | ||
"lib": [ | ||
"ES2020", | ||
"DOM", | ||
"DOM.Iterable" | ||
], | ||
"skipLibCheck": true, | ||
/* Bundler mode */ | ||
"moduleResolution": "Node", | ||
// "allowImportingTsExtensions": true, | ||
"allowSyntheticDefaultImports": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "preserve", | ||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"types": [ | ||
"node", | ||
"vite/client" | ||
] | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
"src/**/*.d.ts", | ||
"src/**/*.tsx", | ||
"src/**/*.vue" | ||
], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.node.json" | ||
} | ||
], | ||
"root": "." | ||
} |
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,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"skipLibCheck": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
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,68 @@ | ||
/// <reference types="vitest" /> | ||
|
||
import { resolve } from "path" | ||
import { defineConfig } from "vite" | ||
import { viteStaticCopy } from "vite-plugin-static-copy" | ||
import dts from "vite-plugin-dts" | ||
import minimist from "minimist" | ||
import livereload from "rollup-plugin-livereload" | ||
|
||
const args = minimist(process.argv.slice(2)) | ||
const isWatch = args.watch || args.w || false | ||
const devDistDir = "./dist" | ||
const distDir = isWatch ? devDistDir : "./dist" | ||
// const distDir = devDistDir | ||
|
||
console.log("isWatch=>", isWatch) | ||
console.log("distDir=>", distDir) | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
dts(), | ||
|
||
viteStaticCopy({ | ||
targets: [ | ||
{ | ||
src: "README.md", | ||
dest: "./", | ||
}, | ||
{ | ||
src: "package.json", | ||
dest: "./", | ||
}, | ||
], | ||
}), | ||
], | ||
|
||
build: { | ||
// 输出路径 | ||
outDir: distDir, | ||
emptyOutDir: false, | ||
|
||
// 构建后是否生成 source map 文件 | ||
sourcemap: false, | ||
|
||
lib: { | ||
// Could also be a dictionary or array of multiple entry points | ||
entry: resolve(__dirname, "src/index.ts"), | ||
// the proper extensions will be added | ||
fileName: "index", | ||
formats: ["cjs"], | ||
}, | ||
rollupOptions: { | ||
plugins: [...(isWatch ? [livereload(devDistDir)] : [])], | ||
// make sure to externalize deps that shouldn't be bundled | ||
// into your library | ||
external: [], | ||
output: { | ||
entryFileNames: "[name].js", | ||
}, | ||
}, | ||
}, | ||
|
||
test: { | ||
globals: true, | ||
environment: "jsdom", | ||
include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], | ||
}, | ||
}) |
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
Oops, something went wrong.