dativebase / dative

Dative: software for linguistic fieldwork
http://www.dative.ca
Apache License 2.0
14 stars 5 forks source link

test node 12 #324

Open cesine opened 4 years ago

cesine commented 4 years ago

for https://github.com/FieldDB/FieldDB/issues/2173

Before Node 8 and Node 10: https://travis-ci.org/github/FieldDB/dative/jobs/708989910

Running "eco:files" (eco) task
File .tmp/scripts/templates/active-server.js created.
File .tmp/scripts/templates/add-user.js created.
File .tmp/scripts/templates/alert-dialog.js created.
File .tmp/scripts/templates/app.js created.
File .tmp/scripts/templates/application-settings-edit.js created.
File .tmp/scripts/templates/application-settings-header.js created.
File .tmp/scripts/templates/application-settings-view.js created.
File .tmp/scripts/templates/application-settings.js created.
File .tmp/scripts/templates/basepage.js created.
File .tmp/scripts/templates/button-control.js created.
File .tmp/scripts/templates/collection-contents-input.js created.
File .tmp/scripts/templates/comment-representation.js cre
...

After Node 12 : https://travis-ci.org/github/FieldDB/dative/jobs/708989911

Screen Shot 2020-07-17 at 4 27 11 PM

Running "eco:files" (eco) task
File .tmp/scripts/templates/active-server.js created.
File .tmp/scripts/templates/add-user.js created.
File .tmp/scripts/templates/alert-dialog.js created.
File .tmp/scripts/templates/app.js created.
File .tmp/scripts/templates/application-settings-edit.js created.
File .tmp/scripts/templates/application-settings-header.js created.
File .tmp/scripts/templates/application-settings-view.js created.
>> Error in app/scripts/templates/application-settings.eco:
>> [stdin]:95:24: error: unexpected end of input
>>     _print _safe '\n' +
>>
Warning: Eco failed to compile app/scripts/templates/application-settings.eco. Use --force to continue.

fix 
>> Error in app/scripts/templates/application-settings.eco:
>> Parse error on line 106: unexpected dedent

Aborted due to warnings.

List of impacted files:

app/scripts/templates/application-settings.eco
app/scripts/templates/csv-import-header.eco
app/scripts/templates/file-data.eco
app/scripts/templates/filter-expression.eco
app/scripts/templates/form-add-widget-backup.eco
app/scripts/templates/keyboard-input.eco
app/scripts/templates/resource.eco
app/scripts/templates/settings.eco
app/scripts/templates/smart-query-preview.eco

Root cause appears that all of these files have nested <% when i remove it or workaround it, the file is able to compile:

Screen Shot 2020-07-17 at 3 58 18 PM

I think i found that i can reproduce this in eco's test suites using 1.0.3 but using the latest version v1.1.0-rc-3 works so upgrading to the latest might be a direction we can go in but it requires an update to grunt-eco to handle the breaking change where compile now returns a function

Option 1: fix the compile issue

  1. Use josh-lauer and other's work to escape characters to prevent a cross site scripting issue, which also fixes the templates https://github.com/cesine/eco/pull/8/files
  2. Optional: Use a new version of nodeunit which can support coffeescript instead of coffee-script https://github.com/caolan/nodeunit/pull/358/files
  3. TBD Use a new version of grunt-eco https://github.com/cesine/grunt-eco/pull/1/files which can support the new compile which returns a function https://github.com/sstephenson/eco/compare/v1.0.3...v1.1.0-rc-3

Option 2: check in the dist

If we cant build on the server, we can build using node 10 and then check in the dist and serve those using node 12 https://github.com/FieldDB/dative/pull/16

Option 3: convert from coffee to js

There is probably a util that we can use to convert all the coffee files into es6. i did a POC using decaffeinate but it would require more work to update the gruntfile to use eslint and another templating engine that is similar to eco https://github.com/FieldDB/dative/pull/17