diff --git a/.scripts/checkEverything.ts b/.scripts/checkEverything.ts deleted file mode 100644 index f184f0550baf..000000000000 --- a/.scripts/checkEverything.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { checkEverything, contains, getArgument, getDefaultLogger, gitDiff, GitDiffResult, gitStatus, GitStatusResult, joinPath, Logger, normalize, resolvePath } from "@ts-common/azure-js-dev-tools"; -import * as path from "path"; -import { getPackageFolderPaths } from "./common"; - -const logger: Logger = getDefaultLogger(); -const changedFiles: string[] = []; - -let headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" }); -if (!headReference) { - const statusResult: GitStatusResult = gitStatus(); - headReference = statusResult.localBranch!; - logger.logInfo(`No head-reference argument specified on command line or in environment variables. Defaulting to "${headReference}".`); - - const modifiedFiles: string[] | undefined = statusResult.modifiedFiles; - if (modifiedFiles) { - changedFiles.push(...modifiedFiles); - } -} - -let baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" }); -if (!baseReference) { - baseReference = "master"; - logger.logInfo(`No base-reference argument specified on command line or in environment variables. Defaulting to "${baseReference}".`); -} - -if (baseReference !== headReference) { - const diffResult: GitDiffResult = gitDiff(baseReference, headReference); - changedFiles.push(...diffResult.filesChanged); - if (!changedFiles || changedFiles.length === 0) { - logger.logInfo(`Found no changes between "${baseReference}" and "${headReference}".`); - } else { - logger.logVerbose(`Found the following changed files`) - for (const changedFilePath of changedFiles) { - logger.logVerbose(changedFilePath); - } - } -} - -const repositoryFolderPath: string = resolvePath(__dirname, ".."); -const packagesFolderPath: string = joinPath(repositoryFolderPath, "sdk"); -const packageFolderPaths: string[] | undefined = getPackageFolderPaths(packagesFolderPath); - -let exitCode: number = 0; -if (!packageFolderPaths) { - logger.logError(`The packages folder (${packagesFolderPath}) doesn't exist.`); -} else { - logger.logVerbose(`Found ${packageFolderPaths.length} package folders.`); - for (const packageFolderPath of packageFolderPaths) { - const packageFolderPathWithSep: string = normalize(packageFolderPath + path.posix.sep); - const shouldCheck = !!changedFiles && contains(changedFiles, (changedFilePath: string) => normalize(changedFilePath).startsWith(packageFolderPathWithSep)); - if (shouldCheck) { - exitCode += checkEverything({ - logger, - checkPackageJsonVersionOptions: { - startPath: packageFolderPath - }, - checkForOnlyCallsOptions: { - startPaths: packageFolderPath - }, - checkForSkipCallsOptions: { - startPaths: packageFolderPath - } - }); - } - } -} -process.exitCode = exitCode; diff --git a/.scripts/clean-autopr.ts b/.scripts/clean-autopr.ts deleted file mode 100644 index d1860e2c47ae..000000000000 --- a/.scripts/clean-autopr.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import { exec as execWithCallback } from "child_process"; -import Octokit from "@octokit/rest"; - -export function getToken(): string { - const token: string = process.env.SDK_GEN_GITHUB_TOKEN || ""; - _validatePersonalAccessToken(token); - - return token; -} - -function _validatePersonalAccessToken(token: string): void { - if (!token) { - const text = - `Github personal access token was not found as a script parameter or as an - environmental variable. Please visit https://github.com/settings/tokens, - generate new token with "repo" scope and pass it with -token switch or set - it as environmental variable named SDK_GEN_GITHUB_TOKEN.` - - console.error(text); - } -} - -export function getAuthenticatedClient(): Octokit { - const octokit = new Octokit({ auth: getToken()}); - return octokit; -} - -async function cleanBranches() { - const octokit = getAuthenticatedClient(); - const params: Octokit.PullsListParams = { - owner: "Azure", - repo: "azure-sdk-for-js", - state: "open", - per_page: 100 - } - - let pullRequestsResponse = await octokit.pulls.list(params); - const autoPullRequests = pullRequestsResponse.data.filter(pr => pr.title.startsWith("[AutoPR")).map(pr => pr.head.ref); - console.log(JSON.stringify(autoPullRequests, undefined, " ")); - console.log(`Found ${autoPullRequests.length} branches`); - - for (const branch of autoPullRequests) { - try { - await exec(`git push origin :${branch}`); - } catch (err) { - console.log(`Branch ${branch} doesn't exist. Skipping. Error: [${err}]`); - } - } -} - -async function exec(command: string): Promise { - console.log(`Executing ${command}`); - return new Promise((resolve, reject) => { - execWithCallback(command, (error, stdout) => { - if (error) { - reject(error); - } - - resolve(stdout); - }); - }); -} - -try { - cleanBranches(); -} catch (err) { - console.error(err); -} diff --git a/.scripts/commandLine.ts b/.scripts/commandLine.ts deleted file mode 100644 index 7b7bdba449e5..000000000000 --- a/.scripts/commandLine.ts +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import minimist from "minimist"; -import * as path from "path"; -import * as yargs from "yargs"; -import { Options } from "yargs"; -import { arrayContains, findAzureRestApiSpecsRepositoryPathSync } from "./common"; - -export type YargsMapping = { [key: string]: Options }; - -export enum SdkType { - ResourceManager = "resource-manager", - DataPlane = "data-plane", - ControlPlane = "control-plane", - Unknown = "unknown" -} - -export module Argv { - export interface CommonOptions { - "logging-level": string | undefined; - } - - export interface GenerateOptions { - "skip-spec": boolean; - "skip-sdk": boolean; - } - - export interface PackageOptions { - package: string; - type: SdkType; - } - - export interface RepositoryOptions { - azureSDKForJSRepoRoot: string; - azureRestAPISpecsRoot: string; - } - - export interface FilterOptions { - include?: RegExp, - exclude?: RegExp - } - - export const Options: { [key: string]: YargsMapping } = { - Common: { - "logging-level": { - alias: "l", - default: "info", - choices: ["all", "trace", "debug", "info", "warn", "error"], - global: true, - description: "Defines how detailed logging statements are" - } - }, - Generate: { - "skip-spec": { - boolean: true, - description: "Whether to skip generating readme.typescript.md file" - }, - "skip-sdk": { - boolean: true, - description: "Whether to skip SDK generation" - } - }, - Package: { - "package": { - alias: ["p", "package-name"], - string: true, - demand: true, - description: "Name of the manipulated package e.g. @azure/arm-servicebus" - }, - "type": { - alias: "sdk-type", - string: true, - coerce: parseSdkType, - choices: ["rm", "data", "control"], - description: "Type of SDK to manipulate." - } - }, - Repository: { - "azure-sdk-for-js-root": { - alias: ["sdk", "azureSDKForJSRepoRoot"], - string: true, - default: path.resolve(__dirname, ".."), - description: "Path to the azure-sdk-for-js repository" - }, - "azure-rest-api-specs-root": { - alias: ["specs", "azureRestAPISpecsRoot"], - string: true, - default: findAzureRestApiSpecsRepositoryPathSync(), - description: "Path to the azure-rest-api-specs repository" - } - }, - Filter: { - "include": { - type: "string", - coerce: (s: string) => new RegExp(s) - }, - "exclude": { - type: "string", - coerce: (s: string) => new RegExp(s) - } - } - } - - export const Global = { - loggingLevel: yargs.options(Argv.Options.Common).argv["logging-level"] as string, - } - - export function combine(...configs: YargsMapping[]): YargsMapping { - let result = Options.Common; - for (const config of configs) { - result = { ...result, ...config }; - } - return result; - } - - export function construct(...configs: YargsMapping[]): yargs.Argv { - const mergedOption: YargsMapping = combine(...configs); - const args: yargs.Argv = yargs.options(mergedOption) - .strict() - .help("?") - .showHelpOnFail(true, "Invalid usage. Run with -? to see help.") - .wrap(Math.min(yargs.terminalWidth(), 150)); - - (args as any).toPrettyString = function (): string { - return JSON.stringify(this, undefined, " "); - } - - return args; - } - - export function print(): String { - return process.argv.slice(2).join(", "); - } -} - -export interface CommandLineOptions extends minimist.ParsedArgs { - "azure-sdk-for-js-repo-root": string; - "azure-rest-api-specs-root": string; - debugger: boolean; - "logging-level": string; - package: string; - "skip-sdk": boolean; - "skip-spec": boolean; - type: string; - use: boolean; - verbose: boolean; - whatif: boolean; - getSdkType(): SdkType; -} - -export const commandLineConfiguration: minimist.Opts = { - string: ["azure-sdk-for-js-repo-root", "azure-rest-api-specs-root", "logging-level", "package", "type"], - boolean: ["debugger", "use", "skip-sdk", "skip-spec", "verbose", "whatif"], - alias: { - l: "logging-level", - log: "logging-level", - package: "packageName", - u: "use", - v: "version", - }, - default: { - "logging-level": "info", - type: "arm" - } -}; - -let _options: CommandLineOptions; -export function getCommandLineOptions(): CommandLineOptions { - if (!_options) { - _options = createCommandLineParameters(); - } - - return _options; -} - -function createCommandLineParameters(): CommandLineOptions { - const args: CommandLineOptions = minimist(process.argv.slice(2), commandLineConfiguration) as CommandLineOptions; - args.getSdkType = () => parseSdkType(args.type); - return args; -} - -export function parseSdkType(str: string): SdkType { - const resourceManagerStrings = ["arm", "rm", "resourcemanager"] - const dataPlaneStrings = ["dp", "data", "dataplane"] - const controlPlaneStrings = ["control"] - - const type = str.toLowerCase().replace("-", ""); - if (arrayContains(resourceManagerStrings, type)) { - return SdkType.ResourceManager; - } else if (arrayContains(dataPlaneStrings, type)) { - return SdkType.DataPlane; - } else if (arrayContains(controlPlaneStrings, type)) { - return SdkType.ControlPlane; - } else { - return SdkType.Unknown; - } -} diff --git a/.scripts/common.ts b/.scripts/common.ts deleted file mode 100644 index 99154d8f492b..000000000000 --- a/.scripts/common.ts +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import { execSync } from "child_process"; -import * as fssync from "fs"; -import { promises as fs } from "fs"; -import * as path from "path"; -import { getChildFolderPaths, fileExistsSync, joinPath, readPackageJsonFileSync, PackageJson, getName } from '@ts-common/azure-js-dev-tools'; -import { generateDataplaneList } from "./generateDataplaneList"; - -export function arrayContains(array: T[], el: T): boolean { - return array.indexOf(el) != -1 -} - -export async function isDirectory(directoryPath: string): Promise { - try { - const stats = await fs.lstat(directoryPath); - return stats.isDirectory(); - } catch { - return false; - } -} - -export async function pathExists(path: string): Promise { - return new Promise((resolve) => { - fssync.exists(path, exists => { - resolve(exists); - }); - }); -} - -export function startsWith(value: string, prefix: string): boolean { - return !!(value && prefix && value.indexOf(prefix) === 0); -} - -export function endsWith(value: string, suffix: string): boolean { - return !!(value && suffix && value.length >= suffix.length && value.lastIndexOf(suffix) === value.length - suffix.length); -} - -export function contains(values: string[], searchString: string): boolean { - return arrayContains(values, searchString); -} - -export function execute(command: string, packageFolderPath: string): void { - if (fssync.existsSync(packageFolderPath)) { - execSync(command, { cwd: packageFolderPath, stdio: "inherit" }); - } -} - -export function npmRunBuild(packageFolderPath: string): void { - execute("npm run build", packageFolderPath); -} - -export function npmInstall(packageFolderPath: string): void { - execute("npm install", packageFolderPath); -} - -export async function npmRunTest(packageFolderPath: string): Promise { - const packageJsonContent = JSON.parse((await fs.readFile(path.join(packageFolderPath, "package.json"))).toString()); - if (packageJsonContent.scripts.test) { - execute("npm test", packageFolderPath); - } else { - console.log("No tests to run"); - } -} - -export async function getChildDirectories(parent: string): Promise { - const allChildren = await fs.readdir(parent); - const childDirectories = []; - - for (const child of allChildren) { - if (await isDirectory(path.resolve(parent, child))) { - childDirectories.push(child); - } - } - - return childDirectories; -} - -export function findAzureRestApiSpecsRepositoryPathSync(): string | undefined { - const repositoryName = "azure-rest-api-specs"; - let currentDirectory = __dirname; - const pathData = path.parse(currentDirectory); - const rootDirectory = pathData.root; - - do { - currentDirectory = path.resolve(currentDirectory, ".."); - - if (containsDirectorySync(repositoryName, currentDirectory)) { - return path.resolve(currentDirectory, repositoryName); - } - - } while (currentDirectory != rootDirectory); - - return undefined; -} - -function containsDirectorySync(directoryName: string, parentPath: string): boolean { - return fssync.existsSync(path.resolve(parentPath, directoryName)); -} - -function isPackageFolderPath(folderPath: string, packagesToIgnore: string[]): boolean { - let result = false; - const packageJsonFilePath: string = joinPath(folderPath, "package.json"); - if (fileExistsSync(packageJsonFilePath)) { - const packageJson: PackageJson = readPackageJsonFileSync(packageJsonFilePath); - // Skip all perf framework projects from gulp pack - if (packageJson?.name?.startsWith("@azure-tests/") || packageJson?.name?.startsWith("@azure/arm-")) { - return false; - } - if (packageJson?.private) { - return false; - } - result = !contains(packagesToIgnore, packageJson.name!); - } - return result; -} - -function shouldProcessFolderPath(folderPath: string, folderNamesToIgnore: string[]): boolean { - if (!contains(folderNamesToIgnore, getName(folderPath))) { - // If current path is not in folder to ignore list then process it. - return true; - } - - // if current folder name is in folder to ignore list then make sure this path is package root path - // eventgrid service name and dataplane package name are same and it is added in ignore list - // So this causes an issue to skip processing eventgrid service folder itself - const packageJsonFilePath: string = joinPath(folderPath, "package.json"); - if (!fileExistsSync(packageJsonFilePath)) { - return true; - } - - // Skip current path since it is package root path and also added in ignore folder list - return false; -} - -export const packagesToIgnore: string[] = generateDataplaneList().packageList; -export var folderNamesToIgnore: string[] = generateDataplaneList().folderList; -folderNamesToIgnore.push("node_modules"); -export function getPackageFolderPaths(packagesFolderPath: string): string[] | undefined { - return getChildFolderPaths(packagesFolderPath, { - recursive: true, - condition: (folderPath: string) => isPackageFolderPath(folderPath, packagesToIgnore), - folderCondition: (folderPath: string) => shouldProcessFolderPath(folderPath, folderNamesToIgnore) - }); -} diff --git a/.scripts/generateDataplaneList.ts b/.scripts/generateDataplaneList.ts deleted file mode 100644 index 3015607ae1a0..000000000000 --- a/.scripts/generateDataplaneList.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as path from "path"; -import * as fs from "fs"; -const parse = require("../common/lib/jju/parse").parse; - -export type PackageData = { packageList: string[]; folderList: string[] }; - -export function generateDataplaneList(): PackageData { - const rushPackages = getRushPackages(); - return rushPackages; -} - -//This gets the list of rush package names and list of rush package folder names -const getRushPackages = () => { - const rushPath = path.resolve(path.join(__dirname, "../rush.json")); - const baseDir = path.dirname(rushPath); - const rushJson = parse(fs.readFileSync(rushPath, "utf8")); - const packageNames: string[] = []; - const packageFolders: string[] = []; - - for (const proj of rushJson.projects) { - const filePath = path.join(baseDir, proj.projectFolder, "package.json"); - packageFolders.push(path.basename(path.dirname(filePath))); - packageNames.push(proj.packageName); - } - return { packageList: packageNames, folderList: packageFolders }; -}; diff --git a/.scripts/gulp.ts b/.scripts/gulp.ts deleted file mode 100644 index cb950f95dca1..000000000000 --- a/.scripts/gulp.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import { execSync } from "child_process"; -import fs from "fs"; -import * as path from "path"; -import { contains, npmInstall, npmRunTest } from "./common"; -import { Logger } from "./logger"; -import { getPackageInformationFromPackageJsons, PackageInfo } from "./packages"; -import { findReadmeTypeScriptMdFilePaths, getAbsolutePackageFolderPathFromReadmeFileContents, getPackageNamesFromReadmeTypeScriptMdFileContents } from "./readme"; -import { NPMViewResult, NPMScope } from "@ts-common/azure-js-dev-tools"; - -const _logger = Logger.get(); - -function containsPackageName(packageNames: string[], packageName: string): boolean { - const result = contains(packageNames, packageName) || - contains(packageNames, `@azure/${packageName}`) || - contains(packageNames, `"${packageName}"`) || - contains(packageNames, `"@azure/${packageName}"`) || - contains(packageNames, `'${packageName}'`) || - contains(packageNames, `'@azure/${packageName}'`); - _logger.logTrace(`Comparing package name "${packageName}" to ${JSON.stringify(packageNames)} - Result: ${result}`); - return result; -} - -export async function generateSdk(azureRestAPISpecsRoot: string, azureSDKForJSRepoRoot: string, packageName: string, use?: string, useDebugger?: boolean) { - const typeScriptReadmeFilePaths: string[] = findReadmeTypeScriptMdFilePaths(azureRestAPISpecsRoot); - - for (let i = 0; i < typeScriptReadmeFilePaths.length; ++i) { - const typeScriptReadmeFilePath: string = typeScriptReadmeFilePaths[i]; - - const typeScriptReadmeFileContents: string = await fs.promises.readFile(typeScriptReadmeFilePath, { encoding: 'utf8' }); - const packageNames: string[] = getPackageNamesFromReadmeTypeScriptMdFileContents(typeScriptReadmeFileContents); - const packageNamesString: string = JSON.stringify(packageNames); - - if (!packageName || containsPackageName(packageNames, packageName)) { - _logger.log(`>>>>>>>>>>>>>>>>>>> Start: "${packageNamesString}" >>>>>>>>>>>>>>>>>>>>>>>>>`); - - const readmeFilePath: string = path.resolve(path.dirname(typeScriptReadmeFilePath), 'readme.md'); - - let cmd = `autorest --typescript --typescript-sdks-folder=${azureSDKForJSRepoRoot} --license-header=MICROSOFT_MIT_NO_VERSION ${readmeFilePath}`; - if (use) { - cmd += ` --use=${use}`; - } - else { - const localAutorestTypeScriptFolderPath = path.resolve(azureSDKForJSRepoRoot, '..', 'autorest.typescript'); - if (fs.existsSync(localAutorestTypeScriptFolderPath) && fs.lstatSync(localAutorestTypeScriptFolderPath).isDirectory()) { - cmd += ` --use=${localAutorestTypeScriptFolderPath}`; - } - } - - if (useDebugger) { - cmd += ` --typescript.debugger`; - } - - try { - _logger.log('Executing command:'); - _logger.log('------------------------------------------------------------'); - _logger.log(cmd); - _logger.log('------------------------------------------------------------'); - - const commandOutput = execSync(cmd, { encoding: "utf8" }); - _logger.log(commandOutput); - - _logger.log('Installing dependencies...'); - const packageFolderPath: string | undefined = getAbsolutePackageFolderPathFromReadmeFileContents(azureSDKForJSRepoRoot, typeScriptReadmeFileContents); - if (!packageFolderPath) { - _logger.log('Error:'); - _logger.log(`Could not determine the generated package folder's path from ${typeScriptReadmeFilePath}.`); - } else { - await npmInstall(packageFolderPath); - await npmRunTest(packageFolderPath); - } - } catch (err) { - _logger.log('Error:'); - _logger.log(`An error occurred while generating client for packages: "${packageNamesString}":\nErr: ${err}\nStderr: "${err.stderr}"`); - } - - _logger.log(`>>>>>>>>>>>>>>>>>>> End: "${packageNamesString}" >>>>>>>>>>>>>>>>>>>>>>>>>`); - _logger.log(); - } - } -} - -function getPackageConfig(azureSdkForJsRoot: string, packageInfo: PackageInfo, include?: RegExp, exclude?: RegExp): { content: any; path: string } | undefined { - if (!include) { - include = /.*/; - } - - if (!packageInfo.name || (!packageInfo.name.match(include) || (exclude && packageInfo.name.match(exclude)))) { - _logger.log(`Skipping ${packageInfo.name} package`); - return undefined; - } - - if (!packageInfo.outputPath) { - throw new Error("Output path cannot be undefined"); - } - - const packageJsonPath = path.join(azureSdkForJsRoot, packageInfo.outputPath, "package.json"); - _logger.log(`Reading "${packageJsonPath}"`); - const configContent = fs.readFileSync(packageJsonPath); - const config = JSON.parse(configContent.toString()); - - return { content: config, path: packageJsonPath }; -} - -export async function setAutoPublish(azureSdkForJsRoot: string, include?: RegExp, exclude?: RegExp) { - const jsonPackageInfos = await getPackageInformationFromPackageJsons(azureSdkForJsRoot); - - for (const packageInfo of jsonPackageInfos) { - _logger.log(`Analyzing ${packageInfo.name} package`); - const config = getPackageConfig(azureSdkForJsRoot, packageInfo, include, exclude); - if (!config) { - _logger.log(`Skipping ${packageInfo.name} package`); - continue; - } - - config.content["autoPublish"] = true; - fs.writeFileSync(config.path, JSON.stringify(config.content, undefined, " ") + "\n"); - _logger.log("Saved"); - } -} - -export async function setVersion(azureSdkForJsRoot: string, include?: RegExp, exclude?: RegExp) { - if (!include) { - include = /.*/; - } - - const jsonPackageInfos = await getPackageInformationFromPackageJsons(azureSdkForJsRoot); - - for (const packageInfo of jsonPackageInfos) { - _logger.log(`Analyzing ${packageInfo.name} package`); - const config = getPackageConfig(azureSdkForJsRoot, packageInfo, include, exclude); - if (!config) { - _logger.log(`Skipping ${packageInfo.name} package`); - continue; - } - - const nodeName = packageInfo.name!.replace("@", "").replace("/", "-"); - const npm = new NPMScope({}); - const npmViewResult: NPMViewResult = npm.view({ packageName: nodeName }); - - if (!npmViewResult.version) { - continue; - } - - config.content["version"] = npmViewResult.version!.replace("-preview", ""); - fs.writeFileSync(config.path, JSON.stringify(config.content, undefined, " ") + "\n"); - _logger.log("Saved"); - } -} diff --git a/.scripts/latest.ts b/.scripts/latest.ts deleted file mode 100644 index 890bbfd69e62..000000000000 --- a/.scripts/latest.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { resolvePath, changeClonedDependenciesTo } from "@ts-common/azure-js-dev-tools"; - -const packagePath: string = resolvePath(__dirname, ".."); -changeClonedDependenciesTo(packagePath, "latest"); \ No newline at end of file diff --git a/.scripts/local.ts b/.scripts/local.ts deleted file mode 100644 index 2acb28447ee9..000000000000 --- a/.scripts/local.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { resolvePath, changeClonedDependenciesTo } from "@ts-common/azure-js-dev-tools"; - -const packagePath: string = resolvePath(__dirname, ".."); -changeClonedDependenciesTo(packagePath, "local"); \ No newline at end of file diff --git a/.scripts/logger.ts b/.scripts/logger.ts deleted file mode 100644 index f6aa24feac70..000000000000 --- a/.scripts/logger.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import * as colors from "colors"; -import { Argv } from "./commandLine"; - -export enum LoggingLevel { - All = 0, - Trace = 0, - Debug = 1, - Info = 2, - Warn = 3, - Error = 4 -} - -colors.setTheme({ - positive: "green", - negative: "red", - debug: "bgCyan", - info: "bgGreen" -}); - -declare global { - interface String { - positive: string; - negative: string; - debug: string; - info: string; - } -} - -export class Logger { - private _cache: string[]; - _loggingLevel: LoggingLevel; - - constructor(loggingLevel: string | string[]) { - const lastLoggingLevel: string = (typeof loggingLevel === "string" ? loggingLevel : loggingLevel[loggingLevel.length - 1]); - const lowerCaseLevel: string = lastLoggingLevel.toLowerCase(); - const capitalizedLevel: string = lowerCaseLevel.charAt(0).toUpperCase() + lowerCaseLevel.slice(1); - this._loggingLevel = LoggingLevel[capitalizedLevel as any] as any; - this._cache = []; - } - - log(text?: string): void { - text = text || ""; - console.log(text); - this._capture(text); - } - - clearCapturedText(): void { - this._cache = []; - } - - getCapturedText(): string { - return this._cache.join("\n"); - } - - private _capture(text: string): void { - this._cache.push(text); - } - - logInfo(text: string): void { - this.log(text.info); - } - - logRed(text: string): void { - this.log(text.red); - } - - logGreen(text: string): void { - this.log(text.green); - } - - logError(text: string): void { - this.log(text.bgRed); - } - - logWarn(text: string): void { - if (this._loggingLevel <= LoggingLevel.Warn) { - this.log(text.bgYellow.black); - } - } - - logDebug(text: string): void { - if (this._loggingLevel <= LoggingLevel.Debug) { - this.log(text); - } - } - - logWithDebugDetails(text: string, details?: string): void { - const greyDetails = `(${details})`.grey; - const textToLog = (this._loggingLevel <= LoggingLevel.Debug) ? `${text} ${greyDetails}` : (text); - this.log(textToLog); - } - - logTrace(text: string): void { - if (this._loggingLevel <= LoggingLevel.Trace) { - this.log(text.gray); - } - } - - logWithPath(path: string, message: string): void { - console.log(`[${path}]> ${message}`); - } - - static get(): Logger { - return new Logger(Argv.Global.loggingLevel); - } -} diff --git a/.scripts/packages.ts b/.scripts/packages.ts deleted file mode 100644 index 9298bca31626..000000000000 --- a/.scripts/packages.ts +++ /dev/null @@ -1,281 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import { exec, ExecException } from "child_process"; -import * as fssync from "fs"; -import { promises as fs } from "fs"; -import * as path from "path"; -import { parseSdkType, SdkType } from "./commandLine"; -import { arrayContains, getChildDirectories, isDirectory, pathExists } from "./common"; -import { Logger } from "./logger"; -import { doesReadmeMdFileSpecifiesTypescriptSdk, findReadmeTypeScriptMdFilePaths, getAbsolutePackageFolderPathFromReadmeFileContents, getPackageNamesFromReadmeTypeScriptMdFileContents } from "./readme"; - -export type SdkInfo = { sdkName: string; sdkType: SdkType }; -export type PackageInfo = { - name?: string; - version?: string; - outputPath?: string, - readmePath?: string, - dependencies?: { [key: string]: string } -}; -export type PackageFault = { - package: PackageInfo - message?: string; - details?: string; -}; - -const specificationsSegment = "specification"; -const _logger = Logger.get(); - -if (!fs) { - throw new Error("This script has to be run on Node.js 10.0+"); -} - -export async function findSdkDirectory(azureRestApiSpecsRepository: string, packageName: string, sdkType: SdkType): Promise { - const sdkPath = path.resolve(azureRestApiSpecsRepository, specificationsSegment, packageName, sdkType); - - if (await !pathExists(sdkPath)) { - return Promise.reject(`${sdkPath} SDK specs don't exist`); - } - - return sdkPath; -} - -export async function findMissingSdks(azureRestApiSpecsRepository: string): Promise { - _logger.logDebug(`Finding missing SDKS in ${azureRestApiSpecsRepository}`); - - const specsDirectory = path.resolve(azureRestApiSpecsRepository, specificationsSegment); - _logger.logTrace(`Reading "${azureRestApiSpecsRepository}" directory`); - - const serviceSpecs = await fs.readdir(specsDirectory); - _logger.logTrace(`Found ${serviceSpecs.length} specification folders`); - - const missingSdks = []; - - for (const serviceDirectory of serviceSpecs) { - const fullServicePath = path.resolve(specsDirectory, serviceDirectory); - _logger.logTrace(`Analyzing ${serviceDirectory} in ${fullServicePath}`); - - if (!(await isDirectory(fullServicePath))) { - _logger.logDebug(`"${fullServicePath}" is not a directory. Skipping`); - continue; - } - - const sdkTypeDirectories = await findChildDirectoriesRecursively(fullServicePath); - _logger.logTrace(`Found ${sdkTypeDirectories.length} specification type folders: [${sdkTypeDirectories}]`); - - for (const sdkTypeDirectory of sdkTypeDirectories) { - const missingSdk = await analyzeSingleDirectory(fullServicePath, serviceDirectory, sdkTypeDirectory); - if (missingSdk) { - missingSdks.push(missingSdk); - } - } - } - - return missingSdks; -} - -async function findChildDirectoriesRecursively(directoryPath: string): Promise { - const _findChildDirectoriesRecursively = async (dirPath: string, paths: string[]) => { - const children = await getChildDirectories(dirPath); - for (const child of children) { - const fullPath = path.resolve(dirPath, child); - paths.push(fullPath); - await _findChildDirectoriesRecursively(fullPath, paths); - } - } - - const allDirectories: string[] = []; - await _findChildDirectoriesRecursively(directoryPath, allDirectories); - return allDirectories; -} - -async function analyzeSingleDirectory(directoryPath: string, serviceDirectory: string, sdkTypeDirectory: string): Promise { - const fullSdkPath = path.resolve(directoryPath, sdkTypeDirectory); - _logger.logTrace(`Analyzing ${sdkTypeDirectory} in ${fullSdkPath}`); - - if (!(await isDirectory(fullSdkPath))) { - _logger.logWarn(`"${directoryPath}" is not a directory. Skipping`); - } else { - const readmeFiles = (await fs.readdir(fullSdkPath)).filter(file => /^readme/.test(file)); - const fullSpecName = `${serviceDirectory} [${sdkTypeDirectory}]` - const sdk = { sdkName: serviceDirectory, sdkType: parseSdkType(sdkTypeDirectory) }; - - if (readmeFiles.length <= 0) { - // No readme.md - } else if (arrayContains(readmeFiles, "readme.nodejs.md")) { - if (!arrayContains(readmeFiles, "readme.typescript.md")) { - _logger.logWithDebugDetails(`${fullSpecName}`.negative, "readme.nodejs.md exists but no matching readme.typescript.md"); - return sdk; - } else { - _logger.logDebug(fullSpecName.positive); - } - } else if (arrayContains(readmeFiles, "readme.md")) { - const readmeMdPath = path.resolve(fullSdkPath, "readme.md"); - if (await doesReadmeMdFileSpecifiesTypescriptSdk(readmeMdPath)) { - _logger.logWithDebugDetails(`${fullSpecName}`.negative, "typescript mentioned in readme.md but no readme.typescript.md exists"); - return sdk; - } else { - _logger.logDebug(fullSpecName.positive); - } - } - } - - return undefined; -} - -export async function saveContentToFile(filePath: string, content: string): Promise { - await fs.writeFile(filePath, content); -} - -export async function findWrongPackages(azureRestApiSpecsRoot: string, azureSdkForJsRoot: string): Promise { - _logger.logDebug(`Finding wrong packages using "${azureRestApiSpecsRoot}" and "${azureSdkForJsRoot}" repositories`); - const readmePackageInfos = await getPackageInformationFromReadmeFiles(azureRestApiSpecsRoot, azureSdkForJsRoot); - const jsonPackageInfos = await getPackageInformationFromPackageJsons(azureSdkForJsRoot); - - const noOutputPackages = await findPackagesWithIncorrectOutput(readmePackageInfos); - const noMatchingReadmes = await findPackagesWithoutMatchingReadmes(readmePackageInfos, jsonPackageInfos); - const noMatchingPackageJsons = await findPackagesWithoutMatchingPackageJson(readmePackageInfos, jsonPackageInfos); - const notBuildingPackages = await getPackagesWithBuildErrors(azureSdkForJsRoot, jsonPackageInfos); - - return noOutputPackages - .concat(noMatchingReadmes) - .concat(noMatchingPackageJsons) - .concat(notBuildingPackages); -} - -async function findPackagesWithIncorrectOutput(packageInfos: PackageInfo[]): Promise { - const incorrectPackages: PackageFault[] = []; - - for (const packageInfo of packageInfos) { - if (packageInfo.outputPath && !fssync.existsSync(packageInfo.outputPath)) { - incorrectPackages.push({ - package: packageInfo, - message: "Output path in azure-sdk-for-js repository doesn't exists. Hint: try regenerating the package." - }); - } - } - - return incorrectPackages; -} - -async function findPackagesWithoutMatchingReadmes(readmePackageInfos: PackageInfo[], jsonPackageInfo: PackageInfo[]): Promise { - const faultyPackages = jsonPackageInfo.filter(json => readmePackageInfos.every(readme => readme.name !== json.name)); - - return faultyPackages.map(pkg => { - return { - package: pkg, - message: "Package exists in packages folder but no matching readme.typescript.md found. Hint: add readme.typescript.md based on existing readme.nodejs.md." - } - }); -} - -async function findPackagesWithoutMatchingPackageJson(readmePackageInfos: PackageInfo[], jsonPackageInfo: PackageInfo[]): Promise { - const faultyPackages = readmePackageInfos.filter(readme => jsonPackageInfo.every(json => json.name !== readme.name)); - - return faultyPackages.map(pkg => { - return { - package: pkg, - message: "Readme file with the name exists, but no matching package.json exists. Hint: try regenerating the package." - } - }); -} - -export async function getPackageInformationFromPackageJsons(azureSdkForJsRoot: string): Promise { - const packageJsonPaths = await getPackageJsons(azureSdkForJsRoot); - const packageInfos = []; - for (const packageJsonPath of packageJsonPaths) { - const packageInfo = await getPackageInfoFromPackageJson(packageJsonPath, azureSdkForJsRoot); - packageInfos.push(packageInfo); - } - - return packageInfos; -} - -async function getPackageJsons(azureSdkForJsRoot: string): Promise { - const packagesPath = path.resolve(azureSdkForJsRoot, "sdk"); - const allChildDirectories = await findChildDirectoriesRecursively(packagesPath); - const packagesJsonPaths = allChildDirectories - .map(dir => path.resolve(dir, "package.json")) - .filter(path => !path.includes("node_modules") && fssync.existsSync(path)); - - _logger.logTrace(`Found ${packagesJsonPaths.length} package.json files`); - return packagesJsonPaths; -} - -async function getPackageInfoFromPackageJson(packageJsonPath: string, azureSdkForJsRoot: string): Promise { - const packageJsonContent = await fs.readFile(packageJsonPath); - const packageJson = JSON.parse(packageJsonContent.toString()); - - return { - name: packageJson.name, - version: packageJson.version, - dependencies: packageJson.dependencies, - outputPath: packageJsonPath.replace(`${path.sep}package.json`, "").replace(new RegExp(`${azureSdkForJsRoot}(\\${path.sep})?`), "") - }; -} - -async function getPackageInformationFromReadmeFiles(azureRestApiSpecsRoot: string, azureSdkForJsRoot: string): Promise { - const typescriptReadmePaths = findReadmeTypeScriptMdFilePaths(azureRestApiSpecsRoot); - _logger.logTrace(`Found ${typescriptReadmePaths.length} readme files: ${typescriptReadmePaths}`); - - const packageInfos = []; - - for (const typescriptReadmePath of typescriptReadmePaths) { - const newPackageInfos: PackageInfo[] = await getPackageMetadataFromReadmeFile(azureSdkForJsRoot, azureRestApiSpecsRoot, typescriptReadmePath); - _logger.logTrace(`Extracted ${JSON.stringify(newPackageInfos)} info from ${typescriptReadmePath}`); - packageInfos.push(...newPackageInfos); - } - - return packageInfos; -} - -async function getPackageMetadataFromReadmeFile(azureSdkForJsRoot: string, azureRestApiSpecsRoot: string, tsReadmePath: string): Promise { - const readmeBuffer: Buffer = await fs.readFile(tsReadmePath); - const readmeContent: string = readmeBuffer.toString() - const absoluteOutputPath: string | undefined = getAbsolutePackageFolderPathFromReadmeFileContents(azureSdkForJsRoot, readmeContent); - const packageNames: string[] = getPackageNamesFromReadmeTypeScriptMdFileContents(readmeContent); - return packageNames.map((name: string) => { - return { - name: name, - outputPath: absoluteOutputPath, - readmePath: tsReadmePath.replace(azureRestApiSpecsRoot, "") - } - }); -} - -async function getPackagesWithBuildErrors(azureSdkForJsRoot: string, jsonPackageInfos: PackageInfo[]): Promise { - const faultyPackages: PackageFault[] = []; - for (const packageInfo of jsonPackageInfos) { - if (packageInfo.outputPath) { - const packagePath: string = path.resolve(azureSdkForJsRoot, packageInfo.outputPath); - _logger.logTrace(`Building ${packagePath} directory.`); - const error: string | undefined = await buildAndGetErrorOutput(packagePath); - if (error) { - faultyPackages.push({ - package: packageInfo, - message: "Package doesn't build correctly. Look into details property to see build failures", - details: error - }); - } - } - } - - _logger.logTrace(`Found ${faultyPackages.length} packages that don't build correctly`); - return faultyPackages; -} - -async function buildAndGetErrorOutput(packagePath: string): Promise { - return new Promise((resolve) => { - exec("npm install && npm run build", { cwd: packagePath }, (error: ExecException | null, stdout: string) => { - if (error) { - resolve(`Status code: ${error.code}\n\tOutput: ${stdout}\n\tMessage: ${error.message}`); - } else { - resolve(undefined); - } - }); - }); -} diff --git a/.scripts/readme.ts b/.scripts/readme.ts deleted file mode 100644 index 9f8de6844140..000000000000 --- a/.scripts/readme.ts +++ /dev/null @@ -1,250 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import { promises as fs } from "fs"; -import * as glob from "glob"; -import * as yaml from "js-yaml"; -import * as path from "path"; -import { SdkType } from "./commandLine"; -import { contains, pathExists, startsWith } from "./common"; -import { Logger } from "./logger"; - -const _logger = Logger.get(); - -interface ReadmeSettings { - "nodejs": { - "azure-arm": boolean; - "license-header": string; - "payload-flattening-threshold": number; - "package-name": string; - "output-folder": string; - "generate-license-txt": boolean | undefined; - "generate-package-json": boolean | undefined; - "generate-readme-md": boolean | undefined; - "generate-metadata": boolean | undefined; - } | undefined; -} - -export async function getPackageFolderPathFromPackageArgument(packageName: string, azureRestAPISpecsRoot: string, azureSDKForJSRepoRoot: string): Promise { - let packageFolderPath: string | undefined; - - if (!packageName) { - _logger.logError(`No --package specified.`); - } else { - const typeScriptReadmeFilePaths: string[] = findReadmeTypeScriptMdFilePaths(azureRestAPISpecsRoot); - _logger.logTrace(`Found ${typeScriptReadmeFilePaths.length} readmes in ${azureRestAPISpecsRoot}`) - - let foundPackage = false; - - for (let i = 0; i < typeScriptReadmeFilePaths.length; ++i) { - const typeScriptReadmeFilePath: string = typeScriptReadmeFilePaths[i]; - - const typeScriptReadmeFileContents: string = await fs.readFile(typeScriptReadmeFilePath, 'utf8'); - const packageNames: string[] = getPackageNamesFromReadmeTypeScriptMdFileContents(typeScriptReadmeFileContents); - _logger.logTrace(`Found [${packageNames}] package names`); - - if (contains(packageNames, packageName)) { - foundPackage = true; - packageFolderPath = getAbsolutePackageFolderPathFromReadmeFileContents(azureSDKForJSRepoRoot, typeScriptReadmeFileContents); - } - } - - if (!foundPackage) { - _logger.logError(`No package found with the name "${packageName}".`); - } - } - - return packageFolderPath; -} - -export async function getYamlSection(buffer: Buffer, sectionBeginning: string, sectionEnd: string): Promise { - const beginningIndex = buffer.indexOf(sectionBeginning); - const trimmedBuffer = buffer.slice(beginningIndex + (sectionBeginning.length)); - - const endIndex = trimmedBuffer.indexOf(sectionEnd, 3); - const sectionBuffer = trimmedBuffer.slice(0, endIndex); - - return sectionBuffer; -} - -export async function doesReadmeMdFileSpecifiesTypescriptSdk(readmeMdPath: string): Promise { - const readmeMdBuffer = await fs.readFile(readmeMdPath); - const sectionBuffer = await getYamlSection(readmeMdBuffer, "``` yaml $(swagger-to-sdk)", "```"); - - if (sectionBuffer.includes("azure-sdk-for-js")) { - return true; - } - - return false; -} - -export async function copyExistingNodeJsReadme(sdkPath: string): Promise { - const nodeJsReadmePath = path.resolve(sdkPath, "readme.nodejs.md"); - if (!(await pathExists(nodeJsReadmePath))) { - return Promise.reject(`${nodeJsReadmePath} doesn't exists`) - } - - const typescriptReadmePath = path.resolve(sdkPath, "readme.typescript.md"); - _logger.logDebug(`Copying ${nodeJsReadmePath} to ${typescriptReadmePath}`) - - if (await pathExists(typescriptReadmePath)) { - return Promise.reject(`${typescriptReadmePath} file already exists`) - } - - await fs.copyFile(nodeJsReadmePath, typescriptReadmePath); - return typescriptReadmePath; -} - -export async function getSinglePackageName(typescriptReadmePath: string): Promise { - const readmeBuffer: Buffer = await fs.readFile(typescriptReadmePath); - const yamlSectionBuffer = await getYamlSection(readmeBuffer, "``` yaml $(typescript)", "```"); - const yamlSectionText = yamlSectionBuffer.toString(); - const yamlSection:any = yaml.safeLoad(yamlSectionText); - return yamlSection["typescript"]["package-name"]; -} - -async function updatePackageName(settings: ReadmeSettings, sdkType: SdkType): Promise { - if (settings.nodejs) { - let packageName: string = settings.nodejs["package-name"] - if (packageName.startsWith("azure-")) { - packageName = packageName.replace("azure-", ""); - } - - if (sdkType == SdkType.ResourceManager && !packageName.startsWith("arm-")) { - packageName = `arm-${packageName}` - } - - settings.nodejs["package-name"] = `"@azure/${packageName}"` - } - return settings; -} - -async function updateMetadataFields(settings: ReadmeSettings): Promise { - if (settings.nodejs) { - settings.nodejs["generate-metadata"] = true; - delete settings.nodejs["generate-license-txt"] - delete settings.nodejs["generate-package-json"] - delete settings.nodejs["generate-readme-md"]; - } - - return settings; -} - -function stripExtraQuotes(text: string): string { - return text.replace(/'/g, ""); -} - -async function updateOutputFolder(settings: ReadmeSettings): Promise { - if (settings.nodejs) { - const outputName: string = settings.nodejs["package-name"].replace(/"/g, ""); - settings.nodejs["output-folder"] = `"$(typescript-sdks-folder)/packages/${outputName}"`; - } - return settings; -} - -async function updateYamlSection(sectionText: string, sdkType: SdkType): Promise { - const section: any = yaml.safeLoad(sectionText); - await updatePackageName(section, sdkType); - await updateMetadataFields(section); - await updateOutputFolder(section); - section["typescript"] = section.nodejs; - delete section.nodejs; - - return yaml.safeDump(section).trim(); -} - -export async function updateTypeScriptReadmeFile(typescriptReadmePath: string, sdkType: SdkType): Promise { - const readmeBuffer: Buffer = await fs.readFile(typescriptReadmePath); - let outputReadme: string = readmeBuffer.toString(); - - const yamlSection = await getYamlSection(readmeBuffer, "``` yaml $(nodejs)", "```"); - const sectionText = yamlSection.toString().trim(); - let updatedYamlSection = await updateYamlSection(sectionText, sdkType); - updatedYamlSection = stripExtraQuotes(updatedYamlSection); - - outputReadme = outputReadme.replace(sectionText, updatedYamlSection); - outputReadme = outputReadme.replace("azure-sdk-for-node", "azure-sdk-for-js"); - outputReadme = outputReadme.replace("Node.js", "TypeScript"); - outputReadme = outputReadme.replace("$(nodejs)", "$(typescript)"); - outputReadme = outputReadme.replace("nodejs", "typescript"); - outputReadme = outputReadme.replace("Node", "TypeScript"); - outputReadme = outputReadme.replace("node", "typescript"); - - return outputReadme; -} - -export async function updateMainReadmeFile(readmeFilePath: string) { - const readmeBuffer: Buffer = await fs.readFile(readmeFilePath); - let outputReadme: string = readmeBuffer.toString(); - - const yamlSection = await getYamlSection(readmeBuffer, "``` yaml $(swagger-to-sdk)", "```"); - const sectionText = yamlSection.toString().trim(); - - let lines = sectionText.split("\r\n"); - let nodeLineIndex = lines.findIndex(el => el.includes("- repo: azure-sdk-for-node")); - - if (nodeLineIndex == -1) { - lines.push(" - repo: azure-sdk-for-node"); - nodeLineIndex = lines.length - 1; - } - - const nodeLine = lines[nodeLineIndex]; - lines.splice(nodeLineIndex, 0, nodeLine.replace("node", "js")); - const updatedYamlSection = lines.join("\r\n"); - - outputReadme = outputReadme.replace(sectionText, updatedYamlSection); - return outputReadme; -} - -export function getPackageNamesFromReadmeTypeScriptMdFileContents(readmeTypeScriptMdFileContents: string): string[] { - const packageNamePattern: RegExp = /package-name: (\S*)/g; - const matches: string[] = readmeTypeScriptMdFileContents.match(packageNamePattern) || []; - _logger.logTrace(`"package-name" matches: ${JSON.stringify(matches)}`); - - for (let i = 0; i < matches.length; ++i) { - matches[i] = matches[i].substring("package-name: ".length); - } - - const trimmedMatches = matches.map(match => match.replace(/\"/g, "")); - _logger.logTrace(`"package-name" matches trimmed: ${JSON.stringify(trimmedMatches)}`); - return trimmedMatches; -} - -export function findReadmeTypeScriptMdFilePaths(azureRestAPISpecsRoot: string): string[] { - _logger.logDebug(`Looking for "readme.typescript.md" files in "${azureRestAPISpecsRoot}"...`); - - const specificationFolderPath: string = path.resolve(azureRestAPISpecsRoot, 'specification'); - const readmeTypeScriptMdFilePaths: string[] = glob.sync( - '**/readme.typescript.md', - { absolute: true, cwd: specificationFolderPath } - ); - if (readmeTypeScriptMdFilePaths) { - for (let i = 0; i < readmeTypeScriptMdFilePaths.length; ++i) { - const readmeTypeScriptMdFilePath: string = readmeTypeScriptMdFilePaths[i]; - _logger.logTrace(` Found "${readmeTypeScriptMdFilePath}".`); - - if (readmeTypeScriptMdFilePath && !startsWith(readmeTypeScriptMdFilePath, specificationFolderPath)) { - const resolvedReadmeTypeScriptMdFilePath: string = path.resolve(specificationFolderPath, readmeTypeScriptMdFilePath); - _logger.logTrace(` Updating to "${resolvedReadmeTypeScriptMdFilePath}".`); - readmeTypeScriptMdFilePaths[i] = resolvedReadmeTypeScriptMdFilePath; - } - } - } - return readmeTypeScriptMdFilePaths; -} - -export function getOutputFolderFromReadmeTypeScriptMdFileContents(readmeTypeScriptMdFileContents: string): string | undefined { - const regExpMatch: RegExpMatchArray | null = readmeTypeScriptMdFileContents.match(/output-folder: (\S*)/); - return regExpMatch && regExpMatch.length >= 1 ? regExpMatch[1].replace(/\"/g, "") : undefined; -} - -export function getAbsolutePackageFolderPathFromReadmeFileContents( - azureSDKForJSRepoRoot: string, - typeScriptReadmeFileContents: string, -): string | undefined { - const outputFolderPath: string | undefined = getOutputFolderFromReadmeTypeScriptMdFileContents(typeScriptReadmeFileContents); - return !outputFolderPath ? outputFolderPath : outputFolderPath.replace("$(typescript-sdks-folder)", azureSDKForJSRepoRoot); -} diff --git a/.scripts/version.ts b/.scripts/version.ts deleted file mode 100644 index dd12a22e93a7..000000000000 --- a/.scripts/version.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -export class Version { - major: number; - minor: number; - patch: number; - suffix?: string; - - constructor(version: string) { - const parts = version.split("-"); - this.suffix = parts[1]; - - const numbers = parts[0].split("."); - this.major = Number.parseInt(numbers[0]); - this.minor = Number.parseInt(numbers[1]); - this.patch = Number.parseInt(numbers[2]); - } - - static parse(version: string): Version { - return new Version(version); - } - - public bumpMajor(): void { - this.major = this.major + 1; - this.minor = 0; - this.patch = 0; - } - - public bumpMinor(): void { - this.minor = this.minor + 1; - this.patch = 0; - } - - public bumpPatch(): void { - this.patch = this.patch + 1; - } - - public toString(): string { - const suffix = this.suffix ? `-${this.suffix}` : ""; - return `${this.major}.${this.minor}.${this.patch}${suffix}`; - } -} diff --git a/eng/pipelines/dataplane-ci.yml b/eng/pipelines/dataplane-ci.yml deleted file mode 100644 index c0c1e0b0416e..000000000000 --- a/eng/pipelines/dataplane-ci.yml +++ /dev/null @@ -1,96 +0,0 @@ -trigger: - branches: - include: - - main - paths: - include: - - eng/pipelines/mgmt-pr.yml - - sdk/applicationinsights/applicationinsights-query - - sdk/batch/batch - - sdk/cognitiveservices/cognitiveservices-anomalydetector - - sdk/cognitiveservices/cognitiveservices-autosuggest - - sdk/cognitiveservices/cognitiveservices-computervision - - sdk/cognitiveservices/cognitiveservices-contentmoderator - - sdk/cognitiveservices/cognitiveservices-customimagesearch - - sdk/cognitiveservices/cognitiveservices-customsearch - - sdk/cognitiveservices/cognitiveservices-customvision-prediction - - sdk/cognitiveservices/cognitiveservices-customvision-training - - sdk/cognitiveservices/cognitiveservices-entitysearch - - sdk/cognitiveservices/cognitiveservices-face - - sdk/cognitiveservices/cognitiveservices-formrecognizer - - sdk/cognitiveservices/cognitiveservices-imagesearch - - sdk/cognitiveservices/cognitiveservices-localsearch - - sdk/cognitiveservices/cognitiveservices-luis-authoring - - sdk/cognitiveservices/cognitiveservices-luis-runtime - - sdk/cognitiveservices/cognitiveservices-newssearch - - sdk/cognitiveservices/cognitiveservices-personalizer - - sdk/cognitiveservices/cognitiveservices-qnamaker - - sdk/cognitiveservices/cognitiveservices-qnamaker-runtime - - sdk/cognitiveservices/cognitiveservices-spellcheck - - sdk/cognitiveservices/cognitiveservices-textanalytics - - sdk/cognitiveservices/cognitiveservices-translatortext - - sdk/cognitiveservices/cognitiveservices-videosearch - - sdk/cognitiveservices/cognitiveservices-visualsearch - - sdk/cognitiveservices/cognitiveservices-websearch - - sdk/graphrbac/graph - - sdk/operationalinsights/loganalytics - - sdk/servicefabric/servicefabric - - sdk/storage/storage-datalake - -pr: none - -variables: - NodeVersion: '10.x' - -jobs: - - job: 'Build' - - pool: - vmImage: 'Ubuntu 20.04' - - steps: - - task: NodeTool@0 - inputs: - versionSpec: '$(NodeVersion)' - displayName: 'Install Node.js $(NodeVersion)' - - - task: Npm@1 - displayName: 'npm install' - inputs: - verbose: false - - - script: 'gulp pack --base-reference=main --head-reference=main' - displayName: 'gulp pack' - - - task: CopyFiles@2 - displayName: 'Copy Files to: drop' - inputs: - Contents: '*.tgz' - TargetFolder: drop - - - task: PublishBuildArtifacts@1 - inputs: - pathtoPublish: $(Build.SourcesDirectory)/drop - - - job: 'Analyze' - - pool: - vmImage: 'Ubuntu 20.04' - - steps: - - task: NodeTool@0 - inputs: - versionSpec: '$(NodeVersion)' - displayName: 'Install Node.js $(NodeVersion)' - - - task: Npm@1 - displayName: 'npm install' - inputs: - command: install - - - task: Npm@1 - displayName: 'npm audit' - condition: and(succeeded(), eq(variables['RunNpmAudit'], 'true')) - inputs: - command: custom - customCommand: 'audit' diff --git a/eng/pipelines/dataplane-pr.yml b/eng/pipelines/dataplane-pr.yml deleted file mode 100644 index a8df2bf92d8d..000000000000 --- a/eng/pipelines/dataplane-pr.yml +++ /dev/null @@ -1,88 +0,0 @@ -trigger: - branches: - include: - - main -pr: - branches: - include: - - main - paths: - include: - - eng/pipelines/mgmt-pr.yml - - sdk/applicationinsights/applicationinsights-query - - sdk/batch/batch - - sdk/cognitiveservices/cognitiveservices-anomalydetector - - sdk/cognitiveservices/cognitiveservices-autosuggest - - sdk/cognitiveservices/cognitiveservices-computervision - - sdk/cognitiveservices/cognitiveservices-contentmoderator - - sdk/cognitiveservices/cognitiveservices-customimagesearch - - sdk/cognitiveservices/cognitiveservices-customsearch - - sdk/cognitiveservices/cognitiveservices-customvision-prediction - - sdk/cognitiveservices/cognitiveservices-customvision-training - - sdk/cognitiveservices/cognitiveservices-entitysearch - - sdk/cognitiveservices/cognitiveservices-face - - sdk/cognitiveservices/cognitiveservices-formrecognizer - - sdk/cognitiveservices/cognitiveservices-imagesearch - - sdk/cognitiveservices/cognitiveservices-localsearch - - sdk/cognitiveservices/cognitiveservices-luis-authoring - - sdk/cognitiveservices/cognitiveservices-luis-runtime - - sdk/cognitiveservices/cognitiveservices-newssearch - - sdk/cognitiveservices/cognitiveservices-personalizer - - sdk/cognitiveservices/cognitiveservices-qnamaker - - sdk/cognitiveservices/cognitiveservices-qnamaker-runtime - - sdk/cognitiveservices/cognitiveservices-spellcheck - - sdk/cognitiveservices/cognitiveservices-textanalytics - - sdk/cognitiveservices/cognitiveservices-translatortext - - sdk/cognitiveservices/cognitiveservices-videosearch - - sdk/cognitiveservices/cognitiveservices-visualsearch - - sdk/cognitiveservices/cognitiveservices-websearch - - sdk/graphrbac/graph - - sdk/operationalinsights/loganalytics - - sdk/servicefabric/servicefabric - - sdk/storage/storage-datalake - -variables: - NodeVersion: 10.x -jobs: -- job: Build - displayName: Build auto-generated projects - pool: - vmImage: Ubuntu 20.04 - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(NodeVersion) - displayName: Install Node.js $(NodeVersion) - - task: Npm@1 - displayName: npm install - inputs: - command: install - - task: Npm@1 - displayName: npm run build - inputs: - command: custom - customCommand: run build -- --head-reference=origin/$(System.PullRequest.SourceBranch) --base-reference=origin/$(System.PullRequest.TargetBranch) --logging-level=trace -- job: Check_everything - displayName: Check .only, .skip and version bump - pool: - vmImage: Ubuntu 20.04 - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(NodeVersion) - displayName: Install Node.js $(NodeVersion) - - task: Npm@1 - displayName: npm install - inputs: - command: install - - task: Npm@1 - displayName: npm audit - condition: and(succeeded(), eq(variables['RunNpmAudit'], 'true')) - inputs: - command: custom - customCommand: audit - - task: Npm@1 - displayName: npm run check:everything - inputs: - command: custom - customCommand: run check:everything -- --head-reference=origin/$(System.PullRequest.SourceBranch) --base-reference=origin/$(System.PullRequest.TargetBranch) --azure-devops --verbose diff --git a/gulpfile.ts b/gulpfile.ts deleted file mode 100644 index 45b89a164e81..000000000000 --- a/gulpfile.ts +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -import { contains, getArgument, gitDiff, GitDiffResult, gitStatus, GitStatusResult, joinPath, normalize, npmInstall, npmRun, NPMScope, NPMViewResult, RunOptions, StringMap } from "@ts-common/azure-js-dev-tools"; -import * as fs from "fs"; -import gulp from "gulp"; -import * as path from "path"; -import PluginError from "plugin-error"; -import { Argv, CommandLineOptions, getCommandLineOptions } from "./.scripts/commandLine"; -import { endsWith, getPackageFolderPaths, packagesToIgnore } from "./.scripts/common"; -import { generateSdk, setAutoPublish, setVersion } from "./.scripts/gulp"; -import { Logger } from "./.scripts/logger"; -import { findMissingSdks } from "./.scripts/packages"; -import { getPackageFolderPathFromPackageArgument } from "./.scripts/readme"; - -enum PackagesToPack { - All, - DifferentVersion, - BranchHasChanges -} - -function getPackagesToPackArgument(toPackArgument: string | undefined): PackagesToPack { - let result: PackagesToPack = PackagesToPack.BranchHasChanges; - if (toPackArgument) { - const toPackArgumentLower: string = toPackArgument.toLowerCase(); - for (const option in PackagesToPack) { - if (option.toLowerCase() === toPackArgumentLower) { - result = PackagesToPack[option] as any; - break; - } - } - } - return result; -} - -const args: CommandLineOptions = getCommandLineOptions(); -const _logger: Logger = Logger.get(); - -const azureSDKForJSRepoRoot: string = getArgument("azure-sdk-for-js-repo-root", { defaultValue: __dirname })!; -const rawToPack: string | undefined = getArgument("to-pack"); -let toPack: PackagesToPack = getPackagesToPackArgument(rawToPack); -const headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" }); -const baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" }); - -function getDropFolderPath(): string { - let result: string | undefined = getArgument("drop"); - if (!result) { - result = "drop"; - } - if (!path.isAbsolute(result)) { - result = path.join(azureSDKForJSRepoRoot, result); - } - return result; -} - -const dropFolderPath: string = getDropFolderPath(); -if (!fs.existsSync(dropFolderPath)) { - fs.mkdirSync(dropFolderPath); -} - -gulp.task('default', async () => { - _logger.log('gulp build --package '); - _logger.log(' --package'); - _logger.log(' NPM package to run "npm run build" on.'); - _logger.log(); - _logger.log('gulp install --package '); - _logger.log(' --package'); - _logger.log(' NPM package to run "npm install" on.'); - _logger.log(); - _logger.log('gulp codegen [--azure-rest-api-specs-root ] [--use ] [--package ]'); - _logger.log(' --azure-rest-api-specs-root'); - _logger.log(' Root location of the local clone of the azure-rest-api-specs-root repository.'); - _logger.log(' --use'); - _logger.log(' Root location of autorest.typescript repository. If this is not specified, then the latest installed generator for TypeScript will be used.'); - _logger.log(' --package'); - _logger.log(' NPM package to regenerate. If no package is specified, then all packages will be regenerated.'); - _logger.log(); - _logger.log('gulp pack [--package ] [--whatif] [--to-pack ] [--drop ]'); - _logger.log(' --package'); - _logger.log(' The name of the package to pack. If no package is specified, then all packages will be packed.'); - _logger.log(' --whatif'); - _logger.log(' Don\'t actually pack packages, but just indicate which packages would be packed.'); - _logger.log(" --to-pack"); - _logger.log(` Which packages should be packed. Options are "All", "DifferentVersion", "BranchHasChanges".`); - _logger.log(` --drop`); - _logger.log(` The folder where packed tarballs will be put. Defaults to "/drop/".`); -}); - -gulp.task("install", async () => { - _logger.log(`Passed arguments: ${Argv.print()}`); - const argv: (Argv.PackageOptions & Argv.RepositoryOptions) - = Argv.construct(Argv.Options.Package, Argv.Options.Repository) - .usage("Example: gulp install --package @azure/arm-mariadb") - .argv as any; - - const packageFolderPath: string | undefined = await getPackageFolderPathFromPackageArgument( - argv.package, - argv.azureRestAPISpecsRoot, - argv.azureSDKForJSRepoRoot, - ); - if (packageFolderPath) { - npmInstall({ executionFolderPath: packageFolderPath }); - } -}); - -gulp.task("build", async () => { - _logger.log(`Passed arguments: ${Argv.print()}`); - const argv: (Argv.PackageOptions & Argv.RepositoryOptions) - = Argv.construct(Argv.Options.Package, Argv.Options.Repository) - .usage("Example: gulp build --package @azure/arm-mariadb") - .argv as any; - - const packageFolderPath: string | undefined = await getPackageFolderPathFromPackageArgument( - argv.package, - argv.azureRestAPISpecsRoot, - argv.azureSDKForJSRepoRoot, - ); - if (packageFolderPath) { - npmRun("build", { executionFolderPath: packageFolderPath }); - } -}); - -// This task is used to generate libraries based on the mappings specified above. -gulp.task('codegen', async () => { - interface CodegenOptions { - debugger: boolean | undefined; - use: string | undefined; - }; - - _logger.log(`Passed arguments: ${Argv.print()}`); - const argv: (CodegenOptions & Argv.PackageOptions & Argv.RepositoryOptions) - = Argv.construct(Argv.Options.Package, Argv.Options.Repository) - .options({ - "debugger": { - boolean: true, - alias: ["d", "use-debugger"], - description: "Enables debugger attaching to autorest.typescript process" - }, - "use": { - string: true, - description: "Specifies location for the generator to use" - } - }) - .usage("Example: gulp codegen --package @azure/arm-mariadb") - .argv as any; - - await generateSdk(argv.azureRestAPISpecsRoot, argv.azureSDKForJSRepoRoot, argv.package, argv.use, argv.debugger); -}); - -function pack(): void { - const runOptions: RunOptions = { - log: (text: string) => _logger.logTrace(text), - showCommand: true, - showOutput: true - }; - - let errorPackages = 0; - let upToDatePackages = 0; - let packedPackages = 0; - let skippedPackages = 0; - - const changedFiles: string[] = []; - - if (toPack === PackagesToPack.BranchHasChanges) { - let packBaseReference: string | undefined = baseReference; - if (!packBaseReference) { - packBaseReference = "master"; - _logger.log(`No base-reference argument specified on command line or in environment variables. Defaulting to "${packBaseReference}".`); - } - - let packHeadReference: string | undefined = headReference; - if (!packHeadReference) { - const statusResult: GitStatusResult = gitStatus(runOptions); - packHeadReference = statusResult.localBranch!; - _logger.log(`No head-reference argument specified on command line or in environment variables. Defaulting to "${packHeadReference}".`); - - const modifiedFiles: string[] | undefined = statusResult.modifiedFiles; - if (modifiedFiles) { - changedFiles.push(...modifiedFiles); - } - } - - if (packBaseReference === packHeadReference) { - if (rawToPack) { - _logger.logWarn(`The base-reference "${packBaseReference}" is equal to the head-reference "${packHeadReference}". This will result in nothing getting packed because there won't be any changes detected. Please change either the base or head-reference.`); - } else { - toPack = PackagesToPack.DifferentVersion; - _logger.log(`The base-reference "${packBaseReference}" is equal to the head-reference "${packHeadReference}" which means there won't be any changes to pack. Switching "to-pack" to be "${PackagesToPack[toPack]}".`); - } - } else { - const diffResult: GitDiffResult = gitDiff(packBaseReference, packHeadReference, runOptions); - changedFiles.push(...diffResult.filesChanged); - if (!changedFiles || changedFiles.length === 0) { - _logger.logTrace(`Found no changes between "${packBaseReference}" and "${packHeadReference}".`); - } else { - _logger.logTrace(`Found the following changed files`) - for (const changedFilePath of changedFiles) { - _logger.logTrace(changedFilePath); - } - } - } - } - - const packageFolderRoot: string = path.resolve(__dirname, "sdk"); - _logger.logTrace(`INFO: Searching for package folders in ${packageFolderRoot}`); - const packageFolderPaths: string[] | undefined = getPackageFolderPaths(packageFolderRoot); - if (!packageFolderPaths) { - _logger.logTrace(`INFO: The folder ${packageFolderPaths} doesn't exist.`); - } else { - for (const packageFolderPath of packageFolderPaths) { - _logger.logTrace(`INFO: Processing ${packageFolderPath}`); - - const npm = new NPMScope({ executionFolderPath: packageFolderPath }); - const packageJsonFilePath: string = joinPath(packageFolderPath, "package.json"); - const packageJson: { [propertyName: string]: any } = require(packageJsonFilePath); - const packageName: string = packageJson.name; - - if (packagesToIgnore.indexOf(packageName) !== -1) { - _logger.log(`INFO: Skipping package ${packageName}`); - ++skippedPackages; - } else if (!args.package || args.package === packageName || endsWith(packageName, `-${args.package}`)) { - const localPackageVersion: string = packageJson.version; - if (!localPackageVersion) { - _logger.log(`ERROR: "${packageJsonFilePath}" doesn't have a version specified.`); - errorPackages++; - } - else { - let shouldPack: boolean = false; - - if (toPack === PackagesToPack.All) { - shouldPack = true; - } else if (toPack === PackagesToPack.DifferentVersion) { - let npmPackageVersion: string | undefined; - try { - const npmViewResult: NPMViewResult = npm.view({ packageName, ...runOptions, showCommand: false, showOutput: false }); - const distTags: StringMap | undefined = npmViewResult["dist-tags"]; - npmPackageVersion = distTags && distTags["latest"]; - } - catch (error) { - // This happens if the package doesn't exist in NPM. - } - - _logger.logTrace(`Local version: ${localPackageVersion}, NPM version: ${npmPackageVersion}`); - shouldPack = localPackageVersion !== npmPackageVersion; - } else if (toPack === PackagesToPack.BranchHasChanges) { - const packageFolderPathWithSep: string = normalize(packageFolderPath + path.posix.sep); - shouldPack = !!changedFiles && contains(changedFiles, (changedFilePath: string) => normalize(changedFilePath).startsWith(packageFolderPathWithSep)); - } - - if (!shouldPack) { - upToDatePackages++; - } else { - _logger.log(`Packing package "${packageName}" with version "${localPackageVersion}"...${args.whatif ? " (SKIPPED)" : ""}`); - if (!args.whatif) { - try { - npm.pack(runOptions); - const packFileName = `${packageName.replace("/", "-").replace("@", "")}-${localPackageVersion}.tgz` - const packFilePath = path.join(packageFolderPath, packFileName); - fs.renameSync(packFilePath, path.join(dropFolderPath, packFileName)); - _logger.log(`Filename: ${packFileName}`); - packedPackages++; - } - catch (error) { - errorPackages++; - } - } else { - skippedPackages++; - } - } - } - } - } - } - - - function padLeft(value: number, minimumWidth: number, padCharacter: string = " "): string { - let result: string = value.toString(); - while (result.length < minimumWidth) { - result = padCharacter + result; - } - return result; - } - const minimumWidth: number = Math.max(errorPackages, upToDatePackages, packedPackages, skippedPackages).toString().length; - _logger.log(); - _logger.log(`Error packages: ${padLeft(errorPackages, minimumWidth)}`); - _logger.log(`Up to date packages: ${padLeft(upToDatePackages, minimumWidth)}`); - _logger.log(`Packed packages: ${padLeft(packedPackages, minimumWidth)}`); - _logger.log(`Skipped packages: ${padLeft(skippedPackages, minimumWidth)}`); - - if (errorPackages !== 0) { - throw new PluginError("pack", { message: "Some packages failed to pack." }); - } -} - -gulp.task('pack', async () => pack()); - -gulp.task("find-missing-sdks", async () => { - try { - _logger.log(`Passed arguments: ${Argv.print()}`); - const argv: Argv.RepositoryOptions - = Argv.construct(Argv.Options.Repository) - .usage("Example: gulp find-missing-sdks") - .argv as any; - - const azureRestApiSpecsRepositoryPath = argv.azureRestAPISpecsRoot; - _logger.log(`Found azure-rest-api-specs repository in ${azureRestApiSpecsRepositoryPath}`); - - await findMissingSdks(azureRestApiSpecsRepositoryPath); - } catch (error) { - _logger.logError(error); - } -}); - -gulp.task("set-autopublish", async () => { - _logger.log(`Passed arguments: ${Argv.print()}`); - const argv: Argv.RepositoryOptions & Argv.FilterOptions - = Argv.construct(Argv.Options.Repository, Argv.Options.Filter) - .usage("Example: gulp set-autopublish") - .argv as any; - - await setAutoPublish(argv.azureSDKForJSRepoRoot, argv.include, argv.exclude || /@azure\/(keyvault|template|service-bus)/); -}); - -gulp.task("set-version", async () => { - _logger.log(`Passed arguments: ${Argv.print()}`); - const argv: Argv.RepositoryOptions & Argv.FilterOptions - = Argv.construct(Argv.Options.Repository, Argv.Options.Filter) - .usage("Example: gulp set-version") - .argv as any; - - await setVersion(argv.azureSDKForJSRepoRoot, argv.include, argv.exclude || /@azure\/(keyvault|template|service-bus)/); -}); diff --git a/package.json b/package.json deleted file mode 100644 index b7b8033c5d77..000000000000 --- a/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "azure-sdk-for-js", - "author": "Microsoft Corporation", - "version": "0.1.0-preview", - "description": "Microsoft Azure Client Libraries for JavaScript with TypeScript type definitions", - "private": true, - "tags": [ - "node", - "azure", - "sdk", - "typescript", - "browser" - ], - "keywords": [ - "node", - "azure", - "sdk", - "typescript", - "browser" - ], - "license": "MIT", - "homepage": "http://github.com/azure/azure-sdk-for-js", - "repository": { - "type": "git", - "url": "https://github.com/azure/azure-sdk-for-js.git" - }, - "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-js/issues" - }, - "scripts": { - "build": "gulp pack --logging-level=info", - "check:everything": "ts-node ./.scripts/checkEverything.ts", - "latest": "ts-node ./.scripts/latest.ts", - "local": "ts-node ./.scripts/local.ts", - "preinstall": "node common/scripts/rush-welcome.js" - }, - "devDependencies": { - "@octokit/rest": "^16.26.0", - "@ts-common/azure-js-dev-tools": "^0.7.0", - "@types/glob": "^7.1.1", - "@types/gulp": "^4.0.0", - "@types/js-yaml": "^3.11.2", - "@types/minimist": "^1.2.0", - "@types/node": "^12.0.0", - "@types/nodegit": "^0.22.5", - "@types/yargs": "^11.0.0", - "colors": "1.4.0", - "fs": "^0.0.1-security", - "gulp": "^4.0.2", - "js-yaml": "^3.12.0", - "minimist": "^1.2.0", - "npm-run-all": "^4.1.5", - "path": "^0.12.7", - "plugin-error": "^1.0.1", - "prettier": "^2.5.1", - "ts-node": "^7.0.1", - "tslib": "1.11.2", - "typescript": "^3.9.10", - "yargs": "^11.0.0" - }, - "engines": { - "node": ">=10.10.0" - }, - "dependencies": { - "eng-package-utils": "file:eng/tools/eng-package-utils", - "versioning": "file:eng/tools/versioning" - } -} diff --git a/tsconfig.json b/tsconfig.json index 61e7296d9bc0..48d281030e5f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "ES2017", - "module": "commonjs", + "module": "es6", "lib": [], "declaration": true, "declarationMap": true, diff --git a/tsconfig.package.json b/tsconfig.package.json index 3a3efd6ae6ba..1c66acf6d810 100644 --- a/tsconfig.package.json +++ b/tsconfig.package.json @@ -1,6 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "es6" - } + "extends": "./tsconfig" }