Compare commits

...

70 Commits

Author SHA1 Message Date
d15500d5a0 1.2.14 2021-06-23 15:30:55 +02:00
7e99fd703f fix(core): update 2021-06-23 15:30:55 +02:00
fa5462c0bc 1.2.13 2021-06-23 15:26:56 +02:00
f8736d3556 fix(core): update 2021-06-23 15:26:55 +02:00
45bba88f46 1.2.12 2020-06-01 19:38:19 +00:00
daafe0b6ff fix(core): update 2020-06-01 19:38:19 +00:00
3d905de2be 1.2.11 2020-06-01 19:37:12 +00:00
815008e881 fix(core): update 2020-06-01 19:37:11 +00:00
4641cc7cad 1.2.10 2020-06-01 18:32:33 +00:00
dbf324682c fix(core): update 2020-06-01 18:32:33 +00:00
8f5c302b6c 1.2.9 2020-06-01 18:19:37 +00:00
e5bf2ac20c fix(core): update 2020-06-01 18:19:37 +00:00
731931452a 1.2.8 2019-07-17 13:26:52 +02:00
0b3730f7e5 fix(core): update 2019-07-17 13:26:52 +02:00
aecc54aab0 1.2.7 2019-07-17 13:22:38 +02:00
e3fa66ff07 fix(core): update 2019-07-17 13:22:38 +02:00
bb3b918521 1.2.6 2019-04-30 12:33:08 +02:00
ba9eaa5091 fix(core): update 2019-04-30 12:33:07 +02:00
0e281ab257 1.2.5 2019-04-08 17:10:10 +02:00
0e14522287 fix(core): update 2019-04-08 17:10:10 +02:00
4d93e2e728 1.2.4 2019-04-08 17:08:27 +02:00
ce9a350521 fix(core): update 2019-04-08 17:08:26 +02:00
df9c7204c7 1.2.3 2019-04-08 16:30:24 +02:00
568472e715 fix(core): update ES2017 2019-04-08 16:30:24 +02:00
0ba6863e28 1.2.2 2019-04-08 16:17:58 +02:00
d5c63cd24c fix(core): update 2019-04-08 16:17:57 +02:00
460babd675 1.2.1 2019-03-02 23:03:06 +01:00
98cde0edb4 fix(readme): update 2019-03-02 23:03:05 +01:00
1d5766435a 1.2.0 2019-03-02 22:38:01 +01:00
92ac844954 feat(dependencies and cache): remove caching 2019-03-02 22:38:01 +01:00
9ae4f9f82b 1.1.17 2018-12-06 00:46:26 +01:00
3df2922085 fix(core): update 2018-12-06 00:46:26 +01:00
3eb29c729e 1.1.16 2018-12-06 00:26:17 +01:00
cadc2cd629 fix(core): update 2018-12-06 00:26:17 +01:00
399ee0b4ca 1.1.15 2018-12-06 00:22:12 +01:00
ac5d8d1614 fix(core): update 2018-12-06 00:22:12 +01:00
6349753cce 1.1.14 2018-12-06 00:21:20 +01:00
3897e15a7e fix(core): update 2018-12-06 00:21:20 +01:00
2582710e8f 1.1.13 2018-10-14 18:51:41 +02:00
4cd06d040d 1.1.12 2018-08-08 23:14:11 +02:00
5eb3ba901a fix(dependencies): update 2018-08-08 23:14:11 +02:00
dd5b101224 1.1.11 2018-08-08 22:36:17 +02:00
972583a3a7 fix(CI): remove obsolete build dependencies 2018-08-08 22:36:16 +02:00
ef3c636976 1.1.10 2018-08-08 22:33:07 +02:00
b1ec59e042 fix(dependencies): update 2018-08-08 22:33:07 +02:00
84275f6804 1.1.9 2018-07-13 23:16:45 +02:00
b02edb7536 fix(core): add readme 2018-07-13 23:16:45 +02:00
4624cce39a 1.1.8 2018-07-13 23:14:45 +02:00
d4938f12cd fix(documentation): update 2018-07-13 23:14:45 +02:00
78157d474a 1.1.7 2018-07-13 23:01:10 +02:00
8f4f22b83f fix(core): update 2018-07-13 23:01:09 +02:00
90a97cb0eb 1.1.6 2018-07-13 22:51:10 +02:00
5bacff743d fix(core): update 2018-07-13 22:51:10 +02:00
f5d4b9ff5b 1.1.5 2018-07-13 22:37:56 +02:00
4e68019aa9 fix(add typedoc): update 2018-07-13 22:37:55 +02:00
022a919adf 1.1.4 2018-07-13 22:33:10 +02:00
d52315382e 1.1.3 2018-07-13 22:33:03 +02:00
5210b09c04 fix(core): update 2018-07-13 22:33:02 +02:00
8e2695a06f 1.1.2 2018-07-09 00:00:08 +02:00
7e8fe1bcba fix(typescript): add experimentalDecorators = true to CompilerOptions 2018-07-09 00:00:07 +02:00
c603ae0c87 1.1.1 2018-07-03 14:44:58 +02:00
4e70a1ef1a fix(CI): update default ci config 2018-07-03 14:44:57 +02:00
74df4b7b2b 1.1.0 2018-07-03 14:40:59 +02:00
51808f230a feat(cache): enable --nocache cli option 2018-07-03 14:40:58 +02:00
42f2f132f1 1.0.18 2018-07-02 09:05:03 +02:00
a3fb24eba3 revert(go back to standard node) 2018-07-02 09:03:26 +02:00
cf89601f28 1.0.17 2018-07-01 17:44:24 +02:00
da899b29bb fix(nodedistribution) 2018-07-01 17:44:12 +02:00
9e94bc56ff 1.0.16 2018-07-01 17:30:09 +02:00
cd549b8aaf fix(ts-node): patch error 2018-07-01 17:30:05 +02:00
18 changed files with 2806 additions and 480 deletions

17
.gitignore vendored
View File

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

View File

@ -1,10 +1,10 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
key: '$CI_BUILD_STAGE'
stages:
- security
@ -19,56 +19,62 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
snyk:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
- npmci npm prepare
- 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
- 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
# ====================
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:
stage: test
script:
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
@ -78,6 +84,7 @@ release:
only:
- tags
tags:
- lossless
- docker
- notpriv
@ -86,20 +93,16 @@ release:
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
only:
- tags
script:
- 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]
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
@ -110,16 +113,20 @@ trigger:
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g npmpage
- npmci command npmpage
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
@ -128,3 +135,4 @@ pages:
expire_in: 1 week
paths:
- public
allow_failure: true

4
.snyk
View File

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

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

5
cli.ts.js Normal file
View File

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

View File

@ -1 +0,0 @@
.gitignore: ../gitignore/

1
dist/index.d.ts vendored
View File

@ -1 +0,0 @@
export {};

20
dist/index.js vendored
View File

@ -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==

View File

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

2826
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,44 @@
{
"name": "@gitzone/tsrun",
"version": "1.0.15",
"version": "1.2.14",
"description": "run typescript programs efficiently",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"bin": {
"tsrun": "./cli.js"
},
"scripts": {
"test": "(npmts --notest && node ./cli.js test/test.ts)",
"test": "(tsbuild && node ./cli.js test/test.ts)",
"format": "(gitzone format)",
"build": "echo \"Not needed for now\"",
"postinstall": "ts-node --skip-ignore true --compilerOptions '{\"lib\": [\"ES2015\"]}' scripts/postinstall.ts"
"build": "(tsbuild)"
},
"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": {
"smartfile": "^4.2.28",
"ts-node": "^6.1.0",
"typescript": "^2.9.1"
"@pushrocks/smartfile": "^8.0.10",
"ts-node": "^10.0.0",
"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
View 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 | [![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 | **©** [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)

View File

@ -1,10 +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');
await smartfile.fs.ensureEmptyDir(tsCacheDir);
}
run()

View File

@ -1,20 +1,41 @@
import * as tsNode from 'ts-node';
import * as path from 'path';
import * as tsNode from 'ts-node';
import { CompilerOptions } from 'typescript';
tsNode.register({
const defaultTsNodeOptions: tsNode.CreateOptions = {
compilerOptions: {
lib: [ 'es2016', 'es2017' ]
},
ignore: ['^(.(.*\.d\.ts))*$'],
cacheDirectory: path.join(__dirname, '../tscache')
});
lib: ['es2017'],
target: <any>'es2017', // Script Target should be a string -> 2 is for ES2015
experimentalDecorators: true,
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
// process.argv[0] -> node Executable
// process.argv[1] -> tsrun executable
const pathToTsFile = process.argv[2]
const pathToTsFile = process.argv[2];
const pathToLoad = path.join(process.cwd(), pathToTsFile);
console.log(process.argv);
process.argv.pop();
console.log(process.argv);
import(pathToLoad);
}
};

View File

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