From 1b6dd7ce42ebae12c153cae1a544cade40de5de5 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 11:12:48 -0300 Subject: [PATCH 01/27] chore: fix main types --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b121afa084a..c59b499a661 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", - "types": "index.d.ts", + "types": "dist/types/index.d.ts", "typesVersions": { ">=5.0": { "*": [ From f9079052d8b9cdcf79747890fbe752b111d818b8 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 11:22:37 -0300 Subject: [PATCH 02/27] fix: drop import package import --- test/faker.spec.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/faker.spec.ts b/test/faker.spec.ts index 749e850110d..b0b1b7a0185 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -18,9 +18,6 @@ describe('faker', () => { .filter((key) => typeof console[key] === 'function') .map((methodName) => vi.spyOn(console, methodName)); - const file: unknown = await import('..'); - expect(file).toBeDefined(); - new Faker({ locale: { metadata: { title: '' } } }); for (const spy of spies) { From 6cc3fcd33ad8cf8e8c65dc07974123ce628cef8b Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 11:25:58 -0300 Subject: [PATCH 03/27] fix: drop async from test callback --- test/faker.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/faker.spec.ts b/test/faker.spec.ts index b0b1b7a0185..536ea8e6c9b 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -13,7 +13,7 @@ describe('faker', () => { ); }); - it('should not log anything on startup', async () => { + it('should not log anything on startup', () => { const spies: MockInstance[] = keys(console) .filter((key) => typeof console[key] === 'function') .map((methodName) => vi.spyOn(console, methodName)); From 85ade949c8714b45c3ad4fcd3df32e276d90bbc9 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:31:52 -0300 Subject: [PATCH 04/27] feat: add playground workflow --- .github/workflows/playground.yml | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/playground.yml diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml new file mode 100644 index 00000000000..6e126734350 --- /dev/null +++ b/.github/workflows/playground.yml @@ -0,0 +1,44 @@ +name: Playground + +on: + pull_request: + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + playground: + runs-on: ubuntu-latest + timeout-minutes: 10 + name: Check Playground + + steps: + - name: Set node version to 22 + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 22 + cache: 'pnpm' + + - name: Install pnpm + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + path: faker + + - run: pnpm install && pnpm build + working-directory: faker + env: + CYPRESS_INSTALL_BINARY: 0 + + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + repository: fakerjs/playground + path: faker-playground + + - run: | + pnpm install + pnpm -r --workspace-concurrency 1 test + working-directory: faker-playground From c9ab999c8896d51a0906255cfebed669f83143ec Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:37:39 -0300 Subject: [PATCH 05/27] fix: playground adjusts --- .github/workflows/playground.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 6e126734350..6e979a1e41d 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -13,20 +13,21 @@ jobs: name: Check Playground steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + path: faker + - name: Set node version to 22 uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 22 cache: 'pnpm' + cache-dependency-path: faker - name: Install pnpm uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - path: faker - - run: pnpm install && pnpm build working-directory: faker env: From 080e6988c05eacd0aa676430262ab5f37eb40810 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:39:34 -0300 Subject: [PATCH 06/27] Update playground.yml --- .github/workflows/playground.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 6e979a1e41d..aed7f4bac63 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -22,8 +22,6 @@ jobs: uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 22 - cache: 'pnpm' - cache-dependency-path: faker - name: Install pnpm uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 From 66b1e8665b2a0b16540d72427f5b18e33916f54c Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:44:55 -0300 Subject: [PATCH 07/27] Update playground.yml --- .github/workflows/playground.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index aed7f4bac63..58edd88a9c0 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -23,20 +23,22 @@ jobs: with: node-version: 22 + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + repository: fakerjs/playground + path: faker-playground + - name: Install pnpm uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + package_json_file: faker-playground/package.json - run: pnpm install && pnpm build working-directory: faker env: CYPRESS_INSTALL_BINARY: 0 - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - repository: fakerjs/playground - path: faker-playground - - run: | pnpm install pnpm -r --workspace-concurrency 1 test From 0bc5a737bb9c5521fa02c3138425aefdb44d04e2 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:46:29 -0300 Subject: [PATCH 08/27] fix playground repository --- .github/workflows/playground.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 58edd88a9c0..63c1435c1ad 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: - repository: fakerjs/playground + repository: faker-js/playground path: faker-playground - name: Install pnpm From ae21dc52c9b7ef4e3b2be236cf4d9fac556ea406 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:51:13 -0300 Subject: [PATCH 09/27] Update playground.yml --- .github/workflows/playground.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 63c1435c1ad..31706a07dac 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -40,6 +40,8 @@ jobs: CYPRESS_INSTALL_BINARY: 0 - run: | + sed -i -e "s/overrides-for-dev/overrides/g" package.json + cat package.json pnpm install pnpm -r --workspace-concurrency 1 test working-directory: faker-playground From ddbc3861fc3394a520cc82d01e62189ee5e8cc51 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:53:23 -0300 Subject: [PATCH 10/27] Update playground.yml --- .github/workflows/playground.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 31706a07dac..c7e13f5f9d0 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -42,6 +42,6 @@ jobs: - run: | sed -i -e "s/overrides-for-dev/overrides/g" package.json cat package.json - pnpm install + pnpm install --no-frozen-lockfile pnpm -r --workspace-concurrency 1 test working-directory: faker-playground From a9dbf31f25710dfda34beffd5c679017b6030d54 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 14:58:23 -0300 Subject: [PATCH 11/27] Update playground.yml --- .github/workflows/playground.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index c7e13f5f9d0..9bffb72f049 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -13,7 +13,7 @@ jobs: name: Check Playground steps: - - name: Checkout + - name: Checkout Faker uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: path: faker @@ -23,7 +23,7 @@ jobs: with: node-version: 22 - - name: Checkout + - name: Checkout Playground uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: repository: faker-js/playground @@ -34,12 +34,14 @@ jobs: with: package_json_file: faker-playground/package.json - - run: pnpm install && pnpm build + - name: Build Faker + run: pnpm install && pnpm build working-directory: faker env: CYPRESS_INSTALL_BINARY: 0 - - run: | + - name: Check Playground + run: | sed -i -e "s/overrides-for-dev/overrides/g" package.json cat package.json pnpm install --no-frozen-lockfile From fa0e7f28c063923f1798428764547ef9f5b925ed Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:06:45 -0300 Subject: [PATCH 12/27] disable cypress install in playground --- .github/workflows/playground.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 9bffb72f049..75abd661d2c 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -47,3 +47,5 @@ jobs: pnpm install --no-frozen-lockfile pnpm -r --workspace-concurrency 1 test working-directory: faker-playground + env: + CYPRESS_INSTALL_BINARY: 0 From dff06610f5c2a4a97246c2b95bcea6fcc6292381 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:08:49 -0300 Subject: [PATCH 13/27] cypress is used --- .github/workflows/playground.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 75abd661d2c..9bffb72f049 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -47,5 +47,3 @@ jobs: pnpm install --no-frozen-lockfile pnpm -r --workspace-concurrency 1 test working-directory: faker-playground - env: - CYPRESS_INSTALL_BINARY: 0 From c7df499d0e291b2d8f276b2e30a76297ac3cb83f Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:18:59 -0300 Subject: [PATCH 14/27] drop types from package.json root --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index c59b499a661..7cdac25d446 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", - "types": "dist/types/index.d.ts", "typesVersions": { ">=5.0": { "*": [ From 6c9a648c19ea69253107f5d7ce553c8c14555266 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:28:20 -0300 Subject: [PATCH 15/27] add types again --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 7cdac25d446..c59b499a661 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", + "types": "dist/types/index.d.ts", "typesVersions": { ">=5.0": { "*": [ From b54909c51fffc4628634356338740c27a5cea995 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:47:40 -0300 Subject: [PATCH 16/27] readd test --- test/faker.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/faker.spec.ts b/test/faker.spec.ts index 536ea8e6c9b..749e850110d 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -13,11 +13,14 @@ describe('faker', () => { ); }); - it('should not log anything on startup', () => { + it('should not log anything on startup', async () => { const spies: MockInstance[] = keys(console) .filter((key) => typeof console[key] === 'function') .map((methodName) => vi.spyOn(console, methodName)); + const file: unknown = await import('..'); + expect(file).toBeDefined(); + new Faker({ locale: { metadata: { title: '' } } }); for (const spy of spies) { From 63cbb00cde1cff9e8b662596d793ec0857ca6404 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:49:34 -0300 Subject: [PATCH 17/27] Update faker.spec.ts --- test/faker.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/faker.spec.ts b/test/faker.spec.ts index 749e850110d..bf41ac07508 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -18,6 +18,7 @@ describe('faker', () => { .filter((key) => typeof console[key] === 'function') .map((methodName) => vi.spyOn(console, methodName)); + // @ts-ignore const file: unknown = await import('..'); expect(file).toBeDefined(); From 3a8cceafc2319b44e093db72c49f4c98fd43fe7c Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:51:19 -0300 Subject: [PATCH 18/27] Update faker.spec.ts --- test/faker.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/faker.spec.ts b/test/faker.spec.ts index bf41ac07508..1ff0c3943fd 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -20,7 +20,7 @@ describe('faker', () => { // @ts-ignore const file: unknown = await import('..'); - expect(file).toBeDefined(); + expect(file).toMatchInlineSnapshot(''); new Faker({ locale: { metadata: { title: '' } } }); From 44864680d207c05917f5cb8ab2c4eadbe6f6f1c3 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:52:24 -0300 Subject: [PATCH 19/27] Apply suggestions from code review Co-authored-by: Shinigami --- .github/workflows/playground.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 9bffb72f049..6322c147c10 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -42,8 +42,9 @@ jobs: - name: Check Playground run: | - sed -i -e "s/overrides-for-dev/overrides/g" package.json + sed -i -e "s/overrides-for-release/overrides/g" package.json cat package.json pnpm install --no-frozen-lockfile + pnpm -r --workspace-concurrency 1 build pnpm -r --workspace-concurrency 1 test working-directory: faker-playground From cb992d22d794e07016c53f48ba478a5652c7b029 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 15:58:35 -0300 Subject: [PATCH 20/27] Update faker.spec.ts --- test/faker.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/faker.spec.ts b/test/faker.spec.ts index 1ff0c3943fd..bf41ac07508 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -20,7 +20,7 @@ describe('faker', () => { // @ts-ignore const file: unknown = await import('..'); - expect(file).toMatchInlineSnapshot(''); + expect(file).toBeDefined(); new Faker({ locale: { metadata: { title: '' } } }); From 1931bf3643d8e16c9cc89ec69f2e943287a78027 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 16:03:04 -0300 Subject: [PATCH 21/27] Update test/faker.spec.ts Co-authored-by: Shinigami --- test/faker.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/faker.spec.ts b/test/faker.spec.ts index bf41ac07508..ca1dc2a6018 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -18,6 +18,7 @@ describe('faker', () => { .filter((key) => typeof console[key] === 'function') .map((methodName) => vi.spyOn(console, methodName)); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const file: unknown = await import('..'); expect(file).toBeDefined(); From cca4aa10ecee87a9e94c8f2784494ed16341ef48 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 16:19:51 -0300 Subject: [PATCH 22/27] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c59b499a661..b9a165e05e7 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", - "types": "dist/types/index.d.ts", + "types": "./dist/types/index.d.ts", "typesVersions": { ">=5.0": { "*": [ From 54446800acc0cffd393ad9bd115a5d2565c6d580 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 16:27:11 -0300 Subject: [PATCH 23/27] drop types. --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index b9a165e05e7..7cdac25d446 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", - "types": "./dist/types/index.d.ts", "typesVersions": { ">=5.0": { "*": [ From d522dd07918b1be183d67cafb567f67d1353c120 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 7 Sep 2024 16:29:08 -0300 Subject: [PATCH 24/27] Update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 7cdac25d446..b121afa084a 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", + "types": "index.d.ts", "typesVersions": { ">=5.0": { "*": [ From 97237d9e5f0f185668da6ed1e533ac39e2e48608 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Tue, 10 Sep 2024 08:47:10 -0300 Subject: [PATCH 25/27] polishing --- .github/workflows/playground.yml | 1 - test/faker.spec.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index 6322c147c10..ff8fb0b9eda 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -43,7 +43,6 @@ jobs: - name: Check Playground run: | sed -i -e "s/overrides-for-release/overrides/g" package.json - cat package.json pnpm install --no-frozen-lockfile pnpm -r --workspace-concurrency 1 build pnpm -r --workspace-concurrency 1 test diff --git a/test/faker.spec.ts b/test/faker.spec.ts index ca1dc2a6018..c76486cf1eb 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -19,7 +19,7 @@ describe('faker', () => { .map((methodName) => vi.spyOn(console, methodName)); // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore + // @ts-ignore package types depends on been built const file: unknown = await import('..'); expect(file).toBeDefined(); From 3984d218acb27ad78e35a730c47e99fe2b1f5227 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Tue, 10 Sep 2024 08:51:19 -0300 Subject: [PATCH 26/27] Rename playground.yml to check-pr.yml --- .github/workflows/{playground.yml => check-pr.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{playground.yml => check-pr.yml} (100%) diff --git a/.github/workflows/playground.yml b/.github/workflows/check-pr.yml similarity index 100% rename from .github/workflows/playground.yml rename to .github/workflows/check-pr.yml From 356e3ae35fdd041740ceee66dee36b070087e93b Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Tue, 10 Sep 2024 08:53:18 -0300 Subject: [PATCH 27/27] rename workflow name --- .github/workflows/check-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index ff8fb0b9eda..2be2dc9b332 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -1,4 +1,4 @@ -name: Playground +name: Check PR on: pull_request: