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 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
- #### `fileExists`
150
+ #### `pathExists`
151
151
 
152
152
  ```ts
153
- function fileExists(
154
- targetFile: string
153
+ function pathExists(
154
+ targetPath: string
155
155
  ): boolean
156
156
  ```
157
157
 
158
- Checks if the specified `targetFile` 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.
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 file exists , the function returns true, false otherwise.
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, row: string
178
+ targetFile: string, pattern: string | RegExp, exact: boolean = false
179
179
  ): boolean
180
180
  ```
181
181
 
182
- Checks whether given `row` 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.
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
- If the `row` is present, the function returns true, false otherwise. Row must be matched completely, but surrounding whitespaces are ignored.
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