Skip to content

Commit a55917d

Browse files
authored
Merge pull request #20 from react18-tools/rewrite
Rewrite
2 parents 6facf71 + 1332278 commit a55917d

File tree

225 files changed

+19060
-2243
lines changed

Some content is hidden

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

225 files changed

+19060
-2243
lines changed

.changeset/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
33
"changelog": "@changesets/cli/changelog",
44
"commit": false,
55
"fixed": [],
66
"linked": [],
77
"access": "restricted",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
10-
"ignore": []
10+
"ignore": ["@example/*"]
1111
}

.changeset/silver-books-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"esbuild-plugin-react18": patch
3+
---
4+
5+
Add ESM build and minify CJS build

.deepsource.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version = 1
2+
3+
test_patterns = ["**/.*test.*"]
4+
5+
exclude_patterns = [
6+
"docs/**",
7+
"**/.*test.*"
8+
]
9+
10+
[[analyzers]]
11+
name = "javascript"
12+
13+
[analyzers.meta]
14+
plugins = ["react"]
15+
environment = [
16+
"nodejs",
17+
"vitest",
18+
"browser"
19+
]
20+
21+
[[transformers]]
22+
name = "prettier"

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: [mayank1513] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [react18-tools, mayank1513] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
44
polar: mayank1513
55
patreon: # Replace with a single Patreon username
66
open_collective: # Replace with a single Open Collective username

.github/workflows/docs.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Update dependencies and Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 */8 * * *"
8+
jobs:
9+
generate-docs:
10+
if: github.event.repository.owner.login == 'react18-tools'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
registry-url: https://registry.npmjs.org
22+
node-version: 20
23+
- run: npm i -g pnpm@9.0.5 && pnpm i
24+
name: Install dependencies
25+
- name: Test
26+
run: npm test
27+
- run: git status && git clean -f -d && git status
28+
name: clean up working directory
29+
- run: npx @turbo/codemod update . && pnpm update --latest -r
30+
name: Update dependencies
31+
- run: pnpm build
32+
name: Build all apps to make sure it is not broken due to dependency upgrades
33+
- name: Run unit tests
34+
run: pnpm test
35+
- name: Generate/update docs
36+
run: pnpm doc
37+
- name: Setup Git
38+
run: |
39+
git config --global user.name "mayank1513"
40+
git config --global user.email "mayank.srmu@gmail.com"
41+
git fetch
42+
git checkout main
43+
git pull
44+
- name: Save upgraded packages back to repo
45+
run: git add . && git commit -m "upgrade deps && docs" && git push origin main
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Manually publish to NPM - Apply changeset in the workflow.
2+
3+
# publish only when package json has changed - assuming version upgrade
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
publish:
9+
if: github.event.repository.owner.login == 'react18-tools'
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
registry-url: https://registry.npmjs.org
24+
- run: npm i -g pnpm@9.0.5 && pnpm i
25+
name: Install dependencies
26+
# fail and not publish if any of the unit tests are failing
27+
- name: Test
28+
run: pnpm test
29+
- name: clean up working directory
30+
run: git status && git clean -f -d && git status
31+
- name: Setup Git
32+
run: |
33+
git config --global user.name "mayank1513"
34+
git config --global user.email "mayank.srmu@gmail.com"
35+
- name: Copy Readme file
36+
run: cp ../README.md . # todo: uncomment this line while rebranding
37+
- name: Apply changesets, publish and create release, branches and tags
38+
run: node ./scripts/manual-publish.js
39+
env:
40+
BRANCH: ${{ github.ref_name }}
41+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
43+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@ name: Publish to NPM
44
on:
55
push:
66
branches: [main]
7-
paths: "esbuild-plugin-react18/package.json"
7+
paths: "lib/package.json"
88

99
jobs:
1010
publish:
1111
# Don't run just after creating repo from template
1212
# Also avoid running after merging set-up PR
13-
if: github.run_number > 2
13+
if: github.run_number > 2 && github.event.repository.owner.login == 'react18-tools'
1414
runs-on: ubuntu-latest
1515
permissions:
16-
packages: write
1716
contents: write
1817
id-token: write
1918

20-
defaults:
21-
run:
22-
working-directory: ./esbuild-plugin-react18
23-
2419
steps:
2520
- uses: actions/checkout@v4
2621
with:
@@ -30,37 +25,22 @@ jobs:
3025
with:
3126
node-version: 20
3227
registry-url: https://registry.npmjs.org
33-
- run: npm i -g pnpm && pnpm i
28+
- run: npm i -g pnpm@9.0.5 && pnpm i
3429
name: Install dependencies
35-
- run: pnpm build --filter esbuild-plugin-react18-example
36-
name: build example app to run tests
37-
working-directory: .
3830
# fail and not publish if any of the unit tests are failing
3931
- name: Test
4032
run: pnpm test
41-
- name: Create release and Publish to NPM
42-
run: pnpm publish-package
43-
# continue on error to publish scoped package name <- by default repo is setup for a non-scoped + scoped package name
44-
continue-on-error: true
45-
env:
46-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
47-
TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
OWNER: ${{ github.event.repository.owner.login }}
49-
REPO: ${{ github.event.repository.name }}
50-
51-
- name: Publish Scoped package to NPM
52-
# continue on error - expecing npm to trow error if scoping is done twice
53-
continue-on-error: true
54-
id: publish_scoped
55-
run: cd dist && node ../scope.js && npm publish --provenance --access public
56-
env:
57-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
58-
TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
OWNER: ${{ github.event.repository.owner.login }}
60-
REPO: ${{ github.event.repository.name }}
61-
62-
- name: Mark scoped package as deprecated
33+
- name: Setup Git
6334
run: |
64-
npm deprecate @mayank1513/esbuild-plugin-react18 "Please use https://www.npmjs.com/package/esbuild-plugin-react18 instead. We initially created scoped packages to have similarities with the GitHub Public Repository (which requires packages to be scoped). We are no longer using GPR and thus deprecating all scoped packages for which corresponding un-scoped packages exist."
35+
git config --global user.name "mayank1513"
36+
git config --global user.email "mayank.srmu@gmail.com"
37+
- name: Copy Readme file
38+
run: cp ../README.md . # will be uncommented while rebranding
39+
- name: Apply changesets, publish and create release, branches and tags
40+
run: node ./scripts/publish.js
6541
env:
42+
BRANCH: ${{ github.ref_name }}
43+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
6644
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,31 @@ name: test
22

33
on:
44
push:
5-
branches: [main]
65
pull_request:
76
schedule:
8-
- cron: "0 */3 * * *"
9-
7+
- cron: "5 */8 * * *"
108
jobs:
119
test:
10+
if: github.run_number != 1
1211
runs-on: ubuntu-latest
1312
steps:
1413
- uses: actions/checkout@v4
1514
- uses: actions/setup-node@v4
1615
with:
1716
node-version: 20
18-
- run: npm i -g pnpm && pnpm i
17+
- run: npm i -g pnpm@9.0.5 && pnpm i
1918
name: Install dependencies
20-
- run: pnpm build --filter esbuild-plugin-react18-example
21-
name: build example app to run tests
2219
- name: Run unit tests
23-
run: pnpm test
20+
run: pnpm build --filter @repo/shared && pnpm test
2421
- name: Upload coverage reports to Codecov
25-
uses: codecov/codecov-action@v3
22+
continue-on-error: true
23+
uses: codecov/codecov-action@v4
2624
with:
27-
directory: ./esbuild-plugin-react18
25+
directory: ./lib
2826
token: ${{ secrets.CODECOV_TOKEN }}
29-
flags: esbuild-plugin-react18
30-
3127
- uses: paambaati/codeclimate-action@v5.0.0
3228
continue-on-error: true
3329
env:
3430
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
3531
with:
36-
coverageLocations: ./esbuild-plugin-react18/coverage/*.xml:clover
32+
coverageLocations: ./lib/coverage/*.xml:clover

.gitignore

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,17 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
1+
.DS_Store
42
node_modules
5-
.pnp
6-
.pnp.js
7-
8-
# testing
9-
coverage
10-
11-
# next.js
12-
.next/
13-
out/
3+
.turbo
4+
*.log
5+
.next
6+
dist
147
build
15-
16-
# misc
17-
.DS_Store
18-
*.pem
19-
20-
# debug
21-
npm-debug.log*
22-
yarn-debug.log*
23-
yarn-error.log*
24-
25-
# local env files
8+
dist-ssr
9+
*.local
2610
.env
27-
.env.local
28-
.env.development.local
29-
.env.test.local
30-
.env.production.local
31-
32-
# turbo
33-
.turbo
34-
35-
# vercel
36-
.vercel
11+
.cache
3712

38-
# lock files
39-
*lock*
13+
# test coverage
14+
coverage
4015

41-
# build files
42-
dist
43-
test-build
16+
# temporary files
17+
tsup.config.bundled*

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
# ignore hbs files as prettier removes all spaces and makes it ugly
44
*hbs
5+
docs
6+
.vscode

0 commit comments

Comments
 (0)