mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-05-31 04:52:48 +00:00
Compare commits
91 Commits
feat-windo
...
chore-cach
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06c98fc67d | ||
|
|
3ce8d463de | ||
|
|
81ffcf3182 | ||
|
|
3d1a75102f | ||
|
|
e6b3aec8c0 | ||
|
|
ed8058deb8 | ||
|
|
480169beac | ||
|
|
625168156f | ||
|
|
75e39c54a2 | ||
|
|
cac2e62da8 | ||
|
|
b6ab62c13f | ||
|
|
d666a860d1 | ||
|
|
7ff40e175f | ||
|
|
45e7dc314b | ||
|
|
976602236b | ||
|
|
83a214a032 | ||
|
|
cc66f930b0 | ||
|
|
afe35f9198 | ||
|
|
910fa48278 | ||
|
|
5544ff9f1b | ||
|
|
d3f3ad1688 | ||
|
|
4eff5b6cbe | ||
|
|
7b8f882d80 | ||
|
|
117ee6117d | ||
|
|
ce18bd5e61 | ||
|
|
6aeb60008b | ||
|
|
83a6d02d50 | ||
|
|
40316a866c | ||
|
|
e2ad197067 | ||
|
|
3995b7e568 | ||
|
|
de71f667a0 | ||
|
|
6320c519dc | ||
|
|
f1d1027701 | ||
|
|
fe59a2f35c | ||
|
|
a5ed5dbe91 | ||
|
|
217d61ed34 | ||
|
|
14cebeeb61 | ||
|
|
ba94ad883b | ||
|
|
801df24541 | ||
|
|
d6fc5cec97 | ||
|
|
1f3e7b5bf0 | ||
|
|
c94b4cf5c7 | ||
|
|
d7a4aaf6b7 | ||
|
|
93be13f388 | ||
|
|
257adec36d | ||
|
|
aa3f468989 | ||
|
|
553380e64c | ||
|
|
231b6d12e4 | ||
|
|
f4ec7ca640 | ||
|
|
5d28f7333a | ||
|
|
2010c62226 | ||
|
|
93e6c64349 | ||
|
|
ea0762c3ea | ||
|
|
f2c4694647 | ||
|
|
d8fffe0dc3 | ||
|
|
6924baca2b | ||
|
|
3c9609457b | ||
|
|
731beff35c | ||
|
|
b375bd8d7e | ||
|
|
502e3d6aa0 | ||
|
|
a2034c99e9 | ||
|
|
8f436dcedd | ||
|
|
500b69e70c | ||
|
|
c503f105fb | ||
|
|
b7a113a001 | ||
|
|
3385ceaa02 | ||
|
|
005ca9f7da | ||
|
|
efe3df6453 | ||
|
|
c4a6d74776 | ||
|
|
4628cc0333 | ||
|
|
deb8f37f8f | ||
|
|
7c62699a43 | ||
|
|
62c9fcc1ba | ||
|
|
90eb1587ba | ||
|
|
e6dcbfb83a | ||
|
|
35a1d08d3a | ||
|
|
fbd5211cd8 | ||
|
|
54fc06904d | ||
|
|
fc3fef8a89 | ||
|
|
566ea0fc9a | ||
|
|
b2c62dc6b6 | ||
|
|
f19fcc361a | ||
|
|
8f39617bcd | ||
|
|
5bb2832ad9 | ||
|
|
81605ddf61 | ||
|
|
13ac3e32fc | ||
|
|
e3e61ca256 | ||
|
|
3364dcb075 | ||
|
|
58be5ce649 | ||
|
|
87b308550d | ||
|
|
15098ba1d2 |
21
.gitignore
vendored
21
.gitignore
vendored
@@ -1,7 +1,24 @@
|
||||
.env
|
||||
node_modules
|
||||
# generated artifacts
|
||||
install-*.sh
|
||||
install-*.bat
|
||||
install-*.ps1
|
||||
|
||||
# local config
|
||||
.env.*
|
||||
*.env
|
||||
.env
|
||||
!example.env
|
||||
|
||||
# caches
|
||||
_cache/
|
||||
node_modules/
|
||||
|
||||
# temporary & backup files
|
||||
.*.sw*
|
||||
*.bak
|
||||
*.bak.*
|
||||
|
||||
# other
|
||||
.DS_Store
|
||||
desktop.ini
|
||||
.directory
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"globals": {
|
||||
"AbortController": false
|
||||
},
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"esversion": 11,
|
||||
|
||||
@@ -145,8 +145,8 @@ It looks like this:
|
||||
`releases.js`:
|
||||
|
||||
```js
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
// if you need to do something special, you can do it here
|
||||
// ...
|
||||
return all;
|
||||
|
||||
@@ -1,64 +1,62 @@
|
||||
'use strict';
|
||||
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
/**
|
||||
* Gets a releases from 'brew'.
|
||||
* Gets releases from 'brew'.
|
||||
*
|
||||
* @param request
|
||||
* @param {null} _
|
||||
* @param {string} formula
|
||||
* @returns {PromiseLike<any> | Promise<any>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
function getAllReleases(request, formula) {
|
||||
async function getDistributables(_, formula) {
|
||||
if (!formula) {
|
||||
return Promise.reject('missing formula for brew');
|
||||
}
|
||||
return request({
|
||||
url: 'https://formulae.brew.sh/api/formula/' + formula + '.json',
|
||||
fail: true, // https://git.coolaj86.com/coolaj86/request.js/issues/2
|
||||
json: true,
|
||||
})
|
||||
.then(failOnBadStatus)
|
||||
.then(function (resp) {
|
||||
var ver = resp.body.versions.stable;
|
||||
var dl = (
|
||||
resp.body.bottle.stable.files.high_sierra ||
|
||||
resp.body.bottle.stable.files.catalina
|
||||
).url.replace(new RegExp(ver.replace(/\./g, '\\.'), 'g'), '{{ v }}');
|
||||
return [
|
||||
{
|
||||
version: ver,
|
||||
download: dl.replace(/{{ v }}/g, ver),
|
||||
},
|
||||
].concat(
|
||||
resp.body.versioned_formulae.map(function (f) {
|
||||
var ver = f.replace(/.*@/, '');
|
||||
return {
|
||||
version: ver,
|
||||
download: dl,
|
||||
};
|
||||
}),
|
||||
);
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Error fetching MariaDB versions (brew)');
|
||||
console.error(err);
|
||||
return [];
|
||||
|
||||
let resp;
|
||||
try {
|
||||
let url = `https://formulae.brew.sh/api/formula/${formula}.json`;
|
||||
resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
}
|
||||
|
||||
function failOnBadStatus(resp) {
|
||||
if (resp.statusCode >= 400) {
|
||||
var err = new Error('Non-successful status code: ' + resp.statusCode);
|
||||
err.code = 'ESTATUS';
|
||||
err.response = resp;
|
||||
throw err;
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch '${formula}' release data from 'brew': ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return resp;
|
||||
let body = JSON.parse(resp.body);
|
||||
|
||||
var ver = body.versions.stable;
|
||||
var dl = (
|
||||
body.bottle.stable.files.high_sierra || body.bottle.stable.files.catalina
|
||||
).url.replace(new RegExp(ver.replace(/\./g, '\\.'), 'g'), '{{ v }}');
|
||||
return [
|
||||
{
|
||||
version: ver,
|
||||
download: dl.replace(/{{ v }}/g, ver),
|
||||
},
|
||||
].concat(
|
||||
body.versioned_formulae.map(
|
||||
/** @param {String} f */
|
||||
function (f) {
|
||||
var ver = f.replace(/.*@/, '');
|
||||
return {
|
||||
version: ver,
|
||||
download: dl,
|
||||
};
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases(require('@root/request'), 'mariadb').then(function (all) {
|
||||
getDistributables(null, 'mariadb').then(function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
56
_common/fetcher.js
Normal file
56
_common/fetcher.js
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
let Fetcher = module.exports;
|
||||
|
||||
/**
|
||||
* @typedef ResponseSummary
|
||||
* @prop {Boolean} ok
|
||||
* @prop {Headers} headers
|
||||
* @prop {Number} status
|
||||
* @prop {String} body
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {String} url
|
||||
* @param {RequestInit} opts
|
||||
* @returns {Promise<ResponseSummary>}
|
||||
*/
|
||||
Fetcher.fetch = async function (url, opts) {
|
||||
let resp = await fetch(url, opts);
|
||||
let summary = Fetcher.throwIfNotOk(resp);
|
||||
|
||||
return summary;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Response} resp
|
||||
* @returns {Promise<ResponseSummary>}
|
||||
*/
|
||||
Fetcher.throwIfNotOk = async function (resp) {
|
||||
let text = await resp.text();
|
||||
|
||||
if (!resp.ok) {
|
||||
let headers = Array.from(resp.headers);
|
||||
console.error('[Fetcher] error: Response Headers:', headers);
|
||||
console.error('[Fetcher] error: Response Text:', text);
|
||||
let err = new Error(`fetch was not ok`);
|
||||
Object.assign({
|
||||
status: 503,
|
||||
code: 'E_FETCH_RELEASES',
|
||||
response: {
|
||||
status: resp.status,
|
||||
headers: headers,
|
||||
body: text,
|
||||
},
|
||||
});
|
||||
throw err;
|
||||
}
|
||||
|
||||
let summary = {
|
||||
ok: resp.ok,
|
||||
headers: resp.headers,
|
||||
status: resp.status,
|
||||
body: text,
|
||||
};
|
||||
return summary;
|
||||
};
|
||||
@@ -115,7 +115,7 @@ Repos.getCommitInfo = async function (repoPath, commitish) {
|
||||
* @param {string} gitUrl
|
||||
* @returns {PromiseLike<any> | Promise<any>}
|
||||
*/
|
||||
async function getAllReleases(gitUrl) {
|
||||
async function getDistributables(gitUrl) {
|
||||
let all = {
|
||||
releases: [],
|
||||
download: '',
|
||||
@@ -190,7 +190,7 @@ async function getAllReleases(gitUrl) {
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
(async function main() {
|
||||
@@ -203,7 +203,7 @@ if (module === require.main) {
|
||||
//'https://github.com/dense-analysis/ale.git',
|
||||
];
|
||||
for (let url of testRepos) {
|
||||
let all = await getAllReleases(url);
|
||||
let all = await getDistributables(url);
|
||||
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
|
||||
@@ -5,15 +5,15 @@ var GitHubish = require('./githubish.js');
|
||||
/**
|
||||
* Lists Gitea Releases (w/ uploaded assets)
|
||||
*
|
||||
* @param {any} _request - deprecated
|
||||
* @param {null} _ - deprecated
|
||||
* @param {String} owner
|
||||
* @param {String} repo
|
||||
* @param {String} baseurl
|
||||
* @param {String} [username]
|
||||
* @param {String} [token]
|
||||
*/
|
||||
async function getAllReleases(
|
||||
_request,
|
||||
async function getDistributables(
|
||||
_,
|
||||
owner,
|
||||
repo,
|
||||
baseurl,
|
||||
@@ -21,7 +21,7 @@ async function getAllReleases(
|
||||
token = '',
|
||||
) {
|
||||
baseurl = `${baseurl}/api/v1`;
|
||||
let all = await GitHubish.getAllReleases({
|
||||
let all = await GitHubish.getDistributables({
|
||||
owner,
|
||||
repo,
|
||||
baseurl,
|
||||
@@ -31,20 +31,17 @@ async function getAllReleases(
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases(
|
||||
getDistributables(
|
||||
null,
|
||||
'root',
|
||||
'pathman',
|
||||
'https://git.rootprojects.org',
|
||||
'',
|
||||
'',
|
||||
).then(
|
||||
//getAllReleases(require('@root/request'), 'root', 'serviceman', 'https://git.rootprojects.org').then(
|
||||
function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
},
|
||||
);
|
||||
).then(function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,133 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
require('dotenv').config();
|
||||
require('dotenv').config({ path: '.env' });
|
||||
|
||||
let GitHubSource = module.exports;
|
||||
|
||||
let GitHubishSource = require('./githubish-source.js');
|
||||
|
||||
/**
|
||||
* Gets the releases for 'ripgrep'. This function could be trimmed down and made
|
||||
* for use with any github release.
|
||||
*
|
||||
* @param request
|
||||
* @param {string} owner
|
||||
* @param {string} repo
|
||||
* @returns {PromiseLike<any> | Promise<any>}
|
||||
* @param {Object} opts
|
||||
* @param {String} opts.owner
|
||||
* @param {String} opts.repo
|
||||
* @param {String} [opts.baseurl]
|
||||
* @param {String} [opts.username]
|
||||
* @param {String} [opts.token]
|
||||
*/
|
||||
async function getAllReleases(
|
||||
request,
|
||||
GitHubSource.getDistributables = async function ({
|
||||
owner,
|
||||
repo,
|
||||
oses,
|
||||
arches,
|
||||
baseurl = 'https://api.github.com',
|
||||
) {
|
||||
if (!owner) {
|
||||
return Promise.reject('missing owner for repo');
|
||||
}
|
||||
if (!repo) {
|
||||
return Promise.reject('missing repo name');
|
||||
}
|
||||
|
||||
let req = {
|
||||
url: `${baseurl}/repos/${owner}/${repo}/releases`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
// TODO I really don't like global config, find a way to do better
|
||||
if (process.env.GITHUB_USERNAME) {
|
||||
req.auth = {
|
||||
user: process.env.GITHUB_USERNAME,
|
||||
pass: process.env.GITHUB_TOKEN,
|
||||
};
|
||||
}
|
||||
|
||||
let resp = await request(req);
|
||||
let gHubResp = resp.body;
|
||||
let all = {
|
||||
releases: [],
|
||||
// TODO make this ':baseurl' + ':releasename'
|
||||
download: '',
|
||||
};
|
||||
|
||||
for (let release of gHubResp) {
|
||||
// TODO tags aren't always semver / sensical
|
||||
let tag = release['tag_name'];
|
||||
let lts = /(\b|_)(lts)(\b|_)/.test(release['tag_name']);
|
||||
let channel = 'stable';
|
||||
if (release['prerelease']) {
|
||||
channel = 'beta';
|
||||
}
|
||||
let date = release['published_at'] || '';
|
||||
date = date.replace(/T.*/, '');
|
||||
|
||||
let urls = [release.tarball_url, release.zipball_url];
|
||||
for (let url of urls) {
|
||||
let resp = await request({
|
||||
method: 'HEAD',
|
||||
followRedirect: true,
|
||||
followAllRedirects: true,
|
||||
followOriginalHttpMethod: true,
|
||||
url: url,
|
||||
stream: true,
|
||||
});
|
||||
// Workaround for bug where method changes to GET
|
||||
resp.destroy();
|
||||
|
||||
// content-disposition: attachment; filename=BeyondCodeBootcamp-DuckDNS.sh-v1.0.1-0-ga2f4bde.zip
|
||||
let name = resp.headers['content-disposition'].replace(
|
||||
/.*filename=([^;]+)(;|$)/,
|
||||
'$1',
|
||||
);
|
||||
all.releases.push({
|
||||
name: name,
|
||||
version: tag,
|
||||
lts: lts,
|
||||
channel: channel,
|
||||
date: date,
|
||||
os: '', // will be guessed by download filename
|
||||
arch: '', // will be guessed by download filename
|
||||
ext: '', // will be normalized
|
||||
download: resp.request.uri.href,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (oses) {
|
||||
return combinate(all, oses, arches);
|
||||
}
|
||||
|
||||
username = process.env.GITHUB_USERNAME || '',
|
||||
token = process.env.GITHUB_TOKEN || '',
|
||||
}) {
|
||||
let all = await GitHubishSource.getDistributables({
|
||||
owner,
|
||||
repo,
|
||||
baseurl,
|
||||
username,
|
||||
token,
|
||||
});
|
||||
return all;
|
||||
}
|
||||
|
||||
function combinate(all, oses, arches) {
|
||||
let releases = all.releases;
|
||||
// ex: arches = ['amd64', 'arm64', 'armv7l', 'armv6l', 'x86'];
|
||||
// ex: oses = ['macos', 'linux', 'bsd', 'posix'];
|
||||
|
||||
let combos = [];
|
||||
for (let release of releases) {
|
||||
for (let arch of arches) {
|
||||
for (let os of oses) {
|
||||
let combo = {
|
||||
arch: arch,
|
||||
os: os,
|
||||
};
|
||||
let rel = Object.assign({}, release, combo);
|
||||
combos.push(rel);
|
||||
}
|
||||
}
|
||||
}
|
||||
all.releases = combos;
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases(
|
||||
require('@root/request'),
|
||||
'BeyondCodeBootcamp',
|
||||
'DuckDNS.sh',
|
||||
).then(function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
GitHubSource.getDistributables(null, 'BeyondCodeBootcamp', 'DuckDNS.sh').then(
|
||||
function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,22 +7,22 @@ let GitHubish = require('./githubish.js');
|
||||
/**
|
||||
* Lists GitHub Releases (w/ uploaded assets)
|
||||
*
|
||||
* @param {any} _request - deprecated
|
||||
* @param {null} _ - deprecated
|
||||
* @param {String} owner
|
||||
* @param {String} repo
|
||||
* @param {String} [baseurl]
|
||||
* @param {String} [username]
|
||||
* @param {String} [token]
|
||||
*/
|
||||
async function getAllReleases(
|
||||
_request,
|
||||
module.exports = async function (
|
||||
_,
|
||||
owner,
|
||||
repo,
|
||||
baseurl = 'https://api.github.com',
|
||||
username = process.env.GITHUB_USERNAME || '',
|
||||
token = process.env.GITHUB_TOKEN || '',
|
||||
) {
|
||||
let all = await GitHubish.getAllReleases({
|
||||
let all = await GitHubish.getDistributables({
|
||||
owner,
|
||||
repo,
|
||||
baseurl,
|
||||
@@ -30,12 +30,13 @@ async function getAllReleases(
|
||||
token,
|
||||
});
|
||||
return all;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = getAllReleases;
|
||||
let GitHub = module.exports;
|
||||
GitHub.getDistributables = module.exports;
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases(null, 'BurntSushi', 'ripgrep').then(function (all) {
|
||||
GitHub.getDistributables(null, 'BurntSushi', 'ripgrep').then(function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
174
_common/githubish-source.js
Normal file
174
_common/githubish-source.js
Normal file
@@ -0,0 +1,174 @@
|
||||
'use strict';
|
||||
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
let GitHubishSource = module.exports;
|
||||
|
||||
/**
|
||||
* Lists GitHub-Like Releases (source tarball & zip)
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @param {String} opts.owner
|
||||
* @param {String} opts.repo
|
||||
* @param {String} opts.baseurl
|
||||
* @param {String} [opts.username]
|
||||
* @param {String} [opts.token]
|
||||
*/
|
||||
GitHubishSource.getDistributables = async function ({
|
||||
owner,
|
||||
repo,
|
||||
baseurl,
|
||||
username = '',
|
||||
token = '',
|
||||
}) {
|
||||
if (!owner) {
|
||||
throw new Error('missing owner for repo');
|
||||
}
|
||||
if (!repo) {
|
||||
throw new Error('missing repo name');
|
||||
}
|
||||
if (!baseurl) {
|
||||
throw new Error('missing baseurl');
|
||||
}
|
||||
|
||||
let url = `${baseurl}/repos/${owner}/${repo}/releases`;
|
||||
let opts = {
|
||||
headers: {
|
||||
'Content-Type': 'appplication/json',
|
||||
},
|
||||
};
|
||||
|
||||
if (token) {
|
||||
let userpass = `${username}:${token}`;
|
||||
let basicAuth = btoa(userpass);
|
||||
Object.assign(opts.headers, {
|
||||
Authorization: `Basic ${basicAuth}`,
|
||||
});
|
||||
}
|
||||
|
||||
let resp;
|
||||
try {
|
||||
resp = await Fetcher.fetch(url, opts);
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch '${baseurl}' (githubish-source, user '${username}) release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
let gHubResp = JSON.parse(resp.body);
|
||||
|
||||
let all = {
|
||||
/** @type {Array<BuildInfo>} */
|
||||
releases: [],
|
||||
download: '',
|
||||
};
|
||||
|
||||
for (let release of gHubResp) {
|
||||
let dists = GitHubishSource.releaseToDistributables(release);
|
||||
for (let dist of dists) {
|
||||
let updates =
|
||||
await GitHubishSource.followDistributableDownloadAttachment(dist);
|
||||
Object.assign(dist, updates);
|
||||
all.releases.push(dist);
|
||||
}
|
||||
}
|
||||
|
||||
return all;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef BuildInfo
|
||||
* @prop {String} [name] - name to use instead of filename for hash urls
|
||||
* @prop {String} version
|
||||
* @prop {String} [_version]
|
||||
* @prop {String} [arch]
|
||||
* @prop {String} channel
|
||||
* @prop {String} date
|
||||
* @prop {String} download
|
||||
* @prop {String} [ext]
|
||||
* @prop {String} [_filename]
|
||||
* @prop {String} [hash]
|
||||
* @prop {String} [libc]
|
||||
* @prop {Boolean} [_musl]
|
||||
* @prop {Boolean} [lts]
|
||||
* @prop {String} [size]
|
||||
* @prop {String} os
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {any} ghRelease - TODO
|
||||
* @returns {Array<BuildInfo>}
|
||||
*/
|
||||
GitHubishSource.releaseToDistributables = function (ghRelease) {
|
||||
let ghTag = ghRelease['tag_name']; // TODO tags aren't always semver / sensical
|
||||
let lts = /(\b|_)(lts)(\b|_)/.test(ghRelease['tag_name']);
|
||||
let channel = 'stable';
|
||||
if (ghRelease['prerelease']) {
|
||||
channel = 'beta';
|
||||
}
|
||||
let date = ghRelease['published_at'] || '';
|
||||
date = date.replace(/T.*/, '');
|
||||
|
||||
let urls = [ghRelease.tarball_url, ghRelease.zipball_url];
|
||||
/** @type {Array<BuildInfo>} */
|
||||
let dists = [];
|
||||
for (let url of urls) {
|
||||
dists.push({
|
||||
name: '',
|
||||
version: ghTag,
|
||||
lts: lts,
|
||||
channel: channel,
|
||||
date: date,
|
||||
os: '*',
|
||||
arch: '*',
|
||||
libc: '',
|
||||
ext: '',
|
||||
download: url,
|
||||
});
|
||||
}
|
||||
|
||||
return dists;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {BuildInfo} dist
|
||||
*/
|
||||
GitHubishSource.followDistributableDownloadAttachment = async function (dist) {
|
||||
let abortCtrl = new AbortController();
|
||||
let resp = await fetch(dist.download, {
|
||||
method: 'HEAD',
|
||||
redirect: 'follow',
|
||||
signal: abortCtrl.signal,
|
||||
});
|
||||
let headers = Object.fromEntries(resp.headers);
|
||||
|
||||
// Workaround for bug where METHOD changes to GET
|
||||
abortCtrl.abort();
|
||||
await resp.text().catch(function (err) {
|
||||
if (err.name !== 'AbortError') {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
// ex: content-disposition: attachment; filename=BeyondCodeBootcamp-DuckDNS.sh-v1.0.1-0-ga2f4bde.zip
|
||||
// => BeyondCodeBootcamp-DuckDNS.sh-v1.0.1-0-ga2f4bde.zip
|
||||
let name = headers['content-disposition'].replace(
|
||||
/.*filename=([^;]+)(;|$)/,
|
||||
'$1',
|
||||
);
|
||||
let download = resp.url;
|
||||
|
||||
return { name, download };
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
GitHubishSource.getDistributables({
|
||||
owner: 'BeyondCodeBootcamp',
|
||||
repo: 'DuckDNS.sh',
|
||||
baseurl: 'https://api.github.com',
|
||||
}).then(function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
/**
|
||||
* @typedef DistributableRaw
|
||||
* @prop {String} name
|
||||
* @prop {String} version
|
||||
* @prop {Boolean} lts
|
||||
* @prop {String} [channel]
|
||||
* @prop {String} date
|
||||
* @prop {String} os
|
||||
* @prop {String} arch
|
||||
* @prop {String} ext
|
||||
* @prop {String} download
|
||||
*/
|
||||
|
||||
let GitHubish = module.exports;
|
||||
|
||||
/**
|
||||
@@ -12,7 +27,7 @@ let GitHubish = module.exports;
|
||||
* @param {String} [opts.username]
|
||||
* @param {String} [opts.token]
|
||||
*/
|
||||
GitHubish.getAllReleases = async function ({
|
||||
GitHubish.getDistributables = async function ({
|
||||
owner,
|
||||
repo,
|
||||
baseurl,
|
||||
@@ -44,28 +59,21 @@ GitHubish.getAllReleases = async function ({
|
||||
});
|
||||
}
|
||||
|
||||
let resp = await fetch(url, opts);
|
||||
if (!resp.ok) {
|
||||
let headers = Array.from(resp.headers);
|
||||
console.error('Bad Resp Headers:', headers);
|
||||
let text = await resp.text();
|
||||
console.error('Bad Resp Body:', text);
|
||||
let msg = `failed to fetch releases from '${baseurl}' with user '${username}'`;
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
let respText = await resp.text();
|
||||
let gHubResp;
|
||||
let resp;
|
||||
try {
|
||||
gHubResp = JSON.parse(respText);
|
||||
resp = await Fetcher.fetch(url, opts);
|
||||
} catch (e) {
|
||||
console.error('Bad Resp JSON:', respText);
|
||||
console.error(e.message);
|
||||
let msg = `failed to parse releases from '${baseurl}' with user '${username}'`;
|
||||
throw new Error(msg);
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch '${baseurl}' (githubish, user '${username}) release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
let gHubResp = JSON.parse(resp.body);
|
||||
|
||||
let all = {
|
||||
/** @type {Array<DistributableRaw>} */
|
||||
releases: [],
|
||||
// todo make this ':baseurl' + ':releasename'
|
||||
download: '',
|
||||
@@ -74,13 +82,18 @@ GitHubish.getAllReleases = async function ({
|
||||
try {
|
||||
gHubResp.forEach(transformReleases);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
console.error(err.message);
|
||||
console.error('Error Headers:', resp.headers);
|
||||
console.error('Error Body:', resp.body);
|
||||
let msg = `failed to transform releases from '${baseurl}' with user '${username}'`;
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} release - TODO
|
||||
*/
|
||||
function transformReleases(release) {
|
||||
for (let asset of release['assets']) {
|
||||
let name = asset['name'];
|
||||
@@ -114,7 +127,7 @@ GitHubish.getAllReleases = async function ({
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
GitHubish.getAllReleases({
|
||||
GitHubish.getDistributables({
|
||||
owner: 'BurntSushi',
|
||||
repo: 'ripgrep',
|
||||
baseurl: 'https://api.github.com',
|
||||
|
||||
@@ -12,19 +12,26 @@ var repo = 'ripgrep';
|
||||
/** **/
|
||||
/******************************************************************************/
|
||||
|
||||
module.exports = async function (request) {
|
||||
let all = await github(request, owner, repo);
|
||||
let Releases = module.exports;
|
||||
|
||||
Releases.latest = async function () {
|
||||
let all = await github(null, owner, repo);
|
||||
return all;
|
||||
};
|
||||
|
||||
Releases.sample = async function () {
|
||||
let normalize = require('../_webi/normalize.js');
|
||||
let all = await Releases.latest();
|
||||
all = normalize(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
return all;
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
(async function () {
|
||||
let request = require('@root/request');
|
||||
let normalize = require('../_webi/normalize.js');
|
||||
let all = await module.exports(request);
|
||||
all = normalize(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
let samples = await Releases.sample();
|
||||
|
||||
console.info(JSON.stringify(samples, null, 2));
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
//var pkg = require('../package.json');
|
||||
var os = require('os');
|
||||
//var request = require('@root/request');
|
||||
//var promisify = require('util').promisify;
|
||||
//var exec = promisify(require('child_process').exec);
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
Submodule _webi/build-classifier updated: 6b626a6d08...1b24d834b9
@@ -9,8 +9,6 @@ let HostTargets = require('./build-classifier/host-targets.js');
|
||||
let Lexver = require('./build-classifier/lexver.js');
|
||||
let Triplet = require('./build-classifier/triplet.js');
|
||||
|
||||
let request = require('@root/request');
|
||||
|
||||
var ALIAS_RE = /^alias: (\w+)$/m;
|
||||
|
||||
var LEGACY_ARCH_MAP = {
|
||||
@@ -58,15 +56,14 @@ var TERMS_META = [
|
||||
/** @typedef {String} VersionString */
|
||||
/** @typedef {Object.<VersionString, Array<BuildAsset>>} PackagesByRelease */
|
||||
|
||||
/** @typedef {ProjectMeta & ProjectInfoPartial} ProjectInfo */
|
||||
/**
|
||||
* @typedef ProjectInfo
|
||||
* @prop {Array<BuildAsset>} releases
|
||||
* @typedef ProjectMeta
|
||||
* @prop {Array<BuildAsset>} packages
|
||||
* @prop {Object.<TripletString, PackagesByRelease>} releasesByTriplet
|
||||
* @prop {Array<import('./build-classifier/types.js').ArchString>} arches
|
||||
* @prop {Array<import('./build-classifier/types.js').OsString>} oses
|
||||
* @prop {Array<import('./build-classifier/types.js').LibcString>} libcs
|
||||
* @prop {Array<String>} channels
|
||||
* @prop {Array<String>} formats
|
||||
* @prop {Array<String>} triplets
|
||||
* @prop {Array<String>} versions
|
||||
@@ -74,6 +71,12 @@ var TERMS_META = [
|
||||
* @prop {Object.<String, String>} lexversMap
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef ProjectInfoPartial
|
||||
* @prop {Array<BuildAsset>} releases
|
||||
* @prop {Array<String>} channels
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef BuildAsset
|
||||
* @prop {String} name
|
||||
@@ -85,6 +88,8 @@ var TERMS_META = [
|
||||
* @prop {String} libc
|
||||
* @prop {String} ext
|
||||
* @prop {String} download
|
||||
* @prop {import('./build-classifier/types.js').TargetTriplet} [target]
|
||||
* @prop {String} [lexver]
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -102,6 +107,18 @@ var TERMS_META = [
|
||||
* @prop {Error} target.error
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Error & WebiErrorPartial} WebiError
|
||||
* @typedef WebiErrorPartial
|
||||
* @prop {String} code
|
||||
* @prop {Number} status
|
||||
*/
|
||||
|
||||
/** @typedef {String} PathString */
|
||||
|
||||
/**
|
||||
* @param {PathString} path
|
||||
*/
|
||||
async function getPartialHeader(path) {
|
||||
let readme = `${path}/README.md`;
|
||||
let head = await readFirstBytes(readme).catch(function (err) {
|
||||
@@ -114,8 +131,9 @@ async function getPartialHeader(path) {
|
||||
return head;
|
||||
}
|
||||
|
||||
// let fsOpen = util.promisify(Fs.open);
|
||||
// let fsRead = util.promisify(Fs.read);
|
||||
/**
|
||||
* @param {PathString} path
|
||||
*/
|
||||
async function readFirstBytes(path) {
|
||||
let start = 0;
|
||||
let n = 1024;
|
||||
@@ -128,15 +146,29 @@ async function readFirstBytes(path) {
|
||||
return str;
|
||||
}
|
||||
|
||||
/** @type {Object.<String, Promise<void>>} */
|
||||
let promises = {};
|
||||
|
||||
/**
|
||||
* @param {import('../_example/releases.js')?} Releases
|
||||
* @param {PathString} installersDir
|
||||
* @param {PathString} cacheDir
|
||||
* @param {PathString} name
|
||||
* @param {Date?} [date]
|
||||
*/
|
||||
async function getLatestBuilds(Releases, installersDir, cacheDir, name, date) {
|
||||
console.info(`[INFO] getLatestBuilds: ${name}`);
|
||||
|
||||
if (!Releases) {
|
||||
Releases = require(`${installersDir}/${name}/releases.js`);
|
||||
}
|
||||
if (!Releases) {
|
||||
throw new Error('unreachable: narrowing for type checker');
|
||||
}
|
||||
|
||||
// TODO update all releases files with module.exports.xxxx = 'foo';
|
||||
if (!Releases.latest) {
|
||||
//@ts-expect-error
|
||||
Releases.latest = Releases;
|
||||
}
|
||||
|
||||
@@ -152,8 +184,14 @@ async function getLatestBuilds(Releases, installersDir, cacheDir, name, date) {
|
||||
return await promises[id];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('../_example/releases.js')} Releases
|
||||
* @param {PathString} cacheDir
|
||||
* @param {PathString} name
|
||||
* @param {Date?} [date]
|
||||
*/
|
||||
async function getLatestBuildsInner(Releases, cacheDir, name, date) {
|
||||
let data = await Releases.latest(request);
|
||||
let data = await Releases.latest();
|
||||
|
||||
if (!date) {
|
||||
date = new Date();
|
||||
@@ -193,11 +231,14 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
bc.orphanTerms = Object.assign({}, bc.ALL_TERMS);
|
||||
bc.unknownTerms = {};
|
||||
bc.usedTerms = {};
|
||||
/** @type {Array<String>} */
|
||||
bc.formats = [];
|
||||
bc._triplets = {};
|
||||
bc._targetsByBuildIdCache = {};
|
||||
/** @type {Object.<String, ProjectInfo>} */
|
||||
bc._caches = {};
|
||||
bc._staleAge = 15 * 60 * 1000;
|
||||
/** @type {Object.<String, Array<String>>} */
|
||||
bc._allFormats = {};
|
||||
bc._allTriplets = {};
|
||||
|
||||
@@ -245,8 +286,8 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
let filepath = Path.join(installersDir, name);
|
||||
let entry;
|
||||
try {
|
||||
entry = await Fs.lstat(filepath);
|
||||
Object.assign(entry, { name: name });
|
||||
let stat = await Fs.lstat(filepath);
|
||||
entry = Object.assign(stat, { name: name });
|
||||
} catch (e) {
|
||||
return { type: 'errors', detail: 'not found' };
|
||||
}
|
||||
@@ -257,7 +298,7 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
|
||||
/**
|
||||
* Get project type and detail - alias, selfhosted, valid (and the invalids)
|
||||
* @param {fs.Stats|fs.Dirent} entry
|
||||
* @param {Omit<import('fs').Dirent, "path"|"parentPath">} entry
|
||||
*/
|
||||
bc.getProjectTypeByEntry = async function (entry) {
|
||||
let path = Path.join(installersDir, entry.name);
|
||||
@@ -302,7 +343,9 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
let releasesPath = Path.join(path, 'releases.js');
|
||||
try {
|
||||
void require(releasesPath);
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
/** @type {WebiError} */ // @ts-expect-error
|
||||
let err = _err;
|
||||
if (err.code !== 'MODULE_NOT_FOUND') {
|
||||
return { type: 'errors', detail: err };
|
||||
}
|
||||
@@ -317,9 +360,16 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
return { type: 'valid', detail: true };
|
||||
};
|
||||
|
||||
// Typically a package is organized by release (ex: go has 1.20, 1.21, etc),
|
||||
// but we will organize by the build (ex: go1.20-darwin-arm64.tar.gz, etc).
|
||||
bc.getPackages = async function ({ Releases, name, date }) {
|
||||
/**
|
||||
* Typically a package is organized by release (ex: go has 1.20, 1.21, etc),
|
||||
* but we will organize by the build (ex: go1.20-darwin-arm64.tar.gz, etc).
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @param {import('../_example/releases.js')?} [opts.Releases]
|
||||
* @param {PathString} opts.name
|
||||
* @param {Date} opts.date
|
||||
*/
|
||||
bc.getPackages = async function ({ Releases = null, name, date }) {
|
||||
if (!date) {
|
||||
date = new Date();
|
||||
}
|
||||
@@ -344,6 +394,7 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
|
||||
let projInfo = bc._caches[name];
|
||||
|
||||
/** @type {ProjectMeta} */
|
||||
let meta = {
|
||||
// version info
|
||||
versions: projInfo?.versions || [],
|
||||
@@ -362,20 +413,23 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
};
|
||||
|
||||
if (!projInfo) {
|
||||
let NULLSTRING = 'null';
|
||||
let json = await Fs.readFile(dataFile, 'ascii').catch(
|
||||
async function (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
throw err;
|
||||
}
|
||||
|
||||
return null;
|
||||
return NULLSTRING;
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
projInfo = JSON.parse(json);
|
||||
} catch (e) {
|
||||
console.error(`error: ${dataFile}:\n\t${e.message}`);
|
||||
} catch (_err) {
|
||||
/** @type {WebiError} */ // @ts-expect-error
|
||||
let err = _err;
|
||||
console.error(`error: ${dataFile}:\n\t${err.message}`);
|
||||
projInfo = null;
|
||||
}
|
||||
}
|
||||
@@ -400,23 +454,34 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
return;
|
||||
}
|
||||
|
||||
projInfo = await getLatestBuilds(Releases, installersDir, cacheDir, name);
|
||||
let latestProjInfo = BuildsCacher.transformAndUpdate(
|
||||
name,
|
||||
projInfo,
|
||||
meta,
|
||||
date,
|
||||
bc,
|
||||
);
|
||||
bc._caches[name] = latestProjInfo;
|
||||
projInfo = await getLatestBuilds(Releases, installersDir, cacheDir, name)
|
||||
.then(function () {
|
||||
let latestProjInfo = BuildsCacher.transformAndUpdate(
|
||||
name,
|
||||
projInfo,
|
||||
meta,
|
||||
date,
|
||||
bc,
|
||||
);
|
||||
bc._caches[name] = latestProjInfo;
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(`Fail when fetching latest builds for '${name}'`);
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
return projInfo;
|
||||
};
|
||||
|
||||
// Makes sure that packages are updated once an hour, on average
|
||||
/** @type {Array<String>} */
|
||||
bc._staleNames = [];
|
||||
/** @type {ReturnType<typeof setTimeout>?} */
|
||||
bc._freshenTimeout = null;
|
||||
/**
|
||||
* @param {Number?} [minDelay]
|
||||
*/
|
||||
bc.freshenRandomPackage = async function (minDelay) {
|
||||
if (!minDelay) {
|
||||
minDelay = 15 * 1000;
|
||||
@@ -433,7 +498,7 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
let name = bc._staleNames.pop();
|
||||
void (await bc.getPackages({
|
||||
//Releases: Releases,
|
||||
name: name,
|
||||
name: name || '',
|
||||
date: new Date(),
|
||||
}));
|
||||
console.info(`[INFO] freshenRandomPackage: ${name}`);
|
||||
@@ -444,7 +509,9 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
let seed = Math.random();
|
||||
delay += seed * spread;
|
||||
|
||||
clearTimeout(bc._freshenTimeout);
|
||||
if (bc._freshenTimeout) {
|
||||
clearTimeout(bc._freshenTimeout);
|
||||
}
|
||||
bc._freshenTimeout = setTimeout(bc.freshenRandomPackage, delay);
|
||||
bc._freshenTimeout.unref();
|
||||
};
|
||||
@@ -467,6 +534,8 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
* .tar.xz
|
||||
* .xz
|
||||
* .zip
|
||||
*
|
||||
* @param {Array<String>} formats
|
||||
*/
|
||||
bc.getSortedFormats = function (formats) {
|
||||
/* jshint maxcomplexity: 25 */
|
||||
@@ -575,6 +644,10 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
return exts;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Array<BuildAsset>} packages
|
||||
* @param {Array<String>} formats
|
||||
*/
|
||||
bc.selectPackage = function (packages, formats) {
|
||||
if (packages.length === 1) {
|
||||
return packages[0];
|
||||
@@ -594,9 +667,8 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
|
||||
/**
|
||||
* @param {ProjectInfo} projInfo
|
||||
* @param {HostTarget} hostTarget
|
||||
*/
|
||||
bc.enumerateLatestVersions = function (projInfo, hostTarget) {
|
||||
bc.enumerateLatestVersions = function (projInfo) {
|
||||
let lexPrefix = '';
|
||||
let matchInfo = Lexver.matchSorted(projInfo.lexvers, lexPrefix);
|
||||
let verInfo = {
|
||||
@@ -726,9 +798,9 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
if (hostTarget.os === 'windows') {
|
||||
oses = ['ANYOS', 'windows'];
|
||||
} else if (hostTarget.os === 'android') {
|
||||
oses = ['ANYOS', 'posix_2017', 'android', 'linux'];
|
||||
oses = ['ANYOS', 'posix_2017', 'posix_2024', 'android', 'linux'];
|
||||
} else {
|
||||
oses = ['ANYOS', 'posix_2017', hostTarget.os];
|
||||
oses = ['ANYOS', 'posix_2017', 'posix_2024', hostTarget.os];
|
||||
}
|
||||
|
||||
let waterfall = HostTargets.WATERFALL[hostTarget.os] || {};
|
||||
@@ -764,6 +836,11 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
return bc;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ReturnType<typeof BuildsCacher.create>} bc
|
||||
* @param {ProjectInfo} projInfo
|
||||
* @param {BuildAsset} build
|
||||
*/
|
||||
BuildsCacher._classify = function (bc, projInfo, build) {
|
||||
/* jshint maxcomplexity: 25 */
|
||||
let maybeInstallable = Triplet.maybeInstallable(projInfo, build);
|
||||
@@ -944,7 +1021,11 @@ BuildsCacher.transformAndUpdate = function (name, projInfo, meta, date, bc) {
|
||||
};
|
||||
|
||||
// TODO
|
||||
// - tag channels
|
||||
// - tag channels
|
||||
/**
|
||||
* @param {ProjectInfo} projInfo
|
||||
* @param {ProjectMeta} meta
|
||||
*/
|
||||
BuildsCacher.updateAndSortVersions = function (projInfo, meta) {
|
||||
for (let build of projInfo.packages) {
|
||||
let hasVersion = meta.versions.includes(build.version);
|
||||
@@ -964,17 +1045,31 @@ BuildsCacher.updateAndSortVersions = function (projInfo, meta) {
|
||||
meta.versions.push(version);
|
||||
}
|
||||
|
||||
projInfo.packages.sort(function (a, b) {
|
||||
if (a.lexver > b.lexver) {
|
||||
return -1;
|
||||
}
|
||||
if (a.lexver < b.lexver) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
projInfo.packages.sort(BuildsCacher.sortByLexver);
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef HasLexver
|
||||
* @prop {String} lexver
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {HasLexver} a
|
||||
* @param {HasLexver} b
|
||||
*/
|
||||
BuildsCacher.sortByLexver = function (a, b) {
|
||||
if (a.lexver > b.lexver) {
|
||||
return -1;
|
||||
}
|
||||
if (a.lexver < b.lexver) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ProjectMeta} meta
|
||||
*/
|
||||
BuildsCacher.updateReleasesByTriplet = function (meta) {
|
||||
for (let build of meta.packages) {
|
||||
let target = build.target;
|
||||
|
||||
@@ -6,8 +6,6 @@ let Path = require('node:path');
|
||||
let BuildsCacher = require('./builds-cacher.js');
|
||||
let Triplet = require('./build-classifier/triplet.js');
|
||||
|
||||
let request = require('@root/request');
|
||||
|
||||
async function main() {
|
||||
let projName = process.argv[2];
|
||||
if (!projName) {
|
||||
@@ -47,7 +45,7 @@ async function main() {
|
||||
Releases.latest = Releases;
|
||||
}
|
||||
|
||||
let projInfo = await Releases.latest(request);
|
||||
let projInfo = await Releases.latest();
|
||||
|
||||
// let packages = await Builds.getPackage({ name: projName });
|
||||
// console.log(packages);
|
||||
|
||||
@@ -16,7 +16,7 @@ var BAD_SH_RE = /[<>'"`$\\]/;
|
||||
Installers.renderBash = async function (
|
||||
pkgdir,
|
||||
rel,
|
||||
{ baseurl, pkg, tag, ver, os = '', arch = '', libc = '', formats, latest },
|
||||
{ baseurl, pkg, tag, ver, os = '', arch = '', libc = '', formats },
|
||||
) {
|
||||
if (!Array.isArray(formats)) {
|
||||
formats = [];
|
||||
@@ -99,11 +99,12 @@ Installers.renderBash = async function (
|
||||
['WEBI_PKG_PATHNAME', pkgFile],
|
||||
['WEBI_PKG_FILE', pkgFile], // TODO replace with pathname
|
||||
['PKG_NAME', pkg],
|
||||
['PKG_STABLE', rel.stable],
|
||||
['PKG_LATEST', rel.latest],
|
||||
['PKG_OSES', (rel.oses || []).join(' ')],
|
||||
['PKG_ARCHES', (rel.arches || []).join(' ')],
|
||||
['PKG_LIBCS', (rel.libcs || []).join(' ')],
|
||||
['PKG_FORMATS', (rel.formats || []).join(' ')],
|
||||
['PKG_LATEST', latest],
|
||||
];
|
||||
|
||||
for (let env of envReplacements) {
|
||||
|
||||
@@ -57,7 +57,7 @@ var archMap = {
|
||||
amd64:
|
||||
/(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)64([_\-]?bit)?(\b|_)/i,
|
||||
//x86: /(86)(\b|_)/i,
|
||||
x86: /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)(86|32)([_\-]?bit)(\b|_)/i,
|
||||
x86: /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)(86|32|i?386)([_\-]?bit)?(\b|_)/i,
|
||||
ppc64le: /(\b|_)(ppc64le)/i,
|
||||
ppc64: /(\b|_)(ppc64)(\b|_)/i,
|
||||
s390x: /(\b|_)(s390x)/i,
|
||||
@@ -211,7 +211,8 @@ function normalize(all) {
|
||||
// won't match:
|
||||
// - v1.0beta
|
||||
// - v1.0-beta1b
|
||||
let isBetaRe = /(\b|_)(preview|rc|beta|alpha)(\d+)(\b|_)/;
|
||||
let isBetaRe =
|
||||
/(\b|_)(alpha|beta|dev|developer|prev|preview|rc)(\d+)(\b|_)/;
|
||||
let isBeta = isBetaRe.test(rel.name);
|
||||
if (isBeta) {
|
||||
rel.channel = 'beta';
|
||||
|
||||
@@ -88,7 +88,7 @@ function Get-UserAgent {
|
||||
IF ($my_arch -eq "AMD64") {
|
||||
# Because PowerShell is sometimes AMD64 on Windows 10 ARM
|
||||
# See https://oofhours.com/2020/02/04/powershell-on-windows-10-arm64/
|
||||
$my_os_arch = wmic os get osarchitecture
|
||||
$my_os_arch = (Get-CimInstance -ClassName Win32_OperatingSystem).OSArchitecture
|
||||
|
||||
# Using -clike because of the trailing newline
|
||||
IF ($my_os_arch -clike "ARM 64*") {
|
||||
|
||||
@@ -27,6 +27,7 @@ __bootstrap_webi() {
|
||||
#PKG_LIBCS=
|
||||
#PKG_FORMATS=
|
||||
#PKG_LATEST=
|
||||
#PKG_STABLE=
|
||||
WEBI_PKG_DOWNLOAD=""
|
||||
WEBI_DOWNLOAD_DIR="${HOME}/Downloads"
|
||||
if command -v xdg-user-dir > /dev/null; then
|
||||
@@ -36,7 +37,7 @@ __bootstrap_webi() {
|
||||
fi
|
||||
fi
|
||||
|
||||
WEBI_PKG_PATH="${WEBI_DOWNLOAD_DIR}/webi/${PKG_NAME:-error}/${WEBI_VERSION:-latest}"
|
||||
WEBI_PKG_PATH="${WEBI_DOWNLOAD_DIR}/webi/${PKG_NAME:-error}/${WEBI_VERSION:-stable}"
|
||||
|
||||
# get the special formatted version
|
||||
# (i.e. "go is go1.14" while node is "node v12.10.8")
|
||||
@@ -127,7 +128,10 @@ __bootstrap_webi() {
|
||||
echo ""
|
||||
echo " $(t_err "Error: no '${PKG_NAME:-"Unknown Package"}@${WEBI_TAG:-"Unknown Tag"}' release for '${WEBI_OS:-"Unknown OS"}' (${WEBI_LIBC:-"Unknown Libc"}) on '${WEBI_ARCH:-"Unknown CPU"}' as one of '${WEBI_FORMATS:-"Unknown File Type"}'")"
|
||||
echo ""
|
||||
echo " Latest Version: ${PKG_LATEST}"
|
||||
echo " Latest Stable: ${PKG_STABLE}"
|
||||
if test "${PKG_LATEST}" != "${PKG_STABLE}"; then
|
||||
echo " Next Version: ${PKG_LATEST}"
|
||||
fi
|
||||
echo " CPUs: $PKG_ARCHES"
|
||||
echo " OSes: $PKG_OSES"
|
||||
echo " libcs: $PKG_LIBCS"
|
||||
|
||||
@@ -70,18 +70,20 @@ InstallerServer.helper = async function ({
|
||||
|
||||
console.log(`dbg: Get Project Installer Type for '${projectName}':`);
|
||||
let proj = await Builds.getProjectType(projectName);
|
||||
console.log(proj);
|
||||
if (proj.type === 'alias') {
|
||||
console.log(`dbg: alias`, proj);
|
||||
projectName = proj.detail;
|
||||
proj = await Builds.getProjectType(projectName); // an alias should never resolve to an alias
|
||||
}
|
||||
console.log(`dbg: proj`, proj);
|
||||
|
||||
let validTypes = ['alias', 'selfhosted', 'valid'];
|
||||
let validTypes = ['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;
|
||||
}
|
||||
if (proj.type === 'alias') {
|
||||
projectName = proj.detail;
|
||||
}
|
||||
|
||||
let tmplParams = {
|
||||
pkg: projectName,
|
||||
@@ -120,8 +122,7 @@ InstallerServer.helper = async function ({
|
||||
name: projectName,
|
||||
date: new Date(),
|
||||
});
|
||||
let latest = projInfo.versions[0];
|
||||
Object.assign(tmplParams, { latest });
|
||||
let latestVersions = Builds.enumerateLatestVersions(projInfo);
|
||||
//console.log('projInfo', projInfo);
|
||||
|
||||
let buildTargetInfo = {
|
||||
@@ -130,12 +131,27 @@ InstallerServer.helper = async function ({
|
||||
arches: projInfo.arches,
|
||||
libcs: projInfo.libcs,
|
||||
formats: projInfo.formats,
|
||||
latest: latestVersions.latest,
|
||||
stable: latestVersions.stable,
|
||||
};
|
||||
|
||||
// TODO .findMatchingPackages() should probably account for this
|
||||
let hasOs = projInfo.oses.includes(hostTarget.os);
|
||||
let maybePosix = !hasOs && hostTarget.os !== 'windows';
|
||||
if (maybePosix) {
|
||||
let posixes = ['posix_2017', 'posix_2024'];
|
||||
for (let posixYear of posixes) {
|
||||
let hasPosix = projInfo.oses.includes(posixYear);
|
||||
if (hasPosix) {
|
||||
hasOs = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasOs) {
|
||||
hasOs = projInfo.oses.includes('ANYOS');
|
||||
}
|
||||
|
||||
if (!hasOs) {
|
||||
let pkg1 = Object.assign(buildTargetInfo, errPackage);
|
||||
return [pkg1, tmplParams];
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
var Releases = module.exports;
|
||||
|
||||
var path = require('path');
|
||||
var request = require('@root/request');
|
||||
var _normalize = require('./normalize.js');
|
||||
|
||||
var cache = {};
|
||||
@@ -17,14 +16,18 @@ let installerDir = path.join(__dirname, '..');
|
||||
Releases.get = async function (pkgdir) {
|
||||
let get;
|
||||
try {
|
||||
get = require(path.join(pkgdir, 'releases.js'));
|
||||
get = require(`${pkgdir}/releases.js`);
|
||||
// TODO update all releases files with module.exports.xxxx = 'foo';
|
||||
if (!get.latest) {
|
||||
get.latest = get;
|
||||
}
|
||||
} catch (e) {
|
||||
let err = new Error('no releases.js for', pkgdir.split(/[\/\\]+/).pop());
|
||||
err.code = 'E_NO_RELEASE';
|
||||
throw err;
|
||||
}
|
||||
|
||||
let all = await get(request);
|
||||
let all = await get.latest();
|
||||
|
||||
return _normalize(all);
|
||||
};
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var githubSource = require('../_common/github-source.js');
|
||||
var owner = 'BeyondCodeBootcamp';
|
||||
var repo = 'aliasman';
|
||||
let Releases = module.exports;
|
||||
|
||||
module.exports = function (request) {
|
||||
let arches = [
|
||||
'amd64',
|
||||
'arm64',
|
||||
'armv6l',
|
||||
'armv7l',
|
||||
'ppc64le',
|
||||
'ppc64',
|
||||
's390x',
|
||||
'x86',
|
||||
];
|
||||
let oses = ['freebsd', 'linux', 'macos', 'posix'];
|
||||
return githubSource(request, owner, repo, oses, arches).then(function (all) {
|
||||
all._names = ['aliasman', 'legacy'];
|
||||
return all;
|
||||
});
|
||||
let GitHubSource = require('../_common/github-source.js');
|
||||
let owner = 'BeyondCodeBootcamp';
|
||||
let repo = 'aliasman';
|
||||
|
||||
Releases.latest = async function () {
|
||||
let all = await GitHubSource.getDistributables({ owner, repo });
|
||||
for (let pkg of all.releases) {
|
||||
pkg.os = 'posix_2017';
|
||||
}
|
||||
return all;
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
Releases.latest().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -4,15 +4,15 @@ var github = require('../_common/github.js');
|
||||
var owner = 'mholt';
|
||||
var repo = 'archiver';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all._names = ['archiver', 'arc'];
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -32,8 +32,8 @@ let targets = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
for (let rel of all.releases) {
|
||||
let windows32 = rel.name.includes('WindowsX86.');
|
||||
if (windows32) {
|
||||
@@ -71,7 +71,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
//console.info(JSON.stringify(all, null, 2));
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'wallix';
|
||||
var repo = 'awless';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
// remove checksums and .deb
|
||||
all.releases = all.releases.filter(function (rel) {
|
||||
return !/(\.txt)|(\.deb)$/i.test(rel.name);
|
||||
@@ -15,7 +15,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'sharkdp';
|
||||
var repo = 'bat';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
//console.info(JSON.stringify(all));
|
||||
|
||||
@@ -7,13 +7,13 @@ main() { (
|
||||
chmod a+x ~/.local/bin/brew-update-hourly
|
||||
|
||||
echo "Checking for serviceman..."
|
||||
~/.local/bin/webi serviceman
|
||||
if ! command -v serviceman > /dev/null; then
|
||||
"$HOME/.local/bin/webi" serviceman
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
serviceman --version
|
||||
fi
|
||||
serviceman --version
|
||||
|
||||
env PATH="$PATH" serviceman add --user \
|
||||
serviceman add --agent \
|
||||
--workdir ~/.local/opt/brew/ \
|
||||
--name sh.brew.updater -- \
|
||||
~/.local/bin/brew-update-hourly
|
||||
|
||||
@@ -132,9 +132,7 @@ file)
|
||||
```
|
||||
3. Add your project to the system launcher, running as the current user
|
||||
```sh
|
||||
sudo env PATH="$PATH" \
|
||||
serviceman add --path="$PATH" --system \
|
||||
--username "$(whoami)" --name my-project -- \
|
||||
serviceman add --name 'my-project' --daemon -- \
|
||||
bun run ./my-project.js
|
||||
```
|
||||
4. Restart the logging service
|
||||
@@ -155,6 +153,6 @@ For **macOS**:
|
||||
```
|
||||
3. Add your project to the system launcher, running as the current user
|
||||
```sh
|
||||
serviceman add --path="$PATH" --user --name my-project -- \
|
||||
serviceman add --agent --name 'my-project' -- \
|
||||
bun run ./my-project.js
|
||||
```
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'oven-sh';
|
||||
var repo = 'bun';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all.releases = all.releases
|
||||
.filter(function (r) {
|
||||
let isDebug = r.name.includes('-profile');
|
||||
@@ -18,6 +18,14 @@ module.exports = function (request) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let isMusl = r.name.includes('-musl');
|
||||
if (isMusl) {
|
||||
r._musl = true;
|
||||
r.libc = 'musl';
|
||||
} else if (r.os === 'linux') {
|
||||
r.libc = 'gnu';
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
.map(function (r) {
|
||||
@@ -30,7 +38,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -819,10 +819,10 @@ To avoid the nitty-gritty details of `launchd` plist files, you can use
|
||||
2. Use Serviceman to create a _launchd_ plist file
|
||||
|
||||
```sh
|
||||
my_username="$( id -u -n )"
|
||||
my_username="$(id -u -n)"
|
||||
|
||||
serviceman add --user --name caddy -- \
|
||||
caddy run --config ./Caddyfile --envfile ~/.config/caddy/env
|
||||
serviceman add --agent --name 'caddy' --workdir ./ -- \
|
||||
caddy run --envfile ~/.config/caddy/env --config ./Caddyfile --adapter caddyfile
|
||||
```
|
||||
|
||||
(this will create `~/Library/LaunchAgents/caddy.plist`)
|
||||
@@ -837,8 +837,8 @@ This process creates a _User-Level_ service in `~/Library/LaunchAgents`. To
|
||||
create a _System-Level_ service in `/Library/LaunchDaemons/` instead:
|
||||
|
||||
```sh
|
||||
sudo serviceman add --system --name caddy -- \
|
||||
caddy run --config ./Caddyfile --envfile ~/.config/caddy/env
|
||||
serviceman add --name 'caddy' --workdir ./ --daemon -- \
|
||||
caddy run --envfile ~/.config/caddy/env --config ./Caddyfile --adapter caddyfile
|
||||
```
|
||||
|
||||
### How to run Caddy as a Windows Service
|
||||
@@ -856,7 +856,7 @@ sudo serviceman add --system --name caddy -- \
|
||||
3. Create a **Startup Registry Entry** with Serviceman.
|
||||
```sh
|
||||
serviceman.exe add --name caddy -- \
|
||||
caddy run --config ./Caddyfile --envfile ~/.config/caddy/env
|
||||
caddy run --envfile ~/.config/caddy/env --config ./Caddyfile --adapter caddyfile
|
||||
```
|
||||
4. You can manage the service directly with Serviceman. For example:
|
||||
```sh
|
||||
@@ -901,10 +901,8 @@ See the notes below to run as a **User Service** or use the JSON Config.
|
||||
```
|
||||
4. Use Serviceman to create a _systemd_ config file.
|
||||
```sh
|
||||
my_username="$( id -u -n )"
|
||||
sudo env PATH="$PATH" \
|
||||
serviceman add --system --username "${my_username}" --name caddy -- \
|
||||
caddy run --config ./Caddyfile --envfile ~/.config/caddy/env
|
||||
serviceman add --name 'caddy' --daemon -- \
|
||||
caddy run --envfile ~/.config/caddy/env --config ./Caddyfile --adapter caddyfile
|
||||
```
|
||||
(this will create `/etc/systemd/system/caddy.service`)
|
||||
5. Manage the service with `systemctl` and `journalctl`:
|
||||
@@ -915,10 +913,10 @@ See the notes below to run as a **User Service** or use the JSON Config.
|
||||
|
||||
To create a **User Service** instead:
|
||||
|
||||
- don't use `sudo`, but do use `--user` when running `serviceman`:
|
||||
- use `--agent` when running `serviceman`:
|
||||
```sh
|
||||
serviceman add --user --name caddy -- \
|
||||
caddy run --config ./Caddyfile --envfile ~/.config/caddy/env
|
||||
serviceman add --agent --name caddy -- \
|
||||
caddy run --envfile ~/.config/caddy/env --config ./Caddyfile --adapter caddyfile
|
||||
```
|
||||
(this will create `~/.config/systemd/user/`)
|
||||
- user the `--user` flag to manage services and logs:
|
||||
@@ -1363,19 +1361,13 @@ See also: <https://caddyserver.com/docs/running>
|
||||
2. Generate the `service` file: \
|
||||
- JSON Config
|
||||
```sh
|
||||
my_app_user="$( id -u -n )"
|
||||
sudo env PATH="${PATH}" \
|
||||
serviceman add --system --cap-net-bind \
|
||||
--username "${my_app_user}" --name caddy -- \
|
||||
caddy run --resume --envfile ./caddy.env
|
||||
serviceman add --name 'caddy' --daemon -- \
|
||||
caddy run --resume --envfile ./caddy.env
|
||||
```
|
||||
- Caddyfile
|
||||
```sh
|
||||
my_app_user="$( id -u -n )"
|
||||
sudo env PATH="${PATH}" \
|
||||
serviceman add --system --cap-net-bind \
|
||||
--username "${my_app_user}" --name caddy -- \
|
||||
caddy run --config ./Caddyfile --envfile ./caddy.env
|
||||
serviceman add --name 'caddy' --daemon -- \
|
||||
caddy run --config ./Caddyfile --envfile ./caddy.env
|
||||
```
|
||||
3. Reload `systemd` config files, the logging service (it may not be started on
|
||||
a new VPS), and caddy
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'caddyserver';
|
||||
var repo = 'caddy';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
// remove checksums and .deb
|
||||
all.releases = all.releases.filter(function (rel) {
|
||||
let isOneOffAsset = rel.download.includes('buildable-artifact');
|
||||
@@ -20,7 +20,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
// See <https://googlechromelabs.github.io/chrome-for-testing/>
|
||||
var releaseApiUrl =
|
||||
const releaseApiUrl =
|
||||
'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json';
|
||||
|
||||
// {
|
||||
@@ -40,14 +42,24 @@ var releaseApiUrl =
|
||||
// ]
|
||||
// }
|
||||
|
||||
module.exports = async function (request) {
|
||||
let resp = await request({
|
||||
url: releaseApiUrl,
|
||||
json: true,
|
||||
});
|
||||
module.exports = async function () {
|
||||
let resp;
|
||||
try {
|
||||
resp = await Fetcher.fetch(releaseApiUrl, {
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch 'chromedriver' release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
let data = JSON.parse(resp.body);
|
||||
|
||||
let builds = [];
|
||||
for (let release of resp.body.versions) {
|
||||
for (let release of data.versions) {
|
||||
if (!release.downloads.chromedriver) {
|
||||
continue;
|
||||
}
|
||||
@@ -58,7 +70,7 @@ module.exports = async function (request) {
|
||||
version: version,
|
||||
download: asset.url,
|
||||
// I' not sure that this is actually statically built but it
|
||||
// seems to be and at worst we'll just get bug reports for Apline
|
||||
// seems to be and at worst we'll just get bug reports for Alpine
|
||||
libc: 'none',
|
||||
};
|
||||
|
||||
@@ -75,10 +87,15 @@ module.exports = async function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the latest 5 for demonstration
|
||||
all.releases = all.releases.slice(-20);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
module
|
||||
.exports()
|
||||
.then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the latest 20 for demonstration
|
||||
all.releases = all.releases.slice(-20);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Error:', err);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,16 +4,15 @@ var github = require('../_common/github.js');
|
||||
var owner = 'cilium';
|
||||
var repo = 'cilium-cli';
|
||||
|
||||
module.exports = async function (request) {
|
||||
let all = await github(request, owner, repo);
|
||||
module.exports = async function () {
|
||||
let all = await github(null, owner, repo);
|
||||
return all;
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
(async function () {
|
||||
let request = require('@root/request');
|
||||
let normalize = require('../_webi/normalize.js');
|
||||
let all = await module.exports(request);
|
||||
let all = await module.exports();
|
||||
all = normalize(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'Kitware';
|
||||
var repo = 'CMake';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
for (let rel of all.releases) {
|
||||
if (rel.version.startsWith('v')) {
|
||||
rel._version = rel.version.slice(1);
|
||||
@@ -44,7 +44,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -6,8 +6,8 @@ var repo = 'comrak';
|
||||
|
||||
var ODDITIES = ['-musleabihf.1-'];
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
let builds = [];
|
||||
|
||||
loopBuilds: for (let build of all.releases) {
|
||||
@@ -31,7 +31,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
//console.info(JSON.stringify(all));
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'sstadick';
|
||||
var repo = 'crabz';
|
||||
|
||||
module.exports = async function (request) {
|
||||
let all = await github(request, owner, repo);
|
||||
module.exports = async function () {
|
||||
let all = await github(null, owner, repo);
|
||||
|
||||
let releases = [];
|
||||
for (let rel of all.releases) {
|
||||
@@ -22,7 +22,7 @@ module.exports = async function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,15 +4,15 @@ var github = require('../_common/github.js');
|
||||
var owner = 'rs';
|
||||
var repo = 'curlie';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all._names = ['curlie', 'curl-httpie'];
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
//console.info(JSON.stringify(all));
|
||||
|
||||
@@ -100,8 +100,7 @@ mkdir -p ~/.dashcore/wallets/
|
||||
mkdir -p /mnt/slc1_vol_100g/dashcore/_data
|
||||
mkdir -p /mnt/slc1_vol_100g/dashcore/_caches
|
||||
|
||||
sudo env PATH="$PATH" serviceman add \
|
||||
--system --user "$my_user" --path "$PATH" --name dashd --force -- \
|
||||
serviceman add --name 'dashd' --daemon -- \
|
||||
dashd \
|
||||
-usehd \
|
||||
-conf="$HOME/.dashcore/dash.conf" \
|
||||
|
||||
@@ -84,20 +84,8 @@ fn_srv_install() { (
|
||||
my_name="dashd-${my_netname}"
|
||||
fi
|
||||
|
||||
my_system_args=""
|
||||
my_kernel="$(
|
||||
uname -s
|
||||
)"
|
||||
if test "Darwin" != "${my_kernel}"; then
|
||||
my_user="$(
|
||||
id -u -n
|
||||
)"
|
||||
my_system_args="--system --username ${my_user}"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2016,SC1090
|
||||
echo 'sudo env PATH="$PATH"' \
|
||||
"serviceman add ${my_system_args} --path \"\$PATH\" --name \"${my_name}\" --force --" \
|
||||
echo "serviceman add --name \"${my_name}\" --" \
|
||||
"dashd " \
|
||||
"${my_net_flag}" \
|
||||
-usehd \
|
||||
@@ -107,16 +95,16 @@ fn_srv_install() { (
|
||||
"-datadir=\"${my_datadir}\"" \
|
||||
"-blocksdir=\"${my_blocksdir}\""
|
||||
|
||||
echo ""
|
||||
echo "Installing latest 'serviceman'..."
|
||||
echo ""
|
||||
"$HOME/.local/bin/webi" serviceman > /dev/null
|
||||
if ! command -v serviceman > /dev/null; then
|
||||
echo ""
|
||||
echo "Installing 'serviceman'..."
|
||||
echo ""
|
||||
{
|
||||
"$HOME/.local/bin/webi" serviceman
|
||||
} > /dev/null
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
. ~/.config/envman/PATH.env || true
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
serviceman --version
|
||||
if ! command -v dashd > /dev/null; then
|
||||
export PATH="$HOME/.local/opt/dashcore/bin:$PATH"
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/.dashcore/wallets/"
|
||||
@@ -131,8 +119,7 @@ fn_srv_install() { (
|
||||
cd "${my_vol}" || return 1
|
||||
# leave options unquoted so they're interpreted separately
|
||||
# shellcheck disable=SC2086
|
||||
sudo env PATH="${PATH}" \
|
||||
serviceman add ${my_system_args} --path "${PATH}" --name "${my_name}" --force -- \
|
||||
serviceman add --name "${my_name}" -- \
|
||||
dashd \
|
||||
${my_net_flag} \
|
||||
-usehd \
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'dashpay';
|
||||
var repo = 'dash';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all.releases.forEach(function (rel) {
|
||||
if (rel.name.includes('osx64')) {
|
||||
rel.os = 'macos';
|
||||
@@ -22,7 +22,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -219,14 +219,7 @@ You can use [`serviceman`](../serviceman/):
|
||||
**Linux**
|
||||
|
||||
```sh
|
||||
sudo env PATH="$PATH" \
|
||||
serviceman add \
|
||||
--system \
|
||||
--username "$(id -n -u)" \
|
||||
--path "$PATH" \
|
||||
--name dashd \
|
||||
--force \
|
||||
-- \
|
||||
serviceman add --name 'dashd' -- \
|
||||
dashd \
|
||||
-usehd \
|
||||
-conf="$HOME/.dashcore/dash.conf" \
|
||||
@@ -239,11 +232,7 @@ sudo env PATH="$PATH" \
|
||||
**Mac**
|
||||
|
||||
```sh
|
||||
serviceman add \
|
||||
--path "$PATH" \
|
||||
--name dashd \
|
||||
--force \
|
||||
-- \
|
||||
serviceman add --name 'dashd' -- \
|
||||
dashd \
|
||||
-usehd \
|
||||
-conf="$HOME/.dashcore/dash.conf" \
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'dashhive';
|
||||
var repo = 'dashmsg';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'dandavison';
|
||||
var repo = 'delta';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 15 for demonstration
|
||||
all.releases = all.releases.slice(0, 15);
|
||||
|
||||
@@ -18,7 +18,7 @@ etc).
|
||||
The obligatory Hello World
|
||||
|
||||
```sh
|
||||
deno run https://deno.land/std/examples/welcome.ts
|
||||
deno run https://docs.deno.com/examples/scripts/hello_world.ts
|
||||
```
|
||||
|
||||
Run a local file
|
||||
|
||||
@@ -6,8 +6,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'denoland';
|
||||
var repo = 'deno';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
// remove checksums and .deb
|
||||
all.releases = all.releases
|
||||
.filter(function (rel) {
|
||||
@@ -35,7 +35,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'dotenv-linter';
|
||||
var repo = 'dotenv-linter';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'therootcompany';
|
||||
var repo = 'dotenv';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var githubSource = require('../_common/github-source.js');
|
||||
var owner = 'BeyondCodeBootcamp';
|
||||
var repo = 'DuckDNS.sh';
|
||||
let Releases = module.exports;
|
||||
|
||||
module.exports = function (request) {
|
||||
let arches = [
|
||||
'amd64',
|
||||
'arm64',
|
||||
'armv6l',
|
||||
'armv7l',
|
||||
'ppc64le',
|
||||
'ppc64',
|
||||
's390x',
|
||||
'x86',
|
||||
];
|
||||
let oses = ['freebsd', 'linux', 'macos', 'posix'];
|
||||
return githubSource(request, owner, repo, oses, arches).then(function (all) {
|
||||
all._names = ['DuckDNS.sh', 'duckdns.sh', 'legacy'];
|
||||
return all;
|
||||
});
|
||||
let GitHubSource = require('../_common/github-source.js');
|
||||
let owner = 'BeyondCodeBootcamp';
|
||||
let repo = 'DuckDNS.sh';
|
||||
|
||||
Releases.latest = async function () {
|
||||
let all = await GitHubSource.getDistributables({ owner, repo });
|
||||
for (let pkg of all.releases) {
|
||||
pkg.os = 'posix_2017';
|
||||
}
|
||||
return all;
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
Releases.latest().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -2,10 +2,16 @@
|
||||
set -e
|
||||
set -u
|
||||
|
||||
echo "'duckdns@${WEBI_TAG:-stable}' is reserved for future use."
|
||||
echo
|
||||
echo "Did you mean 'duckdns.sh@${WEBI_VERSION-}'?"
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webi.sh"}
|
||||
|
||||
echo ""
|
||||
echo " curl -fsSL '$WEBI_HOST/duckdns.sh@${WEBI_VERSION-}' | sh"
|
||||
echo "ERROR"
|
||||
echo " installer name 'duckdns' is reserved for future use"
|
||||
echo ""
|
||||
echo "SOLUTION"
|
||||
echo " Did you mean 'duckdns.sh'?"
|
||||
echo ""
|
||||
echo " curl -fsSL '$WEBI_HOST/duckdns.sh' | sh"
|
||||
echo ""
|
||||
|
||||
exit 1
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'sharkdp';
|
||||
var repo = 'fd';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
let builds = [];
|
||||
|
||||
for (let build of all.releases) {
|
||||
@@ -22,7 +22,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
//console.info(JSON.stringify(all));
|
||||
|
||||
@@ -6,8 +6,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'eugeneware';
|
||||
var repo = 'ffmpeg-static';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all.releases = all.releases
|
||||
.filter(function (rel) {
|
||||
let isFfmpeg = rel.name.includes('ffmpeg');
|
||||
@@ -38,7 +38,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'ffuf';
|
||||
var repo = 'ffuf';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -43,7 +43,7 @@ the file:
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
echo "Who am I? I'm $(whoami)."
|
||||
echo "Who am I? I'm $(id -u -n)."
|
||||
```
|
||||
|
||||
You can also run bash explicitly:
|
||||
@@ -99,7 +99,7 @@ You should use `chsh` to change your shell:
|
||||
```sh
|
||||
#!/bin/sh
|
||||
|
||||
sudo chsh -s "$(command -v fish)" "$(whoami)"
|
||||
sudo chsh -s "$(command -v fish)" "$(id -u -n)"
|
||||
```
|
||||
|
||||
If vim uses `fish` instead of `bash`, annoying errors will happen.
|
||||
|
||||
@@ -6,8 +6,8 @@ var repo = 'fish-shell';
|
||||
|
||||
var ODDITIES = ['bundledpcre'];
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all.releases = all.releases
|
||||
.map(function (rel) {
|
||||
for (let oddity of ODDITIES) {
|
||||
@@ -30,7 +30,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var FLUTTER_OSES = ['macos', 'linux', 'windows'];
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
// stable, beta, dev
|
||||
var channelMap = {};
|
||||
let FLUTTER_OSES = ['macos', 'linux', 'windows'];
|
||||
|
||||
/**
|
||||
* stable, beta, dev
|
||||
* @type {Object.<String, Boolean>}
|
||||
*/
|
||||
let channelMap = {};
|
||||
|
||||
// This can be spot-checked against
|
||||
// https://docs.flutter.dev/release/archive?tab=windows
|
||||
@@ -53,21 +58,45 @@ var channelMap = {};
|
||||
// ]
|
||||
// }
|
||||
|
||||
module.exports = async function (request) {
|
||||
/**
|
||||
* @typedef BuildInfo
|
||||
* @prop {String} version
|
||||
* @prop {String} [_version]
|
||||
* @prop {Boolean} lts
|
||||
* @prop {String} channel
|
||||
* @prop {String} date
|
||||
* @prop {String} download
|
||||
* @prop {String} [_filename]
|
||||
*/
|
||||
|
||||
module.exports = async function () {
|
||||
let all = {
|
||||
download: '',
|
||||
/** @type {Array<BuildInfo>} */
|
||||
releases: [],
|
||||
/** @type {Array<String>} */
|
||||
channels: [],
|
||||
};
|
||||
|
||||
for (let osname of FLUTTER_OSES) {
|
||||
let resp = await request({
|
||||
url: `https://storage.googleapis.com/flutter_infra_release/releases/releases_${osname}.json`,
|
||||
json: true,
|
||||
});
|
||||
let resp;
|
||||
try {
|
||||
let url = `https://storage.googleapis.com/flutter_infra_release/releases/releases_${osname}.json`;
|
||||
resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch 'flutter' release data for ${osname}: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
let data = JSON.parse(resp.body);
|
||||
|
||||
let osBaseUrl = resp.body.base_url;
|
||||
let osReleases = resp.body.releases;
|
||||
let osBaseUrl = data.base_url;
|
||||
let osReleases = data.releases;
|
||||
|
||||
for (let asset of osReleases) {
|
||||
if (!channelMap[asset.channel]) {
|
||||
@@ -80,7 +109,6 @@ module.exports = async function (request) {
|
||||
lts: false,
|
||||
channel: asset.channel,
|
||||
date: asset.release_date.replace(/T.*/, ''),
|
||||
//sha256: asset.sha256,
|
||||
download: `${osBaseUrl}/${asset.archive}`,
|
||||
_filename: asset.archive,
|
||||
});
|
||||
@@ -97,7 +125,7 @@ module.exports = async function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all.releases = all.releases.slice(25);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'junegunn';
|
||||
var repo = 'fzf';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
//console.info(JSON.stringify(all));
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'cli';
|
||||
var repo = 'cli';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -21,9 +21,10 @@ is a good place to get started if you're new to git.
|
||||
- Files
|
||||
- Commit Files
|
||||
- Ignore Files
|
||||
- Reasonable Defaults
|
||||
- Create Branch
|
||||
- Rebase by Default
|
||||
- Rebase
|
||||
- Auth via SSH
|
||||
- Auth via Token
|
||||
|
||||
### Files
|
||||
@@ -66,9 +67,49 @@ This will branch from the branch you're currently on.
|
||||
git switch -c my-branch-name
|
||||
```
|
||||
|
||||
### How to rebase by default
|
||||
### Reasonable Defaults for Git Config
|
||||
|
||||
- use SSH instead of HTTPS
|
||||
- default to 'main'
|
||||
- create on 'push'
|
||||
- stash on 'rebase'
|
||||
- default to 'rebase' (modern)
|
||||
|
||||
```sh
|
||||
#####################
|
||||
# ENFORCE SSH #
|
||||
#####################
|
||||
# replace HTTPS urls with SSH urls (to always use keys rather than tokens)
|
||||
|
||||
git config --global url."ssh://git@example.com/".insteadOf "https://example.com/"
|
||||
git config --global url."ssh://git@github.com/".insteadOf "https://github.com/"
|
||||
|
||||
######################
|
||||
# DEFAULT BRANCH #
|
||||
######################
|
||||
# Set the default branch for new repos (ex: 'main')
|
||||
|
||||
git config --global init.defaultBranch 'main'
|
||||
|
||||
######################
|
||||
# AUTOMATIC BRANCHES #
|
||||
######################
|
||||
# make 'git push' create branches if they don't exist on the remote
|
||||
|
||||
git config --global push.autoSetupRemote true
|
||||
|
||||
######################
|
||||
# REBASE AUTO-STASH #
|
||||
######################
|
||||
# stash immediately before rebase and unstash immediately after
|
||||
|
||||
git config --global rebase.autoStash true
|
||||
|
||||
######################
|
||||
# REBASE BY DEFAULT #
|
||||
######################
|
||||
# use 'rebase' rather than 'merge' or 'ff-only'
|
||||
|
||||
git config --global pull.rebase true
|
||||
```
|
||||
|
||||
@@ -102,6 +143,26 @@ git add ./my-merged-file
|
||||
git rebase --continue
|
||||
```
|
||||
|
||||
### How to authenticate git with SSH keys by default
|
||||
|
||||
```sh
|
||||
# Git, Gitea, etc
|
||||
git config --global url."ssh://git@git.example.com/".insteadOf "https://git.example.com/"
|
||||
git config --global url."ssh://git@git.example.com.com/".insteadOf "git@git.example.com.com:"
|
||||
|
||||
# GitHub
|
||||
git config --global url."ssh://git@github.com/".insteadOf "https://github.com/"
|
||||
git config --global url."ssh://git@github.com/".insteadOf "git@github.com:"
|
||||
|
||||
# GitLab
|
||||
git config --global url."ssh://git@gitlab.com/".insteadOf "https://gitlab.com/"
|
||||
git config --global url."ssh://git@gitlab.com/".insteadOf "git@gitlab.com:"
|
||||
|
||||
# BitBucket
|
||||
git config --global url."ssh://git@bitbucket.com/".insteadOf "https://bitbucket.com/"
|
||||
git config --global url."ssh://git@bitbucket.com/".insteadOf "git@bitbucket.com:"
|
||||
```
|
||||
|
||||
### How to authenticate git with deploy tokens
|
||||
|
||||
Abbreviated from
|
||||
|
||||
@@ -4,9 +4,9 @@ var github = require('../_common/github.js');
|
||||
var owner = 'git-for-windows';
|
||||
var repo = 'git';
|
||||
|
||||
module.exports = function (request) {
|
||||
module.exports = function () {
|
||||
// TODO support mac and linux tarballs
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
// See https://github.com/git-for-windows/git/wiki/MinGit
|
||||
// also consider https://github.com/git-for-windows/git/wiki/Silent-or-Unattended-Installation
|
||||
all.releases = all.releases
|
||||
@@ -26,7 +26,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'therootcompany';
|
||||
var repo = 'gitdeploy';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -6,8 +6,8 @@ var repo = 'gitea';
|
||||
|
||||
var ODDITIES = ['-gogit-', '-docs-'];
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
// remove checksums and .deb
|
||||
all.releases = all.releases.filter(function (rel) {
|
||||
for (let oddity of ODDITIES) {
|
||||
@@ -27,7 +27,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -17,7 +17,6 @@ including:
|
||||
|
||||
- [godoc](https://pkg.go.dev/golang.org/x/tools/cmd/godoc)
|
||||
- [gopls](https://pkg.go.dev/golang.org/x/tools/gopls)
|
||||
- [guru](https://pkg.go.dev/golang.org/x/tools/cmd/guru)
|
||||
- [golint](https://pkg.go.dev/golang.org/x/lint/golint)
|
||||
- [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports)
|
||||
- [gomvpkg](https://pkg.go.dev/golang.org/x/tools/cmd/gomvpkg)
|
||||
|
||||
@@ -16,10 +16,6 @@ Write-Output ""
|
||||
Write-Output gopls
|
||||
& go install golang.org/x/tools/gopls@latest
|
||||
|
||||
Write-Output ""
|
||||
Write-Output guru
|
||||
& go install golang.org/x/tools/guru@latest
|
||||
|
||||
Write-Output ""
|
||||
Write-Output golint
|
||||
& go install golang.org/x/lint/golint@latest
|
||||
|
||||
@@ -44,10 +44,6 @@ __run_go_essentials() {
|
||||
echo gopls
|
||||
go "${my_install}" golang.org/x/tools/gopls@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo guru
|
||||
go "${my_install}" golang.org/x/tools/cmd/guru@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo golint
|
||||
go "${my_install}" golang.org/x/lint/golint@latest > /dev/null #2>/dev/null
|
||||
|
||||
@@ -80,8 +80,7 @@ webi serviceman
|
||||
pushd ./hello/
|
||||
|
||||
# swap 'hello' and './hello' for the name of your project and binary
|
||||
sudo env PATH="$PATH" \
|
||||
serviceman add --system --username "$(whoami)" --name hello -- \
|
||||
serviceman add --name 'hello' -- \
|
||||
./hello
|
||||
|
||||
# Restart the logging service
|
||||
|
||||
131
go/releases.js
131
go/releases.js
@@ -1,14 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var osMap = {
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
/** @type {Object.<String, String>} */
|
||||
let osMap = {
|
||||
darwin: 'macos',
|
||||
};
|
||||
var archMap = {
|
||||
/** @type {Object.<String, String>} */
|
||||
let archMap = {
|
||||
386: 'x86',
|
||||
};
|
||||
|
||||
let ODDITIES = ['bootstrap', '-arm6.'];
|
||||
|
||||
/**
|
||||
* @param {String} filename
|
||||
*/
|
||||
function isOdd(filename) {
|
||||
for (let oddity of ODDITIES) {
|
||||
let isOddity = filename.includes(oddity);
|
||||
@@ -18,7 +25,22 @@ function isOdd(filename) {
|
||||
}
|
||||
}
|
||||
|
||||
function getAllReleases(request) {
|
||||
/**
|
||||
* @typedef BuildInfo
|
||||
* @prop {String} version
|
||||
* @prop {String} [_version]
|
||||
* @prop {String} arch
|
||||
* @prop {String} channel
|
||||
* @prop {String} date
|
||||
* @prop {String} download
|
||||
* @prop {String} ext
|
||||
* @prop {String} [_filename]
|
||||
* @prop {String} hash
|
||||
* @prop {Boolean} lts
|
||||
* @prop {String} os
|
||||
*/
|
||||
|
||||
async function getDistributables() {
|
||||
/*
|
||||
{
|
||||
version: 'go1.13.8',
|
||||
@@ -37,60 +59,71 @@ function getAllReleases(request) {
|
||||
]
|
||||
};
|
||||
*/
|
||||
return request({
|
||||
url: 'https://golang.org/dl/?mode=json&include=all',
|
||||
json: true,
|
||||
}).then((resp) => {
|
||||
var goReleases = resp.body;
|
||||
var all = {
|
||||
releases: [],
|
||||
download: '',
|
||||
};
|
||||
|
||||
goReleases.forEach((release) => {
|
||||
// strip 'go' prefix, standardize version
|
||||
var parts = release.version.slice(2).split('.');
|
||||
while (parts.length < 3) {
|
||||
parts.push('0');
|
||||
}
|
||||
var version = parts.join('.');
|
||||
// nix 'go' prefix
|
||||
var fileversion = release.version.slice(2);
|
||||
|
||||
release.files.forEach((asset) => {
|
||||
let odd = isOdd(asset.filename);
|
||||
if (odd) {
|
||||
return;
|
||||
}
|
||||
|
||||
var filename = asset.filename;
|
||||
var os = osMap[asset.os] || asset.os || '-';
|
||||
var arch = archMap[asset.arch] || asset.arch || '-';
|
||||
all.releases.push({
|
||||
version: version,
|
||||
_version: fileversion,
|
||||
// all go versions >= 1.0.0 are effectively LTS
|
||||
lts: (parts[0] > 0 && release.stable) || false,
|
||||
channel: (release.stable && 'stable') || 'beta',
|
||||
date: '1970-01-01', // the world may never know
|
||||
os: os,
|
||||
arch: arch,
|
||||
ext: '', // let normalize run the split/test/join
|
||||
hash: '-', // not ready to standardize this yet
|
||||
download: `https://dl.google.com/go/${filename}`,
|
||||
});
|
||||
});
|
||||
let resp;
|
||||
try {
|
||||
let url = 'https://golang.org/dl/?mode=json&include=all';
|
||||
resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch 'Go' release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
let goReleases = JSON.parse(resp.body);
|
||||
|
||||
return all;
|
||||
});
|
||||
let all = {
|
||||
/** @type {Array<BuildInfo>} */
|
||||
releases: [],
|
||||
download: '',
|
||||
};
|
||||
|
||||
for (let release of goReleases) {
|
||||
// Strip 'go' prefix, standardize version
|
||||
let parts = release.version.slice(2).split('.');
|
||||
while (parts.length < 3) {
|
||||
parts.push('0');
|
||||
}
|
||||
let version = parts.join('.');
|
||||
let fileversion = release.version.slice(2);
|
||||
|
||||
for (let asset of release.files) {
|
||||
if (isOdd(asset.filename)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let filename = asset.filename;
|
||||
let os = osMap[asset.os] || asset.os || '-';
|
||||
let arch = archMap[asset.arch] || asset.arch || '-';
|
||||
let build = {
|
||||
version: version,
|
||||
_version: fileversion,
|
||||
lts: (parts[0] > 0 && release.stable) || false,
|
||||
channel: (release.stable && 'stable') || 'beta',
|
||||
date: '1970-01-01', // the world may never know
|
||||
os: os,
|
||||
arch: arch,
|
||||
ext: '', // let normalize run the split/test/join
|
||||
hash: '-', // not ready to standardize this yet
|
||||
download: `https://dl.google.com/go/${filename}`,
|
||||
};
|
||||
all.releases.push(build);
|
||||
}
|
||||
}
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases(require('@root/request')).then(function (all) {
|
||||
getDistributables().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
//@ts-expect-error
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -85,8 +85,7 @@ webi serviceman
|
||||
pushd ./hello/
|
||||
|
||||
# swap 'hello' and './hello' for the name of your project and binary
|
||||
sudo env PATH="$PATH" \
|
||||
serviceman add --system --username "$(whoami)" --name hello -- \
|
||||
serviceman add --name 'hello' -- \
|
||||
./hello
|
||||
|
||||
# Restart the logging service
|
||||
|
||||
@@ -4,15 +4,15 @@ var github = require('../_common/github.js');
|
||||
var owner = 'goreleaser';
|
||||
var repo = 'goreleaser';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all._names = ['goreleaser', '1'];
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
114
gpg/releases.js
114
gpg/releases.js
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
let ltsRe = /GnuPG-(2\.2\.[\d\.]+)/;
|
||||
|
||||
function createRssMatcher() {
|
||||
@@ -16,12 +18,42 @@ function createUrlMatcher() {
|
||||
);
|
||||
}
|
||||
|
||||
async function getRawReleases(request) {
|
||||
let matcher = createRssMatcher();
|
||||
/**
|
||||
* @typedef BuildInfo
|
||||
* @prop {String} version
|
||||
* @prop {String} [_version]
|
||||
* @prop {String} arch
|
||||
* @prop {String} channel
|
||||
* @prop {String} date
|
||||
* @prop {String} download
|
||||
* @prop {String} ext
|
||||
* @prop {String} [_filename]
|
||||
* @prop {String} hash
|
||||
* @prop {Boolean} lts
|
||||
* @prop {String} os
|
||||
*/
|
||||
|
||||
let resp = await request({
|
||||
url: 'https://sourceforge.net/projects/gpgosx/rss?path=/',
|
||||
});
|
||||
async function getRawReleases() {
|
||||
let resp;
|
||||
try {
|
||||
let url = 'https://sourceforge.net/projects/gpgosx/rss?path=/';
|
||||
resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'application/rss+xml' },
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch 'gpg' release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
let contentType = resp.headers.get('Content-Type');
|
||||
if (!contentType?.includes('xml')) {
|
||||
throw new Error(`Unexpected content type: ${contentType}`);
|
||||
}
|
||||
|
||||
let matcher = createRssMatcher();
|
||||
let links = [];
|
||||
for (;;) {
|
||||
let m = matcher.exec(resp.body);
|
||||
@@ -30,62 +62,66 @@ async function getRawReleases(request) {
|
||||
}
|
||||
links.push(m[1]);
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<String>} links
|
||||
*/
|
||||
function transformReleases(links) {
|
||||
//console.log(JSON.stringify(links, null, 2));
|
||||
//console.log(links.length);
|
||||
|
||||
let matcher = createUrlMatcher();
|
||||
|
||||
let releases = links
|
||||
.map(function (link) {
|
||||
let isLts = ltsRe.test(link);
|
||||
let parts = link.match(matcher);
|
||||
if (!parts || !parts[2]) {
|
||||
return null;
|
||||
}
|
||||
let segs = parts[2].split('.');
|
||||
let version = segs.slice(0, 3).join('.');
|
||||
if (segs.length > 3) {
|
||||
version += '+' + segs.slice(3);
|
||||
}
|
||||
let fileversion = segs.join('.');
|
||||
let builds = [];
|
||||
for (let link of links) {
|
||||
let isLts = ltsRe.test(link);
|
||||
let parts = link.match(matcher);
|
||||
if (!parts || !parts[2]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return {
|
||||
name: parts[1],
|
||||
version: version,
|
||||
_version: fileversion,
|
||||
// all go versions >= 1.0.0 are effectively LTS
|
||||
lts: isLts,
|
||||
channel: 'stable',
|
||||
// TODO <pubDate>Sat, 19 Nov 2016 16:17:33 UT</pubDate>
|
||||
date: '1970-01-01', // the world may never know
|
||||
os: 'macos',
|
||||
arch: 'amd64',
|
||||
ext: 'dmg',
|
||||
download: link,
|
||||
};
|
||||
})
|
||||
.filter(Boolean);
|
||||
let segs = parts[2].split('.');
|
||||
let version = segs.slice(0, 3).join('.');
|
||||
if (segs.length > 3) {
|
||||
version += '+' + segs.slice(3);
|
||||
}
|
||||
let fileversion = segs.join('.');
|
||||
|
||||
let build = {
|
||||
name: parts[1],
|
||||
version: version,
|
||||
_version: fileversion,
|
||||
lts: isLts,
|
||||
channel: 'stable',
|
||||
// TODO <pubDate>Sat, 19 Nov 2016 16:17:33 UT</pubDate>
|
||||
date: '1970-01-01', // the world may never know
|
||||
os: 'macos',
|
||||
arch: 'amd64',
|
||||
ext: 'dmg',
|
||||
download: link,
|
||||
};
|
||||
builds.push(build);
|
||||
}
|
||||
|
||||
return {
|
||||
_names: ['GnuPG', 'gpgosx'],
|
||||
releases: releases,
|
||||
releases: builds,
|
||||
};
|
||||
}
|
||||
|
||||
async function getAllReleases(request) {
|
||||
let releases = await getRawReleases(request);
|
||||
async function getDistributables() {
|
||||
let releases = await getRawReleases();
|
||||
let all = transformReleases(releases);
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases(require('@root/request')).then(function (all) {
|
||||
getDistributables().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10000);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'creedasaurus';
|
||||
var repo = 'gprox';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'anchore';
|
||||
var repo = 'grype';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'sharkdp';
|
||||
var repo = 'hexyl';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
//console.info(JSON.stringify(all));
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'gohugoio';
|
||||
var repo = 'hugo';
|
||||
|
||||
module.exports = async function (request) {
|
||||
let all = await github(request, owner, repo);
|
||||
module.exports = async function () {
|
||||
let all = await github(null, owner, repo);
|
||||
|
||||
all.releases = all.releases.filter(function (rel) {
|
||||
let isExtended = rel.name.includes('_extended_');
|
||||
@@ -25,7 +25,7 @@ module.exports = async function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'gohugoio';
|
||||
var repo = 'hugo';
|
||||
|
||||
module.exports = async function (request) {
|
||||
let all = await github(request, owner, repo);
|
||||
module.exports = async function () {
|
||||
let all = await github(null, owner, repo);
|
||||
|
||||
all.releases = all.releases.filter(function (rel) {
|
||||
let isExtended = rel.name.includes('_extended_');
|
||||
@@ -25,7 +25,7 @@ module.exports = async function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -1,73 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
function getRawReleases(request) {
|
||||
return request({ url: 'https://iterm2.com/downloads.html' }).then(
|
||||
function (resp) {
|
||||
var links = resp.body
|
||||
.split(/[<>]+/g)
|
||||
.map(function (str) {
|
||||
var m = str.match(
|
||||
/href="(https:\/\/iterm2\.com\/downloads\/.*\.zip)"/,
|
||||
);
|
||||
if (m && /iTerm2-[34]/.test(m[1])) {
|
||||
return m[1];
|
||||
}
|
||||
})
|
||||
.filter(Boolean);
|
||||
return links;
|
||||
},
|
||||
);
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
async function getRawReleases() {
|
||||
let resp;
|
||||
try {
|
||||
let url = 'https://iterm2.com/downloads.html';
|
||||
resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'text/html' },
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch 'iterm2' release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
let contentType = resp.headers.get('Content-Type');
|
||||
if (!contentType || !contentType.includes('text/html')) {
|
||||
throw new Error(`Unexpected Content-Type: ${contentType}`);
|
||||
}
|
||||
|
||||
let lines = resp.body.split(/[<>]+/g);
|
||||
|
||||
/** @type {Array<String>} */
|
||||
let links = [];
|
||||
for (let str of lines) {
|
||||
let m = str.match(/href="(https:\/\/iterm2\.com\/downloads\/.*\.zip)"/);
|
||||
if (m && /iTerm2-[34]/.test(m[1])) {
|
||||
if (m[1]) {
|
||||
links.push(m[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<String>} links
|
||||
*/
|
||||
function transformReleases(links) {
|
||||
//console.log(JSON.stringify(links, null, 2));
|
||||
//console.log(links.length);
|
||||
let builds = [];
|
||||
for (let link of links) {
|
||||
let channel = /\/stable\//.test(link) ? 'stable' : 'beta';
|
||||
|
||||
let parts = link.replace(/.*\/iTerm2[-_]v?(\d_.*)\.zip/, '$1').split('_');
|
||||
let version = parts.join('.').replace(/([_-])?beta/, '-beta');
|
||||
|
||||
// ex: 3.5.0-beta17 => 3_5_0beta17
|
||||
// ex: 3.0.2-preview => 3_0_2-preview
|
||||
let fileversion = version.replace(/\./g, '_');
|
||||
fileversion = fileversion.replace(/-beta/g, 'beta');
|
||||
|
||||
let build = {
|
||||
version: version,
|
||||
_version: fileversion,
|
||||
lts: 'stable' === channel,
|
||||
channel: channel,
|
||||
date: '1970-01-01', // the world may never know
|
||||
os: 'macos',
|
||||
arch: 'amd64',
|
||||
ext: '', // let normalize run the split/test/join
|
||||
download: link,
|
||||
};
|
||||
builds.push(build);
|
||||
}
|
||||
|
||||
return {
|
||||
_names: ['iTerm2', 'iterm2'],
|
||||
releases: links
|
||||
.map(function (link) {
|
||||
var channel = /\/stable\//.test(link) ? 'stable' : 'beta';
|
||||
|
||||
var parts = link
|
||||
.replace(/.*\/iTerm2[-_]v?(\d_.*)\.zip/, '$1')
|
||||
.split('_');
|
||||
var version = parts.join('.').replace(/([_-])?beta/, '-beta');
|
||||
|
||||
// ex: 3.5.0-beta17 => 3_5_0beta17
|
||||
// ex: 3.0.2-preview => 3_0_2-preview
|
||||
let fileversion = version.replace(/\./g, '_');
|
||||
fileversion = fileversion.replace(/-beta/g, 'beta');
|
||||
|
||||
return {
|
||||
version: version,
|
||||
_version: fileversion,
|
||||
// all go versions >= 1.0.0 are effectively LTS
|
||||
lts: 'stable' === channel,
|
||||
channel: channel,
|
||||
date: '1970-01-01', // the world may never know
|
||||
os: 'macos',
|
||||
arch: 'amd64',
|
||||
ext: '', // let normalize run the split/test/join
|
||||
download: link,
|
||||
};
|
||||
})
|
||||
.filter(Boolean),
|
||||
releases: builds,
|
||||
};
|
||||
}
|
||||
|
||||
function getAllReleases(request) {
|
||||
return getRawReleases(request)
|
||||
.then(transformReleases)
|
||||
.then(function (all) {
|
||||
return all;
|
||||
});
|
||||
async function getDistributables() {
|
||||
let rawReleases = await getRawReleases();
|
||||
let all = transformReleases(rawReleases);
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases(require('@root/request')).then(function (all) {
|
||||
getDistributables().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10000);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
|
||||
@@ -15,8 +15,8 @@ function isOdd(build) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
let builds = [];
|
||||
|
||||
for (let build of all.releases) {
|
||||
@@ -35,7 +35,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
//console.info(JSON.stringify(all, null, 2));
|
||||
|
||||
114
jsconfig.json
Normal file
114
jsconfig.json
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
|
||||
/* Modules */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
"typeRoots": ["./typings","./node_modules/@types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
/* JavaScript Support */
|
||||
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
"noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||
|
||||
/* Interop Constraints */
|
||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||
"alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
},
|
||||
"include": [
|
||||
"*.js",
|
||||
"*/*.js"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -1,31 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
var osMap = {
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
/** @type {Object.<String, String>} */
|
||||
let osMap = {
|
||||
winnt: 'windows',
|
||||
mac: 'darwin',
|
||||
};
|
||||
var archMap = {
|
||||
|
||||
/** @type {Object.<String, String>} */
|
||||
let archMap = {
|
||||
armv7l: 'armv7',
|
||||
i686: 'x86',
|
||||
powerpc64le: 'ppc64le',
|
||||
};
|
||||
|
||||
async function getAllReleases() {
|
||||
/**
|
||||
* @typedef BuildInfo
|
||||
* @prop {String} version
|
||||
* @prop {String} [_version]
|
||||
* @prop {String} [arch]
|
||||
* @prop {String} channel
|
||||
* @prop {String} date
|
||||
* @prop {String} download
|
||||
* @prop {String} [ext]
|
||||
* @prop {String} [_filename]
|
||||
* @prop {String} [hash]
|
||||
* @prop {String} [libc]
|
||||
* @prop {Boolean} [_musl]
|
||||
* @prop {Boolean} [lts]
|
||||
* @prop {String} [size]
|
||||
* @prop {String} os
|
||||
*/
|
||||
|
||||
async function getDistributables() {
|
||||
let all = {
|
||||
/** @type {Array<BuildInfo>} */
|
||||
releases: [],
|
||||
download: '',
|
||||
_names: ['julia', 'macaarch64'],
|
||||
};
|
||||
|
||||
let resp = await fetch(
|
||||
'https://julialang-s3.julialang.org/bin/versions.json',
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
},
|
||||
);
|
||||
let buildsByVersion = await resp.json();
|
||||
let resp;
|
||||
try {
|
||||
let url = 'https://julialang-s3.julialang.org/bin/versions.json';
|
||||
resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch 'julia' release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
let buildsByVersion = JSON.parse(resp.body);
|
||||
|
||||
/*
|
||||
{
|
||||
@@ -105,6 +135,12 @@ async function getAllReleases() {
|
||||
return all;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} a
|
||||
* @param {String} a.version
|
||||
* @param {Object} b
|
||||
* @param {String} b.version
|
||||
*/
|
||||
function sortByVersion(a, b) {
|
||||
let [aVer, aPre] = a.version.split('-');
|
||||
let [bVer, bPre] = b.version.split('-');
|
||||
@@ -134,10 +170,10 @@ function sortByVersion(a, b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
module.exports = getAllReleases;
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
getAllReleases().then(function (all) {
|
||||
getDistributables().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'derailed';
|
||||
var repo = 'k9s';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'therootcompany';
|
||||
var repo = 'keypairs';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -12,14 +12,14 @@ var repo = 'kind';
|
||||
/** **/
|
||||
/******************************************************************************/
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -26,7 +26,7 @@ You can use koji in one of two ways:
|
||||
Here's the shortlist of options we've found most useful:
|
||||
|
||||
```text
|
||||
-e, --emoji - use emoji for commit type (ex: `✨ feat:`)
|
||||
-e, --emoji - use emoji for commit summary (ex: `feat: ✨ ...`)
|
||||
-a, --autocomplete - guess 'scope' based on commit history (slow on large projects)
|
||||
--hook - expect to be run from 'git commit', rather than wrap it
|
||||
```
|
||||
@@ -72,8 +72,8 @@ git commit
|
||||
|
||||
### How to use Emoji
|
||||
|
||||
You can use `-e` (or `--emoji`) to prepend your commit message with the relevant
|
||||
emoji for the commit type:
|
||||
You can use `-e` (or `--emoji`) to prepend your commit message summary with the
|
||||
relevant emoji for the commit type:
|
||||
|
||||
```sh
|
||||
koji -e
|
||||
@@ -91,18 +91,20 @@ koji --emoji --hook
|
||||
You can also use _shortcodes_ (`:pinched_fingers:`) in the scope, summary, or
|
||||
body.
|
||||
|
||||
### How to configure Koji (custom emoji)
|
||||
### How to configure koji
|
||||
|
||||
You can add custom commit types via a `koji.toml` in the project directory.
|
||||
You can configure koji via a custom config passed with `--config`, a
|
||||
`.koji.toml` file in the project root, or a user config at
|
||||
`~/.config/koji/config.toml`.
|
||||
|
||||
For example:
|
||||
Here's an example of a custom commit type:
|
||||
|
||||
```toml
|
||||
[[commit_types]]
|
||||
name = "feat"
|
||||
name = "cust"
|
||||
emoji = "✨"
|
||||
description = "A new feature"
|
||||
description = "A custom commit type"
|
||||
```
|
||||
|
||||
The default emoji can be seen in
|
||||
The default configuration can be seen in
|
||||
[default.toml](https://github.com/cococonscious/koji/blob/main/meta/config/default.toml).
|
||||
|
||||
@@ -19,17 +19,28 @@ __init_koji() {
|
||||
# ~/.local/opt/koji-v1.5.0/bin
|
||||
mkdir -p "$(dirname "$pkg_src_cmd")"
|
||||
|
||||
# mv ./koji-*/koji ~/.local/opt/koji-v1.5.0/bin/koji
|
||||
mv ./koji-*/koji "$pkg_src_cmd"
|
||||
if test -f ./koji; then
|
||||
# mv koji ~/.local/opt/koji-v1.5.0/bin/koji
|
||||
mv ./koji "$pkg_src_cmd"
|
||||
elif test -e ./koji-*/koji; then
|
||||
# mv koji-1.4.0/koji ~/.local/opt/koji-v1.4.0/bin/koji
|
||||
mv ./koji-*/koji "$pkg_src_cmd"
|
||||
elif test -e ./koji-*; then
|
||||
# mv koji-linux-amd64 ~/.local/opt/koji-v1.2.0/bin/koji
|
||||
mv ./koji-* "$pkg_src_cmd"
|
||||
else
|
||||
echo >&2 "failed to find 'koji' exectutable"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# pkg_get_current_version is recommended, but (soon) not required
|
||||
pkg_get_current_version() {
|
||||
# 'koji version' has output in this format:
|
||||
# 'koji --version' has output in this format:
|
||||
# koji 1.5.0
|
||||
# This trims it down to just the version number:
|
||||
# 1.5.0
|
||||
koji --version 2> /dev/null | cut -c6-
|
||||
koji --version 2> /dev/null | head -n 1 | cut -d' ' -f2
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'cococonscious';
|
||||
var repo = 'koji';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
console.info(JSON.stringify(all));
|
||||
});
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'ahmetb';
|
||||
var repo = 'kubectx';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
let builds = [];
|
||||
|
||||
for (let build of all.releases) {
|
||||
@@ -28,7 +28,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'ahmetb';
|
||||
var repo = 'kubectx';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
let builds = [];
|
||||
|
||||
for (let build of all.releases) {
|
||||
@@ -28,7 +28,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'gokcehan';
|
||||
var repo = 'lf';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all.releases = all.releases.map(function (r) {
|
||||
// r21 -> 0.21.0
|
||||
if (/^r/.test(r.version)) {
|
||||
@@ -18,7 +18,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')._debug(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
@@ -4,8 +4,8 @@ var github = require('../_common/github.js');
|
||||
var owner = 'lsd-rs';
|
||||
var repo = 'lsd';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all.releases = all.releases.filter(function (rel) {
|
||||
return !/(-msvc\.)|(\.deb$)/.test(rel.name);
|
||||
});
|
||||
@@ -14,7 +14,7 @@ module.exports = function (request) {
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var oses = [
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
let oses = [
|
||||
{
|
||||
name: 'macOS Sierra',
|
||||
version: '10.12.6',
|
||||
@@ -25,7 +27,7 @@ var oses = [
|
||||
},
|
||||
];
|
||||
|
||||
var headers = {
|
||||
let headers = {
|
||||
Connection: 'keep-alive',
|
||||
'Cache-Control': 'max-age=0',
|
||||
'Upgrade-Insecure-Requests': '1',
|
||||
@@ -40,55 +42,103 @@ var headers = {
|
||||
'Accept-Language': 'en-US,en;q=0.9,sq;q=0.8',
|
||||
};
|
||||
|
||||
module.exports = function (request) {
|
||||
var all = {
|
||||
/**
|
||||
* @param {typeof oses[0]} os
|
||||
*/
|
||||
async function fetchReleasesForOS(os) {
|
||||
let resp;
|
||||
try {
|
||||
resp = await Fetcher.fetch(os.url, {
|
||||
headers: headers,
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error & { code: string, response: { status: number, body: string } }} */ //@ts-expect-error
|
||||
let err = e;
|
||||
if (err.code === 'E_FETCH_RELEASES') {
|
||||
err.message = `failed to fetch 'macos' release data: ${err.response.status} ${err.response.body}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Extract the download link
|
||||
let match = resp.body.match(/(http[^>]+Install[^>]+\.dmg)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef BuildInfo
|
||||
* @prop {String} version
|
||||
* @prop {String} [_version]
|
||||
* @prop {String} arch
|
||||
* @prop {String} channel
|
||||
* @prop {String} date
|
||||
* @prop {String} download
|
||||
* @prop {String} ext
|
||||
* @prop {String} [_filename]
|
||||
* @prop {String} hash
|
||||
* @prop {Boolean} lts
|
||||
* @prop {String} os
|
||||
*/
|
||||
|
||||
let osnames = ['macos', 'linux'];
|
||||
|
||||
async function getDistributables() {
|
||||
let all = {
|
||||
_names: ['InstallOS'],
|
||||
download: '',
|
||||
/** @type {Array<BuildInfo>} */
|
||||
releases: [],
|
||||
};
|
||||
|
||||
return Promise.all(
|
||||
oses.map(function (os) {
|
||||
return request({
|
||||
method: 'GET',
|
||||
url: os.url,
|
||||
headers: headers,
|
||||
}).then(function (resp) {
|
||||
var m = resp.body.match(/(http[^>]+Install[^>]+.dmg)/);
|
||||
var download = m && m[1];
|
||||
['macos', 'linux'].forEach(function (osname) {
|
||||
all.releases.push({
|
||||
version: os.version,
|
||||
lts: os.lts || false,
|
||||
channel: os.channel || 'beta',
|
||||
date: os.date,
|
||||
os: osname,
|
||||
arch: 'amd64',
|
||||
ext: 'dmg',
|
||||
hash: '-',
|
||||
download: download,
|
||||
});
|
||||
});
|
||||
});
|
||||
}),
|
||||
).then(function () {
|
||||
all.releases.sort(function (a, b) {
|
||||
if ('10.11.6' === a.version) {
|
||||
return -1;
|
||||
}
|
||||
if (a.date > b.date) {
|
||||
return 1;
|
||||
}
|
||||
if (a.date < b.date) {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
return all;
|
||||
// Fetch data for each OS and populate the releases array
|
||||
for (let os of oses) {
|
||||
let download = await fetchReleasesForOS(os);
|
||||
if (!download) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add releases for macOS and Linux
|
||||
for (let osname of osnames) {
|
||||
let build = {
|
||||
version: os.version,
|
||||
lts: os.lts || false,
|
||||
channel: os.channel || 'beta',
|
||||
date: os.date,
|
||||
os: osname,
|
||||
arch: 'amd64',
|
||||
ext: 'dmg',
|
||||
hash: '-',
|
||||
download: download,
|
||||
};
|
||||
|
||||
all.releases.push(build);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort releases
|
||||
all.releases.sort(function (a, b) {
|
||||
if (a.version === '10.11.6') {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (a.date > b.date) {
|
||||
return 1;
|
||||
} else if (a.date < b.date) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
};
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
module.exports = getDistributables;
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
11
mariadb-server/README.md
Normal file
11
mariadb-server/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: MariaDB Server (MariaDB alias)
|
||||
homepage: https://webinstall.dev/mariadb
|
||||
tagline: |
|
||||
Alias for https://webinstall.dev/mariadb
|
||||
alias: mariadb
|
||||
description: |
|
||||
See https://webinstall.dev/mariadb
|
||||
---
|
||||
|
||||
Alias for https://webinstall.dev/mariadb
|
||||
12
mariadb-server/install.sh
Executable file
12
mariadb-server/install.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
__redirect_alias_mariadb() {
|
||||
echo "'mariadb-server' is an alias for 'mariadb'"
|
||||
sleep 2.5
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webi.sh"}
|
||||
curl -fsSL "$WEBI_HOST/mariadb@${WEBI_VERSION-}" | sh
|
||||
}
|
||||
|
||||
__redirect_alias_mariadb
|
||||
220
mariadb/README.md
Normal file
220
mariadb/README.md
Normal file
@@ -0,0 +1,220 @@
|
||||
---
|
||||
title: MariaDB (MySQL)
|
||||
homepage: https://mariadb.com/
|
||||
tagline: |
|
||||
MariaDB: The original MySQL, renamed due to Oracle acquiring the trademark
|
||||
---
|
||||
|
||||
To update or switch versions, run `webi mariadb@stable` (or `@v11`, `@lts`,
|
||||
etc).
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```text
|
||||
~/.config/envman/PATH.env
|
||||
~/.local/opt/mariadb/
|
||||
~/.local/share/mariadb/
|
||||
~/.my.cnf
|
||||
~/.config/mariadb/my.cnf
|
||||
~/.local/share/mariadb/my.cnf
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> MariaDB is the original authors' successor to MySQL, after Oracle's
|
||||
> acquisition of the MySQL trademark. Although [Postgres](../postgres/) is
|
||||
> generally recommended for new projects, projects that previously used MySQL or
|
||||
> MariaDB can continue to gain benefit from the continued development of
|
||||
> MariaDB.
|
||||
|
||||
Connect as the default admin, the root admin, or a remote (`%`) user:
|
||||
|
||||
```sh
|
||||
mysql 'dbname'
|
||||
sudo mysql -u root 'dbname'
|
||||
mysql -u 'dbuser' -p -h '127.0.0.1' -P 3306 'dbname'
|
||||
```
|
||||
|
||||
Manage MariaDB as a system service with [serviceman](../serviceman/):
|
||||
|
||||
```sh
|
||||
curl https://webi.sh/serviceman | sh
|
||||
|
||||
# Linux and macOS
|
||||
serviceman add --name 'mysqld' --workdir ~/.local/opt/mariadb/ -- \
|
||||
mariadbd --defaults-file="$HOME/.local/share/mariadb/my.cnf"
|
||||
|
||||
# On Linux, with systemd
|
||||
sudo systemctl restart systemd-journald
|
||||
sudo systemctl restart 'mysqld'
|
||||
sudo journalctl -xef --unit 'mysqld'
|
||||
```
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- Use UTF-8 (not Swedish)
|
||||
- Vertical Rows
|
||||
- Create an App User and DB
|
||||
- Backup and Restore
|
||||
- Connect via SSH Proxy
|
||||
- Remove default users
|
||||
|
||||
### Switch from Swedish to UTF-8
|
||||
|
||||
This is done automatically if installed by Webi, and in MariaDB 11.6+.
|
||||
|
||||
Edit your `my.cnf` files as follows:
|
||||
|
||||
```sh
|
||||
[server]
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
init-connect = 'SET NAMES utf8mb4'
|
||||
```
|
||||
|
||||
```sh
|
||||
[client]
|
||||
default-character-set = utf8mb4
|
||||
```
|
||||
|
||||
You can then update old tables:
|
||||
|
||||
```sql
|
||||
ALTER DATABASE your_database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||
```
|
||||
|
||||
See <https://chatgpt.com/c/67941f5a-9390-800e-86e7-2e8bd56117f7>.
|
||||
|
||||
In some cases it may be simpler better to **backup and restore** (see table of
|
||||
contents) the databases due to foreign key constraints.
|
||||
|
||||
### How to View Rows Vertically
|
||||
|
||||
Use `\G` instead of `;` for a single query
|
||||
|
||||
```sh
|
||||
SELECT * FROM `mysql`.`global_priv` \G
|
||||
```
|
||||
|
||||
### How to Create an App User + DB
|
||||
|
||||
You create a database, a user (typically of the same name), a password
|
||||
(typically random via `xxd` or <https://pw.bnna.net>), and grant the app admin
|
||||
privileges on its database.
|
||||
|
||||
```sql
|
||||
USE `mysql`;
|
||||
CREATE DATABASE `appdb`;
|
||||
CREATE USER 'appuser'@'%' IDENTIFIED BY 'super-secret';
|
||||
GRANT ALL PRIVILEGES ON `appdb`.* TO 'appuser'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
Here's a script for doing the same:
|
||||
|
||||
```sh
|
||||
mariadb-create-app 'foobar'
|
||||
```
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# USAGE
|
||||
# mariadb-create-app [app-name]
|
||||
#
|
||||
# EXAMPLE
|
||||
# mariadb-create-app 'foobar'
|
||||
|
||||
main() {(
|
||||
b_appname="${1:-$(hostname)}"
|
||||
|
||||
b_dbname="${b_appname}"
|
||||
b_user="${b_dbname}"
|
||||
b_password="$(xxd -l8 -p /dev/urandom | sed 's/..../&-/g; s/-$//')"
|
||||
|
||||
mariadb -e "
|
||||
USE \`mysql\`;
|
||||
CREATE DATABASE IF NOT EXISTS \`${b_dbname}\`;
|
||||
CREATE USER '${b_user}'@'%' IDENTIFIED BY '${b_password}';
|
||||
GRANT ALL PRIVILEGES ON \`${b_dbname}\`.* TO '${b_user}'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
"
|
||||
|
||||
echo "${b_password}" > ./"${b_appname}-password.txt"
|
||||
|
||||
echo ""
|
||||
echo "Password in ./${b_appname}-password.txt"
|
||||
echo ""
|
||||
echo "mysql://${b_user}:********@localhost:3306/${b_dbname}"
|
||||
echo "mariadb -u ${b_user} -p ${b_dbname}"
|
||||
echo ""
|
||||
)}
|
||||
```
|
||||
|
||||
### How to Backup and Restore
|
||||
|
||||
Backup a single database:
|
||||
|
||||
```sh
|
||||
my_ts="$(date "+%F_%H.%M.%S")"
|
||||
mysqldump -u username -p --force --hex-blob --databases 'dbname' \
|
||||
--triggers --routines --events \
|
||||
--add-drop-table --add-drop-triggers \
|
||||
--skip-set-charset --single-transaction > ./"backup.${ts}.sql"
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- `--force` **is always necessary** and should be the default - it will continue
|
||||
the backup in the case that inconsistencies are found - such as a _View_
|
||||
referencing a column that no longer exists (which is not checked during
|
||||
`ALTER TABLE`)
|
||||
- `--skip-set-charset` to accept the default `utf8` rather than accidentally
|
||||
recreating tables as legacy `latin1-swedish`
|
||||
- `--add-drop-table` and `--add-drop-triggers` do not need to be used if your
|
||||
user has the ability to drop and recreate the database
|
||||
- `--databases 'dbname'` omits ``USE `dbname`;``, which allows you to easily
|
||||
restore to a different database name
|
||||
|
||||
Destructive Restore (drop that database and then restore it):
|
||||
|
||||
```sh
|
||||
mysql -u username -p -e 'DROP DATABASE `dbname`';
|
||||
mysql -u username -p 'dbname' < ./backup.sql
|
||||
```
|
||||
|
||||
### Connect via SSH Proxy
|
||||
|
||||
1. Create a proxy (ignore warnings)
|
||||
```sh
|
||||
#ssh user@server -fnNT -L <local-port>:<remote-host>:<remote-port>
|
||||
ssh ${USER}@${b_hostname} -fnNT -L 13306:localhost:3306
|
||||
```
|
||||
2. Connect via `mysql`, `mariadb`, Sequel Ace, etc:
|
||||
```sh
|
||||
mysql -u remote-user -h 127.0.0.1 -P 13306
|
||||
```
|
||||
|
||||
**Notes**
|
||||
|
||||
- connect with a user that has the host `%` and DOES NOT have a `localhost` or
|
||||
`127.0.0.1` entry - otherwise the client may "upgrade" to a socket connection
|
||||
and fail.
|
||||
- you may need to remove the wildcard `localhost` users (see below)
|
||||
|
||||
### Remove Default Access `localhost` Users
|
||||
|
||||
You may not be able to connect via an SSH proxy if the default users exist. \
|
||||
(it may match `` `%`@`localhost` `` instead of `` `app`@`%` `` and deny the
|
||||
password)
|
||||
|
||||
```sql
|
||||
USE `mysql`;
|
||||
DELETE FROM `global_priv` WHERE `User` = '';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
165
mariadb/install.sh
Executable file
165
mariadb/install.sh
Executable file
@@ -0,0 +1,165 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
__init_mariadb() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
###################
|
||||
# Install mariadb #
|
||||
###################
|
||||
|
||||
# Every package should define these 6 variables
|
||||
pkg_cmd_name="mariadb"
|
||||
|
||||
pkg_dst_cmd="${HOME}/.local/opt/mariadb/bin/mariadb"
|
||||
pkg_dst_bin="${HOME}/.local/opt/mariadb/bin"
|
||||
pkg_dst_dir="${HOME}/.local/opt/mariadb"
|
||||
pkg_dst="${pkg_dst_dir}"
|
||||
|
||||
pkg_src_cmd="${HOME}/.local/opt/mariadb-v${WEBI_VERSION}/bin/mariadb"
|
||||
pkg_src_dir="${HOME}/.local/opt/mariadb-v${WEBI_VERSION}"
|
||||
pkg_src="${pkg_src_dir}"
|
||||
|
||||
pkg_get_current_version() {
|
||||
# 'mariadb --version' has output in this format:
|
||||
# mariadb (mariadbQL) 17.0
|
||||
# This trims it down to just the version number:
|
||||
# 17.0
|
||||
mariadb --version 2> /dev/null | head -n 1 | cut -d' ' -f3
|
||||
}
|
||||
|
||||
pkg_install() {
|
||||
# mkdir -p $HOME/.local/opt
|
||||
mkdir -p "$(dirname "$pkg_src")"
|
||||
|
||||
# mv ./mariadb-11.4.4-linux-systemd-x86_64 "$HOME/.local/opt/mariadb-v11.4.4"
|
||||
mv ./"mariadb-"* "$pkg_src"
|
||||
}
|
||||
|
||||
pkg_link() {
|
||||
# ln -s "$HOME/.local/opt/mariadb-v17.0" "$HOME/.local/opt/mariadb"
|
||||
# for the old mariadb version
|
||||
ln -s "$pkg_src" "$pkg_dst"
|
||||
if ! test -d ~/.local/opt/mysql; then
|
||||
rm -f ~/.local/opt/mysql
|
||||
ln -s "mariadb-v${WEBI_VERSION}" ~/.local/opt/mysql
|
||||
fi
|
||||
}
|
||||
|
||||
#shellcheck disable=SC2059
|
||||
pkg_post_install() {
|
||||
b_hostname="$(hostname)"
|
||||
|
||||
if ! test -e ~/.config/mariadb; then
|
||||
mkdir -p ~/.config/mariadb
|
||||
chmod 0700 ~/.config/mariadb/
|
||||
fi
|
||||
|
||||
if ! test -e ~/.local/share/mariadb; then
|
||||
mkdir -p ~/.local/share/mariadb/
|
||||
chmod 0700 ~/.local/share/mariadb/
|
||||
mkdir -p ~/.local/share/mariadb/run/
|
||||
chmod 0750 ~/.local/share/mariadb/run/
|
||||
mkdir -p ~/.local/share/mariadb/var/
|
||||
chmod 0750 ~/.local/share/mariadb/var/
|
||||
else
|
||||
mkdir -p ~/.local/share/mariadb/run/
|
||||
mkdir -p ~/.local/share/mariadb/data/
|
||||
mkdir -p ~/.local/share/mariadb/var/
|
||||
fi
|
||||
|
||||
printf " $(t_path '~''/.my.cnf') $(t_dim '(sources client & server config)') "
|
||||
if test -e ~/.my.cnf; then
|
||||
printf -- "$(t_dim 'Found')\n"
|
||||
else
|
||||
{
|
||||
echo '[client]'
|
||||
echo '!include /home/app/.config/mariadb/my.cnf'
|
||||
echo ''
|
||||
echo '[server]'
|
||||
echo '!include /home/app/.local/share/mariadb/my.cnf'
|
||||
} > ~/.my.cnf
|
||||
printf -- "Created\n"
|
||||
fi
|
||||
|
||||
printf " $(t_path '~''/.config/mariadb/my.cnf') $(t_dim '(client config)') "
|
||||
if test -e ~/.config/mariadb/my.cnf; then
|
||||
printf -- "$(t_dim 'Found')\n"
|
||||
else
|
||||
{
|
||||
echo '[client]'
|
||||
echo ' default-character-set = utf8mb4'
|
||||
echo ''
|
||||
echo " socket = $HOME/.local/share/mariadb/run/mariadbd.sock"
|
||||
echo " #host = ${b_hostname}"
|
||||
echo ' #port = 3306'
|
||||
echo " #user = ${USER}"
|
||||
echo " #password = (none)"
|
||||
echo " #database = (none)"
|
||||
} > ~/.config/mariadb/my.cnf
|
||||
printf -- "Created\n"
|
||||
fi
|
||||
|
||||
printf " $(t_path '~''/.local/share/mariadb/my.cnf') $(t_dim '(server config)') "
|
||||
if test -e ~/.local/share/mariadb/my.cnf; then
|
||||
printf -- "$(t_dim 'Found')\n"
|
||||
else
|
||||
{
|
||||
echo '[server]'
|
||||
echo " character-set-server = utf8mb4"
|
||||
echo " collation-server = utf8mb4_unicode_ci"
|
||||
echo " init-connect = 'SET NAMES utf8mb4'"
|
||||
echo ''
|
||||
echo " bind-address = 127.0.0.1"
|
||||
echo " port = 3306"
|
||||
echo " socket = $HOME/.local/share/mariadb/run/mariadbd.sock"
|
||||
echo ''
|
||||
echo " basedir = $HOME/.local/opt/mariadb/"
|
||||
echo " datadir = $HOME/.local/share/mariadb/data/"
|
||||
echo " pid-file = $HOME/.local/share/mariadb/run/mariadbd.pid"
|
||||
echo " #log-error = $HOME/.local/share/mariadb/var/error.log"
|
||||
} > ~/.local/share/mariadb/my.cnf
|
||||
printf -- "Created\n"
|
||||
fi
|
||||
|
||||
printf " $(t_path '~''/.local/share/mariadb/data/') $(t_dim '(database)') "
|
||||
if test -e ~/.local/share/mariadb/data; then
|
||||
printf -- "$(t_dim 'Found')\n"
|
||||
else
|
||||
printf -- "Initializing ... "
|
||||
mkdir -p ~/.local/share/mariadb/data/
|
||||
chmod 0700 ~/.local/share/mariadb/data/
|
||||
# echo ""
|
||||
# echo " Consider joining MariaDB's strong and vibrant community:"
|
||||
# echo " https://mariadb.org/get-involved/"
|
||||
# echo ""
|
||||
~/.local/opt/mariadb/scripts/mariadb-install-db --defaults-file="$HOME/.my.cnf" > /dev/null
|
||||
printf -- "OK\n"
|
||||
fi
|
||||
webi_path_add "$(dirname "$pkg_dst_cmd")"
|
||||
}
|
||||
|
||||
pkg_done_message() {
|
||||
b_hostname="$(hostname)"
|
||||
|
||||
echo ""
|
||||
echo " Installed $(t_pkg "mariadb") $(t_dim "(mysql)") as $(t_link '~''/.local/opt/mariadb/bin/mariadb')"
|
||||
|
||||
echo ""
|
||||
echo "To run manually"
|
||||
echo " $(t_cmd 'mariadbd-safe') --defaults-file=\"$(t_path "$HOME/.my.cnf")\""
|
||||
#mariadbd-safe --defaults-file=$HOME/.my.cnf --print-defaults
|
||||
echo ""
|
||||
echo "To install as a system service"
|
||||
# export MARIADB_HOME=$HOME/.local/opt/mariadb/
|
||||
echo " $(t_cmd 'serviceman') add --name mariadb --workdir $(t_path '~''/.local/opt/mariadb/') -- \\"
|
||||
echo " $(t_cmd 'mariadbd') --defaults-file=\"$(t_path "$HOME/.my.cnf")\""
|
||||
echo ""
|
||||
echo "To connect with a client:"
|
||||
echo " $(t_cmd 'mariadb') -u 'root' -h 'localhost' $(t_dim '# all-privileges admin')"
|
||||
echo " $(t_cmd 'mariadb') -u '${USER}' -h 'localhost' $(t_dim '# all-privileges admin')"
|
||||
}
|
||||
}
|
||||
|
||||
__init_mariadb
|
||||
@@ -1,210 +1,181 @@
|
||||
'use strict';
|
||||
|
||||
var brewReleases = require('../_common/brew.js');
|
||||
let Fetcher = require('../_common/fetcher.js');
|
||||
|
||||
module.exports = function (request) {
|
||||
// So many places to get (incomplete) release info...
|
||||
//
|
||||
// MariaDB official
|
||||
// - https://downloads.mariadb.org/mariadb/+releases/
|
||||
// - http://archive.mariadb.org/
|
||||
// Brew
|
||||
// - https://formulae.brew.sh/api/formula/mariadb@10.3.json
|
||||
// - https://formulae.brew.sh/docs/api/
|
||||
// - https://formulae.brew.sh/formula/mariadb@10.2#default
|
||||
//
|
||||
// Note: This could be very fragile due to using the html
|
||||
// as an API. It's pretty rather than minified, but that
|
||||
// doesn't guarantee that it's meant as a consumable API.
|
||||
//
|
||||
let Releases = module.exports;
|
||||
|
||||
var promises = [mariaReleases(), brewReleases(request, 'mariadb')];
|
||||
return Promise.all(promises).then(function (many) {
|
||||
var versions = many[0];
|
||||
var brews = many[1];
|
||||
let PRODUCT = `mariadb`;
|
||||
// `https://downloads.mariadb.org/rest-api/${PRODUCT}/${minor}/`
|
||||
// `https://downloads.mariadb.org/rest-api/mariadb/10.5/`
|
||||
// https://github.com/MariaDB/mariadb-documentation/issues/41
|
||||
|
||||
var all = { download: '', releases: [] };
|
||||
Releases.latest = async function () {
|
||||
let packages = [];
|
||||
let versionData = await getVersionIds();
|
||||
for (let verData of versionData.major_releases) {
|
||||
let isVersion = /^\d+[.]\d+$/.test(verData.release_id);
|
||||
if (!isVersion) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// linux x86
|
||||
// linux x64
|
||||
// windows x86
|
||||
// windows x64
|
||||
// (and mac, wedged-in from Homebrew)
|
||||
versions.forEach(function (ver) {
|
||||
all.releases.push({
|
||||
version: ver.version,
|
||||
lts: false,
|
||||
channel: ver.channel,
|
||||
date: ver.date,
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
download:
|
||||
'http://archive.mariadb.org/mariadb-{{ v }}/bintar-linux-x86_64/mariadb-{{ v }}-linux-x86_64.tar.gz'.replace(
|
||||
/{{ v }}/g,
|
||||
ver.version,
|
||||
),
|
||||
});
|
||||
all.releases.push({
|
||||
version: ver.version,
|
||||
lts: false,
|
||||
channel: ver.channel,
|
||||
date: ver.date,
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
download:
|
||||
'http://archive.mariadb.org/mariadb-{{ v }}/bintar-linux-x86/mariadb-{{ v }}-linux-x86.tar.gz'.replace(
|
||||
/{{ v }}/g,
|
||||
ver.version,
|
||||
),
|
||||
});
|
||||
|
||||
// windows
|
||||
all.releases.push({
|
||||
version: ver.version,
|
||||
lts: false,
|
||||
channel: ver.channel,
|
||||
date: ver.date,
|
||||
os: 'windows',
|
||||
arch: 'amd64',
|
||||
download:
|
||||
'http://archive.mariadb.org/mariadb-{{ v }}/winx64-packages/mariadb-{{ v }}-winx64.zip'.replace(
|
||||
/{{ v }}/g,
|
||||
ver.version,
|
||||
),
|
||||
});
|
||||
all.releases.push({
|
||||
version: ver.version,
|
||||
lts: false,
|
||||
channel: ver.channel,
|
||||
date: ver.date,
|
||||
os: 'windows',
|
||||
arch: 'x86',
|
||||
download:
|
||||
'http://archive.mariadb.org/mariadb-{{ v }}/win32-packages/mariadb-{{ v }}-win32.zip'.replace(
|
||||
/{{ v }}/g,
|
||||
ver.version,
|
||||
),
|
||||
});
|
||||
|
||||
// Note: versions are sorted most-recent first.
|
||||
// We just assume that the brew version is most recent stable
|
||||
// ... but we can't really know for sure
|
||||
|
||||
// TODO
|
||||
brews.some(function (brew, i) {
|
||||
// 10.3 => ^10.2(\b|\.)
|
||||
var reBrewVer = new RegExp(
|
||||
'^' + brew.version.replace(/\./, '\\.') + '(\\b|\\.)',
|
||||
'g',
|
||||
);
|
||||
if (!ver.version.match(reBrewVer)) {
|
||||
return;
|
||||
let releaseData = await getReleases(verData.release_id);
|
||||
let versions = Object.keys(releaseData.releases);
|
||||
for (let ver of versions) {
|
||||
let relData = releaseData.releases[ver];
|
||||
for (let fileData of relData.files) {
|
||||
let packageData = pluckData(verData, relData, fileData);
|
||||
if (!packageData) {
|
||||
continue;
|
||||
}
|
||||
all.releases.push({
|
||||
version: ver.version,
|
||||
lts: false,
|
||||
channel: ver.channel,
|
||||
date: ver.date,
|
||||
os: 'macos',
|
||||
arch: 'amd64',
|
||||
download: brew.download.replace(/{{ v }}/g, ver.version),
|
||||
});
|
||||
brews.splice(i, 1); // remove
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
return all;
|
||||
});
|
||||
|
||||
function mariaReleases() {
|
||||
return request({
|
||||
url: 'https://downloads.mariadb.org/mariadb/+releases/',
|
||||
fail: true, // https://git.coolaj86.com/coolaj86/request.js/issues/2
|
||||
})
|
||||
.then(failOnBadStatus)
|
||||
.then(function (resp) {
|
||||
// fragile, but simple
|
||||
|
||||
// Make release info go from this:
|
||||
var html = resp.body;
|
||||
//
|
||||
// <tr>
|
||||
// <td><a href="/mariadb/10.0.38/">10.0.38</a></td>
|
||||
// <td>2019-01-31</td>
|
||||
// <td>Stable</td>
|
||||
// </tr>
|
||||
|
||||
// To this:
|
||||
var reLine = /\s*(<(tr|td)[^>]*>)\s*/g;
|
||||
//
|
||||
// <tr><tr><td><a href="/mariadb/10.0.38/">10.0.38</a></td><td>2019-01-31</td><td>Stable</td>
|
||||
// </tr><tr><td><a href="/mariadb/10.0.37/">10.0.37</a></td><td>2018-11-01</td><td>Stable</td>
|
||||
// </tr><tr><td><a href="/mariadb/10.0.36/">10.0.36</a></td><td>2018-08-01</td><td>Stable</td>
|
||||
//
|
||||
// To this:
|
||||
var reVer =
|
||||
/<tr>.*mariadb\/(10[^\/]+)\/">.*(20\d\d-\d\d-\d\d)<\/td><td>(\w+)<\/td>/;
|
||||
//
|
||||
// { "version": "10.0.36", "date": "2018-08-01", "channel": "stable" }
|
||||
|
||||
return html
|
||||
.replace(reLine, '$1')
|
||||
.split(/\n/)
|
||||
.map(function (line) {
|
||||
var m = line.match(reVer);
|
||||
if (!m) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
version: m[1],
|
||||
channel: mapChannel(m[3].toLowerCase()),
|
||||
date: m[2],
|
||||
};
|
||||
})
|
||||
.filter(Boolean);
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Error fetching (official) MariaDB versions');
|
||||
console.error(err);
|
||||
return [];
|
||||
});
|
||||
packages.push(packageData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let all = { releases: packages };
|
||||
return all;
|
||||
};
|
||||
|
||||
function mapChannel(ch) {
|
||||
if ('alpha' === ch) {
|
||||
return 'dev';
|
||||
/** @type {Object.<String?, String>} */
|
||||
let channelsMap = {
|
||||
// 'Long Term Support': 'stable',
|
||||
// 'Short Term Support': 'stable',
|
||||
// 'Rolling': null,
|
||||
Stable: 'stable',
|
||||
RC: 'rc',
|
||||
Alpha: 'preview',
|
||||
null: 'preview',
|
||||
};
|
||||
|
||||
/** @type {Object.<String, String>} */
|
||||
let cpusMap = {
|
||||
x86_64: 'amd64',
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {MajorRelease} verData
|
||||
* @param {Release} relData
|
||||
* @param {File} fileData
|
||||
*/
|
||||
function pluckData(verData, relData, fileData) {
|
||||
let lts =
|
||||
verData.release_status === 'Stable' &&
|
||||
verData.release_support_type === 'Long Term Support';
|
||||
let cpu = fileData.cpu || '';
|
||||
cpu = cpu.trim();
|
||||
|
||||
let isNotBinary = !fileData.os || !cpu; // "Source" or some such
|
||||
if (isNotBinary) {
|
||||
return null;
|
||||
}
|
||||
// stable,rc,beta
|
||||
return ch;
|
||||
|
||||
let isDebug = /debug/.test(fileData.file_name);
|
||||
if (isDebug) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let pkgData = {
|
||||
name: fileData.file_name,
|
||||
version: relData.release_id,
|
||||
lts: lts,
|
||||
channel: channelsMap[verData.release_status],
|
||||
date: relData.date_of_release,
|
||||
os: fileData.os?.toLowerCase(),
|
||||
arch: cpusMap[cpu] || cpu,
|
||||
hash: fileData.checksum.sha256sum,
|
||||
download: fileData.file_download_url,
|
||||
};
|
||||
|
||||
return pkgData;
|
||||
}
|
||||
|
||||
function failOnBadStatus(resp) {
|
||||
if (resp.statusCode >= 400) {
|
||||
var err = new Error('Non-successful status code: ' + resp.statusCode);
|
||||
err.code = 'ESTATUS';
|
||||
err.response = resp;
|
||||
throw err;
|
||||
}
|
||||
return resp;
|
||||
/**
|
||||
* @typedef {String} ISODate - YYYY-MM-DD (ISO 8601 format)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef MajorRelease
|
||||
* @prop {String} release_id - version-like for stable versions, otherwise a title
|
||||
* @prop {String} release_name - same as id for MariaDB
|
||||
* @prop {String} release_status - Stable|RC|Alpha
|
||||
* @prop {String?} release_support_type - Long Term Support|Short Term Support|Rolling|null
|
||||
* @prop {ISODate?} release_eol_date
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef MajorReleasesWrapper
|
||||
* @prop {Array<MajorRelease>} major_releases
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Release
|
||||
* @prop {String} release_id - "11.4.4" or "11.6.0 Vector"
|
||||
* @prop {String} release_name - "MariaDB Server 11.8.0 Preview"
|
||||
* @prop {ISODate} date_of_release
|
||||
* @prop {String} release_notes_url
|
||||
* @prop {String} change_log
|
||||
* @prop {Array<File>} files - release assets (packages, docs, etc)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef ReleasesWrapper
|
||||
* @prop {Object.<String, Release>} releases
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef File
|
||||
* @prop {Number} file_id
|
||||
* @prop {String} file_name
|
||||
* @prop {String?} package_type - "gzipped tar file" or "ZIP file"
|
||||
* @prop {String?} os - "Linux" or "Windows"
|
||||
* @prop {String?} cpu - "x86_64" (or null)
|
||||
* @prop {Checksum} checksum
|
||||
* @prop {String} file_download_url
|
||||
* @prop {String?} signature
|
||||
* @prop {String} checksum_url
|
||||
* @prop {String} signature_url
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Checksum
|
||||
* @prop {String?} md5sum
|
||||
* @prop {String?} sha1sum
|
||||
* @prop {String?} sha256sum
|
||||
* @prop {String?} sha512sum
|
||||
*/
|
||||
|
||||
/**
|
||||
* @returns {Promise<MajorReleasesWrapper>}
|
||||
*/
|
||||
async function getVersionIds() {
|
||||
let url = `https://downloads.mariadb.org/rest-api/${PRODUCT}/`;
|
||||
let resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
|
||||
let result = JSON.parse(resp.body);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} verId
|
||||
* @returns {Promise<ReleasesWrapper>}
|
||||
*/
|
||||
async function getReleases(verId) {
|
||||
let url = `https://downloads.mariadb.org/rest-api/${PRODUCT}/${verId}`;
|
||||
let resp = await Fetcher.fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
|
||||
let result = JSON.parse(resp.body);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
console.info('official releases look like:');
|
||||
console.info(JSON.stringify(all.releases.slice(0, 2), null, 2));
|
||||
console.info('Homebrew releases look like:');
|
||||
console.info(
|
||||
JSON.stringify(
|
||||
all.releases
|
||||
.filter(function (rel) {
|
||||
return 'macos' === rel.os;
|
||||
})
|
||||
.slice(0, 2),
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
Releases.latest().then(function (all) {
|
||||
let normalize = require('../_webi/normalize.js');
|
||||
all = normalize(all);
|
||||
let json = JSON.stringify(all, null, 2);
|
||||
console.info(json);
|
||||
});
|
||||
}
|
||||
|
||||
11
mariadbd/README.md
Normal file
11
mariadbd/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: MariaDB Server (MariaDB alias)
|
||||
homepage: https://webinstall.dev/mariadb
|
||||
tagline: |
|
||||
Alias for https://webinstall.dev/mariadb
|
||||
alias: mariadb
|
||||
description: |
|
||||
See https://webinstall.dev/mariadb
|
||||
---
|
||||
|
||||
Alias for https://webinstall.dev/mariadb
|
||||
12
mariadbd/install.sh
Executable file
12
mariadbd/install.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
__redirect_alias_mariadb() {
|
||||
echo "'mariadbd' is an alias for 'mariadb'"
|
||||
sleep 2.5
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webi.sh"}
|
||||
curl -fsSL "$WEBI_HOST/mariadb@${WEBI_VERSION-}" | sh
|
||||
}
|
||||
|
||||
__redirect_alias_mariadb
|
||||
@@ -4,14 +4,14 @@ var github = require('../_common/github.js');
|
||||
var owner = 'mutagen-io';
|
||||
var repo = 'mutagen';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
module.exports().then(function (all) {
|
||||
all = require('../_webi/normalize.js')._debug(all);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
|
||||
15
mysql/README.md
Normal file
15
mysql/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: MySQL (MariaDB alias)
|
||||
homepage: https://webinstall.dev/mariadb
|
||||
tagline: |
|
||||
Alias for https://webinstall.dev/mariadb
|
||||
alias: mariadb
|
||||
description: |
|
||||
See https://webinstall.dev/mariadb
|
||||
---
|
||||
|
||||
`mysql` is ambiguous, and therefore a reserved installer name.
|
||||
|
||||
Currently an alias for <https://webinstall.dev/mariadb>.
|
||||
|
||||
That may change in the future, such as if an Oracle MySQL installer is created.
|
||||
17
mysql/install.sh
Executable file
17
mysql/install.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webi.sh"}
|
||||
|
||||
echo ""
|
||||
echo "ERROR"
|
||||
echo " 'mysql' is ambiguous and therefore reserved for future use"
|
||||
echo ""
|
||||
echo "SOLUTION"
|
||||
echo " Did you mean 'mariadb'?"
|
||||
echo ""
|
||||
echo " curl -fsSL '$WEBI_HOST/mariadb' | sh"
|
||||
echo ""
|
||||
|
||||
exit 1
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user