elrh-cosca 0.3.5 → 0.4.0

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.
Files changed (92) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +419 -265
  3. package/dist/chunks/magicast-B0ixXlDw.mjs +14033 -0
  4. package/dist/chunks/rolldown-runtime-Dqa2HsxW.mjs +20 -0
  5. package/dist/chunks/yaml-BwPmYYDT.mjs +4297 -0
  6. package/dist/elrh-cosca.mjs +489 -15390
  7. package/dist/types/index.d.ts +1 -1
  8. package/dist/types/src/_private/fetch-file.d.ts +1 -0
  9. package/dist/types/src/checks/get-package-manager.d.ts +6 -0
  10. package/dist/types/src/checks/has-json-key.d.ts +11 -0
  11. package/dist/types/src/checks/has-text.d.ts +12 -0
  12. package/dist/types/src/checks/has-yaml-key.d.ts +11 -0
  13. package/dist/types/src/checks/path-exists.d.ts +10 -0
  14. package/dist/types/src/functions/create-file-from-template.d.ts +13 -0
  15. package/dist/types/src/functions/create-file-from-web-template.d.ts +13 -0
  16. package/dist/types/src/functions/delete-path.d.ts +12 -0
  17. package/dist/types/src/functions/remove-from-json-file.d.ts +13 -0
  18. package/dist/types/src/functions/remove-from-text-file.d.ts +13 -0
  19. package/dist/types/src/functions/remove-from-yaml-file.d.ts +13 -0
  20. package/dist/types/src/functions/update-config-file.d.ts +20 -0
  21. package/dist/types/src/functions/update-json-file.d.ts +15 -0
  22. package/dist/types/src/functions/update-text-file.d.ts +15 -0
  23. package/dist/types/src/functions/update-yaml-file.d.ts +15 -0
  24. package/dist/types/src/main.d.ts +23 -0
  25. package/dist/types/src/terminal/prompt-user.d.ts +11 -0
  26. package/dist/types/src/terminal/show-error.d.ts +9 -0
  27. package/dist/types/src/terminal/show-message.d.ts +9 -0
  28. package/dist/types/src/types/data.d.ts +6 -0
  29. package/dist/types/src/types/functions.d.ts +99 -0
  30. package/dist/types/src/utils/get-env-value.d.ts +10 -0
  31. package/dist/types/{utils → src/utils}/parse-qualified-path.d.ts +4 -2
  32. package/dist/types/src/utils/resolve-package-path.d.ts +12 -0
  33. package/dist/types/test/checks-get-package-manager.test.d.ts +1 -0
  34. package/dist/types/test/checks-has-json-key.test.d.ts +1 -0
  35. package/dist/types/test/checks-has-text.test.d.ts +1 -0
  36. package/dist/types/test/checks-has-yaml-key.test.d.ts +1 -0
  37. package/dist/types/test/checks-path-exists.test.d.ts +1 -0
  38. package/dist/types/test/cosca-test-setup.d.ts +1 -0
  39. package/dist/types/test/cosca-test-utils.d.ts +45 -0
  40. package/dist/types/test/fixtures/config-file-default.d.ts +10 -0
  41. package/dist/types/test/fixtures/config-file-named.d.ts +9 -0
  42. package/dist/types/test/functions-create-file-from-template.test.d.ts +1 -0
  43. package/dist/types/test/functions-create-file-from-web-template.test.d.ts +1 -0
  44. package/dist/types/test/functions-delete-path.test.d.ts +1 -0
  45. package/dist/types/test/functions-remove-from-json-file.test.d.ts +1 -0
  46. package/dist/types/test/functions-remove-from-text-file.test.d.ts +1 -0
  47. package/dist/types/test/functions-remove-from-yaml-file.test.d.ts +1 -0
  48. package/dist/types/test/functions-update-config-file.test.d.ts +1 -0
  49. package/dist/types/test/functions-update-json-file.test.d.ts +1 -0
  50. package/dist/types/test/functions-update-text-file.test.d.ts +1 -0
  51. package/dist/types/test/functions-update-yaml-file.test.d.ts +1 -0
  52. package/dist/types/test/private-check-path.test.d.ts +1 -0
  53. package/dist/types/test/private-deep-merge-object.test.d.ts +1 -0
  54. package/dist/types/test/private-fetch-file.test.d.ts +1 -0
  55. package/dist/types/test/snapshots/created-config-file.d.ts +7 -0
  56. package/dist/types/test/snapshots/updated-config-file-default-1.d.ts +13 -0
  57. package/dist/types/test/snapshots/updated-config-file-default-2.d.ts +14 -0
  58. package/dist/types/test/snapshots/updated-config-file-default-3.d.ts +16 -0
  59. package/dist/types/test/snapshots/updated-config-file-default-4.d.ts +18 -0
  60. package/dist/types/test/snapshots/updated-config-file-named-1.d.ts +12 -0
  61. package/dist/types/test/snapshots/updated-config-file-named-2.d.ts +13 -0
  62. package/dist/types/test/snapshots/updated-config-file-named-3.d.ts +15 -0
  63. package/dist/types/test/snapshots/updated-config-file-named-4.d.ts +17 -0
  64. package/dist/types/test/terminal-prompt-user.test.d.ts +1 -0
  65. package/dist/types/test/terninal-show-error.test.d.ts +1 -0
  66. package/dist/types/test/terninal-show-message.test.d.ts +1 -0
  67. package/dist/types/test/utils-get-env-value.test.d.ts +1 -0
  68. package/dist/types/test/utils-parse-qualified-path.test.d.ts +1 -0
  69. package/dist/types/test/utils-resolve-package-path.test.d.ts +1 -0
  70. package/package.json +15 -11
  71. package/test/cosca-test.js +55 -55
  72. package/dist/types/_private/fetch-file.d.ts +0 -1
  73. package/dist/types/checks/get-package-manager.d.ts +0 -6
  74. package/dist/types/checks/has-json-key.d.ts +0 -9
  75. package/dist/types/checks/has-text.d.ts +0 -10
  76. package/dist/types/checks/path-exists.d.ts +0 -8
  77. package/dist/types/functions/create-file-from-template.d.ts +0 -11
  78. package/dist/types/functions/create-file-from-web-template.d.ts +0 -11
  79. package/dist/types/functions/delete-path.d.ts +0 -10
  80. package/dist/types/functions/remove-from-json-file.d.ts +0 -11
  81. package/dist/types/functions/update-config-file.d.ts +0 -14
  82. package/dist/types/functions/update-json-file.d.ts +0 -13
  83. package/dist/types/functions/update-text-file.d.ts +0 -11
  84. package/dist/types/main.d.ts +0 -18
  85. package/dist/types/terminal/prompt-user.d.ts +0 -11
  86. package/dist/types/terminal/show-error.d.ts +0 -7
  87. package/dist/types/terminal/show-message.d.ts +0 -7
  88. package/dist/types/types/json.d.ts +0 -6
  89. package/dist/types/utils/get-env-value.d.ts +0 -8
  90. package/dist/types/utils/resolve-package-path.d.ts +0 -10
  91. /package/dist/types/{_private → src/_private}/check-path.d.ts +0 -0
  92. /package/dist/types/{_private → src/_private}/deep-merge-object.d.ts +0 -0
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ stringKey: string;
3
+ numberKey: number;
4
+ boolKey: boolean;
5
+ arrayKey: string[];
6
+ objectKey: {
7
+ nestedKey: string;
8
+ };
9
+ testKey1: string;
10
+ testKey2: number;
11
+ testKey3: boolean;
12
+ testKey4: {
13
+ nestedKey: {
14
+ deeper: boolean;
15
+ };
16
+ };
17
+ };
18
+ export default _default;
@@ -0,0 +1,12 @@
1
+ export declare const config: {
2
+ stringKey: string;
3
+ numberKey: number;
4
+ boolKey: boolean;
5
+ arrayKey: string[];
6
+ objectKey: {
7
+ nestedKey: string;
8
+ };
9
+ testKey1: string;
10
+ testKey2: number;
11
+ testKey3: boolean;
12
+ };
@@ -0,0 +1,13 @@
1
+ export declare const config: {
2
+ stringKey: string;
3
+ numberKey: number;
4
+ boolKey: boolean;
5
+ arrayKey: string[];
6
+ objectKey: {
7
+ nestedKey: string;
8
+ };
9
+ testKey1: string;
10
+ testKey2: number;
11
+ testKey3: boolean;
12
+ testKey4: string;
13
+ };
@@ -0,0 +1,15 @@
1
+ export declare const config: {
2
+ stringKey: string;
3
+ numberKey: number;
4
+ boolKey: boolean;
5
+ arrayKey: string[];
6
+ objectKey: {
7
+ nestedKey: string;
8
+ };
9
+ testKey1: string;
10
+ testKey2: number;
11
+ testKey3: boolean;
12
+ testKey4: {
13
+ nestedKey: string;
14
+ };
15
+ };
@@ -0,0 +1,17 @@
1
+ export declare const config: {
2
+ stringKey: string;
3
+ numberKey: number;
4
+ boolKey: boolean;
5
+ arrayKey: string[];
6
+ objectKey: {
7
+ nestedKey: string;
8
+ };
9
+ testKey1: string;
10
+ testKey2: number;
11
+ testKey3: boolean;
12
+ testKey4: {
13
+ nestedKey: {
14
+ deeper: boolean;
15
+ };
16
+ };
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "elrh-cosca",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
+ "sideEffects": false,
5
6
  "files": [
6
7
  "dist"
7
8
  ],
@@ -17,18 +18,21 @@
17
18
  },
18
19
  "module": "./dist/elrh-cosca.mjs",
19
20
  "types": "./dist/types/index.d.ts",
20
- "devDependencies": {
21
- "@types/node": "^24.9.0",
22
- "magicast": "^0.5.0",
23
- "typescript": "^5.9.3",
24
- "vite": "^7.1.12",
25
- "vite-plugin-dts": "^4.5.4",
26
- "vitest": "^4.0.4"
27
- },
28
21
  "scripts": {
29
22
  "dev": "vite",
30
23
  "build": "pnpm install && vitest run && tsc && vite build",
31
24
  "preview": "vite preview",
32
- "test": "vitest run"
25
+ "prepublishOnly": "pnpm build",
26
+ "test": "vitest run --coverage"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^26.6.0",
30
+ "@vitest/coverage-v8": "^5.0.2",
31
+ "magicast": "^0.5.5",
32
+ "typescript": "^6.0.0",
33
+ "vite": "^8.0.0",
34
+ "vite-plugin-dts": "^5.0.0",
35
+ "vitest": "^5.0.2",
36
+ "yaml": "^2.9.1"
33
37
  }
34
- }
38
+ }
@@ -1,55 +1,55 @@
1
- #!/usr/bin/env node
2
-
3
- // manual test script for COSCA functions
4
-
5
- import {
6
- createFileFromTemplate, createFileFromWebTemplate, promptUser, showError, showMessage,
7
- updateConfigFile, getEnvValue, updateJsonFile, updateTextFile, deletePath, removeFromJsonFile
8
- } from '../dist/elrh-cosca.mjs'
9
-
10
- async function main() {
11
- console.log('Test showMessage')
12
- showMessage('Hello!')
13
- console.log('Test showMessage')
14
- showError('ERROR!')
15
-
16
- console.log('Test getEnvValue')
17
- const a = getEnvValue('A')
18
- const b = getEnvValue('B')
19
- const c = getEnvValue('C')
20
- const d = getEnvValue('D')
21
- const e = getEnvValue('E')
22
- console.log(a, b, c, d, e)
23
-
24
- console.log('Test promptUser')
25
- const input = await promptUser('Is it today?')
26
- console.log('User input:', input)
27
-
28
- console.log('\nTest createFileFromTemplate')
29
- await createFileFromTemplate('vitest:README.md', 'test/snapshots/test.file1')
30
- await createFileFromTemplate('elrh-cosca:test/fixtures/text-file.txt', 'test/snapshots/test.file2')
31
-
32
- console.log('\nTest createFileFromWebTemplate')
33
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/heads/main/config/vitest.config.ts.template', 'test/snapshots/test.file3')
34
-
35
- console.log('\nTest updateConfigFile')
36
- await updateConfigFile('test/fixtures/config-file-default.ts', { compatibilityDate: '2025-08-26', extends: ['nuxt-iignis'], cosca: { exists: true, data: ['some', 'other'], raw: 'war' } })
37
-
38
- console.log('\nTest updateJsonFile')
39
- await updateJsonFile('test/fixtures/json-file.json', 'scripts', { 'cosca' : 'cosca' })
40
- await updateJsonFile('test/fixtures/json-file.json', 'packageManager', 'pnpm' )
41
-
42
- console.log('\nTest removeFromJsonFile')
43
- await removeFromJsonFile('test/fixtures/json-file.json', 'cosca')
44
-
45
- console.log('\nTest updateTextFile')
46
- await updateTextFile('test/fixtures/text-file.txt', ['# COSCA'])
47
-
48
- console.log('\nTest deletePath')
49
- await deletePath('test/snapshots/test.file1')
50
- }
51
-
52
- main().catch((err) => {
53
- console.error(err)
54
- process.exit(1)
55
- })
1
+ #!/usr/bin/env node
2
+
3
+ // manual test script for COSCA functions
4
+
5
+ import {
6
+ createFileFromTemplate, createFileFromWebTemplate, promptUser, showError, showMessage,
7
+ updateConfigFile, getEnvValue, updateJsonFile, updateTextFile, deletePath, removeFromJsonFile
8
+ } from '../dist/elrh-cosca.mjs'
9
+
10
+ async function main() {
11
+ console.log('Test showMessage')
12
+ showMessage({ message: 'Hello!' })
13
+ console.log('Test showMessage')
14
+ showError({ message: 'ERROR!' })
15
+
16
+ console.log('Test getEnvValue')
17
+ const a = getEnvValue({ key: 'A' })
18
+ const b = getEnvValue({ key: 'B' })
19
+ const c = getEnvValue({ key: 'C' })
20
+ const d = getEnvValue({ key: 'D' })
21
+ const e = getEnvValue({ key: 'E' })
22
+ console.log(a, b, c, d, e)
23
+
24
+ console.log('Test promptUser')
25
+ const input = await promptUser({ question: 'Is it today?' })
26
+ console.log('User input:', input)
27
+
28
+ console.log('\nTest createFileFromTemplate')
29
+ await createFileFromTemplate({ templateFile: 'vitest:README.md', targetFile: 'test/snapshots/test.file1' })
30
+ await createFileFromTemplate({ templateFile: 'elrh-cosca:test/fixtures/text-file.txt', targetFile: 'test/snapshots/test.file2' })
31
+
32
+ console.log('\nTest createFileFromWebTemplate')
33
+ await createFileFromWebTemplate({ url: 'https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/heads/main/config/vitest.config.ts.template', targetFile: 'test/snapshots/test.file3' })
34
+
35
+ console.log('\nTest updateConfigFile')
36
+ await updateConfigFile({ targetFile: 'test/fixtures/config-file-default.ts', newConfig: { compatibilityDate: '2025-08-26', extends: ['nuxt-iignis'], cosca: { exists: true, data: ['some', 'other'], raw: 'war' } } })
37
+
38
+ console.log('\nTest updateJsonFile')
39
+ await updateJsonFile({ targetFile: 'test/fixtures/json-file.json', jsonKey: 'scripts', patch: { 'cosca' : 'cosca' } })
40
+ await updateJsonFile({ targetFile: 'test/fixtures/json-file.json', jsonKey: 'packageManager', patch: 'pnpm' })
41
+
42
+ console.log('\nTest removeFromJsonFile')
43
+ await removeFromJsonFile({ targetFile: 'test/fixtures/json-file.json', jsonKey: 'cosca' })
44
+
45
+ console.log('\nTest updateTextFile')
46
+ await updateTextFile({ targetFile: 'test/fixtures/text-file.txt', rowsToAdd: ['# COSCA'] })
47
+
48
+ console.log('\nTest deletePath')
49
+ await deletePath({ targetPath: 'test/snapshots/test.file1' })
50
+ }
51
+
52
+ main().catch((err) => {
53
+ console.error(err)
54
+ process.exit(1)
55
+ })
@@ -1 +0,0 @@
1
- export declare function fetchFile(url: string): Promise<string>;
@@ -1,6 +0,0 @@
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 +0,0 @@
1
- /**
2
- * Checks if a JSON file contains specified key.
3
- *
4
- * @param {string} targetFile - The path to the JSON file to be checked (relative to CWD).
5
- * @param {string} jsonKey - The key in the JSON file to be checked for existence (may use dot notation for nested keys).
6
- * @returns {boolean} True if the key exists in target file, false otherwise.
7
- * @throws Will throw an error if the path is invalid, file does not exist or cannot be parsed as JSON.
8
- */
9
- export declare function hasJsonKey(targetFile: string, jsonKey: string): boolean;
@@ -1,10 +0,0 @@
1
- /**
2
- * Checks if a text file contains specified text.
3
- *
4
- * @param {string} targetFile - The path to the text file to be checked (relative to CWD).
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.
8
- * @throws Will throw an error if the path is invalid or the file does not exist.
9
- */
10
- export declare function hasText(targetFile: string, pattern: string | RegExp, exact?: boolean): boolean;
@@ -1,8 +0,0 @@
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,11 +0,0 @@
1
- /**
2
- * Creates a new copy of given file from a local template.
3
- *
4
- * @param {string} templateFile - The path to the template file (prefixed with package name).
5
- * @param {string} targetFile - The path to the target file to create (relative to CWD). Can overwrite existing files if confirmed.
6
- * @param {boolean} force - Whether to force creation without prompting.
7
- * @param {string} prompt - Custom prompt message displayed in terminal.
8
- * @returns {Promise<void>} An empty promise that resolves when the file is created.
9
- * @throws Will throw an error if the path is invalid, the template file cannot be found or the target file failed to be created.
10
- */
11
- export declare function createFileFromTemplate(templateFile: string, targetFile: string, force?: boolean, prompt?: string): Promise<void>;
@@ -1,11 +0,0 @@
1
- /**
2
- * Creates a new copy of given file from a web template.
3
- *
4
- * @param {string} url - The URL to the template file (must be accessible via `node:https.get` and return raw text data).
5
- * @param {string} targetFile - The path to the target file to create (relative to CWD). Can overwrite existing files if confirmed.
6
- * @param {boolean} force - Whether to force creation without prompting.
7
- * @param {string} prompt - Custom prompt message displayed in terminal.
8
- * @returns {Promise<void>} An empty promise that resolves when the file is created.
9
- * @throws Will throw an error if the path is invalid, the remote template cannot be fetched or the target file failed to be created.
10
- */
11
- export declare function createFileFromWebTemplate(url: string, targetFile: string, force?: boolean, prompt?: string): Promise<void>;
@@ -1,10 +0,0 @@
1
- /**
2
- * Deletes given path from FS.
3
- *
4
- * @param {string} targetPath - The path to delete (relative to CWD).
5
- * @param {boolean} force - Whether to force the deletion without prompting.
6
- * @param {string} prompt - Custom prompt message displayed in terminal.
7
- * @returns {Promise<void>} An empty promise that resolves when the path is deleted.
8
- * @throws Will throw an error if the path is invalid.
9
- */
10
- export declare function deletePath(targetPath: string, force?: boolean, prompt?: string): Promise<void>;
@@ -1,11 +0,0 @@
1
- /**
2
- * Updates a JSON file by deleting a specified key.
3
- *
4
- * @param {string} targetFile - The path to the JSON file to update (relative to CWD).
5
- * @param {string} jsonKey - The key in the JSON file to be deleted (may use dot notation for nested keys).
6
- * @param {boolean} force - Whether to force the update without prompting.
7
- * @param {string} prompt - Custom prompt message displayed in terminal.
8
- * @returns {Promise<void>} An empty promise that resolves when the file is updated.
9
- * @throws Will throw an error if the path is invalid, the file does not exist or cannot be parsed as JSON.
10
- */
11
- export declare function removeFromJsonFile(targetFile: string, jsonKey: string, force?: boolean, prompt?: string): Promise<void>;
@@ -1,14 +0,0 @@
1
- /**
2
- * Update the single object-literal config found in a file.
3
- *
4
- * The function:
5
- * - Reads and edits the file as code (no execution).
6
- * - Uses `defu(newConfig, existingConfig)` so `newConfig` takes precedence.
7
- * - Applies the merged result back onto the AST to preserve TS/ESM structure.
8
- *
9
- * @param {string} targetFile - Path to file, relative to project root (process.cwd()).
10
- * @param {object} newConfig - Config to merge in (takes precedence).
11
- * @returns {Promise<void>} An empty promise that resolves when the file is updated.
12
- * @throws Will throw an error the path is invalid, the file doesn't exist or no config export is found or it cannot be processed.
13
- */
14
- export declare function updateConfigFile(targetFile: string, newConfig: Record<string | number | symbol, any>, force?: boolean, prompt?: string): Promise<void>;
@@ -1,13 +0,0 @@
1
- import { JsonValue } from '../types/json.js';
2
- /**
3
- * Updates a JSON file by modifying a specific key with new values.
4
- *
5
- * @param {string} targetFile - The path to the JSON file to update (relative to CWD).
6
- * @param {string} jsonKey - The key in the JSON file to update (can be new or existing).
7
- * @param {JsonPrimitive} patch - The new values to set for the specified key.
8
- * @param {boolean} force - Whether to force the update without prompting.
9
- * @param {string} prompt - Custom prompt message displayed in terminal.
10
- * @returns {Promise<void>} An empty promise that resolves when the file is updated.
11
- * @throws Will throw an error if the path is invalid, the file does not exist or cannot be parsed as JSON.
12
- */
13
- export declare function updateJsonFile(targetFile: string, jsonKey: string, patch: JsonValue, force?: boolean, prompt?: string): Promise<void>;
@@ -1,11 +0,0 @@
1
- /**
2
- * Updates a text file by adding new rows.
3
- *
4
- * @param {string} targetFile - The path to the text file to update (relative to CWD).
5
- * @param {string[]} rowsToAdd - New rows to be added at the end of the file.
6
- * @param {boolean} force - Whether to force the update without prompting.
7
- * @param {string} prompt - Custom prompt message displayed in terminal.
8
- * @returns {Promise<void>} An empty promise that resolves when the file is updated.
9
- * @throws Will throw an error if the path is invalid or the file does not exist.
10
- */
11
- export declare function updateTextFile(targetFile: string, rowsToAdd: string[], force?: boolean, prompt?: string): Promise<void>;
@@ -1,18 +0,0 @@
1
- import { getPackageManager } from './checks/get-package-manager';
2
- import { hasJsonKey } from './checks/has-json-key';
3
- import { hasText } from './checks/has-text';
4
- import { pathExists } from './checks/path-exists';
5
- import { createFileFromTemplate } from './functions/create-file-from-template';
6
- import { createFileFromWebTemplate } from './functions/create-file-from-web-template';
7
- import { deletePath } from './functions/delete-path';
8
- import { removeFromJsonFile } from './functions/remove-from-json-file';
9
- import { updateConfigFile } from './functions/update-config-file';
10
- import { updateJsonFile } from './functions/update-json-file';
11
- import { updateTextFile } from './functions/update-text-file';
12
- import { promptUser } from './terminal/prompt-user';
13
- import { showError } from './terminal/show-error';
14
- import { showMessage } from './terminal/show-message';
15
- import { getEnvValue } from './utils/get-env-value';
16
- import { parseQualifiedPath } from './utils/parse-qualified-path';
17
- import { resolvePackagePath } from './utils/resolve-package-path';
18
- export { getPackageManager, hasJsonKey, hasText, pathExists, createFileFromTemplate, createFileFromWebTemplate, deletePath, removeFromJsonFile, updateConfigFile, updateJsonFile, updateTextFile, promptUser, showError, showMessage, getEnvValue, parseQualifiedPath, resolvePackagePath, };
@@ -1,11 +0,0 @@
1
- /**
2
- * Prompts the user with a question and returns their response.
3
- *
4
- * @param {string} question - Question to ask the user
5
- * @param {{ input?: NodeJS.ReadableStream; output?: NodeJS.WritableStream }} options - Optional setting of custom input/output stream
6
- * @returns {Promise<boolean>} - true if the user answered yes (`y`, `Y`, `yes`, `YES`), false otherwise
7
- */
8
- export declare function promptUser(question: string, options?: {
9
- input?: NodeJS.ReadableStream;
10
- output?: NodeJS.WritableStream;
11
- }): Promise<boolean>;
@@ -1,7 +0,0 @@
1
- /**
2
- * Prints error message into stderr with specified number of newlines after it.
3
- *
4
- * @param {string} message - The error message text to display.
5
- * @param {number} linesAfter - The number of newlines to print after the message (default is 1).
6
- */
7
- export declare function showError(message: string, linesAfter?: number): void;
@@ -1,7 +0,0 @@
1
- /**
2
- * Prints message into stdout with specified number of newlines after it.
3
- *
4
- * @param {string} message - The message text to display.
5
- * @param {number} linesAfter - The number of newlines to print after the message (default is 1).
6
- */
7
- export declare function showMessage(message: string, linesAfter?: number): void;
@@ -1,6 +0,0 @@
1
- export type JsonPrimitive = string | number | boolean | null;
2
- export type JsonObject = {
3
- [key: string]: JsonValue;
4
- };
5
- export type JsonArray = JsonValue[];
6
- export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
@@ -1,8 +0,0 @@
1
- /**
2
- * Retrieves the value of an environment variable from a .env file.
3
- *
4
- * @param {string} key - The name of the environment variable to retrieve.
5
- * @param {string} envFilePath - The path to the .env file (default is the .env file in the project root).
6
- * @returns {string | undefined} - The value of the environment variable, or undefined if not found.
7
- */
8
- export declare function getEnvValue(key: string, envFilePath?: string): string | undefined;
@@ -1,10 +0,0 @@
1
- /**
2
- * Resolve a package's installed root directory *from the target app*.
3
- * Package name can be scoped (e.g. `@scope/package`).
4
- * Works with npm/yarn/pnpm, hoisting or not.
5
- *
6
- * @param {string} packageName - The name of the package to resolve.
7
- * @returns {string} The absolute path to the package's root directory.
8
- * @throws Will throw an error if the package cannot be found or accessed.
9
- */
10
- export declare function resolvePackagePath(packageName: string): string;