From 81f33eed3570057be9bc8df1f29de12886dfceea Mon Sep 17 00:00:00 2001 From: Mitchell Hamilton Date: Tue, 4 Oct 2022 12:57:29 +1000 Subject: [PATCH] Make `@keystone-6/core/artifacts` private (#7972) * Make `@keystone-6/core/artifacts` private * update changeset Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com> --- .changeset/odd-files-battle.md | 5 +++++ .../{node-api => artifacts}/package.json | 4 ++-- packages/core/artifacts/package.json | 4 ---- packages/core/package.json | 6 +++--- .../artifacts.ts | 7 +++++++ scripts/generate-artifacts-for-projects/src/index.ts | 2 +- tests/api-tests/indexes.test.ts | 2 +- tests/api-tests/test-runner.ts | 5 ++++- tests/api-tests/utils.ts | 2 +- 9 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 .changeset/odd-files-battle.md rename packages/core/___internal-do-not-use-will-break-in-patch/{node-api => artifacts}/package.json (68%) delete mode 100644 packages/core/artifacts/package.json create mode 100644 packages/core/src/___internal-do-not-use-will-break-in-patch/artifacts.ts diff --git a/.changeset/odd-files-battle.md b/.changeset/odd-files-battle.md new file mode 100644 index 00000000000..f5fd8666559 --- /dev/null +++ b/.changeset/odd-files-battle.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Removes `@keystone-6/core/artifacts` from our exports diff --git a/packages/core/___internal-do-not-use-will-break-in-patch/node-api/package.json b/packages/core/___internal-do-not-use-will-break-in-patch/artifacts/package.json similarity index 68% rename from packages/core/___internal-do-not-use-will-break-in-patch/node-api/package.json rename to packages/core/___internal-do-not-use-will-break-in-patch/artifacts/package.json index 1d9a6bde379..c3f7d08255e 100644 --- a/packages/core/___internal-do-not-use-will-break-in-patch/node-api/package.json +++ b/packages/core/___internal-do-not-use-will-break-in-patch/artifacts/package.json @@ -1,4 +1,4 @@ { - "main": "dist/keystone-6-core-___internal-do-not-use-will-break-in-patch-node-api.cjs.js", - "module": "dist/keystone-6-core-___internal-do-not-use-will-break-in-patch-node-api.esm.js" + "main": "dist/keystone-6-core-___internal-do-not-use-will-break-in-patch-artifacts.cjs.js", + "module": "dist/keystone-6-core-___internal-do-not-use-will-break-in-patch-artifacts.esm.js" } diff --git a/packages/core/artifacts/package.json b/packages/core/artifacts/package.json deleted file mode 100644 index 0d8dc3ea85e..00000000000 --- a/packages/core/artifacts/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "main": "dist/keystone-6-core-artifacts.cjs.js", - "module": "dist/keystone-6-core-artifacts.esm.js" -} diff --git a/packages/core/package.json b/packages/core/package.json index 84f028e36f4..690b81840d9 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -11,7 +11,6 @@ "files": [ "session", "bin", - "artifacts", "___internal-do-not-use-will-break-in-patch", "migrations", "next", @@ -127,10 +126,11 @@ "index.ts", "system.ts", "next.ts", - "___internal-do-not-use-will-break-in-patch/{node-api,next-graphql,load-config}.ts", + "___internal-do-not-use-will-break-in-patch/next-graphql.ts", + "___internal-do-not-use-will-break-in-patch/load-config.ts", + "___internal-do-not-use-will-break-in-patch/artifacts.ts", "___internal-do-not-use-will-break-in-patch/admin-ui/pages/*/index.tsx", "___internal-do-not-use-will-break-in-patch/admin-ui/{next-config.ts,id-field-view.tsx}", - "artifacts.ts", "context.ts", "migrations.ts", "testing.ts", diff --git a/packages/core/src/___internal-do-not-use-will-break-in-patch/artifacts.ts b/packages/core/src/___internal-do-not-use-will-break-in-patch/artifacts.ts new file mode 100644 index 00000000000..cf14b2d5ac1 --- /dev/null +++ b/packages/core/src/___internal-do-not-use-will-break-in-patch/artifacts.ts @@ -0,0 +1,7 @@ +export { + validateCommittedArtifacts, + generateNodeModulesArtifacts, + generateCommittedArtifacts, + getCommittedArtifacts, +} from '../artifacts'; +export type { PrismaModule } from '../artifacts'; diff --git a/scripts/generate-artifacts-for-projects/src/index.ts b/scripts/generate-artifacts-for-projects/src/index.ts index c8acd5cf4c0..df8dac563c4 100644 --- a/scripts/generate-artifacts-for-projects/src/index.ts +++ b/scripts/generate-artifacts-for-projects/src/index.ts @@ -6,7 +6,7 @@ import { validateCommittedArtifacts, generateNodeModulesArtifacts, generateCommittedArtifacts, -} from '@keystone-6/core/artifacts'; +} from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/artifacts'; import { loadConfig } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/load-config'; const mode = process.argv.includes('update-schemas') ? 'generate' : 'validate'; diff --git a/tests/api-tests/indexes.test.ts b/tests/api-tests/indexes.test.ts index e6f55a50c0e..28214a930a2 100644 --- a/tests/api-tests/indexes.test.ts +++ b/tests/api-tests/indexes.test.ts @@ -1,6 +1,6 @@ import { list } from '@keystone-6/core'; import { allowAll } from '@keystone-6/core/access'; -import { getCommittedArtifacts } from '@keystone-6/core/artifacts'; +import { getCommittedArtifacts } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/artifacts'; import { select, text } from '@keystone-6/core/fields'; import { createSystem, initConfig } from '@keystone-6/core/system'; import { setupTestEnv } from '@keystone-6/api-tests/test-runner'; diff --git a/tests/api-tests/test-runner.ts b/tests/api-tests/test-runner.ts index 8cecfa0b283..c54593797f6 100644 --- a/tests/api-tests/test-runner.ts +++ b/tests/api-tests/test-runner.ts @@ -19,7 +19,10 @@ import type { KeystoneConfig, KeystoneContext, } from '@keystone-6/core/types'; -import { getCommittedArtifacts, PrismaModule } from '@keystone-6/core/artifacts'; +import { + getCommittedArtifacts, + PrismaModule, +} from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/artifacts'; import prismaClientPackageJson from '@prisma/client/package.json'; import { runMigrateWithDbUrl, withMigrate } from '@keystone-6/core/src/lib/migrations'; import { dbProvider, dbUrl, SQLITE_DATABASE_FILENAME } from './utils'; diff --git a/tests/api-tests/utils.ts b/tests/api-tests/utils.ts index 184e2883529..f913b0ad5ee 100644 --- a/tests/api-tests/utils.ts +++ b/tests/api-tests/utils.ts @@ -1,5 +1,5 @@ import { initConfig, createSystem } from '@keystone-6/core/system'; -import { getCommittedArtifacts } from '@keystone-6/core/artifacts'; +import { getCommittedArtifacts } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/artifacts'; import { KeystoneConfig, KeystoneContext, DatabaseProvider } from '@keystone-6/core/types'; import { setupTestRunner } from '@keystone-6/core/testing';