Skip to content

Commit

Permalink
Merge some squashed changes from master
Browse files Browse the repository at this point in the history
Related: #7, #8, #10, #11, #13, #14, #18, #22, #23, #24, #25, #26, #27
  • Loading branch information
mahilleb-msft committed Jan 16, 2019
1 parent 94d2a31 commit 57cbb6d
Show file tree
Hide file tree
Showing 41 changed files with 3,382 additions and 3,323 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
32 changes: 32 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runInBand", "--coverage", "false"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runInBand", "--coverage", "false", "${relativeFile}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
]
}
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
76 changes: 36 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,61 @@
# Microsoft Cognitive Services Speech SDK for JavaScript
[![npm version](https://badge.fury.io/js/microsoft-cognitiveservices-speech-sdk.svg)](https://badge.fury.io/js/microsoft-cognitiveservices-speech-sdk)
[![Downloads](https://img.shields.io/npm/dm/microsoft-cognitiveservices-speech-sdk.svg)](https://www.npmjs.com/package/microsoft-cognitiveservices-speech-sdk)

Visit https://aka.ms/csspeech.
# Microsoft Cognitive Services Speech SDK for JavaScript

## Build the project
The Microsoft Cognitive Services Speech SDK for JavaScript is the JavaScript version of the Microsoft Cognitive Services Speech SDK. An in-depth description of feature set, functionality, supported platforms, as well as installation options is available [here](https://aka.ms/csspeech).

To build the project you need to install the required packages, and then run the actual build.
The JavaScript versions of the Cognitive Services Speech SDK supports browser scenarios as well as the Node.js environment.

### Install the required packages
## Installing

Installation of the required packages is required once in your enlistment. Our automated build restores the packages with the following command:
For the latest stable version:

```
npm ci
```bash
npm install microsoft-cognitiveservices-speech-sdk
```

This will install packages exactly matching the package configuration from `package-lock.json`.
## Documentation

In a development environment you can also use the following command:
* [Quick tutorial - Node.js](https://docs.microsoft.com/azure/cognitive-services/speech-service/quickstart-js-node)
* [Quick tutorial - Browser](https://docs.microsoft.com/azure/cognitive-services/speech-service/quickstart-js-browser)
* [API Reference](https://aka.ms/csspeech/javascriptref)
* [Samples](https://aka.ms/csspeech/samples)
* [Speech SDK Homepage](https://aka.ms/csspeech)

```
npm install
```
## Building

This source code for the Cognitive Services Speeck SDK (JavaScript) is available in a public [GitHub repository](https://github.com/Microsoft/cognitive-services-speech-sdk-js). You are not required to go through the build process. We create prebuilt packages tuned for your use-cases. These are updated in regular intervals.

### Run the build
In order to build the Speech SDK, ensure that you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed.

Once the dependencies are installed run the build by
Clone the repository:

```bash
git clone https://github.com/Microsoft/cognitive-services-speech-sdk-js
```
npm run build

Change to the Speech SDK directory:

```bash
cd cognitive-services-speech-sdk-js
```

or
Install the required packages:

```
npx gulp bundle
npm install
```

or
Run the build:

```
npx gulp compress
npm run build
```

> Note: `npx` is packaged with NPM 5.2 or above. Update NPM / Node if you
> don't have it or install it globally with `npm install -g npx` (less
> preferable).
## Data / Telemetry

This project collects data and sends it to Microsoft to help monitor our
service performance and improve our products and services. Read the [Microsoft
This project collects data and sends it to Microsoft to help monitor our service performance and improve our products and services. Read the [Microsoft
Privacy Statement](https://aka.ms/csspeech/privacy) to learn more.

To disable telemetry, you can call the following API:
Expand All @@ -59,26 +65,16 @@ To disable telemetry, you can call the following API:
sdk.Recognizer.enableTelemetry(false);
```

This is a global setting and will disable telemetry for all recognizers
(already created or new recognizers).
This is a global setting and will disable telemetry for all recognizers (already created or new recognizers).

We strongly recommend you keep telemetry enabled. With telemetry enabled you
transmit information about your platform (operating system and possibly, Speech
Service relevant information like microphone characteristics, etc.), and
information about the performance of the Speech Service (the time when you did
send data and when you received data). It can be used to tune the service,
monitor service performance and stability, and might help us to analyze
reported problems. Without telemetry enabled, it is not possible for us to do any
form of detailed analysis in case of a support request.
We strongly recommend you keep telemetry enabled. With telemetry enabled you transmit information about your platform (operating system and possibly, Speech Service relevant information like microphone characteristics, etc.), and information about the performance of the Speech Service (the time when you did send data and when you received data). It can be used to tune the service, monitor service performance and stability, and might help us to analyze reported problems. Without telemetry enabled, it is not possible for us to do any form of detailed analysis in case of a support request.

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
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
81 changes: 69 additions & 12 deletions ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,77 @@ resources:
- repo: self
clean: true

variables:
SPEECHSDK_JS_ROOT: .

jobs:

- job: Pre
- job: Build
pool:
name: Hosted Ubuntu 1604
timeoutInMinutes: 30
name: Hosted VS2017
demands: npm
timeoutInMinutes: 60
variables:
ArtifactOut: $(Build.ArtifactStagingDirectory)/Out/JavaScript
SPEECHSDK_RUN_TESTS: true
steps:
- bash: ./ci/check-git-head.sh
displayName: Repository checks

- template: jsbuild.yml
parameters:
dependsOn: Pre
condition: true
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: Component Detection
condition: >
and(eq(variables['System.CollectionId'], '19422243-19b9-4d85-9ca6-bc961861d287'),
eq(variables['System.DefinitionId'], '7863'),
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.Reason'], 'Manual')))
- bash: npm ci && npm run civersion
displayName: Install packages and set version / SPEECHSDK_SEMVER2NOMETA
- bash: |
F=src/common.speech/RecognizerConfig.ts
[[ -f $F ]] || exit 1
perl -i.bak -p -e 'BEGIN { $c = 0 } $c += s/(?<=const SPEECHSDK_CLIENTSDK_VERSION = ")[^"]*/$(SPEECHSDK_SEMVER2NOMETA)/g; END { die "Patched SPEECHSDK_CLIENTSDK_VERSION $c time(s), expected 1.\n" if $c != 1 }' "$F"
E=$?
rm -f "$F.bak"
git diff
exit $E
displayName: Stamp SPEECHSDK_CLIENTSDK_VERSION
- bash: npm pack
displayName: Build and pack SDK
- bash: "echo '##vso[task.setvariable variable=SPEECHSDK_RUN_TESTS]false'"
condition: or(failed(), canceled())
displayName: Skip tests on build failure
- script: |
RunTests.cmd ^
SpeechSubscriptionKey:$(speech-ne-s0-key1) ^
SpeechRegion:northeurope ^
LuisSubscriptionKey:$(luis-westus-s0-201809-key1) ^
LuisRegion:westus ^
SpeechTestEndpointId:ec3432b2-8584-4736-865a-556213b9f6fd
displayName: Run tests
condition: eq(variables['SPEECHSDK_RUN_TESTS'], 'true')
- task: PublishTestResults@2
displayName: Publish test results
condition: eq(variables['SPEECHSDK_RUN_TESTS'], 'true')
- bash: |
set -u -e -o pipefail -x
PACKAGE_BASE=microsoft-cognitiveservices-speech-sdk
PACKAGE_NAME=$PACKAGE_BASE-$SPEECHSDK_SEMVER2NOMETA.tgz
PACKAGE_IN=$PACKAGE_NAME
PACKAGE_OUT="/npm"
ZIP_OUT="$(ArtifactOut)/SpeechSDK-JavaScript-$SPEECHSDK_SEMVER2NOMETA"
mkdir -p "$PACKAGE_OUT" "$ZIP_OUT"
cp --preserve "$PACKAGE_IN" "$PACKAGE_OUT"
echo SRI hash for microsoft.cognitiveservices.speech.sdk.bundle.js: sha512-"$(openssl dgst -sha512 -binary distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle.js | openssl base64 -A)"
cp --preserve LICENSE REDIST.txt distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle.* distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle-min.* "$ZIP_OUT"
displayName: Create drop
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(ArtifactOut)/SpeechSDK-JavaScript-$(SPEECHSDK_SEMVER2NOMETA)
includeRootFolder: true
archiveType: zip
archiveFile: $(ArtifactOut)/SpeechSDK-JavaScript-$(SPEECHSDK_SEMVER2NOMETA).zip
displayName: Create .zip
- bash: rm -rf "$(ArtifactOut)/SpeechSDK-JavaScript-$(SPEECHSDK_SEMVER2NOMETA)"
displayName: Remove temporary directory
- task: PublishBuildArtifacts@1
displayName: Publish drop
inputs:
PathtoPublish: $(ArtifactOut)
ArtifactName: JavaScript
publishLocation: Container
Loading

0 comments on commit 57cbb6d

Please sign in to comment.