This sets up expressions to be published as an npm library in artifactory @fulcrum/expressions.
It resurrects this repo as the place where expressions work is done.
Right now everything pulls the expressions lib from https://assets.fulcrumapp.com/expv1/expressions.js, so for the immediate, we will likely copy the dist/expressions.js that this repo produces there, until we can move folks over to the published npm lib.
Note, we are doing a bit of a reset in that we are coming back to the coffeescript code. The reason for this is that this code produced the last deployed version of expressions (published by Craig on August 24, 2021 to s3 from the copy that is here at this commit, whose last change was December 13, 2019)
We needed a reproducible build, which this PR generates. (See testing notes)
Eventually, we would like to move to the typescript implementation (the most up-to-date version of that code is in fulcrum/lib/assets/fulcrum-components/src/expressions), but we need better test coverage of the existing expressions lib before we attempt that. Fortunately, the existing coffeescript tests can be run against the generated dist/expressions.js, which means those tests can be run against any new implementation that produces that file, we just need more tests that cover some of the important stuff.
We are not going to attempt to decaffeinate this code, as doing so does not move us towards the goal of using the typescript implementation.
For immediate features, we will be working with coffeescript. It would be prudent to port any additions we make to the coffeescript code to the typescript code, to make that transition easier later.
Testing:
Fixed some unit tests (yarn test), being sure not to change the current expressions implementation, but have the tests pass for the code as it works now (some behavior might not be totally correct, but that's not the goal here).
I did the following to verify the generated dist/expressions.js was consistent with what is in S3:
mkdir expressions-check
wget https://assets.fulcrumapp.com/expv1/expressions.js
mv expressions.js expressions-check/expressions.current.js
yarn build
cp dist/expressions.js expressions-check/expressions.new.js
cd expressions-check
# Use vim to edit both files to make diffs easier:
# In vim run the following substitutions in this order (to type the ^M carriage return do Ctrl-V then Return):
# :%s/;/;^M/g << Replaces all ; with ;<carriage return>
# :%s/{/{^M/g << Replaces all { with {<carriage return>
# :%s/}/}^M/g << Replaces all } with }<carriage return>
# :w expressions.current.formatted.js (or :w expressions.new.formatted.js)
# :q!
git diff --no-index expressions.current.formatted.js expressions.new.formatted.js > diff.patch
This sets up expressions to be published as an npm library in artifactory @fulcrum/expressions.
It resurrects this repo as the place where expressions work is done. Right now everything pulls the expressions lib from https://assets.fulcrumapp.com/expv1/expressions.js, so for the immediate, we will likely copy the dist/expressions.js that this repo produces there, until we can move folks over to the published npm lib.
Note, we are doing a bit of a reset in that we are coming back to the coffeescript code. The reason for this is that this code produced the last deployed version of expressions (published by Craig on August 24, 2021 to s3 from the copy that is here at this commit, whose last change was December 13, 2019) We needed a reproducible build, which this PR generates. (See testing notes) Eventually, we would like to move to the typescript implementation (the most up-to-date version of that code is in fulcrum/lib/assets/fulcrum-components/src/expressions), but we need better test coverage of the existing expressions lib before we attempt that. Fortunately, the existing coffeescript tests can be run against the generated dist/expressions.js, which means those tests can be run against any new implementation that produces that file, we just need more tests that cover some of the important stuff.
We are not going to attempt to decaffeinate this code, as doing so does not move us towards the goal of using the typescript implementation.
For immediate features, we will be working with coffeescript. It would be prudent to port any additions we make to the coffeescript code to the typescript code, to make that transition easier later.
Testing:
Fixed some unit tests (
yarn test
), being sure not to change the current expressions implementation, but have the tests pass for the code as it works now (some behavior might not be totally correct, but that's not the goal here).I did the following to verify the generated dist/expressions.js was consistent with what is in S3:
In my testing, the diff looked like:
return null} +return null} return m.storageGetItem(N,e.toString())} ; d.setItem=function(e,t){ @@ -3654,7 +3654,7 @@ l<i; l++){ u[l]=t[l]===v?arguments[r++]:t[l]} while(r<arguments.length)u.push(arguments[r++])
; +; return _(e,n,this,this,u)} ; return n}