Compare commits

..

10 Commits

12 changed files with 1043 additions and 990 deletions

View File

@ -0,0 +1,66 @@
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

@ -0,0 +1,124 @@
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

View File

@ -1,5 +1,34 @@
# Changelog # 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) ## 2024-06-24 - 1.2.48 - fix(dependencies)
Update TypeScript dependency version Update TypeScript dependency version

View File

@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tsrun", "name": "@git.zone/tsrun",
"version": "1.2.48", "version": "1.3.3",
"description": "run typescript programs efficiently", "description": "run typescript programs efficiently",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
@ -11,9 +11,9 @@
"tsrun": "./cli.js" "tsrun": "./cli.js"
}, },
"scripts": { "scripts": {
"test": "(tsbuild && node ./cli.js test/test.js sayhello)", "test": "(pnpm run build && node ./cli.js test/test.js sayhello)",
"format": "(gitzone format)", "format": "(gitzone format)",
"build": "(tsbuild)", "build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "tsdoc" "buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
@ -25,8 +25,7 @@
"dependencies": { "dependencies": {
"@push.rocks/smartfile": "^11.0.21", "@push.rocks/smartfile": "^11.0.21",
"@push.rocks/smartshell": "^3.0.5", "@push.rocks/smartshell": "^3.0.5",
"ts-node": "^10.9.2", "tsx": "^4.19.2"
"typescript": "5.5.2"
}, },
"private": false, "private": false,
"files": [ "files": [
@ -43,5 +42,13 @@
], ],
"browserslist": [ "browserslist": [
"last 1 chrome versions" "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"
} }

1669
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,28 @@
# @gitzone/tsrun # @gitzone/tsrun
run typescript programs efficiently run typescript programs efficiently
## Availabililty and Links ## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsrun)
* [gitlab.com (source)](https://gitlab.com/gitzone/tsrun) - [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsrun)
* [github.com (source mirror)](https://github.com/gitzone/tsrun) - [gitlab.com (source)](https://gitlab.com/gitzone/tsrun)
* [docs (typedoc)](https://gitzone.gitlab.io/tsrun/) - [github.com (source mirror)](https://github.com/gitzone/tsrun)
- [docs (typedoc)](https://gitzone.gitlab.io/tsrun/)
## Status for master ## Status for master
Status Category | Status Badge | Status Category | Status Badge |
-- | -- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
GitLab Pipelines | [![pipeline status](https://gitlab.com/gitzone/tsrun/badges/master/pipeline.svg)](https://lossless.cloud) | 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) | 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) | 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) | 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) | 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/) | 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) | 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 (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) | 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) | BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@gitzone/tsrun)](https://lossless.cloud) |
## Usage ## Usage
@ -43,5 +45,6 @@ We are always happy for code contributions. If you are not the code contributing
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.
## Legal ## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) > MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tsrun', name: '@git.zone/tsrun',
version: '1.2.48', version: '1.3.3',
description: 'run typescript programs efficiently' description: 'run typescript programs efficiently'
} }

View File

@ -22,21 +22,7 @@ export const runCli = async (pathArg?: string) => {
// thus when pathArg is specifed -> we only splice 2 // 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 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 tsx = await import('tsx/esm/api');
const smartshellInstance = new plugins.smartshell.Smartshell({ const unregister = tsx.register();
executor: 'bash', await import(absolutePathToTsFile);
});
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;
})
: ''
}`
);
}; };

View File

@ -1,23 +0,0 @@
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;

1
ts/paths.ts Normal file
View File

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

View File

@ -5,11 +5,7 @@ import * as url from 'url';
export { path, url }; export { path, url };
// @pushrocks scope // @pushrocks scope
import * as smartfile from '@push.rocks/smartfile';
import * as smartshell from '@push.rocks/smartshell'; import * as smartshell from '@push.rocks/smartshell';
export { smartshell }; export { smartfile, smartshell };
// third party scope
import * as tsNode from 'ts-node';
export { tsNode };

View File

@ -3,7 +3,12 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"useDefineForClassFields": false, "useDefineForClassFields": false,
"target": "ES2022", "target": "ES2022",
"module": "ES2022", "module": "NodeNext",
"moduleResolution": "nodenext" "moduleResolution": "NodeNext",
} "esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
} }