elrh-cosca 0.3.0 → 0.3.2
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 +38 -0
- package/dist/elrh-cosca.mjs +931 -884
- package/dist/types/checks/file-exists.d.ts +8 -0
- package/dist/types/checks/has-json-key.d.ts +9 -0
- package/dist/types/checks/has-text.d.ts +9 -0
- package/dist/types/functions/create-file-from-template.d.ts +1 -1
- package/dist/types/functions/create-file-from-web-template.d.ts +1 -1
- package/dist/types/functions/delete-path.d.ts +1 -1
- package/dist/types/functions/remove-from-json-file.d.ts +1 -1
- package/dist/types/functions/update-config-file.d.ts +1 -1
- package/dist/types/functions/update-json-file.d.ts +1 -1
- package/dist/types/functions/update-text-file.d.ts +1 -1
- package/dist/types/main.d.ts +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,6 +145,44 @@ If the `targetPath` does not exist, the function does nothing.
|
|
|
145
145
|
|
|
146
146
|
By default the function asks for confirmation before attempting to delete the `targetPath`. Setting the last optional parameter `force` to `true` will suppress manual confirmation prompts. Passsing a custom `prompt` allows tailoring your own question to the user.
|
|
147
147
|
|
|
148
|
+
### List of content checkers
|
|
149
|
+
|
|
150
|
+
#### `fileExists`
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
function fileExists(
|
|
154
|
+
targetFile: string
|
|
155
|
+
): boolean
|
|
156
|
+
```
|
|
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.
|
|
159
|
+
|
|
160
|
+
If the file exists , the function returns true, false otherwise.
|
|
161
|
+
|
|
162
|
+
#### `hasJsonKey`
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
function hasJsonKey(
|
|
166
|
+
targetFile: string, jsonKey: string
|
|
167
|
+
): boolean
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Checks whether given `jsonKey` exists in JSON 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.
|
|
171
|
+
|
|
172
|
+
Given `jsonKey` might point to a nested key using dot notation, e.g. `a.b.c`. If the key is present, the function returns true, false otherwise.
|
|
173
|
+
|
|
174
|
+
#### `hasText`
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
function hasText(
|
|
178
|
+
targetFile: string, row: string
|
|
179
|
+
): boolean
|
|
180
|
+
```
|
|
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.
|
|
183
|
+
|
|
184
|
+
If the `row` is present, the function returns true, false otherwise. Row must be matched completely, but surrounding whitespaces are ignored.
|
|
185
|
+
|
|
148
186
|
### List of terminal helpers
|
|
149
187
|
|
|
150
188
|
#### `promptUser`
|