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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks what package manager was used to execute the current command.
3
+ *
4
+ * @returns {string} The name of the package manager used ('npm', 'yarn', 'pnpm', 'deno' or 'bun').
5
+ */
6
+ export declare function getPackageManager(): 'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun';
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Checks if a text file contains specified row.
2
+ * Checks if a text file contains specified text.
3
3
  *
4
4
  * @param {string} targetFile - The path to the text file to be checked (relative to CWD).
5
- * @param {string} row - The text row to be checked for existence.
6
- * @returns {boolean} True if the row exists in target file, false otherwise. Row must be matched completely, but surrounding whitespaces are ignored.
5
+ * @param {string | RegExp} pattern - The text or regular expression pattern to search for.
6
+ * @param {boolean} exact - If true, requires exact line match (default: false for partial matching).
7
+ * @returns {boolean} True if the pattern is found in target file, false otherwise.
7
8
  * @throws Will throw an error if the path is invalid or the file does not exist.
8
9
  */
9
- export declare function hasText(targetFile: string, row: string): boolean;
10
+ export declare function hasText(targetFile: string, pattern: string | RegExp, exact?: boolean): boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Checks if the specified path exists on FS.
3
+ *
4
+ * @param {string} targetPath - The path on FS to be checked (relative to CWD).
5
+ * @returns {boolean} True if the path exists, false otherwise.
6
+ * @throws Will throw an error if the path is invalid (can't traverse past CWD).
7
+ */
8
+ export declare function pathExists(targetPath: string): boolean;
@@ -1,6 +1,7 @@
1
- import { fileExists } from './checks/file-exists';
1
+ import { getPackageManager } from './checks/get-package-manager';
2
2
  import { hasJsonKey } from './checks/has-json-key';
3
3
  import { hasText } from './checks/has-text';
4
+ import { pathExists } from './checks/path-exists';
4
5
  import { createFileFromTemplate } from './functions/create-file-from-template';
5
6
  import { createFileFromWebTemplate } from './functions/create-file-from-web-template';
6
7
  import { deletePath } from './functions/delete-path';
@@ -14,4 +15,4 @@ import { showMessage } from './terminal/show-message';
14
15
  import { getEnvValue } from './utils/get-env-value';
15
16
  import { parseQualifiedPath } from './utils/parse-qualified-path';
16
17
  import { resolvePackagePath } from './utils/resolve-package-path';
17
- export { fileExists, hasJsonKey, hasText, createFileFromTemplate, createFileFromWebTemplate, deletePath, removeFromJsonFile, updateConfigFile, updateJsonFile, updateTextFile, promptUser, showError, showMessage, getEnvValue, parseQualifiedPath, resolvePackagePath, };
18
+ export { getPackageManager, hasJsonKey, hasText, pathExists, createFileFromTemplate, createFileFromWebTemplate, deletePath, removeFromJsonFile, updateConfigFile, updateJsonFile, updateTextFile, promptUser, showError, showMessage, getEnvValue, parseQualifiedPath, resolvePackagePath, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elrh-cosca",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -18,12 +18,12 @@
18
18
  "module": "./dist/elrh-cosca.mjs",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "devDependencies": {
21
- "@types/node": "^24.6.0",
22
- "magicast": "^0.3.5",
21
+ "@types/node": "^24.9.0",
22
+ "magicast": "^0.5.0",
23
23
  "typescript": "^5.9.3",
24
- "vite": "^7.1.8",
24
+ "vite": "^7.1.12",
25
25
  "vite-plugin-dts": "^4.5.4",
26
- "vitest": "^3.2.4"
26
+ "vitest": "^4.0.4"
27
27
  },
28
28
  "scripts": {
29
29
  "dev": "vite",
@@ -1,8 +0,0 @@
1
- /**
2
- * Checks if the specified file exists on FS.
3
- *
4
- * @param {string} targetFile - The path to the text file to be checked (relative to CWD).
5
- * @returns {boolean} True if the file exists, false otherwise.
6
- * @throws Will throw an error if the path is invalid (can't traverse past CWD).
7
- */
8
- export declare function fileExists(targetFile: string): boolean;