WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 9f48e10

Browse files
committed
dev: Development changes
1 parent 519332a commit 9f48e10

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

.github/actions/node-build/dist/index.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20050,26 +20050,32 @@ async function run() {
2005020050
const rootDir = process.env.GITHUB_WORKSPACE;
2005120051
const artifactsDir = import_node_path.default.join(rootDir, "__artifacts__");
2005220052
import_node_fs.default.mkdirSync(artifactsDir, { recursive: true });
20053-
import_node_fs.default.cpSync(
20054-
import_node_path.default.join(rootDir, "COMMIT_CHANGELOG.md"),
20055-
import_node_path.default.join(artifactsDir, "COMMIT_CHANGELOG.md")
20056-
);
20053+
const infoFile = [];
2005720054
for (const pkg of packages) {
2005820055
core.info("Preparing", import_ansi_colors.default.magenta(`${pkg.name}`));
2005920056
const packageDir = import_node_path.default.join(rootDir, pkg.directory);
2006020057
pkg.buildDir = "src";
2006120058
const buildDir = import_node_path.default.join(packageDir, pkg.buildDir || "./");
20062-
if (import_node_fs.default.existsSync(buildDir)) {
20059+
if (!import_node_fs.default.existsSync(buildDir)) {
2006320060
core.warning("build directory do not exists. Skipping");
2006420061
continue;
2006520062
}
20066-
const pkgFilename = sanitizeFilename(pkg.name);
20067-
import_node_fs.default.writeFileSync(
20068-
import_node_path.default.join(artifactsDir, pkgFilename + "json"),
20069-
JSON.stringify(pkg, null, 2)
20070-
);
20071-
import_node_fs.default.cpSync(buildDir, artifactsDir, { recursive: true });
20063+
const pkgDir = sanitizeFilename(pkg.name);
20064+
infoFile.push({
20065+
...pkg,
20066+
directory: pkgDir,
20067+
buildDir: void 0
20068+
});
20069+
import_node_fs.default.cpSync(buildDir, import_node_path.default.join(artifactsDir, pkgDir), { recursive: true });
2007220070
}
20071+
import_node_fs.default.writeFileSync(
20072+
import_node_path.default.join(artifactsDir, "packages.json"),
20073+
JSON.stringify(infoFile, null, 2)
20074+
);
20075+
import_node_fs.default.cpSync(
20076+
import_node_path.default.join(rootDir, "COMMIT_CHANGELOG.md"),
20077+
import_node_path.default.join(artifactsDir, "COMMIT_CHANGELOG.md")
20078+
);
2007320079
core.endGroup();
2007420080
}
2007520081
function sanitizeFilename(filename, replacement = "_") {

.github/actions/node-build/src/index.mjs

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ async function run() {
1313
const rootDir = process.env.GITHUB_WORKSPACE;
1414
const artifactsDir = path.join(rootDir, "__artifacts__");
1515
fs.mkdirSync(artifactsDir, { recursive: true });
16-
fs.cpSync(
17-
path.join(rootDir, "COMMIT_CHANGELOG.md"),
18-
path.join(artifactsDir, "COMMIT_CHANGELOG.md"),
19-
);
2016

17+
const infoFile = [];
2118
for (const pkg of packages) {
2219
core.info("Preparing", colors.magenta(`${pkg.name}`));
2320
const packageDir = path.join(rootDir, pkg.directory);
@@ -27,28 +24,26 @@ async function run() {
2724
core.warning("build directory do not exists. Skipping");
2825
continue;
2926
}
30-
const pkgFilename = sanitizeFilename(pkg.name);
31-
32-
fs.writeFileSync(
33-
path.join(artifactsDir, pkgFilename + "json"),
34-
JSON.stringify(pkg, null, 2),
35-
);
36-
37-
fs.cpSync(buildDir, artifactsDir, { recursive: true });
38-
// core.debug("Zip file crated: " + colors.magenta(pkgFilename + ".zip"));
39-
// if (pkg.isNpmPackage) {
40-
// if (pkg.version === pkg.npmPublishedVersion) {
41-
// core.info("Version is the same as published. Skipping");
42-
// } else {
43-
// core.debug("Copying files to __npm_packages__");
44-
// fs.cpSync(buildDir, npmPackagesRoot, { recursive: true });
45-
// }
46-
// }
47-
// if (pkg.isDockerApp) {
48-
// core.debug("Copying files to __docker_packages__");
49-
// fs.cpSync(buildDir, dockerPackagesRoot, { recursive: true });
50-
// }
27+
const pkgDir = sanitizeFilename(pkg.name);
28+
infoFile.push({
29+
...pkg,
30+
directory: pkgDir,
31+
buildDir: undefined,
32+
});
33+
34+
/** Copy build files to artifacts dir */
35+
fs.cpSync(buildDir, path.join(artifactsDir, pkgDir), { recursive: true });
5136
}
37+
/** Write package info to json file same basename with zip file */
38+
fs.writeFileSync(
39+
path.join(artifactsDir, "packages.json"),
40+
JSON.stringify(infoFile, null, 2),
41+
);
42+
/** Copy COMMIT_CHANGELOG.md to artifacts dir */
43+
fs.cpSync(
44+
path.join(rootDir, "COMMIT_CHANGELOG.md"),
45+
path.join(artifactsDir, "COMMIT_CHANGELOG.md"),
46+
);
5247
core.endGroup();
5348
}
5449

0 commit comments

Comments
 (0)