Compare commits
76 Commits
Author | SHA1 | Date | |
---|---|---|---|
d15500d5a0 | |||
7e99fd703f | |||
fa5462c0bc | |||
f8736d3556 | |||
45bba88f46 | |||
daafe0b6ff | |||
3d905de2be | |||
815008e881 | |||
4641cc7cad | |||
dbf324682c | |||
8f5c302b6c | |||
e5bf2ac20c | |||
731931452a | |||
0b3730f7e5 | |||
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 |
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,7 +1,20 @@
|
|||||||
.nogit/
|
.nogit/
|
||||||
node_modules/
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
.yarn/
|
.yarn/
|
||||||
tscache
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_*/
|
||||||
|
|
||||||
|
# custom
|
142
.gitlab-ci.yml
142
.gitlab-ci.yml
@ -1,16 +1,16 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- .npmci_cache/
|
- .npmci_cache/
|
||||||
key: "$CI_BUILD_STAGE"
|
key: '$CI_BUILD_STAGE'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- security
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
@ -18,108 +18,115 @@ stages:
|
|||||||
mirror:
|
mirror:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
snyk:
|
auditProductionDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g snyk
|
- npmci npm prepare
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --production --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=prod --production
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
allow_failure: true
|
||||||
|
|
||||||
|
auditDevDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install --ignore-scripts
|
||||||
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=dev
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# 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:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci node install stable
|
||||||
- npmci npm test
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
testBuild:
|
||||||
testSTABLE:
|
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci node install stable
|
||||||
- npmci npm test
|
- npmci npm install
|
||||||
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm publish
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# metadata stage
|
# metadata stage
|
||||||
# ====================
|
# ====================
|
||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
image: docker:stable
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
services:
|
only:
|
||||||
- docker:stable-dind
|
- tags
|
||||||
script:
|
script:
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- npmci command npm install -g tslint typescript
|
||||||
- docker run
|
- npmci npm prepare
|
||||||
--env SOURCE_CODE="$PWD"
|
- npmci npm install
|
||||||
--volume "$PWD":/code
|
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
|
||||||
artifacts:
|
|
||||||
paths: [codeclimate.json]
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- priv
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g npmpage
|
- npmci node install lts
|
||||||
- npmci command npmpage
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command tsdoc
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
only:
|
only:
|
||||||
@ -127,4 +134,5 @@ pages:
|
|||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
4
.snyk
4
.snyk
@ -1,4 +0,0 @@
|
|||||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
|
||||||
version: v1.12.0
|
|
||||||
ignore: {}
|
|
||||||
patch: {}
|
|
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "current file",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"${relativeFile}"
|
||||||
|
],
|
||||||
|
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "test.ts",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"test/test.ts"
|
||||||
|
],
|
||||||
|
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
.vscode/settings.json
vendored
Normal file
26
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"json.schemas": [
|
||||||
|
{
|
||||||
|
"fileMatch": ["/npmextra.json"],
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"npmci": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for npmci"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for gitzone",
|
||||||
|
"properties": {
|
||||||
|
"projectType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
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.
|
5
cli.js
5
cli.js
@ -1,3 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL_TSRUN = 'true'
|
process.env.CLI_CALL = 'true';
|
||||||
var index = require("./dist/index.js");
|
const cliTool = require('./dist_ts/index');
|
||||||
|
cliTool.runCli();
|
||||||
|
5
cli.ts.js
Normal file
5
cli.ts.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
process.env.CLI_CALL = 'true';
|
||||||
|
require('@gitzone/tsrun');
|
||||||
|
const cliTool = require('./ts/index');
|
||||||
|
cliTool.runCli();
|
@ -1 +0,0 @@
|
|||||||
.gitignore: ../gitignore/
|
|
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export {};
|
|
20
dist/index.js
vendored
20
dist/index.js
vendored
@ -1,20 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const tsNode = require("ts-node");
|
|
||||||
const path = require("path");
|
|
||||||
tsNode.register({
|
|
||||||
compilerOptions: {
|
|
||||||
lib: ['es2016', 'es2017']
|
|
||||||
},
|
|
||||||
ignore: ['^(.(.*\.d\.ts))*$'],
|
|
||||||
cacheDirectory: path.join(__dirname, '../tscache')
|
|
||||||
});
|
|
||||||
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtDQUFrQztBQUNsQyw2QkFBNkI7QUFFN0IsTUFBTSxDQUFDLFFBQVEsQ0FBQztJQUNkLGVBQWUsRUFBRTtRQUNmLEdBQUcsRUFBRSxDQUFFLFFBQVEsRUFBRSxRQUFRLENBQUU7S0FDNUI7SUFDRCxNQUFNLEVBQUUsQ0FBQyxtQkFBbUIsQ0FBQztJQUM3QixjQUFjLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsWUFBWSxDQUFDO0NBQ25ELENBQUMsQ0FBQztBQUVILElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLEVBQUU7SUFDOUIseUJBQXlCO0lBQ3pCLHFDQUFxQztJQUNyQyxzQ0FBc0M7SUFDdEMsTUFBTSxZQUFZLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUVwQyxNQUFNLFVBQVUsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBRSxZQUFZLENBQUMsQ0FBQztJQUMxRCxxQ0FBTyxVQUFVLEdBQUU7Q0FDcEIifQ==
|
|
@ -1,11 +1,18 @@
|
|||||||
{
|
{
|
||||||
"npmts": {
|
"npmts": {},
|
||||||
},
|
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [
|
"npmGlobalTools": [],
|
||||||
"@gitzone/npmts",
|
|
||||||
"ts-node"
|
|
||||||
],
|
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "gitzone",
|
||||||
|
"gitrepo": "tsrun",
|
||||||
|
"shortDescription": "run typescript programs efficiently",
|
||||||
|
"npmPackagename": "@gitzone/tsrun",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
2838
package-lock.json
generated
2838
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@ -1,27 +1,44 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tsrun",
|
"name": "@gitzone/tsrun",
|
||||||
"version": "1.0.12",
|
"version": "1.2.14",
|
||||||
"description": "run typescript programs efficiently",
|
"description": "run typescript programs efficiently",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsrun": "./cli.js"
|
"tsrun": "./cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts --notest && node ./cli.js 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)"
|
||||||
"postinstall": "ts-node --ignore '' --compilerOptions '{\"lib\": [\"ES2015\"]}' scripts/postinstall.ts"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^10.3.0"
|
"@gitzone/tsbuild": "^2.1.24",
|
||||||
|
"@types/node": "^15.12.4",
|
||||||
|
"tslint": "^6.1.2",
|
||||||
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"smartfile": "^4.2.28",
|
"@pushrocks/smartfile": "^8.0.10",
|
||||||
"ts-node": "^6.1.0",
|
"ts-node": "^10.0.0",
|
||||||
"typescript": "^2.9.1"
|
"typescript": "^4.3.4"
|
||||||
},
|
},
|
||||||
"private": false
|
"private": false,
|
||||||
|
"files": [
|
||||||
|
"ts/**/*",
|
||||||
|
"ts_web/**/*",
|
||||||
|
"dist/**/*",
|
||||||
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
49
readme.md
Normal file
49
readme.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# @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
|
||||||
|
|
||||||
|
Status Category | Status Badge
|
||||||
|
-- | --
|
||||||
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
|
npm | [](https://lossless.cloud)
|
||||||
|
Snyk | [](https://lossless.cloud)
|
||||||
|
TypeScript Support | [](https://lossless.cloud)
|
||||||
|
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
|
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
## Contribution
|
||||||
|
|
||||||
|
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
@ -1,15 +0,0 @@
|
|||||||
// This file takes care of some postinstall actions like clearing the TypeScript cache.
|
|
||||||
import * as smartfile from 'smartfile';
|
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
const run = async () => {
|
|
||||||
const tsCacheDir = path.join(__dirname, '../tscache');
|
|
||||||
const tsCacheFiles: string[] = await smartfile.fs.listFolders(tsCacheDir) as any;
|
|
||||||
for(const dir of tsCacheFiles) {
|
|
||||||
console.log(`Removing cache directory ${dir}`);
|
|
||||||
let dirToRemove = path.join(tsCacheDir, dir);
|
|
||||||
await smartfile.fs.removeSync(dirToRemove);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
43
ts/index.ts
43
ts/index.ts
@ -1,20 +1,41 @@
|
|||||||
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.CreateOptions = {
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
lib: [ 'es2016', 'es2017' ]
|
lib: ['es2017'],
|
||||||
},
|
target: <any>'es2017', // Script Target should be a string -> 2 is for ES2015
|
||||||
ignore: ['^(.(.*\.d\.ts))*$'],
|
experimentalDecorators: true,
|
||||||
cacheDirectory: path.join(__dirname, '../tscache')
|
esModuleInterop: true,
|
||||||
});
|
} as CompilerOptions,
|
||||||
|
skipIgnore: true,
|
||||||
|
};
|
||||||
|
|
||||||
if (process.env.CLI_CALL_TSRUN) {
|
if (process.argv.includes('--web')) {
|
||||||
|
const previousCompilerOptions = defaultTsNodeOptions.compilerOptions as CompilerOptions;
|
||||||
|
defaultTsNodeOptions.compilerOptions = {
|
||||||
|
...previousCompilerOptions,
|
||||||
|
lib: ['es2016', 'es2017', 'dom'],
|
||||||
|
target: <any>'es2017', // Script Target should be a string -> 2 is for ES2015
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.argv.includes('--nocache')) {
|
||||||
|
// currently caching is not used
|
||||||
|
}
|
||||||
|
|
||||||
|
tsNode.register(defaultTsNodeOptions);
|
||||||
|
|
||||||
|
export const runCli = async () => {
|
||||||
// contents of argv array
|
// contents of argv array
|
||||||
// process.argv[0] -> node Executable
|
// process.argv[0] -> node Executable
|
||||||
// process.argv[1] -> tsrun executable
|
// process.argv[1] -> tsrun executable
|
||||||
const pathToTsFile = process.argv[2]
|
const pathToTsFile = process.argv[2];
|
||||||
|
|
||||||
const pathToLoad = path.join(process.cwd(), pathToTsFile);
|
const pathToLoad = path.join(process.cwd(), pathToTsFile);
|
||||||
|
console.log(process.argv);
|
||||||
|
process.argv.pop();
|
||||||
|
console.log(process.argv);
|
||||||
import(pathToLoad);
|
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