Compare commits

..

No commits in common. "master" and "v1.2.0" have entirely different histories.

28 changed files with 1502 additions and 1761 deletions

View File

@ -1,66 +0,0 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: code.foss.global/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -1,124 +0,0 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: code.foss.global/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

17
.gitignore vendored
View File

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

142
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,142 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- metadata
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
stage: security
script:
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# 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:
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
only:
- tags
tags:
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
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]
tags:
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g typedoc typescript
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- 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

4
.snyk Normal file
View File

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

11
.vscode/launch.json vendored
View File

@ -1,11 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

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", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2018 Task Venture Capital GmbH (hello@task.vc) Copyright (c) 2018 Lossless GmbH (hello@lossless.com)
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -1,138 +0,0 @@
# Changelog
## 2024-10-27 - 1.3.3 - fix(core)
removed unused import statement in ts/plugins.ts
- Cleanup: Removed an unused import statement for tsImport from tsx/esm/api
## 2024-10-27 - 1.3.2 - fix(core)
Replace ts-node with tsx for module handling
- Removed ts-node and its loader, using tsx for module imports
- Simplified import logic by replacing tsx register API call
- Updated dependencies in package.json by removing ts-node and typescript
## 2024-10-27 - 1.3.1 - fix(core)
Add console.log to show ts-node options in use
- Added a console log statement in the ts/loader.ts to display the default ts-node options being used.
## 2024-10-27 - 1.3.0 - feat(ci)
Add Gitea workflows for build and release.
- Added .gitea/workflows/default_nottags.yaml for non-tag events.
- Added .gitea/workflows/default_tags.yaml for tag-based events.
- Updated build scripts in package.json to use pnpm.
- Refactored imports and exports in TypeScript source for better modularity.
## 2024-06-24 - 1.2.49 - fix(core)
Minor maintenance updates with version bump
## 2024-06-24 - 1.2.48 - fix(dependencies)
Update TypeScript dependency version
- Updated TypeScript from version 5.4.5 to 5.5.2 to include latest features and fixes.
## 2024-06-24 - 1.2.47 - fix(core)
Remove GitLab CI configuration and update dependencies
- Removed the .gitlab-ci.yml file.
- Updated @git.zone/tsbuild from ^2.1.69 to ^2.1.80.
- Updated @push.rocks/smartcli from ^4.0.8 to ^4.0.11.
- Updated @types/node from ^20.5.6 to ^20.14.8.
- Updated @push.rocks/smartfile from ^10.0.30 to ^11.0.21.
- Updated @push.rocks/smartshell from ^3.0.3 to ^3.0.5.
- Updated ts-node from ^10.9.1 to ^10.9.2.
- Updated typescript from 5.1.6 to 5.4.5.
## 2023-08-26 - 1.2.44 to 1.2.46 - Core Updates and Fixes
Several internal updates and fixes to the core functionality.
- Continuous core updates for improved performance and bug fixes
## 2023-07-13 - 1.2.42 to 1.2.44 - Core Updates and Fixes
Addressing minor bugs and improving core operations.
- Several bug fixes to enhance stability
## 2023-06-03 - 1.2.39 to 1.2.42 - Core and Stability Improvements
Focus on refining core processes and fixing issues.
- Significant fixes for better core performance
## 2022-10-12 - 1.2.37 to 1.2.39 - Core Updates
Series of bug fixes to maintain core functionality.
- Addressed minor bugs in core areas
## 2022-06-02 - 1.2.34 to 1.2.37 - Core Maintenance
Routine updates to address and fix core issues.
- Bug fixes for better core stability
## 2022-03-11 to 2022-03-13 - 1.2.18 to 1.2.33 - Core Enhancements
Multiple updates focusing on resolving core issues and maintaining performance.
- Continuous improvements and fixes in the core functions
## 2021-10-06 - 1.2.18 to 1.2.19 - Core Updates
Minor fixes to keep up with core performance.
- Addressed core issues for improved functionality
## 2021-06-23 to 2021-06-24 - 1.2.12 to 1.2.17 - Core Improvements
Series of updates addressing core functionality.
- Enhanced core features and fixed known bugs
## 2020-06-01 - 1.2.8 to 1.2.11 - Core Stability
Fixes focusing on ensuring core stability.
- Stability improvements in core components
## 2019-07-17 - 1.2.6 to 1.2.7 - Core Updates
Minor fixes targeting the core framework.
- Adjusted core components to enhance performance
## 2019-04-08 to 2019-07-17 - 1.2.2 to 1.2.6 - ES2017 Compatibility and Core Fixes
Updated core to support ES2017 and addressed various core issues.
- Updated environment compatibility
- Fixed several core issues
## 2018-12-06 - 1.1.13 to 1.1.17 - Core Fixes
Routine updates addressing core bugs and issues.
- Multiple fixes to core functionality
## 2018-08-08 - 1.1.11 to 1.1.12 - Dependency Updates
Updated dependencies critical for core performance.
- Enhanced dependencies for better performance
## 2018-07-13 - 1.1.4 to 1.1.10 - Various Updates
Multiple updates focused on documentation, dependencies, and core functions.
- Fixed documentation
- Updated core
- Removed obsolete dependencies
## 2018-06-30 to 2018-07-03 - 1.0.8 to 1.1.3 - Feature and Core Fixes
Introduced new features and addressed core issues.
- Enabled new CLI options
- Resolved core issues for better functionality
## 2018-06-25 - 1.0.4 to 1.0.7 - Core and Security Improvements
Made core improvements and updated security features.
- Added security files
- Fixed core argument parsing issues
## 2018-06-04 - 1.0.1 to 1.0.3 - Initial Fixes and Improvements
Initial setup and fixes to existing issues.
- Moved dependencies to dev
- Fixed package details

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
process.env.CLI_CALL = 'true';
import * as cliTool from './ts/index.js';
cliTool.runCli();

5
cli.js
View File

@ -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 = await import('./dist_ts/index.js'); var index = require("./dist/index.js");
cliTool.runCli();

View File

@ -1,5 +0,0 @@
#!/usr/bin/env node
process.env.CLI_CALL = 'true';
import * as tsrun from '@gitzone/tsrun';
tsrun.runPath('./cli.child.js', import.meta.url);

1
dependencies.yml Normal file
View File

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

1
dist/index.d.ts vendored Normal file
View File

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

29
dist/index.js vendored Normal file
View File

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const tsNode = require("ts-node");
const defaultTsNodeOptions = {
compilerOptions: {
lib: ['es2016', 'es2017'],
target: 'es2015',
experimentalDecorators: true
},
skipIgnore: true
};
if (process.argv.includes('--web')) {
const previousCompilerOptions = defaultTsNodeOptions.compilerOptions;
defaultTsNodeOptions.compilerOptions = Object.assign({}, previousCompilerOptions, { lib: [...previousCompilerOptions.lib, 'dom'] });
}
if (process.argv.includes('--nocache')) {
// currently caching is not used
}
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixrQ0FBa0M7QUFHbEMsTUFBTSxvQkFBb0IsR0FBbUI7SUFDM0MsZUFBZSxFQUFtQjtRQUNoQyxHQUFHLEVBQUUsQ0FBQyxRQUFRLEVBQUUsUUFBUSxDQUFDO1FBQ3pCLE1BQU0sRUFBTyxRQUFRO1FBQ3JCLHNCQUFzQixFQUFFLElBQUk7S0FDN0I7SUFDRCxVQUFVLEVBQUUsSUFBSTtDQUNqQixDQUFDO0FBRUYsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUMsRUFBRTtJQUNsQyxNQUFNLHVCQUF1QixHQUFHLG9CQUFvQixDQUFDLGVBQWtDLENBQUM7SUFDeEYsb0JBQW9CLENBQUMsZUFBZSxxQkFDL0IsdUJBQXVCLElBQzFCLEdBQUcsRUFBRSxDQUFDLEdBQUcsdUJBQXVCLENBQUMsR0FBRyxFQUFFLEtBQUssQ0FBQyxHQUM3QyxDQUFBO0NBQ0Y7QUFFRCxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQyxFQUFFO0lBQ3RDLGdDQUFnQztDQUNqQztBQUVELE1BQU0sQ0FBQyxRQUFRLENBQUMsb0JBQW9CLENBQUMsQ0FBQztBQUV0QyxJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxFQUFFO0lBQzlCLHlCQUF5QjtJQUN6QixxQ0FBcUM7SUFDckMsc0NBQXNDO0lBQ3RDLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFFckMsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEVBQUUsWUFBWSxDQUFDLENBQUM7SUFDMUQscUNBQU8sVUFBVSxHQUFFO0NBQ3BCIn0=

View File

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

1250
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,54 +1,29 @@
{ {
"name": "@git.zone/tsrun", "name": "@gitzone/tsrun",
"version": "1.3.3", "version": "1.2.0",
"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",
"type": "module",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"tsrun": "./cli.js" "tsrun": "./cli.js"
}, },
"scripts": { "scripts": {
"test": "(pnpm run build && node ./cli.js test/test.js sayhello)", "test": "(tsbuild && node ./cli.js test/test.ts)",
"format": "(gitzone format)", "format": "(gitzone format)",
"build": "(tsbuild --web --allowimplicitany)", "build": "(tsbuild)"
"buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.80", "@types/node": "^11.10.4",
"@push.rocks/smartcli": "^4.0.11", "tslint": "^5.13.1",
"@types/node": "^20.14.8", "tslint-config-prettier": "^1.18.0"
"node-fetch": "^3.3.2"
}, },
"dependencies": { "dependencies": {
"@push.rocks/smartfile": "^11.0.21", "@gitzone/tsbuild": "^2.1.8",
"@push.rocks/smartshell": "^3.0.5", "@pushrocks/smartfile": "^7.0.0",
"tsx": "^4.19.2" "ts-node": "^8.0.2",
"typescript": "^3.3.3333"
}, },
"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"
],
"repository": {
"type": "git",
"url": "git+https://gitlab.com/gitzone/tsrun.git"
},
"bugs": {
"url": "https://gitlab.com/gitzone/tsrun/issues"
},
"homepage": "https://gitlab.com/gitzone/tsrun#readme"
} }

1221
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

View File

@ -1,28 +1,25 @@
# @gitzone/tsrun # tsrun
run typescript programs efficiently run typescript programs efficiently
## Availabililty and Links ## Availabililty
- [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsrun) [![npm](https://gitzone.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/@gitzone/tsrun)
- [gitlab.com (source)](https://gitlab.com/gitzone/tsrun) [![git](https://gitzone.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/gitzone/tsrun)
- [github.com (source mirror)](https://github.com/gitzone/tsrun) [![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzone/tsrun)
- [docs (typedoc)](https://gitzone.gitlab.io/tsrun/) [![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.gitlab.io/tsrun/)
## Status for master ## Status for master
| Status Category | Status Badge | [![build status](https://GitLab.com/gitzone/tsrun/badges/master/build.svg)](https://GitLab.com/gitzone/tsrun/commits/master)
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | [![coverage report](https://GitLab.com/gitzone/tsrun/badges/master/coverage.svg)](https://GitLab.com/gitzone/tsrun/commits/master)
| GitLab Pipelines | [![pipeline status](https://gitlab.com/gitzone/tsrun/badges/master/pipeline.svg)](https://lossless.cloud) | [![npm downloads per month](https://img.shields.io/npm/dm/@gitzone/tsrun.svg)](https://www.npmjs.com/package/@gitzone/tsrun)
| GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/gitzone/tsrun/badges/master/coverage.svg)](https://lossless.cloud) | [![bitHound Dependencies](https://www.bithound.io/github/gitzonetools/tsrun/badges/dependencies.svg)](https://www.bithound.io/github/gitzonetools/tsrun/master/dependencies/npm)
| npm | [![npm downloads per month](https://badgen.net/npm/dy/@gitzone/tsrun)](https://lossless.cloud) | [![bitHound Code](https://www.bithound.io/github/gitzonetools/tsrun/badges/code.svg)](https://www.bithound.io/github/gitzonetools/tsrun)
| Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/gitzone/tsrun)](https://lossless.cloud) | [![Known Vulnerabilities](https://snyk.io/test/npm/@gitzone/tsrun/badge.svg)](https://snyk.io/test/npm/@gitzone/tsrun)
| TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) | [![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
| node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) | [![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
| Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) | [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
| 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) |
## Usage ## Usage
@ -34,17 +31,13 @@ To simply run a TypeScript file on the fly type
tsrun myfiletorun.ts tsrun myfiletorun.ts
``` ```
There are options available: There are two options available:
* `--nocache` will disable any caching. Caching speeds up execution, but causes problems in read only environments (e.g. sometimes docker containers are readonly)
* `--web` will inject browser types. this is useful when testing code with polyfills on node, but that is meant for the browser later on.
- `--web` will inject browser types. this is useful when testing code with polyfills on node, but that is meant for the browser later on. For further information read the linked docs at the top of this README.
## Contribution > licensed | **©** [Lossless GmbH](https://lossless.gmbh)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
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). :) [![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://git.zone)
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)

View File

@ -1,14 +1,2 @@
const textToPost: string = 'Test runs!'; const textToPost: string = 'Test runs!';
console.log(textToPost); 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();

View File

@ -1,8 +0,0 @@
/**
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@git.zone/tsrun',
version: '1.3.3',
description: 'run typescript programs efficiently'
}

View File

@ -1,28 +1,36 @@
import * as plugins from './plugins.js'; import * as path from 'path';
const __dirname = plugins.path.dirname(plugins.url.fileURLToPath(import.meta.url)); import * as tsNode from 'ts-node';
import { CompilerOptions } from 'typescript';
export const runPath = async (pathArg: string, fromFileUrl?: string) => { const defaultTsNodeOptions: tsNode.Options = {
pathArg = fromFileUrl compilerOptions: <CompilerOptions>{
? plugins.path.join(plugins.path.dirname(plugins.url.fileURLToPath(fromFileUrl)), pathArg) lib: ['es2016', 'es2017'],
: pathArg; target: <any>'es2015', // Script Target should be a string -> 2 is for ES2015
await runCli(pathArg); experimentalDecorators: true
},
skipIgnore: true
}; };
export const runCli = async (pathArg?: string) => { if (process.argv.includes('--web')) {
const previousCompilerOptions = defaultTsNodeOptions.compilerOptions as CompilerOptions;
defaultTsNodeOptions.compilerOptions = {
...previousCompilerOptions,
lib: [...previousCompilerOptions.lib, 'dom']
}
}
if (process.argv.includes('--nocache')) {
// currently caching is not used
}
tsNode.register(defaultTsNodeOptions);
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 relativePathToTsFile = pathArg ? pathArg : process.argv[2]; const pathToTsFile = 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. const pathToLoad = path.join(process.cwd(), pathToTsFile);
// when we have a path sepcified through a function there is one argeument less to pay respect to. import(pathToLoad);
// 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
const tsx = await import('tsx/esm/api');
const unregister = tsx.register();
await import(absolutePathToTsFile);
};

View File

@ -1 +0,0 @@
export const cwd = process.cwd();

View File

@ -1,11 +0,0 @@
// node native
import * as path from 'path';
import * as url from 'url';
export { path, url };
// @pushrocks scope
import * as smartfile from '@push.rocks/smartfile';
import * as smartshell from '@push.rocks/smartshell';
export { smartfile, smartshell };

View File

@ -1,14 +0,0 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}