Compare commits
149 Commits
Author | SHA1 | Date | |
---|---|---|---|
5efd905068 | |||
ae01679474 | |||
f0bdfa9a65 | |||
a88cf067a1 | |||
c5cd30e20e | |||
02eb0c5435 | |||
6ab3ed21e0 | |||
2f5374be50 | |||
1577265f6b | |||
3b9532bb70 | |||
bcb1ccc6e7 | |||
1dde4c8277 | |||
3a6fc44fbb | |||
a0d523513b | |||
0715f88189 | |||
4a50ae3b00 | |||
2b7c3b78f6 | |||
142667ac87 | |||
9e55126adf | |||
5271f0153e | |||
ba0aaf2793 | |||
1f46e387e7 | |||
03625bfca4 | |||
cc92e3e9ca | |||
c1e66d498a | |||
bfbb802e88 | |||
655fd8b92e | |||
a240cdfde1 | |||
2af7682cf0 | |||
c62619bd27 | |||
ffaf54f1de | |||
2c6b955819 | |||
9bb13e1ede | |||
d9bd5e5340 | |||
b76de3e04d | |||
808726d1df | |||
d011f10b9b | |||
d1baa20aad | |||
71779693d7 | |||
1113251aea | |||
e41cd896bb | |||
ba44007fb2 | |||
8d1362f14b | |||
61ceb03962 | |||
ab3ec90245 | |||
b51cda08c4 | |||
b8332e1de4 | |||
da9a73bc79 | |||
26bf39abae | |||
b66b2083ab | |||
e40c0151bc | |||
fe97fcd193 | |||
5174d9ccc6 | |||
e89c3eda66 | |||
6d4c9f390a | |||
3fc3421857 | |||
e1803dabfa | |||
282d8b2b93 | |||
76dd9707fe | |||
269e54c717 | |||
dd33a359c3 | |||
0caaac2a67 | |||
14a043be1e | |||
de44be741d | |||
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 | |||
d07c7a74e8 | |||
69f6f7460f | |||
f01e07933e | |||
51b5343440 | |||
6815f9bd5d | |||
1b68c19d92 | |||
51cc29d79b | |||
39d94a3daa | |||
c46fcb6ea3 |
16
.gitignore
vendored
16
.gitignore
vendored
@ -1,6 +1,20 @@
|
||||
.nogit/
|
||||
node_modules/
|
||||
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
|
||||
# caches
|
||||
.yarn/
|
||||
.cache/
|
||||
.rpt2_cache
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_*/
|
||||
|
||||
# custom
|
134
.gitlab-ci.yml
134
.gitlab-ci.yml
@ -1,125 +1,122 @@
|
||||
# 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"
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- pnpm install -g pnpm
|
||||
- pnpm install -g @shipzone/npmci
|
||||
- npmci npm prepare
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --prod
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
snyk:
|
||||
auditDevDependencies:
|
||||
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 command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --dev
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- 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:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
- docker
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
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 typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- 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 stable
|
||||
- npmci npm install
|
||||
- npmci command npm run buildDocs
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
@ -127,4 +124,5 @@ pages:
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
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: {}
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "npm test",
|
||||
"name": "Run npm test",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
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.
|
4
cli.child.ts
Normal file
4
cli.child.ts
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
import * as cliTool from './ts/index.js';
|
||||
cliTool.runCli();
|
4
cli.js
Normal file
4
cli.js
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
const cliTool = await import('./dist_ts/index.js');
|
||||
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';
|
||||
|
||||
import * as tsrun from '@gitzone/tsrun';
|
||||
tsrun.runPath('./cli.child.js', import.meta.url);
|
@ -1 +0,0 @@
|
||||
.gitignore: ../gitignore/
|
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");
|
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
18
dist/index.js
vendored
18
dist/index.js
vendored
@ -1,18 +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']
|
||||
}
|
||||
});
|
||||
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtDQUFrQztBQUNsQyw2QkFBNkI7QUFFN0IsTUFBTSxDQUFDLFFBQVEsQ0FBQztJQUNkLGVBQWUsRUFBRTtRQUNmLEdBQUcsRUFBRSxDQUFFLFFBQVEsRUFBRSxRQUFRLENBQUU7S0FDNUI7Q0FDRixDQUFDLENBQUM7QUFFSCxJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxFQUFFO0lBQzlCLHlCQUF5QjtJQUN6QixxQ0FBcUM7SUFDckMsc0NBQXNDO0lBQ3RDLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFFcEMsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEVBQUUsWUFBWSxDQUFDLENBQUM7SUFDMUQscUNBQU8sVUFBVSxHQUFFO0NBQ3BCIn0=
|
@ -1,12 +1,18 @@
|
||||
{
|
||||
"npmts": {
|
||||
"cli": true
|
||||
},
|
||||
"npmts": {},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [
|
||||
"@gitzone/npmts",
|
||||
"ts-node"
|
||||
],
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"gitzone": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "gitzone",
|
||||
"gitrepo": "tsrun",
|
||||
"description": "run typescript programs efficiently",
|
||||
"npmPackagename": "@gitzone/tsrun",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
92
package-lock.json
generated
92
package-lock.json
generated
@ -1,92 +0,0 @@
|
||||
{
|
||||
"name": "@gitzone/tsrun",
|
||||
"version": "1.0.8",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "10.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.3.0.tgz",
|
||||
"integrity": "sha512-hWzNviaVFIr1TqcRA8ou49JaSHp+Rfabmnqg2kNvusKqLhPU0rIsGPUj5WJJ7ld4Bb7qdgLmIhLfCD1qS08IVA==",
|
||||
"dev": true
|
||||
},
|
||||
"arrify": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
|
||||
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0="
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz",
|
||||
"integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ=="
|
||||
},
|
||||
"diff": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
|
||||
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA=="
|
||||
},
|
||||
"make-error": {
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz",
|
||||
"integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g=="
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
}
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz",
|
||||
"integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==",
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-6.1.0.tgz",
|
||||
"integrity": "sha512-mw11Bq08RZgrU/bzcVw/Ti9wNyefpOanXgWsHg008wyVHjvFhWxNatVVrciOAu8BcWSECoNOSunRzUokKH8Mmw==",
|
||||
"requires": {
|
||||
"arrify": "^1.0.0",
|
||||
"diff": "^3.1.0",
|
||||
"make-error": "^1.1.1",
|
||||
"minimist": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"source-map-support": "^0.5.6",
|
||||
"yn": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
|
||||
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA=="
|
||||
},
|
||||
"yn": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
|
||||
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo="
|
||||
}
|
||||
}
|
||||
}
|
44
package.json
44
package.json
@ -1,25 +1,47 @@
|
||||
{
|
||||
"name": "@gitzone/tsrun",
|
||||
"version": "1.0.8",
|
||||
"name": "@git.zone/tsrun",
|
||||
"version": "1.2.46",
|
||||
"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",
|
||||
"type": "module",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"tsrun": "dist/cli.js"
|
||||
"tsrun": "./cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(npmts --notest && node dist/cli.js test/test.ts)",
|
||||
"test": "(tsbuild && node ./cli.js test/test.js sayhello)",
|
||||
"format": "(gitzone format)",
|
||||
"build": "echo \"Not needed for now\""
|
||||
"build": "(tsbuild)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.3.0"
|
||||
"@git.zone/tsbuild": "^2.1.69",
|
||||
"@push.rocks/smartcli": "^4.0.8",
|
||||
"@types/node": "^20.5.6",
|
||||
"node-fetch": "^3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ts-node": "^6.1.0",
|
||||
"typescript": "^2.9.1"
|
||||
"@push.rocks/smartfile": "^10.0.30",
|
||||
"@push.rocks/smartshell": "^3.0.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
|
1136
pnpm-lock.yaml
generated
Normal file
1136
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
47
readme.md
Normal file
47
readme.md
Normal file
@ -0,0 +1,47 @@
|
||||
# @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)
|
||||
|
||||
## 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.
|
||||
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
12
test/test.ts
12
test/test.ts
@ -1,2 +1,14 @@
|
||||
const textToPost: string = 'Test runs!';
|
||||
console.log(textToPost);
|
||||
|
||||
const run = async () => {
|
||||
const smartcli = await import('@push.rocks/smartcli');
|
||||
const smartcliInstance = new smartcli.Smartcli();
|
||||
console.log(process.argv);
|
||||
smartcliInstance.addCommand('sayhello').subscribe(async (argvArg) => {
|
||||
console.log('hello there');
|
||||
});
|
||||
smartcliInstance.startParse();
|
||||
};
|
||||
|
||||
run();
|
||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsrun',
|
||||
version: '1.2.46',
|
||||
description: 'run typescript programs efficiently'
|
||||
}
|
50
ts/index.ts
50
ts/index.ts
@ -1,18 +1,42 @@
|
||||
import * as tsNode from 'ts-node';
|
||||
import * as path from 'path';
|
||||
import * as plugins from './plugins.js';
|
||||
const __dirname = plugins.path.dirname(plugins.url.fileURLToPath(import.meta.url));
|
||||
|
||||
tsNode.register({
|
||||
compilerOptions: {
|
||||
lib: [ 'es2016', 'es2017' ]
|
||||
}
|
||||
});
|
||||
export const runPath = async (pathArg: string, fromFileUrl?: string) => {
|
||||
pathArg = fromFileUrl
|
||||
? plugins.path.join(plugins.path.dirname(plugins.url.fileURLToPath(fromFileUrl)), pathArg)
|
||||
: pathArg;
|
||||
await runCli(pathArg);
|
||||
};
|
||||
|
||||
if (process.env.CLI_CALL_TSRUN) {
|
||||
export const runCli = async (pathArg?: string) => {
|
||||
// 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);
|
||||
}
|
||||
const relativePathToTsFile = pathArg ? pathArg : process.argv[2];
|
||||
const absolutePathToTsFile = plugins.path.isAbsolute(relativePathToTsFile)
|
||||
? relativePathToTsFile
|
||||
: plugins.path.join(process.cwd(), relativePathToTsFile);
|
||||
|
||||
// we want to have command line arguments available in the child process.
|
||||
// when we have a path sepcified through a function there is one argeument less to pay respect to.
|
||||
// thus when pathArg is specifed -> we only splice 2
|
||||
pathArg ? process.argv.splice(0, 2) : process.argv.splice(0, 3); // this ensures transparent arguments for the child process
|
||||
|
||||
// lets setup things for execution
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash',
|
||||
});
|
||||
|
||||
const tsNodeLoaderPath = plugins.path.join(__dirname, 'loader.js');
|
||||
// note: -> reduce on emtpy array does not work
|
||||
// thus check needed before reducing the argv array
|
||||
smartshellInstance.exec(
|
||||
`node --loader ${tsNodeLoaderPath} ${absolutePathToTsFile} ${
|
||||
process.argv.length > 0
|
||||
? process.argv.reduce((prevArg, currentArg) => {
|
||||
return prevArg + ' ' + currentArg;
|
||||
})
|
||||
: ''
|
||||
}`
|
||||
);
|
||||
};
|
||||
|
23
ts/loader.ts
Normal file
23
ts/loader.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import type { CompilerOptions } from 'typescript';
|
||||
|
||||
const defaultTsNodeOptions: plugins.tsNode.CreateOptions = {
|
||||
compilerOptions: {
|
||||
lib: ['dom'],
|
||||
target: <any>'es2022', // Script Target should be a string -> 2 is for ES2015
|
||||
experimentalDecorators: true,
|
||||
useDefineForClassFields: false,
|
||||
esModuleInterop: true,
|
||||
strictNullChecks: false,
|
||||
moduleResolution: <any>'nodenext',
|
||||
module: <any>'nodenext',
|
||||
verbatimModuleSyntax: true,
|
||||
} as CompilerOptions,
|
||||
esm: true,
|
||||
skipIgnore: true,
|
||||
transpileOnly: true,
|
||||
};
|
||||
|
||||
export const { resolve, load, getFormat, transformSource } = plugins.tsNode.createEsmHooks(
|
||||
plugins.tsNode.register(defaultTsNodeOptions)
|
||||
) as any;
|
15
ts/plugins.ts
Normal file
15
ts/plugins.ts
Normal file
@ -0,0 +1,15 @@
|
||||
// node native
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
||||
export { path, url };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
|
||||
export { smartshell };
|
||||
|
||||
// third party scope
|
||||
import * as tsNode from 'ts-node';
|
||||
|
||||
export { tsNode };
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext"
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "tslint-config-standard"
|
||||
}
|
Reference in New Issue
Block a user