mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 16:25:21 +00:00
Changed build scripts for examples and main project
This commit is contained in:
@@ -10,7 +10,7 @@ $ git clone https://github.com/alexandercerutti/passkit-generator.git;
|
|||||||
$ cd passkit-generator && npm install;
|
$ cd passkit-generator && npm install;
|
||||||
$ cd examples && npm install;
|
$ cd examples && npm install;
|
||||||
$ npm run build;
|
$ npm run build;
|
||||||
$ node <the-example-you-want-to-execute>.js
|
$ npm run example <the-example-you-want-to-execute>.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Certificates paths in examples are linked to a folder `certificates` in the root of this project which is not provided.
|
Certificates paths in examples are linked to a folder `certificates` in the root of this project which is not provided.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import genRoute, { app } from "./webserver";
|
import genRoute, { app } from "./webserver";
|
||||||
import { createPass, createAbstractModel, AbstractModel } from "..";
|
import { createPass, createAbstractModel, AbstractModel } from "passkit-generator";
|
||||||
|
|
||||||
let abstractModel: AbstractModel;
|
let abstractModel: AbstractModel;
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
import app from "./webserver";
|
import app from "./webserver";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { createPass } from "..";
|
import { createPass } from "passkit-generator";
|
||||||
|
|
||||||
app.all(async function manageRequest(request, response) {
|
app.all(async function manageRequest(request, response) {
|
||||||
let passName = request.params.modelName + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
let passName = request.params.modelName + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
||||||
|
|
||||||
const avatar = await (
|
const avatar = await (
|
||||||
fetch("https://s.gravatar.com/avatar/83cd11399b7ea79977bc302f3931ee52?size=32&default=retro")
|
fetch("https://s.gravatar.com/avatar/83cd11399b7ea79977bc302f3931ee52?size=32&default=retro")
|
||||||
.then(res => res.buffer())
|
.then(res => res.buffer())
|
||||||
);
|
);
|
||||||
|
|
||||||
const passConfig = {
|
const passConfig = {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import app from "./webserver";
|
import app from "./webserver";
|
||||||
import { createPass } from "..";
|
import { createPass } from "passkit-generator";
|
||||||
|
|
||||||
app.all(async function manageRequest(request, response) {
|
app.all(async function manageRequest(request, response) {
|
||||||
const passName = request.params.modelName + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
const passName = request.params.modelName + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
||||||
@@ -45,6 +45,7 @@ app.all(async function manageRequest(request, response) {
|
|||||||
format: "PKBarcodeFormatPDF417"
|
format: "PKBarcodeFormatPDF417"
|
||||||
}, {
|
}, {
|
||||||
message: "Thank you for using this package <3",
|
message: "Thank you for using this package <3",
|
||||||
|
// @ts-expect-error
|
||||||
format: "PKBarcodeFormatMock44617"
|
format: "PKBarcodeFormatMock44617"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@ app.all(async function manageRequest(request, response) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
stream.pipe(response);
|
stream.pipe(response);
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
||||||
response.set({
|
response.set({
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import app from "./webserver";
|
import app from "./webserver";
|
||||||
import { createPass } from "..";
|
import { createPass } from "passkit-generator";
|
||||||
|
|
||||||
app.all(async function manageRequest(request, response) {
|
app.all(async function manageRequest(request, response) {
|
||||||
if (!request.query.fn) {
|
if (!request.query.fn) {
|
||||||
@@ -51,7 +51,7 @@ app.all(async function manageRequest(request, response) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
stream.pipe(response);
|
stream.pipe(response);
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
||||||
response.set({
|
response.set({
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import app from "./webserver";
|
import app from "./webserver";
|
||||||
import { createPass } from "..";
|
import { createPass } from "passkit-generator";
|
||||||
|
|
||||||
app.all(async function manageRequest(request, response) {
|
app.all(async function manageRequest(request, response) {
|
||||||
let passName = "exampleBooking" + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
let passName = "exampleBooking" + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import app from "./webserver";
|
import app from "./webserver";
|
||||||
import { createPass } from "..";
|
import { createPass } from "passkit-generator";
|
||||||
|
|
||||||
app.all(async function manageRequest(request, response) {
|
app.all(async function manageRequest(request, response) {
|
||||||
const passName = request.params.modelName + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
const passName = request.params.modelName + "_" + (new Date()).toISOString().split('T')[0].replace(/-/ig, "");
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
"author": "Alexander P. Cerutti <cerutti.alexander@gmail.com>",
|
"author": "Alexander P. Cerutti <cerutti.alexander@gmail.com>",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "cd ..; npm run build; cd examples"
|
"preinstall": "npm run clear:deps && npm unlink --no-save passkit-generator && cd .. && npm run build && npm link && cd examples && npm link passkit-generator",
|
||||||
|
"example": "cd build && node",
|
||||||
|
"build": "npm run build:clear && npx tsc",
|
||||||
|
"build:clear": "rm -rf build",
|
||||||
|
"clear:deps": "rm -rf node_modules"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
|||||||
9
examples/tsconfig.json
Normal file
9
examples/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
package.json
11
package.json
@@ -2,11 +2,16 @@
|
|||||||
"name": "passkit-generator",
|
"name": "passkit-generator",
|
||||||
"version": "2.0.5",
|
"version": "2.0.5",
|
||||||
"description": "The easiest way to generate custom Apple Wallet passes in Node.js",
|
"description": "The easiest way to generate custom Apple Wallet passes in Node.js",
|
||||||
"main": "index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx tsc",
|
"build": "npm run build:src",
|
||||||
|
"build:all": "npm run build:src && npm run build:examples && npm run build:spec",
|
||||||
|
"build:src": "rm -rf ./lib && npx tsc -p tsconfig.dist.json",
|
||||||
|
"build:examples": "cd examples && npm run build",
|
||||||
|
"build:spec": "rm -rf ./spec/*.js && npx tsc",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"test": "npm run build && jasmine spec/index.js"
|
"test": "npm run build:spec && npm run build:src && jasmine spec/index.js",
|
||||||
|
"example": "npm run build:src && npm --prefix examples run example"
|
||||||
},
|
},
|
||||||
"author": "Alexander Patrick Cerutti",
|
"author": "Alexander Patrick Cerutti",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
9
tsconfig.dist.json
Normal file
9
tsconfig.dist.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user