Skip to content

Commit

Permalink
[iot] Migrate @azure/iot-modelrepository to ESM/vitest (#31884)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR

- @azure/iot-modelrepository

### Issues associated with this PR

- #31338

### Describe the problem that is addressed by this PR

Migrates the @azure/iot-modelrepository package via automation 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)
  • Loading branch information
mpodwysocki authored Nov 22, 2024
1 parent e99dc0b commit c5f4ce5
Show file tree
Hide file tree
Showing 27 changed files with 217 additions and 283 deletions.
24 changes: 20 additions & 4 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions sdk/iot/iot-modelsrepository/.nycrc

This file was deleted.

2 changes: 1 addition & 1 deletion sdk/iot/iot-modelsrepository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ npm install @azure/iot-modelsrepository
// When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint
// https://devicemodels.azure.com/ is used and the model dependency resolution
// configuration is set to TryFromExpanded.
const { ModelsRepositoryClient } = require("@azure/iot-modelsrepository");
import { ModelsRepositoryClient } from "@azure/iot-modelsrepository";

const client = new ModelsRepositoryClient();
console.log(`Initialized client point to global endpoint: ${client.repositoryLocation}`);
Expand Down
4 changes: 2 additions & 2 deletions sdk/iot/iot-modelsrepository/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "types/src/index.d.ts",
"mainEntryPointFilePath": "dist/esm/index.d.ts",
"docModel": {
"enabled": true
},
Expand All @@ -11,7 +11,7 @@
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/iot-modelsrepository.d.ts"
"publicTrimmedFilePath": "dist/iot-modelsrepository.d.ts"
},
"messages": {
"tsdocMessageReporting": {
Expand Down
123 changes: 0 additions & 123 deletions sdk/iot/iot-modelsrepository/karma.conf.js

This file was deleted.

115 changes: 65 additions & 50 deletions sdk/iot/iot-modelsrepository/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,38 @@
"version": "1.0.0-beta.3",
"description": "Device Model Repository Library with typescript type definitions for node.js and browser.",
"sdk-type": "client",
"main": "dist/index.js",
"module": "dist-esm/src/index.js",
"browser": {
"./dist-esm/src/print.js": "./dist-esm/src/print.browser.js",
"./dist-esm/src/utils/path.js": "./dist-esm/src/utils/path.browser.js",
"./dist-esm/src/fetcherFilesystem.js": "./dist-esm/src/utils/fetcherFilesystem.browser.js"
},
"types": "types/iot-modelsrepository.d.ts",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"browser": "./dist/browser/index.js",
"types": "./dist/commonjs/index.d.ts",
"scripts": {
"build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run extract-api",
"build:browser": "tsc -p . && dev-tool run bundle",
"build:node": "tsc -p . && dev-tool run bundle",
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
"build:browser": "dev-tool run build-package && dev-tool run bundle",
"build:node": "dev-tool run build-package && dev-tool run bundle",
"build:samples": "echo Obsolete.",
"build:test": "tsc -p . && dev-tool run bundle",
"build:test": "dev-tool run build-package && dev-tool run bundle",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"clean": "dev-tool run vendored rimraf --glob dist dist-* test-dist temp types *.tgz *.log",
"execute:samples": "dev-tool samples run samples-dev",
"extract-api": "tsc -p . && dev-tool run extract-api",
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "karma start --single-run",
"integration-test:node": "dev-tool run test:node-js-input",
"lint": "eslint package.json api-extractor.json src test",
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
"integration-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
"integration-test:node": "dev-tool run test:vitest",
"lint": "dev-tool run vendored eslint package.json api-extractor.json src test",
"lint:fix": "dev-tool run vendored eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
"pack": "npm pack 2>&1",
"temp-unit-test": "mocha -r ts-node/register --timeout 1200000 test/node/*.spec.ts",
"test": "npm run build:test && npm run unit-test && npm run integration-test",
"test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:browser": "karma start --single-run",
"unit-test:node": "dev-tool run test:node-ts-input --no-test-proxy",
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
"unit-test:node": "dev-tool run test:vitest",
"update-snippets": "echo skipped"
},
"files": [
"dist/",
"dist-esm/src/",
"types/iot-modelsrepository.d.ts",
"README.md",
"LICENSE"
],
Expand All @@ -62,42 +56,26 @@
"sideEffects": false,
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
"dependencies": {
"@azure/core-client": "^1.0.0",
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/core-tracing": "^1.0.0",
"@azure/core-util": "^1.0.0",
"@azure/logger": "^1.0.0",
"events": "^3.0.0",
"tslib": "^2.2.0"
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.18.0",
"@azure/core-tracing": "^1.2.0",
"@azure/core-util": "^1.11.0",
"@azure/logger": "^1.1.4",
"events": "^3.3.0",
"tslib": "^2.8.1"
},
"devDependencies": {
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-recorder": "^4.1.0",
"@azure-tools/test-utils-vitest": "^1.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@types/chai": "^4.1.6",
"@types/mocha": "^10.0.0",
"@types/node": "^18.0.0",
"@types/sinon": "^17.0.0",
"chai": "^4.2.0",
"@vitest/browser": "^2.1.5",
"@vitest/coverage-istanbul": "^2.1.5",
"eslint": "^9.9.0",
"inherits": "^2.0.3",
"karma": "^6.2.0",
"karma-chrome-launcher": "^3.0.0",
"karma-coverage": "^2.0.0",
"karma-env-preprocessor": "^0.1.1",
"karma-firefox-launcher": "^1.1.0",
"karma-json-preprocessor": "^0.3.3",
"karma-json-to-file-reporter": "^1.0.1",
"karma-junit-reporter": "^2.0.1",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-sourcemap-loader": "^0.3.8",
"mocha": "^10.0.0",
"nyc": "^17.0.0",
"sinon": "^17.0.0",
"ts-node": "^10.0.0",
"playwright": "^1.49.0",
"typescript": "~5.6.2",
"util": "^0.12.1"
"vitest": "^2.1.5"
},
"standard": {
"env": [
Expand All @@ -122,5 +100,42 @@
"prefix": "SDK_VERSION"
}
]
},
"type": "module",
"tshy": {
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
},
"dialects": [
"esm",
"commonjs"
],
"esmDialects": [
"browser",
"react-native"
],
"selfLink": false
},
"exports": {
"./package.json": "./package.json",
".": {
"browser": {
"types": "./dist/browser/index.d.ts",
"default": "./dist/browser/index.js"
},
"react-native": {
"types": "./dist/react-native/index.d.ts",
"default": "./dist/react-native/index.js"
},
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
}
}
Loading

0 comments on commit c5f4ce5

Please sign in to comment.