aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-02-23 08:41:10 -0500
committerGravatar GitHub <noreply@github.com> 2022-02-23 08:41:10 -0500
commit2ad88a9235ea2cb92e0b628c40e375ebe7095176 (patch)
tree5e652bbde478e86565cecbbbdf25e02a4550ba27 /scripts
parenta81660e39a4e6873693e0e7d787350ae08bbd370 (diff)
downloadastro-2ad88a9235ea2cb92e0b628c40e375ebe7095176.tar.gz
astro-2ad88a9235ea2cb92e0b628c40e375ebe7095176.tar.zst
astro-2ad88a9235ea2cb92e0b628c40e375ebe7095176.zip
Run all smoke tests with the static build (#2609)
* Run all smoke tests with the static build * Use a direct relative path * Always use the static build * Use a path that works in both static and regualr build * Always download the zip * astro.build only needs to run once
Diffstat (limited to 'scripts')
-rw-r--r--scripts/smoke/index.js56
1 files changed, 31 insertions, 25 deletions
diff --git a/scripts/smoke/index.js b/scripts/smoke/index.js
index bc81d70c0..e375bcf6a 100644
--- a/scripts/smoke/index.js
+++ b/scripts/smoke/index.js
@@ -58,6 +58,20 @@ async function run() {
process.exit(1);
}
+ // Run with the static build too
+ if(directory.pathname.includes('astro.build')) {
+ // astro.build uses the static build, so rerunning with the flag actually negates it.
+ continue;
+ }
+
+ try {
+ await execa('yarn', ['build', '--', '--experimental-static-build'], { cwd: fileURLToPath(directory), stdout: 'inherit', stderr: 'inherit' });
+ } catch (err) {
+ console.log(err);
+
+ process.exit(1);
+ }
+
console.log();
}
}
@@ -79,42 +93,34 @@ const downloadGithubZip = async (/** @type {GithubOpts} */ opts) => {
/** Expected directory when the zip is downloaded. */
const githubDir = new URL(`${opts.name}-${opts.branch}`, scriptDir);
- /** Whether the expected directory is already available */
- const hasGithubDir = await fs.stat(githubDir).then(
- (stats) => stats.isDirectory(),
- () => false
- );
+ console.log('🤖', 'Downloading', `${opts.org}/${opts.name}#${opts.branch}`);
- if (!hasGithubDir) {
- console.log('🤖', 'Downloading', `${opts.org}/${opts.name}#${opts.branch}`);
+ const buffer = await fetchGithubZip(opts);
- const buffer = await fetchGithubZip(opts);
+ console.log('🤖', 'Extracting', `${opts.org}/${opts.name}#${opts.branch}`);
- console.log('🤖', 'Extracting', `${opts.org}/${opts.name}#${opts.branch}`);
+ new Zip(buffer).extractAllTo(fileURLToPath(scriptDir), true);
- new Zip(buffer).extractAllTo(fileURLToPath(scriptDir), true);
+ console.log('🤖', 'Preparing', `${opts.org}/${opts.name}#${opts.branch}`);
- console.log('🤖', 'Preparing', `${opts.org}/${opts.name}#${opts.branch}`);
+ const astroPackage = await readDirectoryPackage(astroDir);
- const astroPackage = await readDirectoryPackage(astroDir);
+ const githubPackage = await readDirectoryPackage(githubDir);
- const githubPackage = await readDirectoryPackage(githubDir);
-
- if ('astro' in Object(githubPackage.dependencies)) {
- githubPackage.dependencies['astro'] = astroPackage.version;
- }
-
- if ('astro' in Object(githubPackage.devDependencies)) {
- githubPackage.devDependencies['astro'] = astroPackage.version;
- }
+ if ('astro' in Object(githubPackage.dependencies)) {
+ githubPackage.dependencies['astro'] = astroPackage.version;
+ }
- if ('astro' in Object(githubPackage.peerDependencies)) {
- githubPackage.peerDependencies['astro'] = astroPackage.version;
- }
+ if ('astro' in Object(githubPackage.devDependencies)) {
+ githubPackage.devDependencies['astro'] = astroPackage.version;
+ }
- await writeDirectoryPackage(githubDir, githubPackage);
+ if ('astro' in Object(githubPackage.peerDependencies)) {
+ githubPackage.peerDependencies['astro'] = astroPackage.version;
}
+ await writeDirectoryPackage(githubDir, githubPackage);
+
return githubDir;
};