@cluerise/tools 4.2.0 → 4.2.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.
@@ -50,7 +50,7 @@ export default defineConfig([
50
50
  },
51
51
  {
52
52
  name: 'cluerise: typescript-eslint/disable-type-checked',
53
- files: ['**/*.html', '**/*.js', '**/*.json', '**/*.jsonc', '**/*.yaml'],
53
+ files: ['**/*.html', '**/*.js', '**/*.cjs', '**/*.json', '**/*.jsonc', '**/*.yaml'],
54
54
  extends: [typescriptEslint.configs.disableTypeChecked]
55
55
  },
56
56
  {
@@ -118,7 +118,7 @@ export default defineConfig([
118
118
  // Import
119
119
  {
120
120
  name: 'cluerise: eslint/import/js',
121
- files: ['**/*.js'],
121
+ files: ['**/*.js', '**/*.cjs'],
122
122
  extends: [eslintPluginImport.flatConfigs.recommended],
123
123
  rules: {
124
124
  'import/first': 'error',
@@ -152,16 +152,16 @@ export default defineConfig([
152
152
  }
153
153
  },
154
154
  {
155
- name: 'cluerise: eslint/import/rules/config.js',
156
- files: ['**/*.config.js'],
155
+ name: 'cluerise: eslint/import/rules/config.js,cjs',
156
+ files: ['**/*.config.{js,cjs}'],
157
157
  rules: {
158
158
  '@typescript-eslint/no-require-imports': 'off',
159
159
  'import/no-commonjs': 'off'
160
160
  }
161
161
  },
162
162
  {
163
- name: 'cluerise: eslint/import/rules/config.js,ts',
164
- files: ['**/*.config.{js,ts}'],
163
+ name: 'cluerise: eslint/import/rules/config.js,cjs,ts',
164
+ files: ['**/*.config.{js,cjs,ts}'],
165
165
  rules: {
166
166
  'import/no-default-export': 'off'
167
167
  }
@@ -0,0 +1,26 @@
1
+ const Path = require('node:path');
2
+
3
+ const modulesNames = Object.keys(require.cache).filter((path) =>
4
+ Path.posix.normalize(path).endsWith('/git-log-parser/src/index.js')
5
+ );
6
+
7
+ for (const moduleName of modulesNames) {
8
+ const { parse, __patched = false } = require.cache[moduleName].exports;
9
+ if (__patched) {
10
+ continue;
11
+ }
12
+
13
+ require.cache[moduleName].exports.__patched = true;
14
+
15
+ require.cache[moduleName].exports.parse = (config, options) => {
16
+ if (Array.isArray(config._)) {
17
+ config._.push(options.cwd);
18
+ } else if (config._) {
19
+ config._ = [config._, options.cwd];
20
+ } else {
21
+ config._ = options.cwd;
22
+ }
23
+
24
+ return parse(config, options);
25
+ };
26
+ }
@@ -1,3 +1,6 @@
1
+ import Path from 'node:path';
2
+ import Url from 'node:url';
3
+
1
4
  export const defaultReleaseRules = [
2
5
  { breaking: true, release: 'major' },
3
6
  { type: 'feat', release: 'minor' },
@@ -24,8 +27,9 @@ export const defaultChangelogTypes = [
24
27
  const getRepositoryUrl = (path) => {
25
28
  const pathSegments = path.split('/');
26
29
  const rootSegments = pathSegments.filter((segments) => segments.trim().length > 0).map(() => '..');
30
+ const rootPath = Path.join(process.cwd(), ...rootSegments);
27
31
 
28
- return `file://${process.cwd()}/${rootSegments.join('/')}`;
32
+ return Url.pathToFileURL(rootPath).href;
29
33
  };
30
34
 
31
35
  export const createReleaseConfig = ({
@@ -36,11 +40,11 @@ export const createReleaseConfig = ({
36
40
  releaseRules = defaultReleaseRules,
37
41
  changelogTypes = defaultChangelogTypes
38
42
  }) => ({
43
+ extends: [Path.join(import.meta.dirname, 'release-cwd.config.cjs')],
39
44
  branches: ['main'],
40
45
  repositoryUrl: getRepositoryUrl(path),
41
46
  preset: 'conventionalcommits',
42
47
  dryRun: true,
43
- commitPath: path,
44
48
 
45
49
  plugins: [
46
50
  [
@@ -325,7 +325,7 @@ class ToolInitializer {
325
325
  }
326
326
  async #initPnpm() {
327
327
  const workspacePath = "pnpm-workspace.yaml";
328
- const workspaceContent = "engineStrict: true\n\npublicHoistPattern:\n - '@commitlint/cli'\n - eslint\n - lint-staged\n - prettier\n";
328
+ const workspaceContent = "engineStrict: true\n\npublicHoistPattern:\n - '@commitlint/cli'\n - eslint\n - lint-staged\n - prettier\n - prettier-plugin-sh\n";
329
329
  await FileUtils.createFile(workspacePath, workspaceContent);
330
330
  }
331
331
  async #initPrettier() {