mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
add Artplayer.DEGUG
This commit is contained in:
1 parent
eda1fab811
commit
500acc2444
19 files changed
+198
-201
No files matched your search
+5
-3
@@ -2,9 +2,10 @@ import fs from 'fs';
|
||||
import cpy from 'cpy';
|
||||
import path from 'path';
|
||||
import prompts from 'prompts';
|
||||
import projects from './projects.js';
|
||||
import { Parcel } from '@parcel/core';
|
||||
import { formatDate, getProjects } from './utils.js';
|
||||
|
||||
const projects = getProjects();
|
||||
const compiledPath = path.resolve(`docs/compiled`);
|
||||
|
||||
async function build(name) {
|
||||
@@ -29,7 +30,7 @@ async function build(name) {
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
APP_VER: version,
|
||||
BUILD_DATE: Date.now(),
|
||||
BUILD_DATE: formatDate(Date.now()),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -49,7 +50,8 @@ async function build(name) {
|
||||
fs.writeFileSync(filePath, code.replace(/\\n*\s*</g, '<').replace(/>\\n*\s*/g, '>'));
|
||||
fs.renameSync(filePath, newFilePath);
|
||||
await cpy(newFilePath, compiledPath);
|
||||
console.log(`✨ Built ${name}@${version} ${bundles.length} bundles in ${buildTime}ms!`);
|
||||
const size = fs.statSync(newFilePath).size / 1024;
|
||||
console.log(`✨ Built ${name}@${version}`, `Bundles@${bundles.length}`, `Time@${buildTime}ms`, `Size@${size}kb`);
|
||||
}
|
||||
|
||||
function runPromisesInSeries(ps) {
|
||||
|
||||
+4
-2
@@ -3,10 +3,12 @@ import path from 'path';
|
||||
import servor from 'servor';
|
||||
import prompts from 'prompts';
|
||||
import { fileURLToPath } from 'url';
|
||||
import projects from './projects.js';
|
||||
import { Parcel } from '@parcel/core';
|
||||
import { formatDate, getProjects } from './utils.js';
|
||||
import openBrowser from 'servor/utils/openBrowser.js';
|
||||
|
||||
const projects = getProjects();
|
||||
|
||||
async function develop(name) {
|
||||
let isOpenBrowser = false;
|
||||
const uncompiledPath = path.resolve(`docs/uncompiled/${name}`);
|
||||
@@ -37,7 +39,7 @@ async function develop(name) {
|
||||
env: {
|
||||
NODE_ENV: 'development',
|
||||
APP_VER: version,
|
||||
BUILD_DATE: Date.now(),
|
||||
BUILD_DATE: formatDate(Date.now()),
|
||||
},
|
||||
additionalReporters: [
|
||||
{
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import path from 'path';
|
||||
import glob from 'glob';
|
||||
|
||||
export default glob
|
||||
.sync(path.join(process.cwd(), 'packages/*'))
|
||||
.filter((item) => !item.endsWith('artplayer-document') && !item.endsWith('artplayer-template'))
|
||||
.reduce((result, item) => {
|
||||
const name = item.split(path.sep).pop();
|
||||
result[name] = item;
|
||||
return result;
|
||||
}, {});
|
||||
@@ -0,0 +1,24 @@
|
||||
import path from 'path';
|
||||
import glob from 'glob';
|
||||
|
||||
export function formatDate(date) {
|
||||
var date = new Date(Number(date));
|
||||
var YY = date.getFullYear() + '-';
|
||||
var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
|
||||
var DD = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||||
var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
|
||||
var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
|
||||
var ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||
return YY + MM + DD + ' ' + hh + mm + ss;
|
||||
}
|
||||
|
||||
export function getProjects() {
|
||||
return glob
|
||||
.sync(path.join(process.cwd(), 'packages/*'))
|
||||
.filter((item) => !item.endsWith('artplayer-document') && !item.endsWith('artplayer-template'))
|
||||
.reduce((result, item) => {
|
||||
const name = item.split(path.sep).pop();
|
||||
result[name] = item;
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
Reference in new issue
Block a user