@sheplu/editorconfig 0.5.2 → 0.7.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 (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +31 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A small CLI to manage a **consistent `.editorconfig`** across your projects.
4
4
 
5
5
  - ✅ Generate a sane default `.editorconfig` in seconds
6
- - 🔜 Check if your existing file matches the target setup
6
+ - Check if your existing file matches the target setup
7
7
  - 🔜 Propose updates (with confirmation) instead of blindly overwriting
8
8
  - 🔜 Compare your file against the recommended template
9
9
 
package/index.js CHANGED
@@ -1,13 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { copyFile } from 'node:fs/promises';
3
+ import { readFileSync, writeFileSync } from "node:fs";
4
4
 
5
- export async function createEditorConfig(path = '.editorconfig') {
6
- await copyFile('.editorconfig', path);
5
+ const editorconfigContent = `root = true
6
+
7
+ [*]
8
+ indent_style = tab
9
+ indent_size = 4
10
+ tab_width = 4
11
+ end_of_line = lf
12
+ charset = utf-8
13
+ spelling_language = en
14
+ trim_trailing_whitespace = true
15
+ insert_final_newline = true
16
+ quote_type = single
17
+ spaces_around_operators = true
18
+ `;
19
+
20
+ export function createEditorConfig(path = '.editorconfig') {
21
+ writeFileSync(path, editorconfigContent, 'utf8');
22
+ };
23
+
24
+ export function compareEditorConfig(path = '.editorconfig') {
25
+ const file = readFileSync(path).toString();
26
+ if(editorconfigContent === file) {
27
+ console.log('✅ Editorconfig is matching the expected configuration')
28
+ }
29
+ else {
30
+ console.log('❌ Editorconfig is not matching the expected configuration');
31
+ }
7
32
  };
8
33
 
9
- async function main() {
10
- await createEditorConfig();
34
+ function main() {
35
+ readEditorConfig();
11
36
  };
12
37
 
13
- await main();
38
+ main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheplu/editorconfig",
3
- "version": "0.5.2",
3
+ "version": "0.7.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {