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

Fix the chrome build system #98

Open
Stebalien opened this issue Feb 10, 2017 · 6 comments
Open

Fix the chrome build system #98

Stebalien opened this issue Feb 10, 2017 · 6 comments

Comments

@Stebalien
Copy link
Member

So, the chrome build system is a bit weird. npm build chrome runs the tasks in the following order:

> tipsy@ build-chrome /home/steb/projects/tipsy
> grunt chrome-extension

Running "clean:chrome-extension" (clean) task
>> 1 path cleaned.

Running "compress:chrome-extension" (compress) task
Created chrome-extension/dist/tipsy.zip (521682 bytes)

Running "copy:chrome-extension" (copy) task
Created 25 directories, copied 138 files

Running "stylus:chrome-extension" (stylus) task
File chrome-extension/dist/tipsy/css/tipsy.css created.

Running "es6:chrome-extension" (es6) task

Running "shell:chrome-extension" (shell) task

Now, the chrome store expects a zip with a key.pem so I tried uploading the file produced by compress:chrome-extension (which meets both of these requirements). However, that zip file is missing the manifest‽ Worse, it appears to have a slightly different directory structure than the .crx. At the end of the day, I just extracted the compiled extension (.crx), put the key.pem in place, re-zipped, and uploaded that.

As far as I can tell, the correct way to do this is to move the compress:chrome-extension task after es6:chrome-extension and make sure to build the .crx and .zip from the same source.

@tbranyen
Copy link
Member

tbranyen commented Feb 16, 2017

Strange this has been working, was there a change that broke it I wonder? We did not need to follow the steps you just said to publish any of the other versions and I've been using this same exact code (at least the code I wrote originally) for two other chrome extensions as well.

@tbranyen
Copy link
Member

Also to add to this issue, we should drop the chrome- prefix and try and clean up the code to remove any trace of the previous branching.

@Stebalien
Copy link
Member Author

How exactly did you publish it then? Did you upload the zip or did Google accept pre-packaged crx files in the past.

@tbranyen
Copy link
Member

Good question, it's been over a year since I last published an extension, it's possible they changed something on their end. I vaguely remember uploading both a key and the zip separately. I think the idea was that Google signs the .crx for you.

@Stebalien
Copy link
Member Author

Actually, given that the current system drops the key in the zip file (as key.pem) as required by google, I don't think anything has changed. Have you tried building from a clean source?

By the way, here's a diff showing how I think this should work:

diff --git a/Gruntfile.coffee b/Gruntfile.coffee
index 9c991bb..9f3d03d 100644
--- a/Gruntfile.coffee
+++ b/Gruntfile.coffee
@@ -23,10 +23,10 @@ module.exports = ->
 
   @registerTask 'chrome-extension', [
     'clean:chrome-extension'
-    'compress:chrome-extension'
     'copy:chrome-extension'
     'stylus:chrome-extension'
     'es6:chrome-extension'
+    'compress:chrome-extension'
     'shell:chrome-extension'
   ]
 
diff --git a/build/tasks/compress.coffee b/build/tasks/compress.coffee
index a02c5d2..4aee196 100644
--- a/build/tasks/compress.coffee
+++ b/build/tasks/compress.coffee
@@ -8,14 +8,6 @@ module.exports = ->
         mode: 'zip'
 
       files: [
-        { src: ['node_modules/purecss/*'], dest: '.' }
-        { src: ['**/*'], expand: true, cwd: 'shared' }
-        {
-          src: [
-            'key.pem'
-            '_locales/**'
-          ]
-          expand: true
-          cwd: 'chrome-extension'
-        }
+        { src: ['key.pem'], cwd: 'chrome-extension/dist' }
+        { src: ['**/*'], expand: true, cwd: 'chrome-extension/dist/tipsy' }
       ]

However, I don't really know grunt so I don't know if this is how one is supposed to do it. The basic idea is that the crx and zip should look identical modulo key.pem (only in the zip).

@tbranyen
Copy link
Member

This makes sense to me. I dunno how it could work with compress running before building.

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

No branches or pull requests

2 participants