Skip to content

Commit 1f0280c

Browse files
committed
chore: reformatting updates
also add some exclusions to the prettierignore file, for test inputs and guidebook markdown
1 parent f1334f5 commit 1f0280c

File tree

6 files changed

+55
-24
lines changed

6 files changed

+55
-24
lines changed

.prettierignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22
plugins/*/dist
33
plugins/*/mdist
44
tests/**/*.md
5-
store/**/*.md
5+
store/**/*.md
6+
7+
# don't pretty-print notebooks, since spacing is important, e.g. for tabs and tips
8+
plugins/*/notebooks/**/*.md
9+
plugins/*/notebooks/**/*.json
10+
11+
tests/**/inputs/*.json

plugins/plugin-madwizard/src/components/Guide.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ export default class Guide extends React.PureComponent<Props, State> {
8888

8989
private async init(props: Props, useTheseChoices?: State["choices"]) {
9090
const choices = useTheseChoices || props.choices
91-
const newGraph = await Graph.compile(props.blocks, choices, this.memos, undefined, "sequence", props.title, props.description)
91+
const newGraph = await Graph.compile(
92+
props.blocks,
93+
choices,
94+
this.memos,
95+
undefined,
96+
"sequence",
97+
props.title,
98+
props.description
99+
)
92100
choices.onChoice(this.onChoiceFromAbove)
93101

94102
this.setState((state) => {

plugins/plugin-madwizard/src/components/Plan.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,15 @@ export default class Plan extends React.PureComponent<Props, State> {
157157
private async init(props: Props, useTheseChoices?: State["choices"]) {
158158
try {
159159
const choices = useTheseChoices || props.choices
160-
const newGraph = await Graph.compile(props.blocks, choices, this.memos, undefined, "sequence", props.title, props.description)
160+
const newGraph = await Graph.compile(
161+
props.blocks,
162+
choices,
163+
this.memos,
164+
undefined,
165+
"sequence",
166+
props.title,
167+
props.description
168+
)
161169
choices.onChoice(this.onChoice)
162170

163171
this.setState((state) => {

plugins/plugin-madwizard/src/plugin.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ function withFilepath(
3737
) {
3838
return async ({ tab, argvNoOptions, parsedOptions }: Arguments<Options>) => {
3939
if (!argvNoOptions[1]) {
40-
argvNoOptions.push('ml/codeflare')
40+
argvNoOptions.push("ml/codeflare")
4141
}
4242

4343
if (!parsedOptions.u) {
4444
// CLI path
4545
const { cli } = await import("madwizard/dist/fe/cli/index.js")
46-
await cli(["madwizard", task, ...argvNoOptions.slice(1), ...(parsedOptions.n ? ['--no-profile'] : [])], undefined, { store: process.env.GUIDEBOOK_STORE, verbose: parsedOptions.V })
46+
await cli(
47+
["madwizard", task, ...argvNoOptions.slice(1), ...(parsedOptions.n ? ["--no-profile"] : [])],
48+
undefined,
49+
{ store: process.env.GUIDEBOOK_STORE, verbose: parsedOptions.V }
50+
)
4751
return true
4852
}
4953

tests/plugin-madwizard/plan/inputs/1.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const importa: (name?: string) => Tree = (name = "importa.md") => ({ name, child
2121

2222
const importc: Tree = { name: "importc.md", children: [{ name: "echo CCC" }] }
2323

24-
const option2Tab2: Tree = { name: 'Option 2: Tab2', children: [importc] }
24+
const option2Tab2: Tree = { name: "Option 2: Tab2", children: [importc] }
2525

2626
const importe: Tree = { name: "EEE", children: [{ name: "Option 1: TabE1", children: [{ name: "echo EEE" }] }] }
2727

@@ -45,10 +45,12 @@ const mainTasks = {
4545

4646
const IN1: Input = {
4747
input: "guidebook-tree-model1.md",
48-
tree: () => [{
49-
name: 'AAA',
50-
children: [prerequisites, mainTasks],
51-
}]
48+
tree: () => [
49+
{
50+
name: "AAA",
51+
children: [prerequisites, mainTasks],
52+
},
53+
],
5254
}
5355

5456
export { importa, importc, importe, importd }

tests/plugin-madwizard/plan/plan.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,36 @@ import { productName } from "../../../plugins/plugin-client-default/config.d/nam
2626
import { Tree } from "./Input"
2727

2828
function githubActionsOS() {
29-
return process.env.RUNNER_OS
30-
.replace(/macOS/, "darwin")
29+
return process.env.RUNNER_OS.replace(/macOS/, "darwin")
3130
.replace(/Linux/, "linux")
3231
.replace(/Windows/, "win32")
3332
}
3433

3534
function githubActionsArch() {
36-
return process.env.RUNNER_ARCH
37-
.replace(/X64/, 'x64')
38-
.replace(/ARM64/, 'arm64')
35+
return process.env.RUNNER_ARCH.replace(/X64/, "x64").replace(/ARM64/, "arm64")
3936
}
4037

4138
function electronProductionPath() {
42-
return process.platform === 'linux' ? productName
43-
: process.platform === 'win32' ? `${productName}.exe`
39+
return process.platform === "linux"
40+
? productName
41+
: process.platform === "win32"
42+
? `${productName}.exe`
4443
: join(productName + ".app", "Contents/MacOS", productName)
4544
}
4645

4746
async function startElectron() {
4847
// Launch Electron app; "shell" tells Kui to ignore the command line
4948
// and just launch a plain shell
50-
const executablePath = !process.env.EXECUTABLE_PATH ? undefined
49+
const executablePath = !process.env.EXECUTABLE_PATH
50+
? undefined
5151
: process.env.EXECUTABLE_PATH !== "github-actions-production"
5252
? process.env.EXECUTABLE_PATH
53-
: join(process.env.GITHUB_WORKSPACE,
54-
'dist/electron',
55-
`${productName}-${githubActionsOS()}-${githubActionsArch()}`,
56-
electronProductionPath()
57-
)
53+
: join(
54+
process.env.GITHUB_WORKSPACE,
55+
"dist/electron",
56+
`${productName}-${githubActionsOS()}-${githubActionsArch()}`,
57+
electronProductionPath()
58+
)
5859

5960
const app = await electron.launch({ args: [main, "shell"], executablePath })
6061

@@ -122,7 +123,9 @@ export default function doPlan(markdown: Input) {
122123

123124
// the path.relative is not needed, but we are using it to test
124125
// that relative paths work
125-
await page.keyboard.type(`plan -u ${slash(relative(process.cwd(), join(__dirname, "../markdowns", markdown.input)))}`)
126+
await page.keyboard.type(
127+
`plan -u ${slash(relative(process.cwd(), join(__dirname, "../markdowns", markdown.input)))}`
128+
)
126129
await page.keyboard.press("Enter")
127130

128131
const tree = markdown.tree("guide")

0 commit comments

Comments
 (0)