Skip to content

Commit 162d2eb

Browse files
will-stoneshellscape
authored andcommitted
feat: add module and typings entry items (#3)
* feat: add module and typings entry items * test: add typings to fixtures / update snapshot * feat: move types/typings to bottom
1 parent 03a7ab9 commit 162d2eb

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

lib/rules/sort.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const primary = [
2525
// entry
2626
'main',
2727
'bin',
28+
'module',
2829

2930
// constraints
3031
'engines',
@@ -42,7 +43,11 @@ const primary = [
4243
'peerDependencies',
4344
'dependencies',
4445
'devDependencies',
45-
'resolutions'
46+
'resolutions',
47+
48+
// types
49+
'types',
50+
'typings'
4651
];
4752

4853
const sort = (props) => {

test/fixtures/fixture.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"test": "ava",
2525
"lint-staged": "lint-staged"
2626
},
27+
"module": "dist/file.esm.js",
2728
"files": [
2829
"README.md",
2930
"lib/",
@@ -39,6 +40,7 @@
3940
"peerDependencies": {
4041
"prettier": "^1.18.2"
4142
},
43+
"typings": "dist/index.d.ts",
4244
"dependencies": {},
4345
"devDependencies": {
4446
"@commitlint/cli": "^8.1.0",

test/snapshots/test.js.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Generated by [AVA](https://ava.li).
1818
"homepage": "https://github.com/shellscape/prettier-plugin-package",␊
1919
"bugs": "https://github.com/shellscape/prettier-plugin-package/issues",␊
2020
"main": "lib/index.js",␊
21+
"module": "dist/file.esm.js",␊
2122
"engines": {␊
2223
"node": ">= 8.0.0"␊
2324
},␊
@@ -61,6 +62,7 @@ Generated by [AVA](https://ava.li).
6162
"pre-commit": "^1.2.2",␊
6263
"prettier": "^1.18.2"␊
6364
},␊
65+
"typings": "dist/index.d.ts",␊
6466
"ava": {␊
6567
"files": [␊
6668
"!**/fixtures/**"␊
@@ -98,6 +100,7 @@ Generated by [AVA](https://ava.li).
98100
"homepage": "https://github.com/shellscape/prettier-plugin-package",␊
99101
"bugs": "https://github.com/shellscape/prettier-plugin-package/issues",␊
100102
"main": "lib/index.js",␊
103+
"module": "dist/file.esm.js",␊
101104
"engines": {␊
102105
"node": ">= 8.0.0"␊
103106
},␊
@@ -141,6 +144,7 @@ Generated by [AVA](https://ava.li).
141144
"pre-commit": "^1.2.2",␊
142145
"prettier": "^1.18.2"␊
143146
},␊
147+
"typings": "dist/index.d.ts",␊
144148
"ava": {␊
145149
"files": [␊
146150
"!**/fixtures/**"␊

test/snapshots/test.js.snap

33 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)