faa0046a76
### Packages impacted by this PR - @azure/template-dpg ### Issues associated with this PR - https://github.com/Azure/azure-sdk-for-js/issues/31338 ### Describe the problem that is addressed by this PR Upgrades @azure/template-dpg to ESM/vitest ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary) --------- Co-authored-by: Jeremy Meng <jeremy.ymeng@gmail.com> |
||
---|---|---|
.. | ||
review | ||
samples-dev | ||
sources | ||
src | ||
test/public | ||
CHANGELOG.md | ||
LICENSE | ||
README.md | ||
api-extractor.json | ||
assets.json | ||
package.json | ||
tsconfig.browser.config.json | ||
tsconfig.json | ||
vitest.browser.config.ts | ||
vitest.config.ts |
README.md
Azure Template client library for JavaScript
This project is used as a template package for the Azure SDK for JavaScript. It is intended to help Azure SDK developers bootstrap new packages, and it provides an example of how to organize the code and documentation of a client library for an Azure service.
Getting started
Currently supported environments
- LTS versions of Node.js
- Latest versions of Safari, Chrome, Edge, and Firefox.
See our support policy for more details.
Prerequisites
Usually you'd put a shell command for provisioning the necessary Azure services here.
Install the @azure/template
package
Install the Template client library for JavaScript with npm
:
npm install @azure/template
Browser support
JavaScript Bundle
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our bundling documentation.
CORS
You need to set up Cross-Origin Resource Sharing (CORS) rules for your storage account if you need to develop for browsers. Go to Azure portal and Azure Storage Explorer, find your storage account, create new CORS rules for blob/queue/file/table service(s).
For example, you can create the following CORS settings for debugging. But please customize the settings carefully according to your requirements in a production environment.
- Allowed origins: *
- Allowed verbs: DELETE,GET,HEAD,MERGE,POST,OPTIONS,PUT
- Allowed headers: *
- Exposed headers: *
- Maximum age (seconds): 86400
Further examples
Top-level examples usually include things like creating and authenticating the main Client. If your service supports multiple means of authenticating (e.g. key-based and Azure Active Directory) you can give a separate example of each.
Key concepts
ConfigurationClient
Describe your primary client here. Talk about what operations it can do and when a developer would want to use it.
Additional Examples
Create a section for each top-level service concept you want to explain.
Examples
First Example
Create several code examples for how someone would use your library to accomplish a common task with the service.
Troubleshooting
Logging
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the AZURE_LOG_LEVEL
environment variable to info
. Alternatively, logging can be enabled at runtime by calling setLogLevel
in the @azure/logger
:
const { setLogLevel } = require("@azure/logger");
setLogLevel("info");
For more detailed instructions on how to enable logs, you can look at the @azure/logger package docs.
Next steps
Please take a look at the samples directory for detailed examples that demonstrate how to use the client libraries.
Contributing
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.