@dotcom-tool-kit/prettier 4.2.7 → 4.3.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/lib/tasks/prettier.d.ts +16 -1
- package/lib/tasks/prettier.d.ts.map +1 -1
- package/lib/tasks/prettier.js +21 -0
- package/package.json +5 -4
package/lib/tasks/prettier.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
import { PrettierOptions, PrettierSchema } from '@dotcom-tool-kit/schemas/lib/tasks/prettier';
|
|
2
1
|
import { Task, TaskRunContext } from '@dotcom-tool-kit/base';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
declare const PrettierSchema: z.ZodObject<{
|
|
4
|
+
files: z.ZodDefault<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>>;
|
|
5
|
+
configFile: z.ZodOptional<z.ZodString>;
|
|
6
|
+
ignoreFile: z.ZodDefault<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
files: string | string[];
|
|
9
|
+
ignoreFile: string;
|
|
10
|
+
configFile?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
files?: string | string[] | undefined;
|
|
13
|
+
configFile?: string | undefined;
|
|
14
|
+
ignoreFile?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export { PrettierSchema as schema };
|
|
17
|
+
type PrettierOptions = z.infer<typeof PrettierSchema>;
|
|
3
18
|
export default class Prettier extends Task<{
|
|
4
19
|
task: typeof PrettierSchema;
|
|
5
20
|
}> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../src/tasks/prettier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../src/tasks/prettier.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,QAAA,MAAM,cAAc;;;;;;;;;;;;EAmBwB,CAAA;AAC5C,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,CAAA;AAEnC,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,IAAI,CAAC;IAAE,IAAI,EAAE,OAAO,cAAc,CAAA;CAAE,CAAC;IACnE,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBxD,UAAU,aAAoB,MAAM,WAAW,eAAe,KAAG,QAAQ,IAAI,CAAC,CA2B7E;CACF"}
|
package/lib/tasks/prettier.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const prettier_1 = tslib_1.__importDefault(require("prettier"));
|
|
5
6
|
const fs_1 = require("fs");
|
|
@@ -7,6 +8,26 @@ const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
|
|
|
7
8
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
8
9
|
const base_1 = require("@dotcom-tool-kit/base");
|
|
9
10
|
const error_1 = require("@dotcom-tool-kit/error");
|
|
11
|
+
const z = tslib_1.__importStar(require("zod"));
|
|
12
|
+
const PrettierSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
files: z
|
|
15
|
+
.string()
|
|
16
|
+
.array()
|
|
17
|
+
.or(z.string())
|
|
18
|
+
.default(['**/*.{js,jsx,ts,tsx}'])
|
|
19
|
+
.describe('glob pattern of files to run Prettier on.'),
|
|
20
|
+
configFile: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe("path to a Prettier config file to use. Uses Prettier's built-in [config resolution](https://prettier.io/docs/en/configuration.html) by default."),
|
|
24
|
+
ignoreFile: z
|
|
25
|
+
.string()
|
|
26
|
+
.default('.prettierignore')
|
|
27
|
+
.describe('path to a Prettier [ignore file](https://prettier.io/docs/en/ignore).')
|
|
28
|
+
})
|
|
29
|
+
.describe('Format files with `prettier`.');
|
|
30
|
+
exports.schema = PrettierSchema;
|
|
10
31
|
class Prettier extends base_1.Task {
|
|
11
32
|
async run({ files, cwd }) {
|
|
12
33
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcom-tool-kit/prettier",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"scripts": {
|
|
@@ -10,14 +10,15 @@
|
|
|
10
10
|
"author": "FT.com Platforms Team <platforms-team.customer-products@ft.com>",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dotcom-tool-kit/base": "^1.1.
|
|
13
|
+
"@dotcom-tool-kit/base": "^1.1.10",
|
|
14
14
|
"@dotcom-tool-kit/error": "^4.1.0",
|
|
15
15
|
"@dotcom-tool-kit/logger": "^4.1.1",
|
|
16
|
-
"@dotcom-tool-kit/package-json-hook": "^5.
|
|
16
|
+
"@dotcom-tool-kit/package-json-hook": "^5.2.0",
|
|
17
17
|
"fast-glob": "^3.2.7",
|
|
18
18
|
"hook-std": "^2.0.0",
|
|
19
19
|
"prettier": "^2.2.1",
|
|
20
|
-
"tslib": "^2.3.1"
|
|
20
|
+
"tslib": "^2.3.1",
|
|
21
|
+
"zod": "^3.24.1"
|
|
21
22
|
},
|
|
22
23
|
"repository": {
|
|
23
24
|
"type": "git",
|