Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Remove deprecated @types/pkg-dir and pkg-dir #438

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions packages/opencensus-exporter-zpages/package-lock.json

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

4 changes: 1 addition & 3 deletions packages/opencensus-exporter-zpages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"@types/extend": "^3.0.0",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.12",
"@types/pkg-dir": "^2.0.0",
"axios": "^0.18.0",
"codecov": "^3.1.0",
"gts": "^0.9.0",
Expand All @@ -59,7 +58,6 @@
"dependencies": {
"@opencensus/core": "^0.0.9",
"ejs": "^2.5.8",
"express": "^4.16.3",
"pkg-dir": "^3.0.0"
"express": "^4.16.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
*/

import {AggregationType} from '@opencensus/core';
import * as ejs from 'ejs';
import * as path from 'path';
import {StatsParams} from '../../zpages';

const ejs = require('ejs');

import * as pkgDir from 'pkg-dir';
const templatesDir = `${pkgDir.sync(__dirname)}/templates`;

const templatesDir = path.join(__dirname, '../../../../templates');
const FIXED_SIZE = 3;

export interface ZMeasureOrders {
Expand Down Expand Up @@ -71,8 +69,7 @@ export class RpczPageHandler {
*/
emitHtml(json: boolean): string {
/** template HTML */
const rpczFile =
ejs.fileLoader(`${templatesDir}/rpcz.ejs`, 'utf8').toString();
const rpczFile = ejs.fileLoader(`${templatesDir}/rpcz.ejs`).toString();
/** CSS styles file */
const stylesFile =
ejs.fileLoader(`${templatesDir}/styles.min.css`).toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

import {AggregationData, AggregationType, TagKey, TagValue, View} from '@opencensus/core';
import {StatsParams} from '../../zpages';

const ejs = require('ejs');

import * as pkgDir from 'pkg-dir';
import * as path from 'path';

export interface StatszParams {
path: string;
Expand Down Expand Up @@ -202,7 +201,7 @@ export class StatszPageHandler {
* file
*/
private loaderFile(fileName: string): string {
const rootDir = `${pkgDir.sync(__dirname)}`;
return ejs.fileLoader(`${rootDir}/templates/${fileName}`, 'utf8');
const fileDir = path.join(__dirname, '../../../../templates', fileName);
return ejs.fileLoader(fileDir, 'utf8');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import {SamplerBuilder} from '@opencensus/core';
import * as tracing from '@opencensus/nodejs';
import * as ejs from 'ejs';
import * as pkgDir from 'pkg-dir';
import * as path from 'path';

// The directory to search for templates.
const templatesDir = `${pkgDir.sync(__dirname)}/templates`;
const templatesDir = path.join(__dirname, '../../../../templates');

export interface TraceConfigzParams {
change: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import {RootSpan, Span} from '@opencensus/core';
import * as ejs from 'ejs';
import * as pkgDir from 'pkg-dir';
import * as path from 'path';

import {LatencyBucketBoundaries} from '../latency-bucket-boundaries';

// The directory to search for templates.
const templatesDir = `${pkgDir.sync(__dirname)}/templates`;
const templatesDir = path.join(__dirname, '../../../../templates');

export type TracezParams = {
tracename: string; type: string;
Expand Down