Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.option("force", {
describe: "force the re-installation of the **autorest-core** extension and frameworks",
type: "boolean",
group: "### Installation",
})
.option("version", {
describe: "use the specified version of the **autorest-core** extension",
type: "string",
group: "### Installation",
})
.argv;
const preview: boolean = args.preview;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;
console.trace(`Autorest Home folder: ${process.env["autorest.home"]}`);
const rootFolder: string = join(home, ".autorest");
const dotnetFolder: string = join(home, ".dotnet");
const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const maxPkgVersion = `${semver.major(basePkgVersion) + 1}.0.0`
const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const versionRange = preview ? `>=${basePkgVersion}-any <${maxPkgVersion}` : `>=${basePkgVersion} <${maxPkgVersion}`; // the version range of the core package required.
const extensionManager: Promise = ExtensionManager.Create(rootFolder);
let currentVersion: Extension = null;
const frameworkVersion: string = null;
let requestedVersion: string = args.version || (args.latest && "latest") || "latest-installed";
const showInfo: boolean = args.autorest["show-info"] || false;
const listAvailable: boolean = args.autorest["list-available"] || false;
group: "### Installation",
})
.option("force", {
describe: "force the re-installation of the **autorest-core** extension and frameworks",
type: "boolean",
group: "### Installation",
})
.option("version", {
describe: "use the specified version of the **autorest-core** extension",
type: "string",
group: "### Installation",
})
.argv;
const preview: boolean = args.preview;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;
console.trace(`Autorest Home folder: ${process.env["autorest.home"]}`);
const rootFolder: string = join(home, ".autorest");
const dotnetFolder: string = join(home, ".dotnet");
const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const maxPkgVersion = `${semver.major(basePkgVersion) + 1}.0.0`
const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const versionRange = preview ? `>=${basePkgVersion}-any <${maxPkgVersion}` : `>=${basePkgVersion} <${maxPkgVersion}`; // the version range of the core package required.
const extensionManager: Promise = ExtensionManager.Create(rootFolder);
let currentVersion: Extension = null;
const frameworkVersion: string = null;
let requestedVersion: string = args.version || (args.latest && "latest") || "latest-installed";
async function build() {
// use local version of autorest extensions instead of global machine versions
await autorest.initialize("./node_modules/@microsoft.azure/autorest-core");
const autorestInstance = await autorest.create();
autorestInstance.AddConfiguration({
"nodejs": {
"package-name": "vscode-azurekudu",
"license-header": "MICROSOFT_MIT_NO_VERSION",
"add-credentials": "true",
},
"title": "KuduClient",
"input-file": path.join(__dirname, 'swagger.json')
});
autorestInstance.Message.Subscribe((_, msg) => {
if (msg.Channel !== 'file' && msg.Text) {
console.log(msg.FormattedMessage || msg.Text);
}
});
autorestInstance.GeneratedFile.Subscribe((_, file) => {
if (file.uri.includes('lib')) {
async function build() {
// use local version of autorest extensions instead of global machine versions
await autorest.initialize("./node_modules/@microsoft.azure/autorest-core");
const autorestInstance = await autorest.create();
autorestInstance.AddConfiguration({
"nodejs": {
"package-name": "vscode-azurekudu",
"license-header": "MICROSOFT_MIT_NO_VERSION",
"add-credentials": "true",
},
"title": "KuduClient",
"input-file": path.join(__dirname, 'swagger.json')
});
autorestInstance.Message.Subscribe((_, msg) => {
if (msg.Channel !== 'file' && msg.Text) {
console.log(msg.FormattedMessage || msg.Text);
}
});
import { lookup } from "dns";
import { Extension, ExtensionManager } from "@microsoft.azure/extension";
import { homedir } from "os";
import { dirname, join, resolve } from "path";
import { Enumerable as IEnumerable, From } from "linq-es2015";
import { Exception, LazyPromise } from "@microsoft.azure/polyfill";
import * as semver from "semver";
import { isFile, mkdir, isDirectory } from "@microsoft.azure/async-io";
export const pkgVersion: string = require(`${__dirname}/../package.json`).version;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;
export const rootFolder: string = join(home, ".autorest");
export const extensionManager: Promise = ExtensionManager.Create(rootFolder);
export const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const versionRange = `^${basePkgVersion}`; // the version range of the core package required.
export const networkEnabled: Promise = new Promise((r, j) => {
lookup("8.8.8.8", 4, (err, address, family) => {
r(err ? false : true);
});
});
export async function availableVersions() {
if (await networkEnabled) {
public constructor(private fileSystem: IFileSystem = new RealFileSystem(), public configFileOrFolderUri?: string) {
super();
// ensure the environment variable for the home folder is set.
process.env['autorest.home'] = process.env['autorest.home'] || homedir();
}
import { lookup } from "dns";
import { Extension, ExtensionManager } from "@microsoft.azure/extension";
import { homedir } from "os";
import { dirname, join, resolve } from "path";
import { Enumerable as IEnumerable, From } from "linq-es2015";
import { Exception, LazyPromise } from "@microsoft.azure/polyfill";
import * as semver from "semver";
import { isFile, mkdir, isDirectory } from "@microsoft.azure/async-io";
export const pkgVersion: string = require(`${__dirname}/../package.json`).version;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;
export const rootFolder: string = join(home, ".autorest");
export const extensionManager: Promise = ExtensionManager.Create(rootFolder);
export const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const versionRange = `^${basePkgVersion}`; // the version range of the core package required.
export const networkEnabled: Promise = new Promise((r, j) => {
lookup("8.8.8.8", 4, (err, address, family) => {
r(err ? false : true);
});
});
export async function availableVersions() {
public async Activate(): Promise {
// tell autorest that it's view needs to be re-created.
this.Manager.verbose(`Invalidating Autorest view.`);
this.autorest.Invalidate();
// if there is a process() running, kill it.
this.cancel();
// reaquire the config file.
this.autorest.configFileUri = await AutoRest.DetectConfigurationFile(this, this.RootUri);
// if autorest is about to restart the work, stop that
// so we can push it out a bit more.
if (this._readyToRun) {
clearTimeout(this._readyToRun);
this._readyToRun = null;
}
return await this.RunAutoRest();
}
public get autorest(): AutoRest {
if (!this._autoRest) {
this._autoRest = new AutoRest(this, this.configurationFile);
this._autoRest.AddConfiguration({ "output-artifact": ["swagger-document", "swagger-document.map"] });
this.Manager.listenForResults(this._autoRest);
this.autorest.GeneratedFile.Subscribe((instance, artifact) => {
this._outputs.set(artifact.uri, artifact.content);
})
this._autoRest.Finished.Subscribe((autorest, success) => {
this.cancel = () => true;
if (success) {
this.FlushDiagnostics(true);
this.ClearDiagnostics();
}
this.Manager.verbose(`AutoRest Process Finished with '${success}'.`);
})
}
yield* From(items).Where(each => AutoRest.IsConfigurationExtension(GetExtension(each))).Select(each => ResolveUri(folderUri, each));
}