Skip to content

Commit

Permalink
Merge branch 'main' of github.com:mozilla/multi-account-containers in…
Browse files Browse the repository at this point in the history
…to backup-restore-containers
  • Loading branch information
Minigugus committed Jan 14, 2022
2 parents ecc7f21 + cb31410 commit 8f09b8f
Show file tree
Hide file tree
Showing 324 changed files with 3,951 additions and 972 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
"parserOptions": {
"ecmaVersion": 8
"ecmaVersion": 2018
},
"env": {
"browser": true,
Expand All @@ -18,7 +18,10 @@ module.exports = {
"XPCOMUtils": true,
"OS": true,
"ADDON_UNINSTALL": true,
"ADDON_DISABLE": true
"ADDON_DISABLE": true,
"proxifiedContainers": true,
"MozillaVPN": true,
"MozillaVPN_Background": true
},
"plugins": [
"promise",
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Builds
on:
push:
branches:
- main
- production
pull_request:
branches:
- main
- production
schedule:
- cron: '0 2 * * *' # Daily at 2AM UTC

jobs:
builds:
name: Builds
runs-on: ubuntu-20.04

steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Create the package
shell: bash
run: |
./bin/build-addon.sh nightly.xpi
- name: Uploading
uses: actions/upload-artifact@v1
with:
name: ${{matrix.config.name}} Build
path: src/web-ext-artifacts
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[submodule "src/_locales"]
branch = main
path = src/_locales
url = https://github.com/mozilla-l10n/multi-account-containers-l10n.git
ignore=all
3 changes: 1 addition & 2 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@

"rules": {
"declaration-block-no-duplicate-properties": true,
"order/properties-alphabetical-order": true,
"property-no-unknown": [
true, {
ignoreProperties:
["inset-block-end", "inset-block-start"]
}],
"property-blacklist": [
"property-disallowed-list": [
"/(min[-]|max[-])height/",
"/width/",
"/top/",
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ node_js:
notifications:
irc:
- "ircs://irc.mozilla.org:6697/#testpilot-containers-bots"

install:
- npm install --legacy-peer-deps
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Everyone is welcome to contribute to containers. Reach out to team members if you have questions:

- IRC: #containers on irc.mozilla.org
- Matrix chat: [#containers:mozilla.org](https://matrix.to/#/#containers:mozilla.org)
- Email: containers@mozilla.com

## Filing bugs
Expand Down
65 changes: 55 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Firefox Multi-Account Containers extension lets you carve out a separate box for each of your online lives – no more opening a different browser just to check your work email! [Learn More Here](https://blog.mozilla.org/firefox/introducing-firefox-multi-account-containers/)

[Available on addons.mozilla.org](https://addons.mozilla.org/en-GB/firefox/addon/multi-account-containers/)
[Available on addons.mozilla.org](https://addons.mozilla.org/firefox/addon/multi-account-containers/)

For more info, see:

Expand All @@ -18,20 +18,64 @@ For more info, see:

## Development

1. `npm install`
2. `./node_modules/web-ext/bin/web-ext run -s src/`
### Running Locally

#### Via WebExtensions API (web-ext)

1. Fetch the locales updating the git-submodules: `git submodule init && git submodule update --remote --depth 1 src/_locales`
2. Install the [web-ext](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext) tool.
3. Run `web-ext run -s src/`. This launches Firefox and installs the extension automatically.

This tool provides some additional development features, such as [automatic reloading](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext#Automatic_extension_reloading).

#### Via about:debugging in Firefox

1. Fetch the locales updating the git-submodules: `git submodule init && git submodule update --remote --depth 1 src/_locales`
2. Open the `about:debugging` page in Firefox.
3. Click on `This Firefox`.
4. Click on [Load Temporary Add-on](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox).
5. Select `src/manifest.json`.

Here is a [video](https://www.youtube.com/watch?v=cer9EUKegG4) that demonstrates how to do this.

### Testing
`npm run test`

or
* Install dependencies:

```
npm install
```

* Run all tests:

```
npm run test
```

`npm run lint`
* Only run the linter:

for just the linter
```
npm run lint
```

There is a timeout test that sometimes fails on certain machines, so make sure to run the tests on your clone before you make any changes to see if you have this problem.

#### Add/update messages for translation

The `src/_locales` directory is a git repository like any other, so to make changes to the messages:

1. Make whatever changes you need in `src/_locales/en` as you work.

2. `cd src/_locales/en`

3. `git branch message-updates-yyyymmdd`

4. `git push -u origin message-updates-yyyymmdd`

You can then open a pull request from the `message-updates-yyyymmdd` branch to

[the l10n repo](https://github.com/mozilla-l10n/multi-account-containers-l10n/) `main` branch.

### Distributing
#### Make the new version

Expand All @@ -42,13 +86,14 @@ There is a timeout test that sometimes fails on certain machines, so make sure t

#### Publish to AMO

1. `npm run-script build`
2. [Upload the `.zip` to AMO](https://addons.mozilla.org/en-US/developers/addon/multi-account-containers/versions/submit/)
1. `./bin/build-addon.sh`
2. [Upload the `.zip` to AMO](https://addons.mozilla.org/developers/addon/multi-account-containers/versions/submit/)

#### Publish to GitHub

Finally, we also publish the release to GitHub for those followers.

1. Download the signed `.xpi` from [the addon versions page](https://addons.mozilla.org/en-US/developers/addon/multi-account-containers/versions)
1. Download the signed `.xpi` from [the addon versions page](https://addons.mozilla.org/developers/addon/multi-account-containers/versions)
2. [Make the new release on
GitHub](https://github.com/mozilla/multi-account-containers/releases/new)
* Use the version number for "Tag version" and "Release title"
Expand Down
35 changes: 35 additions & 0 deletions bin/addons-linter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# 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/.

# addons-linter is not happy to see a `.github` folder in src/_locales.
# We need to do an horrible hack to run the test.

. $(dirname $0)/commons.sh

TMPDIR=/tmp/MAC_addonsLinter

print Y "Update the submodules..."
git submodule init || die
git submodule update --remote --depth 1 src/_locales || die

printn Y "Removing previous execution data... "
rm -rf $TMPDIR || die
print G "done."

printn Y "Creating a tmp folder ($TMPDIR)... "
mkdir $TMPDIR || die
print G "done."

printn Y "Copying data... "
cp -r src $TMPDIR || die
print G "done."

printn Y "Removing the github folder... "
rm -rf $TMPDIR/src/_locales/.github || die
print G "done."

print Y "Running the test..."
$(npm bin)/addons-linter $TMPDIR/src || die
27 changes: 26 additions & 1 deletion bin/build-addon.sh
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
npm install && npm run deploy
#!/bin/bash

# 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/.

. $(dirname $0)/commons.sh

print Y "Update the submodules..."
git submodule init || die
git submodule update --remote --depth 1 src/_locales || die

print Y "Installing dependencies..."
npm install --legacy-peer-deps || die

print Y "Running tests..."
npm test

print Y "Creating the final package..."
cd src || die

if [[ $# -gt 0 ]]; then
EXTRA_PARAMS="--filename $1"
fi

$(npm bin)/web-ext build --overwrite-dest $EXTRA_PARAMS || die
54 changes: 54 additions & 0 deletions bin/commons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# 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/.

printv() {
if [ -t 1 ]; then
NCOLORS=$(tput colors)

if test -n "$NCOLORS" && test "$NCOLORS" -ge 8; then
NORMAL="$(tput sgr0)"
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
fi
fi

if [[ $2 = 'G' ]]; then
# shellcheck disable=SC2086
echo $1 -e "${GREEN}$3${NORMAL}"
elif [[ $2 = 'Y' ]]; then
# shellcheck disable=SC2086
echo $1 -e "${YELLOW}$3${NORMAL}"
elif [[ $2 = 'N' ]]; then
# shellcheck disable=SC2086
echo $1 -e "$3"
else
# shellcheck disable=SC2086
echo $1 -e "${RED}$3${NORMAL}"
fi
}

print() {
printv '' "$1" "$2"
}

printn() {
printv "-n" "$1" "$2"
}

error() {
printv '' R "$1"
}

die() {
if [[ "$1" ]]; then
error "$1"
else
error Failed
fi

exit 1
}
9 changes: 0 additions & 9 deletions data/filters.svg

This file was deleted.

0 comments on commit 8f09b8f

Please sign in to comment.