Skip to content

Use web api crypto instead of node:crypto for targeting evaluation #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ jobs:
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test
- run: npm run test
- run: npm run test-browser
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ FodyWeavers.xsd

# bundled folder
dist/
dist-esm/
out/
types/

Expand All @@ -411,3 +410,6 @@ types/

# examples
examples/package-lock.json

# playwright test result
test-results
73 changes: 70 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 13 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,24 @@
"name": "@microsoft/feature-management",
"version": "1.0.0-preview",
"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.",
"main": "dist/index.js",
"module": "./dist-esm/index.js",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "types/index.d.ts",
"files": [
"dist/**/*.js",
"dist/**/*.map",
"dist/**/*.d.ts",
"dist-esm/**/*.js",
"dist-esm/**/*.map",
"dist-esm/**/*.d.ts",
"types/**/*.d.ts",
"dist/",
"types/",
"LICENSE",
"README.md"
],
"scripts": {
"build": "npm run clean && npm run build-cjs && npm run build-esm && npm run build-test",
"build-cjs": "rollup --config",
"build-esm": "tsc -p ./tsconfig.json",
"build": "npm run clean && rollup --config && npm run build-test",
"build-test": "tsc -p ./tsconfig.test.json",
"clean": "rimraf dist dist-esm out types",
"clean": "rimraf dist out types",
"dev": "rollup --config --watch",
"lint": "eslint src/ test/",
"fix-lint": "eslint src/ test/ --fix",
"test": "mocha out/test/*.test.{js,cjs,mjs} --parallel"
"lint": "eslint src/ test/ --ignore-pattern test/browser/testcases.js",
"fix-lint": "eslint src/ test/ --fix --ignore-pattern test/browser/testcases.js",
"test": "mocha out/test/*.test.{js,cjs,mjs} --parallel",
"test-browser": "npx playwright install chromium && npx playwright test"
},
"repository": {
"type": "git",
Expand All @@ -42,6 +36,7 @@
"@types/node": "^20.10.7",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@playwright/test": "^1.46.1",
"chai": "^4.4.0",
"chai-as-promised": "^7.1.1",
"eslint": "^8.56.0",
Expand All @@ -51,5 +46,7 @@
"rollup-plugin-dts": "^6.1.0",
"tslib": "^2.6.2",
"typescript": "^5.3.3"
},
"dependencies": {
}
}
15 changes: 15 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
testDir: './test/browser',
fullyParallel: true,

retries: 0,
reporter: 'list',
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
}
],
});
25 changes: 21 additions & 4 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@ import dts from "rollup-plugin-dts";

export default [
{
external: ["crypto"],
input: "src/index.ts",
output: [
{
file: "dist/index.js",
dir: "dist/commonjs/",
format: "cjs",
sourcemap: true
sourcemap: true,
preserveModules: true,
},
{
dir: "dist/esm/",
format: "esm",
sourcemap: true,
preserveModules: true,
},
{
file: "dist/umd/index.js",
format: "umd",
name: 'FeatureManagement',
sourcemap: true
}
],
plugins: [
typescript({
Expand All @@ -28,13 +42,16 @@ export default [
"strictFunctionTypes": true,
"sourceMap": true,
"inlineSources": true
}
},
"exclude": [
"test/**/*"
]
})
],
},
{
input: "src/index.ts",
output: [{ file: "types/index.d.ts", format: "es" }],
output: [{ file: "types/index.d.ts", format: "esm" }],
plugins: [dts()],
},
];
Loading
Loading