Skip to content

Commit

Permalink
feat: add vite-setup-catalogue (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Jun 26, 2022
1 parent 8b36d42 commit 6f5b27f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ecosystem-ci-selected.yml
Expand Up @@ -42,6 +42,7 @@ on:
- astro
- rakkas
- storybook
- vite-setup-catalogue
jobs:
execute-selected-suite:
timeout-minutes: 20
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ecosystem-ci.yml
Expand Up @@ -48,7 +48,8 @@ jobs:
telefunc,
astro,
rakkas,
storybook
storybook,
vite-setup-catalogue
]
fail-fast: false
steps:
Expand Down
12 changes: 12 additions & 0 deletions tests/vite-setup-catalogue.ts
@@ -0,0 +1,12 @@
import { runInRepo } from '../utils'
import { RunOptions } from '../types'

export async function test(options: RunOptions) {
await runInRepo({
...options,
repo: 'sapphi-red/vite-setup-catalogue',
branch: 'main',
test: 'test-for-ecosystem-ci',
useCopyForOverrides: true // needs copy because node_modules is mounted on docker container
})
}
4 changes: 4 additions & 0 deletions types.d.ts
Expand Up @@ -16,6 +16,10 @@ export interface RunOptions {
build?: Task
test?: Task | Task[]
beforeInstall?: Task
/**
* Whether to use `file:` instead of `link:`
*/
useCopyForOverrides?: boolean
}

type Task = string | (() => Promise<any>)
Expand Down
15 changes: 9 additions & 6 deletions utils.ts
Expand Up @@ -122,7 +122,8 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
commit,
skipGit,
verify,
beforeInstall
beforeInstall,
useCopyForOverrides
} = options
const beforeInstallCommand = toCommand(beforeInstall)
const buildCommand = toCommand(build)
Expand Down Expand Up @@ -155,19 +156,21 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
overrides.vite = options.release
}
} else {
overrides.vite ||= `${options.vitePath}/packages/vite`
const protocol = useCopyForOverrides ? 'file:' : ''

overrides.vite ||= `${protocol}${options.vitePath}/packages/vite`
overrides[
`@vitejs/plugin-vue`
] ||= `${options.vitePath}/packages/plugin-vue`
] ||= `${protocol}${options.vitePath}/packages/plugin-vue`
overrides[
`@vitejs/plugin-vue-jsx`
] ||= `${options.vitePath}/packages/plugin-vue-jsx`
] ||= `${protocol}${options.vitePath}/packages/plugin-vue-jsx`
overrides[
`@vitejs/plugin-react`
] ||= `${options.vitePath}/packages/plugin-react`
] ||= `${protocol}${options.vitePath}/packages/plugin-react`
overrides[
`@vitejs/plugin-legacy`
] ||= `${options.vitePath}/packages/plugin-legacy`
] ||= `${protocol}${options.vitePath}/packages/plugin-legacy`
}
await applyPackageOverrides(dir, overrides)

Expand Down

0 comments on commit 6f5b27f

Please sign in to comment.