-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-add build.mjs and remove AlpineJS references (#125)
- Loading branch information
Showing
10 changed files
with
75 additions
and
62 deletions.
There are no files selected for viewing
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,42 @@ | ||
import * as esbuild from 'esbuild' | ||
import fs from 'fs' | ||
|
||
const debug = process.argv.includes('--debug') | ||
|
||
const context = await esbuild.context({ | ||
entryPoints: ['app/javascript/index.js'], | ||
external: ['@hotwired/turbo'], | ||
bundle: true, | ||
format: 'esm', | ||
logLevel: 'debug', | ||
metafile: true, | ||
minify: !debug, | ||
outfile: 'app/assets/builds/@turbo-boost/commands.js', | ||
sourcemap: true, | ||
target: ['chrome79', 'edge44', 'es2020', 'firefox71', 'opera65', 'safari13'] | ||
}) | ||
|
||
const watch = process.argv.includes('--watch') | ||
|
||
if (watch) { | ||
context.logLevel = 'verbose' | ||
await context.watch() | ||
} else { | ||
const result = await context.rebuild() | ||
const metafile = 'app/assets/builds/@turbo-boost/commands.metafile.json' | ||
|
||
fs.writeFile(metafile, JSON.stringify(result.metafile), ex => { | ||
if (ex) { | ||
console.error('Build failed!❗️') | ||
conosle.error(ex) | ||
} else { | ||
const message = [ | ||
'Build succeeded! 🚀', | ||
`|- Metafile saved to ... → ${metafile}`, | ||
'|- Analyze the bundle at → https://esbuild.github.io/analyze/' | ||
] | ||
console.log(message.join('\n')) | ||
} | ||
context.dispose() | ||
}) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,8 @@ | |
"author": "Nate Hopkins (hopsoft) <[email protected]>", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@alpinejs/morph": ">= 3.13.5", | ||
"@hotwired/turbo-rails": ">= 7.2.0", | ||
"@turbo-boost/streams": "^0.1.8", | ||
"alpinejs": ">= 3.13.5" | ||
"@turbo-boost/streams": "^0.1.10" | ||
}, | ||
"devDependencies": { | ||
"@tailwindcss/aspect-ratio": "^0.4.2", | ||
|
@@ -34,6 +32,7 @@ | |
"tailwindcss": "^3.4.1" | ||
}, | ||
"scripts": { | ||
"build": "esbuild app/javascript/index.js --bundle --minify --sourcemap --external:alpinejs --external:@alpinejs/morph --external:@hotwired/turbo-rails --external:@turbo-boost/streams --format=esm --target=es2020,chrome79,edge44,firefox71,opera65,safari13 --outfile=app/assets/builds/@turbo-boost/commands.js" | ||
"build": "node bin/build.mjs", | ||
"build:watch": "node bin/build.mjs --watch" | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.