export-to-exceljs-util 1.0.0
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.
- package/.babelrc +3 -0
- package/defaultExport.js +210 -0
- package/index.js +57 -0
- package/package.json +18 -0
- package/utils/index.js +23 -0
- package/writeBufferWorker.js +200 -0
- package/yarn-error.log +50 -0
package/.babelrc
ADDED
package/defaultExport.js
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
import ExcelJS from "exceljs";
|
2
|
+
import { ExcelExporter } from "./index";
|
3
|
+
import { saveAs } from "file-saver";
|
4
|
+
const fontStyle = {
|
5
|
+
name: "Arial",
|
6
|
+
size: 10,
|
7
|
+
bold: true, // 设置文字加粗
|
8
|
+
color: { argb: "FF000000" },
|
9
|
+
};
|
10
|
+
const alignmentStyle = (vertical = "middle", horizontal = "center") => {
|
11
|
+
return {
|
12
|
+
vertical,
|
13
|
+
horizontal,
|
14
|
+
};
|
15
|
+
};
|
16
|
+
|
17
|
+
const borderStyle = {
|
18
|
+
top: { style: "thin" },
|
19
|
+
left: { style: "thin" },
|
20
|
+
bottom: { style: "thin" },
|
21
|
+
right: { style: "thin" },
|
22
|
+
};
|
23
|
+
export default class DefaultExport extends ExcelExporter {
|
24
|
+
constructor() {
|
25
|
+
super();
|
26
|
+
}
|
27
|
+
async export() {
|
28
|
+
const workbook = new ExcelJS.Workbook();
|
29
|
+
const worksheet = workbook.addWorksheet("Sheet1");
|
30
|
+
// 设置表头样式
|
31
|
+
this.generateHeaders(worksheet, this.columns);
|
32
|
+
|
33
|
+
// 填充数据
|
34
|
+
this.fillData(worksheet);
|
35
|
+
|
36
|
+
// 自动调整列宽
|
37
|
+
// autoFitColumns(worksheet);
|
38
|
+
|
39
|
+
// 处理描述信息
|
40
|
+
this.generateDescribe(worksheet);
|
41
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
42
|
+
const blob = new Blob([buffer], {
|
43
|
+
type: "application/octet-stream",
|
44
|
+
});
|
45
|
+
saveAs(blob, this.filename);
|
46
|
+
}
|
47
|
+
generateHeaders(
|
48
|
+
worksheet,
|
49
|
+
columns,
|
50
|
+
rowIndex = 1,
|
51
|
+
colIndexStart = 1,
|
52
|
+
maxDepth = null
|
53
|
+
) {
|
54
|
+
let maxRowIndex = rowIndex;
|
55
|
+
let colIndex = colIndexStart;
|
56
|
+
|
57
|
+
// 计算整个表头的最大深度(用于单级表头行合并)
|
58
|
+
if (maxDepth === null) {
|
59
|
+
maxDepth = this.getMaxDepth(columns);
|
60
|
+
}
|
61
|
+
|
62
|
+
columns.forEach((column) => {
|
63
|
+
const currentRowIndex = rowIndex;
|
64
|
+
const currentColIndex = colIndex;
|
65
|
+
|
66
|
+
// 计算列的跨度和行的跨度
|
67
|
+
const colSpan = this.getColSpan(column);
|
68
|
+
const rowSpan = this.getRowSpan(column, maxDepth - rowIndex + 1);
|
69
|
+
|
70
|
+
// 设置表头单元格值并应用样式
|
71
|
+
const cell = worksheet.getCell(currentRowIndex, currentColIndex);
|
72
|
+
cell.value = column.title;
|
73
|
+
cell.alignment = alignmentStyle();
|
74
|
+
cell.border = borderStyle;
|
75
|
+
cell.font = fontStyle;
|
76
|
+
cell.fill = {
|
77
|
+
type: "pattern",
|
78
|
+
pattern: "solid",
|
79
|
+
fgColor: { argb: "87CEEB" },
|
80
|
+
};
|
81
|
+
|
82
|
+
// 合并单元格处理
|
83
|
+
if (colSpan > 1) {
|
84
|
+
worksheet.mergeCells(
|
85
|
+
currentRowIndex,
|
86
|
+
currentColIndex,
|
87
|
+
currentRowIndex,
|
88
|
+
currentColIndex + colSpan - 1
|
89
|
+
);
|
90
|
+
}
|
91
|
+
|
92
|
+
// 处理跨行合并的情况
|
93
|
+
if (rowSpan > 1) {
|
94
|
+
worksheet.mergeCells(
|
95
|
+
currentRowIndex,
|
96
|
+
currentColIndex,
|
97
|
+
currentRowIndex + rowSpan - 1,
|
98
|
+
currentColIndex
|
99
|
+
);
|
100
|
+
}
|
101
|
+
|
102
|
+
// 处理子列
|
103
|
+
if (column.children && column.children.length > 0) {
|
104
|
+
const childMaxRowIndex = this.generateHeaders(
|
105
|
+
worksheet,
|
106
|
+
column.children,
|
107
|
+
currentRowIndex + 1,
|
108
|
+
currentColIndex,
|
109
|
+
maxDepth
|
110
|
+
);
|
111
|
+
maxRowIndex = Math.max(maxRowIndex, childMaxRowIndex);
|
112
|
+
} else {
|
113
|
+
maxRowIndex = Math.max(maxRowIndex, currentRowIndex + rowSpan - 1);
|
114
|
+
}
|
115
|
+
|
116
|
+
colIndex += colSpan;
|
117
|
+
});
|
118
|
+
|
119
|
+
return maxRowIndex;
|
120
|
+
}
|
121
|
+
|
122
|
+
getColSpan(column) {
|
123
|
+
if (!column.children || column.children.length === 0) {
|
124
|
+
return 1;
|
125
|
+
}
|
126
|
+
return column.children.reduce(
|
127
|
+
(sum, child) => sum + this.getColSpan(child),
|
128
|
+
0
|
129
|
+
);
|
130
|
+
}
|
131
|
+
|
132
|
+
getRowSpan(column, remainingDepth) {
|
133
|
+
if (!column.children || column.children.length === 0) {
|
134
|
+
return remainingDepth;
|
135
|
+
}
|
136
|
+
return 1;
|
137
|
+
}
|
138
|
+
|
139
|
+
getMaxDepth(columns) {
|
140
|
+
return columns.reduce((max, column) => {
|
141
|
+
const depth = column.children ? 1 + this.getMaxDepth(column.children) : 1;
|
142
|
+
return Math.max(max, depth);
|
143
|
+
}, 1);
|
144
|
+
}
|
145
|
+
|
146
|
+
extractValues(rowData, column) {
|
147
|
+
if (column.children && column.children.length > 0) {
|
148
|
+
return column.children.flatMap((child) =>
|
149
|
+
this.extractValues(rowData, child)
|
150
|
+
);
|
151
|
+
} else {
|
152
|
+
return [rowData[column.key]];
|
153
|
+
}
|
154
|
+
}
|
155
|
+
fillData(worksheet) {
|
156
|
+
this.data.forEach((rowData) => {
|
157
|
+
const row = worksheet.addRow(
|
158
|
+
this.columns.flatMap((col) => this.extractValues(rowData, col))
|
159
|
+
);
|
160
|
+
row.eachCell((cell) => {
|
161
|
+
cell.alignment = alignmentStyle();
|
162
|
+
});
|
163
|
+
});
|
164
|
+
}
|
165
|
+
|
166
|
+
autoFitColumns(worksheet) {
|
167
|
+
worksheet.columns.forEach((column) => {
|
168
|
+
let maxLength = 0;
|
169
|
+
column.eachCell({ includeEmpty: true }, (cell) => {
|
170
|
+
const columnLength = cell.value ? cell.value.toString().length : 10;
|
171
|
+
if (columnLength > maxLength) {
|
172
|
+
maxLength = columnLength;
|
173
|
+
}
|
174
|
+
});
|
175
|
+
column.width = maxLength < 10 ? maxLength + 5 : maxLength;
|
176
|
+
});
|
177
|
+
}
|
178
|
+
|
179
|
+
generateDescribe(worksheet) {
|
180
|
+
if (this.describe.length > 0) {
|
181
|
+
// 定义开始的位置
|
182
|
+
const startCell = this.data.length + 7;
|
183
|
+
const endCell = startCell + this.describe.length + 9;
|
184
|
+
worksheet.mergeCells(`A${startCell}:E${endCell}`);
|
185
|
+
|
186
|
+
// 在表格底部加上文字解释
|
187
|
+
let combinedText = this.describe.join("\n");
|
188
|
+
const mergedCells = [
|
189
|
+
`A${startCell}`,
|
190
|
+
`B${startCell}`,
|
191
|
+
`C${startCell}`,
|
192
|
+
`D${startCell}`,
|
193
|
+
`E${startCell}`,
|
194
|
+
];
|
195
|
+
|
196
|
+
// 设置每个合并单元格的自动换行属性
|
197
|
+
mergedCells.forEach((cell) => {
|
198
|
+
const currentCell = worksheet.getCell(cell);
|
199
|
+
currentCell.value = combinedText;
|
200
|
+
currentCell.font = fontStyle;
|
201
|
+
currentCell.alignment = {
|
202
|
+
vertical: "top",
|
203
|
+
horizontal: "left",
|
204
|
+
wrapText: true, // 设置自动换行
|
205
|
+
};
|
206
|
+
});
|
207
|
+
worksheet.getCell(`A${startCell}`).border = borderStyle;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
package/index.js
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
import { saveAs } from "file-saver";
|
2
|
+
import { retainTitleAndKey } from './utils/index';
|
3
|
+
import DefaultExport from "./defaultExport.js";
|
4
|
+
|
5
|
+
class ExcelExporter {
|
6
|
+
constructor(columns, data, filename = "export.xlsx", describe) {
|
7
|
+
this.columns = columns;
|
8
|
+
this.data = data;
|
9
|
+
this.filename = filename;
|
10
|
+
this.describe = describe;
|
11
|
+
}
|
12
|
+
|
13
|
+
async exportToExcel() {
|
14
|
+
try {
|
15
|
+
if (this.data.length > 10000) {
|
16
|
+
await this.exportLargeDataSet();
|
17
|
+
} else {
|
18
|
+
await this.exportSmallDataSet();
|
19
|
+
}
|
20
|
+
} catch (error) {
|
21
|
+
console.error("Export failed:", error);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
async exportLargeDataSet() {
|
26
|
+
const formatColumns= retainTitleAndKey(this.columns);
|
27
|
+
const writeBufferWorker = new Worker("/writeBufferWorker.js");
|
28
|
+
writeBufferWorker.postMessage({
|
29
|
+
columns: formatColumns,
|
30
|
+
data: this.data,
|
31
|
+
describe: this.describe,
|
32
|
+
filename: this.filename,
|
33
|
+
});
|
34
|
+
|
35
|
+
writeBufferWorker.onmessage = (e) => {
|
36
|
+
const { buffer, filename } = e.data;
|
37
|
+
const blob = new Blob([buffer], { type: "application/octet-stream" });
|
38
|
+
saveAs(blob, filename);
|
39
|
+
};
|
40
|
+
|
41
|
+
writeBufferWorker.onerror = (error) => {
|
42
|
+
console.error("Worker error:", error);
|
43
|
+
};
|
44
|
+
}
|
45
|
+
|
46
|
+
async exportSmallDataSet() {
|
47
|
+
const defaultExport = new DefaultExport(
|
48
|
+
this.columns,
|
49
|
+
this.data,
|
50
|
+
this.filename,
|
51
|
+
this.describe
|
52
|
+
);
|
53
|
+
defaultExport.export();
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
export default ExcelExporter;
|
package/package.json
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "export-to-exceljs-util",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "使用exceljs导出excel文件",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"author": "zjp",
|
10
|
+
"license": "ISC",
|
11
|
+
"dependencies": {
|
12
|
+
"@babel/cli": "^7.26.4",
|
13
|
+
"@babel/core": "^7.26.0",
|
14
|
+
"@babel/preset-env": "^7.26.0",
|
15
|
+
"exceljs": "^4.4.0",
|
16
|
+
"file-saver": "^2.0.5"
|
17
|
+
}
|
18
|
+
}
|
package/utils/index.js
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
export function retainTitleAndKey(items) {
|
2
|
+
return items.map((item) => {
|
3
|
+
// 如果项目是一个数组,递归调用这个函数
|
4
|
+
if (Array.isArray(item)) {
|
5
|
+
return retainTitleAndKey(item);
|
6
|
+
}
|
7
|
+
// 如果项目是一个对象,处理 title, key 和 children 属性
|
8
|
+
if (typeof item === "object" && item !== null) {
|
9
|
+
// 创建一个新对象,只包含 title 和 key 属性
|
10
|
+
let newItem = {
|
11
|
+
title: item.title,
|
12
|
+
key: item.key,
|
13
|
+
};
|
14
|
+
// 如果存在 children 属性,递归处理它
|
15
|
+
if (item.children && Array.isArray(item.children)) {
|
16
|
+
newItem.children = retainTitleAndKey(item.children);
|
17
|
+
}
|
18
|
+
return newItem;
|
19
|
+
}
|
20
|
+
// 如果项目既不是数组也不是对象,直接返回它
|
21
|
+
return item;
|
22
|
+
});
|
23
|
+
}
|
@@ -0,0 +1,200 @@
|
|
1
|
+
importScripts("https://cdn.bootcdn.net/ajax/libs/exceljs/4.4.0/exceljs.min.js");
|
2
|
+
|
3
|
+
self.onmessage = async function (e) {
|
4
|
+
const { data, columns, describe, filename } = e.data;
|
5
|
+
const workbook = new ExcelJS.Workbook();
|
6
|
+
const worksheet = workbook.addWorksheet("Sheet1");
|
7
|
+
// 设置表头样式
|
8
|
+
generateHeaders(worksheet, columns);
|
9
|
+
|
10
|
+
// 填充数据
|
11
|
+
fillData(worksheet, data, columns);
|
12
|
+
|
13
|
+
// 自动调整列宽
|
14
|
+
// autoFitColumns(worksheet);
|
15
|
+
|
16
|
+
// 处理描述信息
|
17
|
+
generateDescribe(worksheet, describe, data);
|
18
|
+
|
19
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
20
|
+
self.postMessage({ buffer, filename });
|
21
|
+
};
|
22
|
+
const fontStyle = {
|
23
|
+
name: "Arial",
|
24
|
+
size: 10,
|
25
|
+
bold: true, // 设置文字加粗
|
26
|
+
color: { argb: "FF000000" },
|
27
|
+
};
|
28
|
+
const alignmentStyle = (vertical = "middle", horizontal = "center") => {
|
29
|
+
return {
|
30
|
+
vertical,
|
31
|
+
horizontal,
|
32
|
+
};
|
33
|
+
};
|
34
|
+
|
35
|
+
const borderStyle = {
|
36
|
+
top: { style: "thin" },
|
37
|
+
left: { style: "thin" },
|
38
|
+
bottom: { style: "thin" },
|
39
|
+
right: { style: "thin" },
|
40
|
+
};
|
41
|
+
|
42
|
+
function generateHeaders(
|
43
|
+
worksheet,
|
44
|
+
columns,
|
45
|
+
rowIndex = 1,
|
46
|
+
colIndexStart = 1,
|
47
|
+
maxDepth = null
|
48
|
+
) {
|
49
|
+
let maxRowIndex = rowIndex;
|
50
|
+
let colIndex = colIndexStart;
|
51
|
+
|
52
|
+
// 计算整个表头的最大深度(用于单级表头行合并)
|
53
|
+
if (maxDepth === null) {
|
54
|
+
maxDepth = getMaxDepth(columns);
|
55
|
+
}
|
56
|
+
|
57
|
+
columns.forEach((column) => {
|
58
|
+
const currentRowIndex = rowIndex;
|
59
|
+
const currentColIndex = colIndex;
|
60
|
+
|
61
|
+
// 计算列的跨度和行的跨度
|
62
|
+
const colSpan = getColSpan(column);
|
63
|
+
const rowSpan = getRowSpan(column, maxDepth - rowIndex + 1);
|
64
|
+
|
65
|
+
// 设置表头单元格值并应用样式
|
66
|
+
const cell = worksheet.getCell(currentRowIndex, currentColIndex);
|
67
|
+
cell.value = column.title;
|
68
|
+
cell.alignment = alignmentStyle();
|
69
|
+
cell.border = borderStyle;
|
70
|
+
cell.font = fontStyle;
|
71
|
+
cell.fill = {
|
72
|
+
type: "pattern",
|
73
|
+
pattern: "solid",
|
74
|
+
fgColor: { argb: "87CEEB" },
|
75
|
+
};
|
76
|
+
|
77
|
+
// 合并单元格处理
|
78
|
+
if (colSpan > 1) {
|
79
|
+
worksheet.mergeCells(
|
80
|
+
currentRowIndex,
|
81
|
+
currentColIndex,
|
82
|
+
currentRowIndex,
|
83
|
+
currentColIndex + colSpan - 1
|
84
|
+
);
|
85
|
+
}
|
86
|
+
|
87
|
+
// 处理跨行合并的情况
|
88
|
+
if (rowSpan > 1) {
|
89
|
+
worksheet.mergeCells(
|
90
|
+
currentRowIndex,
|
91
|
+
currentColIndex,
|
92
|
+
currentRowIndex + rowSpan - 1,
|
93
|
+
currentColIndex
|
94
|
+
);
|
95
|
+
}
|
96
|
+
|
97
|
+
// 处理子列
|
98
|
+
if (column.children && column.children.length > 0) {
|
99
|
+
const childMaxRowIndex = generateHeaders(
|
100
|
+
worksheet,
|
101
|
+
column.children,
|
102
|
+
currentRowIndex + 1,
|
103
|
+
currentColIndex,
|
104
|
+
maxDepth
|
105
|
+
);
|
106
|
+
maxRowIndex = Math.max(maxRowIndex, childMaxRowIndex);
|
107
|
+
} else {
|
108
|
+
maxRowIndex = Math.max(maxRowIndex, currentRowIndex + rowSpan - 1);
|
109
|
+
}
|
110
|
+
|
111
|
+
colIndex += colSpan;
|
112
|
+
});
|
113
|
+
|
114
|
+
return maxRowIndex;
|
115
|
+
}
|
116
|
+
|
117
|
+
function getColSpan(column) {
|
118
|
+
if (!column.children || column.children.length === 0) {
|
119
|
+
return 1;
|
120
|
+
}
|
121
|
+
return column.children.reduce((sum, child) => sum + getColSpan(child), 0);
|
122
|
+
}
|
123
|
+
|
124
|
+
function getRowSpan(column, remainingDepth) {
|
125
|
+
if (!column.children || column.children.length === 0) {
|
126
|
+
return remainingDepth;
|
127
|
+
}
|
128
|
+
return 1;
|
129
|
+
}
|
130
|
+
|
131
|
+
function getMaxDepth(columns) {
|
132
|
+
return columns.reduce((max, column) => {
|
133
|
+
const depth = column.children ? 1 + getMaxDepth(column.children) : 1;
|
134
|
+
return Math.max(max, depth);
|
135
|
+
}, 1);
|
136
|
+
}
|
137
|
+
|
138
|
+
function fillData(worksheet, data, columns) {
|
139
|
+
data.forEach((rowData) => {
|
140
|
+
const row = worksheet.addRow(
|
141
|
+
columns.flatMap((col) => extractValues(rowData, col))
|
142
|
+
);
|
143
|
+
row.eachCell((cell) => {
|
144
|
+
cell.alignment = alignmentStyle();
|
145
|
+
});
|
146
|
+
});
|
147
|
+
}
|
148
|
+
|
149
|
+
function autoFitColumns(worksheet) {
|
150
|
+
worksheet.columns.forEach((column) => {
|
151
|
+
let maxLength = 0;
|
152
|
+
column.eachCell({ includeEmpty: true }, (cell) => {
|
153
|
+
const columnLength = cell.value ? cell.value.toString().length : 10;
|
154
|
+
if (columnLength > maxLength) {
|
155
|
+
maxLength = columnLength;
|
156
|
+
}
|
157
|
+
});
|
158
|
+
column.width = maxLength < 10 ? maxLength + 5 : maxLength;
|
159
|
+
});
|
160
|
+
}
|
161
|
+
|
162
|
+
function generateDescribe(worksheet, describe, data) {
|
163
|
+
if (describe.length > 0) {
|
164
|
+
// 定义开始的位置
|
165
|
+
const startCell = data.length + 7;
|
166
|
+
const endCell = startCell + describe.length + 9;
|
167
|
+
worksheet.mergeCells(`A${startCell}:E${endCell}`);
|
168
|
+
|
169
|
+
// 在表格底部加上文字解释
|
170
|
+
let combinedText = describe.join("\n");
|
171
|
+
const mergedCells = [
|
172
|
+
`A${startCell}`,
|
173
|
+
`B${startCell}`,
|
174
|
+
`C${startCell}`,
|
175
|
+
`D${startCell}`,
|
176
|
+
`E${startCell}`,
|
177
|
+
];
|
178
|
+
|
179
|
+
// 设置每个合并单元格的自动换行属性
|
180
|
+
mergedCells.forEach((cell) => {
|
181
|
+
const currentCell = worksheet.getCell(cell);
|
182
|
+
currentCell.value = combinedText;
|
183
|
+
currentCell.font = fontStyle;
|
184
|
+
currentCell.alignment = {
|
185
|
+
vertical: "top",
|
186
|
+
horizontal: "left",
|
187
|
+
wrapText: true, // 设置自动换行
|
188
|
+
};
|
189
|
+
});
|
190
|
+
worksheet.getCell(`A${startCell}`).border = borderStyle;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
function extractValues(rowData, column) {
|
195
|
+
if (column.children && column.children.length > 0) {
|
196
|
+
return column.children.flatMap((child) => extractValues(rowData, child));
|
197
|
+
} else {
|
198
|
+
return [rowData[column.key]];
|
199
|
+
}
|
200
|
+
}
|
package/yarn-error.log
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
Arguments:
|
2
|
+
C:\Program Files\nodejs\node.exe C:\Users\zhujp\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js add @babel/cli @babel/core @babel/preset - env
|
3
|
+
|
4
|
+
PATH:
|
5
|
+
C:\Windows\System32\HWAudioDriverLibs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\nodejs\;D:\InstallPath\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\nvm;C:\Program Files\nodejs;C:\Users\zhujp\AppData\Local\Programs\Python\Python312;C:\Program Files\MySQL\MySQL Server 9.1\bin;C:\Users\zhujp\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\zhujp\AppData\Local\Programs\Python\Python312\;C:\Users\zhujp\AppData\Local\Microsoft\WindowsApps;C:\Users\zhujp\AppData\Roaming\npm;C:\Users\zhujp\AppData\Local\Programs\Microsoft VS Code\bin;C:\nvm;C:\Program Files\nodejs;
|
6
|
+
|
7
|
+
Yarn version:
|
8
|
+
1.22.19
|
9
|
+
|
10
|
+
Node version:
|
11
|
+
16.20.2
|
12
|
+
|
13
|
+
Platform:
|
14
|
+
win32 x64
|
15
|
+
|
16
|
+
Trace:
|
17
|
+
Error: https://registry.npmmirror.com/@babel%2fpreset: Not found
|
18
|
+
at Request.params.callback [as _callback] (C:\Users\zhujp\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:66145:18)
|
19
|
+
at Request.self.callback (C:\Users\zhujp\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:140890:22)
|
20
|
+
at Request.emit (node:events:513:28)
|
21
|
+
at Request.<anonymous> (C:\Users\zhujp\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:141862:10)
|
22
|
+
at Request.emit (node:events:513:28)
|
23
|
+
at IncomingMessage.<anonymous> (C:\Users\zhujp\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:141784:12)
|
24
|
+
at Object.onceWrapper (node:events:627:28)
|
25
|
+
at IncomingMessage.emit (node:events:525:35)
|
26
|
+
at endReadableNT (node:internal/streams/readable:1358:12)
|
27
|
+
at processTicksAndRejections (node:internal/process/task_queues:83:21)
|
28
|
+
|
29
|
+
npm manifest:
|
30
|
+
{
|
31
|
+
"name": "excel-export",
|
32
|
+
"version": "1.0.0",
|
33
|
+
"description": "使用exceljs导出excel文件",
|
34
|
+
"main": "index.js",
|
35
|
+
"scripts": {
|
36
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
37
|
+
},
|
38
|
+
"author": "",
|
39
|
+
"license": "ISC",
|
40
|
+
"dependencies": {
|
41
|
+
"exceljs": "^4.4.0",
|
42
|
+
"file-saver": "^2.0.5"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
yarn manifest:
|
47
|
+
No manifest
|
48
|
+
|
49
|
+
Lockfile:
|
50
|
+
No lockfile
|