-
Notifications
You must be signed in to change notification settings - Fork 125
add build scripts to programmatically create files ace editor can consume #9
add build scripts to programmatically create files ace editor can consume #9
Conversation
I'm a little skeptical about adding a whole new build system just to accommodate for a different project. I'd prefer to do this without gulp. I just added a browserify build and added some notes to the JavaScript README. Do you think what I suggest there would work? |
I think that, in general, we need a way for things like editor plugins to be separate projects. Otherwise this project will grow into the same size of beast that Gherkin 2 was. |
Oh my bad, I've read the code now. Ignore me. |
Initially I tried browserify but when putting the result of browserify through ace's dryice build system it generates an invalid In the meantime, the only way I was able to get valid ace files created was taking your original src files and wrapping them with amd before dropping them into ace's src. In the end, browserify would be cleaner so we don't have to do any hackey string replacements. Unfortunately, as of now, I haven't found a way to do it. As far as a different build system, I'm not tied to gulp. However, it would be trivial to tie the gulp build into your make file the same way you did browserify. It would be as simple as:
|
@chmontgomery can you check if 55d2419 works? The |
@aslakhellesoy I just tried 55d2419 and the ace build still generates invalid |
dc2750b
to
fe474db
Compare
FYI - I have already wrapped the entry-point in AMD syntax: https://github.com/cucumber/gherkin3/blob/master/javascript/index.js So the browserified |
fe474db
to
38525ab
Compare
Most likely your generated file works in a stand alone amd example, the problem is with ace's build system. Dryice needs to be able to understand the file we're giving it so it can properly generate the different variations of the |
38525ab
to
e49aa8d
Compare
They are not making it easy! Out of curiosity - wouldn't it be easier to keep a Gherkin plugin for Ace outside the Ace project? Doesn't Ace provide a simple mechanism to plug in 3rd party plugins? Codemirror makes that super easy. I've created a 3rd party Codemirror plugin, and it lives its own life. Shoehorning something into Ace sounds like an uphill struggle.... |
agreed, shoehorning ace is a losing battle... that's why I went with my original approach... taking your src files and wrapping them with a simple amd syntax. That seemed to play nice with ace. I'm not an ace expert but they don't seem to have a plugin system. For other parsers they support like javascript, css, json, etc, they're checked into the ace repo directly under The problem with supporting our own 3rd party library is we would still need to build ace compatible files. Ace generates build files for src, src-min, src-min-noconflict, and src-noconflict. Each of these versions are wrapped differently to work in various environments. We could copy ace's build system into a separate repo and modify it to our liking, but I'd prefer not to maintain something like that. I've updated this PR to handle licensing properly so that the result, |
e49aa8d
to
9285afc
Compare
@@ -55,6 +55,9 @@ dist/gherkin.js: lib/gherkin/parser.js ../LICENSE node_modules/.fetched | |||
echo '*/' >> $@ | |||
./node_modules/.bin/browserify index.js --ignore-missing >> $@ | |||
|
|||
ace: lib/gherkin/parser.js ../LICENSE node_modules/.fetched |
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.
The name of the target should not be ace
, but the path to the file that gulp produces. Otherwise, make
won't be able to detect that there is nothing to do.
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.
got it. Will update
updated js |
I appreciate your effort to bring Gherkin to Ace, but your approach is introducing extra work for both the Gherkin team and the Ace team:
I'll illustrate it with a dependency diagram:
You have to remove the maintenance burden from the Gherkin and Ace teams by inverting the dependencies:
You should create a separate GitHub repo where you put your You'll have the freedom to use your favourite build tools, and you'll produce an Ace plugin. I did a quick search in the Ace docs for how to write plugins, and didn't find anything. That doesn't mean Ace doesn't have a plugin API - it just means you'll have to ask the Ace team for help. When you distribute your plugin on npm and/or bower, I recommend you don't embed the Gherkin code there either, just declare a dependency in package.json/bower.json. Consumers of your plugin will then get Gherkin as a transitive dependency. What do you think about this approach? |
I think that makes a lot of sense. I originally wanted to do something similar but, as we mentioned earlier, fighting ace would be an uphill battle. I was just trying to fit into their system without too much friction. We can close this PR and I'll pull the couple build scripts into my own repo where it can be published separately. |
@aslakhellesoy can you publish gherkin3 to npm? right now all that's in npm is version 2. |
Gherkin3 isn't stable yet, so publishing now would be premature. I don't expect significant changes, but I'm sure there will be some minor ones. We don't really know until we start replacing Gherkin2 with Gherkin3 in the various Cucumber implementations. That will start happening as soon as #12 is resolved. Until Gherkin3 is released to npm you can depend on the git repo: I'm glad we're making progress on this! |
@aslakhellesoy I can't depend on this project from my package.json because this project's package.json is not at the top level of the project. Currently npm does not support depending on a package in a subdirectory of a repo: npm/npm#2974 |
Oh I see. There is a similar problem for PHP as described in #4. We might need to split Gherkin up in several git repos. |
@chmontgomery Now there is a standalone repo: |
First, install the new tools by running
npm install
.now, running
gulp
fromgherkin3/javascript
will generate adist/gherkin/
folder containing all the files which can be dropped wholesale into the ace project underlib/ace/mode/gherkin/
This change depends on #7 and #8