-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d33c80
commit 6cf46a4
Showing
16 changed files
with
1,012 additions
and
1,873 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import esbuild from 'esbuild'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import { execSync } from 'child_process'; | ||
|
||
const outputPath = path.resolve('dist'); | ||
const archivePath = path.join(outputPath, 'bundle.zip'); | ||
|
||
fs.mkdirSync(outputPath, { recursive: true }); | ||
|
||
fs.writeFileSync( | ||
path.join(outputPath, 'index.html'), | ||
`<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
</head> | ||
<body> | ||
<script src="/index.js"></script> | ||
</body> | ||
</html>` | ||
); | ||
|
||
const zipPlugin = { | ||
name: 'zip', | ||
|
||
setup(build) { | ||
build.onEnd(() => { | ||
fs.rmSync(archivePath, { force: true }); | ||
|
||
execSync(`zip -r ${archivePath} .`, { cwd: outputPath }); | ||
}); | ||
}, | ||
}; | ||
|
||
const ctx = await esbuild.context({ | ||
entryPoints: ['./src/index.tsx'], | ||
bundle: true, | ||
outdir: outputPath, | ||
plugins: [zipPlugin], | ||
}); | ||
|
||
if (!process.argv.includes('--watch')) { | ||
await ctx.rebuild(); | ||
process.exit(); | ||
} | ||
|
||
await ctx.watch(); | ||
|
||
await ctx.serve({ | ||
port: 10001, | ||
servedir: outputPath, | ||
}); | ||
|
||
console.log(`Serving on http://localhost:10001`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
{ | ||
"label": "esbuild", | ||
"command": "node", | ||
"args": [ | ||
"esbuild.config.mjs", | ||
"--watch" | ||
] | ||
}, | ||
{ | ||
"command": "tsc", | ||
"args": [ | ||
"--watch", | ||
"--preserveWatchOutput", | ||
"--pretty" | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,25 @@ | ||
{ | ||
"name": "example", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "rollup --config rollup.config.js", | ||
"watch": "rollup --config rollup.config.js --watch", | ||
"clean": "rimraf dist", | ||
"test": "exit 0" | ||
"build": "tsc && node esbuild.config.mjs", | ||
"watch": "jointly", | ||
"clean": "rimraf dist" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-html": "^1.0.3", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-replace": "^5.0.5", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@types/react": "^18.2.79", | ||
"@types/react-dom": "^18.2.25", | ||
"rollup": "4.11.0", | ||
"rollup-plugin-copy": "^3.5.0", | ||
"rollup-plugin-livereload": "^2.0.5", | ||
"rollup-plugin-serve": "^2.0.3", | ||
"rollup-plugin-zip": "^1.0.3", | ||
"tslib": "^2.6.2", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"esbuild": "^0.21.5", | ||
"jointly": "^0.0.2", | ||
"tslib": "^2.6.3", | ||
"typescript": "^5.4.5" | ||
}, | ||
"dependencies": { | ||
"@racehorse/react": "^1.2.0", | ||
"abortcontroller-polyfill": "^1.7.5", | ||
"racehorse": "^1.6.3", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters