-
Notifications
You must be signed in to change notification settings - Fork 13
Fix TS relative imports by forcing all Rugs var to be exported #156 #160
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple minor comments. LGTM
val m = p.matcher(str) | ||
if(m.find()){ | ||
val varName = m.group(1) | ||
sb.append("\nexports.").append(varName).append(" = ").append(varName).append(";\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be sb.append(s"\nexports.$varName = $varName;\n")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could - is that better?
|
||
import com.atomist.source.{ArtifactSource, FileArtifact} | ||
import com.atomist.project.archive.{AtomistConfig, DefaultAtomistConfig} | ||
import com.atomist.source.{ArtifactSource} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curly braces superfluous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
I'll verify this with the latest CLI and merge it I don't see any issues. Thanks @kipz. |
I just ran the latest local build inside the CLI against the handlers project:
|
It's less code, which seems better to me.
On Wed, Jan 11, 2017, 2:17 PM James Carnegie ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/main/scala/com/atomist/rug/runtime/js/JavaScriptContext.scala
<#160>:
> }
def getFolder(s: String): Folder = {
val dir = artifacts.findDirectory(s)
if (dir.isEmpty) return null
new ArtifactSourceBasedFolder(artifacts.underPath(s), this, getPath + s + "/")
}
+
+
+ def append(p: Pattern, str: String, sb: StringBuilder): Unit ={
+ val m = p.matcher(str)
+ if(m.find()){
+ val varName = m.group(1)
+ sb.append("\nexports.").append(varName).append(" = ").append(varName).append(";\n")
It could - is that better?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#160>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADiGSQ_uTJkoqh9slfsdkoopkZuoAKRks5rRTjZgaJpZM4Lg81s>
.
--
David Dooling
|
Changed
Hopefully not a breaking change as there is limited support for automatically exporting legacy ones.
Fixed
when 'export' is used from TS or vars are added to the global exports var
CommonJS module loader cannot find local modules in Rugs #156