@cluerise/tools 4.0.0 → 4.0.1

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
@@ -257,8 +257,9 @@ class FileUtils {
257
257
  static async copyFile(sourceDirectory, filePath, destinationFilePath) {
258
258
  const sourcePath = Path.resolve(sourceDirectory, filePath);
259
259
  const destinationPath = Path.resolve(Process.cwd(), destinationFilePath ?? filePath);
260
+ const sourceStat = await FileSystem.stat(sourcePath);
260
261
  await FileSystem.mkdir(Path.dirname(destinationPath), { recursive: true });
261
- return FileSystem.copyFile(sourcePath, destinationPath);
262
+ return FileSystem.copyFile(sourcePath, destinationPath, sourceStat.mode);
262
263
  }
263
264
  }
264
265
  class JsonUtils {
@@ -352,13 +353,11 @@ initEditorConfig_fn = async function() {
352
353
  await FileUtils.copyFile(__privateGet(this, _configDirectory), ".editorconfig");
353
354
  };
354
355
  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}';
356
+ const configPath = "eslint.config.js";
357
+ const markdownConfigPath = "eslint-markdown.config.js";
358
+ const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configPath}';
360
359
  `;
361
- const markdownConfigContent = `export { default } from '${__privateGet(this, _configPackage)}/${markdownConfigName}';
360
+ const markdownConfigContent = `export { default } from '${__privateGet(this, _configPackage)}/${markdownConfigPath}';
362
361
  `;
363
362
  await FileUtils.createFile(configPath, configContent);
364
363
  await FileUtils.createFile(markdownConfigPath, markdownConfigContent);
@@ -377,9 +376,8 @@ initGit_fn = async function() {
377
376
  await Promise.all(gitHookPaths.map((gitHookPath) => FileUtils.copyFile(__privateGet(this, _configDirectory), gitHookPath)));
378
377
  };
379
378
  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}';
379
+ const configPath = "lint-staged.config.js";
380
+ const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configPath}';
383
381
  `;
384
382
  await FileUtils.createFile(configPath, configContent);
385
383
  };
@@ -388,14 +386,12 @@ initNvm_fn = async function() {
388
386
  };
389
387
  initPnpm_fn = async function() {
390
388
  const workspacePath = "pnpm-workspace.yaml";
391
- const workspaceContent = `engineStrict: true
392
- `;
389
+ const workspaceContent = "engineStrict: true\n\npublicHoistPattern:\n - '@commitlint/cli'\n - eslint\n - lint-staged\n - prettier\n";
393
390
  await FileUtils.createFile(workspacePath, workspaceContent);
394
391
  };
395
392
  initPrettier_fn = async function() {
396
- const configName = "prettier.config";
397
- const configPath = `${configName}.js`;
398
- const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configName}';
393
+ const configPath = "prettier.config.js";
394
+ const configContent = `export { default } from '${__privateGet(this, _configPackage)}/${configPath}';
399
395
  `;
400
396
  await FileUtils.createFile(configPath, configContent);
401
397
  };
@@ -422,10 +418,9 @@ getReleaseConfigParams_fn = async function() {
422
418
  }
423
419
  };
424
420
  initRelease_fn = async function() {
425
- const configName = "release.config";
426
- const configPath = `${configName}.js`;
421
+ const configPath = "release.config.js";
427
422
  const configParams = await __privateMethod(this, _ToolInitializer_instances, getReleaseConfigParams_fn).call(this);
428
- const configContent = `import { createReleaseConfig } from '${__privateGet(this, _configPackage)}/${configName}';
423
+ const configContent = `import { createReleaseConfig } from '${__privateGet(this, _configPackage)}/${configPath}';
429
424
 
430
425
  export default createReleaseConfig(${JsonUtils.prettify(configParams)});
431
426
  `;
@@ -434,10 +429,7 @@ export default createReleaseConfig(${JsonUtils.prettify(configParams)});
434
429
  initTypeScript_fn = async function() {
435
430
  const configPath = "tsconfig.json";
436
431
  const configContent = `{
437
- "extends": "${__privateGet(this, _configDirectory)}/${configPath}",
438
- "compilerOptions": {
439
- "baseUrl": "./"
440
- }
432
+ "extends": "${__privateGet(this, _configDirectory)}/${configPath}"
441
433
  }
442
434
  `;
443
435
  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.1",
4
4
  "description": "Tools for maintaining TypeScript projects.",
5
5
  "author": "Branislav Holý <brano@holy.am>",
6
6
  "repository": "github:cluerise/tools",