From 64a57ecf302dcb21179e13a8d31a1c561815750b Mon Sep 17 00:00:00 2001 From: sapphi-red Date: Sun, 26 Jun 2022 07:46:37 +0900 Subject: [PATCH 1/2] feat: add vite-setup-catalogue --- .github/workflows/ecosystem-ci-selected.yml | 1 + .github/workflows/ecosystem-ci.yml | 3 ++- tests/vite-setup-catalogue.ts | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/vite-setup-catalogue.ts diff --git a/.github/workflows/ecosystem-ci-selected.yml b/.github/workflows/ecosystem-ci-selected.yml index fad0d7a8..2fc80e9b 100644 --- a/.github/workflows/ecosystem-ci-selected.yml +++ b/.github/workflows/ecosystem-ci-selected.yml @@ -42,6 +42,7 @@ on: - astro - rakkas - storybook + - vite-setup-catalogue jobs: execute-selected-suite: timeout-minutes: 20 diff --git a/.github/workflows/ecosystem-ci.yml b/.github/workflows/ecosystem-ci.yml index 25adb8f7..68687204 100644 --- a/.github/workflows/ecosystem-ci.yml +++ b/.github/workflows/ecosystem-ci.yml @@ -48,7 +48,8 @@ jobs: telefunc, astro, rakkas, - storybook + storybook, + vite-setup-catalogue ] fail-fast: false steps: diff --git a/tests/vite-setup-catalogue.ts b/tests/vite-setup-catalogue.ts new file mode 100644 index 00000000..2e1f0669 --- /dev/null +++ b/tests/vite-setup-catalogue.ts @@ -0,0 +1,11 @@ +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' + }) +} From da5dd690e8ad9cbb2bee697bfb6de860ce76155f Mon Sep 17 00:00:00 2001 From: sapphi-red Date: Sun, 26 Jun 2022 08:21:42 +0900 Subject: [PATCH 2/2] feat: useCopyForOverrides option --- tests/vite-setup-catalogue.ts | 3 ++- types.d.ts | 4 ++++ utils.ts | 15 +++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/vite-setup-catalogue.ts b/tests/vite-setup-catalogue.ts index 2e1f0669..33e7d20a 100644 --- a/tests/vite-setup-catalogue.ts +++ b/tests/vite-setup-catalogue.ts @@ -6,6 +6,7 @@ export async function test(options: RunOptions) { ...options, repo: 'sapphi-red/vite-setup-catalogue', branch: 'main', - test: 'test-for-ecosystem-ci' + test: 'test-for-ecosystem-ci', + useCopyForOverrides: true // needs copy because node_modules is mounted on docker container }) } diff --git a/types.d.ts b/types.d.ts index dbc1b2a6..c9f76f56 100644 --- a/types.d.ts +++ b/types.d.ts @@ -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) diff --git a/utils.ts b/utils.ts index 54055c7d..cc26a1d6 100644 --- a/utils.ts +++ b/utils.ts @@ -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) @@ -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)