Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
135e860c71 | |||
56be247d16 | |||
94ce004e91 |
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,20 +1,7 @@
|
|||||||
.nogit/
|
.nogit/
|
||||||
|
node_modules/
|
||||||
# artifacts
|
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
# installs
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# caches
|
|
||||||
.yarn/
|
.yarn/
|
||||||
.cache/
|
tscache
|
||||||
.rpt2_cache
|
|
||||||
|
|
||||||
# builds
|
|
||||||
dist/
|
|
||||||
dist_*/
|
|
||||||
|
|
||||||
# custom
|
|
||||||
|
149
.gitlab-ci.yml
149
.gitlab-ci.yml
@ -1,16 +1,16 @@
|
|||||||
# gitzone ci_default
|
# gitzone standard
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: 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,115 +18,108 @@ stages:
|
|||||||
mirror:
|
mirror:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- docker
|
||||||
- docker
|
- notpriv
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
snyk:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci command npm install -g snyk
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
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 install --ignore-scripts
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- npmci command snyk test
|
||||||
- npmci command npm audit --audit-level=high --only=dev
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
- notpriv
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
# ====================
|
# ====================
|
||||||
|
testLEGACY:
|
||||||
testStable:
|
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci node install legacy
|
||||||
- npmci node install stable
|
- npmci npm install
|
||||||
- npmci npm install
|
- npmci npm test
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
testBuild:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci node install lts
|
||||||
- npmci node install stable
|
- npmci npm install
|
||||||
- npmci npm install
|
- npmci npm test
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
testSTABLE:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
tags:
|
||||||
|
- 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:
|
||||||
- lossless
|
- docker
|
||||||
- docker
|
- notpriv
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# metadata stage
|
# metadata stage
|
||||||
# ====================
|
# ====================
|
||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
|
image: docker:stable
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
only:
|
services:
|
||||||
- tags
|
- docker:stable-dind
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||||
- npmci npm prepare
|
- docker run
|
||||||
- npmci npm install
|
--env SOURCE_CODE="$PWD"
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
--volume "$PWD":/code
|
||||||
|
--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:
|
||||||
- lossless
|
- docker
|
||||||
- docker
|
- priv
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- docker
|
||||||
- docker
|
- notpriv
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci command npm install -g npmpage
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
- npmci command npmpage
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command tsdoc
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
only:
|
only:
|
||||||
@ -134,5 +127,15 @@ pages:
|
|||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
windowsCompatibility:
|
||||||
|
image: stefanscherer/node-windows:10-build-tools
|
||||||
|
stage: metadata
|
||||||
|
script:
|
||||||
|
- npm install & npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
tags:
|
||||||
|
- windows
|
||||||
allow_failure: true
|
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.12.0
|
||||||
|
ignore: {}
|
||||||
|
patch: {}
|
29
.vscode/launch.json
vendored
29
.vscode/launch.json
vendored
@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"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
26
.vscode/settings.json
vendored
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"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"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
5
cli.js
5
cli.js
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL = 'true';
|
process.env.CLI_CALL_TSRUN = 'true'
|
||||||
const cliTool = require('./dist_ts/index');
|
var index = require("./dist/index.js");
|
||||||
cliTool.runCli();
|
|
@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
process.env.CLI_CALL = 'true';
|
|
||||||
require('@gitzone/tsrun');
|
|
||||||
const cliTool = require('./ts/index');
|
|
||||||
cliTool.runCli();
|
|
1
dependencies.yml
Normal file
1
dependencies.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
.gitignore: ../gitignore/
|
1
dist/index.d.ts
vendored
Normal file
1
dist/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export {};
|
35
dist/index.js
vendored
Normal file
35
dist/index.js
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = require("path");
|
||||||
|
const tsNode = require("ts-node");
|
||||||
|
const tsCacheDir = path.join(__dirname, "../tscache");
|
||||||
|
const defaultTsNodeOptions = {
|
||||||
|
compilerOptions: {
|
||||||
|
lib: ["es2016", "es2017"],
|
||||||
|
target: "es2015"
|
||||||
|
},
|
||||||
|
skipIgnore: true,
|
||||||
|
cacheDirectory: tsCacheDir
|
||||||
|
};
|
||||||
|
// check wether a cache is feasible
|
||||||
|
if (process.argv.includes("--nocache")) {
|
||||||
|
defaultTsNodeOptions.cache = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var fs = require('fs');
|
||||||
|
fs.access(tsCacheDir, fs.constants.W_OK, function (err) {
|
||||||
|
if (err) {
|
||||||
|
defaultTsNodeOptions.cache = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixrQ0FBa0M7QUFFbEMsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFFdEQsTUFBTSxvQkFBb0IsR0FBbUI7SUFDM0MsZUFBZSxFQUFFO1FBQ2YsR0FBRyxFQUFFLENBQUMsUUFBUSxFQUFFLFFBQVEsQ0FBQztRQUN6QixNQUFNLEVBQUUsUUFBUTtLQUNqQjtJQUNELFVBQVUsRUFBRSxJQUFJO0lBQ2hCLGNBQWMsRUFBRSxVQUFVO0NBQzNCLENBQUM7QUFFRixtQ0FBbUM7QUFDbkMsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxXQUFXLENBQUMsRUFBRTtJQUN0QyxvQkFBb0IsQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO0NBQ3BDO0tBQU07SUFDTCxJQUFJLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDdkIsRUFBRSxDQUFDLE1BQU0sQ0FBQyxVQUFVLEVBQUUsRUFBRSxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUUsVUFBUyxHQUFHO1FBQ25ELElBQUksR0FBRyxFQUFFO1lBQ1Asb0JBQW9CLENBQUMsS0FBSyxHQUFHLEtBQUssQ0FBQztTQUNwQztJQUNILENBQUMsQ0FBQyxDQUFDO0NBQ0o7QUFFRCxNQUFNLENBQUMsUUFBUSxDQUFDLG9CQUFvQixDQUFDLENBQUM7QUFFdEMsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBRTtJQUM5Qix5QkFBeUI7SUFDekIscUNBQXFDO0lBQ3JDLHNDQUFzQztJQUN0QyxNQUFNLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXJDLE1BQU0sVUFBVSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQzFELHFDQUFPLFVBQVUsR0FBRTtDQUNwQiJ9
|
@ -1,18 +1,11 @@
|
|||||||
{
|
{
|
||||||
"npmts": {},
|
"npmts": {
|
||||||
"npmci": {
|
|
||||||
"npmGlobalTools": [],
|
|
||||||
"npmAccessLevel": "public"
|
|
||||||
},
|
},
|
||||||
"gitzone": {
|
"npmci": {
|
||||||
"projectType": "npm",
|
"npmGlobalTools": [
|
||||||
"module": {
|
"@gitzone/npmts",
|
||||||
"githost": "gitlab.com",
|
"ts-node"
|
||||||
"gitscope": "gitzone",
|
],
|
||||||
"gitrepo": "tsrun",
|
"npmAccessLevel": "public"
|
||||||
"shortDescription": "run typescript programs efficiently",
|
|
||||||
"npmPackagename": "@gitzone/tsrun",
|
|
||||||
"license": "MIT"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
2828
package-lock.json
generated
2828
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@ -1,44 +1,27 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tsrun",
|
"name": "@gitzone/tsrun",
|
||||||
"version": "1.2.13",
|
"version": "1.1.3",
|
||||||
"description": "run typescript programs efficiently",
|
"description": "run typescript programs efficiently",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsrun": "./cli.js"
|
"tsrun": "./cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tsbuild && node ./cli.js test/test.ts)",
|
"test": "(npmts --notest && node ./cli.js test/test.ts)",
|
||||||
"format": "(gitzone format)",
|
"format": "(gitzone format)",
|
||||||
"build": "(tsbuild)"
|
"build": "echo \"Not needed for now\"",
|
||||||
|
"postinstall": "(node ./cli.js scripts/postinstall.ts)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.24",
|
"@types/node": "^10.5.2"
|
||||||
"@types/node": "^15.12.4",
|
|
||||||
"tslint": "^6.1.2",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartfile": "^8.0.10",
|
"@pushrocks/smartfile": "^6.0.3",
|
||||||
"ts-node": "^10.0.0",
|
"ts-node": "^7.0.0",
|
||||||
"typescript": "^4.3.4"
|
"typescript": "^2.9.2"
|
||||||
},
|
},
|
||||||
"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
49
readme.md
@ -1,49 +0,0 @@
|
|||||||
# @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)
|
|
10
scripts/postinstall.ts
Normal file
10
scripts/postinstall.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// This file takes care of some postinstall actions like clearing the TypeScript cache.
|
||||||
|
import * as smartfile from '@pushrocks/smartfile';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
const run = async () => {
|
||||||
|
const tsCacheDir = path.join(__dirname, '../tscache');
|
||||||
|
await smartfile.fs.ensureEmptyDir(tsCacheDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
44
ts/index.ts
44
ts/index.ts
@ -1,39 +1,37 @@
|
|||||||
import * as path from 'path';
|
import * as path from "path";
|
||||||
import * as tsNode from 'ts-node';
|
import * as tsNode from "ts-node";
|
||||||
import { CompilerOptions } from 'typescript';
|
|
||||||
|
|
||||||
const defaultTsNodeOptions: tsNode.CreateOptions = {
|
const tsCacheDir = path.join(__dirname, "../tscache");
|
||||||
|
|
||||||
|
const defaultTsNodeOptions: tsNode.Options = {
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
lib: ['es2017'],
|
lib: ["es2016", "es2017"],
|
||||||
target: <any>'es2017', // Script Target should be a string -> 2 is for ES2015
|
target: "es2015"
|
||||||
experimentalDecorators: true,
|
},
|
||||||
esModuleInterop: true,
|
|
||||||
} as CompilerOptions,
|
|
||||||
skipIgnore: true,
|
skipIgnore: true,
|
||||||
|
cacheDirectory: tsCacheDir
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.argv.includes('--web')) {
|
// check wether a cache is feasible
|
||||||
const previousCompilerOptions = defaultTsNodeOptions.compilerOptions as CompilerOptions;
|
if (process.argv.includes("--nocache")) {
|
||||||
defaultTsNodeOptions.compilerOptions = {
|
defaultTsNodeOptions.cache = false;
|
||||||
...previousCompilerOptions,
|
} else {
|
||||||
lib: ['es2016', 'es2017', 'dom'],
|
var fs = require('fs');
|
||||||
target: <any>'es2017', // Script Target should be a string -> 2 is for ES2015
|
fs.access(tsCacheDir, fs.constants.W_OK, function(err) {
|
||||||
};
|
if (err) {
|
||||||
}
|
defaultTsNodeOptions.cache = false;
|
||||||
|
}
|
||||||
if (process.argv.includes('--nocache')) {
|
});
|
||||||
// currently caching is not used
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tsNode.register(defaultTsNodeOptions);
|
tsNode.register(defaultTsNodeOptions);
|
||||||
|
|
||||||
export const runCli = async () => {
|
if (process.env.CLI_CALL_TSRUN) {
|
||||||
// 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);
|
||||||
process.argv.shift();
|
|
||||||
import(pathToLoad);
|
import(pathToLoad);
|
||||||
};
|
}
|
||||||
|
16
tslint.json
16
tslint.json
@ -1,17 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
"extends": "tslint-config-standard"
|
||||||
"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