Skip to content

Commit 1c032b6

Browse files
committed
Merge remote-tracking branch 'origin/master' into glint
As a bonus, actually set the npm version in the Volta config so users who are using it will get the right npm version automatically and not trip over a lockfile version mismatch in CI.
2 parents 41c7524 + bd1aad6 commit 1c032b6

27 files changed

+71923
-15773
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,76 +7,59 @@ on:
77
pull_request:
88

99
env:
10-
NODE_VERSION: 12
10+
NODE_VERSION: 14
1111
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_number }}
1212
PERCY_PARALLEL_TOTAL: 1
1313

1414
jobs:
1515
lint:
1616
name: Lint files
1717
runs-on: ubuntu-latest
18-
timeout-minutes: 3
18+
timeout-minutes: 5
1919
steps:
2020
- name: Check out a copy of the repo
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222

23-
- name: Use Node.js 14
24-
uses: volta-cli/action@v4
23+
- name: Check lockfile version
24+
uses: mansona/npm-lockfile-version@v1
2525

26-
- name: Get Yarn cache path
27-
id: yarn-cache-dir-path
28-
run: echo "::set-output name=dir::$(yarn cache dir)"
29-
30-
- name: Cache Yarn cache and node_modules
31-
id: cache-dependencies
32-
uses: actions/cache@v2
26+
- name: Use Node.js ${{ env.NODE_VERSION }}
27+
uses: actions/setup-node@v3
3328
with:
34-
path: |
35-
${{ steps.yarn-cache-dir-path.outputs.dir }}
36-
node_modules
37-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
38-
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-
29+
cache: 'npm'
30+
node-version: ${{ env.NODE_VERSION }}
31+
32+
- run: npm i -g npm@9
3933

4034
- name: Install dependencies
41-
run: yarn install --frozen-lockfile
42-
if: steps.cache-dependencies.outputs.cache-hit != 'true'
35+
run: npm ci
4336

4437
- name: Lint
45-
run: yarn lint
38+
run: npm run lint
4639

4740

4841
test-app:
4942
name: Test app
5043
runs-on: ubuntu-latest
51-
timeout-minutes: 7
44+
timeout-minutes: 10
5245
steps:
5346
- name: Check out a copy of the repo
54-
uses: actions/checkout@v2
55-
56-
- name: Use Node.js 14
57-
uses: volta-cli/action@v4
47+
uses: actions/checkout@v3
5848

59-
- name: Get Yarn cache path
60-
id: yarn-cache-dir-path
61-
run: echo "::set-output name=dir::$(yarn cache dir)"
62-
63-
- name: Cache Yarn cache and node_modules
64-
id: cache-dependencies
65-
uses: actions/cache@v2
49+
- name: Use Node.js ${{ env.NODE_VERSION }}
50+
uses: actions/setup-node@v3
6651
with:
67-
path: |
68-
${{ steps.yarn-cache-dir-path.outputs.dir }}
69-
node_modules
70-
key: ${{ runner.os }}-14-${{ hashFiles('**/yarn.lock') }}
71-
restore-keys: ${{ runner.os }}-14-
52+
cache: 'npm'
53+
node-version: ${{ env.NODE_VERSION }}
54+
55+
- run: npm i -g npm@9
7256

7357
- name: Install dependencies
74-
run: yarn install --frozen-lockfile
75-
if: steps.cache-dependencies.outputs.cache-hit != 'true'
58+
run: npm ci
7659

7760
- name: Test
7861
env:
7962
PERCY_PARALLEL_NONCE: ${{ env.PERCY_PARALLEL_NONCE }}
8063
PERCY_PARALLEL_TOTAL: ${{ env.PERCY_PARALLEL_TOTAL }}
8164
PERCY_TOKEN: 5ad6687f6b1ad3dec2b964f94d3d59ff3880baccf1492c0663e85c1ce79c1a52
82-
run: yarn run percy exec -- yarn test:ember
65+
run: npx percy exec -- npm run test:ember

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ terraform.tfstate.backup
2727
/libpeerconnection.log
2828
/npm-debug.log*
2929
/testem.log
30-
/yarn-error.log
3130

3231
public/json-docs/
3332
public/rev-index/

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ clone the latest ember.js api docs from github
7777
cd to the cloned ember-api-docs directory
7878
- cd ember-api-docs
7979

80-
ensure Node.js and yarn are installed
80+
ensure Node.js and npm are installed
8181

8282
follow these commands to build ember.js
83-
- yarn install
84-
- yarn run build
83+
- npm install
84+
- npm build
8585
```
8686

8787
## Development steps
8888

8989
1. Follow the setup steps listed above under [Building Ember.js API](#building-emberjs-api-docs).
9090

91-
2. To start the development server, run `yarn start`.
91+
2. To start the development server, run `npm start`.
9292

93-
3. To run all tests run `yarn test`
93+
3. To run all tests run `npm test`
9494

9595
4. To run the app with fastboot cli like our server deployment run the following commands,
9696
```
@@ -106,7 +106,7 @@ We love pull requests. Here's a quick guide:
106106
1. Fork the repo.
107107

108108
2. Run the tests. We only take pull requests with passing tests, and it's great
109-
to know that you have a clean slate: `yarn install && yarn test`.
109+
to know that you have a clean slate: `npm install && npm test`.
110110

111111
3. Add a test for your change. Only refactoring and documentation changes
112112
require no new tests. If you are adding functionality or fixing a bug, we need

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ locally yourself.
4242
```
4343
git clone https://github.com/ember-learn/ember-api-docs.git
4444
cd ember-api-docs
45-
yarn install
45+
npm install
4646
ember serve
4747
```
4848
View at http://localhost:4200
@@ -53,9 +53,9 @@ To run a11y tests, run `test_a11y=yes ember serve`
5353

5454
## Linting
5555

56-
* `yarn run lint:hbs`
57-
* `yarn run lint:js`
58-
* `yarn run lint:js -- --fix`
56+
* `npm run lint:hbs`
57+
* `npm run lint:js`
58+
* `npm run lint:js -- --fix`
5959

6060
## Staging and Deployment
6161

app/controllers/project-version/classes/class.js

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,60 @@
11
/* eslint-disable ember/no-computed-properties-in-native-classes, ember/classic-decorator-no-classic-methods */
2-
import { action, computed } from '@ember/object';
2+
import { action, computed, set, get } from '@ember/object';
33
import { inject as service } from '@ember/service';
44
import Controller from '@ember/controller';
5-
import ParentNameMixin from 'ember-api-docs/mixins/parent-name';
6-
import FilterParams from 'ember-api-docs/mixins/filter-params';
5+
import { A } from '@ember/array';
6+
import { capitalize } from '@ember/string';
7+
import { isEmpty } from '@ember/utils';
8+
import { parentName } from '../../../utils/parent-name';
9+
10+
const filterTypes = ['inherited', 'protected', 'private', 'deprecated'];
11+
const DEFAULT_FILTER = 'inherited';
12+
13+
export default class ClassController extends Controller {
14+
/** @type {import('@ember/routing/router-service').default} */
15+
@service
16+
router;
717

8-
export default class ClassController extends Controller.extend(
9-
ParentNameMixin,
10-
FilterParams
11-
) {
1218
@service
1319
filterData;
1420

21+
queryParams = [{ visibilityFilter: 'show' }];
22+
1523
@service
1624
legacyModuleMappings;
1725

1826
@service
1927
metaStore;
2028

29+
@computed(
30+
'filterData.{showInherited,showProtected,showPrivate,showDeprecated}'
31+
)
32+
get visibilityFilter() {
33+
let appliedFilters = filterTypes
34+
.reduce((filters, filter) => {
35+
let filterValue = get(this, `filterData.show${capitalize(filter)}`)
36+
? filter
37+
: null;
38+
filters.push(filterValue);
39+
return filters;
40+
}, A())
41+
.compact();
42+
43+
if (isEmpty(appliedFilters)) {
44+
return DEFAULT_FILTER;
45+
} else {
46+
return appliedFilters.join(',');
47+
}
48+
}
49+
50+
set visibilityFilter(value = '') {
51+
let filters = A(value.split(','));
52+
filterTypes.forEach((filter) => {
53+
let enabled = filters.indexOf(filter) > -1;
54+
set(this, `filterData.show${capitalize(filter)}`, enabled);
55+
});
56+
}
57+
2158
@computed('legacyModuleMappings.mappings', 'model.{module,name}')
2259
get hasImportExample() {
2360
return this.legacyModuleMappings.hasClassMapping(
@@ -41,6 +78,10 @@ export default class ClassController extends Controller.extend(
4178
];
4279
}
4380

81+
get parentName() {
82+
return parentName(this.router.currentRouteName);
83+
}
84+
4485
@action
4586
updateFilter(filter) {
4687
this.toggleProperty(`filterData.${filter}`);
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import { inject as service } from '@ember/service';
22
import Controller from '@ember/controller';
3-
import ParentNameMixin from 'ember-api-docs/mixins/parent-name';
3+
import { parentName } from '../../../../utils/parent-name';
44

5-
export default class IndexController extends Controller.extend(
6-
ParentNameMixin
7-
) {
5+
export default class IndexController extends Controller {
86
@service
97
filterData;
8+
9+
/** @type {import('@ember/routing/router-service').default} */
10+
@service
11+
router;
12+
13+
get parentName() {
14+
return parentName(this.router.currentRouteName);
15+
}
1016
}

app/mixins/filter-params.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

app/mixins/hash-redirect.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/mixins/parent-name.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/routes/class.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { inject as service } from '@ember/service';
22
import Route from '@ember/routing/route';
33

44
export default class ClassRoute extends Route {
5+
/** @type {import('@ember/routing/router-service').default} */
6+
@service
7+
router;
8+
59
@service
610
legacyModuleMappings;
711

@@ -29,14 +33,14 @@ export default class ClassRoute extends Route {
2933
if (!mappedInfo.error && model.className !== mappedInfo.newName) {
3034
let { itemType, newName, newModule } = mappedInfo;
3135
if (itemType === 'class') {
32-
return this.transitionTo(
36+
return this.router.transitionTo(
3337
`project-version.classes.class`,
3438
'ember',
3539
'release',
3640
newName
3741
);
3842
} else {
39-
return this.transitionTo(
43+
return this.router.transitionTo(
4044
`project-version.functions.function`,
4145
'ember',
4246
'release',
@@ -45,6 +49,6 @@ export default class ClassRoute extends Route {
4549
);
4650
}
4751
}
48-
return this.transitionTo('project-version', 'ember', 'release');
52+
return this.router.transitionTo('project-version', 'ember', 'release');
4953
}
5054
}

0 commit comments

Comments
 (0)