From 4699dc00c1856532a1d2260a7b28e616fe5397a5 Mon Sep 17 00:00:00 2001 From: Josh Black Date: Tue, 19 Jan 2021 10:31:30 -0600 Subject: [PATCH] chore(examples): update grid example for deploy (#7577) * chore(examples): debug example script * chore(examples): debug example script * chore(examples): debug example script * chore(examples): update to fail on subprocess exit code 1 Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/grid/examples/preview/package.json | 2 +- tasks/examples.js | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/grid/examples/preview/package.json b/packages/grid/examples/preview/package.json index 0943da3febbf..d8c2c791e094 100644 --- a/packages/grid/examples/preview/package.json +++ b/packages/grid/examples/preview/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "license": "Apache-2.0", "scripts": { - "build": "export PATH_PREFIX=\"/grid/examples/preview\" && parcel build -d build --public-url $PATH_PREFIX index.html", + "build": "parcel build -d build --public-url \"/grid/examples/preview\" index.html", "develop": "parcel index.html --no-cache" }, "devDependencies": { diff --git a/tasks/examples.js b/tasks/examples.js index 143a502f3e67..d3b6239bc935 100644 --- a/tasks/examples.js +++ b/tasks/examples.js @@ -29,6 +29,7 @@ const IGNORE_EXAMPLE_DIRS = new Set([ 'styled-components', 'vue-cli', 'storybook', + 'sass-modules', ]); /** @@ -91,7 +92,7 @@ async function main() { packagesWithExamples.map(async (pkg) => { reporter.info(`Building examples in package \`${pkg.name}\``); - const { examples, filepath, name } = pkg; + const { examples, name } = pkg; const packageDir = path.join(BUILD_DIR, name, 'examples'); await fs.ensureDir(packageDir); @@ -110,14 +111,25 @@ async function main() { await fs.ensureDir(exampleDir); if (packageJson.scripts.build) { - spawn.sync('yarn', ['install'], { + const installResult = spawn.sync('yarn', ['install'], { stdio: 'ignore', cwd: example.filepath, }); - spawn.sync('yarn', ['build'], { + if (installResult.status !== 0) { + throw new Error( + `Error installing dependencies for ${pkg.name}:${example.name}` + ); + } + + const buildResult = spawn.sync('yarn', ['build'], { stdio: 'ignore', cwd: example.filepath, }); + if (buildResult.status !== 0) { + throw new Error( + `Error building example ${example.name} for ${pkg.name}` + ); + } } if (await fs.pathExists(exampleBuildDir)) { @@ -126,7 +138,7 @@ async function main() { } await fs.copy(example.filepath, exampleDir, { - filter(src, dest) { + filter(src) { const relativePath = path.relative(example.filepath, src); if (relativePath.includes('node_modules')) { return false;