wip: 4.0
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-16 14:27:57 +08:00
parent b09c1d9537
commit 8f3b158032
72 changed files with 3931 additions and 2161 deletions

View File

@@ -1,10 +1,11 @@
// @ts-nocheck
import Components from "unplugin-vue-components/webpack";
import NutUIResolver from "@nutui/nutui-taro/dist/resolver";
import { join } from "node:path";
import { argv } from "yargs";
import Components from 'unplugin-vue-components/webpack';
import NutUIResolver from '@nutui/nutui-taro/dist/resolver';
import {UnifiedWebpackPluginV5} from 'weapp-tailwindcss/webpack';
import {join} from 'node:path';
import {argv} from 'yargs';
const { robot = 1, desc } = argv;
const {robot = 1, desc} = argv;
const CIPluginOptFn = async () => {
/**
@@ -22,10 +23,10 @@ const CIPluginOptFn = async () => {
};
const config = {
projectName: "taroApp",
date: "2023-8-13",
designWidth(input: { file: string }) {
if (input?.file?.replace(/\\+/g, "/").indexOf("@nutui") > -1) {
projectName: 'taroApp',
date: '2023-8-13',
designWidth(input: {file: string}) {
if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
return 375;
}
return 750;
@@ -36,18 +37,18 @@ const config = {
828: 1.81 / 2,
375: 2,
},
sourceRoot: "src",
outputRoot: "dist",
plugins: ["@tarojs/plugin-html", ["@tarojs/plugin-mini-ci", CIPluginOptFn]],
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html', ['@tarojs/plugin-mini-ci', CIPluginOptFn]],
defineConstants: {},
copy: {
patterns: [],
options: {},
},
framework: "vue3",
framework: 'vue3',
compiler: {
type: "webpack5",
prebundle: { enable: false },
type: 'webpack5',
prebundle: {enable: false},
},
cache: {
enable: false, // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
@@ -56,14 +57,26 @@ const config = {
data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`,
},
alias: {
"@": join(__dirname, "..", "src"),
'@': join(__dirname, '..', 'src'),
},
mini: {
webpackChain(chain) {
chain.plugin("unplugin-vue-components").use(
chain.merge({
plugin: {
install: {
plugin: UnifiedWebpackPluginV5,
args: [
{
appType: 'taro',
},
],
},
},
});
chain.plugin('unplugin-vue-components').use(
Components({
resolvers: [NutUIResolver({ taro: true })],
})
resolvers: [NutUIResolver({taro: true})],
}),
);
},
miniCssExtractPluginOption: {
@@ -75,6 +88,7 @@ const config = {
enable: true,
config: {
// selectorBlackList: ['nut-']
removeCursorStyle: false,
},
},
url: {
@@ -86,23 +100,23 @@ const config = {
cssModules: {
enable: true, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: "module", // 转换模式,取值为 global/module
generateScopedName: "[name]__[local]___[hash:base64:5]",
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
},
h5: {
webpackChain(chain) {
chain.plugin("unplugin-vue-components").use(
chain.plugin('unplugin-vue-components').use(
Components({
resolvers: [NutUIResolver({ taro: true })],
})
resolvers: [NutUIResolver({taro: true})],
}),
);
},
publicPath: "/",
staticDirectory: "static",
esnextModules: ["nutui-taro", "icons-vue-taro"],
publicPath: '/',
staticDirectory: 'static',
esnextModules: ['nutui-taro', 'icons-vue-taro'],
postcss: {
autoprefixer: {
enable: true,
@@ -111,8 +125,8 @@ const config = {
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: "module", // 转换模式,取值为 global/module
generateScopedName: "[name]__[local]___[hash:base64:5]",
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
@@ -120,8 +134,8 @@ const config = {
};
module.exports = function (merge) {
if (process.env.NODE_ENV === "development") {
return merge({}, config, require("./dev"));
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'));
}
return merge({}, config, require("./prod"));
return merge({}, config, require('./prod'));
};