-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.js
More file actions
22 lines (17 loc) · 784 Bytes
/
build.js
File metadata and controls
22 lines (17 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
fs = require('fs')
shell = require("shelljs");
path = require('path');
const projectInfo = JSON.parse(fs.readFileSync('angular.json', {encoding: "utf8"})).projects.cloudflared
shell.exec("npm run ng build")
let releases = Object.values(JSON.parse(fs.readFileSync(
path.join(projectInfo.sourceRoot, 'release-info.json'),
{encoding: "utf8"},
)))
let latestRelease = releases.sort((a, b) => new Date(b.releaseDate).valueOf() - new Date(a.releaseDate).valueOf())[0];
fs.writeFileSync(
path.join(projectInfo.architect.build.options.outputPath, '_redirects'),
[
"/binaries/cloudflared-freebsd-latest.7z /" + latestRelease.binary7zipPath + " 302",
"/binaries/cloudflared-freebsd-latest.sha1 /" + latestRelease.binarySHA1Path + " 302",
].join('\n')
)