-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.history | ||
dist | ||
node_modules | ||
package-lock.json | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
# autorest.config | ||
# configuration | ||
|
||
See documentation [here](doc/00-onboarding-guide.md) | ||
|
||
``` yaml | ||
|
||
pipeline-model: v3 | ||
|
||
pipeline: | ||
configPlugin/generate: | ||
input: | ||
- openapi-document/multi-api/identity | ||
output-artifact: config-extension | ||
configPlugin/emitter: | ||
input: | ||
- configPlugin/generate | ||
scope: scope-config-plugin | ||
|
||
scope-config-plugin: | ||
is-object: false | ||
output-artifact: | ||
- config-extension | ||
output-folder: $(config-output-folder) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "@qiaozha/autorest.config", | ||
"version": "0.1.0", | ||
"description": "Autorest Azure AZ extension", | ||
"main": "dist/index.js", | ||
"engines": { | ||
"node": ">=10.12.0" | ||
}, | ||
"scripts": { | ||
"start": "node dist/index.js", | ||
"debug": "node --max_old_space_size=4096 --inspect-brk ./dist/index.js", | ||
"eslint-fix": "eslint . --fix --ext .ts", | ||
"eslint": "eslint . --ext .ts", | ||
"build": "tsc -p .", | ||
"start-testserver": "./node_modules/.bin/start-autorest-testserver", | ||
"stop-testserver": "./node_modules/.bin/stop-autorest-testserver", | ||
"watch": "tsc -p . --watch", | ||
"prepare": "npm run build", | ||
"test": "npm run build && mocha dist/test", | ||
"clean": "ver > nul 2>&1 nul && npm run --silent clean-cmd || npm run --silent clean-bash", | ||
"clean-cmd": "if exist dist rmdir /s /q dist && exit 0 || exit 0 ", | ||
"clean-bash": "rm nul && rm -rf dist && exit 0 || exit 0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Azure/autorest.config.git" | ||
}, | ||
"keywords": [ | ||
"autorest", | ||
"extension" | ||
], | ||
"author": "Microsoft Corporation", | ||
"license": "MIT", | ||
"devDependencies": {}, | ||
"dependencies": { | ||
"@azure-tools/autorest-extension-base": "~3.1.235", | ||
"@azure-tools/codemodel": "^4.13.348", | ||
"@types/node": "^14.14.8" | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { CodeModel, codeModelSchema, Language, Parameter } from "@azure-tools/codemodel"; | ||
import { Session, startSession, Host, Channel } from "@azure-tools/autorest-extension-base"; | ||
|
||
|
||
export async function processRequest(host: Host) { | ||
try { | ||
const session = await startSession<CodeModel>(host, {}, codeModelSchema); | ||
let config = await session.getValue(""); | ||
host.WriteFile('autorest_configuration.json', JSON.stringify(config)); | ||
} catch (E) { | ||
throw E; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { AutoRestExtension, Channel, Host } from "@azure-tools/autorest-extension-base"; | ||
import { processRequest as config } from './config' | ||
|
||
|
||
export type LogCallback = (message: string) => void; | ||
export type FileCallback = (path: string, rows: string[]) => void; | ||
|
||
export async function initializePlugins(pluginHost: AutoRestExtension) { | ||
pluginHost.Add('generate', config); | ||
} | ||
|
||
export async function configPlugin() { | ||
const extension = new AutoRestExtension(); | ||
await initializePlugins(extension); | ||
extension.Run(); | ||
} | ||
|
||
configPlugin(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": [ | ||
"es2016", | ||
"dom" | ||
], | ||
"outDir": "dist", | ||
"module": "commonjs", | ||
"sourceMap": true, | ||
"types": [ | ||
"node" | ||
], | ||
"target": "es2016", | ||
"experimentalDecorators": true | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |