-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of kudu and appservice packages
These primarily just support start/stop and v1 of zip deploy
- Loading branch information
Showing
25 changed files
with
8,021 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 |
---|---|---|
|
@@ -286,3 +286,8 @@ __pycache__/ | |
*.btm.cs | ||
*.odx.cs | ||
*.xsd.cs | ||
|
||
node_modules | ||
lib | ||
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- 'stable' | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- libunwind8 | ||
|
||
env: | ||
- PACKAGE_DIR=appservice | ||
- PACKAGE_DIR=kudu | ||
|
||
script: | ||
- cd $PACKAGE_DIR | ||
- npm install | ||
- npm run build | ||
- npm run lint | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: always |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
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
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,6 @@ | ||
node_modules/ | ||
.vscode/ | ||
src/ | ||
tsconfig.json | ||
tslint.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"taskName": "npm", | ||
"type": "shell", | ||
"command": "npm", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"args": [ | ||
"run", | ||
"compile", | ||
"--loglevel", | ||
"silent" | ||
], | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "silent" | ||
}, | ||
"problemMatcher": "$tsc-watch" | ||
}, | ||
{ | ||
"type": "npm", | ||
"script": "lint", | ||
"problemMatcher": { | ||
"base": "$tslint5", | ||
"fileLocation": "absolute" | ||
} | ||
} | ||
] | ||
} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
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,4 @@ | ||
# VSCode Azure SDK for Node.js - App Service Tools | ||
|
||
## License | ||
[MIT](LICENSE.md) |
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,48 @@ | ||
{ | ||
"name": "vscode-azureappservice", | ||
"author": "Microsoft Corporation", | ||
"version": "0.1.0", | ||
"description": "Common tools for developing Azure App Service extensions for VS Code", | ||
"tags": [ | ||
"azure", | ||
"vscode" | ||
], | ||
"keywords": [ | ||
"azure", | ||
"vscode" | ||
], | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Microsoft/vscode-azuretools" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Microsoft/vscode-azuretools/issues" | ||
}, | ||
"homepage": "https://github.com/Microsoft/vscode-azuretools/blob/master/appservice/README.md", | ||
"scripts": { | ||
"build": "tsc -p ./", | ||
"compile": "tsc -watch -p ./", | ||
"lint": "tslint --project tsconfig.json -e src/*.d.ts --type-check -t verbose", | ||
"prepare": "node ./node_modules/vscode/bin/install" | ||
}, | ||
"dependencies": { | ||
"archiver": "^2.0.3", | ||
"azure-arm-website": "^1.0.0-preview", | ||
"vscode-azurekudu": "0.1.0", | ||
"ms-rest": "^2.2.2", | ||
"ms-rest-azure": "^2.4.0" | ||
}, | ||
"devDependencies": { | ||
"@types/archiver": "^2.0.0", | ||
"typescript": "^2.5.3", | ||
"tslint": "^5.7.0", | ||
"tslint-microsoft-contrib": "5.0.1", | ||
"vscode": "^1.1.5" | ||
}, | ||
"engines": { | ||
"vscode": "^1.16.0" | ||
} | ||
} |
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,68 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as archiver from 'archiver'; | ||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
|
||
export function getFileExtension(fsPath: string): string | undefined { | ||
return fsPath.split('.').pop(); | ||
} | ||
|
||
export async function isDirectory(fsPath: string): Promise<boolean> { | ||
const fsStats: fs.Stats = await new Promise((resolve: (s?: fs.Stats) => void, reject: (e: Error) => void): void => { | ||
fs.lstat(fsPath, (err?: Error, stats?: fs.Stats) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(stats); | ||
} | ||
}); | ||
}); | ||
|
||
return fsStats.isDirectory(); | ||
} | ||
|
||
export async function deleteFile(fsPath: string): Promise<void> { | ||
await new Promise((resolve: () => void, reject: (err: Error) => void): void => { | ||
fs.unlink(fsPath, (err?: Error) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
export async function zipDirectory(folderPath: string): Promise<string> { | ||
if (!folderPath.endsWith(path.sep)) { | ||
folderPath += path.sep; | ||
} | ||
|
||
const zipFilePath: string = path.join(os.tmpdir(), `${randomFileName()}.zip`); | ||
await new Promise((resolve: () => void, reject: (err: Error) => void): void => { | ||
const zipOutput: fs.WriteStream = fs.createWriteStream(zipFilePath); | ||
zipOutput.on('close', resolve); | ||
|
||
const zipper: archiver.Archiver = archiver('zip', { zlib: { level: 9 } }); | ||
zipper.on('error', reject); | ||
zipper.pipe(zipOutput); | ||
zipper.glob('**/*', { | ||
cwd: folderPath, | ||
dot: true, | ||
ignore: 'node_modules{,/**}' | ||
}); | ||
void zipper.finalize(); | ||
}); | ||
|
||
return zipFilePath; | ||
} | ||
|
||
export function randomFileName(): string { | ||
// tslint:disable-next-line:insecure-random | ||
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10); | ||
} |
Oops, something went wrong.