Skip to content

Commit

Permalink
feat: Make project build asset more easy
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Apr 7, 2023
1 parent 3771ff1 commit f9bae6e
Show file tree
Hide file tree
Showing 25 changed files with 326 additions and 315 deletions.
66 changes: 33 additions & 33 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "GPL",
"scripts": {
"build": "nx run-many --target=build --exclude=zhi-docs",
"zhi-build": "nx run-many --target=zhi-build --exclude=zhi-docs",
"test": "nx run-many --target=test --exclude=zhi-docs",
"lint": "nx run-many --target=lint --exclude=zhi-docs",
"serve": "nx serve <project>",
Expand Down
2 changes: 1 addition & 1 deletion packages/zhi-blog/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"zhi-build": {
"dependsOn": ["build"],
"command": "cp -r dist/packages/zhi-blog/* /Users/terwer/Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/modules/blog && echo 'dist copy success'"
"command": "cp -r dist/packages/zhi-blog/* /Users/terwer/Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/modules/blog && echo 'zhi-blog dist copy success'"
}
},
"tags": []
Expand Down
29 changes: 16 additions & 13 deletions packages/zhi-common/src/lib/zhi-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import DateUtil from "./dateUtil"
import StrUtil from "./strUtil"
import DeviceUtil from "./deviceUtil"
import SiyuanUtil from "./siyuanUtil"
import VersionUtil from "./versionUtil";
import VersionUtil from "./versionUtil"
import BrowserUtil from "./browserUtil"

/**
* 平台无关的通用工具类
Expand All @@ -36,19 +37,21 @@ import VersionUtil from "./versionUtil";
* @since 1.3.0
*/
class ZhiCommon {
public readonly dateUtil
public readonly strUtil
public readonly deviceUtil
public readonly siyuanUtil
public readonly versionUtil
public readonly dateUtil
public readonly strUtil
public readonly deviceUtil
public readonly siyuanUtil
public readonly versionUtil
public readonly browserUtil

constructor() {
this.dateUtil = new DateUtil()
this.strUtil = new StrUtil()
this.deviceUtil = DeviceUtil
this.siyuanUtil = new SiyuanUtil()
this.versionUtil = new VersionUtil()
}
constructor() {
this.dateUtil = new DateUtil()
this.strUtil = new StrUtil()
this.deviceUtil = DeviceUtil
this.siyuanUtil = new SiyuanUtil()
this.versionUtil = new VersionUtil()
this.browserUtil = BrowserUtil
}
}

export default ZhiCommon
7 changes: 5 additions & 2 deletions packages/zhi-modules-blog-middleware/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"executor": "@nrwl/vite:build",
"outputs": ["{options.outputPath}"],
"options": {
// "outputPath": "dist/packages/zhi-modules-blog-middleware",
"outputPath": "../SiYuanWorkspace/public/conf/appearance/themes/zhi/modules/blog-middleware"
"outputPath": "dist/packages/zhi/modules/blog-middleware",
}
},
"publish": {
Expand All @@ -33,6 +32,10 @@
"options": {
"lintFilePatterns": ["packages/zhi-modules-blog-middleware/**/*.ts"]
}
},
"zhi-build": {
"dependsOn": ["build"],
"command": "cp -r dist/packages/zhi/modules/blog-middleware/* /Users/terwer/Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/modules/blog-middleware && echo 'zhi-modules-blog-middleware dist copy success'"
}
},
"tags": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"executor": "@nrwl/vite:build",
"outputs": ["{options.outputPath}"],
"options": {
// "outputPath": "dist/packages/zhi-modules-blog-middleware-web",
"outputPath": "../SiYuanWorkspace/public/conf/appearance/themes/zhi/modules-web/blog-middleware"
"outputPath": "dist/packages/zhi/web-modules/blog-middleware",
}
},
"publish": {
Expand All @@ -33,6 +32,10 @@
"options": {
"lintFilePatterns": ["packages/zhi-modules-blog-middleware-web/**/*.ts"]
}
},
"zhi-build": {
"dependsOn": ["build"],
"command": "cp -r dist/packages/zhi/web-modules/blog-middleware/* /Users/terwer/Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/web-modules/blog-middleware && echo 'zhi-web-modules-blog-middleware dist copy success'"
}
},
"tags": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
* @since 1.0.0
*/
export function init(): string {
return "zhi-modules-blog-middleware-web"
return "zhi-web-modules-blog-middleware"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import dts from "vite-plugin-dts"
import { join } from "path"

export default defineConfig({
cacheDir: "../../node_modules/.vite/zhi-modules-blog-middleware-web",
cacheDir: "../../node_modules/.vite/zhi-web-modules-blog-middleware",

plugins: [
dts({
Expand Down Expand Up @@ -35,7 +35,7 @@ export default defineConfig({
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: "src/index.ts",
name: "zhi-modules-blog-middleware-web",
name: "zhi-web-modules-blog-middleware",
fileName: "index",
// Change this to the formats you want to support.
// Don't forgot to update your package.json as well.
Expand Down
35 changes: 19 additions & 16 deletions packages/zhi/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"no-unexpected-multiline": "off"
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
2 changes: 1 addition & 1 deletion packages/zhi/src/lib/modules/http-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class HttpService {
// blogMiddlewareWebDepItem
{
format: "cjs",
libpath: this.common.siyuanUtil.joinPath("modules-web", "blog-middleware", "index.mjs"),
libpath: this.common.siyuanUtil.joinPath("web-modules", "blog-middleware", "index.mjs"),
importType: "import",
runAs: DeviceType.DeviceType_Chrome_Browser,
},
Expand Down
Loading

0 comments on commit f9bae6e

Please sign in to comment.