chore: 🤖 add app-name helper for env-var configured app name
This commit is contained in:
8 files changed
+39
-6
No files matched your search
@@ -3,6 +3,8 @@
|
||||
module.exports = {
|
||||
extends: 'octane',
|
||||
rules: {
|
||||
'no-bare-strings': true
|
||||
'no-bare-strings': true,
|
||||
'no-curly-component-invocation': { allow: ['app-name'] },
|
||||
'no-implicit-this': { allow: ['app-name'] }
|
||||
}
|
||||
};
|
||||
+11
-3
@@ -8,11 +8,11 @@ The core UI for Project Watchtower.
|
||||
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Installation](#installation)
|
||||
- [Yarn Commands](#yarn-commands)
|
||||
- [Running / Development](#running--development)
|
||||
- [Code Generators](#code-generators)
|
||||
- [Running Tests](#running-tests)
|
||||
- [Linting](#linting)
|
||||
- [Building](#building)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Running Tests](#running-tests)
|
||||
- [Deploying](#deploying)
|
||||
- [Further Reading / Useful Links](#further-reading--useful-links)
|
||||
|
||||
@@ -65,6 +65,14 @@ To build the project, without running it, execute one of the following commands:
|
||||
* `yarn run build` (development)
|
||||
* `yarn run build:production` (production)
|
||||
|
||||
#### Environment Variables
|
||||
|
||||
These environment variables may be used to customized the build.
|
||||
|
||||
| Variable | Default Value | Description |
|
||||
| -------- | ------------- | ----------- |
|
||||
| `APP_NAME` | Application Name | The user-facing name of the application, appearing in titles, etc. |
|
||||
|
||||
### Running Tests
|
||||
|
||||
* `npm test` runs full tests in random order with coverage
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,6 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import config from '../config/environment';
|
||||
|
||||
export default helper(function appName() {
|
||||
return config.appName;
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
<HeadLayout />
|
||||
|
||||
{{title (t 'app.name')}}
|
||||
{{title (app-name)}}
|
||||
|
||||
{{outlet}}
|
||||
@@ -1 +1 @@
|
||||
<h1>{{t 'app.name'}}</h1>
|
||||
<h1>{{app-name}}</h1>
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const APP_NAME = process.env.APP_NAME || 'Application Name';
|
||||
|
||||
module.exports = function (environment) {
|
||||
let ENV = {
|
||||
modulePrefix: 'core',
|
||||
@@ -23,6 +25,8 @@ module.exports = function (environment) {
|
||||
// when it is created
|
||||
},
|
||||
|
||||
appName: APP_NAME,
|
||||
|
||||
contentSecurityPolicyHeader: 'Content-Security-Policy',
|
||||
contentSecurityPolicyMeta: true,
|
||||
contentSecurityPolicy: {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Helper | app-name', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function(assert) {
|
||||
await render(hbs`{{app-name}}`);
|
||||
assert.equal(this.element.textContent.trim(), 'Application Name');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user