Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the filePushOrder option in not working as documented #527

Open
jakenjarvis opened this issue Feb 10, 2019 · 10 comments · Fixed by #582
Open

the filePushOrder option in not working as documented #527

jakenjarvis opened this issue Feb 10, 2019 · 10 comments · Fixed by #582

Comments

@jakenjarvis
Copy link

Just because the inherited class has a different loading order(alphabetical), it becomes "TypeError: Cannot read property 'prototype' of undefined". Screen shot

I created a sample project to convey this.

Expected Behavior

case OK:
https://github.com/jakenjarvis/clasp-ts-sample/tree/master/IssueSample/Issue01/ProjectNormal

Actual Behavior

case NG:
https://github.com/jakenjarvis/clasp-ts-sample/tree/master/IssueSample/Issue01/ProjectAbnormal

TypeError: Cannot read property 'prototype' of undefined (line 14, file "AClass")

Steps to Reproduce the Problem

  1. Swap the class names of AClass and BClass.
  2. Oh wonder, it becomes TypeError.

Specifications

  • Windows 10 64bit
  • node v10.15.0
  • yarn 1.13.0
  • @google/clasp 1.6.3
  • @types/google-apps-script 0.0.36
@erickoledadevrel
Copy link
Contributor

The TypeScript to Apps Script conversion is done via the ts2gas module. Please file the issue there instead.

@jakenjarvis
Copy link
Author

Thank you. I reported Issue to ts2gas.

@PopGoesTheWza
Copy link
Collaborator

@erickoledadevrel it seems to be in fact a @google/clasp issue.

You can read my reasoning here grant/ts2gas#27

To summarise

  • the transpiled TypeScript code is correct (i.e. nothing to change in ts2gas)
  • the filePushOrder option in not working as documented (i.e. order of *.gs files do not comply)

In the name of @jakenjarvis , I'd like this issue to be re-opened.

@PopGoesTheWza
Copy link
Collaborator

It seems like the filePushOrder is broken in two places:

  • in files.ts, getProjectFiles(), the nonIgnoredFilePaths.sort(...) does not sort correctly
  • in files.ts, pushFiles(), the script.projects.updateContent sends the filesForAPI with applying the sort order from nonIgnoredFilePaths

@jakenjarvis jakenjarvis changed the title Inheritance class becomes TypeError in load order. the filePushOrder option in not working as documented Mar 21, 2019
@grant grant reopened this Mar 21, 2019
@grant
Copy link
Contributor

grant commented Mar 21, 2019

We can close after clasp is published and the fix is verified.

@grant
Copy link
Contributor

grant commented Jul 3, 2019

Note: I've published @google/clasp@2.2

@kornthing
Copy link

I'm using clasp 2.3.0 and I don't think that this issue has been fixed already. I've made an example on StackOverflow.
I've listed here all opened issues concerned this problem on Git google/clasp:

@PopGoesTheWza
Copy link
Collaborator

@jakenjarvis @kornthing Using the latest npm version of @google/clasp I do not experience any issue related to the filePushOrder in .clasp.json

If you still are, please share a github repository with some sample code and .clasp.json(no need to give access to your Google Apps Script project) so that I may investigate further.

@PopGoesTheWza
Copy link
Collaborator

Here is a sample repository I used to check proper usage of filePushOrder.

A better description in the doc may be useful though and a PR would be appreciated.

@PopGoesTheWza
Copy link
Collaborator

@kornthing can you please give a status about this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants