Skip to content

Commit 1500c53

Browse files
Merge pull request #9 from NaverPayDev/feature/8
🚀 init @naverpay/publint
2 parents 14ab6eb + f4f8222 commit 1500c53

File tree

55 files changed

+2711
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2711
-28
lines changed

.changeset/tasty-guests-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@naverpay/publint": patch
3+
---
4+
5+
🚀 init @naverpay/publint

packages/publint/README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# @naverpay/publint
2+
3+
@naverpay/publint is a specialized tool for verifying and linting npm package structure and `package.json` files, tailored specifically for NaverPay frontend developers. It ensures that packages meet both general npm standards and NaverPay's internal best practices for modern JavaScript and TypeScript projects.
4+
5+
## Features
6+
7+
- Validates the structure and content of `package.json`
8+
- Enforces NaverPay-specific frontend development rules
9+
- Supports TypeScript projects
10+
- Verifies package types (regular, module, or dual)
11+
- Checks the `exports` field
12+
- Ensures presence of required fields
13+
- Validates output paths
14+
- Provides a user-friendly CLI interface
15+
16+
## NaverPay Frontend Guidelines
17+
18+
This tool incorporates NaverPay's internal frontend development guidelines, ensuring that all packages published by the team maintain consistent quality and structure. Some of the NaverPay-specific checks include:
19+
20+
- Adherence to NaverPay's naming conventions
21+
- Verification of required NaverPay-specific fields in `package.json`
22+
- Checks for compliance with NaverPay's code structuring rules
23+
- Validation of dependencies against NaverPay's approved list
24+
25+
By using @naverpay/publint, developers can ensure their packages are compliant with team standards before publication.
26+
27+
## Installation
28+
29+
You can install @naverpay/publint globally:
30+
31+
```bash
32+
npm install -g @naverpay/publint
33+
```
34+
35+
Or use it directly with npx without installing:
36+
37+
```bash
38+
npx @naverpay/publint
39+
```
40+
41+
## Usage
42+
43+
If installed globally, you can use publint directly in your project directory:
44+
45+
```bash
46+
publint
47+
```
48+
49+
Or specify a custom directory:
50+
51+
```bash
52+
publint ./my-project
53+
```
54+
55+
Using npx (without global installation):
56+
57+
```bash
58+
npx @naverpay/publint
59+
```
60+
61+
Or with a custom directory:
62+
63+
```bash
64+
npx @naverpay/publint ./my-project
65+
```
66+
67+
## What it checks
68+
69+
- Presence and validity of `package.json`
70+
- Correct structure of the `exports` field
71+
- Presence of required fields in `package.json`, including NaverPay-specific fields
72+
- Package type (regular, module, or dual) and corresponding structure
73+
- TypeScript configuration and type definition files (if applicable)
74+
- Validity of output paths defined in the `exports` field
75+
- Compliance with NaverPay frontend development guidelines
76+
77+
## Output
78+
79+
The tool will provide detailed feedback on the verification process, including any errors or warnings encountered during the checks. It will specifically highlight any deviations from NaverPay's internal standards.
80+
81+
## Contributing
82+
83+
Contributions are welcome from NaverPay team members! Please ensure you're familiar with our internal development guidelines before submitting a Pull Request.
84+
85+
## License
86+
87+
[MIT License](LICENSE)
88+
89+
## Acknowledgements
90+
91+
This project was inspired by [publint](https://github.com/bluwy/publint), created by Bjorn Lu. We appreciate their work in improving the npm package ecosystem. @naverpay/publint builds upon this foundation to meet the specific needs of the NaverPay frontend development team.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "cjs-typescript-no-require-types",
3+
"version": "1.0.0",
4+
"files": [
5+
"index.js",
6+
"index.d.ts"
7+
],
8+
"main": "./index.js",
9+
"types": "./index.d.ts",
10+
"exports": {
11+
".": {
12+
"require": "./index.js"
13+
},
14+
"./package.json": "./package.json"
15+
},
16+
"sideEffects": false
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig"
3+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "dual-package-invalid-extensions",
3+
"version": "1.0.0",
4+
"files": [
5+
"index.js"
6+
],
7+
"main": "./index.js",
8+
"exports": {
9+
".": {
10+
"require": {
11+
"default": "./index.js",
12+
"types": "./index.d.ts"
13+
},
14+
"import": {
15+
"default": "./index.js",
16+
"types": "./index.d.ts"
17+
}
18+
},
19+
"./package.json": "./package.json"
20+
},
21+
"sideEffects": false,
22+
"module": "./index.js",
23+
"types": "./index.d.ts"
24+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "dual-package-no-module",
3+
"version": "1.0.0",
4+
"files": [
5+
"index.js",
6+
"index.mjs"
7+
],
8+
"main": "./index.js",
9+
"exports": {
10+
".": {
11+
"require": "./index.js",
12+
"import": "./index.mjs"
13+
},
14+
"./package.json": "./package.json"
15+
},
16+
"sideEffects": false,
17+
"types": "./index.d.ts"
18+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "dual-package-invalid-extensions",
3+
"version": "1.0.0",
4+
"files": [
5+
"index.js"
6+
],
7+
"main": "./index.js",
8+
"exports": {
9+
".": {
10+
"require": {
11+
"default": "./index.js",
12+
"types": "./index.d.ts"
13+
},
14+
"import": {
15+
"default": "./index.mjs",
16+
"types": "./index.d.ts"
17+
}
18+
},
19+
"./package.json": "./package.json"
20+
},
21+
"sideEffects": false,
22+
"module": "./index.mjs",
23+
"types": "./index.d.ts"
24+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "dual-typescript-missing-types",
3+
"version": "1.0.0",
4+
"files": [
5+
"index.js",
6+
"index.mjs",
7+
"index.d.ts"
8+
],
9+
"main": "./index.js",
10+
"module": "./index.mjs",
11+
"types": "./index.d.ts",
12+
"exports": {
13+
".": {
14+
"require": "./index.js",
15+
"import": "./index.mjs"
16+
},
17+
"./package.json": "./package.json"
18+
},
19+
"sideEffects": false
20+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig"
3+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "esm-typescript-no-import-types",
3+
"version": "1.0.0",
4+
"files": [
5+
"index.mjs"
6+
],
7+
"main": "./index.mjs",
8+
"exports": {
9+
".": {
10+
"import": "./index.mjs",
11+
"require": {
12+
"types": "./index.d.ts",
13+
"default": "./index.js"
14+
}
15+
},
16+
"./package.json": "./package.json"
17+
},
18+
"sideEffects": false,
19+
"module": "./index.mjs",
20+
"types": "./index.d.ts"
21+
}

0 commit comments

Comments
 (0)