sfc-utils 1.3.62 → 1.3.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/copy/c2p_sheet.js +12 -9
- package/package.json +1 -1
package/copy/c2p_sheet.js
CHANGED
|
@@ -38,7 +38,6 @@ let googleAuth = (configData) => {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
let createSheet = (auth, fallback, configData) => {
|
|
41
|
-
console.log(configData, "config data from create sheet");
|
|
42
41
|
return new Promise((resolveAll, rejectAll) => {
|
|
43
42
|
let gmail;
|
|
44
43
|
if (!fallback) {
|
|
@@ -62,16 +61,21 @@ let createSheet = (auth, fallback, configData) => {
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
const drive = google.drive({ version: "v3", auth });
|
|
65
|
-
const body = { title: "New C2P sheet" };
|
|
66
64
|
const templateId = "1DUvYnFdxtBv1AXcDI9X00s_opUSu4uHJmd5LNemCN9E";
|
|
65
|
+
const body = { title: "New C2P sheet", name: configData.PROJECT.SLUG };
|
|
66
|
+
if (configData.PROJECT.MARKET_KEY === "SFC"){
|
|
67
|
+
// If this is SFC, make sure it's created in the shared folder
|
|
68
|
+
body.parents = ['1_jnRs3xOYDxm27y7TZB9gkudzTRmcd7x'];
|
|
69
|
+
}
|
|
70
|
+
const createOptions = {
|
|
71
|
+
fileId: templateId, // Base template
|
|
72
|
+
resource: body,
|
|
73
|
+
supportsAllDrives: true,
|
|
74
|
+
//'copyCollaborators': true // This doesn't work unfortunately
|
|
75
|
+
};
|
|
67
76
|
drive.files.copy(
|
|
68
|
-
|
|
69
|
-
fileId: templateId, // Base template
|
|
70
|
-
resource: body,
|
|
71
|
-
//'copyCollaborators': true // This doesn't work unfortunately
|
|
72
|
-
},
|
|
77
|
+
createOptions,
|
|
73
78
|
(err, resp) => {
|
|
74
|
-
console.log("SHEET RESP", resp);
|
|
75
79
|
// Make edits to the sheet to match the repo details
|
|
76
80
|
let resources = {
|
|
77
81
|
auth: auth,
|
|
@@ -138,7 +142,6 @@ let createSheet = (auth, fallback, configData) => {
|
|
|
138
142
|
fileId: resp.data.id, // Modify the created file
|
|
139
143
|
},
|
|
140
144
|
(permErr, permResp) => {
|
|
141
|
-
//console.log("permResp", permResp, permErr)
|
|
142
145
|
if (permErr) {
|
|
143
146
|
console.log("An error prevented the sharing of this sheet!");
|
|
144
147
|
rejectAll();
|