Skip to content

Commit

Permalink
.editorconfig: added
Browse files Browse the repository at this point in the history
  • Loading branch information
mahilleb-msft committed Dec 19, 2018
1 parent 4a9ce80 commit 661e668
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 120 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.editorconfig text
.gitattributes text
.gitignore text
.npmignore text
Expand Down
28 changes: 14 additions & 14 deletions BuildTestConfig.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions RunTests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
Expand Down
120 changes: 60 additions & 60 deletions ci/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
}
if (!process.env.npm_package_version) {
throw "npm_package_version not set; run this via 'npm run'"
}

var givenVersion = process.env.npm_package_version;
var givenVersion = process.env.npm_package_version;

if (!semver.valid(givenVersion)) {
throw "Invalid version " + givenVersion;
}
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 baseVersion = semver.major(givenVersion) + "." + semver.minor(givenVersion) + "." + semver.patch(givenVersion);
var prerelease = semver.prerelease(givenVersion) || []

var buildId = process.env.BUILD_BUILDID || "1"
var buildId = process.env.BUILD_BUILDID || "1"

var buildType = "dev"
var inAzureDevOps = false
var buildType = "dev"
var inAzureDevOps = false

if (process.env.SYSTEM_COLLECTIONID === "19422243-19b9-4d85-9ca6-bc961861d287" &&
process.env.SYSTEM_DEFINITIONID === "7863") {
if (process.env.SYSTEM_COLLECTIONID === "19422243-19b9-4d85-9ca6-bc961861d287" &&
process.env.SYSTEM_DEFINITIONID === "7863") {

inAzureDevOps = true
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.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."
// 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"
}
} 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 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 (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 (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;
}
}
);
}
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;
}
}
);
}
}());
64 changes: 32 additions & 32 deletions jsdoc-conf.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
16 changes: 8 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
2 changes: 1 addition & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
"secrets/*.ts"
]
}
}
}

0 comments on commit 661e668

Please sign in to comment.