mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-16 00:25:30 +00:00
Changed back _patch method to return a Promise
This commit is contained in:
9
index.js
9
index.js
@@ -297,9 +297,9 @@ class Pass {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
_patch(options, passBuffer) {
|
_patch(options, passBuffer) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
if (!options) {
|
if (!options) {
|
||||||
return passBuffer;
|
return resolve(passBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
let passFile = JSON.parse(passBuffer.toString("utf8"));
|
let passFile = JSON.parse(passBuffer.toString("utf8"));
|
||||||
@@ -311,7 +311,7 @@ class Pass {
|
|||||||
let barcode = passFile["barcode"];
|
let barcode = passFile["barcode"];
|
||||||
|
|
||||||
if (!(barcode instanceof Object) || !schema.isValid(barcode, schema.constants.barcode) || !options.barcode && barcode.message === "") {
|
if (!(barcode instanceof Object) || !schema.isValid(barcode, schema.constants.barcode) || !options.barcode && barcode.message === "") {
|
||||||
console.log("\x1b[41m", `Barcode syntax of the chosen model (${path.parse(this.model).base}) is not correct or the override content was not provided got removed. Please refer to https://apple.co/2myAbst.`, "\x1b[0m");
|
console.log("\x1b[41m", `Barcode syntax of the chosen model (${path.parse(this.model).base}) is not correct and got removed or the override content was not provided. Please refer to https://apple.co/2myAbst.`, "\x1b[0m");
|
||||||
delete passFile["barcode"];
|
delete passFile["barcode"];
|
||||||
} else {
|
} else {
|
||||||
// options.barcode may not be defined
|
// options.barcode may not be defined
|
||||||
@@ -344,7 +344,8 @@ class Pass {
|
|||||||
|
|
||||||
Object.assign(passFile, options);
|
Object.assign(passFile, options);
|
||||||
|
|
||||||
return Buffer.from(JSON.stringify(passFile));
|
return resolve(Buffer.from(JSON.stringify(passFile)));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user