kn-cli 1.0.126 → 1.0.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/build/webpack.config.js +3 -3
  2. package/package.json +1 -1
  3. package/templates/template_admin/dev.sh +2 -1
  4. package/templates/template_admin/package.json +1 -1
  5. package/templates/template_admin/public/src/_antd.less +1 -1
  6. package/templates/template_admin/public/src/{_reset.less → _reset.module.less} +2 -2
  7. package/templates/template_admin/public/src/components/antd/tooltip/detail/index.jsx +1 -1
  8. package/templates/template_admin/public/src/components/antd/tooltip/detail/{index.less → index.module.less} +1 -1
  9. package/templates/template_admin/public/src/components/antd/tooltip/index.jsx +1 -1
  10. package/templates/template_admin/public/src/components/antd/tooltip/{index.less → index.module.less} +1 -1
  11. package/templates/template_admin/public/src/components/auth/index.jsx +1 -1
  12. package/templates/template_admin/public/src/components/badge/index.jsx +1 -1
  13. package/templates/template_admin/public/src/components/debug/index.jsx +1 -1
  14. package/templates/template_admin/public/src/components/empty/index.jsx +1 -1
  15. package/templates/template_admin/public/src/components/iconFont/index.jsx +1 -1
  16. package/templates/template_admin/public/src/components/image/index.jsx +1 -1
  17. package/templates/template_admin/public/src/components/image/preview.jsx +1 -1
  18. package/templates/template_admin/public/src/components/layout/basic/index.jsx +1 -1
  19. package/templates/template_admin/public/src/components/layout/basic/{index.less → index.module.less} +2 -2
  20. package/templates/template_admin/public/src/components/layout/index.jsx +1 -1
  21. package/templates/template_admin/public/src/components/layout/{index.less → index.module.less} +2 -2
  22. package/templates/template_admin/public/src/components/leftMenu/index.jsx +1 -1
  23. package/templates/template_admin/public/src/components/leftMenu/{index.less → index.module.less} +2 -2
  24. package/templates/template_admin/public/src/components/link/index.jsx +1 -1
  25. package/templates/template_admin/public/src/components/link/{index.less → index.module.less} +1 -1
  26. package/templates/template_admin/public/src/components/menuIcon/index.jsx +1 -1
  27. package/templates/template_admin/public/src/components/page/pageLoading/index.jsx +1 -1
  28. package/templates/template_admin/public/src/components/popup/index.jsx +1 -1
  29. package/templates/template_admin/public/src/components/table/column.jsx +1 -1
  30. package/templates/template_admin/public/src/components/table/index.jsx +1 -1
  31. package/templates/template_admin/public/src/components/text/index.jsx +1 -1
  32. package/templates/template_admin/public/src/components/toast/index.jsx +1 -1
  33. package/templates/template_admin/public/src/components/toast/{index.less → index.module.less} +1 -1
  34. package/templates/template_admin/public/src/components/topMenu/index.jsx +1 -1
  35. package/templates/template_admin/public/src/components/topMenu/{index.less → index.module.less} +2 -2
  36. package/templates/template_admin/public/src/components/topMenu/topBar/index.jsx +1 -1
  37. package/templates/template_admin/public/src/components/topMenu/topBar/{index.less → index.module.less} +1 -1
  38. package/templates/template_admin/public/src/components/video/index.jsx +1 -1
  39. package/templates/template_admin/public/src/components/video/preview.jsx +1 -1
  40. package/templates/template_admin/public/src/index.jsx +1 -1
  41. package/templates/template_admin/public/src/pages/auth/user/create/index.jsx +1 -1
  42. package/templates/template_admin/public/src/pages/components/layout/index.jsx +1 -1
  43. package/templates/template_admin/public/src/pages/components/layout/{index.less → index.module.less} +1 -1
  44. package/templates/template_admin/public/src/pages/components/layout/titleBar/index.jsx +1 -1
  45. package/templates/template_admin/public/src/pages/components/layout/titleBar/{index.less → index.module.less} +1 -1
  46. package/templates/template_admin/public/src/pages/error/permission.jsx +1 -1
  47. package/templates/template_admin/public/src/pages/home.jsx +1 -1
  48. package/templates/template_admin/public/src/pages/login/index.jsx +1 -1
  49. package/templates/template_admin/public/src/pages/login/{index.less → index.module.less} +1 -1
  50. package/templates/template_admin/public/src/pages/pageTemplate.jsx +1 -1
  51. package/templates/template_admin/renamejstojsx.js +45 -0
  52. package/templates/template_admin/renameless.js +53 -0
  53. package/templates/template_admin/webpack.api.js +54 -14
  54. /package/templates/template_admin/public/src/{_mixin.less → _mixin.module.less} +0 -0
  55. /package/templates/template_admin/public/src/{_variable.less → _variable.module.less} +0 -0
  56. /package/templates/template_admin/public/src/assets/iconfont/{iconfont.less → iconfont.module.less} +0 -0
  57. /package/templates/template_admin/public/src/components/auth/{index.less → index.module.less} +0 -0
  58. /package/templates/template_admin/public/src/components/badge/{index.less → index.module.less} +0 -0
  59. /package/templates/template_admin/public/src/components/debug/{index.less → index.module.less} +0 -0
  60. /package/templates/template_admin/public/src/components/empty/{index.less → index.module.less} +0 -0
  61. /package/templates/template_admin/public/src/components/iconFont/{index.less → index.module.less} +0 -0
  62. /package/templates/template_admin/public/src/components/image/{index.less → index.module.less} +0 -0
  63. /package/templates/template_admin/public/src/components/menuIcon/{index.less → index.module.less} +0 -0
  64. /package/templates/template_admin/public/src/components/page/pageLoading/{index.less → index.module.less} +0 -0
  65. /package/templates/template_admin/public/src/components/popup/{index.less → index.module.less} +0 -0
  66. /package/templates/template_admin/public/src/components/table/{column.less → column.module.less} +0 -0
  67. /package/templates/template_admin/public/src/components/table/{index.less → index.module.less} +0 -0
  68. /package/templates/template_admin/public/src/components/text/{index.less → index.module.less} +0 -0
  69. /package/templates/template_admin/public/src/components/video/{index.less → index.module.less} +0 -0
  70. /package/templates/template_admin/public/src/dictionary/{index.js → index.jsx} +0 -0
  71. /package/templates/template_admin/public/src/pages/auth/user/create/{index.less → index.module.less} +0 -0
  72. /package/templates/template_admin/public/src/pages/error/{permission.less → permission.module.less} +0 -0
  73. /package/templates/template_admin/public/src/pages/{home.less → home.module.less} +0 -0
  74. /package/templates/template_admin/public/src/provider/{menu.less → menu.module.less} +0 -0
@@ -178,7 +178,7 @@ if(process.env.build_env == 'localdebug'){
178
178
 
179
179
  const rules= [
180
180
  {
181
- test: /\.js[x]?$/,
181
+ test: /\.[m]?js[x]?$/,
182
182
  exclude: /node_modules/,
183
183
  use: LOADER_JS,
184
184
  },
@@ -289,7 +289,7 @@ if(CLI_CONFIG.rules){
289
289
  if(CLI_CONFIG.rules.compileNpmPackage){
290
290
  let JS_LIST= CLI_CONFIG.rules.compileNpmPackage.join('|');
291
291
  rules.push({
292
- test: /\.js[x]?$/,
292
+ test: /\.[m]?js[x]?$/,
293
293
  include: new RegExp(`(${JS_LIST})`),
294
294
  use: LOADER_JS
295
295
  },)
@@ -521,9 +521,9 @@ const config={
521
521
  output: output,
522
522
  resolve: {
523
523
  modules: [
524
+ 'node_modules',
524
525
  path.resolve(dirname,'node_modules'),
525
526
  path.resolve(webpackPath, 'node_modules'),
526
- 'node_modules',
527
527
  ],
528
528
  extensions: ['.jsx', '.js', '.json','.mjs'],
529
529
  alias: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.126",
3
+ "version": "1.0.128",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,7 +5,8 @@ fi
5
5
 
6
6
  . ./shellUtil.sh
7
7
 
8
- node_version="v16.18.0"
8
+ # 如果要使用webpack调试,改为16.18.0
9
+ node_version="v20.19.0"
9
10
 
10
11
 
11
12
  build(){
@@ -11,7 +11,7 @@
11
11
  "antd": "~4.24.8",
12
12
  "axios": "~1.1.3",
13
13
  "jszip": "~3.10.1",
14
- "kn-hooks": "~0.0.35",
14
+ "kn-hooks": "~1.0.2",
15
15
  "moment": "~2.29.4",
16
16
  "react": "~17.0.2",
17
17
  "react-dom": "~17.0.2",
@@ -1,5 +1,5 @@
1
1
  @import '~antd/dist/antd.less';
2
- @import '_mixin.less';
2
+ @import '_mixin.module.less';
3
3
 
4
4
 
5
5
  // 这里可以重写antd的主题样式变量,参考 https://4x.ant.design/docs/react/customize-theme-cn
@@ -1,6 +1,6 @@
1
1
 
2
- @import '~@/assets/iconfont/iconfont.less';
3
- @import './_variable.less';
2
+ @import '~@/assets/iconfont/iconfont.module.less';
3
+ @import './_variable.module.less';
4
4
 
5
5
  :global {
6
6
  html{
@@ -5,7 +5,7 @@ import { Modal } from "@/components/antd";
5
5
  // @ts-ignore
6
6
  import Popup from "@/components/popup";
7
7
  import { LayoutLanguage } from "@/components/layout/provider";
8
- import styles from './index.less';
8
+ import styles from './index.module.less';
9
9
  import { useEffect } from "react";
10
10
 
11
11
  /**
@@ -1,4 +1,4 @@
1
- @import '~@/_mixin.less';
1
+ @import '~@/_mixin.module.less';
2
2
 
3
3
  .content{
4
4
  width: 100%;
@@ -1,6 +1,6 @@
1
1
 
2
2
  import React from "react";
3
- import styles from './index.less';
3
+ import styles from './index.module.less';
4
4
  import { AntdTooltip } from "@/components/antd";
5
5
  import { useState } from "react";
6
6
  import { useEffect } from "react";
@@ -1,4 +1,4 @@
1
- @import '~@/_mixin.less';
1
+ @import '~@/_mixin.module.less';
2
2
 
3
3
  .moreWrap{
4
4
  display: flex;
@@ -7,7 +7,7 @@ import ProviderApp from '@/provider/app';
7
7
 
8
8
  import {useLoading} from '@/hooks/index';
9
9
  // @ts-ignore
10
- import styles from './index.less';
10
+ import styles from './index.module.less';
11
11
  import { AUTH_DEBUG_OPEN } from '@/config';
12
12
  import Page403 from '@/pages/error/403';
13
13
 
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
2
 
3
3
  // @ts-ignore
4
- import styles from './index.less';
4
+ import styles from './index.module.less';
5
5
 
6
6
 
7
7
  const Badge=(props)=>{
@@ -5,7 +5,7 @@ import ReactJson from 'react-json-view'
5
5
  // @ts-ignore
6
6
  import {Tooltip} from '@/components/antd';
7
7
  // @ts-ignore
8
- import styles from './index.less';
8
+ import styles from './index.module.less';
9
9
 
10
10
  /**
11
11
  * 测试调试时用于点击对象后显示数据用
@@ -1,7 +1,7 @@
1
1
  // @ts-ignore
2
2
  import React from "react";
3
3
  // @ts-ignore
4
- import styles from './index.less';
4
+ import styles from './index.module.less';
5
5
  // @ts-ignore
6
6
  import imgEmpty from '@/assets/images/noData.png';
7
7
  // @ts-ignore
@@ -1,7 +1,7 @@
1
1
  // @ts-ignore
2
2
  import React from "react";
3
3
  // @ts-ignore
4
- import styles from'./index.less';
4
+ import styles from'./index.module.less';
5
5
 
6
6
  /**
7
7
  * iconFont图标
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
3
3
  import { Image } from '@/components/antd';
4
4
  import ShowPreview from './preview';
5
5
  // @ts-ignore
6
- import styles from './index.less';
6
+ import styles from './index.module.less';
7
7
  // @ts-ignore
8
8
  import imgFail from '@/assets/images/loadFail.png';
9
9
 
@@ -4,7 +4,7 @@ import { Image,Button,Space } from '@/components/antd';
4
4
  import { CloseOutlined } from '@ant-design/icons';
5
5
  import Popup from '@/components/popup';
6
6
  // @ts-ignore
7
- import styles from './index.less';
7
+ import styles from './index.module.less';
8
8
 
9
9
  const ModalPreview = (props) => {
10
10
  const { destory,data=[] } = props;
@@ -6,7 +6,7 @@ import {Outlet} from 'react-router-dom';
6
6
  import TopBar from '@/components/topMenu/topBar';
7
7
 
8
8
  // @ts-ignore
9
- import styles from './index.less';
9
+ import styles from './index.module.less';
10
10
 
11
11
  /**
12
12
  * 登录后的页面主体框架,定义导航栏、路由主体部分位置
@@ -1,5 +1,5 @@
1
- @import '~@/_variable.less';
2
- @import '~@/_mixin.less';
1
+ @import '~@/_variable.module.less';
2
+ @import '~@/_mixin.module.less';
3
3
 
4
4
  .layout{
5
5
  position: relative;
@@ -8,7 +8,7 @@ import LayoutBasic from './basic/index';
8
8
  import {LayoutLanguage} from './provider';
9
9
 
10
10
  // @ts-ignore
11
- import styles from './index.less';
11
+ import styles from './index.module.less';
12
12
 
13
13
  import { popupList } from '@/components/popup';
14
14
 
@@ -1,5 +1,5 @@
1
- @import '~@/_variable.less';
2
- @import '~@/_mixin.less';
1
+ @import '~@/_variable.module.less';
2
+ @import '~@/_mixin.module.less';
3
3
 
4
4
  .absoluteLayout {
5
5
  width: 100%;
@@ -11,7 +11,7 @@ import {useLoading} from '@/hooks/index';
11
11
  import ProviderMenu from '@/provider/menu';
12
12
 
13
13
  // @ts-ignore
14
- import styles from './index.less';
14
+ import styles from './index.module.less';
15
15
 
16
16
 
17
17
 
@@ -1,6 +1,6 @@
1
- @import '~@/_variable.less';
1
+ @import '~@/_variable.module.less';
2
2
 
3
- @import '~@/_mixin.less';
3
+ @import '~@/_mixin.module.less';
4
4
 
5
5
 
6
6
  .nav{
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import { openLink } from '@/utils';
5
5
 
6
6
  // @ts-ignore
7
- import styles from './index.less';
7
+ import styles from './index.module.less';
8
8
 
9
9
  /**
10
10
  * 超链接组件
@@ -1,4 +1,4 @@
1
- @import '~@/_variable.less';
1
+ @import '~@/_variable.module.less';
2
2
 
3
3
 
4
4
  .linkWrap{
@@ -1,7 +1,7 @@
1
1
 
2
2
  import React,{ useState, useEffect } from 'react';
3
3
  // @ts-ignore
4
- import styles from './index.less';
4
+ import styles from './index.module.less';
5
5
 
6
6
  const MenuIcon=(props)=>{
7
7
 
@@ -9,7 +9,7 @@ import Popup from '@/components/popup';
9
9
  import imgLoading from '@/assets/images/loading.svg';
10
10
 
11
11
  // @ts-ignore
12
- import CSS from './index.less';
12
+ import CSS from './index.module.less';
13
13
 
14
14
  /**
15
15
  * 页面Loading状态
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import ReactDOM from 'react-dom';
5
5
 
6
6
  // @ts-ignore
7
- import styles from './index.less';
7
+ import styles from './index.module.less';
8
8
  styles;
9
9
 
10
10
  export const popupList={
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  // @ts-ignore
4
- import styles from './column.less';
4
+ import styles from './column.module.less';
5
5
  import {DebugTableItem} from '@/components/debug';
6
6
 
7
7
 
@@ -2,7 +2,7 @@ import React,{useCallback} from 'react';
2
2
  // @ts-ignore
3
3
  import { Table } from '@/components/antd';
4
4
  // @ts-ignore
5
- import styles from './index.less';
5
+ import styles from './index.module.less';
6
6
  import Column from './column';
7
7
 
8
8
  export const SCROLL_CONFIG={x:'max-content',y:550}
@@ -3,7 +3,7 @@ import React, { useEffect, useState, useRef } from 'react';
3
3
  import { Tooltip } from '@/components/antd';
4
4
  import { getStrByteLen } from '@/utils';
5
5
  // @ts-ignore
6
- import styles from './index.less';
6
+ import styles from './index.module.less';
7
7
 
8
8
  /**
9
9
  * 获取字符串末尾字节数的字符串、所在位置
@@ -7,7 +7,7 @@ import ReactDOM from 'react-dom';
7
7
  import Popup from '@/components/popup';
8
8
 
9
9
  // @ts-ignore
10
- import styles from './index.less';
10
+ import styles from './index.module.less';
11
11
 
12
12
  const toastList=[];
13
13
  const runNext=()=>{
@@ -1,4 +1,4 @@
1
- @import '~@/_variable.less';
1
+ @import '~@/_variable.module.less';
2
2
 
3
3
  .wrap{
4
4
  position: fixed;
@@ -11,7 +11,7 @@ import TopBar from './topBar';
11
11
  import {DEBUG_ENV} from '@/config';
12
12
 
13
13
  // @ts-ignore
14
- import styles from './index.less';
14
+ import styles from './index.module.less';
15
15
 
16
16
  const TopSlogan=()=>{
17
17
  const navigate = useNavigate();
@@ -1,5 +1,5 @@
1
- @import '~@/_variable.less';
2
- @import '~@/_mixin.less';
1
+ @import '~@/_variable.module.less';
2
+ @import '~@/_mixin.module.less';
3
3
 
4
4
  @menuWidth:70px;
5
5
  @openMenuWidth:128px;
@@ -11,7 +11,7 @@ import imgUser from '@/assets/images/icon-user.png';
11
11
  import ProviderApp from '@/provider/app';
12
12
 
13
13
  // @ts-ignore
14
- import styles from './index.less';
14
+ import styles from './index.module.less';
15
15
 
16
16
 
17
17
  const TopBar=()=>{
@@ -1,4 +1,4 @@
1
- @import '~@/_mixin.less';
1
+ @import '~@/_mixin.module.less';
2
2
 
3
3
  .toggle{
4
4
  width: 24px;
@@ -3,7 +3,7 @@ import ShowPreview from './preview';
3
3
  // @ts-ignore
4
4
  import moment from 'moment';
5
5
  // @ts-ignore
6
- import styles from './index.less';
6
+ import styles from './index.module.less';
7
7
  // @ts-ignore
8
8
  import imgFail from '@/assets/images/loadFail.png';
9
9
 
@@ -3,7 +3,7 @@ import ReactDom from 'react-dom';
3
3
  import { CloseOutlined } from '@ant-design/icons';
4
4
  import Popup from '@/components/popup';
5
5
  // @ts-ignore
6
- import styles from './index.less';
6
+ import styles from './index.module.less';
7
7
 
8
8
  const ModalPreview = (props) => {
9
9
  const { destory, src } = props;
@@ -1,7 +1,7 @@
1
1
  // @ts-ignore
2
2
  import React from 'react';
3
3
  import './_antd.less';
4
- import './_reset.less';
4
+ import './_reset.module.less';
5
5
  import RouteList from './route';
6
6
  // @ts-ignore
7
7
  import moment from 'moment';
@@ -17,7 +17,7 @@ import {
17
17
  } from '@/services/demo';
18
18
 
19
19
  // @ts-ignore
20
- import styles from './index.less';
20
+ import styles from './index.module.less';
21
21
 
22
22
  const AuthUserCreate = () => {
23
23
  return (
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { useNavigate } from 'react-router-dom';
4
4
  import _TitleBar from './titleBar';
5
5
  // @ts-ignore
6
- import styles from './index.less';
6
+ import styles from './index.module.less';
7
7
 
8
8
 
9
9
 
@@ -1,4 +1,4 @@
1
- @import '~@/_mixin.less';
1
+ @import '~@/_mixin.module.less';
2
2
 
3
3
  .layout{
4
4
  position: relative;
@@ -5,7 +5,7 @@ import { useNavigate } from 'react-router-dom';
5
5
  // @ts-ignore
6
6
  import imgArrow from '@/assets/images/arrow.png';
7
7
  // @ts-ignore
8
- import styles from './index.less';
8
+ import styles from './index.module.less';
9
9
 
10
10
  const TitleBar = (props) => {
11
11
  const { optionLeft, optionRight,label,showBack,className='' } = props;
@@ -1,4 +1,4 @@
1
- @import '~@/_mixin.less';
1
+ @import '~@/_mixin.module.less';
2
2
 
3
3
 
4
4
  .title {
@@ -7,7 +7,7 @@ import { Button } from "@/components/antd";
7
7
  // @ts-ignore
8
8
  import { px2rem } from '@/utils';
9
9
  // @ts-ignore
10
- import styles from './permission.less';
10
+ import styles from './permission.module.less';
11
11
 
12
12
  /**
13
13
  * permission页面
@@ -14,7 +14,7 @@ import { AuthShow } from '@/components/auth';
14
14
 
15
15
  import {useMessageStatus} from '@/dictionary';
16
16
  // @ts-ignore
17
- import styles from './home.less';
17
+ import styles from './home.module.less';
18
18
 
19
19
  const Home = () => {
20
20
 
@@ -7,7 +7,7 @@ import ruler from '@/utils/rule';
7
7
  // @ts-ignore
8
8
  import {Button,Tabs,Form,Input} from '@/components/antd';
9
9
  // @ts-ignore
10
- import styles from './index.less';
10
+ import styles from './index.module.less';
11
11
 
12
12
  import {jumpUrl} from '@/utils';
13
13
  // @ts-ignore
@@ -1,4 +1,4 @@
1
- @import '~@/_mixin.less';
1
+ @import '~@/_mixin.module.less';
2
2
 
3
3
  @keyframes rotate {
4
4
  from {
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import {Layout,SearchBar,TitleBar,Content,Panel} from './components/layout'
4
4
 
5
5
  // @ts-ignore
6
- import styles from './home.less';
6
+ import styles from './home.module.less';
7
7
 
8
8
  const PageTemplate = (props) => {
9
9
  const {name} = props;
@@ -0,0 +1,45 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ // --- 配置区 ---
6
+ // 将这里的 'public/src' 修改为你实际的源码目录
7
+ const TARGET_DIR = './public/src';
8
+
9
+ // 获取绝对路径
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const rootPath = path.resolve(__dirname, TARGET_DIR);
12
+
13
+ const FILE_LIST=[
14
+ 'dictionary/index.js',
15
+ 'pages/bullet/gdtAssets/audienceManage/targetTemplate/dxbTemplate/weiChatPcMarket/components/index.js',
16
+ 'pages/bullet/kuaiShou/creativeTag/create/index.js',
17
+ 'pages/bullet/material/word/wordManagement/create/index.js',
18
+ 'utils/version.js',
19
+ 'pages/components/select/userState/index.js',
20
+ 'pages/bullet/material/word/wordManagement/index.js',
21
+ 'pages/components/select/userZero/index.js',
22
+ 'pages/bullet/selfLandingPage/landingPage/htmlModal/index.js',
23
+ 'pages/dashboard/components/batchGlobalModal/formItemsConfig.js',
24
+ 'pages/equipment/tag/create/index.js'
25
+ ]
26
+
27
+ let count = 0;
28
+ FILE_LIST.forEach(file=>{
29
+ const filePath = rootPath+'/'+file;
30
+ console.log(`🚀 开始处理: ${filePath}`);
31
+ const stats = fs.statSync(filePath);
32
+ if (stats.isFile()) {
33
+ const newFilePath = filePath.replace(/\.js$/, '.jsx');
34
+ // 执行重命名
35
+ try {
36
+ // fs.renameSync(filePath, newFilePath);
37
+ console.log(`✅ Renamed: ${file} -> ${path.basename(newFilePath)}`);
38
+ count++;
39
+ } catch (err) {
40
+ console.error(`❌ Failed: ${file}`, err);
41
+ }
42
+ }
43
+ })
44
+
45
+ console.log(`\n✨ 完成!共重命名了 ${count} 个文件。`);
@@ -0,0 +1,53 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ // --- 配置区 ---
6
+ // 将这里的 'public/src' 修改为你实际的源码目录
7
+ const TARGET_DIR = './public/src';
8
+
9
+ // 获取绝对路径
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const rootPath = path.resolve(__dirname, TARGET_DIR);
12
+
13
+ let count = 0;
14
+
15
+ /**
16
+ * 递归遍历并重命名
17
+ * @param {string} dir
18
+ */
19
+ function walk(dir) {
20
+ const files = fs.readdirSync(dir);
21
+
22
+ files.forEach((file) => {
23
+ const filePath = path.join(dir, file);
24
+ const stats = fs.statSync(filePath);
25
+
26
+ if (stats.isDirectory()) {
27
+ // 递归进入子目录
28
+ walk(filePath);
29
+ } else if (stats.isFile()) {
30
+ // 匹配逻辑:以 .less 结尾,但不是以 .module.less 结尾
31
+ if (file.endsWith('.less') && !file.endsWith('.module.less')) {
32
+ const newFilePath = filePath.replace(/\.less$/, '.module.less');
33
+
34
+ // 执行重命名
35
+ try {
36
+ fs.renameSync(filePath, newFilePath);
37
+ console.log(`✅ Renamed: ${file} -> ${path.basename(newFilePath)}`);
38
+ count++;
39
+ } catch (err) {
40
+ console.error(`❌ Failed: ${file}`, err);
41
+ }
42
+ }
43
+ }
44
+ });
45
+ }
46
+
47
+ console.log(`🚀 开始处理目录: ${rootPath}`);
48
+ if (fs.existsSync(rootPath)) {
49
+ walk(rootPath);
50
+ console.log(`\n✨ 完成!共重命名了 ${count} 个文件。`);
51
+ } else {
52
+ console.error(`❌ 错误:目录 ${rootPath} 不存在,请检查配置。`);
53
+ }
@@ -21,36 +21,76 @@ const configs = {
21
21
 
22
22
 
23
23
  const API_PROXY= {
24
- '/api/**': {
25
- target: 'http://192.168.92.117:8080',
24
+ '/uatapi':{
25
+ target:'https://uat-zeus.kingnet.com/',
26
26
  changeOrigin: true,
27
- logLevel: 'debug',
27
+ logLevel: 'error',
28
28
  pathRewrite: {
29
- '^/api': '/', // rewrite path
29
+ '^/uatapi': '', // rewrite path
30
30
  },
31
31
  },
32
- '/devapi/**':{
32
+ '/devapi':{
33
33
  target:'https://dev-zeus.kingnet.com/',
34
34
  changeOrigin: true,
35
- logLevel: 'debug',
35
+ logLevel: 'error',
36
36
  pathRewrite: {
37
- '^/devapi': '/', // rewrite path
37
+ '^/devapi': '', // rewrite path
38
38
  },
39
39
  },
40
- '/preapi/**': {
40
+ '/preapi': {
41
41
  target:'https://pre-zeus.kingnet.com/',
42
42
  changeOrigin: true,
43
- logLevel: 'debug',
43
+ logLevel: 'error',
44
44
  pathRewrite: {
45
- '^/preapi': '/', // rewrite path
46
- },
45
+ '^/preapi': '', // rewrite path
46
+ }
47
47
  },
48
- '/prodapi/**': {
48
+ '/prodapi': {
49
49
  target:'https://zeus.kingnet.com/',
50
50
  changeOrigin: true,
51
- logLevel: 'debug',
51
+ logLevel: 'error',
52
+ pathRewrite: {
53
+ '^/prodapi': '', // rewrite path
54
+ },
55
+ },
56
+ '/report-api': {
57
+ target: 'http://192.168.100.22:8085/api-report',
58
+ changeOrigin: true,
59
+ logLevel: 'error',
60
+ pathRewrite: {
61
+ '^/report-api': '', // rewrite path
62
+ },
63
+ },
64
+ '/uat-report-api': {
65
+ target: 'https://uat-zeus.kingnet.com/api-report',
66
+ changeOrigin: true,
67
+ logLevel: 'error',
68
+ pathRewrite: {
69
+ '^/uat-report-api': '', // rewrite path
70
+ },
71
+ },
72
+ '/dev-report-api': {
73
+ target: 'https://dev-zeus.kingnet.com/api-report',
74
+ changeOrigin: true,
75
+ logLevel: 'error',
76
+ pathRewrite: {
77
+ '^/dev-report-api': '', // rewrite path
78
+ },
79
+ },
80
+ '/prod-report-api': {
81
+ target: 'https://zeus.kingnet.com/api-report',
82
+ changeOrigin: true,
83
+ logLevel: 'error',
84
+ pathRewrite: {
85
+ '^/prod-report-api': '', // rewrite path
86
+ },
87
+ },
88
+ '/pre-report-api': {
89
+ target: 'https://pre-zeus.kingnet.com/api-report',
90
+ changeOrigin: true,
91
+ logLevel: 'error',
52
92
  pathRewrite: {
53
- '^/prodapi': '/', // rewrite path
93
+ '^/pre-report-api': '', // rewrite path
54
94
  },
55
95
  },
56
96
  };