Skip to content

add: contentFor types deprecation guide #1397

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
@models={{array 'ember-cli' 'v5.x'}}
>v5.x</LinkTo>
</li>
<li class='list-unstyled' data-test-ember-cli-6-link>
<LinkTo
@route='show'
@models={{array 'ember-cli' 'v6.x'}}
>v6.x</LinkTo>
</li>
</ul>
</li>
<li class='item list-unstyled'>
Expand Down
32 changes: 32 additions & 0 deletions content/ember-cli/v6/v1-addon-content-for-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: V1 addon contentFor types
since: 6.3.0
until: 7.0.0
---
`app-prefix`, `app-suffix`, `tests-prefix`, and `tests-suffix` are deprecated as types passed to `contentFor`. See [RFC 1029](https://rfcs.emberjs.com/id/1029-deprecate-app-prefix) for more information.

#### app-prefix

Returning content from an addon's `contentFor()` hook for `type="app-prefix"` is deprecated. Addons will no longer be allowed to inject arbitrary javascript here. If you need to provide code that apps will run before booting, document that app authors should import and call your code at the start of their own `app.js` file.

#### app-suffix

Returning content from an addon's `contentFor()` hook for `type="app-suffix"` is deprecated. Addons will no longer be allowed to inject arbitrary javascript here. If you need to provide code that apps will run before booting, document that app authors should import and call your code at the start of their own `app.js` file.

If you were using app-suffix to overwrites modules provided by the app, that is intentionally not supported. Adjust your API to tell app authors to import your code and invoke it where appropriate.

#### tests-prefix

Returning content from an addon's `contentFor()` hook for `type="tests-prefix"` is deprecated. Addons will no longer be allowed to inject arbitrary javascript here. Provide utilities that users can import into their own test setup code instead.

#### tests-suffix

Returning content from an addon's `contentFor()` hook for `type="tests-suffix"` is deprecated. Addons will no longer be allowed to inject arbitrary javascript here. Provide utilities that users can import into their own test setup code instead.

#### vendor-prefix

Returning content from an addon's `contentFor()` hook for `type="vendor-prefix"` is deprecated. Addons will no longer be allowed to inject arbitrary javascript here. If you really need to run script (non-module) code, provides your own script via your addon's `/public` directory and either document that app authors should createa a `<script>` element in their HTML that includes it, or use `contentFor()` with one of the `type`s that appears in `index.html` to emit the scrip tag automatically. (`contentFor` targeting HTML is not deprecated, this deprecation only covers targeting javascript bundles.)

#### vendor-suffix

Returning content from an addon's `contentFor()` hook for `type="vendor-suffix"` is deprecated. Addons will no longer be allowed to inject arbitrary javascript here. If you really need to run script (non-module) code, provides your own script via your addon's `/public` directory and either document that app authors should createa a `<script>` element in their HTML that includes it, or use `contentFor()` with one of the `type`s that appears in `index.html` to emit the scrip tag automatically. (`contentFor` targeting HTML is not deprecated, this deprecation only covers targeting javascript bundles.)
1 change: 1 addition & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = function (defaults) {
'/ember-cli/v2.x',
'/ember-cli/v4.x',
'/ember-cli/v5.x',
'/ember-cli/v6.x',
...getDeprecationFilenames(),
],
},
Expand Down
1 change: 1 addition & 0 deletions lib/content-docs-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const contentFolders = [
'ember-cli/v2',
'ember-cli/v4',
'ember-cli/v5',
'ember-cli/v6',
];

const jsonTrees = contentFolders.map(
Expand Down
10 changes: 10 additions & 0 deletions tests/acceptance/visual-regression-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ module('Acceptance | visual regression', function (hooks) {

await percySnapshot('ember-cli-5.x');

// v6.x Ember CLI
await click('[data-test-main-deprecations-link]');
await click('[data-test-ember-cli-6-link] > a');

assert
.dom('[data-test-deprecations-added-in]')
.hasText('Deprecations Added in Ember CLI 6.x');

await percySnapshot('ember-cli-6.x');

// v5.x Ember
await click('[data-test-main-deprecations-link]');
await click('[data-test-ember-5-link] > a');
Expand Down