Skip to content

Commit

Permalink
feat: 🎸 init
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Jun 24, 2024
0 parents commit bad362d
Show file tree
Hide file tree
Showing 17 changed files with 5,609 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/metric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Metric and Commit Results

on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
workflow_dispatch: # Allows manual triggering of the workflow

jobs:
benchmark:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Pnpm
uses: pnpm/action-setup@v2
with:
version: 8.10.5

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify the Node.js version you need
cache: 'pnpm'

- name: Install dependencies
run: |
pnpm install -r
- name: Run benchmarks
run: |
pnpm build
node scripts/index.mjs # Replace with your script name
- name: Commit benchmark results
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add metric.json
git commit -m "Update benchmark results"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
test.*

packages/**/*-dist
.parcel-cache
10 changes: 10 additions & 0 deletions metric.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{"case":"basic","metric":"production build size","timestamp":1719159755626,"commit":"","unit":"byte","records":{"parcel":108014,"esbuild":56420,"rolldown":54640,"webpack":101987}}
{"case":"basic","metric":"production build size","timestamp":1719159759103,"commit":"","unit":"byte","records":{"parcel":108014,"esbuild":56420,"rolldown":54640,"webpack":101987}}
{"case":"basic","metric":"production build size","timestamp":1719159802052,"commit":"","unit":"byte","records":{"parcel":108014,"esbuild":56420,"rolldown":54640,"webpack":101987}}
{"case":"basic","metric":"production build size","timestamp":1719159817008,"commit":"","unit":"byte","records":{"parcel":108546,"esbuild":56675,"rolldown":54901,"webpack":102545}}
{"case":"basic","metric":"production build size","timestamp":1719163440149,"commit":"","unit":"byte","records":{"parcel":108546,"esbuild":56675,"rolldown":54901,"webpack":102545}}
{"case":"basic","metric":"production build size","timestamp":1719164457189,"commit":"","unit":"byte","records":{"parcel":108546,"esbuild":56675,"rolldown":54901,"webpack":102545}}
{"case":"basic","metric":"production build size","timestamp":1719164758794,"commit":"","unit":"byte","records":{"parcel":108546,"esbuild":56675,"rolldown":54901,"webpack":102545}}
{"case":"basic","metric":"production build size","timestamp":1719168038940,"commit":"","unit":"byte","records":{"parcel":108546,"esbuild":56675,"rolldown":54901,"webpack":102545}}
{"case":"basic","metric":"production build size","timestamp":1719168239360,"commit":"","unit":"byte","records":{"parcel":108546,"esbuild":56675,"rolldown":54901,"webpack":102545}}
{"case":"react-fluent-hydration","metric":"production build size","timestamp":1719168239360,"commit":"","unit":"byte","records":{"parcel":590683,"esbuild":1289079,"rolldown":1248111,"webpack":336271}}
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"devDependencies": {
"esbuild": "^0.21.5",
"glob": "^10.4.2",
"parcel": "^2.12.0",
"rolldown": "0.10.4-snapshot-0d15f0e-20240620002606",
"vite": "^5.3.1",
"webpack": "^5.92.1",
"webpack-cli": "^5.1.4"
},
"scripts": {
"build": "pnpm run -r build"
},
"packageManager": "[email protected]+sha1.4370a069f21873a0ad83c785b8048ed8caf6e6e9"
}
12 changes: 12 additions & 0 deletions packages/basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"scripts": {
"build:webpack": "webpack",
"build:esbuild": "esbuild src/index.js --bundle --outfile=esbuild-dist/index.js",
"build:parcel": "parcel build src/index.js --dist-dir parcel-dist --no-source-maps --no-cache --no-optimize",
"build:rolldown": "rolldown --config ./rolldown.config.mjs",
"build": "pnpm run /build:.*/"
},
"dependencies": {
"lodash-es": "^4.17.21"
}
}
14 changes: 14 additions & 0 deletions packages/basic/rolldown.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'rolldown'

export default defineConfig({
input: './src/index.js',
resolve: {
// This needs to be explicitly set for now because oxc resolver doesn't
// assume default exports conditions. Rolldown will ship with a default that
// aligns with Vite in the future.
conditionNames: ['import'],
},
output: {
dir: "rolldown-dist"
}
})
21 changes: 21 additions & 0 deletions packages/basic/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { groupBy, last } from "lodash-es";

const list = [
{
name: "jack",
age: 20
},
{
name: "a",
age: 30
},
{
name: "b",
age: 30
}
]

groupBy(list, (item) => {
last();
return item.age
})
15 changes: 15 additions & 0 deletions packages/basic/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const path = require('path')
/**@type {import("webpack").Configuration}*/
module.exports = {
mode: "production",
entry: {
"main": "./src/index.js"
},
optimization: {
minimize: false,
mangleExports: false
},
output: {
path: path.resolve(__dirname, "webpack-dist")
}
}
10 changes: 10 additions & 0 deletions packages/react-fluent-hydration/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>React Fluent</title>
</head>
<body>
<example-app></example-app>
<script type="module" src="react-fluent.js"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions packages/react-fluent-hydration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"scripts": {
"build:esbuild": "esbuild src/index.jsx --bundle --outfile=esbuild-dist/index.js",
"build:parcel": "parcel build src/index.jsx --dist-dir parcel-dist --no-source-maps --no-cache --no-optimize",
"build:rolldown": "rolldown --config ./rolldown.config.mjs",
"build:webpack": "webpack",
"build": "pnpm run /build:.*/"
},
"dependencies": {
"@fluentui/react-components": "^9.54.2",
"lodash-es": "^4.17.21",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@swc/core": "^1.6.5",
"swc-loader": "^0.2.6"
}
}
14 changes: 14 additions & 0 deletions packages/react-fluent-hydration/rolldown.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'rolldown'

export default defineConfig({
input: './src/index.jsx',
resolve: {
// This needs to be explicitly set for now because oxc resolver doesn't
// assume default exports conditions. Rolldown will ship with a default that
// aligns with Vite in the future.
conditionNames: ['import'],
},
output: {
dir: "rolldown-dist"
}
})
12 changes: 12 additions & 0 deletions packages/react-fluent-hydration/src/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import { hydrateRoot} from 'react-dom/client'
import { FluentProvider, teamsLightTheme, Button } from '@fluentui/react-components'

function ExampleApp() {
return <FluentProvider theme={teamsLightTheme}>
<Button>Fluent React</Button>
</FluentProvider>
}

const container = document.querySelector('example-app')
hydrateRoot(container, <ExampleApp />)
36 changes: 36 additions & 0 deletions packages/react-fluent-hydration/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const path = require("path");
/**@type {import("webpack").Configuration}*/
module.exports = {
mode: "production",
entry: {
main: "./src/index.jsx",
},
optimization: {
minimize: false,
mangleExports: false,
},
module: {
rules: [
{
test: /\.jsx$/,
exclude: /(node_modules|bower_components)/,
use: {
// Use `.swcrc` to configure swc
loader: "swc-loader",
options: {
// This makes swc-loader invoke swc synchronously.
sync: true,
jsc: {
parser: {
jsx: true
},
},
},
},
},
],
},
output: {
path: path.resolve(__dirname, "webpack-dist"),
},
};
Loading

0 comments on commit bad362d

Please sign in to comment.