Skip to content

Commit

Permalink
refactor: build test suite (#1670)
Browse files Browse the repository at this point in the history
Co-authored-by: Leah <github.leah@hrmny.sh>
  • Loading branch information
rschristian and ForsakenHarmony committed Apr 15, 2022
1 parent 0346549 commit 7afd8bb
Show file tree
Hide file tree
Showing 50 changed files with 522 additions and 223 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-chefs-yell.md
@@ -0,0 +1,5 @@
---
'preact-cli': patch
---

Corrects 'build --json' ouput location and 'apple-touch-icon' will respect the publicPath automatically
2 changes: 1 addition & 1 deletion packages/cli/lib/commands/build.js
Expand Up @@ -107,7 +107,7 @@ async function command(src, argv) {
let stats = await runWebpack(argv, false);

if (argv.json) {
await runWebpack.writeJsonStats(stats);
await runWebpack.writeJsonStats(cwd, stats);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/lib/webpack/run-webpack.js
Expand Up @@ -122,8 +122,8 @@ function showStats(stats, isProd) {
return stats;
}

function writeJsonStats(stats) {
let outputPath = resolve(process.cwd(), 'stats.json');
function writeJsonStats(cwd, stats) {
let outputPath = resolve(cwd, 'stats.json');
let jsonStats = stats.toJson({
json: true,
chunkModules: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/resources/template.html
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="/assets/icons/apple-touch-icon.png">
<link rel="apple-touch-icon" href="<%= htmlWebpackPlugin.files.publicPath %>assets/icons/apple-touch-icon.png">
<% preact.headEnd %>
</head>
<body>
Expand Down

0 comments on commit 7afd8bb

Please sign in to comment.