diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dc0e090d5..4a91973be 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -27,7 +27,7 @@ protractor.conf.js @adinapitul # The `docs/*` pattern will match files like # `docs/getting-started.md` but not further nested files like # `docs/build-app/troubleshooting.md`. -#docs/* docs@example.com +docs/* @m-hulbert # In this example, @octocat owns any file in an apps directory # anywhere in your repository. diff --git a/.gitignore b/.gitignore index 3a5b6bbee..cc1f7647d 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ npm-debug.log testem.log /typings /www +.env # e2e /e2e/*.js diff --git a/angular.json b/angular.json index 7aa1053a0..06fa37332 100644 --- a/angular.json +++ b/angular.json @@ -145,7 +145,7 @@ "browserTarget": "app:build", "port": 4200, "host": "0.0.0.0", - "proxyConfig": "proxy.conf.js" + "proxyConfig": "src/proxy.conf.js" }, "configurations": { "production": { diff --git a/docs/getting-started/building-from-source.md b/docs/getting-started/building-from-source.md index 418522cef..32d9f4f7c 100644 --- a/docs/getting-started/building-from-source.md +++ b/docs/getting-started/building-from-source.md @@ -27,11 +27,19 @@ npm start The application runs at port `4200` by default, and should automatically open in the default browser once the project has compiled. +## Setting up environment variables + +You might need to set some environment variables to be able to run the local dev server. In the project's root folder, create a `.env` file (this is gitignored) with the following data: + +```bash +API_HOST_CONTENT="http://your-url-here" +``` + ## Proxy settings The Content App provides a proxy configuration for a local development server that allows you to address specific scenarios with CORS and a native authentication dialog. -You can find settings in the `proxy.conf.js` file in the project root directory. +You can find settings in the `proxy.conf.js` file in the project's `src` directory. By default, your settings coming from environment variables are preferenced. **Note:** The proxy settings get automatically applied every time you run the application with the `npm start` script. You must restart the application every time you change its settings. diff --git a/package-lock.json b/package-lock.json index 2124c0a3a..f3dffaa74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4065,6 +4065,12 @@ "is-obj": "^1.0.0" } }, + "dotenv": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz", + "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==", + "dev": true + }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", diff --git a/package.json b/package.json index adc8ab417..b34d419d4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "LGPL-3.0", "scripts": { "ng": "ng", - "start": "npm run validate-config && npm run build.extensions && ng serve --open", + "start": "npm run validate-config && ng serve --open", "start:prod": "npm run validate-config && node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng serve --prod --open", "build:aos-extension": "npx rimraf dist/@alfresco/adf-office-services-ext && ng build adf-office-services-ext && cpr projects/adf-office-services-ext/ngi.json dist/@alfresco/adf-office-services-ext/ngi.json && cpr projects/adf-office-services-ext/assets dist/@alfresco/adf-office-services-ext/assets", "build.shared": "ng build aca-shared", @@ -83,12 +83,13 @@ "@types/jasminewd2": "^2.0.2", "@types/node": "9.3.0", "@types/selenium-webdriver": "^3.0.8", - "ajv-cli": "^3.0.0", "adf-tslint-rules": "0.0.7", + "ajv-cli": "^3.0.0", "chrome-remote-interface": "^0.26.1", "codelyzer": "^4.5.0", "cpr": "^3.0.1", "cspell": "^3.2.17", + "dotenv": "6.2.0", "husky": "^2.4.0", "jasmine-core": "~2.8.0", "jasmine-reporters": "^2.2.1", diff --git a/proxy.conf.js b/src/proxy.conf.js similarity index 60% rename from proxy.conf.js rename to src/proxy.conf.js index 26a361bd3..f0aaf43ae 100644 --- a/proxy.conf.js +++ b/src/proxy.conf.js @@ -1,6 +1,10 @@ +require('dotenv').config(); + +const API_HOST_CONTENT = process.env.API_HOST_CONTENT || 'http://0.0.0.0:8080'; + module.exports = { '/alfresco': { - target: 'http://0.0.0.0:8080', + target: API_HOST_CONTENT, secure: false, changeOrigin: true, // workaround for REPO-2260 @@ -10,5 +14,10 @@ module.exports = { proxyRes.headers['www-authenticate'] = 'x' + header; } } + }, + '/auth': { + target: API_HOST_CONTENT, + secure: false, + changeOrigin: true } }; diff --git a/tsconfig.json b/tsconfig.json index 4c0b0800e..cd195d804 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,31 +1,28 @@ { "compileOnSave": false, "compilerOptions": { + "baseUrl": "./", "importHelpers": true, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, + "module": "es2015", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "noUnusedLocals": true, "noImplicitReturns": true, "target": "es5", + "resolveJsonModule": true, "typeRoots": ["node_modules/@types"], "lib": ["es2018", "dom"], - "module": "es2015", - "baseUrl": "./", "paths": { - "@alfresco/adf-office-services-ext": [ - "dist/@alfresco/adf-office-services-ext" - ], - "@alfresco/adf-office-services-ext/*": [ - "dist/@alfresco/adf-office-services-ext/*" - ], - "@alfresco/aca-shared": ["dist/@alfresco/aca-shared"], - "@alfresco/aca-shared/*": ["dist/@alfresco/aca-shared/*"] - }, - "resolveJsonModule": true + "@alfresco/aca-shared": ["projects/aca-shared/src/public-api.ts"], + "@alfresco/aca-shared/store": ["projects/aca-shared/store/src/public_api.ts"], + "@alfresco/aca-shared/rules": ["projects/aca-shared/rules/src/public_api.ts"], + "@alfresco/adf-office-services-ext": ["projects/adf-office-services-ext/src/public_api.ts"], + "@alfresco/adf-office-services-ext/*": ["projects/adf-office-services-ext/src/lib/*"] + } }, "exclude": ["node_modules"], "angularCompilerOptions": {