-
-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathpackage.json.genie.ts
More file actions
153 lines (143 loc) · 5.52 KB
/
Copy pathpackage.json.genie.ts
File metadata and controls
153 lines (143 loc) · 5.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import docsPkg from './docs/package.json.genie.ts'
import docsCodeSnippetsPkg from './docs/src/content/_assets/code/package.json.genie.ts'
import { memberPathsForProjection, type LivestorePackageProjection } from './genie/repo-topology.ts'
import { catalog, packageJson } from './genie/repo.ts'
import adapterCloudflarePkg from './packages/@livestore/adapter-cloudflare/package.json.genie.ts'
import adapterWebPkg from './packages/@livestore/adapter-web/package.json.genie.ts'
import commonPkg from './packages/@livestore/common/package.json.genie.ts'
import commonCfPkg from './packages/@livestore/common-cf/package.json.genie.ts'
import effectPlaywrightPkg from './packages/@livestore/effect-playwright/package.json.genie.ts'
import frameworkToolkitPkg from './packages/@livestore/framework-toolkit/package.json.genie.ts'
import livestorePkg from './packages/@livestore/livestore/package.json.genie.ts'
import peerDepsPkg from './packages/@livestore/peer-deps/package.json.genie.ts'
import reactPkg from './packages/@livestore/react/package.json.genie.ts'
import sqliteWasmPkg from './packages/@livestore/sqlite-wasm/package.json.genie.ts'
import syncCfPkg from './packages/@livestore/sync-cf/package.json.genie.ts'
import utilsPkg from './packages/@livestore/utils/package.json.genie.ts'
import utilsDevPkg from './packages/@livestore/utils-dev/package.json.genie.ts'
import waSqlitePkg from './packages/@livestore/wa-sqlite/package.json.genie.ts'
import webmeshPkg from './packages/@livestore/webmesh/package.json.genie.ts'
import astroTldrawPkg from './packages/@local/astro-tldraw/package.json.genie.ts'
import astroTwoslashCodeExamplePkg from './packages/@local/astro-twoslash-code/example/package.json.genie.ts'
import astroTwoslashCodePkg from './packages/@local/astro-twoslash-code/package.json.genie.ts'
import localSharedPkg from './packages/@local/shared/package.json.genie.ts'
import scriptsPkg from './scripts/package.json.genie.ts'
import testsIntegrationPkg from './tests/integration/package.json.genie.ts'
import testsPackageCommonPkg from './tests/package-common/package.json.genie.ts'
import testsPerfPkg from './tests/perf/package.json.genie.ts'
import testsPerfEventlogPkg from './tests/perf-eventlog/package.json.genie.ts'
import testsSyncProviderPkg from './tests/sync-provider/package.json.genie.ts'
import testsWaSqlitePkg from './tests/wa-sqlite/package.json.genie.ts'
export const rootWorkspacePackages = [
docsPkg,
docsCodeSnippetsPkg,
adapterCloudflarePkg,
adapterWebPkg,
commonCfPkg,
commonPkg,
effectPlaywrightPkg,
frameworkToolkitPkg,
livestorePkg,
peerDepsPkg,
reactPkg,
sqliteWasmPkg,
syncCfPkg,
utilsDevPkg,
utilsPkg,
waSqlitePkg,
webmeshPkg,
astroTldrawPkg,
astroTwoslashCodeExamplePkg,
astroTwoslashCodePkg,
localSharedPkg,
scriptsPkg,
testsIntegrationPkg,
testsPackageCommonPkg,
testsPerfEventlogPkg,
testsPerfPkg,
testsSyncProviderPkg,
testsWaSqlitePkg,
] as const
const workspacePackagesByMemberPath = new Map(
rootWorkspacePackages.map((workspacePackage) => [workspacePackage.meta.workspace.memberPath, workspacePackage]),
)
const packagesForLivestoreProjection = (projection: Extract<LivestorePackageProjection, 'core' | 'tooling'>) =>
memberPathsForProjection(projection).map((memberPath) => {
const workspacePackage = workspacePackagesByMemberPath.get(memberPath)
if (workspacePackage === undefined) {
throw new Error(`Missing workspace package for topology member path: ${memberPath}`)
}
return workspacePackage
})
/**
* Livestore core workspace packages.
*
* This is the install-projection used by the core workspace root in
* `genie/projections/core/`.
* It follows the topology `core` projection instead of filtering the current
* pre-split root package list by path.
*/
export const coreWorkspacePackages = packagesForLivestoreProjection('core')
/**
* Livestore tooling workspace packages.
*
* This extends the core projection with the local/docs/tooling packages needed
* by downstream devtools and release workflows without pulling in the full repo
* workspace breadth.
*/
export const toolingWorkspacePackages = [
...packagesForLivestoreProjection('tooling'),
docsPkg,
docsCodeSnippetsPkg,
astroTldrawPkg,
astroTwoslashCodePkg,
localSharedPkg,
scriptsPkg,
testsIntegrationPkg,
testsPackageCommonPkg,
testsSyncProviderPkg,
] as const
const rootWorkspaceBase = packageJson.aggregateFromPackages({
packages: rootWorkspacePackages,
name: 'livestore-workspace',
repoName: 'livestore',
extraMembers: ['examples/*'],
})
const rootWorkspaceExtraFields = {
scripts: {
changeset: 'changeset',
'changeset:status': 'changeset status',
'changeset:version': 'changeset version',
},
devDependencies: {
'@changesets/cli': '^2.31.0',
...catalog.pick('@types/node', 'typescript', 'vitest'),
},
} as const
const rootWorkspace = {
...rootWorkspaceBase,
data: {
...rootWorkspaceBase.data,
...rootWorkspaceExtraFields,
},
stringify: (ctx: Parameters<typeof rootWorkspaceBase.stringify>[0]) => {
const generated = JSON.parse(rootWorkspaceBase.stringify(ctx))
return `${JSON.stringify(
{
...generated,
scripts: {
...generated.scripts,
...rootWorkspaceExtraFields.scripts,
},
devDependencies: {
...generated.devDependencies,
...rootWorkspaceExtraFields.devDependencies,
},
},
null,
2,
)}\n`
},
} satisfies typeof rootWorkspaceBase
export const rootWorkspaceMemberPaths = rootWorkspace.data.workspaces
export default rootWorkspace