Clean Makefile
This commit is contained in:
+2
-2
@@ -23,8 +23,8 @@ test:
|
|||||||
paths:
|
paths:
|
||||||
- node_modules
|
- node_modules
|
||||||
script:
|
script:
|
||||||
- make deps-install
|
- npm install
|
||||||
- make test
|
- npm run test
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
|
|||||||
+18
-15
@@ -15,6 +15,7 @@ You're welcome to contribute to the [code](#contributing-to-the-code) or to the
|
|||||||
- [Coding style](#coding-style)
|
- [Coding style](#coding-style)
|
||||||
- [Copyright notice](#copyright-notice)
|
- [Copyright notice](#copyright-notice)
|
||||||
- [Themes and unit tests](#themes-and-unit-tests)
|
- [Themes and unit tests](#themes-and-unit-tests)
|
||||||
|
- [Localized strings](#localized-strings)
|
||||||
- [Contributing to the translations](#contributing-to-the-translations)
|
- [Contributing to the translations](#contributing-to-the-translations)
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -24,23 +25,11 @@ You're welcome to contribute to the [code](#contributing-to-the-code) or to the
|
|||||||
You'll need `make` and [NPM](https://www.npmjs.com/) to install the development dependencies:
|
You'll need `make` and [NPM](https://www.npmjs.com/) to install the development dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make deps-install
|
npm install --save-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a new branch describing what your're working on, for example `feature/{name-of-the-feature}` or `theme/{name-of-the-theme}`.
|
Create a new branch describing what your're working on, for example `feature/{name-of-the-feature}` or `theme/{name-of-the-theme}`.
|
||||||
|
|
||||||
To make sure your code passes basic checks, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make test
|
|
||||||
```
|
|
||||||
|
|
||||||
If you modify localized strings, make your changed available for translation:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make pot
|
|
||||||
```
|
|
||||||
|
|
||||||
When you're done, commit all your changes and create a new merge request. Choose the appropriate merge request template.
|
When you're done, commit all your changes and create a new merge request. Choose the appropriate merge request template.
|
||||||
|
|
||||||
### Coding style
|
### Coding style
|
||||||
@@ -50,13 +39,19 @@ We follow the [GNOME Shell coding style](https://gitlab.gnome.org/GNOME/gnome-sh
|
|||||||
To make sure your code follows it:
|
To make sure your code follows it:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make test-lint
|
npm run test-lint
|
||||||
```
|
```
|
||||||
|
|
||||||
### Copyright notice
|
### Copyright notice
|
||||||
|
|
||||||
If you make changes to a file, please your copyright notice to the top of the file, or in a separate file (named `original-file.ext.license`), following the [SPDX specification](https://spdx.dev/).
|
If you make changes to a file, please your copyright notice to the top of the file, or in a separate file (named `original-file.ext.license`), following the [SPDX specification](https://spdx.dev/).
|
||||||
|
|
||||||
|
Run [`reuse`](https://reuse.software/) to check that all the needed information is present:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
reuse lint
|
||||||
|
```
|
||||||
|
|
||||||
### Themes and unit tests
|
### Themes and unit tests
|
||||||
|
|
||||||
If you add support for a theme, please write a unit test for each of its variants, in the `tests` directory, with the theme name as filename. Unit tests are written for [AVA](https://github.com/avajs/ava).
|
If you add support for a theme, please write a unit test for each of its variants, in the `tests` directory, with the theme name as filename. Unit tests are written for [AVA](https://github.com/avajs/ava).
|
||||||
@@ -64,7 +59,15 @@ If you add support for a theme, please write a unit test for each of its variant
|
|||||||
To run the tests:
|
To run the tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make test-variants
|
npm run test-variants
|
||||||
|
```
|
||||||
|
|
||||||
|
### Localized strings
|
||||||
|
|
||||||
|
If you modify localized strings, make your changes available for translation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make pot
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing to the translations
|
## Contributing to the translations
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: 2019-2021 Romain Vigier <contact AT romainvigier.fr>
|
# SPDX-FileCopyrightText: 2019-2021 Romain Vigier <contact AT romainvigier.fr>
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
COPYRIGHT_YEAR = 2019-2021
|
|
||||||
AUTHOR_NAME = Romain Vigier
|
|
||||||
AUTHOR_EMAIL =
|
|
||||||
|
|
||||||
NAME = $(shell grep '"name"' ./src/metadata.json | sed 's/\s"name":\s"\(.\+\)",\?/\1/')
|
NAME = $(shell grep '"name"' ./src/metadata.json | sed 's/\s"name":\s"\(.\+\)",\?/\1/')
|
||||||
UUID = $(shell grep '"uuid"' ./src/metadata.json | sed 's/\s"uuid":\s"\(.\+\)",\?/\1/')
|
UUID = $(shell grep '"uuid"' ./src/metadata.json | sed 's/\s"uuid":\s"\(.\+\)",\?/\1/')
|
||||||
@@ -11,9 +8,10 @@ VERSION = $(shell grep '"version"' ./src/metadata.json | sed 's/\s"version":\s\(
|
|||||||
|
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: build-clean
|
build:
|
||||||
mkdir -p ./build
|
mkdir -p ./build
|
||||||
gnome-extensions pack \
|
gnome-extensions pack \
|
||||||
|
--force \
|
||||||
--extra-source=../LICENSE \
|
--extra-source=../LICENSE \
|
||||||
--extra-source=./config.js \
|
--extra-source=./config.js \
|
||||||
--extra-source=./utils.js \
|
--extra-source=./utils.js \
|
||||||
@@ -27,70 +25,34 @@ build: build-clean
|
|||||||
--out-dir=./build \
|
--out-dir=./build \
|
||||||
./src
|
./src
|
||||||
|
|
||||||
.PHONY: build-clean
|
.PHONY: clean
|
||||||
build-clean:
|
build-clean:
|
||||||
-rm -rf ./build
|
-rm -rf ./build
|
||||||
find ./src/ -type f -name "*.ui~" -delete
|
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: uninstall
|
install: uninstall
|
||||||
gnome-extensions install ./build/$(UUID).shell-extension.zip
|
gnome-extensions install --force ./build/$(UUID).shell-extension.zip
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
-gnome-extensions uninstall $(UUID)
|
-gnome-extensions uninstall $(UUID)
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean: build-clean deps-clean
|
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: test-lint test-variants
|
test:
|
||||||
|
reuse lint
|
||||||
.PHONY: test-lint
|
|
||||||
test-lint:
|
|
||||||
npx eslint .
|
|
||||||
|
|
||||||
.PHONY: test-variants
|
|
||||||
test-variants:
|
|
||||||
cat ./src/modules/GtkVariants.js ./tests/gtk_themes/_variants.js.template > ./tests/gtk_themes/_variants.js
|
|
||||||
cat ./src/modules/ShellVariants.js ./tests/shell_themes/_variants.js.template > ./tests/shell_themes/_variants.js
|
|
||||||
npm run test
|
npm run test
|
||||||
|
|
||||||
.PHONY: deps-install
|
|
||||||
deps-install:
|
|
||||||
npm install
|
|
||||||
|
|
||||||
.PHONY: deps-clean
|
|
||||||
deps-clean:
|
|
||||||
-rm -rf ./node_modules
|
|
||||||
|
|
||||||
.PHONY: pot
|
.PHONY: pot
|
||||||
pot:
|
pot:
|
||||||
mkdir -p ./src/po
|
mkdir -p ./src/po
|
||||||
xgettext \
|
xgettext \
|
||||||
--from-code=UTF-8 \
|
--from-code=UTF-8 \
|
||||||
--keyword=_ \
|
|
||||||
--package-name="$(NAME)" \
|
--package-name="$(NAME)" \
|
||||||
--package-version="$(VERSION)" \
|
|
||||||
--output=./src/po/$(UUID).pot \
|
--output=./src/po/$(UUID).pot \
|
||||||
./src/*.js ./src/**/*.js ./src/schemas/*.xml ./src/preferences/ui/*.ui
|
./src/*.js ./src/**/*.js ./src/schemas/*.xml ./src/preferences/ui/*.ui
|
||||||
sed -i '1,4s/SOME DESCRIPTIVE TITLE./$(NAME)/g' ./src/po/$(UUID).pot
|
|
||||||
sed -i '1,4s/YEAR/$(COPYRIGHT_YEAR)/' ./src/po/$(UUID).pot
|
|
||||||
sed -i "1,4s/THE PACKAGE'S COPYRIGHT HOLDER/$(AUTHOR_NAME)/" ./src/po/$(UUID).pot
|
|
||||||
sed -i "1,4s/FIRST AUTHOR/$(AUTHOR_NAME)/" ./src/po/$(UUID).pot
|
|
||||||
sed -i "1,4s/EMAIL@ADDRESS/$(AUTHOR_EMAIL)/" ./src/po/$(UUID).pot
|
|
||||||
|
|
||||||
.PHONY: add-po
|
|
||||||
add-po:
|
|
||||||
ifdef LANGUAGE_CODE
|
|
||||||
msginit --no-translator --input=src/po/$(UUID).pot --output=src/po/$(LANGUAGE_CODE).po --locale=$(LANGUAGE_CODE)
|
|
||||||
else
|
|
||||||
@echo "Please specify the code of the language you want to add, for example:"
|
|
||||||
@echo " make add-po LANGUAGE_CODE=fr"
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: update-po
|
.PHONY: update-po
|
||||||
update-po:
|
update-po:
|
||||||
for po_file in $(wildcard ./src/po/*.po); do \
|
for po_file in $(wildcard ./src/po/*.po); do \
|
||||||
msgmerge --update --no-fuzzy-matching --backup=none $$po_file src/po/$(UUID).pot; \
|
msgmerge --update $$po_file src/po/$(UUID).pot; \
|
||||||
done
|
done
|
||||||
|
|||||||
+4
-1
@@ -5,7 +5,10 @@
|
|||||||
},
|
},
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "ava"
|
"test-lint": "eslint .",
|
||||||
|
"pretest-variants": "cat ./src/modules/GtkVariants.js ./tests/gtk_themes/_variants.js.template > ./tests/gtk_themes/_variants.js & cat ./src/modules/ShellVariants.js ./tests/shell_themes/_variants.js.template > ./tests/shell_themes/_variants.js",
|
||||||
|
"test-variants": "ava",
|
||||||
|
"test": "npm run test-lint && npm run test-variants"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^3.13.0",
|
"ava": "^3.13.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user