@markuplint/create-rule 4.7.5 → 4.7.7

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/CHANGELOG.md CHANGED
@@ -3,7 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [4.7.5](https://github.com/markuplint/markuplint/compare/@markuplint/create-rule@4.7.4...@markuplint/create-rule@4.7.5) (2024-06-25)
6
+ ## [4.7.7](https://github.com/markuplint/markuplint/compare/@markuplint/create-rule@4.7.6...@markuplint/create-rule@4.7.7) (2024-09-23)
7
+
8
+ **Note:** Version bump only for package @markuplint/create-rule
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.7.6](https://github.com/markuplint/markuplint/compare/@markuplint/create-rule@4.7.5...@markuplint/create-rule@4.7.6) (2024-09-02)
7
15
 
8
16
  **Note:** Version bump only for package @markuplint/create-rule
9
17
 
@@ -11,6 +19,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
19
 
12
20
 
13
21
 
22
+ ## [4.7.5](https://github.com/markuplint/markuplint/compare/@markuplint/create-rule@4.7.4...@markuplint/create-rule@4.7.5) (2024-06-25)
23
+
24
+ **Note:** Version bump only for package @markuplint/create-rule
25
+
14
26
  ## [4.7.4](https://github.com/markuplint/markuplint/compare/@markuplint/create-rule@4.7.3...@markuplint/create-rule@4.7.4) (2024-06-09)
15
27
 
16
28
  ### Bug Fixes
package/lib/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { resolve } from 'node:path';
1
+ import path from 'node:path';
2
2
  import { input, installModule, select, confirm, font, header } from '@markuplint/cli-utils';
3
3
  import { createRuleHelper } from './create-rule-helper.js';
4
4
  import { isMarkuplintRepo } from './is-markuplint-repo.js';
@@ -61,7 +61,7 @@ export async function createRule() {
61
61
  const needTest = purpose === 'CONTRIBUTE_TO_CORE' ? true : await confirm('Do you need the test?', { initial: true });
62
62
  const result = await createRuleHelper({ purpose, pluginName, ruleName, lang, needTest, core });
63
63
  for (const file of result.files) {
64
- output(pluginName || 'core', file.test ? '🖍 ' : icons[file.name] ?? '🛡 ', file.fileName, resolve(file.destDir, file.fileName + file.ext));
64
+ output(pluginName || 'core', file.test ? '🖍 ' : (icons[file.name] ?? '🛡 '), file.fileName, path.resolve(file.destDir, file.fileName + file.ext));
65
65
  }
66
66
  if (result.dependencies.length > 0) {
67
67
  await installModule(result.dependencies);
@@ -1,9 +1,9 @@
1
- import { resolve } from 'node:path';
1
+ import path from 'node:path';
2
2
  import { CreateRuleHelperError } from './create-rule-helper-error.js';
3
3
  import { fsExists } from './fs-exists.js';
4
4
  import { installScaffold } from './install-scaffold.js';
5
5
  export async function createRuleToProject({ pluginName, ruleName, lang, needTest, }) {
6
- const pluginDir = resolve(process.cwd(), pluginName);
6
+ const pluginDir = path.resolve(process.cwd(), pluginName);
7
7
  if (await fsExists(pluginDir)) {
8
8
  throw new CreateRuleHelperError(`The directory exists: ${pluginDir}`);
9
9
  }
package/lib/glob.js CHANGED
@@ -1,6 +1,6 @@
1
- import { sep } from 'node:path';
1
+ import path from 'node:path';
2
2
  import { glob as origin } from 'glob';
3
3
  export const glob = async (pattern) => {
4
- const normalized = pattern.split(sep).join('/');
4
+ const normalized = pattern.split(path.sep).join('/');
5
5
  return await origin(normalized);
6
6
  };
@@ -1,16 +1,16 @@
1
1
  import fs from 'node:fs/promises';
2
- import { resolve, dirname } from 'node:path';
2
+ import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { fsExists } from './fs-exists.js';
5
5
  import { transfer } from './transfer.js';
6
6
  const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = dirname(__filename);
7
+ const __dirname = path.dirname(__filename);
8
8
  export async function installScaffold(scaffoldType, dest, params) {
9
9
  const exists = await fsExists(dest);
10
10
  if (!exists) {
11
11
  await fs.mkdir(dest);
12
12
  }
13
- const scaffoldDir = resolve(__dirname, '..', 'scaffold', scaffoldType);
13
+ const scaffoldDir = path.resolve(__dirname, '..', 'scaffold', scaffoldType);
14
14
  const transferred = await transfer(scaffoldType, scaffoldDir, dest, {
15
15
  transpile: params.lang === 'JAVASCRIPT',
16
16
  test: params.needTest,
@@ -22,7 +22,7 @@ export async function installScaffold(scaffoldType, dest, params) {
22
22
  severity: params.core?.severity,
23
23
  },
24
24
  });
25
- const packageJson = params.packageJson ? resolve(dest, 'package.json') : null;
25
+ const packageJson = params.packageJson ? path.resolve(dest, 'package.json') : null;
26
26
  const dependencies = [];
27
27
  const devDependencies = [];
28
28
  if (packageJson) {
@@ -2,7 +2,6 @@ import path from 'node:path';
2
2
  import { readPackageJson } from './read-package-json.js';
3
3
  export async function searchCoreRepository() {
4
4
  const paths = path.resolve(process.cwd()).split(path.sep);
5
- // eslint-disable-next-line no-constant-condition
6
5
  while (true) {
7
6
  const currentDir = paths.join(path.sep);
8
7
  const name = await readPackageJson(currentDir);
package/lib/transfer.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import { statSync } from 'node:fs';
2
2
  import fs from 'node:fs/promises';
3
- import { resolve, extname, basename, relative, dirname } from 'node:path';
3
+ import path from 'node:path';
4
4
  import { format } from 'prettier';
5
5
  import tsc from 'typescript';
6
6
  import { fsExists } from './fs-exists.js';
7
7
  import { glob } from './glob.js';
8
- // eslint-disable-next-line import/no-named-as-default-member
9
8
  const { transpile, ScriptTarget } = tsc;
10
9
  export async function transfer(scaffoldType, baseDir, destDir, options) {
11
10
  const files = await scan(baseDir, destDir);
@@ -57,7 +56,7 @@ async function transferFile(scaffoldType, file, options) {
57
56
  newFile.name = candidateName;
58
57
  newFile.fileName = candidateName + (newFile.test ? '.spec' : '');
59
58
  }
60
- const dest = resolve(newFile.destDir, newFile.fileName + newFile.ext);
59
+ const dest = path.resolve(newFile.destDir, newFile.fileName + newFile.ext);
61
60
  // Prettier
62
61
  const parser = newFile.ext === '.md'
63
62
  ? 'markdown'
@@ -76,20 +75,20 @@ async function transferFile(scaffoldType, file, options) {
76
75
  return newFile;
77
76
  }
78
77
  async function scan(baseDir, destDir) {
79
- const fileList = await glob(resolve(baseDir, '**', '*'));
78
+ const fileList = await glob(path.resolve(baseDir, '**', '*'));
80
79
  const destList = fileList
81
80
  .map(filePath => {
82
81
  const stat = statSync(filePath);
83
82
  if (!stat.isFile()) {
84
83
  return null;
85
84
  }
86
- const relPath = relative(baseDir, filePath);
87
- const destPath = resolve(destDir, relPath);
88
- const ext = extname(destPath);
89
- const fileName = basename(destPath, ext);
90
- const test = extname(fileName) === '.spec';
91
- const name = basename(fileName, '.spec');
92
- const destFileDir = dirname(destPath);
85
+ const relPath = path.relative(baseDir, filePath);
86
+ const destPath = path.resolve(destDir, relPath);
87
+ const ext = path.extname(destPath);
88
+ const fileName = path.basename(destPath, ext);
89
+ const test = path.extname(fileName) === '.spec';
90
+ const name = path.basename(fileName, '.spec');
91
+ const destFileDir = path.dirname(destPath);
93
92
  return {
94
93
  ext,
95
94
  fileName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/create-rule",
3
- "version": "4.7.5",
3
+ "version": "4.7.7",
4
4
  "description": "Rule generator for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -25,16 +25,16 @@
25
25
  "clean": "tsc --build --clean"
26
26
  },
27
27
  "dependencies": {
28
- "@markuplint/cli-utils": "4.4.3",
29
- "@markuplint/ml-core": "4.8.2",
30
- "glob": "10.4.2",
31
- "prettier": "3.2.5",
28
+ "@markuplint/cli-utils": "4.4.5",
29
+ "@markuplint/ml-core": "4.9.0",
30
+ "glob": "11.0.0",
31
+ "prettier": "3.3.3",
32
32
  "ts-node": "10.9.2",
33
- "typescript": "5.5.2"
33
+ "typescript": "5.6.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/fs-extra": "11.0.4",
37
37
  "fs-extra": "11.2.0"
38
38
  },
39
- "gitHead": "05fdca254661ec335ff0cae4c6a11db164b032b9"
39
+ "gitHead": "05d2eabfcc41b67847c24049f12dd2b9f5ca6485"
40
40
  }
@@ -1,5 +0,0 @@
1
- {
2
- "rules": {
3
- "import/no-default-export": 0
4
- }
5
- }