Skip to content

Commit

Permalink
Merge pull request #5333 from Gustry/package-json
Browse files Browse the repository at this point in the history
Restructuration package.json
  • Loading branch information
Gustry authored Feb 3, 2025
2 parents ae16ff1 + 943e68b commit 1f36624
Show file tree
Hide file tree
Showing 53 changed files with 4,642 additions and 3,936 deletions.
File renamed without changes.
7 changes: 4 additions & 3 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,16 @@ jobs:
with:
node-version: 21
cache: 'npm'
cache-dependency-path: ${{ github.workspace }}/tests/end2end/package.json
cache-dependency-path: ${{ github.workspace }}/package.json

- name: Install dependencies
working-directory: ./
run: |
cd end2end
npm ci
- name: Install Playwright
working-directory: tests/end2end
run: |
cd end2end
npx playwright install --with-deps chromium
- name: Run Playwright tests read-only
Expand Down Expand Up @@ -268,6 +268,7 @@ jobs:
if: success() || steps.test-playwright-read-only.conclusion == 'failure' || steps.test-playwright-not-read-only.conclusion == 'failure'
uses: cypress-io/[email protected]
with:
install: false
browser: chrome
headed: true
working-directory: tests/end2end
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ jobs:
node-version: 21

- name: Install lizmap dependencies
working-directory: assets
run: npm install

- name: Install tests dependencies
working-directory: tests/js-units
run: npm install

- name: Running tests
working-directory: tests/js-units
run: npm run js:test
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Build
build/
assets/node_modules/
node_modules/
assets/dist/
*.bundle.js

Expand Down Expand Up @@ -129,15 +129,19 @@ tests/qgis-projects/tests/*_attachments.zip
tests/qgis-server-plugins/*
!tests/qgis-server-plugins/upgrade_projects.py
tests/lizmap-qgis-plugin.master.zip
tests/end2end/node_modules/
tests/end2end/cypress/downloads/
tests/end2end/cypress/screenshots/
tests/js-units/node_modules/
tests/.env
tests/end2end/playwright-report/
tests/end2end/playwright/.auth
tests/end2end/test-results*

# Keep them a little bit, when we come back from a legacy branch, to be removed soon
tests/js-units/node_modules/
tests/end2end/node_modules/
assets/node_modules/


/.composer
/.npm

Expand Down
57 changes: 28 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## Getting in touch

- People working on Lizmap are available through email on the Lizmap mailing list
at https://lists.osgeo.org/pipermail/lizmap/
- We are also hanging out on #lizmap on https://libera.chat
* People working on Lizmap are available through email on :
* [Discourse](https://discourse.osgeo.org/c/qgis/lizmap/48)
* the [Lizmap mailing list](https://lists.osgeo.org/pipermail/lizmap/)
* We are also hanging out on #lizmap on https://libera.chat

## Localization and translation

Expand All @@ -14,7 +15,7 @@ The locale files (except for `en_US` language) are stored into the `lizmap/app/l
The files are `*.properties`. You can find [documentation about localizing Jelix](https://docs.jelix.org/en/manual-1.6/locales).

Locale files for `en_US` language are stored into modules directly (see `locales/`
directory into sub-directories of `lizmap/modules/`).
directory into subdirectories of `lizmap/modules/`).

Only modifications on `en_US` locales are accepted in Pull Requests.

Expand All @@ -23,11 +24,12 @@ Only modifications on `en_US` locales are accepted in Pull Requests.
All locales are translated with [Transifex](https://www.transifex.com/) with the **help of the opensource community**.
So to help us to translate, please go on Transifex, create an account and ask to join these projects :

- https://www.transifex.com/3liz-1/lizmap-locales/ to translate Lizmap Web Client and Lizmap QGIS plugin strings
- https://www.transifex.com/3liz-1/jelix/ to translate Jelix strings (the web framework used in Lizmap Web Client)
- https://www.transifex.com/3liz-1/lizmap-documentation/dashboard/ to translate the [documentation](https://docs.lizmap.com)
* [Lizmap-locales](https://www.transifex.com/3liz-1/lizmap-locales/) to translate Lizmap Web Client and Lizmap QGIS plugin strings
- [Jelix](https://www.transifex.com/3liz-1/jelix/) to translate Jelix strings (the web framework used in Lizmap Web Client)
- [Documentation](https://www.transifex.com/3liz-1/lizmap-documentation/) to translate the [documentation](https://docs.lizmap.com)

If the language is not yet available, you **request** the language on Transifex.
If the language is not yet available, you can **request** the language on Transifex.
Please check carefully existing languages before requesting a new one, about the language code. (with 2 or 4 characters).

For **core developers**, see the repository https://github.com/3liz/lizmap-locales/
and https://github.com/jelix/jelix-langpacks.
Expand Down Expand Up @@ -98,16 +100,15 @@ If you just want to modify and/or test the docker image of Lizmap (the

You need some developer tools in order to build and install dependencies.

* The cli version of PHP (prefered version: 7.4). Be sure that following extensions are also installed:
json, curl, mbstring, xml.
* [Composer](http://getcomposer.org), the package manager of PHP. You should have at least version 2.0.0
* Nodejs (we are using 12.x or 14.x) and npm:
* The CLI version of PHP. Be sure that following extensions are also installed:
`json`, `curl`, `mbstring`, `xml`.
* [Composer](http://getcomposer.org), the package manager of PHP.
* Nodejs and npm:
* with [binaries](https://nodejs.org/en/download/)
* or with the package manager for your Linux distribution, but prefer to install
directly from nodesource: https://github.com/nodesource/distributions/blob/master/README.md#debinstall
directly from [nodesource](https://github.com/nodesource/distributions/blob/master/README.md#debinstall)
* `Make` and `zip`.


### Building a zip with Javascript and PHP

- Run `make package` in your terminal.
Expand All @@ -120,23 +121,20 @@ You need some developer tools in order to build and install dependencies.

#### Requirements

* Install dependencies :
* `cd assets/`
* `npm install`

It creates a `assets/node_modules/` directory. Don't commit it into the git repository!
* Install dependencies with `npm install` in the root directory.

It creates a `node_modules/` directory. Don't commit it into the git repository!

#### Installation

* Build for production (minified JS files) :
`npm run build`
* From root directory : `npm run build`

Don't commit minified JS files into the git repository. They will be built by our
continuous integration and added into zip packages that are available on github.
continuous integration and added into zip packages that are available on GitHub.

* Build for development (source mapping, build is executed at every change on a JS file) :
`npm run watch`
* From root directory : `npm run watch`

Look at [webpack documentation](https://webpack.js.org/guides/development/) for other development options (e.g. live reloading)

Expand All @@ -158,27 +156,28 @@ Launch it at the root of the repository.
php-cs-fixer fix
```

Configuration of php-cs-fixer has been setup into .php-cs.dist.
Configuration of `php-cs-fixer` has been set up into `.php-cs.dist`.

### JavaScript

Please run `npm run pretest` in `assets/` directory and fix errors before any commit.
Please run `npm run pretest` in the root directory and fix errors before any commit.

## Issues

Go to https://github.com/3liz/lizmap-web-client/issues and post issues you find.
Go to [GitHub](https://github.com/3liz/lizmap-web-client/issues) and post issues you find.

## Testing your changes

Tests is highly recommended for any new commits. Tests can be provided with :
* End-to-end tests with Cypress

* End-to-end tests with Playwright
* PHP Unit tests
* Manual tests

You can test your changes, or you can launch unit tests, by running some
Docker containers. Go into tests/ and read the README.md file.
A docker-compose.yml file is provided, launching a full stack of softwares to
run Lizmap (nginx, php-fpm, qgis, postgresql...).
Docker containers. Go into `tests/` and read the [README.md](./tests/README.md) file.
A `docker-compose.yml` file is provided, launching a full stack of softwares to
run Lizmap (NGINX, PHP-FPM, QGIS, PostgreSQL...).

You can test with Android browsers in your Ubuntu Desktop thanks to [Anbox](https://docs.anbox.io/userguide/install.html#install-anbox).
For example, you can [download a x86 version of Firefox Mobile](https://ftp.mozilla.org/pub/mobile/) then
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ endif

build: debug
composer update --working-dir=lizmap/ --prefer-dist --no-ansi --no-interaction --no-dev --no-suggest --no-progress
cd assets/ && npm install
cd assets/ && npm run build
npm install
npm run build

tests: debug build
composer update --working-dir=tests/units/ --prefer-dist --no-ansi --no-interaction --no-dev --no-suggest --no-progress
Expand Down Expand Up @@ -208,7 +208,7 @@ version-doc:
sed -i "s@COMMIT_ID@$(COMMITID)@g" docs/index.html
sed -i "s@VERSION@$(FULL_VERSION)@g" docs/index.html
sed -i "s@DATE@$(DATE_VERSION)@g" docs/index.html
jq '.version = "$(FULL_VERSION)"' assets/package.json > "$tmp" && mv "$tmp" assets/package.json
jq '.version = "$(FULL_VERSION)"' package.json > "$tmp" && mv "$tmp" package.json

php-doc:
docker run --rm -v ${PWD}:/data phpdoc/phpdoc:3 -c docs/phpdoc.xml
Expand Down
24 changes: 1 addition & 23 deletions assets/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
{
"name": "assets",
"version": "1.0.0",
"description": "",
"description": "Modules & Component for Lizmap",
"type": "module",
"scripts": {
"build": "webpack --config webpack.prod.js",
"watch": "webpack --watch --config webpack.dev.js",
"pretest": "eslint src",
"pretest-fix": "eslint --fix src"
},
"devDependencies": {
"dompurify": "^3.1.6",
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^48.0.2",
"jsts": "^2.11.0",
"lit-html": "^3.1.1",
"ol": "^10.2.1",
"proj4": "^2.11.0",
"svg-sprite-loader": "^6.0.11",
"svgo": "^3.2.0",
"svgo-loader": "^4.0.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0"
},
"author": "3Liz",
"license": "ISC"
}
22 changes: 11 additions & 11 deletions assets/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ const __dirname = dirname(fileURLToPath(import.meta.url));

export default {
entry: {
lizmap: './src/index.js',
map: './src/legacy/map.js',
attributeTable: './src/legacy/attributeTable.js',
edition: './src/legacy/edition.js',
filter: './src/legacy/filter.js',
atlas: './src/legacy/atlas.js',
'switcher-layers-actions': './src/legacy/switcher-layers-actions.js',
timemanager: './src/legacy/timemanager.js',
view: './src/legacy/view.js',
'bottom-dock': './src/legacy/bottom-dock.js',
'map-projects': './src/legacy/map-projects.js',
lizmap: './assets/src/index.js',
map: './assets/src/legacy/map.js',
attributeTable: './assets/src/legacy/attributeTable.js',
edition: './assets/src/legacy/edition.js',
filter: './assets/src/legacy/filter.js',
atlas: './assets/src/legacy/atlas.js',
'switcher-layers-actions': './assets/src/legacy/switcher-layers-actions.js',
timemanager: './assets/src/legacy/timemanager.js',
view: './assets/src/legacy/view.js',
'bottom-dock': './assets/src/legacy/bottom-dock.js',
'map-projects': './assets/src/legacy/map-projects.js',
},
output: {
filename: '[name].js',
Expand Down
Loading

0 comments on commit 1f36624

Please sign in to comment.