@markuplint/create-rule 4.7.22 → 5.0.0-alpha.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.
- package/ARCHITECTURE.ja.md +194 -0
- package/ARCHITECTURE.md +194 -0
- package/CHANGELOG.md +10 -2
- package/README.md +125 -0
- package/SKILL.md +74 -0
- package/docs/maintenance.ja.md +135 -0
- package/docs/maintenance.md +135 -0
- package/lib/cli.d.ts +9 -0
- package/lib/cli.js +260 -4
- package/lib/create-rule-helper-error.d.ts +5 -0
- package/lib/create-rule-helper-error.js +6 -4
- package/lib/create-rule-helper.d.ts +7 -0
- package/lib/create-rule-helper.js +7 -0
- package/lib/create-rule-package.d.ts +11 -0
- package/lib/create-rule-package.js +11 -0
- package/lib/create-rule-to-core.d.ts +19 -0
- package/lib/create-rule-to-core.js +22 -0
- package/lib/create-rule-to-project.d.ts +8 -0
- package/lib/create-rule-to-project.js +8 -0
- package/lib/fs-exists.d.ts +9 -0
- package/lib/fs-exists.js +9 -0
- package/lib/glob.d.ts +9 -0
- package/lib/glob.js +9 -0
- package/lib/install-scaffold.d.ts +14 -0
- package/lib/install-scaffold.js +14 -0
- package/lib/is-markuplint-repo.d.ts +7 -0
- package/lib/is-markuplint-repo.js +7 -0
- package/lib/read-package-json.d.ts +7 -0
- package/lib/read-package-json.js +7 -0
- package/lib/search-core-repository.d.ts +8 -0
- package/lib/search-core-repository.js +8 -0
- package/lib/transfer.d.ts +19 -0
- package/lib/transfer.js +13 -0
- package/lib/types.d.ts +42 -0
- package/package.json +11 -8
- package/scaffold/package/README.md +2 -2
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
import type { CreateRuleCreatorParams, CreateRuleHelperResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Scaffolds a new rule within the markuplint core rules directory.
|
|
4
|
+
*
|
|
5
|
+
* Creates the rule in the `packages/@markuplint/rules/src/<ruleName>` directory
|
|
6
|
+
* of the monorepo. Requires core-specific parameters (description, category, severity)
|
|
7
|
+
* and always uses TypeScript with tests enabled.
|
|
8
|
+
*
|
|
9
|
+
* @param params - The rule creation parameters. The `core` property is required.
|
|
10
|
+
* @returns The scaffold result containing generated files and dependencies.
|
|
11
|
+
* @throws {CreateRuleHelperError} If core options are not defined or a rule with the same name already exists.
|
|
12
|
+
*/
|
|
2
13
|
export declare function createRuleToCore({ ruleName, core }: CreateRuleCreatorParams): Promise<CreateRuleHelperResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the absolute path to the core rules source directory within the
|
|
16
|
+
* markuplint monorepo. Searches upward from the cwd for the repository root
|
|
17
|
+
* and then constructs the path to `packages/@markuplint/rules/src`.
|
|
18
|
+
*
|
|
19
|
+
* @returns The absolute path to the core rules directory.
|
|
20
|
+
* @throws {CreateRuleHelperError} If the monorepo root or the core rules directory is not found.
|
|
21
|
+
*/
|
|
3
22
|
export declare function getRulesDir(): Promise<string>;
|
|
@@ -3,7 +3,21 @@ 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
|
import { searchCoreRepository } from './search-core-repository.js';
|
|
6
|
+
/**
|
|
7
|
+
* Relative path segments from the monorepo root to the core rules source directory.
|
|
8
|
+
*/
|
|
6
9
|
const rulesRelDir = ['packages', '@markuplint', 'rules', 'src'];
|
|
10
|
+
/**
|
|
11
|
+
* Scaffolds a new rule within the markuplint core rules directory.
|
|
12
|
+
*
|
|
13
|
+
* Creates the rule in the `packages/@markuplint/rules/src/<ruleName>` directory
|
|
14
|
+
* of the monorepo. Requires core-specific parameters (description, category, severity)
|
|
15
|
+
* and always uses TypeScript with tests enabled.
|
|
16
|
+
*
|
|
17
|
+
* @param params - The rule creation parameters. The `core` property is required.
|
|
18
|
+
* @returns The scaffold result containing generated files and dependencies.
|
|
19
|
+
* @throws {CreateRuleHelperError} If core options are not defined or a rule with the same name already exists.
|
|
20
|
+
*/
|
|
7
21
|
export async function createRuleToCore({ ruleName, core }) {
|
|
8
22
|
if (!core) {
|
|
9
23
|
throw new CreateRuleHelperError('Core options are not defined');
|
|
@@ -22,6 +36,14 @@ export async function createRuleToCore({ ruleName, core }) {
|
|
|
22
36
|
core,
|
|
23
37
|
});
|
|
24
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the absolute path to the core rules source directory within the
|
|
41
|
+
* markuplint monorepo. Searches upward from the cwd for the repository root
|
|
42
|
+
* and then constructs the path to `packages/@markuplint/rules/src`.
|
|
43
|
+
*
|
|
44
|
+
* @returns The absolute path to the core rules directory.
|
|
45
|
+
* @throws {CreateRuleHelperError} If the monorepo root or the core rules directory is not found.
|
|
46
|
+
*/
|
|
25
47
|
export async function getRulesDir() {
|
|
26
48
|
const rootDir = await searchCoreRepository();
|
|
27
49
|
if (!rootDir) {
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { CreateRuleCreatorParams, CreateRuleHelperResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Scaffolds a new markuplint rule as a local plugin directory within the
|
|
4
|
+
* current project. Creates a new directory named after the plugin in the cwd.
|
|
5
|
+
*
|
|
6
|
+
* @param params - The rule creation parameters (plugin name, rule name, language, test preference).
|
|
7
|
+
* @returns The scaffold result containing generated files and dependencies.
|
|
8
|
+
* @throws {CreateRuleHelperError} If the target plugin directory already exists.
|
|
9
|
+
*/
|
|
2
10
|
export declare function createRuleToProject({ pluginName, ruleName, lang, needTest, }: CreateRuleCreatorParams): Promise<CreateRuleHelperResult>;
|
|
@@ -2,6 +2,14 @@ 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
|
+
/**
|
|
6
|
+
* Scaffolds a new markuplint rule as a local plugin directory within the
|
|
7
|
+
* current project. Creates a new directory named after the plugin in the cwd.
|
|
8
|
+
*
|
|
9
|
+
* @param params - The rule creation parameters (plugin name, rule name, language, test preference).
|
|
10
|
+
* @returns The scaffold result containing generated files and dependencies.
|
|
11
|
+
* @throws {CreateRuleHelperError} If the target plugin directory already exists.
|
|
12
|
+
*/
|
|
5
13
|
export async function createRuleToProject({ pluginName, ruleName, lang, needTest, }) {
|
|
6
14
|
const pluginDir = path.resolve(process.cwd(), pluginName);
|
|
7
15
|
if (await fsExists(pluginDir)) {
|
package/lib/fs-exists.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a file or directory exists at the given path.
|
|
3
|
+
*
|
|
4
|
+
* Uses `fs.stat` internally and treats `ENOENT` errors as a non-existent path.
|
|
5
|
+
* Any other filesystem errors are re-thrown.
|
|
6
|
+
*
|
|
7
|
+
* @param path - The absolute or relative filesystem path to check.
|
|
8
|
+
* @returns `true` if the path exists, `false` otherwise.
|
|
9
|
+
*/
|
|
1
10
|
export declare function fsExists(path: string): Promise<boolean>;
|
package/lib/fs-exists.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { stat } from 'node:fs/promises';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether a file or directory exists at the given path.
|
|
4
|
+
*
|
|
5
|
+
* Uses `fs.stat` internally and treats `ENOENT` errors as a non-existent path.
|
|
6
|
+
* Any other filesystem errors are re-thrown.
|
|
7
|
+
*
|
|
8
|
+
* @param path - The absolute or relative filesystem path to check.
|
|
9
|
+
* @returns `true` if the path exists, `false` otherwise.
|
|
10
|
+
*/
|
|
2
11
|
export async function fsExists(path) {
|
|
3
12
|
const res = await stat(path).catch(error => {
|
|
4
13
|
if (error?.code === 'ENOENT') {
|
package/lib/glob.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform glob wrapper that normalizes path separators before matching.
|
|
3
|
+
*
|
|
4
|
+
* Converts backslashes (Windows `path.sep`) to forward slashes so that
|
|
5
|
+
* glob patterns work consistently across operating systems.
|
|
6
|
+
*
|
|
7
|
+
* @param pattern - The glob pattern to match against (may contain OS-specific separators).
|
|
8
|
+
* @returns An array of file paths matching the pattern.
|
|
9
|
+
*/
|
|
1
10
|
export declare const glob: (pattern: string) => Promise<string[]>;
|
package/lib/glob.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { glob as origin } from 'glob';
|
|
3
|
+
/**
|
|
4
|
+
* Cross-platform glob wrapper that normalizes path separators before matching.
|
|
5
|
+
*
|
|
6
|
+
* Converts backslashes (Windows `path.sep`) to forward slashes so that
|
|
7
|
+
* glob patterns work consistently across operating systems.
|
|
8
|
+
*
|
|
9
|
+
* @param pattern - The glob pattern to match against (may contain OS-specific separators).
|
|
10
|
+
* @returns An array of file paths matching the pattern.
|
|
11
|
+
*/
|
|
3
12
|
export const glob = async (pattern) => {
|
|
4
13
|
const normalized = pattern.split(path.sep).join('/');
|
|
5
14
|
return await origin(normalized);
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import type { CreateRuleCreatorParams, CreateRuleHelperResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Installs scaffold template files to the destination directory and optionally
|
|
4
|
+
* generates a `package.json` with appropriate scripts and dependency declarations.
|
|
5
|
+
*
|
|
6
|
+
* This is the low-level function used by all scaffold strategies (core, project, package).
|
|
7
|
+
* It copies template files from the built-in `scaffold/<type>` directory, applies
|
|
8
|
+
* placeholder replacements, and sets up the project structure.
|
|
9
|
+
*
|
|
10
|
+
* @param scaffoldType - The type of scaffold to install ("core", "project", or "package").
|
|
11
|
+
* @param dest - The absolute path to the destination directory.
|
|
12
|
+
* @param params - The creation parameters, extended with an optional `packageJson` flag
|
|
13
|
+
* indicating whether to generate a `package.json` file.
|
|
14
|
+
* @returns The scaffold result containing the list of generated files and dependency arrays.
|
|
15
|
+
*/
|
|
2
16
|
export declare function installScaffold(scaffoldType: 'core' | 'project' | 'package', dest: string, params: CreateRuleCreatorParams & {
|
|
3
17
|
readonly packageJson?: boolean;
|
|
4
18
|
}): Promise<CreateRuleHelperResult>;
|
package/lib/install-scaffold.js
CHANGED
|
@@ -5,6 +5,20 @@ import { fsExists } from './fs-exists.js';
|
|
|
5
5
|
import { transfer } from './transfer.js';
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = path.dirname(__filename);
|
|
8
|
+
/**
|
|
9
|
+
* Installs scaffold template files to the destination directory and optionally
|
|
10
|
+
* generates a `package.json` with appropriate scripts and dependency declarations.
|
|
11
|
+
*
|
|
12
|
+
* This is the low-level function used by all scaffold strategies (core, project, package).
|
|
13
|
+
* It copies template files from the built-in `scaffold/<type>` directory, applies
|
|
14
|
+
* placeholder replacements, and sets up the project structure.
|
|
15
|
+
*
|
|
16
|
+
* @param scaffoldType - The type of scaffold to install ("core", "project", or "package").
|
|
17
|
+
* @param dest - The absolute path to the destination directory.
|
|
18
|
+
* @param params - The creation parameters, extended with an optional `packageJson` flag
|
|
19
|
+
* indicating whether to generate a `package.json` file.
|
|
20
|
+
* @returns The scaffold result containing the list of generated files and dependency arrays.
|
|
21
|
+
*/
|
|
8
22
|
export async function installScaffold(scaffoldType, dest, params) {
|
|
9
23
|
const exists = await fsExists(dest);
|
|
10
24
|
if (!exists) {
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether the current working directory is inside the markuplint
|
|
3
|
+
* core monorepo. This is used to conditionally offer the "Contribute to core"
|
|
4
|
+
* option in the CLI wizard.
|
|
5
|
+
*
|
|
6
|
+
* @returns `true` if the cwd is within the markuplint monorepo, `false` otherwise.
|
|
7
|
+
*/
|
|
1
8
|
export declare function isMarkuplintRepo(): Promise<boolean>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { searchCoreRepository } from './search-core-repository.js';
|
|
2
|
+
/**
|
|
3
|
+
* Determines whether the current working directory is inside the markuplint
|
|
4
|
+
* core monorepo. This is used to conditionally offer the "Contribute to core"
|
|
5
|
+
* option in the CLI wizard.
|
|
6
|
+
*
|
|
7
|
+
* @returns `true` if the cwd is within the markuplint monorepo, `false` otherwise.
|
|
8
|
+
*/
|
|
2
9
|
export async function isMarkuplintRepo() {
|
|
3
10
|
const rootDir = await searchCoreRepository();
|
|
4
11
|
return !!rootDir;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the `package.json` file in the given directory and extracts the package name.
|
|
3
|
+
*
|
|
4
|
+
* @param dir - The directory containing the `package.json` file.
|
|
5
|
+
* @returns The `name` field from the package.json, or `null` if the file
|
|
6
|
+
* does not exist, cannot be parsed, or has no `name` field.
|
|
7
|
+
*/
|
|
1
8
|
export declare function readPackageJson(dir: string): Promise<string | null>;
|
package/lib/read-package-json.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Reads the `package.json` file in the given directory and extracts the package name.
|
|
5
|
+
*
|
|
6
|
+
* @param dir - The directory containing the `package.json` file.
|
|
7
|
+
* @returns The `name` field from the package.json, or `null` if the file
|
|
8
|
+
* does not exist, cannot be parsed, or has no `name` field.
|
|
9
|
+
*/
|
|
3
10
|
export async function readPackageJson(dir) {
|
|
4
11
|
const filePath = path.resolve(dir, 'package.json');
|
|
5
12
|
try {
|
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Searches for the markuplint core monorepo root by traversing up from the
|
|
3
|
+
* current working directory. Identifies the root by checking for a
|
|
4
|
+
* `package.json` with the name `"markuplint-packages"`.
|
|
5
|
+
*
|
|
6
|
+
* @returns The absolute path to the monorepo root directory, or `null` if
|
|
7
|
+
* the current working directory is not within the markuplint repository.
|
|
8
|
+
*/
|
|
1
9
|
export declare function searchCoreRepository(): Promise<string | null>;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { readPackageJson } from './read-package-json.js';
|
|
3
|
+
/**
|
|
4
|
+
* Searches for the markuplint core monorepo root by traversing up from the
|
|
5
|
+
* current working directory. Identifies the root by checking for a
|
|
6
|
+
* `package.json` with the name `"markuplint-packages"`.
|
|
7
|
+
*
|
|
8
|
+
* @returns The absolute path to the monorepo root directory, or `null` if
|
|
9
|
+
* the current working directory is not within the markuplint repository.
|
|
10
|
+
*/
|
|
3
11
|
export async function searchCoreRepository() {
|
|
4
12
|
const paths = path.resolve(process.cwd()).split(path.sep);
|
|
5
13
|
while (true) {
|
package/lib/transfer.d.ts
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import type { File } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Options controlling how scaffold files are transferred to their destination.
|
|
4
|
+
*/
|
|
2
5
|
type TransferOptions = {
|
|
6
|
+
/** Whether to transpile TypeScript files to JavaScript. */
|
|
3
7
|
readonly transpile?: boolean;
|
|
8
|
+
/** Whether to include test files in the transfer. */
|
|
4
9
|
readonly test?: boolean;
|
|
10
|
+
/** A mapping of placeholder names to replacement values for template substitution. */
|
|
5
11
|
readonly replacer?: Readonly<Record<string, string | void>>;
|
|
6
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Transfers scaffold template files from a source directory to a destination directory.
|
|
15
|
+
*
|
|
16
|
+
* Scans all files in `baseDir`, processes each file through template substitution,
|
|
17
|
+
* optional TypeScript-to-JavaScript transpilation, and Prettier formatting, then
|
|
18
|
+
* writes the results to `destDir`.
|
|
19
|
+
*
|
|
20
|
+
* @param scaffoldType - The type of scaffold being transferred ("core", "project", or "package").
|
|
21
|
+
* @param baseDir - The source directory containing scaffold template files.
|
|
22
|
+
* @param destDir - The destination directory where processed files will be written.
|
|
23
|
+
* @param options - Optional settings for transpilation, test inclusion, and placeholder replacement.
|
|
24
|
+
* @returns An array of file metadata for each successfully transferred file.
|
|
25
|
+
*/
|
|
7
26
|
export declare function transfer(scaffoldType: 'core' | 'project' | 'package', baseDir: string, destDir: string, options?: TransferOptions): Promise<File[]>;
|
|
8
27
|
export {};
|
package/lib/transfer.js
CHANGED
|
@@ -6,6 +6,19 @@ import tsc from 'typescript';
|
|
|
6
6
|
import { fsExists } from './fs-exists.js';
|
|
7
7
|
import { glob } from './glob.js';
|
|
8
8
|
const { transpile, ScriptTarget } = tsc;
|
|
9
|
+
/**
|
|
10
|
+
* Transfers scaffold template files from a source directory to a destination directory.
|
|
11
|
+
*
|
|
12
|
+
* Scans all files in `baseDir`, processes each file through template substitution,
|
|
13
|
+
* optional TypeScript-to-JavaScript transpilation, and Prettier formatting, then
|
|
14
|
+
* writes the results to `destDir`.
|
|
15
|
+
*
|
|
16
|
+
* @param scaffoldType - The type of scaffold being transferred ("core", "project", or "package").
|
|
17
|
+
* @param baseDir - The source directory containing scaffold template files.
|
|
18
|
+
* @param destDir - The destination directory where processed files will be written.
|
|
19
|
+
* @param options - Optional settings for transpilation, test inclusion, and placeholder replacement.
|
|
20
|
+
* @returns An array of file metadata for each successfully transferred file.
|
|
21
|
+
*/
|
|
9
22
|
export async function transfer(scaffoldType, baseDir, destDir, options) {
|
|
10
23
|
const files = await scan(baseDir, destDir);
|
|
11
24
|
const results = [];
|
package/lib/types.d.ts
CHANGED
|
@@ -1,30 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameters for the create-rule helper, combining creator params with a purpose selection.
|
|
3
|
+
*/
|
|
1
4
|
export type CreateRuleHelperParams = CreateRuleCreatorParams & {
|
|
2
5
|
readonly purpose: CreateRulePurpose;
|
|
3
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Parameters required for scaffolding a new markuplint rule.
|
|
9
|
+
*/
|
|
4
10
|
export type CreateRuleCreatorParams = {
|
|
11
|
+
/** The name of the plugin that will contain the rule. */
|
|
5
12
|
readonly pluginName: string;
|
|
13
|
+
/** The name of the rule to create. */
|
|
6
14
|
readonly ruleName: string;
|
|
15
|
+
/** The programming language for the rule implementation. */
|
|
7
16
|
readonly lang: CreateRuleLanguage;
|
|
17
|
+
/** Whether to generate test files alongside the rule. */
|
|
8
18
|
readonly needTest: boolean;
|
|
19
|
+
/** Additional parameters required when contributing to core rules. */
|
|
9
20
|
readonly core?: CreateRuleCreatorCoreParams;
|
|
10
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Additional parameters specific to contributing a rule to the markuplint core.
|
|
24
|
+
*/
|
|
11
25
|
export type CreateRuleCreatorCoreParams = {
|
|
26
|
+
/** A human-readable description of what the rule checks. */
|
|
12
27
|
readonly description: string;
|
|
28
|
+
/** The rule category (e.g., "validation", "a11y", "style"). */
|
|
13
29
|
readonly category: string;
|
|
30
|
+
/** The default severity level for rule violations. */
|
|
14
31
|
readonly severity: string;
|
|
15
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* The result returned after scaffolding a new rule, containing generated files and dependency information.
|
|
35
|
+
*/
|
|
16
36
|
export type CreateRuleHelperResult = {
|
|
37
|
+
/** The list of files that were generated. */
|
|
17
38
|
readonly files: readonly File[];
|
|
39
|
+
/** Runtime dependencies to install. */
|
|
18
40
|
readonly dependencies: readonly string[];
|
|
41
|
+
/** Development dependencies to install. */
|
|
19
42
|
readonly devDependencies: readonly string[];
|
|
20
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* The programming language used for the rule implementation.
|
|
46
|
+
*/
|
|
21
47
|
export type CreateRuleLanguage = 'JAVASCRIPT' | 'TYPESCRIPT';
|
|
48
|
+
/**
|
|
49
|
+
* The intended purpose for creating a rule, which determines the scaffolding strategy.
|
|
50
|
+
*
|
|
51
|
+
* - `ADD_TO_PROJECT` - Add the rule directly to the current project.
|
|
52
|
+
* - `PUBLISH_AS_PACKAGE` - Create a standalone publishable npm package.
|
|
53
|
+
* - `CONTRIBUTE_TO_CORE` - Add the rule to the markuplint core rules.
|
|
54
|
+
*/
|
|
22
55
|
export type CreateRulePurpose = 'ADD_TO_PROJECT' | 'PUBLISH_AS_PACKAGE' | 'CONTRIBUTE_TO_CORE';
|
|
56
|
+
/**
|
|
57
|
+
* Metadata describing a generated file in the scaffold output.
|
|
58
|
+
*/
|
|
23
59
|
export type File = {
|
|
60
|
+
/** The file extension (e.g., ".ts", ".js", ".json"). */
|
|
24
61
|
readonly ext: string;
|
|
62
|
+
/** The base name of the file without extension or test suffix. */
|
|
25
63
|
readonly name: string;
|
|
64
|
+
/** The full file name including test suffix if applicable, but without extension. */
|
|
26
65
|
readonly fileName: string;
|
|
66
|
+
/** Whether this file is a test file. */
|
|
27
67
|
readonly test: boolean;
|
|
68
|
+
/** The destination directory where the file is written. */
|
|
28
69
|
readonly destDir: string;
|
|
70
|
+
/** The absolute path to the source file in the scaffold. */
|
|
29
71
|
readonly filePath: string;
|
|
30
72
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/create-rule",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.0",
|
|
4
4
|
"description": "Rule generator for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=22"
|
|
10
|
+
},
|
|
8
11
|
"type": "module",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
@@ -22,15 +25,15 @@
|
|
|
22
25
|
"clean": "tsc --build --clean tsconfig.build.json"
|
|
23
26
|
},
|
|
24
27
|
"dependencies": {
|
|
25
|
-
"@markuplint/cli-utils": "
|
|
26
|
-
"@markuplint/ml-core": "
|
|
27
|
-
"glob": "
|
|
28
|
-
"prettier": "3.
|
|
29
|
-
"typescript": "5.9.
|
|
28
|
+
"@markuplint/cli-utils": "5.0.0-alpha.0",
|
|
29
|
+
"@markuplint/ml-core": "5.0.0-alpha.0",
|
|
30
|
+
"glob": "13.0.6",
|
|
31
|
+
"prettier": "3.8.1",
|
|
32
|
+
"typescript": "5.9.3"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
35
|
"@types/fs-extra": "11.0.4",
|
|
33
|
-
"fs-extra": "11.3.
|
|
36
|
+
"fs-extra": "11.3.3"
|
|
34
37
|
},
|
|
35
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "13dcfc84ec83d87360c720e253383b60767e1b56"
|
|
36
39
|
}
|
|
@@ -52,8 +52,8 @@ TODO: Write a description
|
|
|
52
52
|
|
|
53
53
|
| Property | Type | Optional | Default Value | Description |
|
|
54
54
|
| -------- | ---------- | -------- | ------------- | ------------------------- |
|
|
55
|
-
| `foo` | `string` | ✔
|
|
56
|
-
| `bar` | `number[]` | ✔
|
|
55
|
+
| `foo` | `string` | ✔ | `undefined` | TODO: Write a description |
|
|
56
|
+
| `bar` | `number[]` | ✔ | `undefined` | TODO: Write a description |
|
|
57
57
|
|
|
58
58
|
### Default severity
|
|
59
59
|
|