Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add vite-setup-catalogue #83

Merged
merged 2 commits into from Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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