Skip to content

Commit 13ec766

Browse files
authored
chore: workspace migration (#1991)
1 parent caf2193 commit 13ec766

File tree

438 files changed

+2598
-1831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

438 files changed

+2598
-1831
lines changed

.eslintrc.js

Lines changed: 5 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*eslint-env node */
22

3+
// https://eslint.org/docs/v8.x/use/configure/configuration-files
4+
35
const rules = {
46
'prettier/prettier': 'error',
57
'prefer-spread': 'off',
@@ -33,6 +35,7 @@ const extend = [
3335
]
3436

3537
module.exports = {
38+
root: true,
3639
env: {
3740
browser: true,
3841
es6: true,
@@ -47,7 +50,7 @@ module.exports = {
4750
parserOptions: {
4851
ecmaVersion: 2018,
4952
sourceType: 'module',
50-
project: './tsconfig.json',
53+
project: null,
5154
},
5255
plugins: [
5356
'prettier',
@@ -59,57 +62,18 @@ module.exports = {
5962
],
6063
extends: extend,
6164
rules,
62-
settings: {
63-
react: {
64-
version: '17.0',
65-
},
66-
'import/resolver': {
67-
node: {
68-
paths: ['eslint-rules'], // Add the directory containing your custom rules
69-
extensions: ['.js', '.jsx', '.ts', '.tsx'], // Ensure ESLint resolves both JS and TS files
70-
},
71-
},
72-
},
7365
overrides: [
74-
{
75-
files: 'src/**/*',
76-
rules: {
77-
...rules,
78-
'no-restricted-globals': ['error', 'document', 'window'],
79-
},
80-
},
81-
{
82-
files: 'src/__tests__/**/*',
83-
// the same set of config as in the root
84-
// but excluding the 'plugin:compat/recommended' rule
85-
// we don't mind using the latest features in our tests
86-
extends: extend.filter((s) => s !== 'plugin:compat/recommended'),
87-
rules: {
88-
...rules,
89-
'no-console': 'off',
90-
'no-restricted-globals': 'off',
91-
'compat/compat': 'off',
92-
},
93-
parserOptions: {
94-
project: './src/__tests__/tsconfig.json',
95-
},
96-
},
9766
{
9867
files: ['**/*.js'],
9968
parserOptions: {
10069
project: null, // <- prevents the TS parser from trying to parse it with type info
10170
},
10271
rules: {
103-
...rules,
10472
'@typescript-eslint/naming-convention': 'off',
10573
},
10674
},
10775
{
108-
files: 'react/src/**/',
109-
extends: [...extend, 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
110-
},
111-
{
112-
files: 'eslint-rules/**/*',
76+
files: 'eslint-rules/**/*.js',
11377
extends: ['eslint:recommended', 'prettier'],
11478
rules: {
11579
'prettier/prettier': 'error',
@@ -122,52 +86,5 @@ module.exports = {
12286
node: true,
12387
},
12488
},
125-
{
126-
files: 'cypress/**/*',
127-
globals: {
128-
cy: true,
129-
Cypress: true,
130-
},
131-
},
132-
{
133-
files: 'testcafe/**/*',
134-
globals: {
135-
__dirname: true,
136-
},
137-
},
138-
{
139-
files: ['playwright/**/*.ts'],
140-
rules: {
141-
'posthog-js/no-direct-array-check': 'off',
142-
'posthog-js/no-direct-undefined-check': 'off',
143-
'posthog-js/no-direct-null-check': 'off',
144-
'@typescript-eslint/naming-convention': 'off',
145-
},
146-
parserOptions: {
147-
project: null,
148-
},
149-
},
150-
{
151-
files: ['react/**/*.ts'],
152-
rules: {
153-
'posthog-js/no-direct-null-check': 'off',
154-
},
155-
},
156-
{
157-
files: ['playground/**/*'],
158-
rules: {
159-
'no-console': 'off',
160-
'@typescript-eslint/no-require-imports': 'off',
161-
'no-undef': 'off',
162-
},
163-
env: {
164-
node: true,
165-
},
166-
parserOptions: {
167-
project: null,
168-
},
169-
},
17089
],
171-
root: true,
172-
ignorePatterns: ['playground/error-tracking/**/*'],
17390
}

.github/actions/setup/action.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Setup Workspace Environment"
2+
description: "Sets up a Node.js environment and installs dependencies"
3+
4+
inputs:
5+
node_version:
6+
description: "Node.js version to use"
7+
required: false
8+
default: "18"
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Install pnpm
14+
uses: pnpm/action-setup@v4
15+
16+
- name: Get pnpm cache directory path
17+
id: pnpm-cache-dir
18+
shell: bash
19+
run: echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ inputs.node_version }}
25+
registry-url: https://registry.npmjs.org
26+
cache: "pnpm"
27+
28+
- uses: actions/cache@v4
29+
id: pnpm-cache
30+
with:
31+
path: ${{ steps.pnpm-cache-dir.outputs.PNPM_STORE_PATH }}
32+
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
33+
restore-keys: ${{ runner.os }}-pnpm-
34+
35+
- name: Install package.json dependencies with pnpm
36+
shell: bash
37+
run: pnpm install --frozen-lockfile

.github/workflows/bundled-size.yaml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,29 @@ jobs:
77
runs-on: ubuntu-22.04
88

99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111

12-
- name: Install pnpm
13-
uses: pnpm/action-setup@v4
14-
15-
- name: Get pnpm cache directory path
16-
id: pnpm-cache-dir
17-
run: echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
18-
19-
- uses: actions/cache@v4
20-
id: pnpm-cache
21-
with:
22-
path: ${{ steps.pnpm-cache-dir.outputs.PNPM_STORE_PATH }}
23-
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
24-
restore-keys: ${{ runner.os }}-pnpm-
25-
26-
- name: Install package.json dependencies with pnpm
27-
run: pnpm install --frozen-lockfile
12+
- uses: ./.github/actions/setup
2813

2914
- name: Build library
3015
run: pnpm build-rollup
16+
working-directory: packages/browser
3117

3218
- name: Upload bundle size visualization
3319
uses: actions/upload-artifact@v4
3420
id: viz-upload
3521
with:
3622
name: bundle-stats-array.html
37-
path: bundle-stats-array.html
23+
path: packages/browser/bundle-stats-array.html
24+
3825
- name: Find artifact link comment if it exists
3926
uses: peter-evans/find-comment@v3
4027
id: fc
4128
with:
4229
issue-number: ${{ github.event.pull_request.number }}
43-
comment-author: 'github-actions[bot]'
30+
comment-author: "github-actions[bot]"
4431
body-includes: Download bundle size visualization
32+
4533
- name: Create or update artifact link comment
4634
uses: peter-evans/create-or-update-comment@v4
4735
with:

0 commit comments

Comments
 (0)