Compare commits

..

15 Commits

Author SHA1 Message Date
AJ ONeal
18c1c6ae6b WIP: feat(webi): show supported channels 2023-12-12 03:15:22 -07:00
AJ ONeal
3e16f512f9 feat(webi): show latest project release version on error 2023-12-12 03:14:46 -07:00
AJ ONeal
f78d59daa4 ref(webi): show supported OSes, etc with space rather than comma 2023-12-12 03:13:22 -07:00
AJ ONeal
68d3bef7c5 f: replace getReleases with new builds classifier 2023-12-12 03:09:42 -07:00
AJ ONeal
e78972a728 feat: replace getReleases with new builds classifier 2023-12-12 03:09:18 -07:00
AJ ONeal
813115811e ref(classify): parallelize release downloads to fetch *much* faster 2023-12-12 03:08:28 -07:00
AJ ONeal
bf05fdb2b4 feat: add builds classifier, and lint all builds 2023-12-12 03:08:25 -07:00
AJ ONeal
b8fad89b7b feat: add build-classifier submodule 2023-12-12 02:59:24 -07:00
AJ ONeal
02cab21316 fix(ollama-darwin): filter out .app, manually set arch for universal 2023-12-12 02:57:25 -07:00
AJ ONeal
995f849411 fix(goreleaser): handle extraneous build term '1' 2023-12-12 02:57:24 -07:00
AJ ONeal
a7ae44a163 fix(watchexec): remove 'cli-' prefix from literal version 2023-12-12 02:57:24 -07:00
AJ ONeal
331b7b113d ref(shellcheck): remove superfluous target matching 2023-12-12 02:57:24 -07:00
AJ ONeal
a74d7db17d fix(zoxide): remove incorrect arch detection 2023-12-12 02:57:24 -07:00
AJ ONeal
e0aafb389e fix(zig): filter out legacy armv6kz (RPi 1) one-off 2023-12-12 02:57:24 -07:00
AJ ONeal
e20dac059e fix(pwsh): arch = 'musl' should be libc = 'musl' 2023-12-12 02:57:24 -07:00
9 changed files with 87 additions and 41 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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],
];

View File

@@ -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`);

View File

@@ -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('.')) {

View File

@@ -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(
{

View File

@@ -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
View 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: '',
};
};