Skip to content

Commit

Permalink
chore: eslint format
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Mar 27, 2024
1 parent 68e2b93 commit 12399ef
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 47 deletions.
30 changes: 15 additions & 15 deletions scripts/generate-nutui-taro-vue.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const packageConfig = require('../package.json')
const config = require('../src/config.json')
const path = require('path')
const fs = require('fs-extra')
let importStr = `import { App } from 'vue';
import Locale from './locale';\n`
let importStr = `import { App } from 'vue'
import Locale from './locale'\n`
let importScssStr = `\n`
let dts = `export {}
declare module 'vue' {
Expand All @@ -15,46 +15,46 @@ config.nav.map((item) => {
if (taro !== false) {
if (setup === true) {
dts += ` Nut${name}: typeof import('@/packages/__VUE/${name.toLowerCase()}/index.taro')['default']\n`
importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index.taro';\n`
importStr += `export * from './__VUE/${name.toLowerCase()}/index.taro';\n`
importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index.taro'\n`
importStr += `export * from './__VUE/${name.toLowerCase()}/index.taro'\n`
} else {
dts += ` Nut${name}: typeof import('@/packages/__VUE/${name.toLowerCase()}/index.taro.vue')['default']\n`
const filePath = path.join(`src/packages/__VUE/${name.toLowerCase()}/index.taro.vue`)
if (name !== 'Icon') {
importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index${
fs.existsSync(filePath) ? '.taro' : ''
}.vue';\n`
}.vue'\n`
}
}
importScssStr += `import './__VUE/${name.toLowerCase()}/index.scss';\n`
importScssStr += `import './__VUE/${name.toLowerCase()}/index.scss'\n`
if (exclude !== true) {
packages.push(name)
}
}
})
})
let installFunction = `function install(app: App) {
const packages = [${packages.join(',')}];
const packages = [${packages.join(',')}]
packages.forEach((item:any) => {
if (item.install) {
app.use(item);
app.use(item)
} else if (item.name) {
app.component(item.name, item);
app.component(item.name, item)
}
});
})
}`
let fileStrBuild = `${importStr}
${installFunction}
const version = '${packageConfig.version}';
export { install, version, Locale, ${packages.join(',')} };
export default { install, version, Locale};`
const version = '${packageConfig.version}'
export { install, version, Locale, ${packages.join(',')} }
export default { install, version, Locale}`

fs.outputFile(path.resolve(__dirname, '../src/packages/taro.build.ts'), fileStrBuild, 'utf8')
let fileStrDev = `${importStr}
${installFunction}
${importScssStr}
export { install, Locale, ${packages.join(',')} };
export default { install, version:'${packageConfig.version}', Locale};`
export { install, Locale, ${packages.join(',')} }
export default { install, version:'${packageConfig.version}', Locale}`
fs.outputFile(path.resolve(__dirname, '../src/packages/taro.ts'), fileStrDev, 'utf8')

dts += ` }
Expand Down
32 changes: 16 additions & 16 deletions scripts/generate-nutui.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const packageConfig = require('../package.json')
const config = require('../src/config.json')
const path = require('path')
const fs = require('fs-extra')
let importStr = `import { App } from 'vue';
import Locale from './locale';\n`
let importStr = `import { App } from 'vue'
import Locale from './locale'\n`
let importScssStr = `\n`
let dts = `export {}
declare module 'vue' {
Expand All @@ -15,47 +15,47 @@ config.nav.map((item) => {
let { name, funcCall, exclude, setup } = element
if (setup === true) {
dts += ` Nut${name}: typeof import('./__VUE/${name.toLowerCase()}/index')['default']\n`
importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index';\n`
importStr += `export * from './__VUE/${name.toLowerCase()}/index';\n`
importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index'\n`
importStr += `export * from './__VUE/${name.toLowerCase()}/index'\n`
} else {
dts += ` Nut${name}: typeof import('./__VUE/${name.toLowerCase()}/index.vue')['default']\n`
if (name !== 'Icon') {
importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index.vue';\n`
importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index.vue'\n`
}
if (funcCall === true) {
importStr += `import { show${name} } from './__VUE/${name.toLowerCase()}/index';\n`
importStr += `import { show${name} } from './__VUE/${name.toLowerCase()}/index'\n`
methods.push(`show${name}`)
}
}
importScssStr += `import './__VUE/${name.toLowerCase()}/index.scss';\n`
importScssStr += `import './__VUE/${name.toLowerCase()}/index.scss'\n`
if (exclude != true) {
packages.push(name)
}
})
})
let installFunction = `function install(app: App) {
const packages = [${packages.join(',')}];
const packages = [${packages.join(',')}]
packages.forEach((item:any) => {
if (item.install) {
app.use(item);
app.use(item)
} else if (item.name) {
app.component(item.name, item);
app.component(item.name, item)
}
});
})
}`
let fileStrBuild = `${importStr}
${installFunction}
const version = '${packageConfig.version}';
export { install, version, Locale, ${packages.join(',')}, ${methods.join(',')}};
export default { install, version};`
const version = '${packageConfig.version}'
export { install, version, Locale, ${packages.join(',')}, ${methods.join(',')}}
export default { install, version}`

fs.outputFile(path.resolve(__dirname, '../src/packages/index.build.ts'), fileStrBuild, 'utf8')

let fileStrDev = `${importStr}
${installFunction}
${importScssStr}
export { install, Locale, ${packages.join(',')}, ${methods.join(',')} };
export default { install, version:'${packageConfig.version}'};`
export { install, Locale, ${packages.join(',')}, ${methods.join(',')} }
export default { install, version:'${packageConfig.version}'}`
fs.outputFile(path.resolve(__dirname, '../src/packages/index.ts'), fileStrDev, 'utf8')

dts += ` }
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-taro-route.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const taroConfig = `${targetBaseUrl}/packages/nutui-taro-demo/src/app.config.ts`
const createConfig = async () => {
let configRef = []

return new Promise((res, rej) => {
return new Promise((res) => {
config.nav.map((item) => {
let co = {
root: item.enName,
Expand All @@ -33,7 +33,7 @@ const create = async () => {
fse.writeFileSync(
taroConfig,
`
const subPackages = ${JSON.stringify(subpackages, null, 2)};\n
const subPackages = ${JSON.stringify(subpackages, null, 2)}\n
export default {
pages: ['pages/index/index'],
subPackages,
Expand Down
14 changes: 7 additions & 7 deletions src/packages/__VUE/switch/index.taro.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Switch from './switch.taro.vue';
import type { ComponentPublicInstance } from 'vue';
import { withInstall } from '@/packages/utils';
import Switch from './switch.taro.vue'
import type { ComponentPublicInstance } from 'vue'
import { withInstall } from '@/packages/utils'

withInstall(Switch);
withInstall(Switch)

export type { SwitchProps } from './switch.taro.vue';
export type { SwitchProps } from './switch.taro.vue'

export type SwitchInstance = ComponentPublicInstance & InstanceType<typeof Switch>;
export type SwitchInstance = ComponentPublicInstance & InstanceType<typeof Switch>

export { Switch, Switch as default };
export { Switch, Switch as default }
14 changes: 7 additions & 7 deletions src/packages/__VUE/switch/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Switch from './switch.vue';
import type { ComponentPublicInstance } from 'vue';
import { withInstall } from '@/packages/utils';
import Switch from './switch.vue'
import type { ComponentPublicInstance } from 'vue'
import { withInstall } from '@/packages/utils'

withInstall(Switch);
withInstall(Switch)

export type { SwitchProps } from './switch.vue';
export type { SwitchProps } from './switch.vue'

export type SwitchInstance = ComponentPublicInstance & InstanceType<typeof Switch>;
export type SwitchInstance = ComponentPublicInstance & InstanceType<typeof Switch>

export { Switch, Switch as default };
export { Switch, Switch as default }

0 comments on commit 12399ef

Please sign in to comment.