regenerate package.json, tsconfig.json for ts node (#6987)

This commit is contained in:
William Cheng 2017-11-18 21:05:19 +08:00 committed by GitHub
parent 79bac2ca04
commit ec0da35b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 584 additions and 517 deletions

View File

@ -1,2 +0,0 @@
tsconfig.json
package.json

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,15 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const api = require("./api"); var api = require("./api");
const fs = require("fs"); var fs = require("fs");
function deepCheck(objectA, objectB) { function deepCheck(objectA, objectB) {
let a = objectA; var a = objectA;
let b = objectB; var b = objectB;
let isString = (typeof a === "string" && typeof b === "string"); var isString = (typeof a === "string" && typeof b === "string");
let isBool = (typeof a === "boolean" && typeof b === "boolean"); var isBool = (typeof a === "boolean" && typeof b === "boolean");
let isNumber = (typeof a === "number" && typeof b === "number"); var isNumber = (typeof a === "number" && typeof b === "number");
if (a instanceof Array && b instanceof Array) { if (a instanceof Array && b instanceof Array) {
for (let i = 0; i < a.length; i++) { for (var i = 0; i < a.length; i++) {
if (!deepCheck(a[i], b[i])) { if (!deepCheck(a[i], b[i])) {
return false; return false;
} }
@ -20,7 +20,7 @@ function deepCheck(objectA, objectB) {
return a === b; return a === b;
} }
else if (typeof a === "object" && typeof b === "object") { else if (typeof a === "object" && typeof b === "object") {
for (let key in a) { for (var key in a) {
if (!deepCheck(a[key], b[key])) { if (!deepCheck(a[key], b[key])) {
return false; return false;
} }
@ -67,8 +67,8 @@ var deserializedPet = objectSerializer.deserialize(serializedPet, "Pet");
var petType = deserializedPet instanceof rewiredApi.Pet; var petType = deserializedPet instanceof rewiredApi.Pet;
var tagType1 = deserializedPet.tags[0] instanceof rewiredApi.Tag; var tagType1 = deserializedPet.tags[0] instanceof rewiredApi.Tag;
var categoryType = deserializedPet.category instanceof rewiredApi.Category; var categoryType = deserializedPet.category instanceof rewiredApi.Category;
let checks = {}; var checks = {};
for (let key in deserializedPet) { for (var key in deserializedPet) {
checks[key] = {}; checks[key] = {};
checks[key]["isCorrect"] = deepCheck(deserializedPet[key], serializedPet[key]); checks[key]["isCorrect"] = deepCheck(deserializedPet[key], serializedPet[key]);
checks[key]["is"] = deserializedPet[key]; checks[key]["is"] = deserializedPet[key];
@ -81,8 +81,8 @@ if (!correctTypes) {
console.log("TagType1 correct: ", tagType1); console.log("TagType1 correct: ", tagType1);
console.log("CategoryType correct: ", categoryType); console.log("CategoryType correct: ", categoryType);
} }
for (let key in checks) { for (var key in checks) {
let check = checks[key]; var check = checks[key];
if (!check["isCorrect"]) { if (!check["isCorrect"]) {
exitCode = 1; exitCode = 1;
console.log(key, " incorrect ", "\nis:\n ", check["is"], "\nshould:\n ", check["should"]); console.log(key, " incorrect ", "\nis:\n ", check["is"], "\nshould:\n ", check["should"]);
@ -100,26 +100,26 @@ if (!deepCheck(reserializedData, serializedPet)) {
console.log("Reserialized Data incorrect! \nis:\n ", reserializedData, "\nshould:\n ", serializedPet); console.log("Reserialized Data incorrect! \nis:\n ", reserializedData, "\nshould:\n ", serializedPet);
} }
petApi.addPet(pet) petApi.addPet(pet)
.then((res) => { .then(function (res) {
var newPet = res.body; var newPet = res.body;
petId = newPet.id; petId = newPet.id;
console.log(`Created pet with ID ${petId}`); console.log("Created pet with ID " + petId);
newPet.status = api.Pet.StatusEnum.Available; newPet.status = api.Pet.StatusEnum.Available;
return petApi.updatePet(newPet); return petApi.updatePet(newPet);
}) })
.then((res) => { .then(function (res) {
console.log('Updated pet using POST body'); console.log('Updated pet using POST body');
return petApi.updatePetWithForm(petId, undefined, "pending"); return petApi.updatePetWithForm(petId, undefined, "pending");
}) })
.then((res) => { .then(function (res) {
console.log('Updated pet using POST form'); console.log('Updated pet using POST form');
return petApi.uploadFile(petId, undefined, fs.readFileSync('sample.png')); return petApi.uploadFile(petId, undefined, fs.readFileSync('sample.png'));
}) })
.then((res) => { .then(function (res) {
console.log('Uploaded image'); console.log('Uploaded image');
return petApi.getPetById(petId); return petApi.getPetById(petId);
}) })
.then((res) => { .then(function (res) {
console.log('Got pet by ID: ' + JSON.stringify(res.body)); console.log('Got pet by ID: ' + JSON.stringify(res.body));
console.log("EnumValue: ", api.Pet.StatusEnum.Pending); console.log("EnumValue: ", api.Pet.StatusEnum.Pending);
console.log("Typeof EnumValue:", typeof api.Pet.StatusEnum.Pending); console.log("Typeof EnumValue:", typeof api.Pet.StatusEnum.Pending);
@ -128,14 +128,14 @@ petApi.addPet(pet)
throw new Error("Unexpected pet status"); throw new Error("Unexpected pet status");
} }
}) })
.catch((err) => { .catch(function (err) {
console.error(err); console.error(err);
exitCode = 1; exitCode = 1;
}) })
.then(() => { .then(function () {
return petApi.deletePet(petId); return petApi.deletePet(petId);
}) })
.then((res) => { .then(function (res) {
console.log('Deleted pet'); console.log('Deleted pet');
process.exit(exitCode); process.exit(exitCode);
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,7 @@
{ {
"name": "@swagger/angular2-typescript-petstore", "name": "@swagger/angular2-typescript-petstore",
"version": "0.0.1-SNAPSHOT.201605241654", "version": "0.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true,
"dependencies": { "dependencies": {
"@types/bluebird": { "@types/bluebird": {
"version": "3.5.18", "version": "3.5.18",

View File

@ -1,9 +1,10 @@
{ {
"name": "@swagger/angular2-typescript-petstore", "name": "@swagger/angular2-typescript-petstore",
"version": "0.0.1-SNAPSHOT.201605241654", "version": "0.0.1",
"description": "NodeJS client for @swagger/angular2-typescript-petstore", "description": "NodeJS client for @swagger/angular2-typescript-petstore",
"repository": "GIT_USER_ID/GIT_REPO_ID", "repository": "GIT_USER_ID/GIT_REPO_ID",
"main": "api.js", "main": "api.js",
"types": "api.d.ts",
"scripts": { "scripts": {
"clean": "rm -Rf node_modules/ *.js", "clean": "rm -Rf node_modules/ *.js",
"build": "tsc", "build": "tsc",
@ -12,12 +13,10 @@
"author": "Swagger Codegen Contributors", "author": "Swagger Codegen Contributors",
"license": "Unlicense", "license": "Unlicense",
"dependencies": { "dependencies": {
"@types/bluebird": "*",
"@types/request": "*",
"@types/rewire": "^2.5.28",
"bluebird": "^3.5.0", "bluebird": "^3.5.0",
"request": "^2.81.0", "request": "^2.81.0",
"rewire": "^2.5.2" "@types/bluebird": "*",
"@types/request": "*"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^2.4.2" "typescript": "^2.4.2"

View File

@ -3,7 +3,7 @@
"module": "commonjs", "module": "commonjs",
"noImplicitAny": false, "noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true, "suppressImplicitAnyIndexErrors": true,
"target": "ES6", "target": "ES5",
"strict": true, "strict": true,
"moduleResolution": "node", "moduleResolution": "node",
"removeComments": true, "removeComments": true,
@ -16,4 +16,3 @@
"node_modules" "node_modules"
] ]
} }