Skip to content

Commit

Permalink
chore(build): rename package entry (#2866)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Jan 23, 2024
1 parent 038587c commit 71c1515
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ package-lock.json
/cache
/src/nutui.ts
/src/packages/components.d.ts
/src/packages/nutui.vue.ts
/src/packages/nutui.vue.build.ts
/src/packages/nutui.taro.vue.ts
/src/packages/nutui.taro.vue.build.ts
/src/packages/index.ts
/src/packages/index.build.ts
/src/packages/taro.ts
/src/packages/taro.build.ts
src/packages/vscode-extension/*.vsix
/.nyc_output
/coverage
Expand Down
8 changes: 4 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ yarn.lock
package-lock.json
/cache
/src/nutui.ts
/src/packages/nutui.vue.ts
/src/packages/nutui.vue.build.ts
/src/packages/nutui.taro.vue.ts
/src/packages/nutui.taro.vue.build.ts
/src/packages/index.ts
/src/packages/index.build.ts
/src/packages/taro.ts
/src/packages/taro.build.ts
src/packages/vscode-extension/*.vsix
/.nyc_output
/coverage
Expand Down
2 changes: 1 addition & 1 deletion packages/nutui-taro-demo/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createApp } from 'vue';
import './app.scss';
import NutUI from '@/packages/nutui.taro.vue';
import NutUI from '@/packages/taro';
import Demo from './components/demo.vue';
// import NutUI from '@nutui/nutui-taro';
// import '@nutui/nutui-taro/dist/style.css';
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-nutui-taro-vue.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ const version = '${packageConfig.version}';
export { install, version, Locale, ${packages.join(',')} };
export default { install, version, Locale};`;

fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.taro.vue.build.ts'), fileStrBuild, 'utf8');
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};`;
fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.taro.vue.ts'), fileStrDev, 'utf8');
fs.outputFile(path.resolve(__dirname, '../src/packages/taro.ts'), fileStrDev, 'utf8');

dts += ` }
}`
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-nutui.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ const version = '${packageConfig.version}';
export { install, version, Locale, ${packages.join(',')}, ${methods.join(',')}};
export default { install, version};`;

fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.build.ts'), fileStrBuild, 'utf8');
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}'};`;
fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.ts'), fileStrDev, 'utf8');
fs.outputFile(path.resolve(__dirname, '../src/packages/index.ts'), fileStrDev, 'utf8');

dts += ` }
}`
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-types-taro.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fs.cp(sourceDir, toDir, { recursive: true }, (err) => {
return;
}

const oldName = path.join(toDir, 'nutui.taro.vue.build.d.ts');
const oldName = path.join(toDir, 'taro.build.d.ts');
const newName = path.join(toDir, 'index.d.ts');

fs.rename(oldName, newName, (err) => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-types.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fs.cp(sourceDir, toDir, { recursive: true }, (err) => {
return;
}

const oldName = path.join(toDir, 'nutui.vue.build.d.ts');
const oldName = path.join(toDir, 'index.build.d.ts');
const newName = path.join(toDir, 'index.d.ts');

fs.rename(oldName, newName, (err) => {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/form/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
</template>

<script setup lang="ts">
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
import { reactive, ref } from 'vue';
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { FormItemRuleWithoutValidator } from '../formitem/types';
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/icon/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const translate = useTranslate({
copyToast: 'Copied successfully'
}
});
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
import { Add, IconFontConfig, IconFont } from '@nutui/icons-vue';
const copyTag = (name: string) => {
const text = `<IconFont name="${name}"></IconFont>`;
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/imagepreview/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<script setup lang="ts">
import { reactive } from 'vue';
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { showImagePreview } from '@/packages/nutui.vue';
import { showImagePreview } from '@nutui/nutui';
const translate = useTranslate({
'zh-CN': {
basic: '基础用法',
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/numberkeyboard/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

<script setup lang="ts">
import { ref, reactive } from 'vue';
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
import { useTranslate } from '@/sites/assets/util/useTranslate';
const translate = useTranslate({
'zh-CN': {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/picker/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import { ref, onMounted, computed } from 'vue';
import { PickerOption } from './types';
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { Internation } from './doc.en';
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
const translate = useTranslate(Internation);
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/pullrefresh/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<script setup lang="ts">
import { ref, reactive } from 'vue';
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
const translate = useTranslate({
'zh-CN': {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/shortpassword/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

<script setup lang="ts">
import { reactive } from 'vue';
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
import { useTranslate } from '@/sites/assets/util/useTranslate';
const translate = useTranslate({
'zh-CN': {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/sku/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue';
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
const translate = useTranslate({
'zh-CN': {
basic: '基础用法',
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/timeselect/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

<script setup lang="ts">
import { reactive, onMounted } from 'vue';
import { showToast } from '@/packages/nutui.vue';
import { showToast } from '@nutui/nutui';
import { useTranslate } from '@/sites/assets/util/useTranslate';
const translate = useTranslate({
'zh-CN': {
Expand Down
2 changes: 1 addition & 1 deletion src/sites/mobile/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import NutUI from '@/packages/nutui.vue';
import NutUI from '@nutui/nutui';
import Demo from './components/demo.vue';
import '@nutui/touch-emulator';

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.declaration.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"emitDeclarationOnly": true
},
"include": [
"src/packages/nutui.vue.build.ts",
"src/packages/index.build.ts",
"src/packages/locale",
"src/packages/utils",
"src/packages/resolver"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.declaration.taro.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"emitDeclarationOnly": true
},
"include": [
"src/packages/nutui.taro.vue.build.ts",
"src/packages/taro.build.ts",
"src/packages/locale",
"src/packages/utils",
"src/packages/resolver"
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"types": ["vite/client", "vitest/globals"],
"allowJs": true,
"paths": {
"@/*": ["src/*"]
"@/*": ["src/*"],
"@nutui/nutui": ["src/packages/index.ts"],
"@nutui/nutui-taro": ["src/packages/taro.ts"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
Expand Down
2 changes: 1 addition & 1 deletion vite.config.build.taro.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default defineConfig({
}
},
lib: {
entry: 'src/packages/nutui.taro.vue.build.ts',
entry: 'src/packages/taro.build.ts',
name: 'nutui',
fileName: () => 'nutui.umd.js',
formats: ['umd']
Expand Down
2 changes: 1 addition & 1 deletion vite.config.build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineConfig({
}
},
lib: {
entry: 'src/packages/nutui.vue.build.ts',
entry: 'src/packages/index.build.ts',
name: 'nutui',
fileName: (type) => {
return type === 'umd' ? 'nutui.umd.js' : 'nutui.js';
Expand Down
5 changes: 4 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const resolve = path.resolve;
export default defineConfig({
base: '/',
resolve: {
alias: [{ find: '@', replacement: resolve(__dirname, './src') }]
alias: [
{ find: '@', replacement: resolve(__dirname, './src') },
{ find: '@nutui/nutui', replacement: resolve(__dirname, './src/packages/index.ts') }
]
},
css: {
preprocessorOptions: {
Expand Down

0 comments on commit 71c1515

Please sign in to comment.