Skip to content

Commit f102635

Browse files
committed
consolidate tsconfig.workspace.jsons into toplevel tsconfig.demo.json
1 parent b2dfc80 commit f102635

File tree

10 files changed

+16
-84
lines changed

10 files changed

+16
-84
lines changed

demos/example-electron-node/tsconfig.workspace.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

demos/example-electron/tsconfig.workspace.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

demos/react-supabase-todolist-optional-sync/tsconfig.workspace.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

demos/react-supabase-todolist-sync-streams/tsconfig.workspace.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

demos/react-supabase-todolist-tanstackdb/tsconfig.workspace.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

demos/react-supabase-todolist/tsconfig.workspace.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

demos/yjs-react-supabase-text-collab/tsconfig.workspace.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

scripts/demos-use-latest.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,12 @@ const linkDemo = async (demoName: string) => {
8383
}
8484

8585
const tsConfigPath = path.join(demoSrc, 'tsconfig.json');
86-
const tsConfigWorkspacePath = path.join(demoSrc, 'tsconfig.workspace.json');
87-
let workspaceFileFound = false;
8886

8987
changes = false;
9088
if (fs.existsSync(tsConfigPath)) {
9189
console.log('Checking tsconfig.json');
9290

9391
let tsConfig: any;
94-
let tsConfigWorkspace: any;
9592
try {
9693
tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, 'utf8'));
9794
} catch (ex) {
@@ -107,23 +104,6 @@ const linkDemo = async (demoName: string) => {
107104
if (ref.path === 'tsconfig.workspace.json') {
108105
console.log('- Unlinking tsconfig.workspace.json');
109106

110-
tsConfig.references.splice(i);
111-
changes = true;
112-
} else if (ref.path.startsWith('..')) {
113-
// Move reference to workspace file
114-
console.log(`- Moving ${ref.path} to tsconfig.workspace.json`);
115-
tsConfigWorkspace = {};
116-
117-
if (fs.existsSync(tsConfigWorkspacePath)) {
118-
tsConfigWorkspace = JSON.parse(fs.readFileSync(tsConfigWorkspacePath, 'utf8'));
119-
}
120-
121-
if ('references' in tsConfigWorkspace) {
122-
tsConfigWorkspace.references.push(ref);
123-
} else {
124-
tsConfigWorkspace.references = [ref];
125-
}
126-
127107
tsConfig.references.splice(i);
128108
changes = true;
129109
}
@@ -136,9 +116,6 @@ const linkDemo = async (demoName: string) => {
136116

137117
if (changes) {
138118
fs.writeFileSync(tsConfigPath, `${JSON.stringify(tsConfig, null, 2)}\n`, 'utf8');
139-
if (tsConfigWorkspace) {
140-
fs.writeFileSync(tsConfigWorkspacePath, `${JSON.stringify(tsConfigWorkspace, null, 2)}\n`, 'utf8');
141-
}
142119
} else {
143120
console.log('- No changes');
144121
}

scripts/demos-use-workspace.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,23 @@ const linkDemo = async (demoName: string) => {
8484
console.log('- No changes');
8585
}
8686

87-
// Update tsconfig.json using tsconfig.workspace.json
87+
// Update tsconfig.json to reference tsconfig.demo.json
8888
const tsConfigPath = path.join(demoSrc, 'tsconfig.json');
89-
const tsConfigWorkspacePath = path.join(demoSrc, 'tsconfig.workspace.json');
9089

91-
if (fs.existsSync(tsConfigWorkspacePath)) {
90+
if (fs.existsSync(tsConfigPath)) {
9291
const tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, 'utf8'));
9392

9493
const workspaceRef = {
95-
path: 'tsconfig.workspace.json'
94+
path: '../../tsconfig.demo.json'
9695
};
9796

98-
console.log('Linking tsconfig.workspace.json');
97+
console.log('Linking tsconfig.demo.json');
9998

10099
changes = false;
101100
const references = tsConfig['references'];
102101

103102
if (references) {
104-
const existingWorkspaceRef = references.find((v: any) => v.path === 'tsconfig.workspace.json');
103+
const existingWorkspaceRef = references.find((v: any) => v.path === '../../tsconfig.demo.json');
105104
if (existingWorkspaceRef == undefined) {
106105
tsConfig['references'].push(workspaceRef);
107106
changes = true;

tsconfig.demo.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Gets linked into the demos' local tsconfig files when doing local development.
2+
{
3+
"references": [
4+
{
5+
"path": "./packages/web"
6+
},
7+
{
8+
"path": "./packages/node"
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)