Skip to content

Commit bb68bf7

Browse files
committed
fix(swagger): fix referencing of yaml file
1 parent 1044c6c commit bb68bf7

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"api": "node ./dist/api.js",
8-
"build": "npm run lint && rimraf dist/ && babel ./src --out-dir dist/src --copy-files && babel ./test --out-dir dist/test --copy-files && babel ./*.js --out-dir dist/ --copy-files",
8+
"build": "npm run lint && rimraf dist/ && babel ./src --out-dir dist/src --copy-files && babel ./test --out-dir dist/test --copy-files && babel ./*.js --out-dir dist/ --copy-files && cp swagger.yaml dist/",
99
"commit": "./node_modules/.bin/git-cz",
1010
"lint": "node ./node_modules/.bin/eslint ./src ./test --fix --ext=.js --ignore-pattern node_modules/ --ignore-pattern dist/ --ignore-pattern coverage/ --quiet",
1111
"test": "npm run build && cross-env NODE_ENV=test nyc ./node_modules/.bin/mocha --timeout 10000 --require babel-core/register --require babel-polyfill './dist/test/**/*.spec.js'",

src/LaunchDarklyApiClient.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import Swagger from 'swagger-client';
22
import jsYaml from 'js-yaml';
33
import { default as fs } from 'fs';
4-
import appRoot from 'app-root-path';
54

65
export class LaunchDarklyApiClient {
76
static async create(API_TOKEN, log) {
87
log.info(`creating client with api token: ${API_TOKEN}`);
98

109
// swagger.yaml from https://launchdarkly.github.io/ld-openapi/swagger.yaml
11-
const yaml = fs.readFileSync(`${appRoot}/swagger.yaml`, 'utf-8').toString();
10+
const yaml = fs.readFileSync(__dirname + `/../swagger.yaml`, 'utf-8').toString();
1211
const json = jsYaml.safeLoad(yaml);
1312

1413
return Swagger({

0 commit comments

Comments
 (0)