diff --git a/.github/.codecov.yml b/.github/.codecov.yml index d782656df33..21bd0ca39a9 100644 --- a/.github/.codecov.yml +++ b/.github/.codecov.yml @@ -11,3 +11,7 @@ coverage: default: target: 95% threshold: 2% + patch: + default: + target: 95% + threshold: 1% diff --git a/README.md b/README.md index ba750a77cc2..6b1c3b1ba93 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,17 @@ const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com const randomPhoneNumber = faker.phone.phoneNumber(); // 938-672-1359 x418 ``` +#### Alternative CDN links + +**esm:** + +- https://esm.sh/@faker-js/faker +- https://cdn.jsdelivr.net/npm/@faker-js/faker/+esm + +**cjs:** + +- https://cdn.jsdelivr.net/npm/@faker-js/faker + ### TypeScript Support Since version `v6+` there is native TypeScript support. diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index 60799a0eb4f..8c15b49db9f 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -40,13 +40,10 @@ const sidebar = { ], }; -// grab from process.env once this is building on netlify const algolia = { - apiKey: '', - indexName: '', - searchParameters: { - facetFilters: [''], - }, + apiKey: process.env.API_KEY, + appId: process.env.APP_ID, + indexName: 'fakerjs', }; const description = @@ -62,27 +59,42 @@ export default defineConfig({ [ 'meta', { - property: 'og:description', + name: 'og:description', content: description, }, + ], + [ + 'meta', { name: 'twitter:description', content: description, }, + ], + [ + 'meta', { name: 'description', content: description, }, + ], + [ + 'meta', { - property: 'og:image', + name: 'og:image', content: image, }, + ], + [ + 'meta', { - property: 'twitter:image', + name: 'twitter:image', content: image, }, + ], + [ + 'meta', { - property: 'twitter:card', + name: 'twitter:card', content: 'summary_large_image', }, ], @@ -96,7 +108,6 @@ export default defineConfig({ editLinkText: 'Suggest changes to this page', nav, sidebar, - // TODO 2022-03-06: https://github.com/faker-js/faker/issues/222 - // algolia, + algolia, }, }); diff --git a/docs/guide/index.md b/docs/guide/index.md index fded3ac6c8d..61fe9a3dc61 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -71,7 +71,7 @@ const randomCard = faker.helpers.createCard(); // An object representing a rando Using the browser is great for experimenting 👍. However, due to all of the strings Faker uses to generate fake data, **Faker is a large package**. It's `> 5 MiB` minified. **Please avoid deploying Faker in your web app.** ::: -### Deno +### CDN/Deno ```js import { faker } from 'https://cdn.skypack.dev/@faker-js/faker'; @@ -85,6 +85,17 @@ const randomCard = faker.helpers.createCard(); // random contact card containing It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v6.0.0"`. Add `?dts` to import with type definitions: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v6.0.0?dts"`. ::: +#### Alternative CDN links + +**esm:** + +- https://esm.sh/@faker-js/faker +- https://cdn.jsdelivr.net/npm/@faker-js/faker/+esm + +**cjs:** + +- https://cdn.jsdelivr.net/npm/@faker-js/faker + ## Community If you have questions or need help, reach out to the community via [Discord](https://chat.fakerjs.dev) and [GitHub Discussions](https://github.com/faker-js/faker/discussions). diff --git a/package.json b/package.json index 4446c6c2c23..98d30a4baa0 100644 --- a/package.json +++ b/package.json @@ -94,9 +94,9 @@ "@types/prettier": "~2.4.4", "@types/sanitize-html": "~2.6.2", "@types/validator": "~13.7.1", - "@typescript-eslint/eslint-plugin": "~5.15.0", - "@typescript-eslint/parser": "~5.15.0", - "@vitest/ui": "~0.7.6", + "@typescript-eslint/eslint-plugin": "~5.16.0", + "@typescript-eslint/parser": "~5.16.0", + "@vitest/ui": "~0.7.7", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.7.6" + "vitest": "~0.7.7" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 802b1c3a596..4bb506f1700 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,9 +6,9 @@ specifiers: '@types/prettier': ~2.4.4 '@types/sanitize-html': ~2.6.2 '@types/validator': ~13.7.1 - '@typescript-eslint/eslint-plugin': ~5.15.0 - '@typescript-eslint/parser': ~5.15.0 - '@vitest/ui': ~0.7.6 + '@typescript-eslint/eslint-plugin': ~5.16.0 + '@typescript-eslint/parser': ~5.16.0 + '@vitest/ui': ~0.7.7 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.7.6 + vitest: ~0.7.7 devDependencies: '@types/markdown-it': 12.2.3 @@ -43,9 +43,9 @@ devDependencies: '@types/prettier': 2.4.4 '@types/sanitize-html': 2.6.2 '@types/validator': 13.7.1 - '@typescript-eslint/eslint-plugin': 5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28 - '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@vitest/ui': 0.7.6 + '@typescript-eslint/eslint-plugin': 5.16.0_3fed250b11519414a4c7d52468dd6bf5 + '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@vitest/ui': 0.7.7 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.7.6_@vitest+ui@0.7.6+c8@7.11.0 + vitest: 0.7.7_@vitest+ui@0.7.7+c8@7.11.0 packages: @@ -434,8 +434,8 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28: - resolution: {integrity: sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==} + /@typescript-eslint/eslint-plugin/5.16.0_3fed250b11519414a4c7d52468dd6bf5: + resolution: {integrity: sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -445,11 +445,11 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@typescript-eslint/scope-manager': 5.15.0 - '@typescript-eslint/type-utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@typescript-eslint/utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 - debug: 4.3.3 + '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/scope-manager': 5.16.0 + '@typescript-eslint/type-utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 + debug: 4.3.4 eslint: 8.11.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 @@ -461,8 +461,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.15.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==} + /@typescript-eslint/parser/5.16.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -471,26 +471,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.15.0 - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/typescript-estree': 5.15.0_typescript@4.6.2 - debug: 4.3.3 + '@typescript-eslint/scope-manager': 5.16.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.2 + debug: 4.3.4 eslint: 8.11.0 typescript: 4.6.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.15.0: - resolution: {integrity: sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==} + /@typescript-eslint/scope-manager/5.16.0: + resolution: {integrity: sha512-P+Yab2Hovg8NekLIR/mOElCDPyGgFZKhGoZA901Yax6WR6HVeGLbsqJkZ+Cvk5nts/dAlFKm8PfL43UZnWdpIQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/visitor-keys': 5.15.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/visitor-keys': 5.16.0 dev: true - /@typescript-eslint/type-utils/5.15.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==} + /@typescript-eslint/type-utils/5.16.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -499,7 +499,7 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 debug: 4.3.4 eslint: 8.11.0 tsutils: 3.21.0_typescript@4.6.2 @@ -508,13 +508,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types/5.15.0: - resolution: {integrity: sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==} + /@typescript-eslint/types/5.16.0: + resolution: {integrity: sha512-oUorOwLj/3/3p/HFwrp6m/J2VfbLC8gjW5X3awpQJ/bSG+YRGFS4dpsvtQ8T2VNveV+LflQHjlLvB6v0R87z4g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.15.0_typescript@4.6.2: - resolution: {integrity: sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==} + /@typescript-eslint/typescript-estree/5.16.0_typescript@4.6.2: + resolution: {integrity: sha512-SE4VfbLWUZl9MR+ngLSARptUv2E8brY0luCdgmUevU6arZRY/KxYoLI/3V/yxaURR8tLRN7bmZtJdgmzLHI6pQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -522,8 +522,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/visitor-keys': 5.15.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/visitor-keys': 5.16.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -534,16 +534,16 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.15.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==} + /@typescript-eslint/utils/5.16.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.9 - '@typescript-eslint/scope-manager': 5.15.0 - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/typescript-estree': 5.15.0_typescript@4.6.2 + '@typescript-eslint/scope-manager': 5.16.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.2 eslint: 8.11.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.11.0 @@ -552,11 +552,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.15.0: - resolution: {integrity: sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==} + /@typescript-eslint/visitor-keys/5.16.0: + resolution: {integrity: sha512-jqxO8msp5vZDhikTwq9ubyMHqZ67UIvawohr4qF3KhlpL7gzSjOd+8471H3nh5LyABkaI85laEKKU8SnGUK5/g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.15.0 + '@typescript-eslint/types': 5.16.0 eslint-visitor-keys: 3.3.0 dev: true @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.7.6: - resolution: {integrity: sha512-UX99oH1XM9XXi6Py26CbzlqLhG8kOXVB2n7nneoj1uU+C9mKCaVKX8eN4reRU49ntby9FAMAVq4uIkVcAMHIAA==} + /@vitest/ui/0.7.7: + resolution: {integrity: sha512-r+8w1AlUUWcHmAbNbm2wuhhtLqAL5EPtgE2MYCF3/7fjLJUkxRdox8fn/bwqAQGoPTRDOyhLdOZWlJUpk5VKcw==} dependencies: sirv: 2.0.2 dev: true @@ -4444,9 +4444,9 @@ packages: - stylus dev: true - /vitest/0.7.6_@vitest+ui@0.7.6+c8@7.11.0: - resolution: {integrity: sha512-fqk0cn0I2BUpzwLfeZ725JeXJ7WGwDtVcVBksQ6SdyjrBi6aex8t3w70TWgyLOXgylS7FJ8C9DRap4MMgpkqYw==} - engines: {node: '>=14.14.0'} + /vitest/0.7.7_@vitest+ui@0.7.7+c8@7.11.0: + resolution: {integrity: sha512-xU7BTB7T7GbcjFBdbZAAp/dIQUwn8bygI+cbw6Yq1oXj60oGRJ+nJ7AXvSOJyaHMTmglEoaqazyDGnCHJBXftw==} + engines: {node: '>=v14.19.1'} hasBin: true peerDependencies: '@vitest/ui': '*' @@ -4465,7 +4465,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.7.6 + '@vitest/ui': 0.7.7 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 diff --git a/tsconfig.json b/tsconfig.json index 9f2fe64c876..aea7ca439c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,15 @@ "outDir": "dist", "declaration": true, "esModuleInterop": true, - "allowJs": true + "allowJs": true, + "alwaysStrict": true, + // "strictNullChecks": true, + // "strictBindCallApply": true, + "strictFunctionTypes": true, + // "strictPropertyInitialization": true, + // "noImplicitAny": true, + // "noImplicitThis": true, + "useUnknownInCatchVariables": true }, "include": ["src/**/*"], "exclude": ["node_modules"]