Skip to content

Commit

Permalink
removes pjson and directly requires package.json, fixes #478
Browse files Browse the repository at this point in the history
  • Loading branch information
aoberoi committed Mar 14, 2018
1 parent dee4b03 commit 8e4da08
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"p-cancelable": "^0.3.0",
"p-queue": "^2.3.0",
"p-retry": "^1.0.0",
"pjson": "^1.0.9",
"retry": "^0.10.1",
"url-join": "^4.0.0",
"ws": "^4.1.0"
Expand Down
4 changes: 2 additions & 2 deletions src/KeepAlive.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RTMClient, ErrorCode } from './';
import EventEmitter = require('eventemitter3'); // tslint:disable-line:import-name no-require-imports
import * as pjson from 'pjson';
import { LogLevel, Logger, LoggingFunc, getLogger, loggerFromLoggingFunc } from './logger';
import { errorWithCode } from './errors';
const pkg = require('../package.json'); // tslint:disable-line:no-require-imports no-var-requires

export interface KeepAliveOptions {
logger?: LoggingFunc;
Expand Down Expand Up @@ -50,7 +50,7 @@ export class KeepAlive extends EventEmitter {
/**
* The name used to prefix all logging generated from this object
*/
private static loggerName = `${pjson.name}:KeepAlive`;
private static loggerName = `${pkg.name}:KeepAlive`;

/**
* This object's logger instance
Expand Down
4 changes: 2 additions & 2 deletions src/RTMClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Agent } from 'http';
import * as pjson from 'pjson';
import objectValues = require('object.values'); // tslint:disable-line:import-name no-require-imports
import EventEmitter = require('eventemitter3'); // tslint:disable-line:import-name no-require-imports
import WebSocket = require('ws'); // tslint:disable-line:import-name no-require-imports
Expand All @@ -13,6 +12,7 @@ import { WebClient, WebAPICallResult, WebAPICallError, ErrorCode, CodedError } f
import * as methods from './methods'; // tslint:disable-line:import-name
import { errorWithCode } from './errors';
import { callbackify, TLSOptions } from './util';
const pkg = require('../package.json'); // tslint:disable-line:no-require-imports no-var-requires

/**
* An RTMClient allows programs to communicate with the {@link https://api.slack.com/rtm|Slack Platform's RTM API}.
Expand Down Expand Up @@ -272,7 +272,7 @@ export class RTMClient extends EventEmitter {
/**
* The name used to prefix all logging generated from this object
*/
private static loggerName = `${pjson.name}:RTMClient`;
private static loggerName = `${pkg.name}:RTMClient`;


/**
Expand Down
4 changes: 2 additions & 2 deletions src/WebClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Readable } from 'stream';
import objectEntries = require('object.entries'); // tslint:disable-line:no-require-imports
import * as pjson from 'pjson';
import urlJoin = require('url-join'); // tslint:disable-line:no-require-imports
import isStream = require('is-stream'); // tslint:disable-line:no-require-imports
import EventEmitter = require('eventemitter3'); // tslint:disable-line:import-name no-require-imports
Expand All @@ -15,6 +14,7 @@ import { CodedError, errorWithCode, ErrorCode } from './errors';
import { LogLevel, Logger, LoggingFunc, getLogger, loggerFromLoggingFunc } from './logger';
import retryPolicies, { RetryOptions } from './retry-policies';
import Method, * as methods from './methods'; // tslint:disable-line:import-name
const pkg = require('../package.json'); // tslint:disable-line:no-require-imports no-var-requires

/**
* A client for Slack's Web API
Expand Down Expand Up @@ -58,7 +58,7 @@ export class WebClient extends EventEmitter {
/**
* The name used to prefix all logging generated from this object
*/
private static loggerName = `${pjson.name}:WebClient`;
private static loggerName = `${pkg.name}:WebClient`;

/**
* This object's logger instance
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as util from 'util';
import * as os from 'os';
import * as pjson from 'pjson';
import { Agent } from 'http';
import objectEntries = require('object.entries'); // tslint:disable-line:no-require-imports
const pkg = require('../package.json'); // tslint:disable-line:no-require-imports no-var-requires

/**
* For when you need a function that does nothing
Expand All @@ -17,7 +17,7 @@ function replaceSlashes(s: string): string {
return s.replace('/', ':');
}

const baseUserAgent = `${replaceSlashes(pjson.name)}/${pjson.version} ` +
const baseUserAgent = `${replaceSlashes(pkg.name)}/${pkg.version} ` +
`node/${process.version.replace('v', '')} ` +
`${os.platform()}/${os.release()}`;

Expand Down

0 comments on commit 8e4da08

Please sign in to comment.