Initial commit of a skeleton typescript project

This commit is contained in:
R. Tyler Croy 2018-09-09 17:27:58 -07:00
commit 48dd461f77
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
11 changed files with 5798 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/
node_modules/
*.sw*

32
Makefile Normal file
View File

@ -0,0 +1,32 @@
# Root Makefile to make the building and testing of this project easier
# regardless of *nix based platform
PATH:=./node_modules/.bin:./tools:$(PATH)
all: build check
depends: package.json package-lock.json
if [ ! -d node_modules ]; then \
npm install; \
fi;
build: depends
tsc
check: depends
jest
clean:
rm -rf node_modules
debug-jest:
node --inspect-brk=0.0.0.0:9229 ./node_modules/.bin/jest
watch:
jest --watchAll
watch-compile:
tsc -w
.PHONY: all depends build clean check watch
# vim: set et

4
README.adoc Normal file
View File

@ -0,0 +1,4 @@
= Uplink
`uplink` is a simple web application to receive short bursts of anonymous
telemetry data from Jenkins instances.

3
activate Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
export PATH=./node_modules/.bin:${PWD}/tools:${PATH}

5657
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

47
package.json Normal file
View File

@ -0,0 +1,47 @@
{
"name": "uplink",
"version": "1.0.0",
"description": "Uplink receives bursts of Jenkins telemetry",
"main": "src/index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jenkins-infra/uplink.git"
},
"author": "R Tyler Croy",
"license": "AGPL-3.0",
"bugs": {
"url": "https://github.com/jenkins-infra/uplink/issues"
},
"homepage": "https://github.com/jenkins-infra/uplink#readme",
"devDependencies": {
"@types/winston": "^2.4.4",
"jest": "^23.5.0",
"ts-jest": "^23.1.4",
"typescript": "^3.0.3"
},
"dependencies": {
"tslib": "^1.9.3",
"uuid": "^3.3.2",
"winston": "^3.1.0"
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/test/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
}

0
src/.gitignore vendored Normal file
View File

0
test/.gitignore vendored Normal file
View File

29
tools/node Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# If we're executing from a normal shell, allow input. If we're in a
# subprocess, like under Jenkins Pipeline, don't allow it
tty -s
if [ $? -eq 0 ]; then
TTY_ARGS="-ti"
fi;
COMMAND=$@
# The caller is passing in some custom paraneters to the `node` binary, so we
# need to override the entrypoint to explicitly call node
if [[ "${1}" =~ "--" ]]; then
COMMAND="node $@";
fi;
exec docker run --rm ${TTY_ARGS} --net host \
-u $(id -u):$(id -g) \
-w ${PWD} \
--mount type=tmpfs,destination=/.npm \
--mount type=tmpfs,destination=/.config \
-v ${PWD}:${PWD} \
-e PATH=$PWD/node_modules/.bin:/usr/local/bin:$PATH \
-e LANG=C.UTF-8 \
-e LOG_LEVEL=$LOG_LEVEL \
$(printenv | grep -i \^node | awk '{ print "-e", $1 }') \
node:10-alpine \
${COMMAND}

3
tools/npm Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec $(dirname $0)/node npm $@

20
tsconfig.json Normal file
View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"alwaysStrict" : true,
"outDir": "./build",
"module" : "commonjs",
"skipLibCheck": true,
"lib" : ["es2017"],
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"importHelpers" : true,
"target": "es2015",
"sourceMap": true
},
"include": [
"./common/**/*",
"./crawl/**/*",
"./processor/**/*"
]
}