Skip to content

Commit

Permalink
Merge pull request #2542 from PVautour/develop
Browse files Browse the repository at this point in the history
Improvements to setup documentation
  • Loading branch information
PVautour authored Oct 15, 2024
2 parents 98c719d + 339e310 commit 3d3bb37
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 25 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ common/config/rush/pnpm-lock.yaml

**/packages/geoview-core/types
packages/geoview-core/public/docs/

.direnv/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ $ cd geoview
$ npm install -g @microsoft/rush
```

* Note: you can also use the included `shell.nix` to setup your dev environment if you are on Mac/Linux/WSL.

### Install dependencies

It's always recommended to run the below command if you pull any changes.
Expand Down
12 changes: 0 additions & 12 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
"summary": "Serves the page locally with hot-reload.",
"shellCommand": "npm run --prefix packages/geoview-core serve"
},
{
"commandKind": "global",
"name": "serve:mac",
"summary": "Serves the page locally with hot-reload for Mac users",
"shellCommand": "npm run --prefix packages/geoview-core serveMac"
},
{
"commandKind": "global",
"name": "host",
Expand All @@ -25,12 +19,6 @@
"summary": "Build the packages and move them to the dist directory",
"shellCommand": "npm run --prefix packages/geoview-core build"
},
{
"commandKind": "global",
"name": "build:mac",
"summary": "Build the packages and move them to the dist directory",
"shellCommand": "npm run --prefix packages/geoview-core buildMac"
},
{
"commandKind": "bulk",
"name": "build",
Expand Down
11 changes: 3 additions & 8 deletions packages/geoview-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@
"scripts": {
"serve": "npm run format && npm run fix && webpack serve --progress --color --config webpack.dev.js",
"build": "npm run format && npm run fix && npm run doc && webpack --progress --color --config webpack.prod.js && npm run generate.d.ts",
"serveMac": "npm run formatMac && npm run fixMac && webpack serve --progress --color --config webpack.dev.js",
"buildMac": "npm run formatMac && npm run fixMac && npm run doc && webpack --progress --color --config webpack.prod.js && npm run generate.d.ts",
"doc": "typedoc src/app.tsx --logLevel Error --out public/docs",
"deploy": "gh-pages -d dist",
"test": "jest",
"update_test": "jest --updateSnapshot",
"format": "prettier --write ../geoview-**/src/**/*.{ts,tsx,js}",
"lint": "eslint ../geoview-**/src/**/*.{ts,tsx,js}",
"fix": "eslint ../geoview-**/src/**/*.{ts,tsx,js} --fix",
"formatMac": "prettier --write '../geoview-**/src/**/*.{ts,tsx,js}'",
"lintMac": "eslint '../geoview-**/src/**/*.{ts,tsx,js}'",
"fixMac": "eslint '../geoview-**/src/**/*.{ts,tsx,js}' --fix",
"format": "prettier --write \"../geoview-**/src/**/*.{ts,tsx,js}\"",
"lint": "eslint \"../geoview-**/src/**/*.{ts,tsx,js}\"",
"fix": "eslint \"../geoview-**/src/**/*.{ts,tsx,js}\" --fix",
"generate.d.ts": "tsc --noEmit false --skipLibCheck true --declaration --allowJs --emitDeclarationOnly --outDir types"
},
"dependencies": {
Expand Down
10 changes: 5 additions & 5 deletions packages/geoview-core/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ async function fetchConfigFile(configUrl: string): Promise<string> {

/**
* Function to get a configuration from a div element who contains attributes to read from.
* If the div has one of the folllowing atttributes data-config, data-config-url or data-shared,
* it will try to get a valide configuration from the attribute content. If there is no such attributes,
* If the div has one of the following atttributes data-config, data-config-url or data-shared,
* it will try to get a valid configuration from the attribute content. If there is no such attributes,
* it will return a default config. If the data-geocore is present, it will inject the layer in the
* consifuration automatically
* configuration automatically.
*
* @param {Element} mapElement - Div map element with attributes
* @returns {Promise<TypeMapFeaturesConfig>} A promise who contains the caonfiguration to use
* @returns {Promise<TypeMapFeaturesConfig>} A promise that contains the configuration to use
*/
async function getMapConfig(mapElement: Element): Promise<TypeMapFeaturesConfig> {
// get language in wich we need to have the config file (if not provided, default to English)
const lang = mapElement.hasAttribute('data-lang') ? (mapElement.getAttribute('data-lang')! as TypeDisplayLanguage) : 'en';

// create a new config object and apply default
const lang = mapElement.hasAttribute('data-lang') ? (mapElement.getAttribute('data-lang')! as TypeDisplayLanguage) : 'en';
let mapConfig: MapFeatureConfig = api.config.getDefaultMapFeatureConfig(lang);

// check what type of config is provided (data-config, data-config-url or data-shared)
Expand Down
14 changes: 14 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
pkgs ? import <nixpkgs> { },
}:

pkgs.mkShell {
buildInputs = [
pkgs.nodejs
pkgs.nodePackages.rush
];

shellHook = ''
echo "Development environment ready. You can use 'rush' now."
'';
}

0 comments on commit 3d3bb37

Please sign in to comment.