Merge pull request #10 from Microsoft/mahilleb/editorconfig

.editorconfig: added
This commit is contained in:
Friedel van Megen 2018-12-20 10:57:26 +01:00 коммит произвёл GitHub
Родитель e9262805ab 661e668ca2
Коммит 3894ca740c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 151 добавлений и 127 удалений

23
.editorconfig Normal file
Просмотреть файл

@ -0,0 +1,23 @@
root = true
[*.{js,ts}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
charset = utf-8
insert_final_newline = true
[*.{cmd,json,md,txt,yml}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
charset = utf-8
insert_final_newline = true
[*.sh]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
charset = utf-8
insert_final_newline = true
end_of_line = lf

1
.gitattributes поставляемый
Просмотреть файл

@ -1,3 +1,4 @@
.editorconfig text
.gitattributes text
.gitignore text
.npmignore text

Просмотреть файл

@ -10,32 +10,32 @@ if "%~1" equ "-h" goto :Usage
set TEST_SETTING_FILE_DIR=%~dp0\secrets
if NOT EXIST "%TEST_SETTING_FILE_DIR%" (
md "%TEST_SETTING_FILE_DIR%" || (
echo Error creating directory %TEST_SETTING_FILE_DIR%
exit /b 1
)
md "%TEST_SETTING_FILE_DIR%" || (
echo Error creating directory %TEST_SETTING_FILE_DIR%
exit /b 1
)
)
set TEST_SETTING_FILE_NAME=%TEST_SETTING_FILE_DIR%\TestConfiguration.ts
if EXIST "%TEST_SETTING_FILE_NAME%" (
echo Clearing values from settings file.
echo. > "%TEST_SETTING_FILE_NAME%" || (
echo Error creating file %TEST_SETTING_FILE_NAME%
exit /b 1
)
echo Clearing values from settings file.
echo. > "%TEST_SETTING_FILE_NAME%" || (
echo Error creating file %TEST_SETTING_FILE_NAME%
exit /b 1
)
)
@echo import { Settings } from "../tests/Settings" > "%TEST_SETTING_FILE_NAME%"
:NextArg
if "%~1" == "" (
goto :eof
goto :eof
)
for /f "tokens=1,2 delims=:" %%I in ("%~1") do (
echo Setting Settings.%%I = "%%J"
echo Settings.%%I = "%%J"; >> "%TEST_SETTING_FILE_NAME%"
echo Setting Settings.%%I = "%%J"
echo Settings.%%I = "%%J"; >> "%TEST_SETTING_FILE_NAME%"
)
shift
@ -46,7 +46,7 @@ exit /b 0
:Usage
@echo off
echo.
echo Usage: %~n0 ^<ParamName^>:^<Value^>
echo Usage: %~n0 ^<ParamName^>:^<Value^>
echo.
echo Writes any ^<ParamName^>:^<Value^> pair to the test settings file for JavaScript bindings tests.
echo.

Просмотреть файл

@ -14,10 +14,10 @@ set TEST_SETTING_FILE_EXISTED=0
if EXIST "%TEST_SETTING_FILE_NAME%" set TEST_SETTING_FILE_EXISTED=1
if "%~1" NEQ "" (
call "%~dp0BuildTestConfig.cmd" %* || (
echo Error creating test config.
exit /b 1
)
call "%~dp0BuildTestConfig.cmd" %* || (
echo Error creating test config.
exit /b 1
)
) else if %TEST_SETTING_FILE_EXISTED% EQU 0 (
echo Warning: No test config and no parameters specified. This will probably fail. 1>&2
)
@ -28,7 +28,7 @@ call npm run test
set NPM_ERROR=%ERRORLEVEL%
if %TEST_SETTING_FILE_EXISTED% EQU 0 (
del "%TEST_SETTING_FILE_NAME%"
del "%TEST_SETTING_FILE_NAME%"
)
popd

Просмотреть файл

@ -4,80 +4,80 @@
//
(function () {
'use strict';
var semver = require("semver");
var exec = require("child_process").exec;
'use strict';
var semver = require("semver");
var exec = require("child_process").exec;
if (!process.env.npm_package_version) {
throw "npm_package_version not set; run this via 'npm run'"
}
var givenVersion = process.env.npm_package_version;
if (!semver.valid(givenVersion)) {
throw "Invalid version " + givenVersion;
}
var baseVersion = semver.major(givenVersion) + "." + semver.minor(givenVersion) + "." + semver.patch(givenVersion);
var prerelease = semver.prerelease(givenVersion) || []
var buildId = process.env.BUILD_BUILDID || "1"
var buildType = "dev"
var inAzureDevOps = false
if (process.env.SYSTEM_COLLECTIONID === "19422243-19b9-4d85-9ca6-bc961861d287" &&
process.env.SYSTEM_DEFINITIONID === "7863") {
inAzureDevOps = true
if (process.env.BUILD_SOURCEBRANCH.match("^refs/heads/release/")) {
buildType = "prod"
} else if (process.env.BUILD_SOURCEBRANCH === "refs/heads/master" &&
(process.env.BUILD_REASON === "Schedule" ||
process.env.BUILD_REASON === "Manual")) {
buildType = "int"
if (!process.env.npm_package_version) {
throw "npm_package_version not set; run this via 'npm run'"
}
}
// Check our version constraints
if (buildType === "prod") {
// Full version give in package.json
if (prerelease.length != 0 &&
(prerelease.length != 2 ||
!prerelease[0].match("^(?:alpha|beta|rc)$") ||
prerelease[1] < 1)) {
throw "For prod build types, version must have no pre-release tag, or alpha / beta / rc with a positive number."
var givenVersion = process.env.npm_package_version;
if (!semver.valid(givenVersion)) {
throw "Invalid version " + givenVersion;
}
} else if (prerelease.length != 3 ||
(prerelease[0] !== "alpha" || prerelease[1] !== 0 || prerelease[2] !== 1)) {
throw "For non-prod build types, checked-in version must end in -alpha.0.1"
}
var versionToUse
var baseVersion = semver.major(givenVersion) + "." + semver.minor(givenVersion) + "." + semver.patch(givenVersion);
var prerelease = semver.prerelease(givenVersion) || []
if (buildType === "dev") {
versionToUse = baseVersion + "-alpha.0." + buildId
} else if (buildType === "int") {
versionToUse = baseVersion + "-beta.0." + buildId
} else if (buildType === "prod") {
versionToUse = givenVersion
} else {
throw "Internal error. Unexpected build type: " + buildType
}
var buildId = process.env.BUILD_BUILDID || "1"
if (inAzureDevOps) {
console.log("##vso[task.setvariable variable=SPEECHSDK_SEMVER2NOMETA]" + versionToUse);
}
var buildType = "dev"
var inAzureDevOps = false
if (givenVersion !== versionToUse) {
console.log("Setting version to " + versionToUse);
exec("npm version --no-git-tag-version " + versionToUse, { cwd: __dirname + "/.." },
function (error) {
if (error) {
throw error;
if (process.env.SYSTEM_COLLECTIONID === "19422243-19b9-4d85-9ca6-bc961861d287" &&
process.env.SYSTEM_DEFINITIONID === "7863") {
inAzureDevOps = true
if (process.env.BUILD_SOURCEBRANCH.match("^refs/heads/release/")) {
buildType = "prod"
} else if (process.env.BUILD_SOURCEBRANCH === "refs/heads/master" &&
(process.env.BUILD_REASON === "Schedule" ||
process.env.BUILD_REASON === "Manual")) {
buildType = "int"
}
}
);
}
}
// Check our version constraints
if (buildType === "prod") {
// Full version give in package.json
if (prerelease.length != 0 &&
(prerelease.length != 2 ||
!prerelease[0].match("^(?:alpha|beta|rc)$") ||
prerelease[1] < 1)) {
throw "For prod build types, version must have no pre-release tag, or alpha / beta / rc with a positive number."
}
} else if (prerelease.length != 3 ||
(prerelease[0] !== "alpha" || prerelease[1] !== 0 || prerelease[2] !== 1)) {
throw "For non-prod build types, checked-in version must end in -alpha.0.1"
}
var versionToUse
if (buildType === "dev") {
versionToUse = baseVersion + "-alpha.0." + buildId
} else if (buildType === "int") {
versionToUse = baseVersion + "-beta.0." + buildId
} else if (buildType === "prod") {
versionToUse = givenVersion
} else {
throw "Internal error. Unexpected build type: " + buildType
}
if (inAzureDevOps) {
console.log("##vso[task.setvariable variable=SPEECHSDK_SEMVER2NOMETA]" + versionToUse);
}
if (givenVersion !== versionToUse) {
console.log("Setting version to " + versionToUse);
exec("npm version --no-git-tag-version " + versionToUse, { cwd: __dirname + "/.." },
function (error) {
if (error) {
throw error;
}
}
);
}
}());

Просмотреть файл

@ -1,35 +1,35 @@
{
"templates": {
"applicationName": "Microsoft Cognitive Services Speech SDK",
"disqus": "",
"googleAnalytics": "",
"openGraph": {
"title": "",
"type": "website",
"image": "",
"site_name": "",
"url": ""
}
},
"meta": {
"title": "Microsoft Cognitive Services Speech SDK",
"description": "Microsoft Cognitive Services Speech SDK",
"keyword": ""
},
"linenums": true,
"source": {
"include": [
"./distrib/src/sdk"
],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"opts": {
"encoding": "utf8",
"recurse": true,
"private": false,
"lenient": true,
"destination": "./outjs",
"template": "templates/default"
"templates": {
"applicationName": "Microsoft Cognitive Services Speech SDK",
"disqus": "",
"googleAnalytics": "",
"openGraph": {
"title": "",
"type": "website",
"image": "",
"site_name": "",
"url": ""
}
},
"meta": {
"title": "Microsoft Cognitive Services Speech SDK",
"description": "Microsoft Cognitive Services Speech SDK",
"keyword": ""
},
"linenums": true,
"source": {
"include": [
"./distrib/src/sdk"
],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"opts": {
"encoding": "utf8",
"recurse": true,
"private": false,
"lenient": true,
"destination": "./outjs",
"template": "templates/default"
}
}

Просмотреть файл

@ -1,11 +1,11 @@
{
"compilerOptions": {
"module": "commonjs",
"preserveConstEnums": true,
"sourceMap": true,
"target": "ES5",
"declaration": true,
"noImplicitAny": true,
"removeComments": false
"module": "commonjs",
"preserveConstEnums": true,
"sourceMap": true,
"target": "ES5",
"declaration": true,
"noImplicitAny": true,
"removeComments": false
}
}
}

Просмотреть файл

@ -48,4 +48,4 @@
"secrets/*.ts"
]
}
}
}