Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.1k stars 1.21k forks source link

[engsys][samples] use the new `import "dotenv/config";` pattern #30263

Open jeremymeng opened 5 months ago

jeremymeng commented 5 months ago

as it is suggested in dotenv's documentation. https://github.com/motdotla/dotenv/blob/8ab33066f90a20445d3c41e4fafba6c929c5e1a5/README.md#%EF%B8%8F-usage

It would be nice to be consistent across the repository.

MaryGao commented 2 months ago

@jeremymeng does that mean we could replace two lines with only one in sample gen?

From

import * as dotenv from "dotenv";

dotenv.config();

To

import 'dotenv/config';

Do we need to upgrade the dotenv version before that change?

jeremymeng commented 2 months ago

@MaryGao yes, current version (^16.0.0) in the repo should be good. An example:

https://github.com/Azure/azure-sdk-for-js/blob/d06725e7badadce9474df99b5c4fa31f636df109/sdk/eventhub/event-hubs/samples-dev/sendEvents.ts#L14