mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Changed utils import namespace
This commit is contained in:
@@ -4,8 +4,8 @@ import getModelFolderContents from "./getModelFolderContents";
|
|||||||
import * as Schemas from "./schemas";
|
import * as Schemas from "./schemas";
|
||||||
import * as Signature from "./Signature";
|
import * as Signature from "./Signature";
|
||||||
import * as Strings from "./StringsUtils";
|
import * as Strings from "./StringsUtils";
|
||||||
|
import * as Utils from "./utils";
|
||||||
import { Stream } from "stream";
|
import { Stream } from "stream";
|
||||||
import { processDate } from "./utils";
|
|
||||||
|
|
||||||
/** Exporting for tests specs */
|
/** Exporting for tests specs */
|
||||||
export const propsSymbol = Symbol("props");
|
export const propsSymbol = Symbol("props");
|
||||||
@@ -710,7 +710,7 @@ export default class PKPass extends Bundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this[propsSymbol]["expirationDate"] = processDate(date);
|
this[propsSymbol]["expirationDate"] = Utils.processDate(date);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
`Cannot set expirationDate. Invalid date ${date}`,
|
`Cannot set expirationDate. Invalid date ${date}`,
|
||||||
@@ -799,7 +799,7 @@ export default class PKPass extends Bundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this[propsSymbol]["relevantDate"] = processDate(date);
|
this[propsSymbol]["relevantDate"] = Utils.processDate(date);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
`Cannot set relevantDate. Invalid date ${date}`,
|
`Cannot set relevantDate. Invalid date ${date}`,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
import * as Utils from "./utils";
|
||||||
import formatMessage, { ERROR } from "./messages";
|
import formatMessage, { ERROR } from "./messages";
|
||||||
import { removeHidden } from "./utils";
|
|
||||||
import { promises as fs } from "fs";
|
import { promises as fs } from "fs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,7 +19,7 @@ export default async function getModelFolderContents(
|
|||||||
const modelFilesList = await fs.readdir(modelPath);
|
const modelFilesList = await fs.readdir(modelPath);
|
||||||
|
|
||||||
// No dot-starting files, manifest and signature
|
// No dot-starting files, manifest and signature
|
||||||
const filteredModelRecords = removeHidden(modelFilesList).filter(
|
const filteredModelRecords = Utils.removeHidden(modelFilesList).filter(
|
||||||
(f) =>
|
(f) =>
|
||||||
!/(manifest|signature)/i.test(f) &&
|
!/(manifest|signature)/i.test(f) &&
|
||||||
/.+$/.test(path.parse(f).ext),
|
/.+$/.test(path.parse(f).ext),
|
||||||
@@ -116,7 +116,7 @@ function getObjectFromModelFile(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
async function readDirectory(filePath: string) {
|
async function readDirectory(filePath: string) {
|
||||||
const dirContent = await fs.readdir(filePath).then(removeHidden);
|
const dirContent = await fs.readdir(filePath).then(Utils.removeHidden);
|
||||||
|
|
||||||
return dirContent.map(async (fileName) => {
|
return dirContent.map(async (fileName) => {
|
||||||
const content = await fs.readFile(path.resolve(filePath, fileName));
|
const content = await fs.readFile(path.resolve(filePath, fileName));
|
||||||
|
|||||||
Reference in New Issue
Block a user