mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 02:28:04 +08:00 
			
		
		
		
	chore(admin): 使用dayjs替换moment
This commit is contained in:
		
							parent
							
								
									8fa1d4a5c3
								
							
						
					
					
						commit
						a41a5b3ad4
					
				
							
								
								
									
										13
									
								
								magic-admin/server/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										13
									
								
								magic-admin/server/package-lock.json
									
									
									
										generated
									
									
									
								
							@ -8,6 +8,7 @@
 | 
			
		||||
      "name": "magic-admin",
 | 
			
		||||
      "version": "1.0.0",
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "dayjs": "^1.11.7",
 | 
			
		||||
        "koa": "^2.7.0",
 | 
			
		||||
        "koa-bodyparser": "^4.2.1",
 | 
			
		||||
        "koa-router": "^8.0.6",
 | 
			
		||||
@ -45,8 +46,6 @@
 | 
			
		||||
        "lodash": "^4.17.21",
 | 
			
		||||
        "minimatch": "^5.1.0",
 | 
			
		||||
        "module-alias": "^2.2.2",
 | 
			
		||||
        "moment": "^2.29.4",
 | 
			
		||||
        "moment-timezone": "^0.5.34",
 | 
			
		||||
        "nodemon": "^1.19.0",
 | 
			
		||||
        "prettier": "^2.3.2",
 | 
			
		||||
        "serialize-javascript": "^6.0.0",
 | 
			
		||||
@ -4530,6 +4529,11 @@
 | 
			
		||||
        "node": ">=4.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/dayjs": {
 | 
			
		||||
      "version": "1.11.7",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz",
 | 
			
		||||
      "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ=="
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/debug": {
 | 
			
		||||
      "version": "4.3.3",
 | 
			
		||||
      "resolved": "https://mirrors.tencent.com/npm/debug/-/debug-4.3.3.tgz",
 | 
			
		||||
@ -16501,6 +16505,11 @@
 | 
			
		||||
      "resolved": "https://mirrors.tencent.com/npm/date-format/-/date-format-3.0.0.tgz",
 | 
			
		||||
      "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w=="
 | 
			
		||||
    },
 | 
			
		||||
    "dayjs": {
 | 
			
		||||
      "version": "1.11.7",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz",
 | 
			
		||||
      "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ=="
 | 
			
		||||
    },
 | 
			
		||||
    "debug": {
 | 
			
		||||
      "version": "4.3.3",
 | 
			
		||||
      "resolved": "https://mirrors.tencent.com/npm/debug/-/debug-4.3.3.tgz",
 | 
			
		||||
 | 
			
		||||
@ -27,6 +27,7 @@
 | 
			
		||||
    "exec": "ts-node -r tsconfig-paths/register src/index.ts --files"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "dayjs": "^1.11.7",
 | 
			
		||||
    "koa": "^2.7.0",
 | 
			
		||||
    "koa-bodyparser": "^4.2.1",
 | 
			
		||||
    "koa-router": "^8.0.6",
 | 
			
		||||
@ -64,8 +65,6 @@
 | 
			
		||||
    "lodash": "^4.17.21",
 | 
			
		||||
    "minimatch": "^5.1.0",
 | 
			
		||||
    "module-alias": "^2.2.2",
 | 
			
		||||
    "moment": "^2.29.4",
 | 
			
		||||
    "moment-timezone": "^0.5.34",
 | 
			
		||||
    "nodemon": "^1.19.0",
 | 
			
		||||
    "prettier": "^2.3.2",
 | 
			
		||||
    "serialize-javascript": "^6.0.0",
 | 
			
		||||
 | 
			
		||||
@ -19,14 +19,19 @@
 | 
			
		||||
import path from 'path';
 | 
			
		||||
 | 
			
		||||
import axios from 'axios';
 | 
			
		||||
import dayjs from 'dayjs';
 | 
			
		||||
import timezone from 'dayjs/plugin/timezone';
 | 
			
		||||
import utc from 'dayjs/plugin/utc';
 | 
			
		||||
import { createWriteStream, emptyDir } from 'fs-extra';
 | 
			
		||||
import momentTimezone from 'moment-timezone';
 | 
			
		||||
import serialize from 'serialize-javascript';
 | 
			
		||||
import uglifyJS from 'uglify-js';
 | 
			
		||||
 | 
			
		||||
import type { UiConfig } from '@src/typings';
 | 
			
		||||
import { babelTransform } from '@src/utils/transform';
 | 
			
		||||
 | 
			
		||||
dayjs.extend(utc);
 | 
			
		||||
dayjs.extend(timezone);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 格式化配置内容
 | 
			
		||||
 * @param {string} value 待格式化内容
 | 
			
		||||
@ -91,6 +96,6 @@ const getFileFromUrl = async ({ url, filePath, fileName }) => {
 | 
			
		||||
 * @returns {string} 格式化之后的时间
 | 
			
		||||
 */
 | 
			
		||||
const getFormatTime = (time: string | number = Date.now(), formatTmp = 'YYYY-MM-DD HH:mm:ss') =>
 | 
			
		||||
  momentTimezone.tz(time, 'Asia/Shanghai').format(formatTmp);
 | 
			
		||||
  dayjs.tz(time, 'Asia/Shanghai').format(formatTmp);
 | 
			
		||||
 | 
			
		||||
export { serializeConfig, configTransformDist, processTransConfig, getFileFromUrl, getFormatTime };
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user