Skip to content

Commit cd675c6

Browse files
committed
Updated fix for danthareja#71 stricter to restrict any json files to only appscript.json manifest file. Modified logging to reflect the change
Updated Readme of this repo to let users know this is just a fork for fixing & submitting pull requests to gapps issues
1 parent 9757563 commit cd675c6

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
---
2-
### :warning: A request for maintainers :construction:
2+
### Fork of [node-google-apps-script](https://github.com/danthareja/node-google-apps-script)
33

4-
This project was initially developed for my own personal use at work and reached a wider audience with the help of a few members on the Google Apps Script team. I do not have the capacity to maintain this project and I am asking you, the beloved community member, for help.
4+
This project is a fork of Dan Thareja's excellent [ node-google-apps-script](https://github.com/danthareja/node-google-apps-script)
5+
It is meant to submit a fix and pull-request to that npm package.
56

6-
While the core commands are mostly stable, users have identified a few bugs and asked for some additional features. I need help taking action on these [issues](https://github.com/danthareja/node-google-apps-script/issues) and [pull requests](https://github.com/danthareja/node-google-apps-script/pulls), ideally from someone who uses this project in production.
7+
The fix is for [this issue](https://github.com/danthareja/node-google-apps-script/issues/71). Explanation:
8+
* Google Apps Script (GAS) seems to have recently introduces support for [manifest files](https://developers.google.com/apps-script/concepts/manifests)
9+
* GAS allows definition of these files in a file called appsscript.json
10+
* node-google-apps-script as of `1.1.5` does not support .json files
11+
* This fork adds support for .json files so that appsscript.json can be synced.
712

8-
If you are interested in taking over this project, please [contact me](mailto:[email protected]). I'm happy to provide anything you need in order to continue improving this useful tool for the community.
913

10-
Until a candidate has been selected for take over, I will not be able to review issues and pull requests. I encourage anyone interested in active development to do so in a fork.
1114

1215
---
1316

lib/util.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ function hasFileOnDisk(filesOnDisk, file) {
5050
function getFileType(file) {
5151
if (file.ext === '.js') return 'server_js';
5252
if (file.ext === '.gs') return 'server_js';
53-
if (file.ext === '.json') return 'json';
53+
if (file.ext === '.json' && checkIfValidJsonFile(file)) return 'json';
5454
if (file.ext === '.html') return 'html';
55-
throw new Error('Unsupported file type found. Google Apps Script only allows .js and .html');
55+
throw new Error('Unsupported file type found. Google Apps Script only allows .js and .html files and an optional appsscript.json manifest file');
5656
}
5757

5858
function getFileExtension(file) {
@@ -69,6 +69,11 @@ function swapGStoJS(filename) {
6969
return filename;
7070
}
7171

72+
function checkIfValidJsonFile(file){
73+
if (file && file.name === 'appsscript') return true;
74+
return false;
75+
}
76+
7277

7378
module.exports.getFilesFromDisk = getFilesFromDisk;
7479
module.exports.updateFileSource = updateFileSource;

0 commit comments

Comments
 (0)