@18f/identity-normalize-yaml
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
/** @type {Record<string,any>=} */ | ||
const prettierConfig = prettier.resolveConfig.sync(process.cwd()); | ||
const prettierConfig = (await prettier.resolveConfig(process.cwd())) || undefined; | ||
@@ -38,3 +38,3 @@ const args = process.argv.slice(2); | ||
try { | ||
await writeFile(absolutePath, normalize(content, options)); | ||
await writeFile(absolutePath, await normalize(content, options)); | ||
} catch (error) { | ||
@@ -41,0 +41,0 @@ console.error(`Error normalizing ${relativePath}: ${error.message}`); |
@@ -15,3 +15,3 @@ import YAML from 'yaml'; | ||
/** | ||
* Given an input YAML string and optional options, returns a normalized YAML string. | ||
* Given an input YAML string and optional options, resolves to a normalized YAML string. | ||
* | ||
@@ -21,3 +21,3 @@ * @param {string} content Original content. | ||
* | ||
* @return {string} Normalized content. | ||
* @return {Promise<string>} Normalized content. | ||
*/ | ||
@@ -24,0 +24,0 @@ function normalize(content, { prettierConfig, exclude } = {}) { |
@@ -5,3 +5,3 @@ { | ||
"description": "Normalizes YAML files to ensure consistency and typographical quality", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"type": "module", | ||
@@ -38,7 +38,7 @@ "main": "./index.js", | ||
"smartquotes": "^2.3.2", | ||
"yaml": "^2.3.1" | ||
"yaml": "^2.3.4" | ||
}, | ||
"peerDependencies": { | ||
"prettier": "*" | ||
"prettier": ">=3" | ||
} | ||
} |
@@ -52,5 +52,5 @@ # @18f/identity-normalize-yaml | ||
#### `normalize(content: string, config?: Options): string` | ||
#### `normalize(content: string, config?: Options): Promise<string>` | ||
Given an input YAML string and optional options, returns a normalized YAML string. | ||
Given an input YAML string and optional options, resolves to a normalized YAML string. | ||
@@ -57,0 +57,0 @@ **Options:** |
@@ -21,3 +21,3 @@ export default normalize; | ||
/** | ||
* Given an input YAML string and optional options, returns a normalized YAML string. | ||
* Given an input YAML string and optional options, resolves to a normalized YAML string. | ||
* | ||
@@ -27,4 +27,4 @@ * @param {string} content Original content. | ||
* | ||
* @return {string} Normalized content. | ||
* @return {Promise<string>} Normalized content. | ||
*/ | ||
declare function normalize(content: string, { prettierConfig, exclude }?: NormalizeOptions): string; | ||
declare function normalize(content: string, { prettierConfig, exclude }?: NormalizeOptions): Promise<string>; |
8574
+ Addedprettier@3.2.5(transitive)
+ Addedyaml@2.4.2(transitive)
- Removedprettier@3.3.1(transitive)
- Removedyaml@2.4.3(transitive)
Updatedyaml@^2.3.4