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

Build tools for AMO submissions #441

Merged
merged 7 commits into from Aug 26, 2019

create source code generator script

  • Loading branch information
christophertino committed Aug 24, 2019
commit 7806e5debbbc613ec63970a88525a95d35ba4cba
@@ -22,6 +22,9 @@ tools/leet/*.json
# Cliqz
cliqz/

# Tools
tools/amo/*.zip

## JSDoc
docs/
jsdocs/
@@ -0,0 +1,42 @@
# Ghostery Source Code Builder for AMO Review

This package includes source code for the Ghostery extension along with Cliqz browser-core. Although browser-core is included in the Ghostery project as an NPM dependency, we provide the full source code here for easier review.

## `build.sh`

Use this script to install dependencies and build production code for the browser-core and ghostery-extension projects.

#### Requirements

This build script was tested on macOS Mojave with the following configuration:

+ [Homebrew](https://brew.sh/)
+ [nvm](https://github.com/nvm-sh/nvm")
+ `brew install nvm`
+ [Yarn](https://yarnpkg.com/)
+ `brew install yarn`
+ [jq](https://stedolan.github.io/jq/)
+ `brew install jq`

#### Notes on `browser-core-X.X.X`

After running `build.sh`, you should see the production files in the `browser-core-X.X.X/build/` directory. This should match the code found in `ghostery-extension-X.X.X/node_modules/browser-core/build/`.

#### Notes on `ghostery-extension-X.X.X`

After running `build.sh`, you should see the production build archive in the `ghostery-extension-X.X.X/build/` directory. This file should match the archive that was submitted to AMO.

Compiled assets live in the `ghostery-extension-X.X.X/dist/` folder. Assets from Cliqz browser-core (see above) are copied into the `ghostery-extension-X.X.X/cliqz/` directory from `node_modules/browser-core/build/assets` using the `vendor-copy` npm package. That copy is triggered when running `yarn install`. See `package.json`:

```json
"vendorCopy": [
{
"from": "node_modules/browser-core/build/assets",
"to": "cliqz"
}
]
```

## `generate.sh` (Not included in submission)

Fetches source code from GitHub and packages it along with `build.sh` and this README. This creates the complete source code archive that Ghostery sends along with its AMO submissions.
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Build script for AMO Reviewers
# Build script for AMO reviewers
#
# Ghostery Browser Extension
# http://www.ghostery.com/
@@ -69,7 +69,7 @@ if ! type jq > /dev/null; then
fi

# Check for nvm
. /usr/local/opt/nvm/nvm.sh
source /usr/local/opt/nvm/nvm.sh
if ! command -v nvm | grep -q 'nvm'; then
abort "Please install nvm: https://github.com/nvm-sh/nvm"
fi
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Generate source code archive for AMO reviewers
#
# Ghostery Browser Extension
# http://www.ghostery.com/
#
# Copyright 2019 Ghostery, Inc. All rights reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0

VERSION_FILE=../../manifest.json
PACKAGE_FILE=../../package.json
ZIP_FILE=ghostery-source

# Get version numbers
GHOSTERY_RAW_VERSION=$(cat $VERSION_FILE | jq '.version')
GHOSTERY_VERSION=${GHOSTERY_RAW_VERSION//\"} # remove ""
CLIQZ_BROWSER_CORE=$(cat $PACKAGE_FILE | jq '.dependencies["browser-core"]')
CLIQZ_VERSION=$(echo $CLIQZ_BROWSER_CORE | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/')

# Download source code zip files from GitHub
curl "https://github.com/ghostery/ghostery-extension/archive/v$GHOSTERY_VERSION.zip" -O -J -L --fail
This conversation was marked as resolved by christophertino

This comment has been minimized.

@luciancor

luciancor Aug 26, 2019
Contributor

this currently fails as 8.4.2 is not released in https://github.com/ghostery/ghostery-extension/releases

This comment has been minimized.

@christophertino

christophertino Aug 26, 2019
Author Member

Good point. The generate script can't be run until the release is posted.

curl "https://github.com/cliqz-oss/browser-core/archive/v$CLIQZ_VERSION.zip" -O -J -L --fail

# Make source-code zip
zip --quiet -R "$ZIP_FILE" "*" -x generate.sh *.DS_Store

# Clean up
rm "browser-core-$CLIQZ_VERSION.zip"
rm "ghostery-extension-$GHOSTERY_VERSION.zip"
ProTip! Use n and p to navigate between commits in a pull request.