sfc-utils 1.3.33 → 1.3.36

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/sheets.js CHANGED
@@ -41,18 +41,18 @@ let googleAuth = (project, directory = null, forceStr = false) => {
41
41
  var auth = null;
42
42
  authObj.authenticate({ fallback: false }).then((resp) => {
43
43
  auth = resp;
44
- grabSheets(auth, project, directory, forceStr).catch(() => {
44
+ grabSheets(auth, project, directory, forceStr).then(() => resolveFinal()).catch(() => {
45
45
  // If the first attempt failed, then make another req using the fallback
46
46
  authObj.authenticate({ fallback: true }).then((resp) => {
47
47
  auth = resp;
48
- grabSheets(auth, project, directory, forceStr).then(() => {console.log("RES 1"); return resolveFinal();});
48
+ grabSheets(auth, project, directory, forceStr).then(() => resolveFinal());
49
49
  });
50
- }).then(() => {console.log("RES 2"); return resolveFinal();});
50
+ });
51
51
  })
52
52
  .catch(() => {
53
53
  // Failure if we fall back but there's no token
54
54
  auth = authObj.task();
55
- grabSheets(auth, project, directory, forceStr).then(() => {console.log("RES 3"); return resolveFinal();});
55
+ grabSheets(auth, project, directory, forceStr).then(() => resolveFinal());
56
56
  });
57
57
  })
58
58
  };
@@ -79,7 +79,6 @@ let grabSheets = (auth, project, directory, forceStr) => {
79
79
  });
80
80
  promiseStack.push(promiseItem);
81
81
  }
82
-
83
82
  Promise.all(promiseStack)
84
83
  .then(() => {
85
84
  // Resolve the whole thing
@@ -144,8 +143,8 @@ let getSheet = async (resolve, reject, auth, spreadsheetId, directory, forceStr)
144
143
  console.log(`Saving sheet to ${file_path}`);
145
144
  // grunt.file.write(filename, JSON.stringify(out, null, 2));
146
145
  writeFile(file_path, JSON.stringify(out, null, 2));
147
- resolve(file_path);
148
146
  }
147
+ resolve("Complete");
149
148
  };
150
149
 
151
150
  module.exports = { googleAuth };
@@ -2,7 +2,7 @@
2
2
  "_comment": "The possible paywall values are 'meter' (hit the paywall after a certain number of free stories), 'paywall' (paywall immediately), 'free' (no wall), or 'meter-no-paywall' (count this against the reader's meter, but never show the paywall on this page)",
3
3
  "PAYWALL_SETTING": "meter",
4
4
  "EMBEDDED": false,
5
- "GOOGLE_SHEETS": [],
5
+ "GOOGLE_SHEETS": ["1v2U2iG7lEZHaKRgGTeg6xKlyTjZnu_C5uQ1CLSD5iEw"],
6
6
  "GOOGLE_DOCS": [],
7
7
 
8
8
  "_domain_explainer": "NOTE: MAIN_DOMAIN will get swapped out based on the MARKEY_KEY when deployed on the server. If you are building it locally for a repo push, you need to set the domain manually here.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.3.33",
3
+ "version": "1.3.36",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",
package/settings.js CHANGED
@@ -19,11 +19,30 @@ let getSettings = function(){
19
19
  settings.PROJECT['ANALYTICS_CREDIT'] = ''
20
20
  // Populate with storySettings if they exist
21
21
  let storySettings
22
+ let fullAuthors = []
22
23
  try {
23
-
24
24
  try {
25
25
  // Check for classic story_settings sheet
26
26
  [storySettings] = require("../../src/data/story_settings.sheet.json")
27
+ // If we got story_settings, try structuring the AUTHORS object
28
+ let authorNames = []
29
+ let authorLinks = []
30
+ try {
31
+ if (storySettings.Byline) {
32
+ authorNames = storySettings.Byline.split(',')
33
+ }
34
+ if (storySettings.Byline_Links) {
35
+ authorLinks = storySettings.Byline_Links.split(',')
36
+ }
37
+ for (let i in authorNames){
38
+ fullAuthors.push({
39
+ AUTHOR_NAME: authorNames[i],
40
+ AUTHOR_PAGE: authorLinks[i] || ""
41
+ })
42
+ }
43
+ } catch(err){
44
+ // It's ok, we'll fall back
45
+ }
27
46
  } catch(err){
28
47
  try {
29
48
  // May be an Archie doc, try grabbing from there
@@ -53,7 +72,7 @@ let getSettings = function(){
53
72
  "TWITTER_TEXT": storySettings.Twitter_Text,
54
73
  "DATE": storySettings.Publish_Date,
55
74
  "MOD_DATE": storySettings.Mod_Date || storySettings.LastModDate_C2P,
56
- "AUTHORS": projectSettings.AUTHORS,
75
+ "AUTHORS": fullAuthors || projectSettings.AUTHORS,
57
76
  "ANALYTICS_CREDIT": storySettings.Analytics_Credit,
58
77
  "HEARST_CATEGORY": storySettings.Category || storySettings.Analytics_Section || "News",
59
78
  "KEY_SUBJECTS": storySettings.Key_Subjects || "",