@dotcom-tool-kit/prettier 3.2.0 → 4.0.0-beta.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/.toolkitrc.yml +15 -1
- package/lib/tasks/prettier.d.ts +5 -4
- package/lib/tasks/prettier.d.ts.map +1 -1
- package/lib/tasks/prettier.js +2 -7
- package/package.json +8 -10
- package/readme.md +13 -14
- package/lib/index.d.ts +0 -13
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -18
package/.toolkitrc.yml
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
plugins:
|
|
2
|
+
- '@dotcom-tool-kit/package-json-hook'
|
|
3
|
+
|
|
4
|
+
tasks:
|
|
5
|
+
Prettier: './lib/tasks/prettier'
|
|
6
|
+
|
|
7
|
+
commands:
|
|
2
8
|
'format:local': Prettier
|
|
3
9
|
'format:staged': Prettier
|
|
10
|
+
|
|
11
|
+
options:
|
|
12
|
+
hooks:
|
|
13
|
+
- PackageJson:
|
|
14
|
+
scripts:
|
|
15
|
+
format: 'format:local'
|
|
16
|
+
|
|
17
|
+
version: 2
|
package/lib/tasks/prettier.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PrettierOptions, PrettierSchema } from '@dotcom-tool-kit/
|
|
2
|
-
import { Task } from '@dotcom-tool-kit/
|
|
3
|
-
export default class Prettier extends Task<
|
|
4
|
-
|
|
1
|
+
import { PrettierOptions, PrettierSchema } from '@dotcom-tool-kit/schemas/lib/tasks/prettier';
|
|
2
|
+
import { Task } from '@dotcom-tool-kit/base';
|
|
3
|
+
export default class Prettier extends Task<{
|
|
4
|
+
task: typeof PrettierSchema;
|
|
5
|
+
}> {
|
|
5
6
|
run(files?: string[]): Promise<void>;
|
|
6
7
|
formatFile: (filepath: string, options: PrettierOptions) => Promise<void>;
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../src/tasks/prettier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../src/tasks/prettier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAI7F,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAG5C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,IAAI,CAAC;IAAE,IAAI,EAAE,OAAO,cAAc,CAAA;CAAE,CAAC;IACnE,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB1C,UAAU,aAAoB,MAAM,WAAW,eAAe,KAAG,QAAQ,IAAI,CAAC,CA2B7E;CACF"}
|
package/lib/tasks/prettier.js
CHANGED
|
@@ -5,9 +5,9 @@ const prettier_1 = tslib_1.__importDefault(require("prettier"));
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
|
|
7
7
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
8
|
-
const
|
|
8
|
+
const base_1 = require("@dotcom-tool-kit/base");
|
|
9
9
|
const error_1 = require("@dotcom-tool-kit/error");
|
|
10
|
-
class Prettier extends
|
|
10
|
+
class Prettier extends base_1.Task {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.formatFile = async (filepath, options) => {
|
|
@@ -25,10 +25,6 @@ class Prettier extends types_1.Task {
|
|
|
25
25
|
throw error;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
if (!prettierConfig && options.configOptions) {
|
|
29
|
-
this.logger.warn(`prettier could not find the specified configFile${options.configFile ? ` (${logger_1.styles.filepath(options.configFile)})` : ''}), using ${logger_1.styles.option('configOptions')} instead`);
|
|
30
|
-
prettierConfig = options.configOptions;
|
|
31
|
-
}
|
|
32
28
|
const { ignored } = await prettier_1.default.getFileInfo(filepath, { ignorePath: this.options.ignoreFile });
|
|
33
29
|
if (ignored) {
|
|
34
30
|
return;
|
|
@@ -62,4 +58,3 @@ class Prettier extends types_1.Task {
|
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
exports.default = Prettier;
|
|
65
|
-
Prettier.description = '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcom-tool-kit/prettier",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"scripts": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"author": "FT.com Platforms Team <platforms-team.customer-products@ft.com>",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dotcom-tool-kit/
|
|
14
|
-
"@dotcom-tool-kit/
|
|
15
|
-
"@dotcom-tool-kit/
|
|
16
|
-
"@dotcom-tool-kit/
|
|
13
|
+
"@dotcom-tool-kit/base": "4.0.0-beta.0",
|
|
14
|
+
"@dotcom-tool-kit/error": "4.0.0-beta.0",
|
|
15
|
+
"@dotcom-tool-kit/logger": "4.0.0-beta.0",
|
|
16
|
+
"@dotcom-tool-kit/package-json-hook": "5.0.0-beta.1",
|
|
17
17
|
"fast-glob": "^3.2.7",
|
|
18
18
|
"hook-std": "^2.0.0",
|
|
19
19
|
"prettier": "^2.2.1",
|
|
@@ -31,19 +31,17 @@
|
|
|
31
31
|
".toolkitrc.yml"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"jest": "^27.4.7",
|
|
36
|
-
"ts-jest": "^27.1.3",
|
|
34
|
+
"@types/prettier": "^2.7.3",
|
|
37
35
|
"winston": "^3.5.1"
|
|
38
36
|
},
|
|
39
37
|
"volta": {
|
|
40
38
|
"extends": "../../package.json"
|
|
41
39
|
},
|
|
42
40
|
"peerDependencies": {
|
|
43
|
-
"dotcom-tool-kit": "
|
|
41
|
+
"dotcom-tool-kit": "4.0.0-beta.1"
|
|
44
42
|
},
|
|
45
43
|
"engines": {
|
|
46
|
-
"node": "
|
|
44
|
+
"node": "18.x || 20.x",
|
|
47
45
|
"npm": "7.x || 8.x || 9.x || 10.x"
|
|
48
46
|
}
|
|
49
47
|
}
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @dotcom-tool-kit/prettier
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tool Kit plugin to format your source code with [Prettier](https://prettier.io).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -17,20 +17,19 @@ plugins:
|
|
|
17
17
|
- '@dotcom-tool-kit/prettier'
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<!-- begin autogenerated docs -->
|
|
21
|
+
## Tasks
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
npx dotcom-tool-kit --install
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
This will modify your `package.json`. You should commit this change.
|
|
23
|
+
### `Prettier`
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
Format files with `prettier`.
|
|
26
|
+
#### Task options
|
|
29
27
|
|
|
30
|
-
|
|
|
31
|
-
|
|
32
|
-
| `files`
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
28
|
+
| Property | Description | Type | Default |
|
|
29
|
+
| :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------ | :------------------------- |
|
|
30
|
+
| `files` | glob pattern of files to run Prettier on. | `Array<string> \| string` | `["**/*.{js,jsx,ts,tsx}"]` |
|
|
31
|
+
| `configFile` | path to a Prettier config file to use. Uses Prettier's built-in [config resolution](https://prettier.io/docs/en/configuration.html) by default. | `string` | |
|
|
32
|
+
| `ignoreFile` | path to a Prettier [ignore file](https://prettier.io/docs/en/ignore). | `string` | `'.prettierignore'` |
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
_All properties are optional._
|
|
35
|
+
<!-- end autogenerated docs -->
|
package/lib/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PackageJsonScriptHook } from '@dotcom-tool-kit/package-json-hook';
|
|
2
|
-
import Prettier from './tasks/prettier';
|
|
3
|
-
export declare const tasks: (typeof Prettier)[];
|
|
4
|
-
declare class FormatLocal extends PackageJsonScriptHook {
|
|
5
|
-
static description: string;
|
|
6
|
-
key: string;
|
|
7
|
-
hook: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const hooks: {
|
|
10
|
-
'format:local': typeof FormatLocal;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AAEvC,eAAO,MAAM,KAAK,qBAAa,CAAA;AAE/B,cAAM,WAAY,SAAQ,qBAAqB;IAC7C,MAAM,CAAC,WAAW,SAAoB;IAEtC,GAAG,SAAW;IACd,IAAI,SAAiB;CACtB;AAED,eAAO,MAAM,KAAK;;CAEjB,CAAA"}
|
package/lib/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hooks = exports.tasks = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const package_json_hook_1 = require("@dotcom-tool-kit/package-json-hook");
|
|
6
|
-
const prettier_1 = tslib_1.__importDefault(require("./tasks/prettier"));
|
|
7
|
-
exports.tasks = [prettier_1.default];
|
|
8
|
-
class FormatLocal extends package_json_hook_1.PackageJsonScriptHook {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.key = 'format';
|
|
12
|
-
this.hook = `format:local`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
FormatLocal.description = 'format prettier';
|
|
16
|
-
exports.hooks = {
|
|
17
|
-
'format:local': FormatLocal
|
|
18
|
-
};
|