Skip to content

Commit

Permalink
fix generate manifest to rename the file when generating release folder
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomontero committed May 7, 2024
1 parent 9229d8a commit 5bc2d5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
6 changes: 4 additions & 2 deletions scripts/generate-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function parseFilename(filename) {
// Simplified parsing logic, adjust as needed
console.log('parsing', filename);
const platformMap = { macos: 'darwin', linux: 'linux', win: 'win32' };
const archMap = { armv7: 'arm' };

const parts = filename.split('-');
let arch;
Expand All @@ -33,7 +34,7 @@ function parseFilename(filename) {
}
return {
platform: platformMap[parts[2]] || parts[2],
arch: arch // Removing file extension if present
arch: archMap[arch] || arch // Removing file extension if present
};
}

Expand Down Expand Up @@ -161,7 +162,8 @@ async function restructureFiles(version, sourceDir, targetBaseDir) {
}
const targetDir = path.join(targetBaseDir, 'release', version, platform, arch);
await fs.ensureDir(targetDir);
await moveFile(path.join(sourceDir, file), path.join(targetDir, file));
const newFileName = file.includes('exe') ? 'particle.exe.gz' : 'particle.gz';
await moveFile(path.join(sourceDir, file), path.join(targetDir, newFileName));
}
}

Expand Down
15 changes: 3 additions & 12 deletions src/cmd/update-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,10 @@ class UpdateCliCommand {
}

getBuildDetailsFromManifest(manifest) {
const platformMapping = {
darwin: 'darwin',
linux: 'linux',
win32: 'win'
};
const archMapping = {
x64: 'amd64',
arm64: 'arm64'
};
const platform = os.platform();
const arch = os.arch();
const platformKey = platformMapping[platform] || platform;
const archKey = archMapping[arch] || arch;
let arch = os.arch();
const platformKey = platform;
const archKey = arch;
const platformManifest = manifest.builds && manifest.builds[platformKey];
const archManifest = platformManifest && platformManifest[archKey];
if (!archManifest) {
Expand Down

0 comments on commit 5bc2d5a

Please sign in to comment.