Compare commits

...

18 Commits

Author SHA1 Message Date
b4dae84835 5.0.8 2023-10-03 18:55:17 +02:00
20e27c93d9 fix(core): update 2023-10-03 18:55:16 +02:00
117dc6013c 5.0.7 2023-10-03 18:54:52 +02:00
c6bc433a73 fix(core): update 2023-10-03 18:54:51 +02:00
299815838c switch to new org scheme 2023-07-11 00:36:49 +02:00
e8318cbf2f switch to new org scheme 2023-07-10 02:48:52 +02:00
ae60053cff 5.0.6 2023-02-12 19:08:40 +01:00
dca3cf1f08 fix(core): update 2023-02-12 19:08:40 +01:00
eaf379b119 5.0.5 2023-01-03 16:46:41 +01:00
0074938e57 fix(core): update 2023-01-03 16:46:41 +01:00
eed1c75aba 5.0.4 2022-12-28 19:43:49 +01:00
6de2f36964 fix(core): update 2022-12-28 19:43:48 +01:00
76e777a3ac 5.0.3 2022-08-07 01:17:45 +02:00
165cd3737e fix(core): update 2022-08-07 01:17:45 +02:00
2f11d1ba0f 5.0.2 2022-05-28 23:22:31 +02:00
33692ff417 fix(core): update 2022-05-28 23:22:31 +02:00
f408337186 5.0.1 2022-03-25 13:22:43 +01:00
bd6d574226 fix(core): update 2022-03-25 13:22:42 +01:00
15 changed files with 5892 additions and 18919 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{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 @shipzone/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: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{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 @shipzone/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 @shipzone/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 @shipzone/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 @shipzone/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,137 +0,0 @@
# gitzone ci_default
image: registry.gitlab.com/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
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
"type": "node-terminal"
}
]
}

View File

@ -7,10 +7,10 @@
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitscope": "push.rocks",
"gitrepo": "smartenv",
"description": "store things about your environment and let them travel across modules",
"npmPackagename": "@pushrocks/smartenv",
"npmPackagename": "@push.rocks/smartenv",
"license": "MIT"
}
}

18699
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartenv",
"version": "5.0.0",
"name": "@push.rocks/smartenv",
"version": "5.0.8",
"description": "store things about your environment and let them travel across modules",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -8,7 +8,8 @@
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web --allowimplicitany && tsbundle npm)",
"testbrowser": "(npm test) && (node testbrowser.js)"
"testbrowser": "(npm test) && (node testbrowser.js)",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
@ -24,18 +25,16 @@
},
"homepage": "https://gitlab.com/pushrocks/smartenv",
"dependencies": {
"@pushrocks/smartpromise": "^3.1.7",
"@types/node": "^17.0.21"
"@push.rocks/smartpromise": "^4.0.2"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.56",
"@gitzone/tsbundle": "^1.0.98",
"@gitzone/tsrun": "^1.2.31",
"@gitzone/tstest": "^1.0.68",
"@pushrocks/tapbundle": "^5.0.2",
"@types/npm": "^7.19.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
"@git.zone/tsbuild": "^2.1.66",
"@git.zone/tsbundle": "^2.0.8",
"@git.zone/tsrun": "^1.2.44",
"@git.zone/tstest": "^1.0.77",
"@push.rocks/tapbundle": "^5.0.8",
"@types/node": "^20.8.2",
"@types/npm": "^7.19.1"
},
"private": false,
"files": [

5633
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,26 @@
# @pushrocks/smartenv
# @push.rocks/smartenv
store things about your environment and let them travel across modules
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartenv)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartenv)
* [github.com (source mirror)](https://github.com/pushrocks/smartenv)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartenv/)
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartenv)
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartenv)
* [github.com (source mirror)](https://github.com/push.rocks/smartenv)
* [docs (typedoc)](https://push.rocks.gitlab.io/smartenv/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartenv/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartenv/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartenv)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartenv)](https://lossless.cloud)
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartenv/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartenv/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartenv)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartenv)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartenv)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartenv)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartenv)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartenv)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartenv)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartenv)](https://lossless.cloud)
## Usage
@ -33,7 +32,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.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
## 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)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,4 +1,4 @@
import { tap, expect } from '@pushrocks/tapbundle';
import { tap, expect } from '@push.rocks/tapbundle';
import * as smartenv from '../ts/index.js';
let testEnv: smartenv.Smartenv;

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartenv',
version: '5.0.8',
description: 'store things about your environment and let them travel across modules'
}

View File

@ -17,10 +17,14 @@ export class Smartenv {
getFunction: () => any;
}) {
if (this.isNode) {
const moduleResult = await this.getSafeNodeModule(optionsArg.nodeModuleName);
const moduleResult = await this.getSafeNodeModule(optionsArg.nodeModuleName);
return moduleResult;
} else if (this.isBrowser) {
const moduleResult = await this.getSafeWebModule(optionsArg.webUrlArg, optionsArg.getFunction);
const moduleResult = await this.getSafeWebModule(
optionsArg.webUrlArg,
optionsArg.getFunction
);
return moduleResult;
} else {
console.error('platform for loading not supported by smartenv');
}
@ -28,11 +32,11 @@ export class Smartenv {
public async getSafeNodeModule<T = any>(moduleNameArg: string): Promise<T> {
if (!this.isNode) {
console.error('You tried to load a node module in a wrong context');
console.error(`You tried to load a node module in a wrong context: ${moduleNameArg}`);
return;
}
// tslint:disable-next-line: function-constructor
return (new Function(`return import('${moduleNameArg}')`))() as Promise<T>;
return new Function(`return import('${moduleNameArg}')`)() as Promise<T>;
}
public loadedScripts: string[] = [];
@ -65,10 +69,10 @@ export class Smartenv {
}
public get runtimeEnv() {
if (typeof window !== 'undefined') {
return 'browser';
} else if (typeof process !== 'undefined') {
if (typeof process !== 'undefined') {
return 'node';
} else {
return 'browser';
}
}
@ -138,9 +142,7 @@ export class Smartenv {
public async printEnv() {
if (this.isNode) {
console.log('running on NODE');
console.log(
'node version is ' + this.nodeVersion
);
console.log('node version is ' + this.nodeVersion);
} else {
console.log('running on BROWSER');
console.log('browser is ' + this.userAgent);

View File

@ -1,3 +1,3 @@
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartpromise from '@push.rocks/smartpromise';
export { smartpromise };

14
tsconfig.json Normal file
View File

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

View File

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