mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-05-31 13:02:46 +00:00
Compare commits
15 Commits
ref-instal
...
feat-relea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18c1c6ae6b | ||
|
|
3e16f512f9 | ||
|
|
f78d59daa4 | ||
|
|
68d3bef7c5 | ||
|
|
e78972a728 | ||
|
|
813115811e | ||
|
|
bf05fdb2b4 | ||
|
|
b8fad89b7b | ||
|
|
02cab21316 | ||
|
|
995f849411 | ||
|
|
a7ae44a163 | ||
|
|
331b7b113d | ||
|
|
a74d7db17d | ||
|
|
e0aafb389e | ||
|
|
e20dac059e |
3
.github/workflows/node.js.yml
vendored
3
.github/workflows/node.js.yml
vendored
@@ -23,9 +23,6 @@ jobs:
|
||||
sh ./_scripts/install-ci-deps
|
||||
echo "${HOME}/.local/bin" >> $GITHUB_PATH
|
||||
echo "${HOME}/.local/opt/pwsh" >> $GITHUB_PATH
|
||||
- run: |
|
||||
git submodule init
|
||||
git submodule update
|
||||
- run: shfmt --version
|
||||
- run: shellcheck -V
|
||||
- run: node --version
|
||||
|
||||
Submodule _webi/build-classifier updated: 49771ecc61...36b91ac129
@@ -490,7 +490,7 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
|
||||
let pattern = Triplet.toPattern(projInfo, build);
|
||||
if (!pattern) {
|
||||
let err = new Error(`no pattern generated for ${projInfo.name}`);
|
||||
let err = new Error(`no pattern generated for ${name}`);
|
||||
err.code = 'E_BUILD_NO_PATTERN';
|
||||
target = { error: err };
|
||||
bc._targetsByBuildIdCache[buildId] = target;
|
||||
|
||||
@@ -103,6 +103,7 @@ Installers.renderBash = async function (
|
||||
['PKG_ARCHES', (rel.arches || []).join(' ')],
|
||||
['PKG_LIBCS', (rel.libcs || []).join(' ')],
|
||||
['PKG_FORMATS', (rel.formats || []).join(' ')],
|
||||
['PKG_CHANNELS', (rel.channels || []).join(' ')],
|
||||
['PKG_LATEST', latest],
|
||||
];
|
||||
|
||||
|
||||
@@ -144,6 +144,13 @@ async function main() {
|
||||
let triples = [];
|
||||
let valids = Object.keys(dirs.valid);
|
||||
|
||||
let index = valids.indexOf('webi');
|
||||
if (index >= 0) {
|
||||
// TODO fix the webi faux package
|
||||
// (not sure why I even created it)
|
||||
void valids.splice(index, 1);
|
||||
}
|
||||
|
||||
if (projName) {
|
||||
if (!valids.includes(projName)) {
|
||||
throw new Error(`'${projName}' is not a valid installable project`);
|
||||
|
||||
@@ -17,14 +17,16 @@ InstallerServer.serveInstaller = async function (
|
||||
tag,
|
||||
ext,
|
||||
formats,
|
||||
libc,
|
||||
) {
|
||||
let unameAgent = ua;
|
||||
let projectName = pkg;
|
||||
let [rel, tmplParams] = await InstallerServer.helper({
|
||||
unameAgent,
|
||||
projectName,
|
||||
tag,
|
||||
unameAgent,
|
||||
formats,
|
||||
libc,
|
||||
});
|
||||
Object.assign(tmplParams, {
|
||||
baseurl,
|
||||
@@ -44,6 +46,7 @@ InstallerServer.helper = async function ({
|
||||
projectName,
|
||||
tag,
|
||||
formats,
|
||||
libc,
|
||||
}) {
|
||||
console.log(`dbg: Installer User-Agent: ${unameAgent}`);
|
||||
|
||||
@@ -71,15 +74,28 @@ InstallerServer.helper = async function ({
|
||||
|
||||
let validTypes = ['alias', 'selfhosted', 'valid'];
|
||||
if (!validTypes.includes(proj.type)) {
|
||||
let msg = `'${projectName}' doesn't have an installer: '${proj.type}': '${proj.detail}'`;
|
||||
let err = new Error(msg);
|
||||
err.code = 'ENOENT';
|
||||
throw err;
|
||||
throw new Error(
|
||||
`'${projectName}' doesn't have an installer: '${proj.type}': '${proj.detail}'`,
|
||||
);
|
||||
}
|
||||
if (proj.type === 'alias') {
|
||||
projectName = proj.detail;
|
||||
}
|
||||
|
||||
let projInfo = await Builds.getPackage({
|
||||
name: projectName,
|
||||
date: new Date(),
|
||||
});
|
||||
//console.log('projInfo', projInfo);
|
||||
|
||||
let buildTargetInfo = {
|
||||
triplets: projInfo.triplets,
|
||||
oses: projInfo.oses,
|
||||
arches: projInfo.arches,
|
||||
libcs: projInfo.libcs,
|
||||
formats: projInfo.formats,
|
||||
};
|
||||
|
||||
let tmplParams = {
|
||||
pkg: projectName,
|
||||
tag: tag,
|
||||
@@ -89,6 +105,8 @@ InstallerServer.helper = async function ({
|
||||
formats: hostFormats,
|
||||
limit: 1,
|
||||
};
|
||||
let latest = projInfo.versions[0];
|
||||
Object.assign(tmplParams, { latest });
|
||||
Object.assign(tmplParams, releaseTarget);
|
||||
console.log('tmplParams', tmplParams);
|
||||
|
||||
@@ -109,30 +127,7 @@ InstallerServer.helper = async function ({
|
||||
"Check query parameters. Should be something like '/api/releases/{package}@{version}.tab?os={macos|linux|windows|-}&arch={amd64|x86|aarch64|arm64|armv7l|-}&libc={musl|gnu|msvc|libc|static}&limit=10'",
|
||||
};
|
||||
|
||||
if (proj.type === 'selfhosted') {
|
||||
return [errPackage, tmplParams];
|
||||
}
|
||||
|
||||
let projInfo = await Builds.getPackage({
|
||||
name: projectName,
|
||||
date: new Date(),
|
||||
});
|
||||
let latest = projInfo.versions[0];
|
||||
Object.assign(tmplParams, { latest });
|
||||
//console.log('projInfo', projInfo);
|
||||
|
||||
let buildTargetInfo = {
|
||||
triplets: projInfo.triplets,
|
||||
oses: projInfo.oses,
|
||||
arches: projInfo.arches,
|
||||
libcs: projInfo.libcs,
|
||||
formats: projInfo.formats,
|
||||
};
|
||||
|
||||
let hasOs = projInfo.oses.includes(hostTarget.os);
|
||||
if (!hasOs) {
|
||||
hasOs = projInfo.oses.includes('ANYOS');
|
||||
}
|
||||
if (!hasOs) {
|
||||
let pkg1 = Object.assign(buildTargetInfo, errPackage);
|
||||
return [pkg1, tmplParams];
|
||||
@@ -152,6 +147,11 @@ InstallerServer.helper = async function ({
|
||||
return [pkg1, tmplParams];
|
||||
}
|
||||
|
||||
if (!targetRelease.packages) {
|
||||
let pkg1 = Object.assign(buildTargetInfo, errPackage);
|
||||
return [pkg1, tmplParams];
|
||||
}
|
||||
|
||||
let buildPkg = Builds.selectPackage(targetRelease.packages, hostFormats);
|
||||
let ext = buildPkg.ext || '.exe';
|
||||
if (ext.startsWith('.')) {
|
||||
|
||||
@@ -82,10 +82,11 @@ Releases.get(path.join(process.cwd(), pkgdir)).then(async function (all) {
|
||||
var formats = ['exe', 'xz', 'tar', 'zip', 'git'];
|
||||
|
||||
let [rel, opts] = await ServeInstaller.helper({
|
||||
projectName: pkgname,
|
||||
ua: `${nodeOs}/${nodeOsRelease} ${nodeArch}/unknown ${nodeLibc}`,
|
||||
pkg: pkgname,
|
||||
tag: pkgtag || '',
|
||||
unameAgent: `${nodeOs}/${nodeOsRelease} ${nodeArch}/unknown ${nodeLibc}`,
|
||||
formats: formats,
|
||||
libc: nodeLibc,
|
||||
});
|
||||
Object.assign(
|
||||
{
|
||||
|
||||
@@ -5,22 +5,19 @@
|
||||
"description": "webinstall script repository",
|
||||
"main": "_webi/",
|
||||
"scripts": {
|
||||
"bump": "npm version -m \"chore(release): bump to v%s\"",
|
||||
"fmt": "npm run prettier && npm run shfmt && npm run pwsh-fmt",
|
||||
"lint": "npm run shellcheck && npm run jshint && npm run pwsh-lint && npm run tsc",
|
||||
"lint": "npm run shellcheck && npm run jshint && npm run pwsh-lint",
|
||||
"prepare": "npm run tooling-init && npm run git-hooks-init",
|
||||
"test": "node _webi/test.js ./node/",
|
||||
"----": "------------------------------------",
|
||||
"git-hooks-init": "node ./_scripts/git-hooks-init.js",
|
||||
"jshint": "npx -p jshint@2.x -- jshint -c ./.jshintrc --exclude 'node_modules/**/*' *.js */*.js",
|
||||
"jshint": "npx -p jshint@2.x -- jshint -c ./.jshintrc --exclude 'node_modules/**/*' */*.js */*/*.js",
|
||||
"prettier": "npx -p prettier@3.x -- prettier -w '**/*.{js,md,html}'",
|
||||
"pwsh-fmt": "pwsh ./_scripts/pwsh-fmt.ps1",
|
||||
"pwsh-lint": "pwsh ./_scripts/pwsh-lint.ps1",
|
||||
"shellcheck": "shellcheck -s sh -S style --exclude=SC2154,SC2034 */*.sh",
|
||||
"shfmt": "shfmt -w -i 4 -sr -ci -s ./",
|
||||
"tsc": "npx -p typescript@5.x -- tsc -p ./jsconfig.json",
|
||||
"tooling-init": "node ./_scripts/tooling-init.js",
|
||||
"prepublish": "npx -p jswt@1.x -- reexport"
|
||||
"tooling-init": "node ./_scripts/tooling-init.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
43
webi/releases.js
Normal file
43
webi/releases.js
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = async function () {
|
||||
return {
|
||||
releases: [
|
||||
{
|
||||
name: 'webi.tar',
|
||||
version: '0.0.0',
|
||||
lts: false,
|
||||
channel: 'stable',
|
||||
date: '',
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
ext: 'tar',
|
||||
download: '',
|
||||
},
|
||||
{
|
||||
name: 'webi.tar',
|
||||
version: '0.0.0',
|
||||
lts: false,
|
||||
channel: 'stable',
|
||||
date: '',
|
||||
os: 'macos',
|
||||
arch: 'amd64',
|
||||
ext: 'tar',
|
||||
download: '',
|
||||
},
|
||||
{
|
||||
name: 'webi.tar',
|
||||
version: '0.0.0',
|
||||
lts: false,
|
||||
channel: 'stable',
|
||||
date: '',
|
||||
os: 'windows',
|
||||
arch: 'amd64',
|
||||
ext: 'tar',
|
||||
download: '',
|
||||
},
|
||||
],
|
||||
formats: [],
|
||||
downloads: '',
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user