Skip to content

Commit eea1186

Browse files
Merge pull request #354 from FormidableLabs/task/pnpm
Migrate codebase to pnpm + integrate prism react renderer 2
2 parents b0e2d5d + 45bd5ed commit eea1186

45 files changed

Lines changed: 19245 additions & 23737 deletions

Some content is hidden

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

.changeset/rude-laws-repair.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-live": minor
3+
---
4+
5+
Moved to a pnpm workspace, migrated to Prism React Renderer 2.

.eslintignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules/
2-
dist/
3-
demo/
2+
packages/react-live/dist/
3+
website/build/

.eslintrc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"root": true,
3-
"parser": "@babel/eslint-parser",
3+
"parser": "@typescript-eslint/parser",
44
"plugins": ["prettier", "@typescript-eslint"],
55
"settings": {
66
"react": {
@@ -11,7 +11,8 @@
1111
"eslint:recommended",
1212
"plugin:@typescript-eslint/recommended",
1313
"plugin:react/recommended",
14-
"plugin:import/recommended"
14+
"plugin:import/recommended",
15+
"plugin:import/typescript"
1516
],
1617
"env": {
1718
"browser": true,
@@ -54,18 +55,15 @@
5455
"react/no-find-dom-node": "off",
5556
"no-invalid-this": "off",
5657
"complexity": "off",
57-
"no-unused-vars": [
58-
"error",
59-
{
60-
"argsIgnorePattern": "^_+$"
61-
}
62-
],
58+
"no-unused-vars": 0,
6359
"import/no-unresolved": [2, { "ignore": ["polished", "next/document"] }],
6460
"prefer-template": "off",
6561
"filenames/match-regex": "off",
6662
"react/react-in-jsx-scope": "off",
6763
"max-params": ["error", 5],
6864
"max-nested-callbacks": ["error", 5],
69-
"prettier/prettier": "error"
65+
"prettier/prettier": "error",
66+
"@typescript-eslint/no-unused-vars": ["error"],
67+
"@typescript-eslint/no-var-requires": 0
7068
}
7169
}

.github/workflows/code-check.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,36 @@ jobs:
1212
build:
1313
name: Check codebase (lint and typecheck)
1414
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
node-version: [ 18.x ]
1518
steps:
1619
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v3
20+
- uses: actions/setup-node@v2
1821
with:
19-
node-version: 18
20-
cache: 'yarn'
22+
node-version: ${{ matrix.node-version }}
2123

22-
- name: Installation
23-
run: yarn --frozen-lockfile
24+
- uses: pnpm/action-setup@v2.2.2
25+
with:
26+
version: 7
2427

25-
- name: Lint
26-
run: yarn lint
28+
- name: Get pnpm store directory
29+
id: pnpm-cache
30+
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
2731

28-
- name: Test
29-
run: yarn run test
32+
- name: Setup pnpm cache
33+
uses: actions/cache@v3
34+
with:
35+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
36+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('./pnpm-lock.yaml') }}
37+
restore-keys: |
38+
${{ runner.os }}-pnpm-store-
3039
31-
- name: Type Check
32-
run: yarn run typecheck
40+
- name: Install dependencies
41+
run: pnpm install
3342

34-
- name: Library Build
35-
run: yarn run build
43+
- name: Check Code ${{ matrix.node-version }}
44+
run: pnpm lint
3645

37-
- name: Storybook Build
38-
run: yarn run storybook:build
46+
- name: Build ${{ matrix.node-version }}
47+
run: pnpm build

.github/workflows/deploy-docs.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,32 @@ jobs:
2020
- uses: actions/checkout@v2
2121
- uses: actions/setup-node@v3
2222
with:
23-
node-version: 16
24-
cache: 'yarn'
23+
node-version: 18
2524

2625
- name: AWS CLI version
2726
run: "aws --version"
2827

28+
- uses: pnpm/action-setup@v2
29+
with:
30+
version: 8.2.0
31+
32+
- name: Get pnpm store directory
33+
id: pnpm-cache
34+
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
35+
36+
- name: Setup pnpm cache
37+
uses: actions/cache@v3
38+
with:
39+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
40+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
41+
restore-keys: |
42+
${{ runner.os }}-pnpm-store-
43+
2944
- name: Install Dependencies
30-
run: yarn install --frozen-lockfile
31-
working-directory: ./website
45+
run: pnpm install
3246

3347
- name: Build the website
34-
run: yarn build
48+
run: pnpm build
3549
working-directory: ./website
3650

3751
# Use `gh` tool to infer more information about the pull request.
@@ -46,7 +60,7 @@ jobs:
4660

4761
- name: Deploy docs (production)
4862
if: github.ref == 'refs/heads/master'
49-
run: yarn deploy:prod
63+
run: pnpm run deploy:prod
5064
working-directory: ./website
5165
env:
5266
GITHUB_DEPLOYMENT_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,38 @@ jobs:
2222
- uses: actions/setup-node@v3
2323
with:
2424
node-version: 18
25-
cache: "yarn"
25+
26+
- uses: pnpm/action-setup@v2.2.2
27+
with:
28+
version: 7
29+
30+
- name: Get pnpm store directory
31+
id: pnpm-cache
32+
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
33+
34+
- name: Setup pnpm cache
35+
uses: actions/cache@v3
36+
with:
37+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
38+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39+
restore-keys: |
40+
${{ runner.os }}-pnpm-store-
2641
2742
- name: Install dependencies
28-
run: yarn install --frozen-lockfile
43+
run: pnpm install
2944

3045
- name: Build packages
31-
run: yarn run build
46+
run: pnpm run build
3247

3348
- name: PR or Publish
3449
id: changesets
3550
uses: changesets/action@v1
3651
with:
37-
version: yarn run version
38-
publish: yarn changeset publish
52+
# Note: Our `package.json:scripts.version` currently doesn't have `--fix-lockfile` for
53+
# `pnpm install` because of a PNPM bug of some kind.
54+
# https://github.com/FormidableLabs/spectacle/issues/1156
55+
version: pnpm run version
56+
publish: pnpm changeset publish
3957
env:
4058
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4159
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ bundle-stats.html
1010
.history/
1111
stats.html
1212
/.idea
13+
/packages/react-live/LICENSE
14+
/packages/react-live/README.md

CONTRIBUTING.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Thanks for contributing!
88
yarn install
99
```
1010

11-
You will find all building blocks that make up React Live in the [`src`](src) folder and examples in the [`demo`](demo) folder.
11+
You will find all building blocks that make up React Live in the [`src`](packages/react-live/src) folder and examples in the [`demo`](demo) folder.
1212

1313
### Testing
1414

package.json

Lines changed: 12 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,35 @@
11
{
2-
"name": "react-live",
3-
"version": "4.0.1",
4-
"description": "A production-focused playground for live editing React code",
2+
"name": "react-live-workspace",
3+
"private": "true",
54
"main": "dist/react-live.cjs.js",
65
"types": "dist/index.d.ts",
76
"jsnext:main": "dist/react-live.es.js",
87
"module": "dist/react-live.es.js",
98
"license": "MIT",
109
"scripts": {
11-
"storybook": "start-storybook -p 9001",
12-
"storybook:build": "build-storybook -o .out",
13-
"prebuild:lib": "rm -rf lib/*",
14-
"prebuild": "yarn lint",
15-
"build": "rollup -c",
16-
"prepublishOnly": "npm run build",
17-
"test": "jest",
18-
"test:typings": "typings-tester --dir typings",
19-
"typecheck": "tsc --noEmit",
20-
"lint": "eslint --config .eslintrc \"./src/**/*.js\"",
21-
"install:docs": "yarn --cwd website install",
22-
"start:docs": "yarn --cwd website start",
23-
"build:docs": "yarn --cwd website build",
24-
"format:docs": "prettier --write docs",
10+
"start:docs": "pnpm run --filter website start",
11+
"build": "pnpm run -r build",
12+
"build:lib": "pnpm run --filter react-live build",
13+
"lint": "pnpm run --parallel lint",
14+
"lint:fix": "pnpm run --parallel lint --fix",
2515
"changeset": "changeset",
26-
"version": "yarn changeset version"
16+
"version": "pnpm changeset version && pnpm install --no-frozen-lockfile"
2717
},
2818
"dependencies": {
29-
"prism-react-renderer": "^1.3.1",
30-
"sucrase": "^3.31.0",
31-
"use-editable": "^2.3.3"
19+
"prism-react-renderer": "^2.0.3"
3220
},
3321
"devDependencies": {
34-
"@babel/core": "^7.15.0",
3522
"@babel/eslint-parser": "^7.15.0",
36-
"@babel/plugin-proposal-class-properties": "^7.14.5",
37-
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
38-
"@babel/plugin-transform-runtime": "^7.15.0",
39-
"@babel/preset-env": "^7.15.0",
40-
"@babel/preset-react": "^7.14.5",
41-
"@babel/preset-typescript": "^7.21.0",
4223
"@changesets/cli": "^2.26.1",
43-
"@rollup/plugin-babel": "^5.3.0",
44-
"@rollup/plugin-commonjs": "^20.0.0",
45-
"@rollup/plugin-node-resolve": "^13.0.4",
46-
"@rollup/plugin-replace": "^3.0.0",
47-
"@rollup/plugin-typescript": "^11.0.0",
48-
"@storybook/addon-controls": "^6.4.13",
49-
"@storybook/builder-webpack5": "^6.5.16",
50-
"@storybook/manager-webpack5": "^6.5.16",
51-
"@storybook/react": "^6.4.13",
5224
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
53-
"@types/prismjs": "^1.26.0",
54-
"@types/react": "^18.0.31",
55-
"@types/styled-components": "^5.1.26",
5625
"@typescript-eslint/eslint-plugin": "^5.57.0",
5726
"@typescript-eslint/parser": "^5.57.0",
58-
"babel-jest": "^27.0.6",
59-
"babel-loader": "^8.2.2",
60-
"babel-plugin-add-module-exports": "^1.0.4",
61-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
27+
"babel-eslint": "^10.1.0",
6228
"eslint": "^8.7.0",
6329
"eslint-plugin-filenames": "^1.3.2",
6430
"eslint-plugin-import": "^2.25.4",
6531
"eslint-plugin-prettier": "^4.0.0",
6632
"eslint-plugin-react": "^7.28.0",
67-
"jest": "^27.0.6",
68-
"prettier": "^2.5.1",
69-
"prismjs": "^1.26.0",
70-
"prop-types": "^15.7.2",
71-
"react": "^18.2.0",
72-
"react-docgen-typescript": "^2.2.2",
73-
"react-dom": "^18.2.0",
74-
"react-test-renderer": "^17.0.2",
75-
"rollup": "^2.55.1",
76-
"rollup-plugin-filesize": "^9.1.1",
77-
"rollup-plugin-terser": "^7.0.2",
78-
"rollup-plugin-visualizer": "^5.5.4",
79-
"styled-components": "^4.0.0-beta.8",
80-
"typescript": "^4.9",
81-
"typings-tester": "^0.3.1",
82-
"webpack": "^5.76.3"
83-
},
84-
"publishConfig": {
85-
"provenance": true
86-
},
87-
"files": [
88-
"src",
89-
"lib",
90-
"dist",
91-
"react-live.css",
92-
"typings/react-live.d.ts"
93-
],
94-
"author": "@FormidableLabs",
95-
"bugs": {
96-
"url": "https://github.com/philpl/react-live/issues"
97-
},
98-
"repository": {
99-
"type": "git",
100-
"url": "https://github.com/FormidableLabs/react-live"
101-
},
102-
"engines": {
103-
"npm": ">= 2.0.0",
104-
"node": ">= 0.12.0"
105-
},
106-
"keywords": [
107-
"react",
108-
"live",
109-
"live edit",
110-
"component playground",
111-
"react live"
112-
],
113-
"jest": {
114-
"testEnvironment": "jsdom",
115-
"resetMocks": true,
116-
"rootDir": "./src",
117-
"testURL": "http://localhost/"
118-
},
119-
"sideEffects": false
33+
"prettier": "^2.5.1"
34+
}
12035
}
File renamed without changes.

0 commit comments

Comments
 (0)