Add TypeScript CI
This commit is contained in:
parent
bf31b2e351
commit
3581bdf9fe
@ -1,26 +1,37 @@
|
||||
NODE_BUILD_TOOL ?= node-pre-gyp
|
||||
NODE_ABI_TARGET ?=
|
||||
NODE_BUILD_VERBOSE ?= --verbose
|
||||
NPM_TOOL ?= npm
|
||||
PROJECT_NAME ?= deepspeech
|
||||
PROJECT_VERSION ?= $(shell cat ../../VERSION | tr -d '\n')
|
||||
NPM_ROOT ?= $(shell npm root)
|
||||
|
||||
NODE_MODULES_BIN ?= $(NPM_ROOT)/.bin/
|
||||
ifeq ($(findstring _NT,$(OS)),_NT)
|
||||
# On Windows, we seem to need both in PATH for node-pre-gyp as well as tsc
|
||||
# they do not get installed the same way.
|
||||
NODE_MODULES_BIN := $(shell cygpath -u $(NPM_ROOT)/.bin/):$(shell cygpath -u `dirname "$(NPM_ROOT)"`)
|
||||
endif
|
||||
|
||||
include ../definitions.mk
|
||||
|
||||
ifeq ($(TARGET),host-win)
|
||||
ifeq ($(findstring _NT,$(OS)),_NT)
|
||||
LIBS := '$(shell cygpath -w $(subst .lib,,$(LIBS)))'
|
||||
endif
|
||||
|
||||
.PHONY: npm-dev
|
||||
|
||||
default: build
|
||||
|
||||
clean:
|
||||
rm -f deepspeech_wrap.cxx package.json
|
||||
rm -f deepspeech_wrap.cxx package.json package-lock.json
|
||||
rm -rf ./build/
|
||||
|
||||
clean-npm-pack:
|
||||
rm -fr ./node_modules/
|
||||
rm -fr ./deepspeech-*.tgz
|
||||
|
||||
really-clean: clean clean-npm-pack
|
||||
rm -fr ./node_modules/
|
||||
rm -fr ./lib/
|
||||
|
||||
package.json: package.json.in
|
||||
@ -29,22 +40,27 @@ package.json: package.json.in
|
||||
-e 's/$$(PROJECT_VERSION)/$(PROJECT_VERSION)/' \
|
||||
package.json.in > package.json && cat package.json
|
||||
|
||||
configure: deepspeech_wrap.cxx package.json
|
||||
$(NODE_BUILD_TOOL) configure $(NODE_BUILD_VERBOSE)
|
||||
npm-dev: package.json
|
||||
ifeq ($(findstring _NT,$(OS)),_NT)
|
||||
# node-gyp@5.x behaves erratically with VS2015 and MSBuild.exe detection
|
||||
$(NPM_TOOL) install node-gyp@4.x
|
||||
endif
|
||||
$(NPM_TOOL) install --prefix=$(NPM_ROOT)/../ --ignore-scripts --force --verbose --production=false .
|
||||
|
||||
configure: deepspeech_wrap.cxx package.json npm-dev
|
||||
PATH="$(NODE_MODULES_BIN):${PATH}" $(NODE_BUILD_TOOL) configure $(NODE_BUILD_VERBOSE)
|
||||
|
||||
build: configure deepspeech_wrap.cxx
|
||||
AS=$(AS) CC=$(CC) CXX=$(CXX) LD=$(LD) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(RPATH_NODEJS) $(LDFLAGS)" LIBS=$(LIBS) $(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) rebuild $(NODE_BUILD_VERBOSE)
|
||||
PATH="$(NODE_MODULES_BIN):${PATH}" AS=$(AS) CC=$(CC) CXX=$(CXX) LD=$(LD) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(RPATH_NODEJS) $(LDFLAGS)" LIBS=$(LIBS) $(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) --no-color rebuild $(NODE_BUILD_VERBOSE)
|
||||
|
||||
copy-deps: build
|
||||
$(call copy_missing_libs,lib/binding/*/*/*/deepspeech.node,lib/binding/*/*/)
|
||||
|
||||
node-wrapper: copy-deps build
|
||||
$(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) package $(NODE_BUILD_VERBOSE)
|
||||
PATH="$(NODE_MODULES_BIN):${PATH}" $(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) --no-color package $(NODE_BUILD_VERBOSE)
|
||||
|
||||
npm-pack: clean package.json index.js
|
||||
npm install --prefix=${NPM_ROOT} node-pre-gyp@0.14.x typescript@3.6.2 @types/argparse@1.0.38
|
||||
${NPM_ROOT}/.bin/tsc --outDir dist/ client.ts || true
|
||||
npm pack $(NODE_BUILD_VERBOSE)
|
||||
npm-pack: clean package.json index.js npm-dev
|
||||
PATH="$(NODE_MODULES_BIN):${PATH}" tsc && $(NPM_TOOL) pack $(NODE_BUILD_VERBOSE)
|
||||
|
||||
deepspeech_wrap.cxx: deepspeech.i
|
||||
swig -version
|
||||
|
@ -39,7 +39,11 @@
|
||||
"node-wav": "0.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^1.7.9"
|
||||
"electron": "^1.7.9",
|
||||
"node-gyp": "4.x - 5.x",
|
||||
"typescript": "3.6.x",
|
||||
"@types/argparse": "1.0.x",
|
||||
"@types/node": "13.9.x"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node index.js"
|
||||
|
@ -9,7 +9,6 @@
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
|
@ -105,16 +105,10 @@ do_deepspeech_nodejs_build()
|
||||
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
|
||||
# Windows
|
||||
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
|
||||
NPM_ROOT=$(cygpath -u "$(npm root)")
|
||||
PYTHON27=":/c/Python27"
|
||||
# node-gyp@5.x behaves erratically with VS2015 and MSBuild.exe detection
|
||||
npm install node-gyp@4.x node-pre-gyp
|
||||
else
|
||||
NPM_ROOT="$(npm root)"
|
||||
npm install node-gyp@5.x node-pre-gyp
|
||||
PYTHON27="/c/Python27"
|
||||
fi
|
||||
|
||||
export PATH="$NPM_ROOT/.bin/${PYTHON27}:$PATH"
|
||||
export PATH="${PYTHON27}:$PATH"
|
||||
|
||||
for node in ${SUPPORTED_NODEJS_VERSIONS}; do
|
||||
EXTRA_CFLAGS="${EXTRA_LOCAL_CFLAGS}" EXTRA_LDFLAGS="${EXTRA_LOCAL_LDFLAGS}" EXTRA_LIBS="${EXTRA_LOCAL_LIBS}" make -C native_client/javascript \
|
||||
@ -157,16 +151,10 @@ do_deepspeech_npm_package()
|
||||
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
|
||||
# Windows
|
||||
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
|
||||
NPM_ROOT=$(cygpath -u "$(npm root)")
|
||||
PYTHON27=":/c/Python27"
|
||||
# node-gyp@5.x behaves erratically with VS2015 and MSBuild.exe detection
|
||||
npm install node-gyp@4.x node-pre-gyp
|
||||
else
|
||||
NPM_ROOT="$(npm root)"
|
||||
npm install node-gyp@5.x node-pre-gyp
|
||||
PYTHON27="/c/Python27"
|
||||
fi
|
||||
|
||||
export PATH="$NPM_ROOT/.bin/$PYTHON27:$PATH"
|
||||
export PATH="${NPM_BIN}${PYTHON27}:$PATH"
|
||||
|
||||
all_tasks="$(curl -s https://community-tc.services.mozilla.com/api/queue/v1/task/${TASK_ID} | python -c 'import json; import sys; print(" ".join(json.loads(sys.stdin.read())["dependencies"]));')"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user