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

Make individual pages for deprecations #1261

Merged
merged 13 commits into from
Jun 9, 2023
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,19 @@ module.exports = {
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
{
// mocha tests
files: ['node-tests/**/*.mjs'],
env: {
browser: false,
node: true,
mocha: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
rules: {
'node/no-unpublished-import': 'off',
},
},
],
};
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

40 changes: 4 additions & 36 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,10 @@
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import { inject as service } from '@ember/service';
import config from 'deprecation-app/config/environment';

export default class ApplicationAdapter extends JSONAPIAdapter {
@service fastboot;

/**
* FastBoot shouldn't know the host since we use prember
* & it can't find the resources at the API host during build time.
*/
get host() {
let isFastBoot = this.fastboot.isFastBoot;
return isFastBoot ? '' : config.apiHost;
urlForFindRecord(id, modelName) {
return `/${modelName}/${id}.json`;
}

buildURL(modelName, id, snapshot, requestType, query) {
let url;

if (requestType === 'queryRecord') {
url = [modelName, `${query.path}.json`];
} else if (requestType === 'query') {
url = [modelName, `${query.path}-${query.version}.json`];
} else {
return this.super;
}

let host = this.host;
let prefix = this.urlPrefix();

if (prefix) {
url.unshift(prefix);
}

url = url.join('/');
if (!host && url && url.charAt(0) !== '/') {
url = '/' + url;
}

return url;
urlForQuery(query, modelName) {
return `/${modelName}/${query.path}-${query.version}.json`;
}
}
7 changes: 0 additions & 7 deletions app/controllers/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ export default class ShowController extends Controller {
return PROJECTS[this.content.query.path];
}

get renderIdOrUntil() {
let version = this.content.query.version;
let versionsWithoutId = ['v1.x'];

return !versionsWithoutId.includes(version);
}

@action
toggleToc() {
this.displayMobileToc = !this.displayMobileToc;
Expand Down
6 changes: 6 additions & 0 deletions app/models/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ export default class ContentModel extends Model {
@attr until;
@attr since;
@attr anchor;
@attr displayId;

// v1 has different meta, so conditionally render it
get renderUntil() {
return !this.since.startsWith('1.');
}
}
2 changes: 2 additions & 0 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ Router.map(function () {
this.route('show', {
path: ':project/:version',
});

this.route('id', { path: 'id/:id' });
});
10 changes: 10 additions & 0 deletions app/routes/id.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class IdPRoute extends Route {
@service store;

model(params) {
return this.store.findRecord('content', params.id);
}
}
6 changes: 5 additions & 1 deletion app/serializers/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import JSONAPISerializer from '@ember-data/serializer/json-api';

export default class ApplicationSerializer extends JSONAPISerializer {}
export default class ApplicationSerializer extends JSONAPISerializer {
keyForAttribute(key) {
return key;
}
}
17 changes: 3 additions & 14 deletions app/templates/components/deprecation-article.hbs
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
<div class="padding-vertical-small bg-light-muted rounded-sm">
<h3 id="{{id-for-deprecation @model.id @model.anchor}}">
<a href="#{{id-for-deprecation @model.id @model.anchor}}" title={{@model.title}} class="toc-anchor">
§
</a>
{{markdown-to-html
@model.title
extensions="no-wrapper"
tagName=""
}}
</h3>
{{yield}}
<div class="my-2">
{{#if @renderIdOrUntil}}
{{#if @model.renderUntil}}
<div><span class="bold">until: </span>{{@model.until}}</div>
{{/if}}
{{#if @renderIdOrUntil}}
<div><span class="bold">id: </span>{{@model.id}}</div>
<div><span class="bold">id: </span>{{or @model.displayId @model.id}}</div>
{{/if}}
</div>
<section>
Expand Down
13 changes: 12 additions & 1 deletion app/templates/components/main-layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@
{{#each @sortedGroupedResults as |result|}}
<h2 class="anchorable-toc rounded-lg padding-small">Deprecations Added in {{result.since}} </h2>
{{#each result.contents as |content|}}
<DeprecationArticle @model={{content}} @renderIdOrUntil={{@renderIdOrUntil}} />
<DeprecationArticle @model={{content}}>
<h3 id="{{id-for-deprecation (or content.displayId content.id) content.anchor}}">
<a href="#{{id-for-deprecation (or content.displayId content.id) content.anchor}}" title={{content.title}} class="toc-anchor">
§
</a>
{{markdown-to-html
content.title
extensions="no-wrapper"
tagName=""
}}
</h3>
</DeprecationArticle>
{{/each}}
{{/each}}
{{/if}}
Expand Down
13 changes: 13 additions & 0 deletions app/templates/id.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{page-title @model.title}}
<LinkTo @route="index">&laquo; All deprecation guides</LinkTo>
<h1>
Deprecation Guide for
{{markdown-to-html
@model.title
extensions="no-wrapper"
tagName=""
}}
</h1>
<DeprecationArticle @model={{@model}} />

{{outlet}}
1 change: 0 additions & 1 deletion app/templates/show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
@sortedGroupedResults={{@model.sorted}}
@version={{this.version}}
@project={{this.project}}
@renderIdOrUntil={{this.renderIdOrUntil}}
@displayMobileToc={{this.displayMobileToc}}
/>
</div>
5 changes: 0 additions & 5 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ module.exports = function (environment) {

if (environment === 'production') {
// here you can enable a production-specific feature

let fastlyDomain = process.env.FASTLY_DOMAIN;
if (fastlyDomain) {
ENV.apiHost = `https://${fastlyDomain}`;
}
}

return ENV;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
id: base-url
title: Base URL
until: '3.0.0'
since: '2.7.0'
until: 3.0.0
since: 2.7.0
---


The usage of `baseURL` setting in `config/environments.js` has been deprecated in favor of using
an explicit `rootURL`. A detailed explanation of the problem and the migration path can be found in
[this blog post](/blog/2016/04/28/baseURL.html).
Expand Down
4 changes: 2 additions & 2 deletions content/ember-cli/v2/clobbering-addon-options.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
id: clobbering-addon-options
title: Clobbering Addon#options
since: '2.12.0'
since: 2.12.0
---


Clobbering `this.options` within an addon has been deprecated. If you would like to use `this.options`
for internal options within your addon, you must preserve the intitial options object that is present.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
id: deprecate-utility
title: Deprecate Utility
until: '3.0.0'
since: '2.2.0'
until: 3.0.0
since: 2.2.0
---


Using the `ember-cli/lib/utlities/deprecate` module to issue deprecations has been deprecated
in favor of using `.writeDeprecateLine` method on the `ui` object (which is available on both
addons and project instances).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
id: migrate-from-brocfile-js-to-ember-cli-build-js
title: Migrate from Brocfile.js to ember-cli-build.js
until: '3.0.0'
since: '2.0.0'
until: 3.0.0
since: 2.0.0
---


Early versions of Ember CLI utilized the default build file of Broccoli: `Brocfile.js`. Over time
we began realizing that this was not a tenable solution (we could not pass high fidelity objects
into the build pipeline, and therefore created two instances of all addons, etc), and introduced a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: ember-cli.blacklist-whitelist-build-options
title: blacklist and whitelist build options
until: '5.0.0'
since: '4.4.0'
until: 5.0.0
since: 4.4.0
displayId: ember-cli.blacklist-whitelist-build-options
---


Using the `blacklist` and `whitelist` build options has been deprecated. Please
use `exclude` and `include` respectively instead.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: ember-cli.blueprint.add-bower-package-to-project
title: Blueprint::addBowerPackageToProject
until: '5.0.0'
since: '4.3.0'
until: 5.0.0
since: 4.3.0
displayId: ember-cli.blueprint.add-bower-package-to-project
---


`addBowerPackageToProject` has been deprecated. If the package is also available
on the npm registry, please use `addPackageToProject` instead. If not, please
suggest your users to install the Bower package manually by running:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: ember-cli.blueprint.add-bower-packages-to-project
title: Blueprint::addBowerPackagesToProject
until: '5.0.0'
since: '4.3.0'
until: 5.0.0
since: 4.3.0
displayId: ember-cli.blueprint.add-bower-packages-to-project
---


`addBowerPackagesToProject` has been deprecated. If the packages are also available
on the npm registry, please use `addPackagesToProject` instead. If not, please
suggest your users to install the Bower packages manually by running:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: ember-cli.building-bower-packages
title: Building Bower Packages
until: '5.0.0'
since: '4.3.0'
until: 5.0.0
since: 4.3.0
displayId: ember-cli.building-bower-packages
---


Building Bower packages has been deprecated.

Please consider one of the following alternatives:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: ember-cli.ember-cli-jshint-support
title: ember-cli-jshint support
until: '5.0.0'
since: '4.6.0'
until: 5.0.0
since: 4.6.0
displayId: ember-cli.ember-cli-jshint-support
---


Support for [ember-cli-jshint](https://github.com/ember-cli/ember-cli-jshint) has been deprecated.
Please use [ESLint](https://eslint.org/) directly instead. Please refer to the
default [app blueprint](https://github.com/ember-cli/ember-cli/tree/master/blueprints/app/files)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: ember-cli.project.bower-dependencies
title: Project::bowerDependencies
until: '5.0.0'
since: '4.3.0'
until: 5.0.0
since: 4.3.0
displayId: ember-cli.project.bower-dependencies
---


`bowerDependencies` has been deprecated. If you still need access to the
project's Bower dependencies, you will have to manually resolve the project's
`bower.json` file instead:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: ember-cli.project.bower-directory
title: Project::bowerDirectory
until: '5.0.0'
since: '4.3.0'
until: 5.0.0
since: 4.3.0
displayId: ember-cli.project.bower-directory
---


`bowerDirectory` has been deprecated. If you still need access to the
project's Bower directory, you will have to manually resolve the project's
`.bowerrc` file and read the `directory` property instead:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
id: ember-cli.vendor-shim-blueprint
title: vendor-shim blueprint
until: '5.0.0'
since: '4.6.0'
until: 5.0.0
since: 4.6.0
displayId: ember-cli.vendor-shim-blueprint
---


The `vendor-shim` blueprint has been deprecated. Please use [ember-auto-import](https://github.com/ef4/ember-auto-import)
instead to import normal npm packages.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
id: date-prototype-extension
title: Date Prototype Extension
until: '3.0.0'
since: '2.7'
until: 3.0.0
since: "2.7"
---


In previous versions of Ember Data, the native `Date.parse` function was
replaced with `Ember.Date.parse`, a [progressive enhancement for ISO
8601](https://github.com/csnover/js-iso8601) support in browsers that do not
Expand Down
Loading