Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9a12f1c17 | |||
| 6995010a2c | |||
| e0cbc9cfec | |||
| c538e6b10b | |||
| c31df766fc | |||
| 0c626c20e7 | |||
| c07f10b97b | |||
| 08d32f0370 | |||
| ac386f01e0 | |||
| 08ead4258f | |||
| f930f3a6a7 | |||
| b6d4a76c70 |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: code.foss.global/host.today/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
|
||||
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@@ -0,0 +1,124 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: code.foss.global/host.today/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
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -3,7 +3,6 @@
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
@@ -15,9 +14,11 @@ node_modules/
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
dist_*/
|
||||
|
||||
# custom
|
||||
# AI
|
||||
.claude/
|
||||
.serena/
|
||||
|
||||
#------# custom
|
||||
test
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
stages:
|
||||
- mirror
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
|
||||
mirror:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: mirror
|
||||
script:
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
tags:
|
||||
- docker
|
||||
- lossless
|
||||
- priv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
environment: npmjs-com_registry
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- lossless
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: trigger
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- lossless
|
||||
- priv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: pages
|
||||
script:
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci command tsdoc
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
25
.vscode/settings.json
vendored
25
.vscode/settings.json
vendored
@@ -1,3 +1,26 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
62
README.md
62
README.md
@@ -1,62 +0,0 @@
|
||||
# @gitzone/npmdocker
|
||||
develop npm modules cross platform with docker
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/npmdocker)
|
||||
* [gitlab.com (source)](https://gitlab.com/gitzone/npmdocker)
|
||||
* [github.com (source mirror)](https://github.com/gitzone/npmdocker)
|
||||
* [docs (typedoc)](https://gitzone.gitlab.io/npmdocker/)
|
||||
|
||||
## Status for master
|
||||
[](https://gitlab.com/gitzone/npmdocker/commits/master)
|
||||
[](https://gitlab.com/gitzone/npmdocker/commits/master)
|
||||
[](https://www.npmjs.com/package/@gitzone/npmdocker)
|
||||
[](https://snyk.io/test/npm/@gitzone/npmdocker)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://prettier.io/)
|
||||
|
||||
## Usage
|
||||
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
### Why does this package exist?
|
||||
|
||||
Sometimes you want a clean and fresh linux environment everytime you test your package.
|
||||
Usually this is the default i CI, but locally behaviour tends to defer.
|
||||
|
||||
### Where does it work
|
||||
|
||||
The npmdocker package works in everywhere where the docker cli is available. e.g.:
|
||||
|
||||
- docker toolbox
|
||||
- native docker application
|
||||
- docker in docker
|
||||
- mounted docker.sock
|
||||
|
||||
### How do I use it?
|
||||
|
||||
create a npmextra.json in the project's root directory
|
||||
|
||||
```json
|
||||
{
|
||||
"npmdocker": {
|
||||
"baseImage": "hosttoday/ht-docker-node:npmts",
|
||||
"command": "npmci test stable",
|
||||
"dockerSock": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| option | description |
|
||||
| ----------- | ------------------------------------------------------------------------------------- |
|
||||
| baseImage | the base image that is the context for your project |
|
||||
| command | the cli command to run within the the project's directory inside the docker container |
|
||||
| dockersSock | wether or not the testcontainer will have access to the docker.sock of the host |
|
||||
|
||||
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.html)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
@@ -1,5 +1,5 @@
|
||||
FROM hosttoday/ht-docker-node:npmci
|
||||
RUN yarn global add @gitzone/tsdocker
|
||||
RUN yarn global add @git.zone/tsdocker
|
||||
COPY ./ /workspace
|
||||
WORKDIR /workspace
|
||||
ENV CI=true
|
||||
|
||||
374
changelog.md
Normal file
374
changelog.md
Normal file
@@ -0,0 +1,374 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-01-19 - 1.3.0 - feat(packaging)
|
||||
Rename package scope to @git.zone and migrate to ESM; rename CLI/config keys, update entrypoints and imports, bump Node requirement to 18, and adjust scripts/dependencies
|
||||
|
||||
- Package renamed to @git.zone/tsdocker (scope change) — consumers must update package reference.
|
||||
- Configuration key changed from 'npmdocker' to '@git.zone/tsdocker' in npmextra.json; update project config accordingly.
|
||||
- CLI command renamed from 'npmdocker' to 'tsdocker' and entrypoint/entrypoint binary references updated.
|
||||
- Project migrated to ESM: imports now use .js extensions, package main/typings point to dist_ts, and ts source uses ESM patterns — Node >=18 required.
|
||||
- Build/test scripts changed to use tsx and updated test task names; CI/workflow and npmextra release registries updated.
|
||||
- Dependencies/devDependencies bumped; smartfs, smartcli and tsbuild versions updated.
|
||||
- Docker build command now uses '--load' and default base images/installation behavior adjusted (global install of tsdocker in image).
|
||||
|
||||
## 2025-12-13 - 1.2.43 - fix(packaging)
|
||||
|
||||
Rename package scope to @git.zone and migrate deps/CI; pin pnpm and enable ESM packaging
|
||||
|
||||
- Rename npm package scope from @gitzone/tsdocker to @git.zone/tsdocker (package.json, commitinfo, README, npmextra)
|
||||
- Migrate devDependencies from @gitzone/_ to @git.zone/_ and ensure runtime packages use @push.rocks/\* where applicable
|
||||
- Replace smartfile usage with smartfs and update code to use async smartfs.file(...).write()/delete() patterns
|
||||
- Add packageManager pin for pnpm, set type: "module", add files array and pnpm.overrides in package.json
|
||||
- Add tsconfig.json with NodeNext/ES2022 settings and other ESM-related adjustments
|
||||
- Add Gitea CI workflows (.gitea/workflows/default_tags.yaml and default_nottags.yaml) for test, audit and release flows
|
||||
- Update assets Dockerfile to reference @git.zone/tsdocker and other packaging/CI related scripts
|
||||
- Update .gitignore to consolidate dist patterns and add AI/tooling excludes (.claude/, .serena/)
|
||||
- Update README, readme.hints.md and changelog to document the scope rename, dependency migrations and SmartFS migration
|
||||
|
||||
## 2025-11-22 - 1.2.42 - fix(package.json)
|
||||
|
||||
Add packageManager field to package.json to pin pnpm version
|
||||
|
||||
- Add packageManager: "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" to package.json to lock pnpm CLI version and integrity
|
||||
|
||||
## 2025-11-22 - 1.2.41 - fix(core)
|
||||
|
||||
Migrate to @git.zone / @push.rocks packages, replace smartfile with smartfs and adapt filesystem usage; update dev deps and remove CI/lint config
|
||||
|
||||
- Updated devDependencies from @gitzone/_ to @git.zone/_ (tsbuild, tsrun, tstest) and bumped versions
|
||||
- Re-scoped runtime dependencies from @pushrocks/_ to @push.rocks/_ and updated package versions
|
||||
- Replaced deprecated smartfile usage with new async smartfs API; added SmartFs instance in ts/tsdocker.plugins.ts
|
||||
- Switched sync filesystem calls to Node fs where appropriate (fs.existsSync, fs.mkdirSync) and updated code to await smartfs.file(...).write()/delete()
|
||||
- Made buildDockerFile async and awaited file write/delete operations to ensure correct async flow
|
||||
- Updated CLI bootstrap to require @git.zone/tsrun in cli.ts.js
|
||||
- Removed tslint.json and cleaned up CI configuration (.gitlab-ci.yml content removed)
|
||||
- Added readme.hints.md describing the migration and dependency changes
|
||||
|
||||
## 2021-09-30 - 1.2.40 - release (no code changes)
|
||||
|
||||
Routine release tag with no recorded source changes.
|
||||
|
||||
- Tagged release only (no changelogged changes).
|
||||
|
||||
## 2021-09-30 - 1.2.39 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-28 - 1.2.38 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-27 - 1.2.37 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-27 - 1.2.36 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-21 - 1.2.35 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-21 - 1.2.34 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-12 - 1.2.33 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-12 - 1.2.32 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-12 - 1.2.31 - fix(bin name)
|
||||
|
||||
Rename of the published CLI binary.
|
||||
|
||||
- Changed published binary name from "npmdocker" to "tsdocker".
|
||||
|
||||
## 2019-05-10 - 1.2.30 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-10 - 1.2.29 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-10 - 1.2.28 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2019-05-09 - 1.2.27 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2018-10-29 - 1.2.26 - fix(ci)
|
||||
|
||||
CI build process change.
|
||||
|
||||
- Removed "npmts" from the build process.
|
||||
|
||||
## 2018-10-29 - 1.2.25 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2018-10-28 - 1.2.24 - fix(clean)
|
||||
|
||||
Improved image cleanup.
|
||||
|
||||
- Images are now cleaned in a more thorough way.
|
||||
|
||||
## 2018-09-16 - 1.2.23 - fix(core)
|
||||
|
||||
Core maintenance updates.
|
||||
|
||||
- Internal core updates and maintenance.
|
||||
|
||||
## 2018-09-16 - 1.2.22 - fix(dependencies)
|
||||
|
||||
Dependency updates.
|
||||
|
||||
- Updated dependencies (maintenance).
|
||||
|
||||
## 2018-07-21 - 1.2.21 - fix(update to latest standards)
|
||||
|
||||
Standards/update alignment.
|
||||
|
||||
- Updated codebase to latest standards (general maintenance).
|
||||
|
||||
## 2018-05-18 - 1.2.20 - release (no code changes)
|
||||
|
||||
Tagged release with no recorded source changes.
|
||||
|
||||
- Tagged release only (no changelogged changes).
|
||||
|
||||
## 2018-05-18 - 1.2.19 - fix(ci)
|
||||
|
||||
CI improvements.
|
||||
|
||||
- Added a build command to package.json to support CI builds.
|
||||
|
||||
## 2018-05-18 - 1.2.18 - fix(package)
|
||||
|
||||
Packaging change for scoped publish.
|
||||
|
||||
- Include npmdocker under the @git.zone npm scope.
|
||||
|
||||
## 2018-01-24 - 1.2.18 - update
|
||||
|
||||
Documentation update.
|
||||
|
||||
- Updated package description.
|
||||
|
||||
## 2017-10-13 - 1.2.17 - fix(cleanup)
|
||||
|
||||
Cleanup behavior fix.
|
||||
|
||||
- Now cleans up correctly after operations.
|
||||
|
||||
## 2017-10-13 - 1.2.16 - update
|
||||
|
||||
Miscellaneous updates.
|
||||
|
||||
- General maintenance and updates.
|
||||
|
||||
## 2017-10-13 - 1.2.15 - fix(test)
|
||||
|
||||
Testing improvements.
|
||||
|
||||
- Fixed Docker testing.
|
||||
|
||||
## 2017-10-07 - 1.2.14 - ci
|
||||
|
||||
CI improvements.
|
||||
|
||||
- Updated CI configuration.
|
||||
|
||||
## 2017-10-07 - 1.2.13 - update(analytics)
|
||||
|
||||
Analytics integration.
|
||||
|
||||
- Updated Analytics integration.
|
||||
|
||||
## 2017-10-07 - 1.2.12 - update(dependencies)
|
||||
|
||||
Dependency updates.
|
||||
|
||||
- Updated dependencies.
|
||||
|
||||
## 2017-07-16 - 1.2.11 - update
|
||||
|
||||
Dependency and greeting update.
|
||||
|
||||
- Updated dependencies and changed greeting text.
|
||||
|
||||
## 2017-04-21 - 1.2.10 - feature
|
||||
|
||||
Added analytics.
|
||||
|
||||
- Now includes SmartAnalytics.
|
||||
|
||||
## 2017-04-02 - 1.2.8 - docs & ci
|
||||
|
||||
Docs and CI updates.
|
||||
|
||||
- Updated README and CI configuration.
|
||||
|
||||
## 2017-04-02 - 1.2.7 - fix(command)
|
||||
|
||||
Command execution fix.
|
||||
|
||||
- Fixed command execution behavior.
|
||||
|
||||
## 2017-03-28 - 1.2.6 - ci
|
||||
|
||||
CI configuration update.
|
||||
|
||||
- Updated .gitlab-ci.yml for correct images/steps.
|
||||
|
||||
## 2017-03-28 - 1.2.5 - ci
|
||||
|
||||
CI improvements.
|
||||
|
||||
- Further CI updates.
|
||||
|
||||
## 2017-03-28 - 1.2.4 - perf
|
||||
|
||||
Performance improvements.
|
||||
|
||||
- Now runs asynchronously and is significantly faster.
|
||||
|
||||
## 2017-02-12 - 1.2.3 - feature
|
||||
|
||||
New cleanup and diagnostics features.
|
||||
|
||||
- Added speedtest utility.
|
||||
- Added removal of volumes.
|
||||
|
||||
## 2017-02-11 - 1.2.2 - feature
|
||||
|
||||
Cleanup enhancement.
|
||||
|
||||
- Added "clean --all" option to remove more artifacts.
|
||||
|
||||
## 2017-02-11 - 1.2.1 - maintenance
|
||||
|
||||
Docs and dependency updates.
|
||||
|
||||
- Updated README and dependencies.
|
||||
|
||||
## 2016-08-04 - 1.2.0 - maintenance
|
||||
|
||||
Dependency cleanup.
|
||||
|
||||
- Removed unnecessary dependencies.
|
||||
|
||||
## 2016-07-29 - 1.1.6 - feature
|
||||
|
||||
Environment support.
|
||||
|
||||
- Added support for qenv.
|
||||
|
||||
## 2016-07-29 - 1.1.5 - fix
|
||||
|
||||
Container cleanup improvements.
|
||||
|
||||
- Now also removes old running containers.
|
||||
|
||||
## 2016-07-29 - 1.1.4 - fix
|
||||
|
||||
Namespace conflict avoidance.
|
||||
|
||||
- Removes previous containers to avoid name-space conflicts after errors.
|
||||
|
||||
## 2016-07-29 - 1.1.3 - ci
|
||||
|
||||
CI image configuration.
|
||||
|
||||
- Added correct images for GitLab CI.
|
||||
|
||||
## 2016-07-29 - 1.1.2 - ci
|
||||
|
||||
CI fixes.
|
||||
|
||||
- Fixed GitLab CI configuration.
|
||||
|
||||
## 2016-07-28 - 1.1.1 - ci
|
||||
|
||||
CI fixes and configuration.
|
||||
|
||||
- Fixed gitlab.yml and CI issues.
|
||||
|
||||
## 2016-07-28 - 1.1.0 - feature
|
||||
|
||||
Docker-in-Docker support.
|
||||
|
||||
- Improved support for Docker-in-Docker scenarios.
|
||||
|
||||
## 2016-07-28 - 1.0.5 - feature & ci
|
||||
|
||||
Docker socket option and CI update.
|
||||
|
||||
- Added dockerSock option.
|
||||
- Updated .gitlab-ci.yml.
|
||||
|
||||
## 2016-07-19 - 1.0.4 - release (no code changes)
|
||||
|
||||
Tagged release with no recorded source changes.
|
||||
|
||||
- Tagged release only (no changelogged changes).
|
||||
|
||||
## 2016-07-19 - 1.0.3 - feature
|
||||
|
||||
Environment tagging.
|
||||
|
||||
- Added environment tag support.
|
||||
|
||||
## 2016-07-19 - 1.0.2 - milestone
|
||||
|
||||
CLI and stability improvements.
|
||||
|
||||
- Wired up CLI usage.
|
||||
- Marked as fully working.
|
||||
|
||||
## 2016-07-19 - 1.0.1 - initial improvements
|
||||
|
||||
Early project refinements and Docker integration.
|
||||
|
||||
- Added/updated Docker integration and configuration.
|
||||
- Improved config handling and path management.
|
||||
- Updated Docker handling and removed test artifacts.
|
||||
|
||||
## 2016-07-13 - 1.0.0 - initial
|
||||
|
||||
Initial release.
|
||||
|
||||
- Added README and initial project scaffolding.
|
||||
2
cli.js
2
cli.js
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
require('./dist/index');
|
||||
import('./dist_ts/index.js');
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
require('@gitzone/tsrun');
|
||||
require('./ts/index');
|
||||
@@ -3,18 +3,25 @@
|
||||
"mode": "default",
|
||||
"cli": true
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"gitzone": {
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "gitzone",
|
||||
"gitrepo": "npmdocker",
|
||||
"shortDescription": "develop npm modules cross platform with docker",
|
||||
"npmPackagename": "@gitzone/npmdocker",
|
||||
"gitrepo": "tsdocker",
|
||||
"description": "develop npm modules cross platform with docker",
|
||||
"npmPackagename": "@git.zone/tsdocker",
|
||||
"license": "MIT"
|
||||
},
|
||||
"release": {
|
||||
"accessLevel": "public",
|
||||
"registries": [
|
||||
"https://verdaccio.lossless.digital",
|
||||
"https://registry.npmjs.org"
|
||||
]
|
||||
}
|
||||
},
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": []
|
||||
}
|
||||
}
|
||||
2059
package-lock.json
generated
2059
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
83
package.json
83
package.json
@@ -1,27 +1,29 @@
|
||||
{
|
||||
"name": "@gitzone/tsdocker",
|
||||
"version": "1.2.38",
|
||||
"name": "@git.zone/tsdocker",
|
||||
"version": "1.3.0",
|
||||
"private": false,
|
||||
"description": "develop npm modules cross platform with docker",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"bin": {
|
||||
"tsdocker": "cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(npm run clean && npm run setupCheck && npm run testStandard && npm run testSpeed)",
|
||||
"test": "(npm run build)",
|
||||
"build": "(tsbuild)",
|
||||
"testStandard": "(cd test/ && node ../cli.ts.js)",
|
||||
"testSpeed": "(cd test/ && node ../cli.ts.js speedtest)",
|
||||
"testClean": "(cd test/ && node ../cli.ts.js clean --all)",
|
||||
"testVscode": "(cd test/ && node ../cli.ts.js vscode)",
|
||||
"testIntegration": "(npm run clean && npm run setupCheck && npm run testStandard)",
|
||||
"testStandard": "(cd test/ && tsx ../ts/index.ts)",
|
||||
"testSpeed": "(cd test/ && tsx ../ts/index.ts speedtest)",
|
||||
"testClean": "(cd test/ && tsx ../ts/index.ts clean --all)",
|
||||
"testVscode": "(cd test/ && tsx ../ts/index.ts vscode)",
|
||||
"clean": "(rm -rf test/)",
|
||||
"compile": "(npmts --notest)",
|
||||
"setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)"
|
||||
"setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@gitlab.com/gitzone/npmdocker.git"
|
||||
"url": "https://gitlab.com/gitzone/tsdocker.git"
|
||||
},
|
||||
"keywords": [
|
||||
"docker"
|
||||
@@ -29,32 +31,45 @@
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/gitzone/npmdocker/issues"
|
||||
"url": "https://gitlab.com/gitzone/tsdocker/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/gitzone/npmdocker#README",
|
||||
"homepage": "https://gitlab.com/gitzone/tsdocker#readme",
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.11",
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
"@gitzone/tstest": "^1.0.22",
|
||||
"@pushrocks/tapbundle": "^3.0.9",
|
||||
"@types/node": "^12.0.2",
|
||||
"tslint": "^5.16.0",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
"@git.zone/tsbuild": "^4.1.2",
|
||||
"@git.zone/tsrun": "^2.0.1",
|
||||
"@git.zone/tstest": "^3.1.6",
|
||||
"@types/node": "^25.0.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/npmextra": "^3.0.5",
|
||||
"@pushrocks/projectinfo": "^4.0.2",
|
||||
"@pushrocks/qenv": "^4.0.0",
|
||||
"@pushrocks/smartanalytics": "^2.0.15",
|
||||
"@pushrocks/smartcli": "^3.0.7",
|
||||
"@pushrocks/smartfile": "^7.0.2",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartlog-destination-local": "^7.0.5",
|
||||
"@pushrocks/smartlog-source-ora": "^1.0.7",
|
||||
"@pushrocks/smartopen": "^1.0.8",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartshell": "^2.0.20",
|
||||
"@pushrocks/smartstring": "^3.0.10",
|
||||
"@types/shelljs": "^0.8.5"
|
||||
"@push.rocks/npmextra": "^5.3.3",
|
||||
"@push.rocks/projectinfo": "^5.0.2",
|
||||
"@push.rocks/qenv": "^6.1.3",
|
||||
"@push.rocks/smartanalytics": "^2.0.15",
|
||||
"@push.rocks/smartcli": "^4.0.20",
|
||||
"@push.rocks/smartfs": "^1.3.1",
|
||||
"@push.rocks/smartlog": "^3.1.10",
|
||||
"@push.rocks/smartlog-destination-local": "^9.0.2",
|
||||
"@push.rocks/smartlog-source-ora": "^1.0.9",
|
||||
"@push.rocks/smartopen": "^2.0.0",
|
||||
"@push.rocks/smartpromise": "^4.2.3",
|
||||
"@push.rocks/smartshell": "^3.3.0",
|
||||
"@push.rocks/smartstring": "^4.1.0"
|
||||
},
|
||||
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
"ts_web/**/*",
|
||||
"dist/**/*",
|
||||
"dist_*/**/*",
|
||||
"dist_ts/**/*",
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"pnpm": {
|
||||
"overrides": {}
|
||||
}
|
||||
}
|
||||
|
||||
8740
pnpm-lock.yaml
generated
Normal file
8740
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
40
readme.hints.md
Normal file
40
readme.hints.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# tsdocker Project Hints
|
||||
|
||||
## Module Purpose
|
||||
|
||||
tsdocker is a tool for developing npm modules cross-platform using Docker. It allows testing in clean, reproducible Linux environments locally.
|
||||
|
||||
## Recent Upgrades (2025-11-22)
|
||||
|
||||
- Updated all @git.zone/_ dependencies to @git.zone/_ scope (latest versions)
|
||||
- Updated all @pushrocks/_ dependencies to @push.rocks/_ scope (latest versions)
|
||||
- Migrated from smartfile v8 to smartfs v1.1.0
|
||||
- All filesystem operations now use smartfs fluent API
|
||||
- Operations are now async (smartfs is async-only)
|
||||
- Updated dev dependencies:
|
||||
- @git.zone/tsbuild: ^3.1.0
|
||||
- @git.zone/tsrun: ^2.0.0
|
||||
- @git.zone/tstest: ^3.1.3
|
||||
- Removed @pushrocks/tapbundle (now use @git.zone/tstest/tapbundle)
|
||||
- Updated @types/node to ^22.10.2
|
||||
- Removed tslint and tslint-config-prettier (no longer needed)
|
||||
|
||||
## SmartFS Migration Details
|
||||
|
||||
The following operations were converted:
|
||||
|
||||
- `smartfile.fs.fileExistsSync()` → Node.js `fs.existsSync()` (for sync needs)
|
||||
- `smartfile.fs.ensureDirSync()` → Node.js `fs.mkdirSync(..., { recursive: true })`
|
||||
- `smartfile.memory.toFsSync()` → `smartfs.file(path).write(content)` (async)
|
||||
- `smartfile.fs.removeSync()` → `smartfs.file(path).delete()` (async)
|
||||
|
||||
## Test Status
|
||||
|
||||
- Build: ✅ Passes
|
||||
- The integration test requires cloning an external test repository (sandbox-npmts)
|
||||
- The external test repo uses top-level await which requires ESM module handling
|
||||
- This is not a tsdocker issue but rather the test repository's structure
|
||||
|
||||
## Dependencies
|
||||
|
||||
All dependencies are now at their latest versions compatible with Node.js without introducing new Node.js-specific dependencies.
|
||||
338
readme.md
Normal file
338
readme.md
Normal file
@@ -0,0 +1,338 @@
|
||||
# @git.zone/tsdocker
|
||||
|
||||
> 🐳 Cross-platform npm module development with Docker — test your packages in clean, reproducible Linux environments every time.
|
||||
|
||||
## Issue Reporting and Security
|
||||
|
||||
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
||||
|
||||
## What is tsdocker?
|
||||
|
||||
**tsdocker** provides containerized testing environments for npm packages, ensuring your code works consistently across different systems. It's perfect for:
|
||||
|
||||
- 🧪 **Testing in clean environments** — Every test run starts fresh, just like CI
|
||||
- 🔄 **Reproducing CI behavior locally** — No more "works on my machine" surprises
|
||||
- 🐧 **Cross-platform development** — Develop on macOS/Windows, test on Linux
|
||||
- 🚀 **Quick validation** — Spin up isolated containers for testing without polluting your system
|
||||
|
||||
## Features
|
||||
|
||||
✨ **Works Everywhere Docker Does**
|
||||
|
||||
- Docker Toolbox
|
||||
- Native Docker Desktop
|
||||
- Docker-in-Docker (DinD)
|
||||
- Mounted docker.sock scenarios
|
||||
|
||||
🔧 **Flexible Configuration**
|
||||
|
||||
- Custom base images
|
||||
- Configurable test commands
|
||||
- Environment variable injection via qenv
|
||||
- Optional docker.sock mounting for nested container tests
|
||||
|
||||
📦 **TypeScript-First**
|
||||
|
||||
- Full TypeScript support with excellent IntelliSense
|
||||
- Type-safe configuration
|
||||
- Modern ESM with async/await patterns throughout
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install -g @git.zone/tsdocker
|
||||
# or for project-local installation
|
||||
pnpm install --save-dev @git.zone/tsdocker
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Configure Your Project
|
||||
|
||||
Create an `npmextra.json` file in your project root:
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/tsdocker": {
|
||||
"baseImage": "node:20",
|
||||
"command": "npm test",
|
||||
"dockerSock": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Run Your Tests
|
||||
|
||||
```bash
|
||||
tsdocker
|
||||
```
|
||||
|
||||
That's it! tsdocker will:
|
||||
|
||||
1. ✅ Verify Docker is available
|
||||
2. 🏗️ Build a test container with your specified base image
|
||||
3. 📂 Mount your project directory
|
||||
4. 🚀 Execute your test command
|
||||
5. 🧹 Clean up automatically
|
||||
|
||||
## Configuration Options
|
||||
|
||||
| Option | Type | Description |
|
||||
| ------------ | --------- | ---------------------------------------------------------------------- |
|
||||
| `baseImage` | `string` | Docker image to use as the test environment base |
|
||||
| `command` | `string` | CLI command to execute inside the container |
|
||||
| `dockerSock` | `boolean` | Whether to mount `/var/run/docker.sock` for Docker-in-Docker scenarios |
|
||||
|
||||
### Environment Variables
|
||||
|
||||
If you have a `qenv.yml` file in your project, tsdocker automatically loads and injects those environment variables into your test container.
|
||||
|
||||
Example `qenv.yml`:
|
||||
|
||||
```yaml
|
||||
demoKey: demoValue
|
||||
API_KEY: your-key-here
|
||||
```
|
||||
|
||||
## CLI Commands
|
||||
|
||||
### Standard Test Run
|
||||
|
||||
```bash
|
||||
tsdocker
|
||||
```
|
||||
|
||||
Runs your configured test command in a fresh Docker container.
|
||||
|
||||
### Clean Docker Environment
|
||||
|
||||
```bash
|
||||
tsdocker clean --all
|
||||
```
|
||||
|
||||
⚠️ **WARNING**: This aggressively cleans your Docker environment by:
|
||||
|
||||
- Killing all running containers
|
||||
- Removing all stopped containers
|
||||
- Removing dangling images
|
||||
- Removing all images
|
||||
- Removing dangling volumes
|
||||
|
||||
Use with caution!
|
||||
|
||||
### VSCode in Docker
|
||||
|
||||
```bash
|
||||
tsdocker vscode
|
||||
```
|
||||
|
||||
Launches a containerized VS Code instance accessible via browser at `testing-vscode.git.zone:8443`.
|
||||
|
||||
### Speed Test
|
||||
|
||||
```bash
|
||||
tsdocker speedtest
|
||||
```
|
||||
|
||||
Runs a network speed test inside a Docker container.
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Docker-in-Docker Testing
|
||||
|
||||
If you need to run Docker commands inside your test container (e.g., testing Docker-related tools):
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/tsdocker": {
|
||||
"baseImage": "docker:latest",
|
||||
"command": "docker run hello-world",
|
||||
"dockerSock": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Setting `"dockerSock": true` mounts the host's Docker socket into the container.
|
||||
|
||||
### Custom Base Images
|
||||
|
||||
You can use any Docker image as your base:
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/tsdocker": {
|
||||
"baseImage": "node:20-alpine",
|
||||
"command": "npm test"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Popular choices:
|
||||
|
||||
- `node:20` — Official Node.js images
|
||||
- `node:20-alpine` — Lightweight Alpine-based images
|
||||
- `node:lts` — Long-term support Node.js version
|
||||
|
||||
### CI Integration
|
||||
|
||||
tsdocker automatically detects CI environments (via `CI=true` env var) and adjusts behavior:
|
||||
|
||||
- Copies project files into container in CI (instead of mounting)
|
||||
- Optimizes for CI execution patterns
|
||||
|
||||
## Why tsdocker?
|
||||
|
||||
### The Problem
|
||||
|
||||
Local development environments drift over time. You might have:
|
||||
|
||||
- Stale global packages
|
||||
- Modified system configurations
|
||||
- Cached dependencies
|
||||
- Different Node.js versions
|
||||
|
||||
Your tests pass locally but fail in CI — or vice versa.
|
||||
|
||||
### The Solution
|
||||
|
||||
tsdocker ensures every test run happens in a **clean, reproducible environment**, just like your CI pipeline. This means:
|
||||
|
||||
✅ Consistent behavior between local and CI
|
||||
✅ No dependency pollution between test runs
|
||||
✅ Easy cross-platform testing
|
||||
✅ Reproducible bug investigations
|
||||
|
||||
## TypeScript Usage
|
||||
|
||||
tsdocker is built with TypeScript and provides full type definitions:
|
||||
|
||||
```typescript
|
||||
import type { IConfig } from '@git.zone/tsdocker/dist_ts/tsdocker.config.js';
|
||||
|
||||
const config: IConfig = {
|
||||
baseImage: 'node:20',
|
||||
command: 'npm test',
|
||||
dockerSock: false,
|
||||
keyValueObject: {
|
||||
NODE_ENV: 'test',
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- **Docker**: Docker must be installed and accessible via CLI
|
||||
- **Node.js**: Version 18 or higher (ESM support required)
|
||||
|
||||
## How It Works
|
||||
|
||||
Under the hood, tsdocker:
|
||||
|
||||
1. 📋 Reads your `npmextra.json` configuration
|
||||
2. 🔍 Optionally loads environment variables from `qenv.yml`
|
||||
3. 🐳 Generates a temporary Dockerfile
|
||||
4. 🏗️ Builds a Docker image with your base image
|
||||
5. 📦 Mounts your project directory (unless in CI)
|
||||
6. ▶️ Runs your test command inside the container
|
||||
7. 📊 Captures the exit code
|
||||
8. 🧹 Cleans up containers and images
|
||||
9. ✅ Exits with the same code as your tests
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "docker not found on this machine"
|
||||
|
||||
Make sure Docker is installed and the `docker` command is in your PATH:
|
||||
|
||||
```bash
|
||||
docker --version
|
||||
```
|
||||
|
||||
### Tests fail in container but work locally
|
||||
|
||||
This often indicates environment-specific issues. Check:
|
||||
|
||||
- Are all dependencies in `package.json`? (not relying on global packages)
|
||||
- Does your code have hardcoded paths?
|
||||
- Are environment variables set correctly?
|
||||
|
||||
### Permission errors with docker.sock
|
||||
|
||||
If using `dockerSock: true`, ensure your user has permissions to access `/var/run/docker.sock`:
|
||||
|
||||
```bash
|
||||
sudo usermod -aG docker $USER
|
||||
# Then log out and back in
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic npm test
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/tsdocker": {
|
||||
"baseImage": "node:20",
|
||||
"command": "npm test"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Running pnpm tests
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/tsdocker": {
|
||||
"baseImage": "node:20",
|
||||
"command": "corepack enable && pnpm install && pnpm test"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Testing Docker-based tools
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/tsdocker": {
|
||||
"baseImage": "docker:latest",
|
||||
"command": "sh -c 'docker version && docker ps'",
|
||||
"dockerSock": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Performance Tips
|
||||
|
||||
🚀 **Use specific base images**: `node:20-alpine` is much faster to pull than `node:latest`
|
||||
🚀 **Layer caching**: Docker caches image layers — your base image only downloads once
|
||||
🚀 **Prune regularly**: Run `docker system prune` periodically to reclaim disk space
|
||||
|
||||
## Migration from legacy npmdocker
|
||||
|
||||
This package was previously published under the `npmdocker` name. It is now available as `@git.zone/tsdocker` with modernized ESM support and updated dependencies.
|
||||
|
||||
Key changes:
|
||||
- Configuration key changed from `npmdocker` to `@git.zone/tsdocker` in `npmextra.json`
|
||||
- CLI command is now `tsdocker` instead of `npmdocker`
|
||||
- Full ESM support with `.js` extensions in imports
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
### Trademarks
|
||||
|
||||
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
||||
|
||||
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District Court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsdocker',
|
||||
version: '1.3.0',
|
||||
description: 'develop npm modules cross platform with docker'
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* smartanalytics:
|
||||
* We count executions of this tool to keep track which of our tools are really used.
|
||||
* This insight is used to plan spending our limited resources for improving them.
|
||||
* Any submitted analytics data is fully anonymized (no Ips or any other personal information is tracked).
|
||||
* Feel free to dig into the smartanalytics package, if you are interested in how it works.
|
||||
* Our privacy policy can be found here: https://lossless.gmbh/privacy.html
|
||||
* The privacy policy is also linked in the readme, so we hope this behaviour does not come as a surprise to you.
|
||||
* Have a nice day and regards
|
||||
* Your Open Source team at Lossless GmbH :)
|
||||
*/
|
||||
import * as smartanalytics from '@pushrocks/smartanalytics';
|
||||
const npmdockerAnalytics = new smartanalytics.Analytics({
|
||||
apiEndPoint: 'https://pubapi.lossless.one',
|
||||
appName: 'tsdocker',
|
||||
projectId: 'gitzone'
|
||||
});
|
||||
npmdockerAnalytics.recordEvent('npmtoolexecution', {
|
||||
somedata: 'somedata'
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import './analytics';
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as cli from './tsdocker.cli';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as cli from './tsdocker.cli.js';
|
||||
|
||||
cli.run();
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as paths from './tsdocker.paths';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as paths from './tsdocker.paths.js';
|
||||
|
||||
// modules
|
||||
import * as ConfigModule from './tsdocker.config';
|
||||
import * as DockerModule from './tsdocker.docker';
|
||||
import * as ConfigModule from './tsdocker.config.js';
|
||||
import * as DockerModule from './tsdocker.docker.js';
|
||||
|
||||
import { logger, ora } from './tsdocker.logging';
|
||||
import { logger, ora } from './tsdocker.logging.js';
|
||||
|
||||
const tsdockerCli = new plugins.smartcli.Smartcli();
|
||||
|
||||
export let run = () => {
|
||||
tsdockerCli.standardTask().subscribe(async argvArg => {
|
||||
let configArg = await ConfigModule.run().then(DockerModule.run);
|
||||
tsdockerCli.standardCommand().subscribe(async argvArg => {
|
||||
const configArg = await ConfigModule.run().then(DockerModule.run);
|
||||
if (configArg.exitCode === 0) {
|
||||
logger.log('success', 'container ended all right!');
|
||||
} else {
|
||||
@@ -68,7 +68,7 @@ export let run = () => {
|
||||
});
|
||||
logger.log('ok', 'Starting speedtest');
|
||||
await smartshellInstance.exec(
|
||||
`docker pull tianon/speedtest && docker run --rm tianon/speedtest`
|
||||
`docker pull tianon/speedtest && docker run --rm tianon/speedtest --accept-license --accept-gdpr`
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as paths from './tsdocker.paths';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as paths from './tsdocker.paths.js';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export interface IConfig {
|
||||
baseImage: string;
|
||||
command: string;
|
||||
dockerSock: boolean;
|
||||
exitCode?: number;
|
||||
keyValueObject: any[];
|
||||
keyValueObject: {[key: string]: any};
|
||||
}
|
||||
|
||||
const getQenvKeyValueObject = async () => {
|
||||
let qenvKeyValueObjectArray: { [key: string]: string | number };
|
||||
if (plugins.smartfile.fs.fileExistsSync(plugins.path.join(paths.cwd, 'qenv.yml'))) {
|
||||
if (fs.existsSync(plugins.path.join(paths.cwd, 'qenv.yml'))) {
|
||||
qenvKeyValueObjectArray = new plugins.qenv.Qenv(paths.cwd, '.nogit/').keyValueObject;
|
||||
} else {
|
||||
qenvKeyValueObjectArray = {};
|
||||
@@ -21,7 +22,7 @@ const getQenvKeyValueObject = async () => {
|
||||
|
||||
const buildConfig = async (qenvKeyValueObjectArg: { [key: string]: string | number }) => {
|
||||
const npmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
const config = npmextra.dataFor<IConfig>('npmdocker', {
|
||||
const config = npmextra.dataFor<IConfig>('@git.zone/tsdocker', {
|
||||
baseImage: 'hosttoday/ht-docker-node:npmdocker',
|
||||
init: 'rm -rf node_nodules/ && yarn install',
|
||||
command: 'npmci npm test',
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as paths from './tsdocker.paths';
|
||||
import * as snippets from './tsdocker.snippets';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as paths from './tsdocker.paths.js';
|
||||
import * as snippets from './tsdocker.snippets.js';
|
||||
|
||||
import { logger, ora } from './tsdocker.logging';
|
||||
import { logger, ora } from './tsdocker.logging.js';
|
||||
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
});
|
||||
|
||||
// interfaces
|
||||
import { IConfig } from './tsdocker.config';
|
||||
import type { IConfig } from './tsdocker.config.js';
|
||||
|
||||
let config: IConfig;
|
||||
|
||||
@@ -43,7 +43,7 @@ const checkDocker = () => {
|
||||
/**
|
||||
* builds the Dockerfile according to the config in the project
|
||||
*/
|
||||
const buildDockerFile = () => {
|
||||
const buildDockerFile = async () => {
|
||||
const done = plugins.smartpromise.defer();
|
||||
ora.text('building Dockerfile...');
|
||||
const dockerfile: string = snippets.dockerfileSnippet({
|
||||
@@ -52,7 +52,7 @@ const buildDockerFile = () => {
|
||||
});
|
||||
logger.log('info', `Base image is: ${config.baseImage}`);
|
||||
logger.log('info', `Command is: ${config.command}`);
|
||||
plugins.smartfile.memory.toFsSync(dockerfile, plugins.path.join(paths.cwd, 'npmdocker'));
|
||||
await plugins.smartfs.file(plugins.path.join(paths.cwd, 'npmdocker')).write(dockerfile);
|
||||
logger.log('ok', 'Dockerfile created!');
|
||||
ora.stop();
|
||||
done.resolve();
|
||||
@@ -67,7 +67,7 @@ const buildDockerImage = async () => {
|
||||
await smartshellInstance.exec(`docker pull ${config.baseImage}`);
|
||||
ora.text('building Dockerimage...');
|
||||
const execResult = await smartshellInstance.execSilent(
|
||||
`docker build -f npmdocker -t ${dockerData.imageTag} ${paths.cwd}`
|
||||
`docker build --load -f npmdocker -t ${dockerData.imageTag} ${paths.cwd}`
|
||||
);
|
||||
if (execResult.exitCode !== 0) {
|
||||
console.log(execResult.stdout);
|
||||
@@ -148,7 +148,7 @@ const postClean = async () => {
|
||||
.then(async () => {
|
||||
logger.log('ok', 'cleaned up!');
|
||||
});
|
||||
plugins.smartfile.fs.removeSync(paths.npmdockerFile);
|
||||
await plugins.smartfs.file(paths.npmdockerFile).delete();
|
||||
};
|
||||
|
||||
export let run = async (configArg: IConfig): Promise<IConfig> => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
|
||||
export const logger = new plugins.smartlog.Smartlog({
|
||||
logContext: {
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
// directories
|
||||
export let cwd = process.cwd();
|
||||
export let packageBase = plugins.path.join(__dirname, '../');
|
||||
export let assets = plugins.path.join(packageBase, 'assets/');
|
||||
plugins.smartfile.fs.ensureDirSync(assets);
|
||||
fs.mkdirSync(assets, { recursive: true });
|
||||
export let npmdockerFile = plugins.path.join(cwd, 'npmdocker');
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
// pushrocks scope
|
||||
import * as npmextra from '@pushrocks/npmextra';
|
||||
// push.rocks scope
|
||||
import * as npmextra from '@push.rocks/npmextra';
|
||||
import * as path from 'path';
|
||||
import * as projectinfo from '@pushrocks/projectinfo';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as qenv from '@pushrocks/qenv';
|
||||
import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
||||
import * as smartlogSouceOra from '@pushrocks/smartlog-source-ora';
|
||||
import * as smartopen from '@pushrocks/smartopen';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
import * as projectinfo from '@push.rocks/projectinfo';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
import * as smartcli from '@push.rocks/smartcli';
|
||||
import { SmartFs, SmartFsProviderNode } from '@push.rocks/smartfs';
|
||||
import * as smartlog from '@push.rocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
||||
import * as smartlogSouceOra from '@push.rocks/smartlog-source-ora';
|
||||
import * as smartopen from '@push.rocks/smartopen';
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
import * as smartstring from '@push.rocks/smartstring';
|
||||
|
||||
// Create smartfs instance
|
||||
export const smartfs = new SmartFs(new SmartFsProviderNode());
|
||||
|
||||
export {
|
||||
npmextra,
|
||||
@@ -20,7 +23,6 @@ export {
|
||||
smartpromise,
|
||||
qenv,
|
||||
smartcli,
|
||||
smartfile,
|
||||
smartlog,
|
||||
smartlogDestinationLocal,
|
||||
smartlogSouceOra,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
|
||||
export interface IDockerfileSnippet {
|
||||
baseImage: string;
|
||||
@@ -14,23 +14,20 @@ let getMountSolutionString = (optionsArg: IDockerfileSnippet) => {
|
||||
};
|
||||
|
||||
let getGlobalPreparationString = (optionsArg: IDockerfileSnippet) => {
|
||||
if (optionsArg.baseImage !== 'hosttoday/ht-docker-node:npmdocker') {
|
||||
return 'RUN npm install -g npmdocker';
|
||||
} else {
|
||||
return '# not installing npmdocker since it is included in the base image';
|
||||
}
|
||||
// Always install tsdocker to ensure the latest version is available
|
||||
return 'RUN npm install -g @git.zone/tsdocker';
|
||||
};
|
||||
|
||||
export let dockerfileSnippet = (optionsArg: IDockerfileSnippet): string => {
|
||||
return plugins.smartstring.indent.normalize(
|
||||
`
|
||||
FROM ${optionsArg.baseImage}
|
||||
# For info about what npmdocker does read the docs at https://gitzone.github.io/npmdocker
|
||||
# For info about what tsdocker does read the docs at https://gitzone.github.io/tsdocker
|
||||
${getGlobalPreparationString(optionsArg)}
|
||||
${getMountSolutionString(optionsArg)}
|
||||
WORKDIR /workspace
|
||||
ENV CI=true
|
||||
ENTRYPOINT ["npmdocker"]
|
||||
ENTRYPOINT ["tsdocker"]
|
||||
CMD ["runinside"]
|
||||
`
|
||||
);
|
||||
|
||||
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {}
|
||||
},
|
||||
"exclude": ["dist_*/**/*.d.ts"]
|
||||
}
|
||||
17
tslint.json
17
tslint.json
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
Reference in New Issue
Block a user