Zammad addon common updates

This commit is contained in:
Darren Clarke 2023-05-09 12:26:23 +00:00
parent e4450c37ee
commit 6fca9c704f
16 changed files with 192 additions and 107 deletions

View file

@ -1,7 +0,0 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"runArgs": ["--device=/dev/net/tun"],
"features": {
"ghcr.io/tailscale/codespace/tailscale": {}
}
}

View file

@ -1 +0,0 @@
[]

94
package-lock.json generated
View file

@ -2730,7 +2730,6 @@
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
"devOptional": true,
"dependencies": {
"@jridgewell/trace-mapping": "0.3.9"
},
@ -2742,7 +2741,6 @@
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
"devOptional": true,
"dependencies": {
"@jridgewell/resolve-uri": "^3.0.3",
"@jridgewell/sourcemap-codec": "^1.4.10"
@ -6054,26 +6052,22 @@
"node_modules/@tsconfig/node10": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
"devOptional": true
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA=="
},
"node_modules/@tsconfig/node12": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
"devOptional": true
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="
},
"node_modules/@tsconfig/node14": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
"devOptional": true
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="
},
"node_modules/@tsconfig/node16": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
"devOptional": true
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ=="
},
"node_modules/@twilio/audioplayer": {
"version": "1.0.6",
@ -7277,7 +7271,6 @@
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
"devOptional": true,
"engines": {
"node": ">=0.4.0"
}
@ -7476,8 +7469,7 @@
"node_modules/arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
"devOptional": true
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
},
"node_modules/argparse": {
"version": "2.0.1",
@ -9005,8 +8997,7 @@
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
"devOptional": true
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
},
"node_modules/crelt": {
"version": "1.0.5",
@ -9395,7 +9386,6 @@
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"devOptional": true,
"engines": {
"node": ">=0.3.1"
}
@ -11931,18 +11921,6 @@
"integrity": "sha512-vo76VJ44MkUBZL/BzpGXaKzMfroF4ZR6+haRuw9p+eSWfoNaH2AxVc8xmiEPC08jhzJSeM6w7/iMUGet8b4oBQ==",
"peer": true
},
"node_modules/hapi/node_modules/b64": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/b64/-/b64-4.1.2.tgz",
"integrity": "sha512-+GUspBxlH3CJaxMUGUE1EBoWM6RKgWiYwUDal0qdf8m3ArnXNN1KzKVo5HOnE/FSq4HHyWf3TlHLsZI8PKQgrQ==",
"extraneous": true
},
"node_modules/hapi/node_modules/big-time": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/big-time/-/big-time-2.0.1.tgz",
"integrity": "sha512-qtwYYoocwpiAxTXC5sIpB6nH5j6ckt+n/jhD7J5OEiFHnUZEFn0Xk8STUaE5s10LdazN/87bTDMe+fSihaW7Kg==",
"extraneous": true
},
"node_modules/hapi/node_modules/boom": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/boom/-/boom-7.2.2.tgz",
@ -11955,12 +11933,6 @@
"integrity": "sha512-1LPcXg3fkGVhjdA/P3DcR5cDktKEYtDpruJv9Nhmy36RoYaoxZfC82Zr2JmS3vysDJKqMtP0qJw3/P6iisTASg==",
"peer": true
},
"node_modules/hapi/node_modules/bourne": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/bourne/-/bourne-1.1.1.tgz",
"integrity": "sha512-Ou0l3W8+n1FuTOoIfIrCk9oF9WVWc+9fKoAl67XQr9Ws0z7LgILRZ7qtc9xdT4BveSKtnYXfKPgn8pFAqeQRew==",
"extraneous": true
},
"node_modules/hapi/node_modules/call": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/call/-/call-5.0.3.tgz",
@ -11979,18 +11951,6 @@
"integrity": "sha512-1tDnll066au0HXBSDHS/YQ34MQ2omBsmnA9g/jseyq/M3m7UPrajVtPDZK/rXgikSC1dfjo9Pa+kQ1qcyG2d3g==",
"peer": true
},
"node_modules/hapi/node_modules/content": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/content/-/content-4.0.6.tgz",
"integrity": "sha512-lR9ND3dXiMdmsE84K6l02rMdgiBVmtYWu1Vr/gfSGHcIcznBj2QxmSdUgDuNFOA+G9yrb1IIWkZ7aKtB6hDGyA==",
"extraneous": true
},
"node_modules/hapi/node_modules/cryptiles": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-4.1.3.tgz",
"integrity": "sha512-gT9nyTMSUC1JnziQpPbxKGBbUg8VL7Zn2NB4E1cJYvuXdElHrwxrV9bmltZGDzet45zSDGyYceueke1TjynGzw==",
"extraneous": true
},
"node_modules/hapi/node_modules/heavy": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/heavy/-/heavy-6.1.2.tgz",
@ -12003,42 +11963,18 @@
"integrity": "sha512-3PvUwBerLNVJiIVQdpkWF9F/M0ekgb2NPJWOhsE28RXSQPsY42YSnaJ8d1kZjcAz58TZ/Fk9Tw64xJsENFlJNw==",
"peer": true
},
"node_modules/hapi/node_modules/iron": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/iron/-/iron-5.0.6.tgz",
"integrity": "sha512-zYUMOSkEXGBdwlV/AXF9zJC0aLuTJUKHkGeYS5I2g225M5i6SrxQyGJGhPgOR8BK1omL6N5i6TcwfsXbP8/Exw==",
"extraneous": true
},
"node_modules/hapi/node_modules/joi": {
"version": "14.0.4",
"resolved": "https://registry.npmjs.org/joi/-/joi-14.0.4.tgz",
"integrity": "sha512-KUXRcinDUMMbtlOk7YLGHQvG73dLyf8bmgE+6sBTkdJbZpeGVGAlPXEHLiQBV7KinD/VLD5OA0EUgoTTfbRAJQ==",
"peer": true
},
"node_modules/hapi/node_modules/mime-db": {
"version": "1.37.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
"integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==",
"extraneous": true
},
"node_modules/hapi/node_modules/mimos": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/mimos/-/mimos-4.0.2.tgz",
"integrity": "sha512-5XBsDqBqzSN88XPPH/TFpOalWOjHJM5Z2d3AMx/30iq+qXvYKd/8MPhqBwZDOLtoaIWInR3nLzMQcxfGK9djXA==",
"peer": true
},
"node_modules/hapi/node_modules/nigel": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/nigel/-/nigel-3.0.4.tgz",
"integrity": "sha512-3SZCCS/duVDGxFpTROHEieC+itDo4UqL9JNUyQJv3rljudQbK6aqus5B4470OxhESPJLN93Qqxg16rH7DUjbfQ==",
"extraneous": true
},
"node_modules/hapi/node_modules/pez": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/pez/-/pez-4.0.5.tgz",
"integrity": "sha512-HvL8uiFIlkXbx/qw4B8jKDCWzo7Pnnd65Uvanf9OOCtb20MRcb9gtTVBf9NCnhETif1/nzbDHIjAWC/sUp7LIQ==",
"extraneous": true
},
"node_modules/hapi/node_modules/podium": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/podium/-/podium-3.1.5.tgz",
@ -12081,18 +12017,6 @@
"integrity": "sha512-IgpPtvD4kjrJ7CRA3ov2FhWQADwv+Tdqbsf1ZnPUSAtCJ9e1Z44MmoSGDXGk4IppoZA7jd/QRkNddlLJWlUZsQ==",
"peer": true
},
"node_modules/hapi/node_modules/vise": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/vise/-/vise-3.0.1.tgz",
"integrity": "sha512-7BJNjsv2o83+E6AHAFSnjQF324UTgypsR/Sw/iFmLvr7RgJrEXF1xNBvb5LJfi+1FvWQXjJK4X41WMuHMeunPQ==",
"extraneous": true
},
"node_modules/hapi/node_modules/wreck": {
"version": "14.1.3",
"resolved": "https://registry.npmjs.org/wreck/-/wreck-14.1.3.tgz",
"integrity": "sha512-hb/BUtjX3ObbwO3slCOLCenQ4EP8e+n8j6FmTne3VhEFp5XV1faSJojiyxVSvw34vgdeTG5baLTl4NmjwokLlw==",
"extraneous": true
},
"node_modules/has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
@ -20938,7 +20862,6 @@
"version": "10.9.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
"devOptional": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
@ -21844,8 +21767,7 @@
"node_modules/v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
"devOptional": true
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="
},
"node_modules/v8-to-istanbul": {
"version": "9.1.0",
@ -22443,7 +22365,6 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
"devOptional": true,
"engines": {
"node": ">=6"
}
@ -25434,6 +25355,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"ts-node": "^10.9.1",
"zammad-addon-common": "*"
}
}

View file

@ -0,0 +1,11 @@
import { createZPM } from "./lib";
import { promises as fs } from "fs";
const main = async () => {
const packageJSON = JSON.parse(await fs.readFile("./package.json", "utf-8"));
const { name, version } = packageJSON;
console.log(`Building ${name} v${version}`);
await createZPM({ name, version });
}
main();

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lib_1 = require("./lib");
const fs_1 = require("fs");
const main = async () => {
const packageJSON = JSON.parse(await fs_1.promises.readFile("./package.json", "utf-8"));
const { name, version } = packageJSON;
console.log(`Building ${name} v${version}`);
await (0, lib_1.createZPM)({ name, version });
};
main();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9idWlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtCQUFrQztBQUNsQywyQkFBb0M7QUFFcEMsTUFBTSxJQUFJLEdBQUcsS0FBSyxJQUFJLEVBQUU7SUFDdEIsTUFBTSxXQUFXLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLGFBQUUsQ0FBQyxRQUFRLENBQUMsZ0JBQWdCLEVBQUUsT0FBTyxDQUFDLENBQUMsQ0FBQztJQUM3RSxNQUFNLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxHQUFHLFdBQVcsQ0FBQztJQUN0QyxPQUFPLENBQUMsR0FBRyxDQUFDLFlBQVksSUFBSSxLQUFLLE9BQU8sRUFBRSxDQUFDLENBQUM7SUFDNUMsTUFBTSxJQUFBLGVBQVMsRUFBQyxFQUFFLElBQUksRUFBRSxPQUFPLEVBQUUsQ0FBQyxDQUFDO0FBQ3JDLENBQUMsQ0FBQTtBQUVELElBQUksRUFBRSxDQUFDIn0=

View file

@ -0,0 +1,2 @@
export declare const createZPM: ({ name, version }: Record<string, string>) => Promise<void>;
export declare const createMigration: ({ packageName }: Record<string, string>) => Promise<void>;

113
packages/zammad-addon-common/dist/lib.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lib_1 = require("./lib");
const fs_1 = require("fs");
const main = async () => {
const packageJSON = JSON.parse(await fs_1.promises.readFile("./package.json", "utf-8"));
const { name, } = packageJSON;
await (0, lib_1.createMigration)({ packageName: name });
};
main();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlncmF0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL21pZ3JhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQkFBd0M7QUFDeEMsMkJBQW9DO0FBRXBDLE1BQU0sSUFBSSxHQUFHLEtBQUssSUFBSSxFQUFFO0lBQ3RCLE1BQU0sV0FBVyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxhQUFFLENBQUMsUUFBUSxDQUFDLGdCQUFnQixFQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUM7SUFDN0UsTUFBTSxFQUFFLElBQUksR0FBRyxHQUFHLFdBQVcsQ0FBQztJQUM5QixNQUFNLElBQUEscUJBQWUsRUFBQyxFQUFFLFdBQVcsRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDO0FBQy9DLENBQUMsQ0FBQTtBQUVELElBQUksRUFBRSxDQUFDIn0=

File diff suppressed because one or more lines are too long

View file

@ -28,7 +28,7 @@ const skeleton: Record<string, any> = {
const packageFile = async (actualPath: string): Promise<any> => {
console.log(`Packaging: ${actualPath}`);
const packagePath = actualPath.slice(6);
const packagePath = actualPath.slice(4);
const data = await fs.readFile(actualPath, "utf-8");
const content = Buffer.from(data, "utf-8").toString("base64");
const fileStats = await fs.stat(actualPath);
@ -76,19 +76,16 @@ const camelize = (str: string): string => {
return camelizedStr.charAt(0).toUpperCase() + camelizedStr.slice(1);
}
export const createZPM = async () => {
export const createZPM = async ({ name, version }: Record<string, string>) => {
const files = await packageFiles();
skeleton.files = files;
skeleton.builddate = new Date().toISOString();
skeleton.buildhost = os.hostname();
const name = skeleton.name.toLowerCase();
const version = skeleton.version;
const pkg = JSON.stringify(skeleton, null, 2);
await fs.writeFile(`dist/${name}-v${version}.zpm`, pkg, 'utf-8');
await fs.writeFile(`../../docker/zammad/auto_install/${name}-v${version}.zpm`, pkg, 'utf-8');
}
export const createMigration = async () => {
const name = skeleton["name"].toLowerCase();
export const createMigration = async ({ packageName}: Record<string, string>) => {
const rawName: string = await new Promise((resolve) => {
process.stdin.setEncoding("utf-8");
process.stdout.write("Enter migration name: ");
@ -96,7 +93,8 @@ export const createMigration = async () => {
resolve(data.trim());
});
});
const migrationBaseName = `${name}_${underscore(rawName)}`;
const migrationBaseName = `${packageName}_${underscore(rawName)}`;
const migrationName = camelize(migrationBaseName);
const migrationTemplate = `class MIGRATION_NAME < ActiveRecord::Migration[5.2]
def self.up

View file

@ -0,0 +1,10 @@
import { createMigration } from "./lib";
import { promises as fs } from "fs";
const main = async () => {
const packageJSON = JSON.parse(await fs.readFile("./package.json", "utf-8"));
const { name, } = packageJSON;
await createMigration({ packageName: name });
}
main();

View file

@ -2,7 +2,13 @@
"name": "zammad-addon-common",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": {
"zpm-build": "./dist/build.js",
"zpm-migrate": "./dist/migrate.js"
},
"dependencies": {
"ts-node": "^10.9.1"
},
"scripts": {
"build": "tsc"
},

View file

@ -1,10 +1,10 @@
{
"name": "zammad-addon-pgp",
"version": "1.0.0",
"version": "2.0.0",
"description": "Adds PGP integration into [Zammad](https://zammad.org) via [Sequoia](https://sequoia-pgp.org).",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "zpm-build",
"migrate": "zpm-migrate"
},
"dependencies": {
"zammad-addon-common": "*"

View file

@ -0,0 +1,6 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true
}
}