microsoft / azure-devops-extension-sdk

Client SDK for developing Azure DevOps extensions
MIT License
122 stars 38 forks source link

Adding ES Module Support with Backward Compatibility for AMD #87

Closed lohitakshgupta closed 8 months ago

lohitakshgupta commented 9 months ago

This PR adds support for ES Modules while ensuring backward compatibility with AMD modules. rollup is being used for the build process here. Details:

  1. rollup.config.js generates the same set of files that were being generated by buildpackage.js earlier. It's modern and easy to use when it comes to supporting multiple modules. The only extra file that gets generated is SDK.js.map which is actually helpful for debugging purposes. Please see the comments in the code file to understand the folder structure. Essentially, it adds AMD content to the package root (ensuring backward compatibility) and ESM content to an esm folder. License, README.md, SECURITY.md and package.json files are added to the package root as well.
  2. tsconfig.amd.json extends existing tsconfig.json to support AMD modules.
  3. tsconfig.esm.json extends existing tsconfig.json to support ESM modules.

Relevant issues addressed:

66

58

56

dpaquette commented 8 months ago

Let's add the engine properties to package.json to specify which version of node/npm we should be using to build this project.

https://docs.npmjs.com/cli/v6/configuring-npm/package-json#engines