Skip to content

Commit fd588be

Browse files
merge main & resolve conflict
2 parents 7e3a228 + ea7ec83 commit fd588be

26 files changed

+320
-89
lines changed

.eslintrc

+13-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@
4545
"error",
4646
"always"
4747
],
48-
"no-trailing-spaces": "warn"
48+
"no-trailing-spaces": "error",
49+
"space-before-blocks": [
50+
"error",
51+
"always"
52+
],
53+
"no-multi-spaces": "error",
54+
"no-multiple-empty-lines": [
55+
"error",
56+
{
57+
"max": 1
58+
}
59+
],
60+
"semi": ["error", "always"]
4961
}
5062
}

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ jobs:
3030
- run: npm ci
3131
- run: npm run lint
3232
- run: npm run build
33-
- run: npm test
33+
- run: npm run test
34+
- run: npm run test-browser

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ FodyWeavers.xsd
399399

400400
# bundled folder
401401
dist/
402-
dist-esm/
403402
out/
404403
types/
405404

@@ -411,3 +410,6 @@ types/
411410

412411
# examples
413412
examples/package-lock.json
413+
414+
# playwright test result
415+
test-results

package-lock.json

+70-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+12-17
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,24 @@
22
"name": "@microsoft/feature-management",
33
"version": "1.0.0-preview",
44
"description": "Feature Management is a library for enabling/disabling features at runtime. Developers can use feature flags in simple use cases like conditional statement to more advanced scenarios like conditionally adding routes.",
5-
"main": "dist/index.js",
6-
"module": "./dist-esm/index.js",
5+
"main": "./dist/commonjs/index.js",
6+
"module": "./dist/esm/index.js",
77
"types": "types/index.d.ts",
88
"files": [
9-
"dist/**/*.js",
10-
"dist/**/*.map",
11-
"dist/**/*.d.ts",
12-
"dist-esm/**/*.js",
13-
"dist-esm/**/*.map",
14-
"dist-esm/**/*.d.ts",
15-
"types/**/*.d.ts",
9+
"dist/",
10+
"types/",
1611
"LICENSE",
1712
"README.md"
1813
],
1914
"scripts": {
20-
"build": "npm run clean && npm run build-cjs && npm run build-esm && npm run build-test",
21-
"build-cjs": "rollup --config",
22-
"build-esm": "tsc -p ./tsconfig.json",
15+
"build": "npm run clean && rollup --config && npm run build-test",
2316
"build-test": "tsc -p ./tsconfig.test.json",
24-
"clean": "rimraf dist dist-esm out types",
17+
"clean": "rimraf dist out types",
2518
"dev": "rollup --config --watch",
26-
"lint": "eslint src/ test/",
27-
"fix-lint": "eslint src/ test/ --fix",
28-
"test": "mocha out/test/*.test.{js,cjs,mjs} --parallel"
19+
"lint": "eslint src/ test/ --ignore-pattern test/browser/testcases.js",
20+
"fix-lint": "eslint src/ test/ --fix --ignore-pattern test/browser/testcases.js",
21+
"test": "mocha out/*.test.{js,cjs,mjs} --parallel",
22+
"test-browser": "npx playwright install chromium && npx playwright test"
2923
},
3024
"repository": {
3125
"type": "git",
@@ -42,7 +36,9 @@
4236
"@types/node": "^20.10.7",
4337
"@typescript-eslint/eslint-plugin": "^6.18.1",
4438
"@typescript-eslint/parser": "^6.18.1",
39+
"@playwright/test": "^1.46.1",
4540
"chai": "^4.4.0",
41+
"chai-as-promised": "^7.1.1",
4642
"eslint": "^8.56.0",
4743
"mocha": "^10.2.0",
4844
"rimraf": "^5.0.5",
@@ -52,6 +48,5 @@
5248
"typescript": "^5.3.3"
5349
},
5450
"dependencies": {
55-
"chai-as-promised": "^7.1.1"
5651
}
5752
}

playwright.config.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
testDir: './test/browser',
5+
fullyParallel: true,
6+
7+
retries: 0,
8+
reporter: 'list',
9+
projects: [
10+
{
11+
name: 'chromium',
12+
use: { ...devices['Desktop Chrome'] },
13+
}
14+
],
15+
});

rollup.config.mjs

+21-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,27 @@ import dts from "rollup-plugin-dts";
44

55
export default [
66
{
7+
external: ["crypto"],
78
input: "src/index.ts",
89
output: [
910
{
10-
file: "dist/index.js",
11+
dir: "dist/commonjs/",
1112
format: "cjs",
12-
sourcemap: true
13+
sourcemap: true,
14+
preserveModules: true,
15+
},
16+
{
17+
dir: "dist/esm/",
18+
format: "esm",
19+
sourcemap: true,
20+
preserveModules: true,
1321
},
22+
{
23+
file: "dist/umd/index.js",
24+
format: "umd",
25+
name: 'FeatureManagement',
26+
sourcemap: true
27+
}
1428
],
1529
plugins: [
1630
typescript({
@@ -28,13 +42,16 @@ export default [
2842
"strictFunctionTypes": true,
2943
"sourceMap": true,
3044
"inlineSources": true
31-
}
45+
},
46+
"exclude": [
47+
"test/**/*"
48+
]
3249
})
3350
],
3451
},
3552
{
3653
input: "src/index.ts",
37-
output: [{ file: "types/index.d.ts", format: "es" }],
54+
output: [{ file: "types/index.d.ts", format: "esm" }],
3855
plugins: [dts()],
3956
},
4057
];

0 commit comments

Comments
 (0)