@sapphire-sh/utils 1.59.0 → 1.61.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.
@@ -8,17 +8,22 @@ const START_MARKER = '# @sapphire-sh/utils:start';
8
8
  const END_MARKER = '# @sapphire-sh/utils:end';
9
9
 
10
10
  const sectioned = new Set(['.gitignore']);
11
+ const renameMap = new Map([
12
+ ['editorconfig.template', '.editorconfig'],
13
+ ['gitignore.template', '.gitignore'],
14
+ ['prettierignore.template', '.prettierignore'],
15
+ ]);
11
16
 
12
17
  const templatesDir = join(fileURLToPath(import.meta.url), '..', '..', 'templates');
13
18
  const cwd = process.cwd();
14
19
 
15
- const writeSectioned = (filename, content) => {
16
- const filepath = join(cwd, filename);
20
+ const writeSectioned = (outputName, content) => {
21
+ const filepath = join(cwd, outputName);
17
22
  const section = `${START_MARKER}\n${content}${END_MARKER}`;
18
23
 
19
24
  if (existsSync(filepath) === false) {
20
25
  writeFileSync(filepath, `${section}\n`);
21
- console.log(`wrote ${filename}`);
26
+ console.log(`wrote ${outputName}`);
22
27
  return;
23
28
  }
24
29
 
@@ -34,15 +39,16 @@ const writeSectioned = (filename, content) => {
34
39
  writeFileSync(filepath, `${section}\n\n${existing}`);
35
40
  }
36
41
 
37
- console.log(`wrote ${filename}`);
42
+ console.log(`wrote ${outputName}`);
38
43
  };
39
44
 
40
45
  for (const filename of readdirSync(templatesDir)) {
41
- if (sectioned.has(filename)) {
46
+ const outputName = renameMap.get(filename) ?? filename;
47
+ if (sectioned.has(outputName)) {
42
48
  const content = readFileSync(join(templatesDir, filename), 'utf-8');
43
- writeSectioned(filename, content);
49
+ writeSectioned(outputName, content);
44
50
  } else {
45
- copyFileSync(join(templatesDir, filename), join(cwd, filename));
46
- console.log(`wrote ${filename}`);
51
+ copyFileSync(join(templatesDir, filename), join(cwd, outputName));
52
+ console.log(`wrote ${outputName}`);
47
53
  }
48
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire-sh/utils",
3
- "version": "1.59.0",
3
+ "version": "1.61.0",
4
4
  "description": "@sapphire-sh/utils",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -37,7 +37,7 @@
37
37
  "files": [
38
38
  "bin/**/*",
39
39
  "lib/**/*",
40
- "templates/**/*",
40
+ "templates",
41
41
  "tsconfig.json",
42
42
  "tsconfig.esm.json"
43
43
  ],
@@ -0,0 +1,10 @@
1
+ *.log
2
+ *.tsbuildinfo
3
+ .DS_Store
4
+ .env
5
+ build/
6
+ coverage/
7
+ data/
8
+ dist/
9
+ lib/
10
+ node_modules/
@@ -2,12 +2,12 @@ root = true
2
2
 
3
3
  [*]
4
4
  charset = utf-8
5
- indent_style = tab
6
- indent_size = 2
7
5
  end_of_line = lf
6
+ indent_size = 2
7
+ indent_style = tab
8
8
  insert_final_newline = true
9
9
  trim_trailing_whitespace = true
10
10
 
11
11
  [*.{json,md,yml}]
12
- indent_style = space
13
12
  indent_size = 2
13
+ indent_style = space