Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: devScripts update #358

Merged
merged 3 commits into from
Mar 25, 2024
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
6 changes: 1 addition & 5 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You would only do this once after you cloned the repository.

1. Clone this repository from git.
1. `cd` into `command`.
1. We develop using feature brances off `main` and release from the `main` branch. At
1. We develop using feature branches off `main` and release from the `main` branch. At
this point, it should be set to `main` by default. If not, run `git checkout -t origin/main`.
1. `yarn` to bring in all the top-level dependencies.
1. Open the project in your editor of choice.
Expand All @@ -43,10 +43,6 @@ This cleans all generated files and directories. Run `yarn clean-all` to also cl

This tests the typescript using ts-node.

### `yarn docs`

This generates documentation into [docs](docs).

### `yarn lint`

This lints all the typescript. If there are no errors/warnings
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"clean": "sf-clean",
"clean-all": "sf-clean all",
"compile": "wireit",
"docs": "sf-docs",
"format": "wireit",
"link-check": "wireit",
"lint": "wireit",
Expand All @@ -41,13 +40,13 @@
],
"dependencies": {
"@salesforce/core": "^6.7.3",
"@salesforce/ts-types": "^2.0.9",
"@salesforce/kit": "^3.0.15",
"applicationinsights": "^2.9.5",
"got": "^11",
"proxy-agent": "^6.4.0"
},
"devDependencies": {
"@salesforce/dev-scripts": "^8.4.1",
"@salesforce/dev-scripts": "^8.4.2",
"ts-node": "^10.9.2",
"typescript": "^5.4.3"
},
Expand Down
9 changes: 4 additions & 5 deletions src/appInsights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import * as os from 'node:os';
import { Logger } from '@salesforce/core';
import { AsyncCreatable, Env } from '@salesforce/kit';
import { isBoolean, isNumber, isString, JsonPrimitive } from '@salesforce/ts-types';
import * as appInsights from 'applicationinsights';

export { TelemetryClient } from 'applicationinsights';
Expand All @@ -21,7 +20,7 @@ export type Measurements = {
};

export type Attributes = {
[key: string]: JsonPrimitive | undefined;
[key: string]: string | number | boolean | null | undefined;
};

export interface TelemetryOptions {
Expand Down Expand Up @@ -80,11 +79,11 @@ export function buildPropertiesAndMeasurements(attributes: Attributes): {
const measurements: Measurements = {};
Object.keys(attributes).forEach((key) => {
const value = attributes[key];
if (isString(value)) {
if (typeof value === 'string') {
properties[key] = value.replace(homeDir, '~');
} else if (isNumber(value)) {
} else if (typeof value === 'number') {
measurements[key] = value;
} else if (isBoolean(value)) {
} else if (typeof value === 'boolean') {
properties[key] = value.toString();
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class TelemetryReporter extends AsyncCreatable<TelemetryOptions> {
},
timeout: {
lookup: 100,
send: 10000,
send: 10_000,
response: 1000,
},
});
Expand Down
Loading
Loading