Skip to content

Commit 0c2a500

Browse files
committed
[load-themed-styles] Update package layout
1 parent aca753f commit 0c2a500

8 files changed

Lines changed: 58 additions & 18 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/load-themed-styles",
5+
"comment": "Update package folder layout to be explicit about module types.",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@microsoft/load-themed-styles"
10+
}

libraries/load-themed-styles/.npmignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
# Use negative patterns to bring back the specific things we want to publish.
77
!/bin/**
8-
!/lib/**
9-
!/lib-*/**
8+
!/lib*/**
109
!/dist/**
1110

1211
!CHANGELOG.md
@@ -17,8 +16,7 @@
1716

1817
# Ignore certain patterns that should not get published.
1918
/dist/*.stats.*
20-
/lib/**/test/
21-
/lib-*/**/test/
19+
/lib*/**/test/
2220
*.test.js
2321

2422
# NOTE: These don't need to be specified, because NPM includes them automatically.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",
3+
4+
"extends": "local-web-rig/profiles/library/config/heft.json",
5+
6+
"phasesByName": {
7+
"build": {
8+
"cleanFiles": [{ "includeGlobs": ["lib-dts", "lib-esm"] }]
9+
}
10+
}
11+
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"extends": "local-web-rig/profiles/library/config/jest.config.json",
3-
4-
"rootDir": "lib",
5-
"roots": ["<rootDir>/lib"],
6-
"testMatch": ["<rootDir>/lib/**/*.test.js"]
2+
"extends": "local-web-rig/profiles/library/config/jest.config.json"
73
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",
3+
4+
"extends": "local-web-rig/profiles/library/config/rush-project.json",
5+
6+
"operationSettings": [
7+
{
8+
"operationName": "_phase:build",
9+
"outputFolderNames": ["lib-dts", "lib-esm"]
10+
}
11+
]
12+
}

libraries/load-themed-styles/config/typescript.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
},
2727

2828
{
29-
"moduleKind": "esnext",
30-
"outFolderName": "lib-es6"
29+
"moduleKind": "commonjs",
30+
"outFolderName": "lib-commonjs"
3131
}
3232
]
3333
}

libraries/load-themed-styles/package.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,32 @@
1313
"_phase:build": "heft run --only build -- --clean",
1414
"_phase:test": "heft run --only test -- --clean"
1515
},
16-
"main": "lib/index.js",
17-
"module": "lib-es6/index.js",
18-
"typings": "lib/index.d.ts",
16+
"main": "lib-commonjs/index.js",
17+
"module": "lib-esm/index.js",
18+
"typings": "lib-dts/index.d.ts",
1919
"keywords": [],
2020
"devDependencies": {
2121
"@rushstack/heft": "workspace:*",
2222
"local-web-rig": "workspace:*"
2323
},
2424
"exports": {
2525
".": {
26-
"require": "./lib/index.js",
27-
"import": "./lib-es6/index.js",
28-
"types": "./lib/index.d.ts"
26+
"require": "./lib-commonjs/index.js",
27+
"import": "./lib-esm/index.js",
28+
"types": "./lib-dts/index.d.ts"
29+
},
30+
"./lib/*": {
31+
"require": "./lib-commonjs/*",
32+
"import": "./lib-esm/*",
33+
"types": "./lib-dts/*"
2934
},
3035
"./package.json": "./package.json"
36+
},
37+
"typesVersions": {
38+
"*": {
39+
"lib/*": [
40+
"lib-dts/*"
41+
]
42+
}
3143
}
3244
}

libraries/load-themed-styles/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"extends": "./node_modules/local-web-rig/profiles/library/tsconfig-base.json",
33
"compilerOptions": {
44
"importHelpers": false,
5-
"module": "commonjs",
5+
"outDir": "lib-esm",
6+
"declarationDir": "lib-dts",
67
"lib": ["ES2015"]
78
}
89
}

0 commit comments

Comments
 (0)