Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "nx run-many -t build",
"build:clean": "node ./tasks/clean-build.mts",
"build:pack": "nx run-many -t build:pack",
"build:test-project": "node ./tasks/test-project/test-project.mts",
"build:test-project": "tsx ./tasks/test-project/test-project.mts",
"build:watch": "lerna run build:watch --parallel; tsc --build",
"changesets": "tsx ./tasks/changesets/changesets.mts",
"check": "cross-env yarn constraints && yarn dedupe --check",
Expand Down Expand Up @@ -44,8 +44,8 @@
"project:deps": "node ./tasks/framework-tools/frameworkDepsToProject.mjs",
"project:sync": "node ./tasks/framework-tools/frameworkSyncToProject.mjs",
"project:tarsync": "tsx ./tasks/framework-tools/tarsync/bin.mts",
"rebuild-test-project-fixture": "tsx ./tasks/test-project/rebuild-test-project-fixture.ts",
"rebuild-test-project-fixture-esm": "tsx ./tasks/test-project/rebuild-test-project-fixture-esm.ts",
"rebuild-test-project-fixture": "tsx ./tasks/test-project/rebuild-test-project-fixture.mts",
"rebuild-test-project-fixture-esm": "tsx ./tasks/test-project/rebuild-test-project-fixture-esm.mts",
"smoke-tests": "node ./tasks/smoke-tests/smoke-tests.mjs",
"test": "nx run-many -t test -- --minWorkers=1 --maxWorkers=4",
"test:k6": "tsx ./tasks/k6-test/run-k6-tests.mts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'node:path'
import { hideBin } from 'yargs/helpers'
import yargs from 'yargs/yargs'

import { fragmentsTasks } from './tasks.js'
import { fragmentsTasks } from './tasks.mjs'

const args = yargs(hideBin(process.argv))
.usage('Usage: $0 <project directory>')
Expand Down
2 changes: 0 additions & 2 deletions tasks/test-project/codemods/delayedPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

const delayedComponents = `
function DelayedComponent({
time,
Expand Down
31 changes: 0 additions & 31 deletions tasks/test-project/frameworkLinking.js

This file was deleted.

38 changes: 38 additions & 0 deletions tasks/test-project/frameworkLinking.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import execa from 'execa'
import type { StdioOption, Options as ExecaOptions } from 'execa'

export const addFrameworkDepsToProject = (
frameworkPath: string,
projectPath: string,
stdio?: StdioOption,
) => {
const options: ExecaOptions = {
cwd: frameworkPath,
shell: true,
stdio: (stdio ?? 'inherit') as any,
env: {
CFW_PATH: frameworkPath,
RWJS_CWD: projectPath,
},
}

return execa('yarn', ['project:deps'], options)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: changed from execa('yarn project:deps', options) (string command) to execa('yarn', ['project:deps'], options) (array syntax). verify this behaves the same with shell: true

Prompt To Fix With AI
This is a comment left during a code review.
Path: tasks/test-project/frameworkLinking.mts
Line: 19:19

Comment:
**style:** changed from `execa('yarn project:deps', options)` (string command) to `execa('yarn', ['project:deps'], options)` (array syntax). verify this behaves the same with `shell: true`

How can I resolve this? If you propose a fix, please make it concise.

}

export const copyFrameworkPackages = (
frameworkPath: string,
projectPath: string,
stdio?: StdioOption,
) => {
const options: ExecaOptions = {
cwd: frameworkPath,
shell: true,
stdio: (stdio ?? 'inherit') as any,
env: {
CFW_PATH: frameworkPath,
RWJS_CWD: projectPath,
},
}

return execa('yarn', ['project:copy'], options)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'

import { fileURLToPath } from 'node:url'

import ansis from 'ansis'
import { rimraf } from 'rimraf'
import semver from 'semver'
import { hideBin } from 'yargs/helpers'
Expand All @@ -12,19 +15,20 @@ import { RedwoodTUI, ReactiveTUIContent, RedwoodStyling } from '@cedarjs/tui'
import {
addFrameworkDepsToProject,
copyFrameworkPackages,
} from './frameworkLinking.js'
import { webTasks, apiTasks } from './tui-tasks.js'
import { isAwaitable, isTuiError } from './typing.js'
import type { TuiTaskDef } from './typing.js'
} from './frameworkLinking.mjs'
import { webTasks, apiTasks } from './tui-tasks.mjs'
import { isAwaitable, isTuiError } from './typing.mjs'
import type { TuiTaskDef } from './typing.mjs'
import {
getExecaOptions as utilGetExecaOptions,
updatePkgJsonScripts,
ExecaError,
exec,
getCfwBin,
} from './util.js'
} from './util.mjs'

const ansis = require('ansis')
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

function recommendedNodeVersion() {
const templatePackageJsonPath = path.join(
Expand Down Expand Up @@ -111,7 +115,7 @@ if (!startStep) {
const tui = new RedwoodTUI()

function getExecaOptions(cwd: string) {
return { ...utilGetExecaOptions(cwd), stdio: 'pipe' }
return { ...utilGetExecaOptions(cwd), stdio: 'pipe' as const }
}

function beginStep(step: string) {
Expand Down Expand Up @@ -160,7 +164,7 @@ async function tuiTask({ step, title, content, task, parent }: TuiTaskDef) {

try {
promise = task()
} catch (e) {
} catch (e: any) {
// This code handles errors from synchronous tasks

tui.stopReactive(true)
Expand All @@ -184,7 +188,7 @@ async function tuiTask({ step, title, content, task, parent }: TuiTaskDef) {
}

if (isAwaitable(promise)) {
const result = await promise.catch((e) => {
const result = await (promise as Promise<any>).catch((e: any) => {
// This code handles errors from asynchronous tasks

tui.stopReactive(true)
Expand Down Expand Up @@ -348,11 +352,12 @@ async function runCommand() {
content: 'yarn install',
task: async () => {
// TODO: See if this is needed now with tarsync
await exec('yarn install', getExecaOptions(OUTPUT_PROJECT_PATH))
await exec('yarn install', [], getExecaOptions(OUTPUT_PROJECT_PATH))

// TODO: Now that I've added this, I wonder what other steps I can remove
return exec(
`yarn ${getCfwBin(OUTPUT_PROJECT_PATH)} project:tarsync`,
[],
getExecaOptions(OUTPUT_PROJECT_PATH),
)
},
Expand Down Expand Up @@ -521,7 +526,7 @@ async function runCommand() {
RW_PATH: path.join(__dirname, '../../'),
},
})
} catch (e) {
} catch (e: any) {
if (
e instanceof ExecaError &&
!e.stderr &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'

import { fileURLToPath } from 'node:url'

import ansis from 'ansis'
import { rimraf } from 'rimraf'
import semver from 'semver'
import { hideBin } from 'yargs/helpers'
Expand All @@ -12,19 +15,20 @@ import { RedwoodTUI, ReactiveTUIContent, RedwoodStyling } from '@cedarjs/tui'
import {
addFrameworkDepsToProject,
copyFrameworkPackages,
} from './frameworkLinking'
import { webTasks, apiTasks } from './tui-tasks'
import { isAwaitable, isTuiError } from './typing'
import type { TuiTaskDef } from './typing'
} from './frameworkLinking.mjs'
import { webTasks, apiTasks } from './tui-tasks.mjs'
import { isAwaitable, isTuiError } from './typing.mjs'
import type { TuiTaskDef } from './typing.mjs'
import {
getExecaOptions as utilGetExecaOptions,
updatePkgJsonScripts,
ExecaError,
exec,
getCfwBin,
} from './util'
} from './util.mjs'

const ansis = require('ansis')
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

function recommendedNodeVersion() {
const templatePackageJsonPath = path.join(
Expand Down Expand Up @@ -111,7 +115,7 @@ if (!startStep) {
const tui = new RedwoodTUI()

function getExecaOptions(cwd: string) {
return { ...utilGetExecaOptions(cwd), stdio: 'pipe' }
return { ...utilGetExecaOptions(cwd), stdio: 'pipe' as const }
}

function beginStep(step: string) {
Expand Down Expand Up @@ -160,7 +164,7 @@ async function tuiTask({ step, title, content, task, parent }: TuiTaskDef) {

try {
promise = task()
} catch (e) {
} catch (e: any) {
// This code handles errors from synchronous tasks

tui.stopReactive(true)
Expand All @@ -184,7 +188,7 @@ async function tuiTask({ step, title, content, task, parent }: TuiTaskDef) {
}

if (isAwaitable(promise)) {
const result = await promise.catch((e) => {
const result = await (promise as Promise<any>).catch((e: any) => {
// This code handles errors from asynchronous tasks

tui.stopReactive(true)
Expand Down Expand Up @@ -345,11 +349,12 @@ async function runCommand() {
content: 'yarn install',
task: async () => {
// TODO: See if this is needed now with tarsync
await exec('yarn install', getExecaOptions(OUTPUT_PROJECT_PATH))
await exec('yarn install', [], getExecaOptions(OUTPUT_PROJECT_PATH))

// TODO: Now that I've added this, I wonder what other steps I can remove
return exec(
`yarn ${getCfwBin(OUTPUT_PROJECT_PATH)} project:tarsync`,
[],
getExecaOptions(OUTPUT_PROJECT_PATH),
)
},
Expand Down Expand Up @@ -521,7 +526,7 @@ async function runCommand() {
RW_PATH: path.join(__dirname, '../../'),
},
})
} catch (e) {
} catch (e: any) {
if (
e instanceof ExecaError &&
!e.stderr &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import * as path from 'node:path'
import { hideBin } from 'yargs/helpers'
import yargs from 'yargs/yargs'

import { exec, getExecaOptions as utilGetExecaOptions } from './util'
import { exec, getExecaOptions as utilGetExecaOptions } from './util.mjs'

function getExecaOptions(cwd: string) {
return { ...utilGetExecaOptions(cwd), stdio: 'pipe' }
return { ...utilGetExecaOptions(cwd), stdio: 'pipe' as const }
}

const args = yargs(hideBin(process.argv))
Expand Down
Loading
Loading