fix(core): update

This commit is contained in:
Philipp Kunz 2024-04-12 14:59:49 +02:00
parent b51ccda39e
commit fad06e3c33
7 changed files with 1339 additions and 1202 deletions

View File

@ -119,6 +119,6 @@ jobs:
run: | run: |
npmci node install stable npmci node install stable
npmci npm install npmci npm install
pnpm install -g @gitzone/tsdoc pnpm install -g @git.zone/tsdoc
npmci command tsdoc npmci command tsdoc
continue-on-error: true continue-on-error: true

View File

@ -125,7 +125,7 @@ pages:
script: script:
- npmci node install stable - npmci node install stable
- npmci npm prepare - npmci npm prepare
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @git.zone/tsdoc
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command tsdoc
tags: tags:

View File

@ -27,11 +27,11 @@
}, },
"homepage": "https://github.com/pushrocks/smartpath", "homepage": "https://github.com/pushrocks/smartpath",
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.66", "@git.zone/tsbuild": "^2.1.66",
"@gitzone/tsrun": "^1.2.42", "@git.zone/tsrun": "^1.2.44",
"@gitzone/tstest": "^1.0.74", "@git.zone/tstest": "^1.0.77",
"@pushrocks/tapbundle": "^5.0.8", "@push.rocks/tapbundle": "^5.0.8",
"@types/node": "^20.4.1" "@types/node": "^20.12.7"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import { tap, expect, expectAsync } from '@pushrocks/tapbundle'; import { tap, expect, expectAsync } from '@push.rocks/tapbundle';
import * as smartpath from '../ts/index.js'; import * as smartpath from '../ts/index.js';
let mySmartpath: smartpath.Smartpath; let mySmartpath: smartpath.Smartpath;

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartpath', name: '@push.rocks/smartpath',
version: '5.0.11', version: '5.0.12',
description: 'offers smart ways to handle paths' description: 'offers smart ways to handle paths'
} }

View File

@ -4,13 +4,21 @@ import * as plugins from './smartpath.plugins.js';
* ------------ helpers --------------------- * * ------------ helpers --------------------- *
* ------------------------------------------ */ * ------------------------------------------ */
// checks a file /**
* takes a path and makes it absolute
* @param localPathArg
* @param baseArg
* @returns
*/
export const makeAbsolute = (localPathArg: string, baseArg?: string): string => { export const makeAbsolute = (localPathArg: string, baseArg?: string): string => {
let absolutePath: string; let absolutePath: string;
let alreadyAbsolute = plugins.path.isAbsolute(localPathArg); let alreadyAbsolute = plugins.path.isAbsolute(localPathArg);
if (baseArg && !alreadyAbsolute) { if (!alreadyAbsolute && baseArg && !baseArg.startsWith('.')) {
absolutePath = plugins.path.join(baseArg, localPathArg); absolutePath = plugins.path.join(baseArg, localPathArg);
} else if (!alreadyAbsolute) { } else if (!alreadyAbsolute) {
if (baseArg) {
plugins.path.join(baseArg, localPathArg);
}
absolutePath = plugins.path.resolve(localPathArg); absolutePath = plugins.path.resolve(localPathArg);
} else { } else {
absolutePath = localPathArg; absolutePath = localPathArg;
@ -18,9 +26,9 @@ export const makeAbsolute = (localPathArg: string, baseArg?: string): string =>
return absolutePath; return absolutePath;
}; };
/* ------------------------------------------ * /*
* ------- export functions ----------------- * * like makeAbsolute, but takes different complex contructs like arrays and objects
* ------------------------------------------ */ */
export const toAbsolute = (relativeArg: string | string[], baseArg?: string): string | string[] => { export const toAbsolute = (relativeArg: string | string[], baseArg?: string): string | string[] => {
if (typeof relativeArg === 'string') { if (typeof relativeArg === 'string') {
return makeAbsolute(relativeArg, baseArg); return makeAbsolute(relativeArg, baseArg);