Skip to content

Commit

Permalink
feat(theme): 主题变量配置改为子包引入
Browse files Browse the repository at this point in the history
  • Loading branch information
vaebe committed Sep 18, 2024
1 parent f150cf1 commit 9be6e01
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pnpm-debug.log*
*.zip

packages/ccui/ui/vue-ccui.ts
packages/ccui/ui/theme/theme.scss
packages/ccui/ui/theme/darkTheme.css
packages/theme/theme.scss
packages/theme/darkTheme.css
packages/ccui/build
**/.vitepress/config/sidebar.ts
**/.vitepress/config/enSidebar.ts
Expand Down
3 changes: 2 additions & 1 deletion packages/ccui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"coverage": "vitest run --coverage"
},
"dependencies": {
"vue": "^3.5.6"
"vue": "^3.5.6",
"theme":"workspace:*"
},
"devDependencies": {
"@types/node": "^22.5.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/ccui/ui/style-var/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import '../theme/theme';
@import 'theme/theme';

$cls-prefix: ccui;
8 changes: 4 additions & 4 deletions packages/cli/commands/generate-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const path = require('node:path')
const fs = require('fs-extra')
const logger = require('../shared/logger')
const { CSS_CLASS_PREFIX } = require('../shared/constant')
const lightTheme = require('../../ccui/ui/theme/themes/light.ts').default
const darkTheme = require('../../ccui/ui/theme/themes/dark.ts').default
const lightTheme = require('theme/themes/light.ts').default
const darkTheme = require('theme/themes/dark.ts').default

const lightFileStr = Object.entries(lightTheme)
.map(
Expand All @@ -24,13 +24,13 @@ ${darkCssVariablesStr}
exports.generateTheme = async () => {
const lightThemeFilePath = path.resolve(
__dirname,
'../../ccui/ui/theme/theme.scss',
'../../theme/theme.scss',
)

// 生成深色主题css文件
const darkThemeFilePath = path.resolve(
__dirname,
'../../ccui/ui/theme/darkTheme.css',
'../../theme/darkTheme.css',
)

try {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ exports.release = async ({ version }) => {
shell.mkdir('-p', 'theme')
shell.cp(
'-R',
path.resolve(__dirname, '../../ccui/ui/theme/theme.scss'),
path.resolve(__dirname, '../../theme/theme.scss'),
path.resolve(outputDir, 'theme'),
)
shell.cp(
'-R',
path.resolve(__dirname, '../../ccui/ui/theme/darkTheme.css'),
path.resolve(__dirname, '../../theme/darkTheme.css'),
path.resolve(outputDir, 'theme'),
)
// shell.exec('npm publish');
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"changelog": "conventional-changelog -k '../ccui/package.json' -p angular -i CHANGELOG.md -s"
},
"dependencies": {
"lodash": "^4.17.21"
"lodash": "^4.17.21",
"theme":"workspace:*"
},
"devDependencies": {
"@babel/parser": "^7.25.3",
Expand Down
25 changes: 25 additions & 0 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "theme",
"version": "1.2.2",
"license": "MIT",
"description": "vue3-ccui components based on Vite and Vue3",
"type": "module",
"keywords": [
"frontend",
"typescript",
"ui-component",
"components",
"vue-components",
"vue",
"vue3",
"vite",
"jsx",
"vue3-ccui"
],
"homepage": "https://vaebe.github.io/ccui/",
"repository": {
"type": "git",
"url": "https://github.com/vaebe/ccui.git"
},
"scripts": {}
}
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9be6e01

Please sign in to comment.