Skip to content

Commit

Permalink
[agrifood-farming-rest] Migration to ESM/vitest (#31951)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR
`@azure-rest/agrifood-farming`

### Issues associated with this PR
#31338
  • Loading branch information
HarshaNalluru authored Dec 10, 2024
1 parent 53155a8 commit 86d5ce3
Show file tree
Hide file tree
Showing 19 changed files with 676 additions and 501 deletions.
796 changes: 524 additions & 272 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions sdk/agrifood/agrifood-farming-rest/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/agrifood-farming-rest.d.ts"
"publicTrimmedFilePath": "dist/agrifood-farming-rest.d.ts"
},
"messages": {
"tsdocMessageReporting": {
Expand Down
134 changes: 0 additions & 134 deletions sdk/agrifood/agrifood-farming-rest/karma.conf.js

This file was deleted.

98 changes: 58 additions & 40 deletions sdk/agrifood/agrifood-farming-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@
"isomorphic"
],
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist-esm/src/index.js",
"types": "./types/agrifood-farming-rest.d.ts",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/commonjs/index.d.ts",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/agrifood/agrifood-farming/README.md",
"repository": "github:Azure/azure-sdk-for-js",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"files": [
"dist/",
"dist-esm/src/",
"types/agrifood-farming-rest.d.ts",
"README.md",
"LICENSE"
],
Expand All @@ -49,34 +47,32 @@
"Azure FarmBeats Service instance": "https://docs.microsoft.com/azure/industry/agriculture/install-azure-farmbeats"
}
},
"browser": {
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
},
"browser": "./dist/browser/index.js",
"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:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api",
"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:debug": "dev-tool run build-package && dev-tool run bundle && dev-tool run extract-api",
"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-browser dist-esm test-dist temp types *.tgz *.log",
"execute:samples": "dev-tool samples run samples-dev",
"extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && 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}\"",
"generate:client": "autorest --typescript swagger/README.md && npm run format",
"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 -- --timeout 5000000 \"dist-esm/test/{,!(browser)/**/}*.spec.js\"",
"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": "eslint package.json api-extractor.json src test",
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
"pack": "npm pack 2>&1",
"test": "npm run clean && npm run build:test && npm run unit-test",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
"unit-test": "dev-tool run vendored cross-env TEST_MODE=playback && npm run unit-test:node && npm run unit-test:browser",
"unit-test:browser": "dev-tool run test:browser",
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
"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"
},
"sideEffects": false,
Expand All @@ -91,35 +87,57 @@
"tslib": "^2.2.0"
},
"devDependencies": {
"@azure-tools/test-credential": "^1.0.0",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-utils": "^1.0.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.1.0",
"@azure-tools/test-utils-vitest": "^1.0.0",
"@azure/core-util": "^1.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/identity": "^4.0.1",
"@types/chai": "^4.1.6",
"@types/mocha": "^10.0.0",
"@types/node": "^18.0.0",
"chai": "^4.2.0",
"@vitest/browser": "^2.1.5",
"@vitest/coverage-istanbul": "^2.1.5",
"dotenv": "^16.0.0",
"eslint": "^9.9.0",
"karma": "^6.2.0",
"karma-chrome-launcher": "^3.0.0",
"karma-coverage": "^2.0.0",
"karma-env-preprocessor": "^0.1.1",
"karma-firefox-launcher": "^2.1.3",
"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-source-map-support": "~1.4.0",
"karma-sourcemap-loader": "^0.3.8",
"mocha": "^11.0.2",
"nyc": "^17.0.0",
"source-map-support": "^0.5.9",
"ts-node": "^10.0.0",
"typescript": "~5.6.2"
"playwright": "^1.49.0",
"typescript": "~5.6.2",
"vitest": "^2.1.5"
},
"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"
}
}
}
}
4 changes: 2 additions & 2 deletions sdk/agrifood/agrifood-farming-rest/src/clientDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ import type {
ZonesListParameters,
ZonesGetCascadeDeleteJobDetailsParameters,
ZonesCreateCascadeDeleteJobParameters,
} from "./parameters";
} from "./parameters.js";
import type {
ApplicationDataList200Response,
ApplicationDataListDefaultResponse,
Expand Down Expand Up @@ -623,7 +623,7 @@ import type {
ZonesGetCascadeDeleteJobDetailsDefaultResponse,
ZonesCreateCascadeDeleteJob202Response,
ZonesCreateCascadeDeleteJobDefaultResponse,
} from "./responses";
} from "./responses.js";
import type { Client, StreamableMethod } from "@azure-rest/core-client";

export interface ApplicationDataList {
Expand Down
2 changes: 1 addition & 1 deletion sdk/agrifood/agrifood-farming-rest/src/farmBeats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { ClientOptions } from "@azure-rest/core-client";
import { getClient } from "@azure-rest/core-client";
import type { TokenCredential } from "@azure/core-auth";
import type { FarmBeatsClient } from "./clientDefinitions";
import type { FarmBeatsClient } from "./clientDefinitions.js";

/**
* Initialize a new instance of `FarmBeatsClient`
Expand Down
22 changes: 11 additions & 11 deletions sdk/agrifood/agrifood-farming-rest/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import FarmBeats from "./farmBeats";
import FarmBeats from "./farmBeats.js";

export * from "./farmBeats";
export * from "./parameters";
export * from "./responses";
export * from "./clientDefinitions";
export * from "./isUnexpected";
export * from "./models";
export * from "./outputModels";
export * from "./paginateHelper";
export * from "./pollingHelper";
export * from "./serializeHelper";
export * from "./farmBeats.js";
export * from "./parameters.js";
export * from "./responses.js";
export * from "./clientDefinitions.js";
export * from "./isUnexpected.js";
export * from "./models.js";
export * from "./outputModels.js";
export * from "./paginateHelper.js";
export * from "./pollingHelper.js";
export * from "./serializeHelper.js";

export default FarmBeats;
2 changes: 1 addition & 1 deletion sdk/agrifood/agrifood-farming-rest/src/isUnexpected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ import type {
ZonesGetCascadeDeleteJobDetailsDefaultResponse,
ZonesCreateCascadeDeleteJob202Response,
ZonesCreateCascadeDeleteJobDefaultResponse,
} from "./responses";
} from "./responses.js";

const responseMap: Record<string, string[]> = {
"GET /application-data": ["200"],
Expand Down
2 changes: 1 addition & 1 deletion sdk/agrifood/agrifood-farming-rest/src/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import type {
WeatherDataIngestionJob,
WeatherDataProviderRequest,
Zone,
} from "./models";
} from "./models.js";

export interface ApplicationDataListQueryParamProperties {
/** Minimum average amount of material applied during the application (inclusive). */
Expand Down
2 changes: 1 addition & 1 deletion sdk/agrifood/agrifood-farming-rest/src/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import type {
WeatherDataProviderResponseOutput,
ZoneListResponseOutput,
ZoneOutput,
} from "./outputModels";
} from "./outputModels.js";

/** Returns a paginated list of application data resources across all parties. */
export interface ApplicationDataList200Response extends HttpResponse {
Expand Down
Loading

0 comments on commit 86d5ce3

Please sign in to comment.