@langri-sha/projen-lint-staged 0.1.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/CHANGELOG.json +52 -0
- package/CHANGELOG.md +21 -0
- package/lib/index.d.ts +28 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +43 -0
- package/lib/index.js.map +1 -0
- package/license +10 -0
- package/package.json +33 -0
- package/readme +1 -0
- package/src/index.ts +62 -0
package/CHANGELOG.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@langri-sha/projen-lint-staged",
|
|
3
|
+
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Sat, 15 Jun 2024 09:06:45 GMT",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"tag": "@langri-sha/projen-lint-staged_v0.1.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "filip.dupanovic@gmail.com",
|
|
12
|
+
"package": "@langri-sha/projen-lint-staged",
|
|
13
|
+
"commit": "7ac78ea2d172ae9e30f23d213752297fb8436a88",
|
|
14
|
+
"comment": "feat(projen): Reconfigure project expressions"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "filip.dupanovic@gmail.com",
|
|
18
|
+
"package": "@langri-sha/projen-lint-staged",
|
|
19
|
+
"commit": "7ac78ea2d172ae9e30f23d213752297fb8436a88",
|
|
20
|
+
"comment": "feat(projen): Drop pinning peer dependencies"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "filip.dupanovic@gmail.com",
|
|
24
|
+
"package": "@langri-sha/projen-lint-staged",
|
|
25
|
+
"commit": "7ac78ea2d172ae9e30f23d213752297fb8436a88",
|
|
26
|
+
"comment": "feat(project): Omit Node.js engine package defaults"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "filip.dupanovic@gmail.com",
|
|
30
|
+
"package": "@langri-sha/projen-lint-staged",
|
|
31
|
+
"commit": "7ac78ea2d172ae9e30f23d213752297fb8436a88",
|
|
32
|
+
"comment": "feat(project): Reconfigure NPM ignore patterns"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "filip.dupanovic@gmail.com",
|
|
36
|
+
"package": "@langri-sha/projen-lint-staged",
|
|
37
|
+
"commit": "7ac78ea2d172ae9e30f23d213752297fb8436a88",
|
|
38
|
+
"comment": "feat(lint-staged): Add component for configuring `lint-staged`"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"patch": [
|
|
42
|
+
{
|
|
43
|
+
"author": "email not defined",
|
|
44
|
+
"package": "@langri-sha/projen-lint-staged",
|
|
45
|
+
"commit": "7ac78ea2d172ae9e30f23d213752297fb8436a88",
|
|
46
|
+
"comment": "chore(deps): chore(deps): update dependency projen to v0.82.3"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Change Log - @langri-sha/projen-lint-staged
|
|
2
|
+
|
|
3
|
+
This log was last generated on Sat, 15 Jun 2024 09:06:45 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
Sat, 15 Jun 2024 09:06:45 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- feat(projen): Reconfigure project expressions (filip.dupanovic@gmail.com)
|
|
14
|
+
- feat(projen): Drop pinning peer dependencies (filip.dupanovic@gmail.com)
|
|
15
|
+
- feat(project): Omit Node.js engine package defaults (filip.dupanovic@gmail.com)
|
|
16
|
+
- feat(project): Reconfigure NPM ignore patterns (filip.dupanovic@gmail.com)
|
|
17
|
+
- feat(lint-staged): Add component for configuring `lint-staged` (filip.dupanovic@gmail.com)
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- chore(deps): chore(deps): update dependency projen to v0.82.3 (email not defined)
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Config } from 'prettier';
|
|
2
|
+
import { FileBase, IResolver, Project } from 'projen';
|
|
3
|
+
/**
|
|
4
|
+
* Options for configuring Prettier.
|
|
5
|
+
*/
|
|
6
|
+
export interface LintStagedOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Name of the Prettier config module.
|
|
9
|
+
*
|
|
10
|
+
* @default 'lint-staged.config.js'
|
|
11
|
+
*/
|
|
12
|
+
filename?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Name of the `lint-staged` configuration package to extend from.
|
|
15
|
+
*/
|
|
16
|
+
extends?: string;
|
|
17
|
+
/**
|
|
18
|
+
* `lint-staged` configuration.
|
|
19
|
+
*/
|
|
20
|
+
config?: Config;
|
|
21
|
+
}
|
|
22
|
+
export declare class LintStaged extends FileBase {
|
|
23
|
+
#private;
|
|
24
|
+
config: Config;
|
|
25
|
+
constructor(project: Project, options?: LintStagedOptions);
|
|
26
|
+
protected synthesizeContent(_: IResolver): string | undefined;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,UAAW,SAAQ,QAAQ;;IAEtC,MAAM,EAAE,MAAM,CAAA;gBAEF,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,iBAAsB;cAY1C,iBAAiB,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;CAmBvE"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _LintStaged_extends;
|
|
13
|
+
import serialize from 'serialize-javascript';
|
|
14
|
+
import { FileBase } from 'projen';
|
|
15
|
+
export class LintStaged extends FileBase {
|
|
16
|
+
constructor(project, options = {}) {
|
|
17
|
+
const filename = options.filename ?? 'lint-staged.config.js';
|
|
18
|
+
super(project, filename, {
|
|
19
|
+
readonly: true,
|
|
20
|
+
marker: true,
|
|
21
|
+
});
|
|
22
|
+
_LintStaged_extends.set(this, void 0);
|
|
23
|
+
__classPrivateFieldSet(this, _LintStaged_extends, options.extends, "f");
|
|
24
|
+
this.config = options.config ?? {};
|
|
25
|
+
}
|
|
26
|
+
synthesizeContent(_) {
|
|
27
|
+
const config = {
|
|
28
|
+
...this.config,
|
|
29
|
+
};
|
|
30
|
+
const serialized = serialize(config, {
|
|
31
|
+
unsafe: true,
|
|
32
|
+
});
|
|
33
|
+
return `${__classPrivateFieldGet(this, _LintStaged_extends, "f") ? `import defaults from '${__classPrivateFieldGet(this, _LintStaged_extends, "f")}'\n\n` : ''}/** @type {import('lint-staged').Config} */
|
|
34
|
+
const config = {
|
|
35
|
+
${__classPrivateFieldGet(this, _LintStaged_extends, "f") ? `...defaults,` : ''}
|
|
36
|
+
${serialized.slice(1)}
|
|
37
|
+
|
|
38
|
+
export default config
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_LintStaged_extends = new WeakMap();
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,sBAAsB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAsB,MAAM,QAAQ,CAAA;AAwBrD,MAAM,OAAO,UAAW,SAAQ,QAAQ;IAItC,YAAY,OAAgB,EAAE,UAA6B,EAAE;QAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,uBAAuB,CAAA;QAE5D,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE;YACvB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;SACb,CAAC,CAAA;QATJ,sCAAiB;QAWf,uBAAA,IAAI,uBAAY,OAAO,CAAC,OAAO,MAAA,CAAA;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAA;IACpC,CAAC;IAEkB,iBAAiB,CAAC,CAAY;QAC/C,MAAM,MAAM,GAAW;YACrB,GAAG,IAAI,CAAC,MAAM;SACf,CAAA;QAED,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE;YACnC,MAAM,EAAE,IAAI;SACb,CAAC,CAAA;QAEF,OAAO,GACL,uBAAA,IAAI,2BAAS,CAAC,CAAC,CAAC,yBAAyB,uBAAA,IAAI,2BAAS,OAAO,CAAC,CAAC,CAAC,EAClE;;QAEI,uBAAA,IAAI,2BAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;QACnC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;;;KAGtB,CAAA;IACH,CAAC;CACF"}
|
package/license
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2024 Filip Dupanović <filip.dupanovic@gmail.com> (https://langri-sha.com)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@langri-sha/projen-lint-staged",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Filip Dupanović",
|
|
7
|
+
"email": "filip.dupanovic@gmail.com",
|
|
8
|
+
"url": "https://langri-sha.com",
|
|
9
|
+
"organization": false
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"prepublishOnly": "rm -rf lib; tsc --project tsconfig.build.json"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"serialize-javascript": "6.0.2"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@langri-sha/jest-test": "0.8.0",
|
|
21
|
+
"@langri-sha/tsconfig": "0.10.0",
|
|
22
|
+
"@types/serialize-javascript": "5.0.4"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"lint-staged": "^15.0.0",
|
|
26
|
+
"projen": "^0.82.0"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.mts and run \"npx projen\".",
|
|
32
|
+
"types": "lib/index.d.ts"
|
|
33
|
+
}
|
package/readme
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @langri-sha/projen-lint-staged
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import serialize from 'serialize-javascript'
|
|
2
|
+
import type { Config } from 'prettier'
|
|
3
|
+
import { FileBase, IResolver, Project } from 'projen'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options for configuring Prettier.
|
|
7
|
+
*/
|
|
8
|
+
export interface LintStagedOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Name of the Prettier config module.
|
|
11
|
+
*
|
|
12
|
+
* @default 'lint-staged.config.js'
|
|
13
|
+
*/
|
|
14
|
+
filename?: string
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Name of the `lint-staged` configuration package to extend from.
|
|
18
|
+
*/
|
|
19
|
+
extends?: string
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `lint-staged` configuration.
|
|
23
|
+
*/
|
|
24
|
+
config?: Config
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class LintStaged extends FileBase {
|
|
28
|
+
#extends?: string
|
|
29
|
+
config: Config
|
|
30
|
+
|
|
31
|
+
constructor(project: Project, options: LintStagedOptions = {}) {
|
|
32
|
+
const filename = options.filename ?? 'lint-staged.config.js'
|
|
33
|
+
|
|
34
|
+
super(project, filename, {
|
|
35
|
+
readonly: true,
|
|
36
|
+
marker: true,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
this.#extends = options.extends
|
|
40
|
+
this.config = options.config ?? {}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected override synthesizeContent(_: IResolver): string | undefined {
|
|
44
|
+
const config: Config = {
|
|
45
|
+
...this.config,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const serialized = serialize(config, {
|
|
49
|
+
unsafe: true,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
return `${
|
|
53
|
+
this.#extends ? `import defaults from '${this.#extends}'\n\n` : ''
|
|
54
|
+
}/** @type {import('lint-staged').Config} */
|
|
55
|
+
const config = {
|
|
56
|
+
${this.#extends ? `...defaults,` : ''}
|
|
57
|
+
${serialized.slice(1)}
|
|
58
|
+
|
|
59
|
+
export default config
|
|
60
|
+
`
|
|
61
|
+
}
|
|
62
|
+
}
|