[ACA-2952] Remove unnecessary build steps for dev-server start, add first bit of .env usage (#1379)

* [ACA-2952] Remove unnecessary build steps for dev-server start, add first bit of .env usage

* Fix doc owner
This commit is contained in:
Popovics András 2020-03-26 17:03:38 +01:00 committed by GitHub
parent 0cca87b382
commit 9a87564c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 18 deletions

2
.github/CODEOWNERS vendored
View File

@ -27,7 +27,7 @@ protractor.conf.js @adinapitul
# The `docs/*` pattern will match files like # The `docs/*` pattern will match files like
# `docs/getting-started.md` but not further nested files like # `docs/getting-started.md` but not further nested files like
# `docs/build-app/troubleshooting.md`. # `docs/build-app/troubleshooting.md`.
#docs/* docs@example.com docs/* @m-hulbert
# In this example, @octocat owns any file in an apps directory # In this example, @octocat owns any file in an apps directory
# anywhere in your repository. # anywhere in your repository.

1
.gitignore vendored
View File

@ -35,6 +35,7 @@ npm-debug.log
testem.log testem.log
/typings /typings
/www /www
.env
# e2e # e2e
/e2e/*.js /e2e/*.js

View File

@ -145,7 +145,7 @@
"browserTarget": "app:build", "browserTarget": "app:build",
"port": 4200, "port": 4200,
"host": "0.0.0.0", "host": "0.0.0.0",
"proxyConfig": "proxy.conf.js" "proxyConfig": "src/proxy.conf.js"
}, },
"configurations": { "configurations": {
"production": { "production": {

View File

@ -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. 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 ## 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. 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. **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. You must restart the application every time you change its settings.

6
package-lock.json generated
View File

@ -4065,6 +4065,12 @@
"is-obj": "^1.0.0" "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": { "duplexer3": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",

View File

@ -4,7 +4,7 @@
"license": "LGPL-3.0", "license": "LGPL-3.0",
"scripts": { "scripts": {
"ng": "ng", "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", "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: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", "build.shared": "ng build aca-shared",
@ -83,12 +83,13 @@
"@types/jasminewd2": "^2.0.2", "@types/jasminewd2": "^2.0.2",
"@types/node": "9.3.0", "@types/node": "9.3.0",
"@types/selenium-webdriver": "^3.0.8", "@types/selenium-webdriver": "^3.0.8",
"ajv-cli": "^3.0.0",
"adf-tslint-rules": "0.0.7", "adf-tslint-rules": "0.0.7",
"ajv-cli": "^3.0.0",
"chrome-remote-interface": "^0.26.1", "chrome-remote-interface": "^0.26.1",
"codelyzer": "^4.5.0", "codelyzer": "^4.5.0",
"cpr": "^3.0.1", "cpr": "^3.0.1",
"cspell": "^3.2.17", "cspell": "^3.2.17",
"dotenv": "6.2.0",
"husky": "^2.4.0", "husky": "^2.4.0",
"jasmine-core": "~2.8.0", "jasmine-core": "~2.8.0",
"jasmine-reporters": "^2.2.1", "jasmine-reporters": "^2.2.1",

View File

@ -1,6 +1,10 @@
require('dotenv').config();
const API_HOST_CONTENT = process.env.API_HOST_CONTENT || 'http://0.0.0.0:8080';
module.exports = { module.exports = {
'/alfresco': { '/alfresco': {
target: 'http://0.0.0.0:8080', target: API_HOST_CONTENT,
secure: false, secure: false,
changeOrigin: true, changeOrigin: true,
// workaround for REPO-2260 // workaround for REPO-2260
@ -10,5 +14,10 @@ module.exports = {
proxyRes.headers['www-authenticate'] = 'x' + header; proxyRes.headers['www-authenticate'] = 'x' + header;
} }
} }
},
'/auth': {
target: API_HOST_CONTENT,
secure: false,
changeOrigin: true
} }
}; };

View File

@ -1,31 +1,28 @@
{ {
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"baseUrl": "./",
"importHelpers": true, "importHelpers": true,
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"module": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"target": "es5", "target": "es5",
"resolveJsonModule": true,
"typeRoots": ["node_modules/@types"], "typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"], "lib": ["es2018", "dom"],
"module": "es2015",
"baseUrl": "./",
"paths": { "paths": {
"@alfresco/adf-office-services-ext": [ "@alfresco/aca-shared": ["projects/aca-shared/src/public-api.ts"],
"dist/@alfresco/adf-office-services-ext" "@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/*": [ "@alfresco/adf-office-services-ext": ["projects/adf-office-services-ext/src/public_api.ts"],
"dist/@alfresco/adf-office-services-ext/*" "@alfresco/adf-office-services-ext/*": ["projects/adf-office-services-ext/src/lib/*"]
], }
"@alfresco/aca-shared": ["dist/@alfresco/aca-shared"],
"@alfresco/aca-shared/*": ["dist/@alfresco/aca-shared/*"]
},
"resolveJsonModule": true
}, },
"exclude": ["node_modules"], "exclude": ["node_modules"],
"angularCompilerOptions": { "angularCompilerOptions": {