Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove enabled configuration option #147

Merged
merged 1 commit into from
May 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 5 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,15 @@ module.exports = {

this.addonBuildConfig = this.app.options['ember-web-app'] || {};

if (!this._disabled()) {
this._configureFingerprint();
this.manifestConfiguration = getManifestConfiguration(
this.app.project,
this.app.env
);
}
this._configureFingerprint();
this.manifestConfiguration = getManifestConfiguration(
this.app.project,
this.app.env
);

this._super.included.apply(this, arguments);
},

treeFor() {
if (this._disabled()) {
return;
}

return this._super.treeFor.apply(this, arguments);
},

treeForPublic() {
const configPath = path.join(this.app.project.root, 'config');

Expand All @@ -66,10 +56,6 @@ module.exports = {
},

contentFor(section, config) {
if (this._disabled()) {
return;
}

if (section === 'head') {
let tags = [];

Expand Down Expand Up @@ -121,8 +107,4 @@ module.exports = {
BROWSERCONFIG_NAME
);
},

_disabled() {
return this.addonBuildConfig.enabled === false;
},
};
23 changes: 0 additions & 23 deletions node-tests/acceptance/browserconfig-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,6 @@ describe('Acceptance: browserconfig file generation', function() {
.then(assertJSON(app, { 'pio.png': 'pio-0987654321.png' }));
});

it(`doesn't generate browserconfig when disabled`, function() {
return app
.create('disabled', {
fixturesPath: 'node-tests/acceptance/fixtures',
})
.then(function() {
return app.runEmberCommand('build');
})
.then(function() {
assert.ok(
!fs.existsSync(app.filePath('dist/browserconfig.xml')),
`Doesn't generate browserconfig.xml file`
);
})
.then(contentOf(app, 'dist/index.html'))
.then(function(content) {
assert.ok(
!content.includes('msapplication-config'),
`Doesn't include meta tags`
);
});
});

it(`doesn't generate browserconfig when 'ms' is falsey`, function() {
return app
.create('no-ms', {
Expand Down
11 changes: 0 additions & 11 deletions node-tests/acceptance/fixtures/disabled/config/manifest.js

This file was deleted.

13 changes: 0 additions & 13 deletions node-tests/acceptance/fixtures/disabled/ember-cli-build.js

This file was deleted.

Binary file not shown.
23 changes: 0 additions & 23 deletions node-tests/acceptance/manifest-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,6 @@ describe('Acceptance: manifest file generation', function() {
.then(assertJSON(app, { 'pio.png': 'pio-0987654321.png' }));
});

it(`doesn't generate manifest when disabled`, function() {
return app
.create('disabled', {
fixturesPath: 'node-tests/acceptance/fixtures',
})
.then(function() {
return app.runEmberCommand('build');
})
.then(function() {
assert.ok(
!fs.existsSync(app.filePath('dist/manifest.webmanifest')),
`Doesn't generate manifest.webmanifest file`
);
})
.then(contentOf(app, 'dist/index.html'))
.then(function(content) {
assert.ok(
!content.includes('apple-touch-icon'),
`Doesn't include meta tags`
);
});
});

it('uses rootURL configuration', function() {
return app
.create('config-root-url', {
Expand Down
15 changes: 0 additions & 15 deletions node-tests/unit/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ function createIndex() {
display: 'standalone',
},
addonBuildConfig: {},
_disabled() {
return false;
},
});
}

Expand Down Expand Up @@ -66,18 +63,6 @@ describe('Unit: index', function() {
assert.ok(index.contentFor('head', { rootURL: '/' }).includes(expected));
});

it('returns empty meta tags when disabled', function() {
let index = createIndex();
index._disabled = function() {
return true;
};

assert.ok(
!index.contentFor('head', { rootURL: '/' }),
"Doesn't include meta tags when disabled"
);
});

it('returns safari pinned tab link tags', function() {
let expected = '<link rel="mask-icon" href="/foo/bar.svg" color="red">';
let index = createIndex();
Expand Down
21 changes: 0 additions & 21 deletions tests/dummy/app/templates/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ See the documentation section below for more information.
- [Example](#example)
- [Configuration](#configuration)
- [CORS](#cors)
- [Disable](#disable)
- [Fingerprint](#fingerprint)
- [API Documentation](#api-documentation)
- [`name`](#name)
Expand Down Expand Up @@ -205,26 +204,6 @@ module.exports = function(defaults) {
};
```

### Disable

You can disable the addon by adding a configuration option to `ember-cli-build.js` build file.

```js
const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
let options = {
'ember-web-app': {
enabled: false,
},
};

let app = new EmberApp(defaults, options);

return app.toTree();
};
```

### Fingerprint

You can add fingerprint checksum to your `manifest.webmanifest` file by configuring [broccoli-asset-rev](https://github.com/rickharrison/broccoli-asset-rev) in `ember-cli-build.js`.
Expand Down