@cluerise/tools 4.0.0 → 4.0.2

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.
package/README.md CHANGED
@@ -8,7 +8,7 @@ _Tools for maintaining TypeScript projects_
8
8
 
9
9
  ```sh
10
10
  pnpm add -DE @cluerise/tools
11
- pnpm exec @cluerise/tools init [all|name]
11
+ pnpm exec cluerise-tools init [all|name]
12
12
  ```
13
13
 
14
14
  Before you run the `init` command, make sure your `package.json` contains
@@ -1,4 +1,4 @@
1
- import { RuleConfigSeverity, UserConfig } from '@commitlint/types';
1
+ import { RuleConfigSeverity, type UserConfig } from '@commitlint/types';
2
2
 
3
3
  const commitlintConfig: UserConfig = {
4
4
  extends: ['@commitlint/config-conventional'],
@@ -1,8 +1,3 @@
1
1
  import eslintMarkdown from '@eslint/markdown';
2
2
 
3
- export default [
4
- {
5
- ignores: ['**/*.(j|t)sx?']
6
- },
7
- ...eslintMarkdown.configs.recommended
8
- ];
3
+ export default eslintMarkdown.configs.recommended;
@@ -75,7 +75,7 @@ export default defineConfig([
75
75
  },
76
76
  {
77
77
  name: 'cluerise: typescript-eslint/rules',
78
- files: ['**/*.tsx?'],
78
+ files: ['**/*.{ts,tsx}'],
79
79
  rules: {
80
80
  '@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }]
81
81
  }
@@ -135,7 +135,7 @@ export default defineConfig([
135
135
  },
136
136
  {
137
137
  name: 'cluerise: eslint/import/ts',
138
- files: ['**/*.tsx?'],
138
+ files: ['**/*.{ts,tsx}'],
139
139
  extends: [eslintPluginImport.flatConfigs.recommended, eslintPluginImport.flatConfigs.typescript],
140
140
  rules: {
141
141
  'import/first': 'error',
@@ -160,7 +160,7 @@ export default defineConfig([
160
160
  },
161
161
  {
162
162
  name: 'cluerise: eslint/import/rules/config.js,ts',
163
- files: ['*.config.js', '*.config.ts'],
163
+ files: ['*.config.{js,ts}'],
164
164
  rules: {
165
165
  'import/no-default-export': 'off'
166
166
  }
@@ -254,11 +254,14 @@ class FileUtils {
254
254
  await FileSystem.mkdir(Path.dirname(absolutePath), { recursive: true });
255
255
  return FileSystem.writeFile(absolutePath, fileContent);
256
256
  }
257
- static async copyFile(sourceDirectory, filePath, destinationFilePath) {
257
+ static async copyFile(sourceDirectory, filePath, destinationFilePath, mode) {
258
258
  const sourcePath = Path.resolve(sourceDirectory, filePath);
259
259
  const destinationPath = Path.resolve(Process.cwd(), destinationFilePath ?? filePath);
260
260
  await FileSystem.mkdir(Path.dirname(destinationPath), { recursive: true });
261
- return FileSystem.copyFile(sourcePath, destinationPath);
261
+ await FileSystem.copyFile(sourcePath, destinationPath);
262
+ if (mode !== void 0) {
263
+ await FileSystem.chmod(destinationPath, mode);
264
+ }
262
265
  }
263
266
  }
264
267
  class JsonUtils {
@@ -352,13 +355,11 @@ initEditorConfig_fn = async function() {
352
355
  await FileUtils.copyFile(__privateGet(this, _configDirectory), ".editorconfig");
353
356
  };
354
357
  initESLint_fn = async function() {
355
- const configName = "eslint.config";
356
- const configPath = `${configName}.js`;
357
- const markdownConfigName = "eslint-markdown.config";
358
- const markdownConfigPath = `${markdownConfigName}.js`;
359
- const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configName}';
358
+ const configPath = "eslint.config.js";
359
+ const markdownConfigPath = "eslint-markdown.config.js";
360
+ const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configPath}';
360
361
  `;
361
- const markdownConfigContent = `export { default } from '${__privateGet(this, _configPackage)}/${markdownConfigName}';
362
+ const markdownConfigContent = `export { default } from '${__privateGet(this, _configPackage)}/${markdownConfigPath}';
362
363
  `;
363
364
  await FileUtils.createFile(configPath, configContent);
364
365
  await FileUtils.createFile(markdownConfigPath, markdownConfigContent);
@@ -374,12 +375,13 @@ initGit_fn = async function() {
374
375
  Path.join(gitHookDirectory, "pre-commit"),
375
376
  Path.join(gitHookDirectory, "prepare-commit-msg")
376
377
  ];
377
- await Promise.all(gitHookPaths.map((gitHookPath) => FileUtils.copyFile(__privateGet(this, _configDirectory), gitHookPath)));
378
+ await Promise.all(
379
+ gitHookPaths.map((gitHookPath) => FileUtils.copyFile(__privateGet(this, _configDirectory), gitHookPath, void 0, 493))
380
+ );
378
381
  };
379
382
  initLintStaged_fn = async function() {
380
- const configName = "lint-staged.config";
381
- const configPath = `${configName}.js`;
382
- const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configName}';
383
+ const configPath = "lint-staged.config.js";
384
+ const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configPath}';
383
385
  `;
384
386
  await FileUtils.createFile(configPath, configContent);
385
387
  };
@@ -388,14 +390,12 @@ initNvm_fn = async function() {
388
390
  };
389
391
  initPnpm_fn = async function() {
390
392
  const workspacePath = "pnpm-workspace.yaml";
391
- const workspaceContent = `engineStrict: true
392
- `;
393
+ const workspaceContent = "engineStrict: true\n\npublicHoistPattern:\n - '@commitlint/cli'\n - eslint\n - lint-staged\n - prettier\n";
393
394
  await FileUtils.createFile(workspacePath, workspaceContent);
394
395
  };
395
396
  initPrettier_fn = async function() {
396
- const configName = "prettier.config";
397
- const configPath = `${configName}.js`;
398
- const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configName}';
397
+ const configPath = "prettier.config.js";
398
+ const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configPath}';
399
399
  `;
400
400
  await FileUtils.createFile(configPath, configContent);
401
401
  };
@@ -422,10 +422,9 @@ getReleaseConfigParams_fn = async function() {
422
422
  }
423
423
  };
424
424
  initRelease_fn = async function() {
425
- const configName = "release.config";
426
- const configPath = `${configName}.js`;
425
+ const configPath = "release.config.js";
427
426
  const configParams = await __privateMethod(this, _ToolInitializer_instances, getReleaseConfigParams_fn).call(this);
428
- const configContent = `import { createReleaseConfig } from '${__privateGet(this, _configPackage)}/${configName}';
427
+ const configContent = `import { createReleaseConfig } from '${__privateGet(this, _configPackage)}/${configPath}';
429
428
 
430
429
  export default createReleaseConfig(${JsonUtils.prettify(configParams)});
431
430
  `;
@@ -434,10 +433,7 @@ export default createReleaseConfig(${JsonUtils.prettify(configParams)});
434
433
  initTypeScript_fn = async function() {
435
434
  const configPath = "tsconfig.json";
436
435
  const configContent = `{
437
- "extends": "${__privateGet(this, _configDirectory)}/${configPath}",
438
- "compilerOptions": {
439
- "baseUrl": "./"
440
- }
436
+ "extends": "${__privateGet(this, _configDirectory)}/${configPath}"
441
437
  }
442
438
  `;
443
439
  await FileUtils.createFile(configPath, configContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cluerise/tools",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Tools for maintaining TypeScript projects.",
5
5
  "author": "Branislav Holý <brano@holy.am>",
6
6
  "repository": "github:cluerise/tools",