Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit 35d5306

Browse files
committed
Add build script
1 parent d32c549 commit 35d5306

File tree

4 files changed

+88
-30
lines changed

4 files changed

+88
-30
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
web-ext-artifacts/
1+
web-ext-artifacts/
2+
manifest.json
3+
__pycache__/

manifest.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

scripts/manage.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import subprocess
2+
import argparse
3+
import settings
4+
import json
5+
6+
7+
def create_manifest_file(target):
8+
data = settings.MANIFEST_FILE
9+
10+
if target == 'firefox':
11+
data['browser_specific_settings'] = {
12+
'gecko': {
13+
14+
'strict_min_version': '57.0'
15+
}
16+
}
17+
18+
with open('manifest.json', 'w', encoding='utf-8') as f:
19+
json.dump(data, f, indent=2)
20+
21+
22+
def switch(target):
23+
create_manifest_file(target)
24+
25+
26+
def build(target):
27+
switch(target)
28+
29+
arguments = [
30+
'web-ext',
31+
'build',
32+
'--overwrite-dest',
33+
'--ignore-files',
34+
]
35+
36+
arguments.extend(settings.FILES_AND_DIRECTORIES_TO_IGNORE_WHEN_BUILDING)
37+
38+
subprocess.run(arguments, shell=True)
39+
40+
41+
def run():
42+
arg_parser = argparse.ArgumentParser()
43+
arg_parser.add_argument('action', choices=['build', 'switch'])
44+
arg_parser.add_argument('target', choices=['firefox', 'chrome'])
45+
46+
args = arg_parser.parse_args()
47+
48+
if args.action == 'build':
49+
build(args.target)
50+
elif args.action == 'switch':
51+
switch(args.target)
52+
53+
if __name__ == '__main__':
54+
run()

scripts/settings.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
MANIFEST_FILE = {
2+
'manifest_version': 2,
3+
'name': 'GitLab Merge Requests lists enhancer',
4+
'version': '1.0.0',
5+
'description': 'An extension that enhance all Merge Requests lists on any instance of Gitlab and GitLab.com',
6+
'homepage_url': 'https://github.com/EpocDotFr/gitlab-merge-requests-lists-enhancer',
7+
'author': 'Maxime \'Epoc\' G.',
8+
'icons': {
9+
'16': 'images/logo_16.png',
10+
'48': 'images/logo_48.png',
11+
'96': 'images/logo_96.png',
12+
'128': 'images/logo_128.png'
13+
},
14+
'content_scripts': [
15+
{
16+
'matches': ['*://*/*/*/-/merge_requests', '*://*/*/*/-/merge_requests?*'],
17+
'js': ['js/content.js']
18+
}
19+
],
20+
'permissions': [
21+
'*://*/*/*/-/merge_requests', '*://*/*/*/-/merge_requests?*'
22+
]
23+
}
24+
25+
FILES_AND_DIRECTORIES_TO_IGNORE_WHEN_BUILDING = [
26+
'scripts',
27+
'web-ext-artifacts',
28+
'LICENSE.md',
29+
'README.md',
30+
'screenshot.png',
31+
]

0 commit comments

Comments
 (0)