Compare commits
83 Commits
Author | SHA1 | Date | |
---|---|---|---|
aecc54aab0 | |||
e3fa66ff07 | |||
bb3b918521 | |||
ba9eaa5091 | |||
0e281ab257 | |||
0e14522287 | |||
4d93e2e728 | |||
ce9a350521 | |||
df9c7204c7 | |||
568472e715 | |||
0ba6863e28 | |||
d5c63cd24c | |||
460babd675 | |||
98cde0edb4 | |||
1d5766435a | |||
92ac844954 | |||
9ae4f9f82b | |||
3df2922085 | |||
3eb29c729e | |||
cadc2cd629 | |||
399ee0b4ca | |||
ac5d8d1614 | |||
6349753cce | |||
3897e15a7e | |||
2582710e8f | |||
4cd06d040d | |||
5eb3ba901a | |||
dd5b101224 | |||
972583a3a7 | |||
ef3c636976 | |||
b1ec59e042 | |||
84275f6804 | |||
b02edb7536 | |||
4624cce39a | |||
d4938f12cd | |||
78157d474a | |||
8f4f22b83f | |||
90a97cb0eb | |||
5bacff743d | |||
f5d4b9ff5b | |||
4e68019aa9 | |||
022a919adf | |||
d52315382e | |||
5210b09c04 | |||
8e2695a06f | |||
7e8fe1bcba | |||
c603ae0c87 | |||
4e70a1ef1a | |||
74df4b7b2b | |||
51808f230a | |||
42f2f132f1 | |||
a3fb24eba3 | |||
cf89601f28 | |||
da899b29bb | |||
9e94bc56ff | |||
cd549b8aaf | |||
dcf5c6ab22 | |||
00480a27e0 | |||
353c1f6dbd | |||
e540ac8327 | |||
ef1bc5c93a | |||
a76aaa45d2 | |||
d07c7a74e8 | |||
69f6f7460f | |||
f01e07933e | |||
51b5343440 | |||
6815f9bd5d | |||
1b68c19d92 | |||
51cc29d79b | |||
39d94a3daa | |||
c46fcb6ea3 | |||
ff83eae8e4 | |||
b6179bf8fc | |||
8c08cf68d4 | |||
cc7ec18141 | |||
8f5b0a747a | |||
3971df8ad8 | |||
c129560e07 | |||
ea44ec9a14 | |||
dbbcd3d0b5 | |||
abd68e0846 | |||
cfac1c5008 | |||
c4b38d7b41 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ coverage/
|
|||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
.yarn/
|
.yarn/
|
||||||
|
tscache
|
||||||
|
@ -26,6 +26,7 @@ mirror:
|
|||||||
snyk:
|
snyk:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci command npm install -g snyk
|
- npmci command npm install -g snyk
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command snyk test
|
||||||
@ -33,24 +34,39 @@ snyk:
|
|||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
|
sast:
|
||||||
|
stage: security
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci
|
||||||
|
variables:
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
|
allow_failure: true
|
||||||
|
services:
|
||||||
|
- docker:stable-dind
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command npm run build
|
||||||
|
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||||
|
- docker run
|
||||||
|
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
|
||||||
|
--volume "$PWD:/code"
|
||||||
|
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
sast: gl-sast-report.json
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
# ====================
|
# ====================
|
||||||
testLEGACY:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install legacy
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install lts
|
- npmci node install lts
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -62,6 +78,7 @@ testLTS:
|
|||||||
testSTABLE:
|
testSTABLE:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -117,8 +134,10 @@ pages:
|
|||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g npmpage
|
- npmci command npm install -g typedoc typescript
|
||||||
- npmci command npmpage
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
@ -128,3 +147,4 @@ pages:
|
|||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
4
.snyk
Normal file
4
.snyk
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||||
|
version: v1.13.4
|
||||||
|
ignore: {}
|
||||||
|
patch: {}
|
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2018 Lossless GmbH (hello@lossless.com)
|
||||||
|
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
3
cli.js
Normal file
3
cli.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
process.env.CLI_CALL_TSRUN = 'true'
|
||||||
|
var index = require("./dist/index.js");
|
3
dist/cli.js
vendored
3
dist/cli.js
vendored
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
process.env.CLI_CALL = 'true'
|
|
||||||
var index = require("../dist/index.js");
|
|
35
dist/index.js
vendored
35
dist/index.js
vendored
@ -1,12 +1,31 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tsNode = require("ts-node");
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
tsNode.register({
|
const tsNode = require("ts-node");
|
||||||
|
const defaultTsNodeOptions = {
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
lib: ['es2016', 'es2017']
|
lib: ['es2017'],
|
||||||
}
|
target: 'es2017',
|
||||||
});
|
experimentalDecorators: true,
|
||||||
const pathToLoad = path.join(process.cwd(), process.argv.pop());
|
esModuleInterop: true
|
||||||
Promise.resolve().then(() => require(pathToLoad));
|
},
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtDQUFrQztBQUNsQyw2QkFBNkI7QUFFN0IsTUFBTSxDQUFDLFFBQVEsQ0FBQztJQUNkLGVBQWUsRUFBRTtRQUNmLEdBQUcsRUFBRSxDQUFDLFFBQVEsRUFBRSxRQUFRLENBQUM7S0FDMUI7Q0FDRixDQUFDLENBQUM7QUFFSCxNQUFNLFVBQVUsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBRSxPQUFPLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUM7QUFDaEUscUNBQU8sVUFBVSxHQUFFIn0=
|
skipIgnore: true
|
||||||
|
};
|
||||||
|
if (process.argv.includes('--web')) {
|
||||||
|
const previousCompilerOptions = defaultTsNodeOptions.compilerOptions;
|
||||||
|
defaultTsNodeOptions.compilerOptions = Object.assign({}, previousCompilerOptions, { lib: ['es2016', 'es2017', 'dom'], target: 'es2015' // Script Target should be a string -> 2 is for ES2015
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (process.argv.includes('--nocache')) {
|
||||||
|
// currently caching is not used
|
||||||
|
}
|
||||||
|
tsNode.register(defaultTsNodeOptions);
|
||||||
|
if (process.env.CLI_CALL_TSRUN) {
|
||||||
|
// contents of argv array
|
||||||
|
// process.argv[0] -> node Executable
|
||||||
|
// process.argv[1] -> tsrun executable
|
||||||
|
const pathToTsFile = process.argv[2];
|
||||||
|
const pathToLoad = path.join(process.cwd(), pathToTsFile);
|
||||||
|
Promise.resolve().then(() => require(pathToLoad));
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixrQ0FBa0M7QUFHbEMsTUFBTSxvQkFBb0IsR0FBbUI7SUFDM0MsZUFBZSxFQUFFO1FBQ2YsR0FBRyxFQUFFLENBQUMsUUFBUSxDQUFDO1FBQ2YsTUFBTSxFQUFPLFFBQVE7UUFDckIsc0JBQXNCLEVBQUUsSUFBSTtRQUM1QixlQUFlLEVBQUUsSUFBSTtLQUNIO0lBQ3BCLFVBQVUsRUFBRSxJQUFJO0NBQ2pCLENBQUM7QUFFRixJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE9BQU8sQ0FBQyxFQUFFO0lBQ2xDLE1BQU0sdUJBQXVCLEdBQUcsb0JBQW9CLENBQUMsZUFBa0MsQ0FBQztJQUN4RixvQkFBb0IsQ0FBQyxlQUFlLHFCQUMvQix1QkFBdUIsSUFDMUIsR0FBRyxFQUFFLENBQUMsUUFBUSxFQUFFLFFBQVEsRUFBRSxLQUFLLENBQUMsRUFDaEMsTUFBTSxFQUFPLFFBQVEsQ0FBQyxzREFBc0Q7T0FDN0UsQ0FBQztDQUNIO0FBRUQsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxXQUFXLENBQUMsRUFBRTtJQUN0QyxnQ0FBZ0M7Q0FDakM7QUFFRCxNQUFNLENBQUMsUUFBUSxDQUFDLG9CQUFvQixDQUFDLENBQUM7QUFFdEMsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBRTtJQUM5Qix5QkFBeUI7SUFDekIscUNBQXFDO0lBQ3JDLHNDQUFzQztJQUN0QyxNQUFNLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXJDLE1BQU0sVUFBVSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQzFELHFDQUFPLFVBQVUsR0FBRTtDQUNwQiJ9
|
@ -1,12 +1,17 @@
|
|||||||
{
|
{
|
||||||
"npmts": {
|
"npmts": {},
|
||||||
"cli": true
|
|
||||||
},
|
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [
|
"npmGlobalTools": [],
|
||||||
"@gitzone/npmts",
|
|
||||||
"ts-node"
|
|
||||||
],
|
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "gitzone",
|
||||||
|
"gitrepo": "tsrun",
|
||||||
|
"shortDescription": "run typescript programs efficiently",
|
||||||
|
"npmPackagename": "@gitzone/tsrun",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1311
package-lock.json
generated
1311
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -1,24 +1,29 @@
|
|||||||
{
|
{
|
||||||
"name": "tsrun",
|
"name": "@gitzone/tsrun",
|
||||||
"version": "1.0.2",
|
"version": "1.2.7",
|
||||||
"description": "run typescript programs efficiently",
|
"description": "run typescript programs efficiently",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsrun": "dist/cli.js"
|
"tsrun": "./cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts --notest && node dist/cli.js -d test/test.ts)",
|
"test": "(tsbuild && node ./cli.js test/test.ts)",
|
||||||
"format": "(gitzone format)",
|
"format": "(gitzone format)",
|
||||||
"build": "echo \"Not needed for now\""
|
"build": "(tsbuild)"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@gitzone/tsbuild": "^2.1.11",
|
||||||
|
"@types/node": "^12.6.6",
|
||||||
|
"tslint": "^5.18.0",
|
||||||
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^10.3.0",
|
"@pushrocks/smartfile": "^7.0.4",
|
||||||
"ts-node": "^6.1.0",
|
"ts-node": "^8.3.0",
|
||||||
"typescript": "^2.9.1"
|
"typescript": "^3.5.3"
|
||||||
},
|
},
|
||||||
"private": false
|
"private": false
|
||||||
}
|
}
|
||||||
|
38
readme.md
Normal file
38
readme.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# @gitzone/tsrun
|
||||||
|
run typescript programs efficiently
|
||||||
|
|
||||||
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsrun)
|
||||||
|
* [gitlab.com (source)](https://gitlab.com/gitzone/tsrun)
|
||||||
|
* [github.com (source mirror)](https://github.com/gitzone/tsrun)
|
||||||
|
* [docs (typedoc)](https://gitzone.gitlab.io/tsrun/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://gitlab.com/gitzone/tsrun/commits/master)
|
||||||
|
[](https://gitlab.com/gitzone/tsrun/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/@gitzone/tsrun)
|
||||||
|
[](https://snyk.io/test/npm/@gitzone/tsrun)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://prettier.io/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
To simply run a TypeScript file on the fly type
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
tsrun myfiletorun.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
There are options available:
|
||||||
|
|
||||||
|
- `--web` will inject browser types. this is useful when testing code with polyfills on node, but that is meant for the browser later on.
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
41
ts/index.ts
41
ts/index.ts
@ -1,11 +1,38 @@
|
|||||||
import * as tsNode from 'ts-node';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as tsNode from 'ts-node';
|
||||||
|
import { CompilerOptions } from 'typescript';
|
||||||
|
|
||||||
tsNode.register({
|
const defaultTsNodeOptions: tsNode.Options = {
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
lib: ['es2016', 'es2017']
|
lib: ['es2017'],
|
||||||
}
|
target: <any>'es2017', // Script Target should be a string -> 2 is for ES2015
|
||||||
});
|
experimentalDecorators: true,
|
||||||
|
esModuleInterop: true
|
||||||
|
} as CompilerOptions,
|
||||||
|
skipIgnore: true
|
||||||
|
};
|
||||||
|
|
||||||
const pathToLoad = path.join(process.cwd(), process.argv.pop());
|
if (process.argv.includes('--web')) {
|
||||||
import(pathToLoad);
|
const previousCompilerOptions = defaultTsNodeOptions.compilerOptions as CompilerOptions;
|
||||||
|
defaultTsNodeOptions.compilerOptions = {
|
||||||
|
...previousCompilerOptions,
|
||||||
|
lib: ['es2016', 'es2017', 'dom'],
|
||||||
|
target: <any>'es2015' // Script Target should be a string -> 2 is for ES2015
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.argv.includes('--nocache')) {
|
||||||
|
// currently caching is not used
|
||||||
|
}
|
||||||
|
|
||||||
|
tsNode.register(defaultTsNodeOptions);
|
||||||
|
|
||||||
|
if (process.env.CLI_CALL_TSRUN) {
|
||||||
|
// contents of argv array
|
||||||
|
// process.argv[0] -> node Executable
|
||||||
|
// process.argv[1] -> tsrun executable
|
||||||
|
const pathToTsFile = process.argv[2];
|
||||||
|
|
||||||
|
const pathToLoad = path.join(process.cwd(), pathToTsFile);
|
||||||
|
import(pathToLoad);
|
||||||
|
}
|
||||||
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user