Skip to content

Commit

Permalink
Use posix.join
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x authored Apr 10, 2024
1 parent 362f823 commit 8f9351f
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions generate-routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFile, writeFile } from 'node:fs/promises'
import { dirname, resolve } from 'node:path'
import { dirname, resolve, posix } from 'node:path'
import { fileURLToPath } from 'node:url'

import { openapi } from '@seamapi/types/connect'
Expand All @@ -8,24 +8,33 @@ import { deleteAsync } from 'del'
import { ESLint } from 'eslint'
import { format, resolveConfig } from 'prettier'

const rootPath = resolve(
dirname(fileURLToPath(import.meta.url)),
const rootPathParts = [
'src',
'lib',
'seam',
'connect',
]

const routeOutputPathParts = [
'routes'
]

const rootPath = resolve(
dirname(fileURLToPath(import.meta.url)),
...rootPathParts
)
const rootClassPath = resolve(rootPath, 'seam-http.ts')
const routeOutputPath = resolve(rootPath, 'routes')
const routeOutputPath = resolve(rootPath, ...routeOutputPathParts)

async function main(): Promise<void> {
const routes = createRoutes()
const routeNames = await Promise.all(routes.map(writeRoute))
const routeIndexName = await writeRoutesIndex(routes)
const outputPathParts = [...rootPathParts, routeOutputPathParts]
await deleteAsync([
`${routeOutputPath}/**`,
`!${routeOutputPath}/${routeIndexName}`,
...routeNames.map((name) => `!${routeOutputPath}/${name}`),
posix.join(...outputPathParts, '*')

Check failure on line 35 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v18)

It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.

Check failure on line 35 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v18)

Argument of type 'string | string[]' is not assignable to parameter of type 'string'.

Check failure on line 35 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v20)

It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.

Check failure on line 35 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v20)

Argument of type 'string | string[]' is not assignable to parameter of type 'string'.
`!${posix.join(...outputPathParts, routeIndexName)}`,

Check failure on line 36 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v18)

Argument of type 'string | string[]' is not assignable to parameter of type 'string'.

Check failure on line 36 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v20)

Argument of type 'string | string[]' is not assignable to parameter of type 'string'.
...routeNames.map((name) => `!${posix.join(...outputPathParts, name)}`),

Check failure on line 37 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v18)

Argument of type 'string | string[]' is not assignable to parameter of type 'string'.

Check failure on line 37 in generate-routes.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v20)

Argument of type 'string | string[]' is not assignable to parameter of type 'string'.
])
}

Expand Down

0 comments on commit 8f9351f

Please sign in to comment.