Compare commits

..

3 Commits

Author SHA1 Message Date
135e860c71 1.1.3 2018-07-13 22:31:34 +02:00
56be247d16 1.1.2 2018-07-13 22:31:15 +02:00
94ce004e91 fix(dependencies): update to @pushrocks/smartfile 2018-07-13 22:31:15 +02:00
17 changed files with 465 additions and 1212 deletions

17
.gitignore vendored
View File

@ -1,20 +1,7 @@
.nogit/
# artifacts
node_modules/
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom
tscache

View File

@ -1,16 +1,16 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
# ====================
# security stage
@ -18,104 +18,108 @@ stages:
mirror:
stage: security
script:
- npmci git mirror
- npmci git mirror
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
audit:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
snyk:
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command snyk test
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
# ====================
# test stage
# ====================
testStable:
testLEGACY:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
- docker
- notpriv
allow_failure: true
testBuild:
testLTS:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
- 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:
stage: release
script:
- npmci node install stable
- npmci npm publish
- npmci node install stable
- npmci npm publish
only:
- tags
- tags
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--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:
- lossless
- docker
- priv
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
- npmci command npm install -g npmpage
- npmci command npmpage
tags:
- lossless
- docker
- notpriv
only:
@ -123,5 +127,15 @@ pages:
artifacts:
expire_in: 1 week
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

2
.snyk
View File

@ -1,4 +1,4 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.4
version: v1.12.0
ignore: {}
patch: {}

29
.vscode/launch.json vendored
View File

@ -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
View File

@ -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"]
}
}
}
}
}
}
]
}

5
cli.js
View File

@ -1,4 +1,3 @@
#!/usr/bin/env node
process.env.CLI_CALL = 'true';
const cliTool = require('./dist_ts/index');
cliTool.runCli();
process.env.CLI_CALL_TSRUN = 'true'
var index = require("./dist/index.js");

View File

@ -1,5 +0,0 @@
#!/usr/bin/env node
process.env.CLI_CALL = 'true';
require('@gitzone/tsrun');
const cliTool = require('./ts/index');
cliTool.runCli();

28
dist/index.js vendored
View File

@ -2,22 +2,26 @@
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: ['es2017'],
target: 'es2017',
experimentalDecorators: true,
esModuleInterop: true
lib: ["es2016", "es2017"],
target: "es2015"
},
skipIgnore: true
skipIgnore: true,
cacheDirectory: tsCacheDir
};
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
});
// check wether a cache is feasible
if (process.argv.includes("--nocache")) {
defaultTsNodeOptions.cache = false;
}
if (process.argv.includes('--nocache')) {
// currently caching is not used
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) {
@ -28,4 +32,4 @@ if (process.env.CLI_CALL_TSRUN) {
const pathToLoad = path.join(process.cwd(), pathToTsFile);
Promise.resolve().then(() => require(pathToLoad));
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixrQ0FBa0M7QUFHbEMsTUFBTSxvQkFBb0IsR0FBbUI7SUFDM0MsZUFBZSxFQUFFO1FBQ2YsR0FBRyxFQUFFLENBQUMsUUFBUSxDQUFDO1FBQ2YsTUFBTSxFQUFPLFFBQVE7UUFDckIsc0JBQXNCLEVBQUUsSUFBSTtRQUM1QixlQUFlLEVBQUUsSUFBSTtLQUNIO0lBQ3BCLFVBQVUsRUFBRSxJQUFJO0NBQ2pCLENBQUM7QUFFRixJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE9BQU8sQ0FBQyxFQUFFO0lBQ2xDLE1BQU0sdUJBQXVCLEdBQUcsb0JBQW9CLENBQUMsZUFBa0MsQ0FBQztJQUN4RixvQkFBb0IsQ0FBQyxlQUFlLHFCQUMvQix1QkFBdUIsSUFDMUIsR0FBRyxFQUFFLENBQUMsUUFBUSxFQUFFLFFBQVEsRUFBRSxLQUFLLENBQUMsRUFDaEMsTUFBTSxFQUFPLFFBQVEsQ0FBQyxzREFBc0Q7T0FDN0UsQ0FBQztDQUNIO0FBRUQsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxXQUFXLENBQUMsRUFBRTtJQUN0QyxnQ0FBZ0M7Q0FDakM7QUFFRCxNQUFNLENBQUMsUUFBUSxDQUFDLG9CQUFvQixDQUFDLENBQUM7QUFFdEMsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBRTtJQUM5Qix5QkFBeUI7SUFDekIscUNBQXFDO0lBQ3JDLHNDQUFzQztJQUN0QyxNQUFNLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXJDLE1BQU0sVUFBVSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQzFELHFDQUFPLFVBQVUsR0FBRTtDQUNwQiJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixrQ0FBa0M7QUFFbEMsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFFdEQsTUFBTSxvQkFBb0IsR0FBbUI7SUFDM0MsZUFBZSxFQUFFO1FBQ2YsR0FBRyxFQUFFLENBQUMsUUFBUSxFQUFFLFFBQVEsQ0FBQztRQUN6QixNQUFNLEVBQUUsUUFBUTtLQUNqQjtJQUNELFVBQVUsRUFBRSxJQUFJO0lBQ2hCLGNBQWMsRUFBRSxVQUFVO0NBQzNCLENBQUM7QUFFRixtQ0FBbUM7QUFDbkMsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxXQUFXLENBQUMsRUFBRTtJQUN0QyxvQkFBb0IsQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO0NBQ3BDO0tBQU07SUFDTCxJQUFJLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDdkIsRUFBRSxDQUFDLE1BQU0sQ0FBQyxVQUFVLEVBQUUsRUFBRSxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUUsVUFBUyxHQUFHO1FBQ25ELElBQUksR0FBRyxFQUFFO1lBQ1Asb0JBQW9CLENBQUMsS0FBSyxHQUFHLEtBQUssQ0FBQztTQUNwQztJQUNILENBQUMsQ0FBQyxDQUFDO0NBQ0o7QUFFRCxNQUFNLENBQUMsUUFBUSxDQUFDLG9CQUFvQixDQUFDLENBQUM7QUFFdEMsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBRTtJQUM5Qix5QkFBeUI7SUFDekIscUNBQXFDO0lBQ3JDLHNDQUFzQztJQUN0QyxNQUFNLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXJDLE1BQU0sVUFBVSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQzFELHFDQUFPLFVBQVUsR0FBRTtDQUNwQiJ9

1
dist_ts/index.d.ts vendored
View File

@ -1 +0,0 @@
export declare const runCli: () => Promise<void>;

View File

@ -1,51 +0,0 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.runCli = void 0;
const path = __importStar(require("path"));
const tsNode = __importStar(require("ts-node"));
const defaultTsNodeOptions = {
compilerOptions: {
lib: ['es2017'],
target: 'es2017',
experimentalDecorators: true,
esModuleInterop: true
},
skipIgnore: true
};
if (process.argv.includes('--web')) {
const previousCompilerOptions = defaultTsNodeOptions.compilerOptions;
defaultTsNodeOptions.compilerOptions = Object.assign(Object.assign({}, previousCompilerOptions), { lib: ['es2016', 'es2017', 'dom'], target: 'es2017' // Script Target should be a string -> 2 is for ES2015
});
}
if (process.argv.includes('--nocache')) {
// currently caching is not used
}
tsNode.register(defaultTsNodeOptions);
exports.runCli = async () => {
// 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(() => __importStar(require(pathToLoad)));
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkNBQTZCO0FBQzdCLGdEQUFrQztBQUdsQyxNQUFNLG9CQUFvQixHQUF5QjtJQUNqRCxlQUFlLEVBQUU7UUFDZixHQUFHLEVBQUUsQ0FBQyxRQUFRLENBQUM7UUFDZixNQUFNLEVBQU8sUUFBUTtRQUNyQixzQkFBc0IsRUFBRSxJQUFJO1FBQzVCLGVBQWUsRUFBRSxJQUFJO0tBQ0g7SUFDcEIsVUFBVSxFQUFFLElBQUk7Q0FDakIsQ0FBQztBQUVGLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLEVBQUU7SUFDbEMsTUFBTSx1QkFBdUIsR0FBRyxvQkFBb0IsQ0FBQyxlQUFrQyxDQUFDO0lBQ3hGLG9CQUFvQixDQUFDLGVBQWUsbUNBQy9CLHVCQUF1QixLQUMxQixHQUFHLEVBQUUsQ0FBQyxRQUFRLEVBQUUsUUFBUSxFQUFFLEtBQUssQ0FBQyxFQUNoQyxNQUFNLEVBQU8sUUFBUSxDQUFDLHNEQUFzRDtPQUM3RSxDQUFDO0NBQ0g7QUFFRCxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQyxFQUFFO0lBQ3RDLGdDQUFnQztDQUNqQztBQUVELE1BQU0sQ0FBQyxRQUFRLENBQUMsb0JBQW9CLENBQUMsQ0FBQztBQUV6QixRQUFBLE1BQU0sR0FBRyxLQUFLLElBQUksRUFBRTtJQUMvQix5QkFBeUI7SUFDekIscUNBQXFDO0lBQ3JDLHNDQUFzQztJQUN0QyxNQUFNLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXJDLE1BQU0sVUFBVSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQzFELGtEQUFPLFVBQVUsSUFBRTtBQUNyQixDQUFDLENBQUEifQ==

View File

@ -1,18 +1,11 @@
{
"npmts": {},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
"npmts": {
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "gitzone",
"gitrepo": "tsrun",
"shortDescription": "run typescript programs efficiently",
"npmPackagename": "@gitzone/tsrun",
"license": "MIT"
}
"npmci": {
"npmGlobalTools": [
"@gitzone/npmts",
"ts-node"
],
"npmAccessLevel": "public"
}
}

1197
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +1,27 @@
{
"name": "@gitzone/tsrun",
"version": "1.2.12",
"version": "1.1.3",
"description": "run typescript programs efficiently",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"bin": {
"tsrun": "./cli.js"
},
"scripts": {
"test": "(tsbuild && node ./cli.js test/test.ts)",
"test": "(npmts --notest && node ./cli.js test/test.ts)",
"format": "(gitzone format)",
"build": "(tsbuild)"
"build": "echo \"Not needed for now\"",
"postinstall": "(node ./cli.js scripts/postinstall.ts)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.24",
"@types/node": "^14.0.6",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0"
"@types/node": "^10.5.2"
},
"dependencies": {
"@pushrocks/smartfile": "^7.0.12",
"ts-node": "^8.10.2",
"typescript": "^3.9.3"
"@pushrocks/smartfile": "^6.0.3",
"ts-node": "^7.0.0",
"typescript": "^2.9.2"
},
"private": false,
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
]
"private": false
}

View File

@ -1,50 +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 | [![pipeline status](https://gitlab.com/gitzone/tsrun/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/gitzone/tsrun/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@gitzone/tsrun)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/gitzone/tsrun)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@gitzone/tsrun)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@gitzone/tsrun)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@gitzone/tsrun)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](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 | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

10
scripts/postinstall.ts Normal file
View 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();

View File

@ -1,33 +1,32 @@
import * as path from 'path';
import * as tsNode from 'ts-node';
import { CompilerOptions } from 'typescript';
import * as path from "path";
import * as tsNode from "ts-node";
const defaultTsNodeOptions: tsNode.CreateOptions = {
const tsCacheDir = path.join(__dirname, "../tscache");
const defaultTsNodeOptions: tsNode.Options = {
compilerOptions: {
lib: ['es2017'],
target: <any>'es2017', // Script Target should be a string -> 2 is for ES2015
experimentalDecorators: true,
esModuleInterop: true
} as CompilerOptions,
skipIgnore: true
lib: ["es2016", "es2017"],
target: "es2015"
},
skipIgnore: true,
cacheDirectory: tsCacheDir
};
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
// 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);
export const runCli = async () => {
if (process.env.CLI_CALL_TSRUN) {
// contents of argv array
// process.argv[0] -> node Executable
// process.argv[1] -> tsrun executable
@ -35,4 +34,4 @@ export const runCli = async () => {
const pathToLoad = path.join(process.cwd(), pathToTsFile);
import(pathToLoad);
};
}

View File

@ -1,17 +1,3 @@
{
"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"
"extends": "tslint-config-standard"
}