diff --git a/compatibility-tests/.gitignore b/compatibility-tests/.gitignore new file mode 100644 index 0000000..6d9e0ed --- /dev/null +++ b/compatibility-tests/.gitignore @@ -0,0 +1,5 @@ +# these lock files include checksums of the @theatre/*@compat packages, which +# would change after every edit to their source, so we better not keep them +# in the repo +/*/package-lock.json +/*/yarn.lock \ No newline at end of file diff --git a/compatibility-tests/package.json b/compatibility-tests/package.json index eeb5f9b..0b9f43b 100644 --- a/compatibility-tests/package.json +++ b/compatibility-tests/package.json @@ -3,7 +3,8 @@ "private": true, "scripts": { "registry:start": "zx ./scripts/start-registry.mjs", - "test:ci": "zx ./scripts/ci.mjs" + "test:ci": "zx ./scripts/ci.mjs", + "clean": "zx ./scripts/clean.mjs" }, "dependencies": { "node-cleanup": "^2.1.2", @@ -12,5 +13,6 @@ "verdaccio-auth-memory": "^10.2.0", "verdaccio-memory": "^10.2.0", "zx": "^6.1.0" - } + }, + "version": "0.0.1-COMPAT.1" } diff --git a/compatibility-tests/scripts/clean.mjs b/compatibility-tests/scripts/clean.mjs new file mode 100644 index 0000000..0d5fa88 --- /dev/null +++ b/compatibility-tests/scripts/clean.mjs @@ -0,0 +1,3 @@ +import {clean} from './utils.mjs' + +await clean() diff --git a/compatibility-tests/scripts/utils.mjs b/compatibility-tests/scripts/utils.mjs index aa75c99..890d873 100644 --- a/compatibility-tests/scripts/utils.mjs +++ b/compatibility-tests/scripts/utils.mjs @@ -2,9 +2,8 @@ * Utility functions for the compatibility tests */ -import fs from 'fs' import path from 'path' -import {YAML} from 'zx' +import {globby, YAML} from 'zx' import onCleanup from 'node-cleanup' import * as verdaccioPackage from 'verdaccio' @@ -14,6 +13,7 @@ const startVerdaccioServer = verdaccioPackage.default.default export const VERDACCIO_PORT = 4823 export const VERDACCIO_HOST = `localhost` export const VERDACCIO_URL = `http://${VERDACCIO_HOST}:${VERDACCIO_PORT}/` +export const PATH_TO_COMPAT_TESTS_ROOT = path.join(__dirname, '..') export const MONOREPO_ROOT = path.join(__dirname, '../..') export const PATH_TO_YARNRC = path.join(MONOREPO_ROOT, '.yarnrc.yml') @@ -259,3 +259,23 @@ export function getCompatibilityTestSetups() { return setupsAbsPaths } + +/** + * Deletes ../test-*\/(node_modules|package-lock.json|yarn.lock) + */ +export async function clean() { + const toDelete = await globby( + './test-*/(node_modules|yarn.lock|package-lock.json)', + { + cwd: PATH_TO_COMPAT_TESTS_ROOT, + // node_modules et al are gitignored, but we still want to clean them + gitignore: false, + // include directories too + onlyFiles: false, + }, + ) + toDelete.forEach((fileOrDir) => { + console.log('deleting', fileOrDir) + fs.removeSync(path.join(PATH_TO_COMPAT_TESTS_ROOT, fileOrDir)) + }) +} diff --git a/compatibility-tests/test-create-react-app/.gitignore b/compatibility-tests/test-cra-react18/.gitignore similarity index 100% rename from compatibility-tests/test-create-react-app/.gitignore rename to compatibility-tests/test-cra-react18/.gitignore diff --git a/compatibility-tests/test-cra-react18/README.md b/compatibility-tests/test-cra-react18/README.md new file mode 100644 index 0000000..a7eedd2 --- /dev/null +++ b/compatibility-tests/test-cra-react18/README.md @@ -0,0 +1 @@ +Testing `@theatre/core` and `@theatre/studio` with `npm`, `create-react-app`, and `react@18` \ No newline at end of file diff --git a/compatibility-tests/test-create-react-app/package.json b/compatibility-tests/test-cra-react18/package.json similarity index 91% rename from compatibility-tests/test-create-react-app/package.json rename to compatibility-tests/test-cra-react18/package.json index eafa8be..bab4a91 100644 --- a/compatibility-tests/test-create-react-app/package.json +++ b/compatibility-tests/test-cra-react18/package.json @@ -1,5 +1,5 @@ { - "name": "@theatre-build-tests/react-app", + "name": "@compat/cra-react18", "version": "0.1.0", "private": true, "scripts": { @@ -15,7 +15,6 @@ "@testing-library/user-event": "^12.1.10", "@theatre/core": "^0.0.1-COMPAT.1", "@theatre/studio": "^0.0.1-COMPAT.1", - "@theatre/r3f": "^0.0.1-COMPAT.1", "react-scripts": "^5.0.1", "three": ">0.132.0", "web-vitals": "^1.0.1" diff --git a/compatibility-tests/test-create-react-app/public/index.html b/compatibility-tests/test-cra-react18/public/index.html similarity index 77% rename from compatibility-tests/test-create-react-app/public/index.html rename to compatibility-tests/test-cra-react18/public/index.html index aa069f2..55dcc48 100644 --- a/compatibility-tests/test-create-react-app/public/index.html +++ b/compatibility-tests/test-cra-react18/public/index.html @@ -2,19 +2,13 @@
- - - - +