Skip to content

Commit cce9ad3

Browse files
author
Alessandro Romanelli
committed
1.0.0
1 parent 9f4c942 commit cce9ad3

File tree

6 files changed

+18
-22
lines changed

6 files changed

+18
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "expresso-api",
3-
"version": "0.2.14",
3+
"version": "1.0.0",
44
"main": "dist/lib/index.js",
55
"types": "dist/lib/index.d.ts",
66
"bin": {

src/cli/commands/compare.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ export const parseCompareCommandLineArgs = (argv: string[]): CLIOptionsCompare =
99
];
1010

1111
const parseOptions = commandLineArgs(parseCommandDefinitions, { stopAtFirstUnknown: true, argv });
12-
if (parseOptions.help) return {
13-
fileA: "", fileB: "", json: false, help: true
14-
}
12+
if (parseOptions.help)
13+
return {
14+
fileA: '',
15+
fileB: '',
16+
json: false,
17+
help: true,
18+
};
1519

1620
if (!parseOptions.files || parseOptions.files.length < 2) {
1721
throw new Error('Must provide at least two file paths as arguments');

src/lib/expresso/compare.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ export const expressoCompare = async (options: CLIOptionsCompare): Promise<void>
1717
This command compare two user-provided specifications and generates a report of how much the OAPI specification of fileB covers what is specified in fileA.
1818
1919
Available options:
20-
${table(
21-
[
22-
['-J', '--json', 'Switches output from human-readable to JSON format'],
23-
],
24-
tableOptions,
25-
)}`,
20+
${table([['-J', '--json', 'Switches output from human-readable to JSON format']], tableOptions)}`,
2621
);
2722
const results = await compareSpecifications(options.fileA, options.fileB);
2823
if (options.json) {

src/lib/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ for (const k of Object.keys(real_express)) {
1111

1212
module.exports.Router = Router;
1313
module.exports.expresso = expresso;
14-

src/lib/proxy/model/Handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import express from 'express-original';
22
import { Endpoint, EndpointJSON } from './Endpoint';
33
import { Method } from './Method';
4-
import path from 'path'
4+
import path from 'path';
55

66
export interface HandlerJSON {
77
_instance: ExpressHandler;

src/lib/replacer/index.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import { stat, move, copy, remove, readFile } from 'fs-extra';
33
import logger from 'jet-logger';
44
import filesize from 'filesize';
55
import { exec as syncExec } from 'child_process';
6-
import util from "util";
6+
import util from 'util';
77

88
const exec = util.promisify(syncExec);
99

10-
1110
/**
1211
* Function to create a working copy of the project at basePath substituting express
1312
* with the express-api module. The folder is first duplicated and then placed within
@@ -51,18 +50,18 @@ export const replaceExpress = async (basePath: string): Promise<boolean> => {
5150
await move(path.resolve(basePath, '../.expresso-runtime'), path.resolve(basePath, '.expresso-runtime'));
5251
logger.info(`Created folder '.expresso-runtime' work copy`);
5352

54-
const { stdout } = await exec("npm list -g | head -1")
55-
const npmLibFolder = stdout.trim()
53+
const { stdout } = await exec('npm list -g | head -1');
54+
const npmLibFolder = stdout.trim();
5655

5756
// Install the global 'expresso-api' as local 'express' within the work copy
5857
await copy(
5958
path.resolve(npmLibFolder, 'node_modules/expresso-api'),
6059
path.resolve(basePath, '.expresso-runtime/node_modules/express'),
6160
{
6261
recursive: true,
63-
overwrite: true
64-
}
65-
)
62+
overwrite: true,
63+
},
64+
);
6665

6766
try {
6867
// Install the 'express' types within as types for 'expresso-api'
@@ -74,7 +73,7 @@ export const replaceExpress = async (basePath: string): Promise<boolean> => {
7473
},
7574
);
7675
} catch (e) {
77-
logger.warn("Could not find any 'express' types installed")
76+
logger.warn("Could not find any 'express' types installed");
7877
}
7978

8079
// Install the real 'express' within the work copy with a different name to avoid conflicts
@@ -83,11 +82,10 @@ export const replaceExpress = async (basePath: string): Promise<boolean> => {
8382
path.resolve(basePath, '.expresso-runtime/node_modules/express-original'),
8483
{
8584
recursive: true,
86-
overwrite: true
85+
overwrite: true,
8786
},
8887
);
8988
logger.info(`Created 'express' proxy within work copy`);
90-
9189
} catch (e) {
9290
logger.err(e);
9391
logger.err(`Failed to replace 'express' in folder '${path.resolve(basePath, '.expresso-runtime')}'`);

0 commit comments

Comments
 (0)