|
|
@@ -1,6 +1,10 @@
|
|
|
/** Experimental-package publication and dependency constraints. */
|
|
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
+import {
|
|
|
+ isPublicExperimentalPackageDirectory,
|
|
|
+ PRIVATE_EXPERIMENTAL_PACKAGE_DIRECTORIES,
|
|
|
+} from './experimental-package-policy.ts'
|
|
|
import {
|
|
|
checkDshFamilyVersion,
|
|
|
checkExperimentalDependencyIsolation,
|
|
|
@@ -9,18 +13,13 @@ import {
|
|
|
type WorkspaceManifest,
|
|
|
} from './check-workspace-constraints.ts'
|
|
|
|
|
|
-const experimental: WorkspaceManifest = {
|
|
|
+const experimental = {
|
|
|
dir: 'packages/experimental/prototype',
|
|
|
- manifest: { name: '@deepseek-ai/dsh-experimental-prototype', private: true },
|
|
|
-}
|
|
|
-
|
|
|
-const publicExperimental: WorkspaceManifest = {
|
|
|
- dir: 'packages/experimental/agent-team',
|
|
|
manifest: {
|
|
|
- name: '@deepseek-ai/dsh-experimental-agent-team',
|
|
|
+ name: '@deepseek-ai/dsh-experimental-prototype',
|
|
|
publishConfig: { access: 'public' },
|
|
|
},
|
|
|
-}
|
|
|
+} satisfies WorkspaceManifest
|
|
|
|
|
|
describe('experimental workspace constraints', () => {
|
|
|
it('requires the experimental package-name prefix', () => {
|
|
|
@@ -32,29 +31,44 @@ describe('experimental workspace constraints', () => {
|
|
|
])
|
|
|
})
|
|
|
|
|
|
- it('requires private manifests without publication metadata', () => {
|
|
|
+ it('requires public metadata for unlisted experimental packages', () => {
|
|
|
expect(checkExperimentalManifest(experimental)).toEqual([])
|
|
|
expect(checkExperimentalManifest({
|
|
|
...experimental,
|
|
|
- manifest: { ...experimental.manifest, private: false, publishConfig: { access: 'public' } },
|
|
|
+ manifest: { name: experimental.manifest.name, private: true },
|
|
|
})).toEqual([
|
|
|
- '@deepseek-ai/dsh-experimental-prototype: experimental package must set "private": true',
|
|
|
- '@deepseek-ai/dsh-experimental-prototype: experimental package must omit publishConfig',
|
|
|
+ '@deepseek-ai/dsh-experimental-prototype: public experimental package must not set "private": true',
|
|
|
+ '@deepseek-ai/dsh-experimental-prototype: public experimental package must set publishConfig.access to "public"',
|
|
|
])
|
|
|
})
|
|
|
|
|
|
- it('requires public metadata only for the Agent Teams exceptions', () => {
|
|
|
- expect(checkExperimentalManifest(publicExperimental)).toEqual([])
|
|
|
- expect(checkExperimentalManifest({
|
|
|
- ...publicExperimental,
|
|
|
- manifest: {
|
|
|
- name: '@deepseek-ai/dsh-experimental-agent-team',
|
|
|
- private: true,
|
|
|
- },
|
|
|
- })).toEqual([
|
|
|
- '@deepseek-ai/dsh-experimental-agent-team: public experimental package must not set "private": true',
|
|
|
- '@deepseek-ai/dsh-experimental-agent-team: public experimental package must set publishConfig.access to "public"',
|
|
|
- ])
|
|
|
+ it.each(PRIVATE_EXPERIMENTAL_PACKAGE_DIRECTORIES)(
|
|
|
+ 'requires private metadata for denylisted %s',
|
|
|
+ (dir) => {
|
|
|
+ const name = `@deepseek-ai/dsh-experimental-${dir.split('/').at(-1)}`
|
|
|
+ expect(checkExperimentalManifest({ dir, manifest: { name, private: true } })).toEqual([])
|
|
|
+ expect(checkExperimentalManifest({
|
|
|
+ dir,
|
|
|
+ manifest: { name, publishConfig: { access: 'public' } },
|
|
|
+ })).toEqual([
|
|
|
+ `${name}: experimental package must set "private": true`,
|
|
|
+ `${name}: experimental package must omit publishConfig`,
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ it('limits the public default to experimental package directories', () => {
|
|
|
+ expect(isPublicExperimentalPackageDirectory(experimental.dir)).toBe(true)
|
|
|
+ for (const dir of [
|
|
|
+ 'packages/core/session',
|
|
|
+ 'apps/cli',
|
|
|
+ 'vendor/cordis',
|
|
|
+ 'packages/experimental',
|
|
|
+ 'packages/experimental/prototype/src',
|
|
|
+ ...PRIVATE_EXPERIMENTAL_PACKAGE_DIRECTORIES,
|
|
|
+ ]) {
|
|
|
+ expect(isPublicExperimentalPackageDirectory(dir)).toBe(false)
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
it.each(['dependencies', 'optionalDependencies', 'peerDependencies'] as const)(
|