Skip to content

Commit e2e902c

Browse files
committed
Fix: Ensure parent ID is saved in .clasp.json
1 parent 82e921f commit e2e902c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/core/clasp.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export async function initClaspInstance(options: InitOptions): Promise<Clasp> {
131131
project: {
132132
scriptId: config.scriptId,
133133
projectId: config.projectId,
134-
parentId: config.parentId,
134+
parentId: firstValue(config.parentId),
135135
},
136136
});
137137
}
@@ -245,3 +245,10 @@ async function hasReadAccess(path: string): Promise<boolean> {
245245
}
246246
return true;
247247
}
248+
249+
function firstValue<T>(values: T | T[] | undefined): T | undefined {
250+
if (Array.isArray(values) && values.length > 0) {
251+
return values[0];
252+
}
253+
return values as T | undefined;
254+
}

src/core/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ export class Project {
316316
const settings = {
317317
scriptId: this.options.project.scriptId,
318318
rootDir: srcDir,
319+
parentId: this.options.project.parentId,
319320
projectId: this.options.project.projectId,
320321
scriptExtensions: this.options.files.fileExtensions['SERVER_JS'],
321322
htmlExtensions: this.options.files.fileExtensions['HTML'],

0 commit comments

Comments
 (0)