Skip to content

Commit

Permalink
chore: auto-format generated types with prettier (#70405)
Browse files Browse the repository at this point in the history
### What?

Added a step in both `build-native.cjs` and `build-wasm.cjs` scripts to
run Prettier on the generated types file after writing it.

Should have been added with #69680, but I didn't think about it.

Currently, every time you built the native module you have changes in
the git repo (which would be fixed on commit, but graphite might not be
happy with uncommitted changes).
  • Loading branch information
ForsakenHarmony committed Sep 24, 2024
1 parent a4d7768 commit 14f7018
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/next/src/build/swc/generated-wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@

/* tslint:disable */
/* eslint-disable */
/**
* @param {string} value
* @param {any} opts
* @returns {any}
*/
export function mdxCompileSync(value: string, opts: any): any
/**
* @param {string} value
* @param {any} opts
* @returns {Promise<any>}
*/
export function mdxCompile(value: string, opts: any): Promise<any>
/**
* @param {string} s
* @param {any} opts
Expand Down Expand Up @@ -51,3 +39,15 @@ export function parseSync(s: string, opts: any): any
* @returns {Promise<any>}
*/
export function parse(s: string, opts: any): Promise<any>
/**
* @param {string} value
* @param {any} opts
* @returns {any}
*/
export function mdxCompileSync(value: string, opts: any): any
/**
* @param {string} value
* @param {any} opts
* @returns {Promise<any>}
*/
export function mdxCompile(value: string, opts: any): Promise<any>
8 changes: 8 additions & 0 deletions scripts/build-native.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
booleanArg,
execAsyncWithOutput,
execFn,
exec,
namedValueArg,
} = require('./pack-util.cjs')
const fs = require('fs')
Expand Down Expand Up @@ -85,4 +86,11 @@ function writeTypes() {
vendoredTypes + generatedTypesMarker + generatedNotice + generatedTypes

fs.writeFileSync(vendoredTypesPath, vendoredTypes)

exec('Prettify generated types', [
'pnpm',
'prettier',
'--write',
vendoredTypesPath,
])
}
8 changes: 8 additions & 0 deletions scripts/build-wasm.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
booleanArg,
execAsyncWithOutput,
execFn,
exec,
namedValueArg,
} = require('./pack-util.cjs')
const fs = require('fs')
Expand Down Expand Up @@ -79,4 +80,11 @@ function writeTypes() {
const vendoredTypes = generatedNotice + generatedTypes

fs.writeFileSync(vendoredTypesPath, vendoredTypes)

exec('Prettify generated types', [
'pnpm',
'prettier',
'--write',
vendoredTypesPath,
])
}

0 comments on commit 14f7018

Please sign in to comment.