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

Add @@PLUGINSTART-USE-STRICT@@ Replacement #1187

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hayeswise
Copy link

@hayeswise hayeswise commented Feb 10, 2017

Add support for new replacement, @@PLUGINSTART-USE-STRICT@@. The replacement is the standard PLUGINSTART code followed by "use strict";.

For plugin example that uses this:


Following has been removed per guidance from nhamer to keep the changes focused on one item:

Also add a --verbose option to show which files are being built.
Sample verbose option output during the build:

> python build.py local --version
Buidling total-conversion-build.user.js
Buidling plugins\add-kml.user.js
Buidling plugins\ap-list.user.js
...

@@PLUGINSTART-USE-STRICT@@ is replaced with the standard PLUGINSTART
code and "use strict";  Also add a --verbose option to show which files
are buing built.
Copy link

@nhamer nhamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, there's a lot more changes here than should be necessary for the patch. It should just need the pluginWrapperUseStrict (which, really, should be X + usecommon) and then the alternate macro.

@hayeswise
Copy link
Author

hayeswise commented Feb 10, 2017

Okay, I can back out the verbose option easy enough. And make the other requested change. A pluginWrapperUseStrict = pluginWrapperStart + "use strict;" approach will not work since the "use strict" needs to go immediately after the function wrapper(plugin_info) {. Now, I could split pluginWrapperStart into two parts/variables, say pluginWrapperStartOpening and pluginInWrapperStartClosing. Or, use a replacement string approach.

@nhamer
Copy link

nhamer commented Feb 10, 2017

I'd have pluginWrapperStartCommon = "most of it"; and then pluginWrapperStart and pluginWrapperStartStrict add the extra couple lines at the top

Insert "use strict"; using string replace on pluginWrapperStart.  Remove
--verbose option.
@hayeswise
Copy link
Author

After considering the options, I went with the one line approach:

pluginWrapperStartUseStrict = pluginWrapperStart.replace("{\n", "{\n\"use strict\";\n", 1)

Also removed the --verbose feature.

Copy link

@nhamer nhamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erm, you just added a couple extra files.

@hayeswise
Copy link
Author

Sorry, this is the first time I've done this with a repository that wasn't mine. I'll get to it. Thanks for keeping me on track.

@hayeswise hayeswise changed the title Add @@PLUGINSTART-USE-STRICT@@ Replacement and --verbose Add @@PLUGINSTART-USE-STRICT@@ Replacement Feb 10, 2017
@hayeswise
Copy link
Author

I got this down to the one file and checked it via the "Files Changed" link, above.

modos189 added a commit to IITC-CE/ingress-intel-total-conversion that referenced this pull request Nov 27, 2018
The replacement is the standard PLUGINSTART code followed by "use strict";. by @hayeswise

iitc-project/ingress-intel-total-conversion#1187
#2
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 this pull request may close these issues.

2 participants