elrh-cosca 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/dist/elrh-cosca.mjs +7825 -9028
- package/dist/types/checks/get-package-manager.d.ts +6 -0
- package/dist/types/checks/has-text.d.ts +5 -4
- package/dist/types/checks/path-exists.d.ts +8 -0
- package/dist/types/main.d.ts +3 -2
- package/package.json +5 -5
- package/dist/types/checks/file-exists.d.ts +0 -8
package/README.md
CHANGED
|
@@ -147,17 +147,17 @@ By default the function asks for confirmation before attempting to delete the `t
|
|
|
147
147
|
|
|
148
148
|
### List of content checkers
|
|
149
149
|
|
|
150
|
-
#### `
|
|
150
|
+
#### `pathExists`
|
|
151
151
|
|
|
152
152
|
```ts
|
|
153
|
-
function
|
|
154
|
-
|
|
153
|
+
function pathExists(
|
|
154
|
+
targetPath: string
|
|
155
155
|
): boolean
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
Checks if the specified `
|
|
158
|
+
Checks if the specified `targetPath` exists on FS. Path is resolved relatively to `process.cwd()`. Several checks are in place to prevent accidental and malicious paths being passed in. Path traversal outside of CWD or providing absolute paths is disallowed.
|
|
159
159
|
|
|
160
|
-
If the
|
|
160
|
+
If the path exists , the function returns true, false otherwise.
|
|
161
161
|
|
|
162
162
|
#### `hasJsonKey`
|
|
163
163
|
|
|
@@ -175,13 +175,21 @@ Given `jsonKey` might point to a nested key using dot notation, e.g. `a.b.c`. If
|
|
|
175
175
|
|
|
176
176
|
```ts
|
|
177
177
|
function hasText(
|
|
178
|
-
targetFile: string,
|
|
178
|
+
targetFile: string, pattern: string | RegExp, exact: boolean = false
|
|
179
179
|
): boolean
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
Checks whether given `
|
|
182
|
+
Checks whether given `pattern` exists in text file located at `targetFile`. Path is resolved relatively to `process.cwd()`. Several checks are in place to prevent accidental and malicious paths being passed in. Path traversal outside of CWD or providing absolute paths is disallowed.
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
The `pattern` might be a plain string or a regular expression. If it is present, the function returns true, false otherwise. By default partial matches are allowed for string patterns. If you set optional `exact` parameter to true, the string must completely match at least one line in the file. However, surrounding whitespaces are trimmed in both cases.
|
|
185
|
+
|
|
186
|
+
#### `getPackageManager`
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
function getPackageManager(): 'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun'
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Tries to detect the package manager used in the current environment by checking for specific global variables and user agent strings. Fallbacks to `npm` if common checks fail to detect otherwise.
|
|
185
193
|
|
|
186
194
|
### List of terminal helpers
|
|
187
195
|
|