mirror of https://github.com/webpack/webpack.git
add builtAt stats option. use locale string functions
This commit is contained in:
parent
152575c2b0
commit
5266a30808
12
lib/Stats.js
12
lib/Stats.js
|
|
@ -105,6 +105,7 @@ class Stats {
|
|||
const showEnv = optionOrLocalFallback(options.env, false);
|
||||
const showVersion = optionOrLocalFallback(options.version, true);
|
||||
const showTimings = optionOrLocalFallback(options.timings, true);
|
||||
const showBuiltAt = optionOrLocalFallback(options.builtAt, true);
|
||||
const showAssets = optionOrLocalFallback(options.assets, true);
|
||||
const showEntrypoints = optionOrLocalFallback(options.entrypoints, true);
|
||||
const showChunks = optionOrLocalFallback(options.chunks, !forToString);
|
||||
|
|
@ -252,6 +253,9 @@ class Stats {
|
|||
if(showHash) obj.hash = this.hash;
|
||||
if(showTimings && this.startTime && this.endTime) {
|
||||
obj.time = this.endTime - this.startTime;
|
||||
}
|
||||
|
||||
if(showBuiltAt && this.endTime) {
|
||||
obj.builtAt = this.endTime;
|
||||
}
|
||||
|
||||
|
|
@ -618,11 +622,11 @@ class Stats {
|
|||
newline();
|
||||
}
|
||||
if(typeof obj.builtAt === "number") {
|
||||
const now = (new Date(obj.builtAt)).toString().split(" ");
|
||||
const builtAtDate = new Date(obj.builtAt);
|
||||
colors.normal("Built at: ");
|
||||
colors.normal(`${now[0]} ${now[1]} ${now[2]} ${now[3]} `);
|
||||
colors.bold(now[4]);
|
||||
colors.normal(now[6] ? ` ${now[5]} ${now[6]}` : ` ${now[5]}`);
|
||||
colors.normal(builtAtDate.toLocaleDateString());
|
||||
colors.normal(" ");
|
||||
colors.bold(builtAtDate.toLocaleTimeString());
|
||||
newline();
|
||||
}
|
||||
if(obj.env) {
|
||||
|
|
|
|||
|
|
@ -1655,6 +1655,10 @@
|
|||
"type": "boolean",
|
||||
"description": "add timing information"
|
||||
},
|
||||
"builtAt": {
|
||||
"type": "boolean",
|
||||
"description": "add built at time information"
|
||||
},
|
||||
"performance": {
|
||||
"type": "boolean",
|
||||
"description": "add performance hint flags"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ const path = require("path");
|
|||
const stats = {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
assets: false,
|
||||
chunks: true,
|
||||
chunkOrigins: true,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ module.exports = {
|
|||
stats: {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
assets: false,
|
||||
chunks: true,
|
||||
chunkOrigins: true,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ module.exports = {
|
|||
stats: {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
assets: false,
|
||||
chunks: true,
|
||||
chunkModules: true,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ module.exports = {
|
|||
stats: {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
assets: false,
|
||||
chunks: true,
|
||||
chunkModules: true,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ module.exports = {
|
|||
stats: {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
assets: false,
|
||||
chunks: true,
|
||||
chunkModules: true,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ module.exports = {
|
|||
stats: {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
chunks: true,
|
||||
chunkModules: true,
|
||||
modules: false
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ module.exports = {
|
|||
stats: {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
chunks: true,
|
||||
chunkModules: true,
|
||||
modules: false
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module.exports = {
|
|||
entry: "./index",
|
||||
stats: {
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
hash: false,
|
||||
modules: true,
|
||||
chunks: false
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ module.exports = [
|
|||
entrypoints: true,
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
chunks: false,
|
||||
assets: false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const stats = {
|
||||
hash: false,
|
||||
timings: false,
|
||||
builtAt: false,
|
||||
assets: false,
|
||||
chunks: true,
|
||||
chunkOrigins: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue