@azure-tools/typespec-ts 0.54.2 → 0.55.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -9
- package/README.md +68 -105
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +3 -4
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +2 -3
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +2 -3
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +4 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +26 -34
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/sample.js +1 -1
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +104 -170
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +2 -18
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +30 -124
- package/dist/src/lib.js.map +1 -1
- package/dist/src/modular/build-classical-client.js +2 -2
- package/dist/src/modular/build-classical-client.js.map +1 -1
- package/dist/src/modular/build-client-context.d.ts.map +1 -1
- package/dist/src/modular/build-client-context.js +6 -15
- package/dist/src/modular/build-client-context.js.map +1 -1
- package/dist/src/modular/build-project-files.d.ts.map +1 -1
- package/dist/src/modular/build-project-files.js +4 -4
- package/dist/src/modular/build-project-files.js.map +1 -1
- package/dist/src/modular/build-restore-poller.js +2 -2
- package/dist/src/modular/build-restore-poller.js.map +1 -1
- package/dist/src/modular/build-root-index.d.ts.map +1 -1
- package/dist/src/modular/build-root-index.js +9 -13
- package/dist/src/modular/build-root-index.js.map +1 -1
- package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
- package/dist/src/modular/build-subpath-index.js +4 -4
- package/dist/src/modular/build-subpath-index.js.map +1 -1
- package/dist/src/modular/emit-logger-file.d.ts.map +1 -1
- package/dist/src/modular/emit-logger-file.js +0 -3
- package/dist/src/modular/emit-logger-file.js.map +1 -1
- package/dist/src/modular/emit-models-options.js +2 -2
- package/dist/src/modular/emit-models-options.js.map +1 -1
- package/dist/src/modular/emit-models.d.ts.map +1 -1
- package/dist/src/modular/emit-models.js +7 -22
- package/dist/src/modular/emit-models.js.map +1 -1
- package/dist/src/modular/emit-samples.d.ts.map +1 -1
- package/dist/src/modular/emit-samples.js +10 -28
- package/dist/src/modular/emit-samples.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts +2 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +21 -11
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/client-helpers.js +6 -16
- package/dist/src/modular/helpers/client-helpers.js.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.js +11 -28
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
- package/dist/src/modular/serialization/serialize-utils.js +2 -2
- package/dist/src/modular/serialization/serialize-utils.js.map +1 -1
- package/dist/src/rlc-common/helpers/imports-util.d.ts +3 -4
- package/dist/src/rlc-common/helpers/imports-util.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/imports-util.js +43 -56
- package/dist/src/rlc-common/helpers/imports-util.js.map +1 -1
- package/dist/src/rlc-common/helpers/name-constructors.d.ts +0 -9
- package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/name-constructors.js +1 -17
- package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +0 -18
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +0 -18
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts +2 -20
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
- package/dist/src/rlc-common/interfaces.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js +5 -42
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.js +3 -41
- package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.js +25 -73
- package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.js +18 -108
- package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.js +1 -2
- package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-test-config.js +1 -4
- package/dist/src/rlc-common/metadata/build-test-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.js +19 -60
- package/dist/src/rlc-common/metadata/build-ts-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.js +0 -3
- package/dist/src/rlc-common/metadata/build-warp-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts +1 -38
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js +1 -108
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +0 -39
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +4 -20
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +1 -22
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.js +21 -98
- package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -1
- package/dist/src/rlc-common/static/polling-content.d.ts +1 -1
- package/dist/src/rlc-common/static/polling-content.d.ts.map +1 -1
- package/dist/src/rlc-common/static/polling-content.js +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.js +2 -5
- package/dist/src/rlc-common/test/build-recorded-client.js.map +1 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts +1 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-sample-test.js +2 -5
- package/dist/src/rlc-common/test/build-sample-test.js.map +1 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts +1 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-snippets.js +2 -6
- package/dist/src/rlc-common/test/build-snippets.js.map +1 -1
- package/dist/src/rlc-common/test/template.d.ts +3 -3
- package/dist/src/rlc-common/test/template.d.ts.map +1 -1
- package/dist/src/rlc-common/test/template.js +1 -35
- package/dist/src/rlc-common/test/template.js.map +1 -1
- package/dist/src/transform/transform-helper-function-details.d.ts +2 -2
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
- package/dist/src/transform/transform-helper-function-details.js +1 -9
- package/dist/src/transform/transform-helper-function-details.js.map +1 -1
- package/dist/src/transform/transform-schemas.js +1 -1
- package/dist/src/transform/transform-schemas.js.map +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +9 -16
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.d.ts +2 -2
- package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.js +29 -94
- package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
- package/dist/src/utils/client-utils.d.ts +1 -1
- package/dist/src/utils/client-utils.d.ts.map +1 -1
- package/dist/src/utils/client-utils.js +4 -5
- package/dist/src/utils/client-utils.js.map +1 -1
- package/dist/src/utils/emit-util.d.ts +0 -1
- package/dist/src/utils/emit-util.d.ts.map +1 -1
- package/dist/src/utils/emit-util.js +13 -24
- package/dist/src/utils/emit-util.js.map +1 -1
- package/dist/src/utils/file-system-utils.d.ts +4 -4
- package/dist/src/utils/file-system-utils.d.ts.map +1 -1
- package/dist/src/utils/file-system-utils.js +14 -16
- package/dist/src/utils/file-system-utils.js.map +1 -1
- package/dist/src/utils/import-helper.js +3 -3
- package/dist/src/utils/import-helper.js.map +1 -1
- package/dist/src/utils/model-utils.d.ts +1 -1
- package/dist/src/utils/model-utils.d.ts.map +1 -1
- package/dist/src/utils/model-utils.js +4 -11
- package/dist/src/utils/model-utils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.d.ts +6 -4
- package/dist/src/utils/resolve-project-root.d.ts.map +1 -1
- package/dist/src/utils/resolve-project-root.js +11 -18
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -59
- package/src/framework/hooks/binder.ts +4 -5
- package/src/framework/hooks/sdk-types.ts +2 -3
- package/src/framework/load-static-helpers.ts +38 -41
- package/src/framework/sample.ts +1 -1
- package/src/index.ts +126 -204
- package/src/lib.ts +32 -143
- package/src/modular/build-classical-client.ts +2 -2
- package/src/modular/build-client-context.ts +6 -14
- package/src/modular/build-project-files.ts +11 -4
- package/src/modular/build-restore-poller.ts +2 -2
- package/src/modular/build-root-index.ts +9 -13
- package/src/modular/build-subpath-index.ts +4 -4
- package/src/modular/emit-logger-file.ts +0 -3
- package/src/modular/emit-models-options.ts +2 -2
- package/src/modular/emit-models.ts +7 -23
- package/src/modular/emit-samples.ts +10 -26
- package/src/modular/emit-tests.ts +28 -11
- package/src/modular/helpers/client-helpers.ts +7 -17
- package/src/modular/helpers/example-value-helpers.ts +11 -26
- package/src/modular/serialization/serialize-utils.ts +2 -2
- package/src/rlc-common/helpers/imports-util.ts +44 -56
- package/src/rlc-common/helpers/name-constructors.ts +1 -23
- package/src/rlc-common/index.ts +0 -18
- package/src/rlc-common/interfaces.ts +2 -23
- package/src/rlc-common/metadata/build-api-extractor-config.ts +5 -47
- package/src/rlc-common/metadata/build-es-lint-config.ts +3 -42
- package/src/rlc-common/metadata/build-package-file.ts +24 -86
- package/src/rlc-common/metadata/build-readme-file.ts +19 -121
- package/src/rlc-common/metadata/build-sample-env-file.ts +1 -4
- package/src/rlc-common/metadata/build-test-config.ts +1 -6
- package/src/rlc-common/metadata/build-ts-config.ts +30 -72
- package/src/rlc-common/metadata/build-warp-config.ts +0 -4
- package/src/rlc-common/metadata/package-json/azure-package-common.ts +2 -134
- package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +4 -24
- package/src/rlc-common/metadata/package-json/package-common.ts +22 -120
- package/src/rlc-common/static/polling-content.ts +1 -1
- package/src/rlc-common/test/build-recorded-client.ts +2 -5
- package/src/rlc-common/test/build-sample-test.ts +2 -5
- package/src/rlc-common/test/build-snippets.ts +2 -6
- package/src/rlc-common/test/template.ts +1 -35
- package/src/transform/transform-helper-function-details.ts +1 -10
- package/src/transform/transform-schemas.ts +1 -1
- package/src/transform/transform.ts +8 -19
- package/src/transform/transfrom-rlc-options.ts +29 -127
- package/src/utils/client-utils.ts +4 -5
- package/src/utils/emit-util.ts +14 -39
- package/src/utils/file-system-utils.ts +14 -15
- package/src/utils/import-helper.ts +3 -3
- package/src/utils/model-utils.ts +4 -17
- package/src/utils/resolve-project-root.ts +11 -24
- package/dist/src/rlc-common/build-client-definitions.d.ts +0 -6
- package/dist/src/rlc-common/build-client-definitions.d.ts.map +0 -1
- package/dist/src/rlc-common/build-client-definitions.js +0 -157
- package/dist/src/rlc-common/build-client-definitions.js.map +0 -1
- package/dist/src/rlc-common/build-client.d.ts +0 -9
- package/dist/src/rlc-common/build-client.d.ts.map +0 -1
- package/dist/src/rlc-common/build-client.js +0 -391
- package/dist/src/rlc-common/build-client.js.map +0 -1
- package/dist/src/rlc-common/build-index-file.d.ts +0 -6
- package/dist/src/rlc-common/build-index-file.d.ts.map +0 -1
- package/dist/src/rlc-common/build-index-file.js +0 -241
- package/dist/src/rlc-common/build-index-file.js.map +0 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.js +0 -223
- package/dist/src/rlc-common/build-is-unexpected-helper.js.map +0 -1
- package/dist/src/rlc-common/build-logger.d.ts +0 -6
- package/dist/src/rlc-common/build-logger.d.ts.map +0 -1
- package/dist/src/rlc-common/build-logger.js +0 -31
- package/dist/src/rlc-common/build-logger.js.map +0 -1
- package/dist/src/rlc-common/build-method-shortcuts.d.ts +0 -5
- package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +0 -1
- package/dist/src/rlc-common/build-method-shortcuts.js +0 -54
- package/dist/src/rlc-common/build-method-shortcuts.js.map +0 -1
- package/dist/src/rlc-common/build-object-types.d.ts +0 -29
- package/dist/src/rlc-common/build-object-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-object-types.js +0 -412
- package/dist/src/rlc-common/build-object-types.js.map +0 -1
- package/dist/src/rlc-common/build-paginate-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-paginate-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-paginate-helper.js +0 -27
- package/dist/src/rlc-common/build-paginate-helper.js.map +0 -1
- package/dist/src/rlc-common/build-parameter-types.d.ts +0 -14
- package/dist/src/rlc-common/build-parameter-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-parameter-types.js +0 -391
- package/dist/src/rlc-common/build-parameter-types.js.map +0 -1
- package/dist/src/rlc-common/build-polling-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-polling-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-polling-helper.js +0 -61
- package/dist/src/rlc-common/build-polling-helper.js.map +0 -1
- package/dist/src/rlc-common/build-response-types.d.ts +0 -6
- package/dist/src/rlc-common/build-response-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-response-types.js +0 -143
- package/dist/src/rlc-common/build-response-types.js.map +0 -1
- package/dist/src/rlc-common/build-samples.d.ts +0 -3
- package/dist/src/rlc-common/build-samples.d.ts.map +0 -1
- package/dist/src/rlc-common/build-samples.js +0 -30
- package/dist/src/rlc-common/build-samples.js.map +0 -1
- package/dist/src/rlc-common/build-schema-type.d.ts +0 -20
- package/dist/src/rlc-common/build-schema-type.d.ts.map +0 -1
- package/dist/src/rlc-common/build-schema-type.js +0 -71
- package/dist/src/rlc-common/build-schema-type.js.map +0 -1
- package/dist/src/rlc-common/build-serialize-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-serialize-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-serialize-helper.js +0 -36
- package/dist/src/rlc-common/build-serialize-helper.js.map +0 -1
- package/dist/src/rlc-common/build-top-level-index-file.d.ts +0 -6
- package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +0 -1
- package/dist/src/rlc-common/build-top-level-index-file.js +0 -48
- package/dist/src/rlc-common/build-top-level-index-file.js.map +0 -1
- package/dist/src/rlc-common/helpers/package-util.d.ts +0 -7
- package/dist/src/rlc-common/helpers/package-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/package-util.js +0 -10
- package/dist/src/rlc-common/helpers/package-util.js.map +0 -1
- package/dist/src/rlc-common/helpers/path-utils.d.ts +0 -2
- package/dist/src/rlc-common/helpers/path-utils.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/path-utils.js +0 -10
- package/dist/src/rlc-common/helpers/path-utils.js.map +0 -1
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +0 -4
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/shortcut-methods.js +0 -49
- package/dist/src/rlc-common/helpers/shortcut-methods.js.map +0 -1
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts +0 -12
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/value-generation-util.js +0 -161
- package/dist/src/rlc-common/helpers/value-generation-util.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.js +0 -140
- package/dist/src/rlc-common/metadata/build-rollup-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts +0 -8
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js +0 -101
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts +0 -57
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js +0 -53
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js.map +0 -1
- package/dist/src/rlc-common/transform-sample-groups.d.ts +0 -9
- package/dist/src/rlc-common/transform-sample-groups.d.ts.map +0 -1
- package/dist/src/rlc-common/transform-sample-groups.js +0 -313
- package/dist/src/rlc-common/transform-sample-groups.js.map +0 -1
- package/dist/src/utils/dirname.d.ts +0 -9
- package/dist/src/utils/dirname.d.ts.map +0 -1
- package/dist/src/utils/dirname.js +0 -12
- package/dist/src/utils/dirname.js.map +0 -1
- package/src/rlc-common/build-client-definitions.ts +0 -235
- package/src/rlc-common/build-client.ts +0 -490
- package/src/rlc-common/build-index-file.ts +0 -344
- package/src/rlc-common/build-is-unexpected-helper.ts +0 -248
- package/src/rlc-common/build-logger.ts +0 -43
- package/src/rlc-common/build-method-shortcuts.ts +0 -71
- package/src/rlc-common/build-object-types.ts +0 -603
- package/src/rlc-common/build-paginate-helper.ts +0 -31
- package/src/rlc-common/build-parameter-types.ts +0 -554
- package/src/rlc-common/build-polling-helper.ts +0 -83
- package/src/rlc-common/build-response-types.ts +0 -180
- package/src/rlc-common/build-samples.ts +0 -32
- package/src/rlc-common/build-schema-type.ts +0 -89
- package/src/rlc-common/build-serialize-helper.ts +0 -49
- package/src/rlc-common/build-top-level-index-file.ts +0 -58
- package/src/rlc-common/helpers/package-util.ts +0 -13
- package/src/rlc-common/helpers/path-utils.ts +0 -10
- package/src/rlc-common/helpers/shortcut-methods.ts +0 -58
- package/src/rlc-common/helpers/value-generation-util.ts +0 -234
- package/src/rlc-common/metadata/build-rollup-config.ts +0 -147
- package/src/rlc-common/metadata/package-json/build-azure-standalone-package.ts +0 -123
- package/src/rlc-common/metadata/package-json/build-flavorless-package.ts +0 -68
- package/src/rlc-common/transform-sample-groups.ts +0 -407
- package/src/utils/dirname.ts +0 -12
|
@@ -2,23 +2,10 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project, SourceFile } from "ts-morph";
|
|
5
|
-
import { NameType, normalizeName } from "../helpers/name-utils.js";
|
|
6
5
|
import { hasPollingOperations } from "../helpers/operation-helpers.js";
|
|
7
|
-
import {
|
|
8
|
-
isAzureMonorepoPackage,
|
|
9
|
-
isAzurePackage,
|
|
10
|
-
isAzureStandalonePackage,
|
|
11
|
-
} from "../helpers/package-util.js";
|
|
12
|
-
import { getRelativePartFromSrcPath } from "../helpers/path-utils.js";
|
|
13
6
|
import { RLCModel } from "../interfaces.js";
|
|
14
7
|
import { buildAzureMonorepoPackage } from "./package-json/build-azure-monorepo-package.js";
|
|
15
|
-
import {
|
|
16
|
-
import { buildFlavorlessPackage } from "./package-json/build-flavorless-package.js";
|
|
17
|
-
import {
|
|
18
|
-
PackageCommonInfoConfig,
|
|
19
|
-
getTshyConfig,
|
|
20
|
-
resolveWarpExports,
|
|
21
|
-
} from "./package-json/package-common.js";
|
|
8
|
+
import { PackageCommonInfoConfig, resolveWarpExports } from "./package-json/package-common.js";
|
|
22
9
|
import { getPackageName } from "./utils.js";
|
|
23
10
|
|
|
24
11
|
interface PackageFileOptions {
|
|
@@ -33,7 +20,6 @@ export function buildPackageFile(
|
|
|
33
20
|
) {
|
|
34
21
|
const config: PackageCommonInfoConfig = {
|
|
35
22
|
description: getDescription(model),
|
|
36
|
-
moduleKind: model.options?.moduleKind ?? "esm",
|
|
37
23
|
name: getPackageName(model),
|
|
38
24
|
version: getPackageVersion(model),
|
|
39
25
|
withSamples: model.options?.generateSample === true,
|
|
@@ -41,32 +27,20 @@ export function buildPackageFile(
|
|
|
41
27
|
nameWithoutScope: model.options?.packageDetails?.nameWithoutScope,
|
|
42
28
|
exports,
|
|
43
29
|
azureArm: model.options?.azureArm,
|
|
44
|
-
isModularLibrary: model.options?.isModularLibrary ?? false,
|
|
45
|
-
azureSdkForJs: model.options?.azureSdkForJs,
|
|
46
30
|
generateReactNativeTarget: model.options?.generateReactNativeTarget,
|
|
47
31
|
};
|
|
48
32
|
|
|
49
|
-
let packageInfo: Record<string, any> = buildFlavorlessPackage(config);
|
|
50
|
-
|
|
51
33
|
const extendedConfig = {
|
|
52
34
|
...config,
|
|
53
|
-
clientFilePaths: [getClientFilePath(model)],
|
|
54
35
|
hasLro: hasPollingOperations(model),
|
|
55
36
|
monorepoPackageDirectory: model.options?.azureOutputDirectory,
|
|
56
|
-
specSource: model.options?.sourceFrom ?? "TypeSpec",
|
|
57
37
|
dependencies,
|
|
58
38
|
clientContextPaths,
|
|
59
39
|
};
|
|
60
40
|
|
|
61
|
-
|
|
62
|
-
packageInfo = buildAzureMonorepoPackage(extendedConfig);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (isAzureStandalonePackage(model)) {
|
|
66
|
-
packageInfo = buildAzureStandalonePackage(extendedConfig);
|
|
67
|
-
}
|
|
41
|
+
const packageInfo: Record<string, any> = buildAzureMonorepoPackage(extendedConfig);
|
|
68
42
|
|
|
69
|
-
const project = new Project();
|
|
43
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
70
44
|
const filePath = "package.json";
|
|
71
45
|
|
|
72
46
|
if (!packageInfo) {
|
|
@@ -97,12 +71,9 @@ export function updatePackageFile(
|
|
|
97
71
|
{ exports, clientContextPaths }: PackageFileOptions = {},
|
|
98
72
|
) {
|
|
99
73
|
const hasLro = hasPollingOperations(model);
|
|
100
|
-
const
|
|
101
|
-
const needsLroUpdate = isAzure && hasLro;
|
|
74
|
+
const needsLroUpdate = hasLro;
|
|
102
75
|
const needsExportsUpdate = exports;
|
|
103
76
|
const needsConstantPathsUpdate = clientContextPaths && clientContextPaths.length > 0;
|
|
104
|
-
const needsPlatformImportsUpdate =
|
|
105
|
-
model.options?.azureSdkForJs && model.options?.moduleKind === "esm";
|
|
106
77
|
|
|
107
78
|
let packageInfo;
|
|
108
79
|
if (typeof existingFilePathOrContent === "string") {
|
|
@@ -128,57 +99,33 @@ export function updatePackageFile(
|
|
|
128
99
|
needsCoreClientUpdate = true;
|
|
129
100
|
}
|
|
130
101
|
|
|
131
|
-
// Early return if nothing needs to be updated
|
|
132
|
-
if (
|
|
133
|
-
!needsLroUpdate &&
|
|
134
|
-
!needsExportsUpdate &&
|
|
135
|
-
!needsConstantPathsUpdate &&
|
|
136
|
-
!needsPlatformImportsUpdate &&
|
|
137
|
-
!needsCoreClientUpdate
|
|
138
|
-
) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
102
|
// Ensure warp packages have #platform/* imports for polyfill resolution.
|
|
143
103
|
// The `react-native` condition is only added when explicitly opted in via
|
|
144
104
|
// `generateReactNativeTarget`, matching the fresh-generation path in
|
|
145
105
|
// `getEsmEntrypointInformation` (packageCommon.ts).
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
106
|
+
const platformImports: Record<string, string> = {
|
|
107
|
+
browser: "./src/*-browser.mts",
|
|
108
|
+
default: "./src/*.ts",
|
|
109
|
+
};
|
|
110
|
+
if (model.options?.generateReactNativeTarget) {
|
|
111
|
+
// Insert `react-native` before `default` so Node's conditional
|
|
112
|
+
// resolution order matches the fresh-generation output.
|
|
113
|
+
packageInfo.imports = {
|
|
114
|
+
"#platform/*": {
|
|
115
|
+
browser: platformImports["browser"],
|
|
116
|
+
"react-native": "./src/*-react-native.mts",
|
|
117
|
+
default: platformImports["default"],
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
} else {
|
|
121
|
+
packageInfo.imports = {
|
|
122
|
+
"#platform/*": platformImports,
|
|
150
123
|
};
|
|
151
|
-
if (model.options?.generateReactNativeTarget) {
|
|
152
|
-
// Insert `react-native` before `default` so Node's conditional
|
|
153
|
-
// resolution order matches the fresh-generation output.
|
|
154
|
-
packageInfo.imports = {
|
|
155
|
-
"#platform/*": {
|
|
156
|
-
browser: platformImports["browser"],
|
|
157
|
-
"react-native": "./src/*-react-native.mts",
|
|
158
|
-
default: platformImports["default"],
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
} else {
|
|
162
|
-
packageInfo.imports = {
|
|
163
|
-
"#platform/*": platformImports,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
124
|
}
|
|
167
125
|
|
|
168
|
-
// Update exports
|
|
126
|
+
// Update exports (warp: resolved exports in package.json)
|
|
169
127
|
if (needsExportsUpdate) {
|
|
170
|
-
|
|
171
|
-
// Warp: update resolved exports in package.json
|
|
172
|
-
packageInfo.exports = resolveWarpExports(exports, model.options?.generateReactNativeTarget);
|
|
173
|
-
} else if (packageInfo.tshy) {
|
|
174
|
-
// Tshy: update tshy.exports in package.json
|
|
175
|
-
const newTshy = getTshyConfig({
|
|
176
|
-
exports,
|
|
177
|
-
azureSdkForJs: model.options?.azureSdkForJs,
|
|
178
|
-
generateReactNativeTarget: model.options?.generateReactNativeTarget,
|
|
179
|
-
} as PackageCommonInfoConfig);
|
|
180
|
-
packageInfo.tshy["exports"] = newTshy["exports"];
|
|
181
|
-
}
|
|
128
|
+
packageInfo.exports = resolveWarpExports(exports, model.options?.generateReactNativeTarget);
|
|
182
129
|
}
|
|
183
130
|
|
|
184
131
|
// Update Core Client dependency
|
|
@@ -200,7 +147,7 @@ export function updatePackageFile(
|
|
|
200
147
|
}
|
|
201
148
|
|
|
202
149
|
// Update constantPaths metadata for Azure packages
|
|
203
|
-
if (needsConstantPathsUpdate &&
|
|
150
|
+
if (needsConstantPathsUpdate && packageInfo["//metadata"]) {
|
|
204
151
|
const metadata = packageInfo["//metadata"];
|
|
205
152
|
// Filter out existing userAgentInfo entries
|
|
206
153
|
const nonUserAgentPaths = (metadata.constantPaths || []).filter(
|
|
@@ -231,12 +178,3 @@ function getDescription(model: RLCModel): string {
|
|
|
231
178
|
}
|
|
232
179
|
return description;
|
|
233
180
|
}
|
|
234
|
-
|
|
235
|
-
function getClientFilePath(model: RLCModel) {
|
|
236
|
-
const { srcPath } = model;
|
|
237
|
-
const sdkReletivePart = getRelativePartFromSrcPath(srcPath);
|
|
238
|
-
const clientFilename = normalizeName(model.libraryName, NameType.File);
|
|
239
|
-
return sdkReletivePart
|
|
240
|
-
? `src/${sdkReletivePart}/${clientFilename}.ts`
|
|
241
|
-
: `src/${clientFilename}.ts`;
|
|
242
|
-
}
|
|
@@ -1,88 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { RLCModel } from "../interfaces.js";
|
|
5
4
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
5
|
// @ts-ignore: to fix the handlebars issue
|
|
7
|
-
import { readFileSync } from "fs";
|
|
8
6
|
import hbs from "handlebars";
|
|
9
7
|
import { getClientName } from "../helpers/name-constructors.js";
|
|
10
8
|
import { NameType, normalizeName } from "../helpers/name-utils.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const azureReadmeRLCTemplate = `# {{ clientDescriptiveName }} library for JavaScript
|
|
14
|
-
|
|
15
|
-
{{ description }}
|
|
16
|
-
|
|
17
|
-
{{#if azureArm}}
|
|
18
|
-
**If you are not familiar with our REST client, please spend 5 minutes to take a look at {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api
|
|
19
|
-
{{else}}
|
|
20
|
-
**Please rely heavily on {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
|
|
21
|
-
{{/if}}
|
|
22
|
-
|
|
23
|
-
Key links:
|
|
24
|
-
|
|
25
|
-
{{#if packageSourceURL}}
|
|
26
|
-
- [Source code]({{ packageSourceURL }})
|
|
27
|
-
{{/if}}
|
|
28
|
-
{{#if packageNPMURL}}
|
|
29
|
-
- [Package (NPM)]({{ packageNPMURL }})
|
|
30
|
-
{{/if}}
|
|
31
|
-
{{#if apiRefURL}}
|
|
32
|
-
- [API reference documentation]({{ apiRefURL }})
|
|
33
|
-
{{/if}}
|
|
34
|
-
{{#if serviceDocURL}}
|
|
35
|
-
- [Product documentation]({{ serviceDocURL }})
|
|
36
|
-
{{/if}}
|
|
37
|
-
{{#if samplesURL}}
|
|
38
|
-
- [Samples]({{ samplesURL }})
|
|
39
|
-
{{/if}}
|
|
40
|
-
|
|
41
|
-
## Getting started
|
|
42
|
-
|
|
43
|
-
### Currently supported environments
|
|
44
|
-
|
|
45
|
-
- LTS versions of Node.js
|
|
46
|
-
|
|
47
|
-
### Prerequisites
|
|
48
|
-
|
|
49
|
-
- You must have an [Azure subscription](https://azure.microsoft.com/free/){{#if dependencyLink}} and follow [these]({{ dependencyLink }}) instructions{{/if}} to use this package.
|
|
50
|
-
|
|
51
|
-
### Install the \`{{ clientPackageName }}\` package
|
|
52
|
-
|
|
53
|
-
Install the {{ clientDescriptiveName }} REST client library for JavaScript with \`npm\`:
|
|
54
|
-
|
|
55
|
-
\`\`\`bash
|
|
56
|
-
npm install {{ clientPackageName }}
|
|
57
|
-
\`\`\`
|
|
58
|
-
|
|
59
|
-
### Create and authenticate a \`{{ clientClassName }}\`
|
|
60
|
-
|
|
61
|
-
To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
|
|
62
|
-
provide an instance of the desired credential type obtained from the
|
|
63
|
-
[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
|
|
64
|
-
|
|
65
|
-
To authenticate with AAD, you must first \`npm\` install [\`@azure/identity\`](https://www.npmjs.com/package/@azure/identity) {{#if dependencyLink}}and
|
|
66
|
-
[{{dependencyDescription }}]({{ dependencyLink }}){{/if}}
|
|
67
|
-
|
|
68
|
-
After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from \`@azure/identity\` to use.
|
|
69
|
-
As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
|
|
70
|
-
can be used to authenticate the client.
|
|
71
|
-
|
|
72
|
-
## Troubleshooting
|
|
73
|
-
|
|
74
|
-
### Logging
|
|
75
|
-
|
|
76
|
-
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\`:
|
|
77
|
-
|
|
78
|
-
\`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:SetLogLevel{{/if}}{{/if}}
|
|
79
|
-
import { setLogLevel } from "@azure/logger";
|
|
80
|
-
|
|
81
|
-
setLogLevel("info");
|
|
82
|
-
\`\`\`
|
|
83
|
-
|
|
84
|
-
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
|
85
|
-
`;
|
|
9
|
+
import { RLCModel } from "../interfaces.js";
|
|
86
10
|
|
|
87
11
|
const azureReadmeModularTemplate = `# {{ clientDescriptiveName }} library for JavaScript
|
|
88
12
|
|
|
@@ -134,10 +58,10 @@ npm install {{ clientPackageName }}
|
|
|
134
58
|
{{#if addCredentials}}
|
|
135
59
|
### Create and authenticate a \`{{ clientClassName}}\`
|
|
136
60
|
|
|
137
|
-
To create a client object to access the {{ serviceName }} API, you will need the \`endpoint\` of your {{ serviceName }} resource and a \`credential\`. The {{ clientDescriptiveName }} can use
|
|
61
|
+
To create a client object to access the {{ serviceName }} API, you will need the \`endpoint\` of your {{ serviceName }} resource and a \`credential\`. The {{ clientDescriptiveName }} can use Microsoft Entra credentials to authenticate.
|
|
138
62
|
You can find the endpoint for your {{ serviceName }} resource in the [Azure Portal][azure_portal].
|
|
139
63
|
|
|
140
|
-
You can authenticate with
|
|
64
|
+
You can authenticate with Microsoft Entra ID using a credential from the [@azure/identity][azure_identity] library or [an existing Microsoft Entra token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
|
|
141
65
|
|
|
142
66
|
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the \`@azure/identity\` package:
|
|
143
67
|
|
|
@@ -145,14 +69,14 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below
|
|
|
145
69
|
npm install @azure/identity
|
|
146
70
|
\`\`\`
|
|
147
71
|
|
|
148
|
-
You will also need to **register a new
|
|
72
|
+
You will also need to **register a new Microsoft Entra application and grant access to {{ serviceName}}** by assigning the suitable role to your service principal (note: roles such as \`"Owner"\` will not grant the necessary permissions).
|
|
149
73
|
|
|
150
|
-
For more information about how to create
|
|
74
|
+
For more information about how to create a Microsoft Entra application check out [this guide](https://learn.microsoft.com/entra/identity-platform/howto-create-service-principal-portal).
|
|
151
75
|
|
|
152
76
|
{{#if azureArm}}
|
|
153
77
|
Using Node.js and Node-like environments, you can use the \`DefaultAzureCredential\` class to authenticate the client.
|
|
154
78
|
|
|
155
|
-
\`\`\`ts {{#if
|
|
79
|
+
\`\`\`ts {{#if generateTest}}snippet:ReadmeSampleCreateClient_Node{{/if}}
|
|
156
80
|
import { {{ clientClassName }} } from "{{ clientPackageName }}";
|
|
157
81
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
158
82
|
|
|
@@ -166,7 +90,7 @@ const client = new {{ clientClassName }}(new DefaultAzureCredential());
|
|
|
166
90
|
|
|
167
91
|
For browser environments, use the \`InteractiveBrowserCredential\` from the \`@azure/identity\` package to authenticate.
|
|
168
92
|
|
|
169
|
-
\`\`\`ts {{#if
|
|
93
|
+
\`\`\`ts {{#if generateTest}}snippet:ReadmeSampleCreateClient_Browser{{/if}}
|
|
170
94
|
import { InteractiveBrowserCredential } from "@azure/identity";
|
|
171
95
|
import { {{ clientClassName }} } from "{{ clientPackageName }}";
|
|
172
96
|
|
|
@@ -185,7 +109,7 @@ const client = new {{ clientClassName }}(credential);
|
|
|
185
109
|
{{else}}
|
|
186
110
|
Using Node.js and Node-like environments, you can use the \`DefaultAzureCredential\` class to authenticate the client.
|
|
187
111
|
|
|
188
|
-
\`\`\`ts {{#if
|
|
112
|
+
\`\`\`ts {{#if generateTest}}snippet:ReadmeSampleCreateClient_Node{{/if}}
|
|
189
113
|
import { {{ clientClassName }} } from "{{ clientPackageName }}";
|
|
190
114
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
191
115
|
|
|
@@ -194,7 +118,7 @@ const client = new {{ clientClassName }}("<endpoint>", new DefaultAzureCredentia
|
|
|
194
118
|
|
|
195
119
|
For browser environments, use the \`InteractiveBrowserCredential\` from the \`@azure/identity\` package to authenticate.
|
|
196
120
|
|
|
197
|
-
\`\`\`ts {{#if
|
|
121
|
+
\`\`\`ts {{#if generateTest}}snippet:ReadmeSampleCreateClient_Browser{{/if}}
|
|
198
122
|
import { InteractiveBrowserCredential } from "@azure/identity";
|
|
199
123
|
import { {{ clientClassName }} } from "{{ clientPackageName }}";
|
|
200
124
|
|
|
@@ -223,7 +147,7 @@ To use this client library in the browser, first you need to use a bundler. For
|
|
|
223
147
|
|
|
224
148
|
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\`:
|
|
225
149
|
|
|
226
|
-
\`\`\`ts {{#if
|
|
150
|
+
\`\`\`ts {{#if generateTest}}snippet:SetLogLevel{{/if}}
|
|
227
151
|
import { setLogLevel } from "@azure/logger";
|
|
228
152
|
|
|
229
153
|
setLogLevel("info");
|
|
@@ -339,8 +263,6 @@ interface Metadata {
|
|
|
339
263
|
isReleasablePackage?: boolean;
|
|
340
264
|
/** The link to the contributing guide in the repository */
|
|
341
265
|
contributingGuideURL?: string;
|
|
342
|
-
/** Indicates if the package is generated to azure-sdk-for-js repo */
|
|
343
|
-
azureSdkForJs?: boolean;
|
|
344
266
|
/** Indicates if the package need generate test files */
|
|
345
267
|
generateTest?: boolean;
|
|
346
268
|
/** Indicates if the package need SubscriptionId as the client parameter */
|
|
@@ -350,11 +272,7 @@ interface Metadata {
|
|
|
350
272
|
export function buildReadmeFile(model: RLCModel) {
|
|
351
273
|
const metadata = createMetadata(model) ?? {};
|
|
352
274
|
const readmeFileContents = hbs.compile(
|
|
353
|
-
model.options
|
|
354
|
-
? model.options.isModularLibrary
|
|
355
|
-
? azureReadmeModularTemplate
|
|
356
|
-
: azureReadmeRLCTemplate
|
|
357
|
-
: nonBrandedReadmeTemplate,
|
|
275
|
+
model.options ? azureReadmeModularTemplate : nonBrandedReadmeTemplate,
|
|
358
276
|
{ noEscape: true },
|
|
359
277
|
);
|
|
360
278
|
return {
|
|
@@ -363,10 +281,9 @@ export function buildReadmeFile(model: RLCModel) {
|
|
|
363
281
|
};
|
|
364
282
|
}
|
|
365
283
|
|
|
366
|
-
export function hasClientNameChanged(model: RLCModel,
|
|
284
|
+
export function hasClientNameChanged(model: RLCModel, existingReadmeContent: string): boolean {
|
|
367
285
|
try {
|
|
368
|
-
const
|
|
369
|
-
const importMatch = existingContent.match(
|
|
286
|
+
const importMatch = existingReadmeContent.match(
|
|
370
287
|
/import\s*\{\s*([A-Za-z0-9_]+)\s*\}\s*from\s*["'][^"']*["']/,
|
|
371
288
|
);
|
|
372
289
|
const existingClientName = importMatch?.[1];
|
|
@@ -379,21 +296,20 @@ export function hasClientNameChanged(model: RLCModel, existingReadmeFilePath: st
|
|
|
379
296
|
|
|
380
297
|
export function updateReadmeFile(
|
|
381
298
|
model: RLCModel,
|
|
382
|
-
|
|
299
|
+
existingReadmeContent: string,
|
|
383
300
|
): { path: string; content: string } | undefined {
|
|
384
301
|
try {
|
|
385
|
-
const existingContent = readFileSync(existingReadmeFilePath, "utf8");
|
|
386
302
|
const metadata = createMetadata(model) ?? {};
|
|
387
303
|
|
|
388
304
|
const newApiRefLink = hbs.compile(apiReferenceTemplate, { noEscape: true })(metadata).trim();
|
|
389
305
|
|
|
390
306
|
if (!newApiRefLink) {
|
|
391
|
-
return { path: "README.md", content:
|
|
307
|
+
return { path: "README.md", content: existingReadmeContent };
|
|
392
308
|
}
|
|
393
309
|
|
|
394
310
|
const apiRefRegex =
|
|
395
311
|
/^- \[API reference documentation\]\(https:\/\/learn\.microsoft\.com\/javascript\/api\/[^)]+\)$/m;
|
|
396
|
-
const updatedContent =
|
|
312
|
+
const updatedContent = existingReadmeContent.replace(apiRefRegex, (match) =>
|
|
397
313
|
match ? newApiRefLink : match,
|
|
398
314
|
);
|
|
399
315
|
|
|
@@ -413,16 +329,7 @@ function createMetadata(model: RLCModel): Metadata | undefined {
|
|
|
413
329
|
return;
|
|
414
330
|
}
|
|
415
331
|
// const packageDetails = model.options.packageDetails;
|
|
416
|
-
const {
|
|
417
|
-
packageDetails,
|
|
418
|
-
azureOutputDirectory,
|
|
419
|
-
productDocLink,
|
|
420
|
-
dependencyInfo,
|
|
421
|
-
multiClient,
|
|
422
|
-
batch,
|
|
423
|
-
serviceInfo,
|
|
424
|
-
isTypeSpecTest,
|
|
425
|
-
} = model.options;
|
|
332
|
+
const { packageDetails, azureOutputDirectory, serviceInfo, isTypeSpecTest } = model.options;
|
|
426
333
|
|
|
427
334
|
const azureHuh =
|
|
428
335
|
packageDetails?.scopeName === "azure" || packageDetails?.scopeName === "azure-rest";
|
|
@@ -450,11 +357,8 @@ function createMetadata(model: RLCModel): Metadata | undefined {
|
|
|
450
357
|
serviceName,
|
|
451
358
|
clientClassName,
|
|
452
359
|
clientPackageName: clientPackageName,
|
|
453
|
-
clientDescriptiveName:
|
|
454
|
-
? `${serviceName} client`
|
|
455
|
-
: `${serviceName} REST client`,
|
|
360
|
+
clientDescriptiveName: `${serviceName} client`,
|
|
456
361
|
description: serviceInfo?.description ?? packageDetails.description,
|
|
457
|
-
serviceDocURL: productDocLink,
|
|
458
362
|
packageSourceURL: packageSourceURL,
|
|
459
363
|
packageNPMURL: `https://www.npmjs.com/package/${clientPackageName}`,
|
|
460
364
|
samplesURL:
|
|
@@ -462,9 +366,6 @@ function createMetadata(model: RLCModel): Metadata | undefined {
|
|
|
462
366
|
apiRefURL: azureHuh
|
|
463
367
|
? `https://learn.microsoft.com/javascript/api/${clientPackageName}${apiRefUrlQueryParameter}`
|
|
464
368
|
: undefined,
|
|
465
|
-
dependencyDescription: dependencyInfo?.description,
|
|
466
|
-
dependencyLink: dependencyInfo?.link,
|
|
467
|
-
hasMultiClients: multiClient && batch && batch.length > 1,
|
|
468
369
|
azureArm: Boolean(model.options.azureArm),
|
|
469
370
|
azure: azureHuh,
|
|
470
371
|
isReleasablePackage: !isTypeSpecTest,
|
|
@@ -473,7 +374,6 @@ function createMetadata(model: RLCModel): Metadata | undefined {
|
|
|
473
374
|
identityPackageURL: repoURL && `${repoURL}/tree/main/sdk/identity/identity`,
|
|
474
375
|
addCredentials: model.options.addCredentials,
|
|
475
376
|
contributingGuideURL: repoURL && `${repoURL}/blob/main/CONTRIBUTING.md`,
|
|
476
|
-
azureSdkForJs: model.options.azureSdkForJs,
|
|
477
377
|
generateTest: model.options.generateTest,
|
|
478
378
|
hasSubscriptionId: model.options.hasSubscriptionId,
|
|
479
379
|
};
|
|
@@ -484,9 +384,7 @@ function getServiceName(model: RLCModel) {
|
|
|
484
384
|
model?.options?.packageDetails?.scopeName === "azure" ||
|
|
485
385
|
model?.options?.packageDetails?.scopeName === "azure-rest";
|
|
486
386
|
const libraryName = model.libraryName;
|
|
487
|
-
const serviceTitle = model.
|
|
488
|
-
? model.libraryName
|
|
489
|
-
: (model.options?.serviceInfo?.title ?? model.libraryName);
|
|
387
|
+
const serviceTitle = model.libraryName;
|
|
490
388
|
const batch = model?.options?.batch,
|
|
491
389
|
packageDetails = model?.options?.packageDetails;
|
|
492
390
|
let simpleServiceName =
|
|
@@ -7,10 +7,7 @@ const sampleEnvText = `
|
|
|
7
7
|
`;
|
|
8
8
|
|
|
9
9
|
export function buildSampleEnvFile(model: RLCModel) {
|
|
10
|
-
if (
|
|
11
|
-
(model.options?.generateMetadata === true || model.options?.generateSample === true) &&
|
|
12
|
-
model.options?.flavor === "azure"
|
|
13
|
-
) {
|
|
10
|
+
if (model.options?.generateMetadata === true || model.options?.generateSample === true) {
|
|
14
11
|
const filePath = "sample.env";
|
|
15
12
|
return {
|
|
16
13
|
path: filePath,
|
|
@@ -5,12 +5,7 @@ import { RLCModel } from "../interfaces.js";
|
|
|
5
5
|
import { getPackageName } from "./utils.js";
|
|
6
6
|
|
|
7
7
|
function shouldGenerateTestConfig(model: RLCModel): boolean {
|
|
8
|
-
|
|
9
|
-
return !(
|
|
10
|
-
model.options?.generateMetadata === false ||
|
|
11
|
-
model.options?.generateTest === false ||
|
|
12
|
-
isAzureSdkForJs !== true
|
|
13
|
-
);
|
|
8
|
+
return !(model.options?.generateMetadata === false || model.options?.generateTest === false);
|
|
14
9
|
}
|
|
15
10
|
|
|
16
11
|
/**
|
|
@@ -7,83 +7,41 @@ import { RLCModel } from "../interfaces.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Builds the root tsconfig.json.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Emits project references pointing into the `config/` subfolder
|
|
11
|
+
* (following the eng/tsconfigs pattern).
|
|
12
12
|
*/
|
|
13
13
|
export function buildTsConfig(model: RLCModel) {
|
|
14
|
-
const { packageDetails, azureSdkForJs } = model.options || {};
|
|
15
14
|
const { generateTest, generateSample, generateReactNativeTarget } = model.options || {};
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (generateSample) {
|
|
41
|
-
references.push({ path: "./config/tsconfig.samples.json" });
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (generateTest) {
|
|
45
|
-
references.push({ path: "./config/tsconfig.snippets.json" });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
tsConfig = { references, files: [] };
|
|
49
|
-
} else {
|
|
50
|
-
const { options } = model;
|
|
51
|
-
tsConfig = {
|
|
52
|
-
compilerOptions: {
|
|
53
|
-
target: "ES2017",
|
|
54
|
-
module: options?.moduleKind === "esm" ? "NodeNext" : "es6",
|
|
55
|
-
lib: [],
|
|
56
|
-
declaration: true,
|
|
57
|
-
declarationMap: true,
|
|
58
|
-
inlineSources: true,
|
|
59
|
-
sourceMap: true,
|
|
60
|
-
importHelpers: true,
|
|
61
|
-
strict: true,
|
|
62
|
-
alwaysStrict: true,
|
|
63
|
-
noUnusedLocals: true,
|
|
64
|
-
noUnusedParameters: true,
|
|
65
|
-
noImplicitReturns: true,
|
|
66
|
-
noFallthroughCasesInSwitch: true,
|
|
67
|
-
forceConsistentCasingInFileNames: true,
|
|
68
|
-
moduleResolution: options?.moduleKind === "esm" ? "NodeNext" : "node",
|
|
69
|
-
allowSyntheticDefaultImports: true,
|
|
70
|
-
esModuleInterop: true,
|
|
71
|
-
outDir: options?.moduleKind === "cjs" ? "./dist-esm" : undefined,
|
|
72
|
-
declarationDir: options?.moduleKind === "cjs" ? "./types" : undefined,
|
|
73
|
-
},
|
|
74
|
-
include: ["src/**/*.ts"],
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
if (generateTest) {
|
|
78
|
-
tsConfig["include"].push("test/**/*.ts");
|
|
79
|
-
}
|
|
80
|
-
if (generateSample) {
|
|
81
|
-
tsConfig["include"].push("samples-dev/**/*.ts");
|
|
82
|
-
tsConfig["compilerOptions"]["paths"] = {};
|
|
83
|
-
tsConfig["compilerOptions"]["paths"][clientPackageName] = ["./src/index"];
|
|
84
|
-
}
|
|
15
|
+
const project = new Project({ useInMemoryFileSystem: true });
|
|
16
|
+
|
|
17
|
+
const references: { path: string }[] = [
|
|
18
|
+
{ path: "./config/tsconfig.src.esm.json" },
|
|
19
|
+
{ path: "./config/tsconfig.src.browser.json" },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
if (generateReactNativeTarget) {
|
|
23
|
+
references.push({ path: "./config/tsconfig.src.react-native.json" });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
references.push({ path: "./config/tsconfig.src.cjs.json" });
|
|
27
|
+
|
|
28
|
+
if (generateTest) {
|
|
29
|
+
references.push(
|
|
30
|
+
{ path: "./config/tsconfig.test.node.json" },
|
|
31
|
+
{ path: "./config/tsconfig.test.browser.json" },
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (generateSample) {
|
|
36
|
+
references.push({ path: "./config/tsconfig.samples.json" });
|
|
85
37
|
}
|
|
86
38
|
|
|
39
|
+
if (generateTest) {
|
|
40
|
+
references.push({ path: "./config/tsconfig.snippets.json" });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const tsConfig = { references, files: [] };
|
|
44
|
+
|
|
87
45
|
const filePath = "tsconfig.json";
|
|
88
46
|
const configFile = project.createSourceFile(filePath, JSON.stringify(tsConfig, null, 2), {
|
|
89
47
|
overwrite: true,
|
|
@@ -68,10 +68,6 @@ targets:
|
|
|
68
68
|
* in options to include it.
|
|
69
69
|
*/
|
|
70
70
|
export function buildWarpConfig(model: RLCModel, { exports }: WarpConfigOptions = {}) {
|
|
71
|
-
if (model.options?.moduleKind !== "esm") {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
71
|
const allExports: Record<string, string> = {
|
|
76
72
|
...BASE_EXPORTS,
|
|
77
73
|
...exports,
|