Skip to content

Commit

Permalink
Merge pull request #358 from forcedotcom/devScripts2024-03-24
Browse files Browse the repository at this point in the history
refactor: devScripts update
  • Loading branch information
svc-cli-bot authored Mar 25, 2024
2 parents 3c3f077 + 01c0d5d commit 3f3054e
Show file tree
Hide file tree
Showing 5 changed files with 218 additions and 227 deletions.
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

0 comments on commit 3f3054e

Please sign in to comment.