Skip to content

Commit 926e07e

Browse files
committed
Merge branch 'main' into deploy
2 parents 5d5976c + 0305ccc commit 926e07e

File tree

10 files changed

+80
-56
lines changed

10 files changed

+80
-56
lines changed

esp32/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"postinstall": "node ./postinstall.js"
89
},
910
"author": "",
1011
"license": "ISC"

esp32/postinstall.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ async function extractArchives() {
3030
}
3131

3232
// 确保目标目录存在
33-
if (!fs.existsSync(destDir)) {
34-
console.error(`目标目录不存在: ${destDir}`);
33+
if (!destDir) {
34+
console.error('未设置目标目录');
3535
return;
3636
}
3737

@@ -41,6 +41,10 @@ async function extractArchives() {
4141
return;
4242
}
4343

44+
if (!fs.existsSync(destDir)) {
45+
console.log(`目标目录不存在,创建: ${destDir}`);
46+
fs.mkdirSync(destDir, { recursive: true });
47+
}
4448

4549
// 读取目录并过滤出 .7z 文件
4650
const files = await readdir(srcDir);
@@ -62,15 +66,15 @@ async function extractArchives() {
6266
await unpack(srcPath, destDir);
6367
console.log(`已解压 ${file}${destDir}`);
6468

65-
// 重命名
66-
const newName = path.basename(file, '.7z');
67-
const destPath = path.join(destDir, newName);
69+
// // 重命名
70+
// const newName = path.basename(file, '.7z');
71+
// const destPath = path.join(destDir, newName);
6872

69-
// 将newName中的@替换为_
70-
const newName2 = newName.replace('@', '_');
71-
const newPath = path.join(destDir, newName2);
72-
fs.renameSync(destPath, newPath);
73-
console.log(`已重命名 ${destPath}${newPath}`);
73+
// // 将newName中的@替换为_
74+
// const newName2 = newName.replace('@', '_');
75+
// const newPath = path.join(destDir, newName2);
76+
// fs.renameSync(destPath, newPath);
77+
// console.log(`已重命名 ${destPath} 为 ${newPath}`);
7478

7579
} catch (error) {
7680
console.error(`解压 ${file} 失败:`, error);

idf_esp32/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"postinstall": "node ./postinstall.js"
89

910
},
1011
"author": "",

idf_esp32/postinstall.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ async function extractArchives() {
3030
}
3131

3232
// 确保目标目录存在
33-
if (!fs.existsSync(destDir)) {
34-
console.error(`目标目录不存在: ${destDir}`);
33+
if (!destDir) {
34+
console.error('未设置目标目录');
3535
return;
3636
}
3737

@@ -41,6 +41,10 @@ async function extractArchives() {
4141
return;
4242
}
4343

44+
if (!fs.existsSync(destDir)) {
45+
console.log(`目标目录不存在,创建: ${destDir}`);
46+
fs.mkdirSync(destDir, { recursive: true });
47+
}
4448

4549
// 读取目录并过滤出 .7z 文件
4650
const files = await readdir(srcDir);
@@ -62,15 +66,15 @@ async function extractArchives() {
6266
await unpack(srcPath, destDir);
6367
console.log(`已解压 ${file}${destDir}`);
6468

65-
// 重命名
66-
const newName = path.basename(file, '.7z');
67-
const destPath = path.join(destDir, newName);
69+
// // 重命名
70+
// const newName = path.basename(file, '.7z');
71+
// const destPath = path.join(destDir, newName);
6872

69-
// 将newName中的@替换为_
70-
const newName2 = newName.replace('@', '_');
71-
const newPath = path.join(destDir, newName2);
72-
fs.renameSync(destPath, newPath);
73-
console.log(`已重命名 ${destPath}${newPath}`);
73+
// // 将newName中的@替换为_
74+
// const newName2 = newName.replace('@', '_');
75+
// const newPath = path.join(destDir, newName2);
76+
// fs.renameSync(destPath, newPath);
77+
// console.log(`已重命名 ${destPath} 为 ${newPath}`);
7478

7579
} catch (error) {
7680
console.error(`解压 ${file} 失败:`, error);

idf_esp32c3/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"postinstall": "node ./postinstall.js"
99
},
1010
"author": "",
1111
"license": "ISC"

idf_esp32c3/postinstall.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ async function extractArchives() {
3030
}
3131

3232
// 确保目标目录存在
33-
if (!fs.existsSync(destDir)) {
34-
console.error(`目标目录不存在: ${destDir}`);
33+
if (!destDir) {
34+
console.error('未设置目标目录');
3535
return;
3636
}
3737

@@ -41,6 +41,10 @@ async function extractArchives() {
4141
return;
4242
}
4343

44+
if (!fs.existsSync(destDir)) {
45+
console.log(`目标目录不存在,创建: ${destDir}`);
46+
fs.mkdirSync(destDir, { recursive: true });
47+
}
4448

4549
// 读取目录并过滤出 .7z 文件
4650
const files = await readdir(srcDir);
@@ -62,15 +66,15 @@ async function extractArchives() {
6266
await unpack(srcPath, destDir);
6367
console.log(`已解压 ${file}${destDir}`);
6468

65-
// 重命名
66-
const newName = path.basename(file, '.7z');
67-
const destPath = path.join(destDir, newName);
69+
// // 重命名
70+
// const newName = path.basename(file, '.7z');
71+
// const destPath = path.join(destDir, newName);
6872

69-
// 将newName中的@替换为_
70-
const newName2 = newName.replace('@', '_');
71-
const newPath = path.join(destDir, newName2);
72-
fs.renameSync(destPath, newPath);
73-
console.log(`已重命名 ${destPath}${newPath}`);
73+
// // 将newName中的@替换为_
74+
// const newName2 = newName.replace('@', '_');
75+
// const newPath = path.join(destDir, newName2);
76+
// fs.renameSync(destPath, newPath);
77+
// console.log(`已重命名 ${destPath} 为 ${newPath}`);
7478

7579
} catch (error) {
7680
console.error(`解压 ${file} 失败:`, error);

idf_esp32s3/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"postinstall": "node ./postinstall.js"
89
},
910
"author": "",
1011
"license": "ISC"

idf_esp32s3/postinstall.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ async function extractArchives() {
3030
}
3131

3232
// 确保目标目录存在
33-
if (!fs.existsSync(destDir)) {
34-
console.error(`目标目录不存在: ${destDir}`);
33+
if (!destDir) {
34+
console.error('未设置目标目录');
3535
return;
3636
}
3737

@@ -41,6 +41,10 @@ async function extractArchives() {
4141
return;
4242
}
4343

44+
if (!fs.existsSync(destDir)) {
45+
console.log(`目标目录不存在,创建: ${destDir}`);
46+
fs.mkdirSync(destDir, { recursive: true });
47+
}
4448

4549
// 读取目录并过滤出 .7z 文件
4650
const files = await readdir(srcDir);
@@ -62,15 +66,15 @@ async function extractArchives() {
6266
await unpack(srcPath, destDir);
6367
console.log(`已解压 ${file}${destDir}`);
6468

65-
// 重命名
66-
const newName = path.basename(file, '.7z');
67-
const destPath = path.join(destDir, newName);
69+
// // 重命名
70+
// const newName = path.basename(file, '.7z');
71+
// const destPath = path.join(destDir, newName);
6872

69-
// 将newName中的@替换为_
70-
const newName2 = newName.replace('@', '_');
71-
const newPath = path.join(destDir, newName2);
72-
fs.renameSync(destPath, newPath);
73-
console.log(`已重命名 ${destPath}${newPath}`);
73+
// // 将newName中的@替换为_
74+
// const newName2 = newName.replace('@', '_');
75+
// const newPath = path.join(destDir, newName2);
76+
// fs.renameSync(destPath, newPath);
77+
// console.log(`已重命名 ${destPath} 为 ${newPath}`);
7478

7579
} catch (error) {
7680
console.error(`解压 ${file} 失败:`, error);

renesas_uno/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"postinstall": "node ./postinstall.js"
89
},
910
"author": "",
1011
"license": "ISC"

renesas_uno/postinstall.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ async function extractArchives() {
3030
}
3131

3232
// 确保目标目录存在
33-
if (!fs.existsSync(destDir)) {
34-
console.error(`目标目录不存在: ${destDir}`);
33+
if (!destDir) {
34+
console.error('未设置目标目录');
3535
return;
3636
}
3737

@@ -41,6 +41,10 @@ async function extractArchives() {
4141
return;
4242
}
4343

44+
if (!fs.existsSync(destDir)) {
45+
console.log(`目标目录不存在,创建: ${destDir}`);
46+
fs.mkdirSync(destDir, { recursive: true });
47+
}
4448

4549
// 读取目录并过滤出 .7z 文件
4650
const files = await readdir(srcDir);
@@ -62,15 +66,15 @@ async function extractArchives() {
6266
await unpack(srcPath, destDir);
6367
console.log(`已解压 ${file}${destDir}`);
6468

65-
// 重命名
66-
const newName = path.basename(file, '.7z');
67-
const destPath = path.join(destDir, newName);
69+
// // 重命名
70+
// const newName = path.basename(file, '.7z');
71+
// const destPath = path.join(destDir, newName);
6872

69-
// 将newName中的@替换为_
70-
const newName2 = newName.replace('@', '_');
71-
const newPath = path.join(destDir, newName2);
72-
fs.renameSync(destPath, newPath);
73-
console.log(`已重命名 ${destPath}${newPath}`);
73+
// // 将newName中的@替换为_
74+
// const newName2 = newName.replace('@', '_');
75+
// const newPath = path.join(destDir, newName2);
76+
// fs.renameSync(destPath, newPath);
77+
// console.log(`已重命名 ${destPath} 为 ${newPath}`);
7478

7579
} catch (error) {
7680
console.error(`解压 ${file} 失败:`, error);

0 commit comments

Comments
 (0)