From 893953f4d5fba2485d8dde51a48a9e350fd98a69 Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Tue, 2 Mar 2021 15:33:36 +0000 Subject: [PATCH 01/11] Port test-tutorial script to JS --- .eslintrc.js | 1 + tasks/test-tutorial | 60 +----------------------- tasks/test-tutorial.js | 101 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 59 deletions(-) create mode 100644 tasks/test-tutorial.js diff --git a/.eslintrc.js b/.eslintrc.js index c032631bed11..98ed1654543f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -97,6 +97,7 @@ module.exports = { 'packages/testing/src/**', 'packages/eslint-config/*.js', 'packages/eslint-plugin-redwood/src/**', + 'tasks/**', ], env: { es6: true, diff --git a/tasks/test-tutorial b/tasks/test-tutorial index 8a3a7c6d6687..c6ba217af405 100755 --- a/tasks/test-tutorial +++ b/tasks/test-tutorial @@ -1,60 +1,2 @@ #!/bin/bash -set -e - -realpath() { - path=`eval echo "$1"` - folder=$(dirname "$path") - echo $(cd "$folder"; pwd)/$(basename "$path"); -} - -SCRIPT=`realpath $0` -SCRIPTPATH=`dirname $SCRIPT` - -# Install the dependencies required to run the e2e tests. -cd "$SCRIPTPATH/e2e" -yarn install - -if [ -z "$1" ] - then - echo "You have not supplied a path to a RedwoodJS project." - echo "We will create one for you." - echo "We will copy './packages/create-redwood-app/template' and the packages/*" - TMP_DIR=$(mktemp -d -t redwood) -else - echo "You have supplied a path $1, we will not create a new " - echo "Redwood project, we will use the app you have specified." - TMP_DIR=$1 -fi - -if [[ -z "$1" || "$CREATE_RWJS_PROJECT" == "1" ]] - then - echo "Creating new RedwoodJS Project..." - cd ../../packages/create-redwood-app - yarn babel-node src/create-redwood-app.js $TMP_DIR --no-yarn-install -fi - -if [[ -z "$1" || "$CREATE_RWJS_PROJECT" == "1" ]] - then - cd "$SCRIPTPATH/../" - # build all the packages, but not the TypeScript - # since it is slow and we do not need it. - yarn build:clean && yarn lerna run build:js -fi - -cd $TMP_DIR - -if [[ -z "$1" || "$CREATE_RWJS_PROJECT" == "1" ]]; - then - echo "Linking packages from $SCRIPTPATH" - # make the e2e tests use the packages from this Redwood Framework Repo. - ln -s "$SCRIPTPATH/../packages" -fi - -yarn install - -if [ -z "$CI" ] - then - yarn rw dev --fwd="--open=false" & cd "$SCRIPTPATH/e2e"; yarn cypress open --env RW_PATH=$TMP_DIR - else - echo "CI env-var set skipping Cypress run." -fi +yarn babel-node tasks/test-tutorial.js $1 diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js new file mode 100644 index 000000000000..1a913c9c3b55 --- /dev/null +++ b/tasks/test-tutorial.js @@ -0,0 +1,101 @@ +import fs from 'fs' +import os from 'os' +import path from 'path' + +import execa from 'execa' + +const testTutorial = async () => { + // First two args are "node" and path to script + const [, , pathToProject] = process.argv + + let projectPath = pathToProject + const frameworkPath = path.join(__dirname, '..') + const e2ePath = path.join(frameworkPath, 'tasks/e2e') + + if (process.env.DEBUG) { + console.log(`📁 ~ file: test-tutorial.js ~ projectPath`, projectPath) + console.log(`🌲 ~ file: test-tutorial.js ~ frameworkPath`, frameworkPath) + console.log(`🚀 ~ file: test-tutorial.js ~ e2ePath`, e2ePath) + } + + await execa('yarn install', { + cwd: e2ePath, + shell: true, + stdio: 'inherit', + }) + + if (pathToProject) { + console.log( + `\n 🗂ī¸ You have supplied a path ${projectPath}, we will not create a new ` + ) + console.log('Redwood project, we will use the app you have specified.') + } else { + console.log('\n ℹī¸ You have not supplied a path to a Redwood project.') + console.log('We will create one for you. \n \n') + console.log( + "📋 We will copy './packages/create-redwood-app/template' and link packages/* \n" + ) + + // Use temporary project path, because no user supplied one + projectPath = fs.mkdtempSync(path.join(os.tmpdir(), 'redwood-e2e-')) + + await execa( + 'yarn babel-node', + ['src/create-redwood-app.js', projectPath, '--no-yarn-install'], + { + cwd: path.join(frameworkPath, 'packages/create-redwood-app'), + shell: true, + stdio: 'inherit', + } + ) + } + + // @TODO use rwt link here + + // Clean and build framework + await execa('yarn build:clean && yarn lerna run build:js', { + cwd: frameworkPath, + shell: true, + stdio: 'inherit', + }) + + const packagesPath = path.join(frameworkPath, 'packages') + + // Link packages from framework + await execa(`ln -s ${packagesPath} ./packages`, { + shell: true, + stdio: 'inherit', + cwd: projectPath, + }) + + await execa('yarn install', { + shell: true, + stdio: 'inherit', + cwd: projectPath, + }) + + // end RWT link @TODO + + await execa('yarn rw dev --fwd="--open=false" &', { + shell: true, + stdio: 'inherit', + cwd: projectPath, + }) + + // @Note: using env to set RW_PATH does not work correctly + if (process.env.CI) { + console.log('\n ⏊ Skipping cypress open, handled by github workflow') + // @TODO should we just use yarn cypress run? + } else { + await execa('yarn cypress', ['open', `--env RW_PATH=${projectPath}`], { + shell: true, + stdio: 'inherit', + env: { + ...process.env, + }, + cwd: e2ePath, + }) + } +} + +testTutorial() From f83bba7fee1ecc2499290bc954ede961fa2b0b62 Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Tue, 2 Mar 2021 16:14:47 +0000 Subject: [PATCH 02/11] Remove todos --- tasks/test-tutorial.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index 1a913c9c3b55..c7af4319d298 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -50,8 +50,6 @@ const testTutorial = async () => { ) } - // @TODO use rwt link here - // Clean and build framework await execa('yarn build:clean && yarn lerna run build:js', { cwd: frameworkPath, @@ -74,8 +72,6 @@ const testTutorial = async () => { cwd: projectPath, }) - // end RWT link @TODO - await execa('yarn rw dev --fwd="--open=false" &', { shell: true, stdio: 'inherit', From 8c3e76fae426de878fb90e1a85260916b5fdfd49 Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Tue, 2 Mar 2021 17:15:52 +0000 Subject: [PATCH 03/11] PR Review comments --- tasks/test-tutorial.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index c7af4319d298..cd65147e33e2 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -26,7 +26,7 @@ const testTutorial = async () => { if (pathToProject) { console.log( - `\n 🗂ī¸ You have supplied a path ${projectPath}, we will not create a new ` + `\n 🗂ī¸ You have supplied the path ${projectPath}, we will not create a new ` ) console.log('Redwood project, we will use the app you have specified.') } else { @@ -60,11 +60,7 @@ const testTutorial = async () => { const packagesPath = path.join(frameworkPath, 'packages') // Link packages from framework - await execa(`ln -s ${packagesPath} ./packages`, { - shell: true, - stdio: 'inherit', - cwd: projectPath, - }) + fs.symlinkSync(packagesPath, path.join(projectPath, 'packages')) await execa('yarn install', { shell: true, From d156259f7a71a17e11fb58e6429cb78bf0329cb3 Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Thu, 4 Mar 2021 12:06:51 +0000 Subject: [PATCH 04/11] Apply suggestions from code review Co-authored-by: Peter Pistorius --- .eslintrc.js | 1 - tasks/test-tutorial.js | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 98ed1654543f..c032631bed11 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -97,7 +97,6 @@ module.exports = { 'packages/testing/src/**', 'packages/eslint-config/*.js', 'packages/eslint-plugin-redwood/src/**', - 'tasks/**', ], env: { es6: true, diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index cd65147e33e2..84679330261e 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -1,3 +1,5 @@ +/* eslint-env node, es6*/ + import fs from 'fs' import os from 'os' import path from 'path' @@ -25,10 +27,11 @@ const testTutorial = async () => { }) if (pathToProject) { - console.log( - `\n 🗂ī¸ You have supplied the path ${projectPath}, we will not create a new ` - ) - console.log('Redwood project, we will use the app you have specified.') + console.log([ + '🗂ī¸ You have supplied the path "${projectPath}",' + 'because of this we assume that there is a pre-existing Redwood project at this path,' + 'so we will not create a new redwood project.' + ].join('\n')) } else { console.log('\n ℹī¸ You have not supplied a path to a Redwood project.') console.log('We will create one for you. \n \n') @@ -39,6 +42,7 @@ const testTutorial = async () => { // Use temporary project path, because no user supplied one projectPath = fs.mkdtempSync(path.join(os.tmpdir(), 'redwood-e2e-')) + console.log('------------------------ start create redwood app -------------------------') await execa( 'yarn babel-node', ['src/create-redwood-app.js', projectPath, '--no-yarn-install'], @@ -49,6 +53,8 @@ const testTutorial = async () => { } ) } + + // Clean and build framework await execa('yarn build:clean && yarn lerna run build:js', { From e80ad615a59819d25e3d0783f972faa1260d4c17 Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Thu, 4 Mar 2021 17:35:07 +0000 Subject: [PATCH 05/11] Fix comma position --- tasks/test-tutorial.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index 84679330261e..a34ca08f9dd9 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -27,11 +27,13 @@ const testTutorial = async () => { }) if (pathToProject) { - console.log([ - '🗂ī¸ You have supplied the path "${projectPath}",' - 'because of this we assume that there is a pre-existing Redwood project at this path,' - 'so we will not create a new redwood project.' - ].join('\n')) + console.log( + [ + '🗂ī¸ You have supplied the path "${projectPath}"', + 'because of this we assume that there is a pre-existing Redwood project at this path', + 'so we will not create a new redwood project.', + ].join('\n') + ) } else { console.log('\n ℹī¸ You have not supplied a path to a Redwood project.') console.log('We will create one for you. \n \n') @@ -42,7 +44,9 @@ const testTutorial = async () => { // Use temporary project path, because no user supplied one projectPath = fs.mkdtempSync(path.join(os.tmpdir(), 'redwood-e2e-')) - console.log('------------------------ start create redwood app -------------------------') + console.log( + '------------------------ start create redwood app -------------------------' + ) await execa( 'yarn babel-node', ['src/create-redwood-app.js', projectPath, '--no-yarn-install'], @@ -53,8 +57,6 @@ const testTutorial = async () => { } ) } - - // Clean and build framework await execa('yarn build:clean && yarn lerna run build:js', { From 44767f0e7f8aafaf3c531292950f8a31236b32c1 Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Thu, 4 Mar 2021 17:49:43 +0000 Subject: [PATCH 06/11] Update based on github workflow file --- tasks/test-tutorial.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index a34ca08f9dd9..60296f11ddbb 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -76,17 +76,21 @@ const testTutorial = async () => { cwd: projectPath, }) - await execa('yarn rw dev --fwd="--open=false" &', { - shell: true, - stdio: 'inherit', - cwd: projectPath, - }) + // Make sure rw dev can run + fs.chmodSync(path.joins(projectPath, 'node_modules/.bin/rw')) - // @Note: using env to set RW_PATH does not work correctly if (process.env.CI) { - console.log('\n ⏊ Skipping cypress open, handled by github workflow') - // @TODO should we just use yarn cypress run? + console.log( + '\n ⏊ Skipping cypress and dev server launch, handled by github workflow' + ) } else { + await execa('yarn rw dev --fwd="--open=false" &', { + shell: true, + stdio: 'inherit', + cwd: projectPath, + }) + + // @Note: using env to set RW_PATH does not work correctly await execa('yarn cypress', ['open', `--env RW_PATH=${projectPath}`], { shell: true, stdio: 'inherit', From a9866747fe7e623c41223b370d76f79963499eb9 Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Thu, 4 Mar 2021 18:08:21 +0000 Subject: [PATCH 07/11] Additional logging by default | Throw properly in script --- tasks/test-tutorial.js | 156 +++++++++++++++++++++-------------------- 1 file changed, 80 insertions(+), 76 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index 60296f11ddbb..d9ff4a52e88a 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -14,91 +14,95 @@ const testTutorial = async () => { const frameworkPath = path.join(__dirname, '..') const e2ePath = path.join(frameworkPath, 'tasks/e2e') - if (process.env.DEBUG) { - console.log(`📁 ~ file: test-tutorial.js ~ projectPath`, projectPath) - console.log(`🌲 ~ file: test-tutorial.js ~ frameworkPath`, frameworkPath) - console.log(`🚀 ~ file: test-tutorial.js ~ e2ePath`, e2ePath) - } + console.log(`📁 ~ projectPath`, projectPath) + console.log(`🌲 ~ frameworkPath`, frameworkPath) + console.log(`🚀 ~ e2ePath`, e2ePath) - await execa('yarn install', { - cwd: e2ePath, - shell: true, - stdio: 'inherit', - }) - - if (pathToProject) { - console.log( - [ - '🗂ī¸ You have supplied the path "${projectPath}"', - 'because of this we assume that there is a pre-existing Redwood project at this path', - 'so we will not create a new redwood project.', - ].join('\n') - ) - } else { - console.log('\n ℹī¸ You have not supplied a path to a Redwood project.') - console.log('We will create one for you. \n \n') - console.log( - "📋 We will copy './packages/create-redwood-app/template' and link packages/* \n" - ) - - // Use temporary project path, because no user supplied one - projectPath = fs.mkdtempSync(path.join(os.tmpdir(), 'redwood-e2e-')) - - console.log( - '------------------------ start create redwood app -------------------------' - ) - await execa( - 'yarn babel-node', - ['src/create-redwood-app.js', projectPath, '--no-yarn-install'], - { - cwd: path.join(frameworkPath, 'packages/create-redwood-app'), - shell: true, - stdio: 'inherit', - } - ) - } + try { + await execa('yarn install', { + cwd: e2ePath, + shell: true, + stdio: 'inherit', + }) - // Clean and build framework - await execa('yarn build:clean && yarn lerna run build:js', { - cwd: frameworkPath, - shell: true, - stdio: 'inherit', - }) - - const packagesPath = path.join(frameworkPath, 'packages') - - // Link packages from framework - fs.symlinkSync(packagesPath, path.join(projectPath, 'packages')) - - await execa('yarn install', { - shell: true, - stdio: 'inherit', - cwd: projectPath, - }) - - // Make sure rw dev can run - fs.chmodSync(path.joins(projectPath, 'node_modules/.bin/rw')) - - if (process.env.CI) { - console.log( - '\n ⏊ Skipping cypress and dev server launch, handled by github workflow' - ) - } else { - await execa('yarn rw dev --fwd="--open=false" &', { + if (pathToProject) { + console.log( + [ + '🗂ī¸ You have supplied the path "${projectPath}"', + 'because of this we assume that there is a pre-existing Redwood project at this path', + 'so we will not create a new redwood project.', + ].join('\n') + ) + } else { + console.log('\n ℹī¸ You have not supplied a path to a Redwood project.') + console.log('We will create one for you. \n \n') + console.log( + "📋 We will copy './packages/create-redwood-app/template' and link packages/* \n" + ) + + // Use temporary project path, because no user supplied one + projectPath = fs.mkdtempSync(path.join(os.tmpdir(), 'redwood-e2e-')) + + console.log( + '------------------------ start create redwood app -------------------------' + ) + await execa( + 'yarn babel-node', + ['src/create-redwood-app.js', projectPath, '--no-yarn-install'], + { + cwd: path.join(frameworkPath, 'packages/create-redwood-app'), + shell: true, + stdio: 'inherit', + } + ) + } + + // Clean and build framework + await execa('yarn build:clean && yarn lerna run build:js', { + cwd: frameworkPath, shell: true, stdio: 'inherit', - cwd: projectPath, }) - // @Note: using env to set RW_PATH does not work correctly - await execa('yarn cypress', ['open', `--env RW_PATH=${projectPath}`], { + const packagesPath = path.join(frameworkPath, 'packages') + + // Link packages from framework + fs.symlinkSync(packagesPath, path.join(projectPath, 'packages')) + + await execa('yarn install', { shell: true, stdio: 'inherit', - env: { - ...process.env, - }, - cwd: e2ePath, + cwd: projectPath, }) + + // Make sure rw dev can run + fs.chmodSync(path.join(projectPath, 'node_modules/.bin/rw'), '755') + + if (process.env.CI) { + console.log( + '\n ⏊ Skipping cypress and dev server launch, handled by github workflow' + ) + } else { + await execa('yarn rw dev --fwd="--open=false" &', { + shell: true, + stdio: 'inherit', + cwd: projectPath, + }) + + // @Note: using env to set RW_PATH does not work correctly + await execa('yarn cypress', ['open', `--env RW_PATH=${projectPath}`], { + shell: true, + stdio: 'inherit', + env: { + ...process.env, + }, + cwd: e2ePath, + }) + } + } catch (e) { + console.error('🛑 test-tutorial script failed') + console.error(e) + process.exit(1) } } From c2b9ee528fb7b3992c582c3cf52506b46bc5278c Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Thu, 4 Mar 2021 18:26:29 +0000 Subject: [PATCH 08/11] =?UTF-8?q?Adopt=20new=20logic=20for=20=E2=98=81?= =?UTF-8?q?=EF=B8=8F=20=20e2e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks/test-tutorial.js | 49 ++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index d9ff4a52e88a..b71fd6a01047 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -6,6 +6,21 @@ import path from 'path' import execa from 'execa' +const createNewRedwoodProject = async (projectPath, frameworkPath) => { + console.log( + '------------------------ start create redwood app -------------------------' + ) + await execa( + 'yarn babel-node', + ['src/create-redwood-app.js', projectPath, '--no-yarn-install'], + { + cwd: path.join(frameworkPath, 'packages/create-redwood-app'), + shell: true, + stdio: 'inherit', + } + ) +} + const testTutorial = async () => { // First two args are "node" and path to script const [, , pathToProject] = process.argv @@ -26,13 +41,20 @@ const testTutorial = async () => { }) if (pathToProject) { - console.log( - [ - '🗂ī¸ You have supplied the path "${projectPath}"', - 'because of this we assume that there is a pre-existing Redwood project at this path', - 'so we will not create a new redwood project.', - ].join('\n') - ) + console.log('🗂ī¸ You have supplied the path "${projectPath}" \n') + + // For e2e tests in CI + if (process.env.CREATE_RWJS_PROJECT === '1') { + createNewRedwoodProject(projectPath, frameworkPath) + } else { + // Normally when a path is specified, no need to create a new project + console.log( + [ + 'Assuming pre-existing Redwood project', + 'Not creating a new one', + ].join('\n') + ) + } } else { console.log('\n ℹī¸ You have not supplied a path to a Redwood project.') console.log('We will create one for you. \n \n') @@ -43,18 +65,7 @@ const testTutorial = async () => { // Use temporary project path, because no user supplied one projectPath = fs.mkdtempSync(path.join(os.tmpdir(), 'redwood-e2e-')) - console.log( - '------------------------ start create redwood app -------------------------' - ) - await execa( - 'yarn babel-node', - ['src/create-redwood-app.js', projectPath, '--no-yarn-install'], - { - cwd: path.join(frameworkPath, 'packages/create-redwood-app'), - shell: true, - stdio: 'inherit', - } - ) + createNewRedwoodProject(projectPath, frameworkPath) } // Clean and build framework From 8894fb0e5e28c7014987e9c2f816c32496f7627e Mon Sep 17 00:00:00 2001 From: Daniel Choudhury Date: Thu, 4 Mar 2021 20:58:09 +0000 Subject: [PATCH 09/11] Dont link when not creatingProject --- tasks/test-tutorial.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index b71fd6a01047..e124f3f0593f 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -28,6 +28,7 @@ const testTutorial = async () => { let projectPath = pathToProject const frameworkPath = path.join(__dirname, '..') const e2ePath = path.join(frameworkPath, 'tasks/e2e') + const shouldCreateNewProject = process.env.CREATE_RWJS_PROJECT === '1' console.log(`📁 ~ projectPath`, projectPath) console.log(`🌲 ~ frameworkPath`, frameworkPath) @@ -44,7 +45,7 @@ const testTutorial = async () => { console.log('🗂ī¸ You have supplied the path "${projectPath}" \n') // For e2e tests in CI - if (process.env.CREATE_RWJS_PROJECT === '1') { + if (shouldCreateNewProject) { createNewRedwoodProject(projectPath, frameworkPath) } else { // Normally when a path is specified, no need to create a new project @@ -77,8 +78,10 @@ const testTutorial = async () => { const packagesPath = path.join(frameworkPath, 'packages') - // Link packages from framework - fs.symlinkSync(packagesPath, path.join(projectPath, 'packages')) + // Link packages from framework, but only if creating a new one + if (!projectPath || shouldCreateNewProject) { + fs.symlinkSync(packagesPath, path.join(projectPath, 'packages')) + } await execa('yarn install', { shell: true, From ead3e3b372025aebc52d878fd5c0a1eb0dd477dc Mon Sep 17 00:00:00 2001 From: David S Price Date: Thu, 4 Mar 2021 14:10:46 -0800 Subject: [PATCH 10/11] handle edge case reset for existing projects --- tasks/test-tutorial.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tasks/test-tutorial.js b/tasks/test-tutorial.js index e124f3f0593f..6cf002beb154 100644 --- a/tasks/test-tutorial.js +++ b/tasks/test-tutorial.js @@ -69,17 +69,16 @@ const testTutorial = async () => { createNewRedwoodProject(projectPath, frameworkPath) } - // Clean and build framework - await execa('yarn build:clean && yarn lerna run build:js', { - cwd: frameworkPath, - shell: true, - stdio: 'inherit', - }) - const packagesPath = path.join(frameworkPath, 'packages') - // Link packages from framework, but only if creating a new one - if (!projectPath || shouldCreateNewProject) { + // Clean, Build, and Link packages from framework, but only if creating a new one + if (!pathToProject || shouldCreateNewProject) { + await execa('yarn build:clean && yarn lerna run build:js', { + cwd: frameworkPath, + shell: true, + stdio: 'inherit', + }) + fs.symlinkSync(packagesPath, path.join(projectPath, 'packages')) } From d819a0637d6008cc389c78ec15e75488d0469f95 Mon Sep 17 00:00:00 2001 From: David S Price Date: Thu, 4 Mar 2021 14:11:25 -0800 Subject: [PATCH 11/11] fix broken linking logic --- tasks/e2e/cypress/integration/tutorial/tutorial.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tasks/e2e/cypress/integration/tutorial/tutorial.js b/tasks/e2e/cypress/integration/tutorial/tutorial.js index 7d68ca6f6238..7f1f017665bc 100644 --- a/tasks/e2e/cypress/integration/tutorial/tutorial.js +++ b/tasks/e2e/cypress/integration/tutorial/tutorial.js @@ -90,7 +90,9 @@ describe('The Redwood Tutorial - Golden path edition', () => { cy.writeFile(path.join(BASE_DIR, 'api/db/schema.prisma'), Step4_1_DbSchema) cy.exec(`rm ${BASE_DIR}/api/db/dev.db`, { failOnNonZeroExit: false }) // need to also handle case where Prisma Client be out of sync - cy.exec(`cd ${BASE_DIR}; yarn rw prisma migrate reset --skip-seed --force`) + cy.exec( + `cd ${BASE_DIR}; yarn rimraf ./api/db/migrations && yarn rw prisma migrate reset --skip-seed --force` + ) cy.exec(`cd ${BASE_DIR}; yarn rw prisma migrate dev`) cy.exec(`cd ${BASE_DIR}; yarn rw g scaffold post --force`) @@ -225,10 +227,7 @@ describe('The Redwood Tutorial - Golden path edition', () => { path.join(BASE_DIR, 'web/src/pages/ContactPage/ContactPage.js'), Step7_2_ContactPage ) - cy.writeFile( - path.join(BASE_DIR, 'web/src/index.css'), - Step7_3_Css - ) + cy.writeFile(path.join(BASE_DIR, 'web/src/index.css'), Step7_3_Css) cy.contains('Contact').click() cy.contains('Save').click()