checksum system
This commit is contained in:
parent
0513c9827e
commit
ea1fbd0b8d
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@squeebot/cli",
|
"name": "@squeebot/cli",
|
||||||
"version": "3.4.4",
|
"version": "3.5.0",
|
||||||
"description": "Squeebot v3 runtime, environments and configuration",
|
"description": "Squeebot v3 runtime, environments and configuration",
|
||||||
"main": "dist/squeebot.js",
|
"main": "dist/squeebot.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"typescript": "^4.4.2"
|
"typescript": "^4.4.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@squeebot/core": "^3.3.8",
|
"@squeebot/core": "^3.4.0",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"node-watch": "^0.7.1",
|
"node-watch": "^0.7.1",
|
||||||
"tar": "^6.1.11",
|
"tar": "^6.1.11",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { PluginMetaLoader } from '@squeebot/core/lib/plugin';
|
import { PluginMetaLoader } from '@squeebot/core/lib/plugin';
|
||||||
|
import { takeChecksum } from '@squeebot/core/lib/util';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import tar from 'tar';
|
import tar from 'tar';
|
||||||
@ -82,15 +83,8 @@ export async function buildRepository(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Creating repository index');
|
|
||||||
await fs.remove(outDir);
|
await fs.remove(outDir);
|
||||||
await fs.ensureDir(outDir);
|
await fs.ensureDir(outDir);
|
||||||
await fs.writeJSON(path.join(outDir, 'repository.json'), {
|
|
||||||
created: Math.floor(Date.now() / 1000),
|
|
||||||
name: meta.name,
|
|
||||||
plugins: meta.plugins,
|
|
||||||
$schema: REPOSITORY_SCHEMA,
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log('Copying plugins');
|
console.log('Copying plugins');
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
@ -125,13 +119,29 @@ export async function buildRepository(
|
|||||||
console.log('Creating tarballs');
|
console.log('Creating tarballs');
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
const plOut = path.join(outDir, plugin.name);
|
const plOut = path.join(outDir, plugin.name);
|
||||||
|
const fileName = `${plOut}.plugin.tgz`;
|
||||||
await tar.c({
|
await tar.c({
|
||||||
gzip: true,
|
gzip: true,
|
||||||
file: plOut + '.plugin.tgz',
|
file: fileName,
|
||||||
C: outDir,
|
C: outDir,
|
||||||
}, [plugin.name]);
|
}, [plugin.name]);
|
||||||
|
|
||||||
|
// Create checksum of tarball
|
||||||
|
const checksum = await takeChecksum(fileName);
|
||||||
|
const metaPlugin = meta.plugins.find((item: { name: string }) => item.name === plugin.name);
|
||||||
|
if (metaPlugin && checksum) {
|
||||||
|
metaPlugin.checksum = checksum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Creating repository index');
|
||||||
|
await fs.writeJSON(path.join(outDir, 'repository.json'), {
|
||||||
|
created: Math.floor(Date.now() / 1000),
|
||||||
|
name: meta.name,
|
||||||
|
plugins: meta.plugins,
|
||||||
|
$schema: REPOSITORY_SCHEMA,
|
||||||
|
});
|
||||||
|
|
||||||
if (doDeploy == null) {
|
if (doDeploy == null) {
|
||||||
console.log('Done!');
|
console.log('Done!');
|
||||||
return;
|
return;
|
||||||
|
@ -26,7 +26,7 @@ const yar = yargs.scriptName('squeebot')
|
|||||||
})
|
})
|
||||||
.option('t', {
|
.option('t', {
|
||||||
alias: 'no-typescript',
|
alias: 'no-typescript',
|
||||||
describe: 'Do not include typescript in the development environment',
|
describe: 'Do not include TypeScript in the development environment',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
});
|
});
|
||||||
}, (v) => newRepository(v.name as string, v.path as string, v.t !== true));
|
}, (v) => newRepository(v.name as string, v.path as string, v.t !== true));
|
||||||
|
Loading…
Reference in New Issue
Block a user