diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..d7568adf6 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 20.11.1 diff --git a/README.md b/README.md index 398cb4e65..213b25f3d 100644 --- a/README.md +++ b/README.md @@ -319,6 +319,11 @@ That [NPM script](./instance/package.json) will run the `mage.service` script fr [configuration](./instance/config.js) from the instance directory. You can modify that configuration to suit your needs. +## Local development + +These steps will ensure all necessary packages are installed and built correctly. This will also ensure that changes are applied in real time, rather than having to rebuild packages and restart the instance. First, ensure you have the correct version of node installed as mentioned above. From the root directory, run 'npm run install'. This will install all of the necessary node_modules for each app. If there is an additional plugin you would like to install packages for, see the 'postinstall' script and make adjustments there. +Next, run 'npm run build:local' + ### Local runtime issues You may run into some problems running the Mage instance from your working tree due to NPM's dependency installation diff --git a/local-dev.sh b/local-dev.sh new file mode 100755 index 000000000..4d3acb1e4 --- /dev/null +++ b/local-dev.sh @@ -0,0 +1,15 @@ +case $1 in + stop-watch ) + echo "stopping builds running with watch..." + watchPIDS="" + watchPIDS=$(ps aux | grep -- '--watch' | grep -v grep | awk '{print $2}') + echo "found pids with watch: {$watchPIDS}" + if [ -z "$watchPIDS" ]; then + echo "No watch processes were found." + else + echo "Killing PIDs: $watchPIDS" + kill $watchPIDS + echo "watch builds have been stopped." + fi +esac + diff --git a/package-lock.json b/package-lock.json index 949c5a76c..21036ce2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "@ngageoint/mage.project", "version": "6.3.0-beta.6", + "hasInstallScript": true, "devDependencies": { "npm-run-all": "^4.1.5" } diff --git a/package.json b/package.json index 4df4a9b00..b924b17c3 100644 --- a/package.json +++ b/package.json @@ -5,17 +5,20 @@ "version": "6.3.0-beta.6", "files": [], "scripts": { - "postinstall": "npm-run-all service:ci web-app:ci image.service:ci nga-msi:ci", + "postinstall": "npm-run-all service:ci web-app:ci image.service:ci nga-msi:ci arc-web:install arc-service:install", "install:resolve": "npm-run-all service:install web-app:install image.service:install nga-msi:install", - "build": "npm-run-all service:build web-app:build image.service:build nga-msi:build instance:build", + "build": "npm-run-all service:build web-app:build image.service:build nga-msi:build instance:build arc-service:build arc-web:build", + "build:local": "npm-run-all service:build-local web-app:build-local arc-service:build-local arc-web:build-local instance:build", "pack-all": "npm-run-all service:pack web-app:pack image.service:pack nga-msi:pack", "service:install": "npm install --prefix service", "service:ci": "npm ci --prefix service", "service:build": "npm run build --prefix service", + "service:build-local": "npm run build:local --prefix service", "service:pack": "npm pack ./service", "web-app:install": "npm install --prefix web-app", "web-app:ci": "npm ci --prefix web-app", "web-app:build": "npm run build --prefix web-app", + "web-app:build-local": "npm run build:local --prefix web-app", "web-app:debug": "npm start --prefix web-app", "web-app:pack": "npm pack ./web-app/dist/app", "instance:build": "npm install --prefix instance", @@ -29,6 +32,12 @@ "nga-msi:ci": "npm ci --prefix plugins/nga-msi", "nga-msi:build": "npm run build --prefix plugins/nga-msi", "nga-msi:pack": "npm pack ./plugins/nga-msi", + "arc-web:install": "npm install --prefix plugins/arcgis/web-app", + "arc-web:build-local": "cd plugins/arcgis/web-app && npm run build:local", + "arc-web:build": "npm run build --prefix plugins/arcgis/web-app", + "arc-service:install": "npm install --prefix plugins/arcgis/service", + "arc-service:build-local": "cd plugins/arcgis/service && npm run build:local", + "arc-service:build": "npm run build --prefix plugins/arcgis/service", "start": "npm run instance:start-env", "start-web": "npm run web-app:debug" }, diff --git a/plugins/arcgis/service/package-lock.json b/plugins/arcgis/service/package-lock.json index 4b696144d..63e7f2c65 100644 --- a/plugins/arcgis/service/package-lock.json +++ b/plugins/arcgis/service/package-lock.json @@ -26,7 +26,7 @@ "typescript": "^4.6.3" }, "peerDependencies": { - "@ngageoint/mage.service": "^6.2.9 || ^6.3.0-beta", + "@ngageoint/mage.service": "^6.2.13 || ^6.3.0-beta", "express": "^4.17.0" } }, diff --git a/plugins/arcgis/service/package.json b/plugins/arcgis/service/package.json index 6d18e5827..72306f3be 100644 --- a/plugins/arcgis/service/package.json +++ b/plugins/arcgis/service/package.json @@ -14,6 +14,7 @@ "scripts": { "build:tsc": "tsc -b src", "build": "npm-run-all build:tsc", + "build:local": "npm link ../../../service && tsc -b src --watch &", "test:run": "jest lib", "test": "npm-run-all build test:run", "clean": "rm -rf lib" @@ -44,7 +45,7 @@ "form-data": "^4.0.1" }, "peerDependencies": { - "@ngageoint/mage.service": "^6.2.9 || ^6.3.0-beta", + "@ngageoint/mage.service": "^6.2.13 || ^6.3.0-beta", "express": "^4.17.0" }, "devDependencies": { diff --git a/plugins/arcgis/web-app/package-lock.json b/plugins/arcgis/web-app/package-lock.json index 020393389..49f9b6878 100644 --- a/plugins/arcgis/web-app/package-lock.json +++ b/plugins/arcgis/web-app/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@ngageoint/mage.arcgis.web-app.workspace", + "name": "@ngageoint/mage.arcgis.web-app", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@ngageoint/mage.arcgis.web-app.workspace", + "name": "@ngageoint/mage.arcgis.web-app", "version": "1.0.0", "dependencies": { "@angular/animations": "^14.3.0", diff --git a/plugins/arcgis/web-app/package.json b/plugins/arcgis/web-app/package.json index a30995220..d33e9754b 100644 --- a/plugins/arcgis/web-app/package.json +++ b/plugins/arcgis/web-app/package.json @@ -5,6 +5,7 @@ "ng": "ng", "start": "ng serve", "build": "npm-run-all build:main", + "build:local": "npm link ../../../web-app && ng build --project=main --watch &", "build:main": "ng build --project=main", "test": "ng test --project=main", "test-headless": "ng test --watch=false --browsers=ChromeHeadless --project=main", diff --git a/service/package.json b/service/package.json index b2c1794da..3356b2256 100644 --- a/service/package.json +++ b/service/package.json @@ -152,6 +152,7 @@ }, "scripts": { "build:compile": "tsc -b src", + "build:compile-local": "tsc -b src --watch &", "build:copy_assets": "cpy --cwd=src './assets/**/*' '../lib/assets/'", "build:copy_docs": "cpy --cwd=src './docs/**/*' '../lib/docs/'", "build:copy_package": "cpy --rename=dist-package.json 'package.json' 'lib'", @@ -159,6 +160,7 @@ "build:copy_views": "cpy --cwd=src './views/**/*' '../lib/views/'", "build:after_compile": "npm-run-all build:copy_assets build:copy_types build:copy_docs build:copy_package build:copy_views", "build": "npm-run-all build:compile build:after_compile", + "build:local": "npm-run-all build:compile-local build:copy_assets", "test:compile": "tsc -b test", "test:copy_resources": "cpy --cwd=test 'environment/*.pem' '../test-lib/environment/'", "test:copy_node_modules": "cpy --cwd=test 'node_modules/**/*' '../test-lib/node_modules/'", diff --git a/web-app/package.json b/web-app/package.json index 9cfc7d595..9cc6e3b9f 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -30,9 +30,12 @@ "start:app": "ng serve --project=app --configuration development", "start:admin": "ng serve --project=admin --configuration development", "build": "npm-run-all clean build:core-lib build:app:dev build:admin:dev combine", + "build:local": "npm-run-all clean build:core-lib build:app:dev-local build:admin:dev-local combine", "build:prod": "npm-run-all clean build:core-lib build:app:prod build:admin:prod combine", "build:app:dev": "ng build --project=app --configuration development", + "build:app:dev-local": "ng build --project=app --configuration development --watch &", "build:admin:dev": "ng build --project=admin --configuration development", + "build:admin:dev-local": "ng build --project=admin --configuration development --watch &", "build:app:prod": "ng build --project=app --configuration production", "build:admin:prod": "ng build --project=admin --configuration production", "build:core-lib": "npm-run-all build:core-lib:*",