Merge branch 'dev' of github.com:opentiny/tiny-vue into dev

This commit is contained in:
zzcr 2023-06-12 05:09:44 -07:00
commit 9a292394b4
No known key found for this signature in database
GPG Key ID: F6C4DFD2EF53A673
9 changed files with 47 additions and 16 deletions

View File

@ -1,6 +1,11 @@
import path from 'node:path'
import { removeSync } from 'fs-extra'
import { walkFileTree, pathJoin, logGreen, logRed } from '../shared/utils'
import {
walkFileTree,
logGreen,
logRed,
pathJoinFromCLI
} from '../shared/utils'
/**
* packages distruntimenode_modules
@ -22,7 +27,7 @@ const deleteDistFile = () => {
return flag
},
dirPath: pathJoin('..', 'packages'),
dirPath: pathJoinFromCLI('../../packages'),
callback() {
// empty
}

View File

@ -10,11 +10,12 @@ import fs from 'fs-extra'
import semver from 'semver'
import {
getInputCmd,
pathJoin,
walkFileTree,
capitalizeKebabCase,
logGreen,
logYellow
logYellow,
templatePath,
pathJoinFromCLI
} from '../../shared/utils'
import { createModuleMapping } from '../../shared/module-utils'
import handlebarsRender from '../build/handlebars.render'
@ -24,9 +25,9 @@ const args = getInputCmd()
if (args.length > 0) {
const commands: string[] = []
const components: string[] = []
const templateDir = pathJoin('../../public/template/component')
const componetDir = pathJoin('../../../../packages/vue/src')
const { version } = fs.readJSONSync(pathJoin('../../../../packages/vue/package.json'))
const templateDir = path.join(templatePath, './component')
const componetDir = pathJoinFromCLI('../../packages/vue/src')
const { version } = fs.readJSONSync(pathJoinFromCLI('../../packages/vue/package.json'))
args.forEach((item) => {
if (item.indexOf('-') === 0) {

View File

@ -13,16 +13,16 @@ import {
capitalizeKebabCase,
prettierFormat,
logGreen,
logRed
logRed,
templatePath
} from '../../shared/utils'
const svgRE = /\.svg$/
const svgDir = pathJoin('..', 'node_modules', '@opentiny', 'theme', 'svgs')
const iconDir = pathJoin('..', 'packages', 'icon')
const packageJson = 'package.json'
const templatePath = pathJoin('..', 'template')
// 检查是否按照依赖包
// 检查是否安装依赖包
if (!fs.existsSync(svgDir)) {
logYellow('The @opentiny/vue-theme is not exist , please npm install @opentiny/vue-theme.')
}

View File

@ -11,7 +11,7 @@ import {
capitalizeKebabCase,
kebabCase,
prettierFormat,
pathJoin
pathJoinFromCLI
} from './utils'
const require = createRequire(import.meta.url)
@ -434,7 +434,7 @@ const createModuleMapping = (componentName, isMobile = false) => {
const moduleJson = quickSort({ sortData: moduleMap, returnType: 'object' })
fs.writeJsonSync(
pathJoin('..', 'modules.json'),
pathJoinFromCLI('../../packages/modules.json'),
prettierFormat({
str: JSON.stringify(moduleJson),
options: {

View File

@ -482,6 +482,23 @@ const filesFragmentReplace = (folderPath, regExpStr: Array<string | RegExp> | st
}
}
/** 是否已打包 */
const isCLIProduction = process.env.TINY_TSUP_ENV === 'production'
/** 相对 `CLI` 工程目录解析路径 */
const pathJoinFromCLI = (...args: string[]) => {
const cliDir = path.resolve(dirname, '../../', isCLIProduction ? '../' : '')
return path.join(cliDir, ...args)
}
/** 相对 `CLI` 入口文件解析目录 */
const pathJoinFromCLIEntry = (...args: string[]) => {
return path.join(dirname, '../', ...args)
}
/** 模板所在路径 */
const templatePath = isCLIProduction ? pathJoinFromCLIEntry('./template') : pathJoinFromCLI('./public/template')
export {
assetsPath,
capitalize,
@ -517,4 +534,7 @@ export {
getBuildTag,
getVueVersion,
pathFromWorkspaceRoot,
pathJoinFromCLI,
pathJoinFromCLIEntry,
templatePath,
}

View File

@ -9,7 +9,10 @@ const shared: Options = {
target: 'node14',
platform: 'node',
dts: false,
publicDir: true
publicDir: true,
env: {
TINY_TSUP_ENV: 'production'
}
}
export default defineConfig([

View File

@ -123,10 +123,12 @@
& &__close-icon {
position: absolute;
top: 0;
right: 0;
padding: 0 8px;
cursor: pointer;
display: inline-flex;
top: 50%;
transform: translateY(-50%);
}
&-primary {

View File

@ -64,7 +64,7 @@ export default defineComponent({
*/
isEnterSearch: {
type: Boolean,
default: false
default: true
},
/**
* primary: gray:

View File

@ -71,7 +71,7 @@ import { iconSearch, iconOperationfaild } from '@opentiny/vue-icon'
import '@opentiny/vue-theme-mobile/search/index.less'
export default defineComponent({
props: [...props, 'transparent', 'searchTypes', 'placeholder', 'buttonText', 'modelValue', 'themeType'],
props: [...props, 'transparent', 'searchTypes', 'placeholder', 'buttonText', 'modelValue', 'themeType', 'isEnterSearch'],
components: {
IconSearch: iconSearch(),
IconOperationfaild: iconOperationfaild()