Skip to content

Commit 370976b

Browse files
Pnpm 8 (#848)
* Update to pnpm8 * Update workflows * Fix engines / volta specification * Re-roll lockfile * Bump ember-async-data * Upgrade QUnit + related types * Ember concurrency is not compatible with the preview types so the test-app can't use them * Success? * '@ember/owner' isn't available yet * Remove ember-export-application-global * Get typedoc working and try to fix util output * Fixup the docs a bit * Give up on @ember/owner for now -- will fix in separate PR
1 parent 3bea077 commit 370976b

File tree

16 files changed

+4645
-5040
lines changed

16 files changed

+4645
-5040
lines changed

.github/workflows/ci.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v3
24-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
24+
- uses: NullVoxPopuli/action-setup-pnpm@v2
2525

2626
lint:
2727
name: Lint
2828
runs-on: ubuntu-latest
2929
needs: [install_dependencies]
3030
steps:
3131
- uses: actions/checkout@v3
32-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
32+
- uses: NullVoxPopuli/action-setup-pnpm@v2
3333
- name: Lint
3434
run: pnpm lint
3535

@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
steps:
4343
- uses: actions/checkout@v3
44-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
44+
- uses: NullVoxPopuli/action-setup-pnpm@v2
4545
- uses: ./.github/actions/assert-build
4646

4747

@@ -61,7 +61,7 @@ jobs:
6161

6262
steps:
6363
- uses: actions/checkout@v3
64-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
64+
- uses: NullVoxPopuli/action-setup-pnpm@v2
6565
- uses: ./.github/actions/download-built-package
6666
- name: 'Change TS to ${{ matrix.typescript-scenario }}'
6767
run: 'pnpm add --save-dev ${{ matrix.typescript-scenario}}'
@@ -84,7 +84,7 @@ jobs:
8484
needs: [build]
8585
steps:
8686
- uses: actions/checkout@v3
87-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
87+
- uses: NullVoxPopuli/action-setup-pnpm@v2
8888
- uses: ./.github/actions/download-built-package
8989
- run: pnpm --filter test-app test:ember
9090

@@ -95,7 +95,7 @@ jobs:
9595
needs: [build]
9696
steps:
9797
- uses: actions/checkout@v3
98-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
98+
- uses: NullVoxPopuli/action-setup-pnpm@v2
9999
with:
100100
no-lockfile: true
101101
- uses: ./.github/actions/download-built-package
@@ -124,7 +124,7 @@ jobs:
124124

125125
steps:
126126
- uses: actions/checkout@v3
127-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
127+
- uses: NullVoxPopuli/action-setup-pnpm@v2
128128
- uses: ./.github/actions/download-built-package
129129
- name: Run Tests
130130
working-directory: ./test-app
@@ -150,7 +150,7 @@ jobs:
150150
- uses: actions/checkout@v3
151151
with:
152152
persist-credentials: false
153-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
153+
- uses: NullVoxPopuli/action-setup-pnpm@v2
154154
- uses: ./.github/actions/download-built-package
155155
- name: Create Release Pull Request or Publish to npm
156156
id: changesets
@@ -173,7 +173,7 @@ jobs:
173173
- uses: actions/checkout@v3
174174
with:
175175
persist-credentials: false
176-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
176+
- uses: NullVoxPopuli/action-setup-pnpm@v2
177177
- uses: ./.github/actions/download-built-package
178178
- name: measure asset sizes
179179
run: node ./dev/estimate-bytes/index.js
@@ -198,7 +198,7 @@ jobs:
198198
- uses: actions/checkout@v3
199199
with:
200200
persist-credentials: false
201-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
201+
- uses: NullVoxPopuli/action-setup-pnpm@v2
202202
- uses: ./.github/actions/download-built-package
203203
- run: |
204204
pnpm build:docs
@@ -233,7 +233,7 @@ jobs:
233233
- uses: actions/checkout@v3
234234
with:
235235
persist-credentials: false
236-
- uses: NullVoxPopuli/action-setup-pnpm@v1.1.0
236+
- uses: NullVoxPopuli/action-setup-pnpm@v2
237237
- uses: ./.github/actions/download-built-package
238238
- uses: marocchino/sticky-pull-request-comment@v2
239239
with:

docs/build.mjs

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import fs from 'node:fs';
2+
import path from 'node:path';
3+
import url from 'node:url';
4+
5+
import { execa } from 'execa';
6+
import fse from 'fs-extra';
7+
8+
9+
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
10+
11+
const packagePath = path.resolve(__dirname, '../ember-resources/package.json');
12+
13+
async function main() {
14+
15+
let pkg = await fse.readJson(packagePath);
16+
let config = await fse.readJson(path.resolve(__dirname, './typedoc.config.json'));
17+
18+
let packageExports = pkg.exports;
19+
20+
let relevant = Object.keys(packageExports).filter((importPath) => {
21+
if (importPath === '.') return;
22+
if (importPath.startsWith('./core')) return;
23+
if (importPath === './util') return;
24+
if (importPath === './addon-main.js') return;
25+
if (importPath.includes('cell')) return;
26+
27+
return true;
28+
});
29+
30+
let expectedOutputPath = {};
31+
32+
// Clear links
33+
config.sidebarLinks = {};
34+
35+
// Update links
36+
for (let importPath of relevant) {
37+
let normalized = importPath.replace('./util/', '').replace('./', '').replaceAll(/-/g, ' ');
38+
let split = normalized.split(' ');
39+
let camelCase = split.map((word, i) => i === 0 ? word : word[0].toUpperCase() + word.slice(1)).join('');
40+
let outputPath = `/utils/${camelCase}`;
41+
42+
expectedOutputPath[importPath] = outputPath;
43+
44+
let link = `${outputPath}/index.html`;
45+
46+
47+
config.sidebarLinks[camelCase] = link;
48+
}
49+
50+
// manual overrides because reasons
51+
// Default is an index.html for all exports, which may not be ideal
52+
config.sidebarLinks['link'] = '/utils/link/functions/link.html';
53+
config.sidebarLinks['service'] = '/utils/service/functions/service.html';
54+
config.sidebarLinks['map'] = '/utils/map/functions/map.html';
55+
config.sidebarLinks['helper'] = '/utils/helper/functions/helper.html';
56+
delete config.sidebarLinks['function'];
57+
config.sidebarLinks['trackedFunction'] = '/utils/function/functions/trackedFunction.html';
58+
config.sidebarLinks['emberConcurrency'] = '/utils/emberConcurrency/functions/trackedTask.html';
59+
config.sidebarLinks['debounce'] = '/utils/debounce/functions/debounce.html';
60+
config.sidebarLinks['keepLatest'] = '/utils/keepLatest/functions/keepLatest.html';
61+
config.sidebarLinks['remoteData'] = '/utils/remoteData/functions/RemoteData.html';
62+
63+
await fse.writeJson(path.resolve(__dirname, './typedoc.config.json'), config, { spaces: 2 });
64+
65+
await buildDefault();
66+
67+
// Generate type-doc outputs with
68+
for (let [importPath, outputPath] of Object.entries(expectedOutputPath)) {
69+
let configCopy = { ...config };
70+
71+
configCopy.entryPoints = [
72+
path.resolve('../ember-resources/src', importPath + '.ts'),
73+
];
74+
configCopy.tsconfig = path.resolve(path.join(__dirname, '../ember-resources/tsconfig.json'));
75+
configCopy.navigationLinks = {};
76+
configCopy.navigationLinks['Back to ember-resources'] = '/index.html';
77+
configCopy.navigationLinks['GitHub'] = 'https://github.com/NullVoxPopuli/ember-resources';
78+
configCopy.sidebarLinks = {};
79+
configCopy.sidebarLinks['Back to ember-resources'] = '/index.html';
80+
configCopy.readme = 'none';
81+
configCopy.customCss = path.resolve(path.join(__dirname, './custom.css'));
82+
delete configCopy.json;
83+
configCopy.out = path.join(__dirname, `dist/${outputPath}`);
84+
configCopy.cleanOutputDir = false;
85+
86+
let configLocation = `/tmp/ember-resources-docs/${outputPath}/`;
87+
88+
await fse.ensureDir(configLocation);
89+
await fse.writeJson(path.join(configLocation, 'typedoc.config.json'), configCopy, { spaces: 2 });
90+
91+
await build(configLocation);
92+
}
93+
}
94+
95+
main();
96+
97+
async function buildDefault() {
98+
await execa('pnpm', ['typedoc', '--options', './typedoc.config.json'], {
99+
cwd: __dirname,
100+
stdio: 'inherit',
101+
});
102+
}
103+
104+
async function build(configLocation) {
105+
await execa('pnpm', ['typedoc', '--options', path.join(configLocation, './typedoc.config.json')], {
106+
cwd: __dirname,
107+
stdio: 'inherit',
108+
});
109+
}

docs/custom.css

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.col-menu.menu-sticky-wrap {
2+
display: flex;
3+
flex-direction: column-reverse;
4+
justify-content: start;
5+
}
6+
7+
.tsd-navigation.settings {
8+
display: none;
9+
}
10+
11+
.tsd-navigation.primary {
12+
display: none;
13+
}
14+
15+
#tsd-sidebar-links::before {
16+
content: 'Utils';
17+
font-weight: bold;
18+
margin-bottom: 0.4rem;
19+
display: block;
20+
margin-top: 0.5rem;
21+
margin-left: -0.25rem;
22+
}
23+
24+
#tsd-sidebar-links a::after,
25+
#tsd-toolbar-links a::after {
26+
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"/></svg>');
27+
width: 0.75rem;
28+
height: 0.75rem;
29+
display: inline-block;
30+
margin-left: 0.5rem;
31+
color: currentColor;
32+
}
33+
34+
@media (prefers-color-scheme: dark) {
35+
#tsd-sidebar-links a::after,
36+
#tsd-toolbar-links a::after {
37+
filter: invert(1);
38+
}
39+
}

docs/package.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@
44
"private": true,
55
"scripts": {
66
"start": "pnpm docs:watch",
7-
"docs:collect": "typedoc --options ./typedoc.config.json",
7+
"debug": "npx html-pages ./dist --no-cache",
8+
"docs:collect": "node ./build.mjs",
89
"docs:watch": "typedoc --options ./typedoc.config.json --watch"
910
},
1011
"devDependencies": {
11-
"typedoc": "^0.23.14",
12+
"typedoc": "^0.23.28",
1213
"typedoc-github-wiki-theme": "^1.0.1",
1314
"typedoc-gitlab-wiki-theme": "^1.0.0",
1415
"typedoc-plugin-markdown": "^3.14.0",
1516
"typedoc-plugin-markdown-pages": "^0.3.0",
16-
"typedoc-plugin-mdn-links": "^3.0.0",
17+
"typedoc-plugin-mdn-links": "^3.0.3",
1718
"typescript": "^5.0.0"
19+
},
20+
"dependencies": {
21+
"execa": "^7.1.1",
22+
"fs-extra": "^11.1.1"
23+
},
24+
"engines": {
25+
"node": ">= 18"
1826
}
1927
}

docs/typedoc.config.json

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
11
{
22
"tsconfig": "../ember-resources/tsconfig.json",
3+
"customCss": "./custom.css",
4+
"compilerOptions": {
5+
"noEmitOnError": false
6+
},
37
"entryPoints": [
4-
"../ember-resources/src/index.ts",
5-
"../ember-resources/src/util/"
8+
"../ember-resources/src"
69
],
7-
"entryPointStrategy": "expand",
10+
"navigationLinks": {
11+
"Tutorial": "https://tutorial.glimdown.com",
12+
"GitHub": "https://github.com/NullVoxPopuli/ember-resources"
13+
},
14+
"sidebarLinks": {
15+
"link": "/utils/link/functions/link.html",
16+
"service": "/utils/service/functions/service.html",
17+
"keepLatest": "/utils/keepLatest/functions/keepLatest.html",
18+
"fps": "/utils/fps/index.html",
19+
"map": "/utils/map/functions/map.html",
20+
"helper": "/utils/helper/functions/helper.html",
21+
"remoteData": "/utils/remoteData/functions/RemoteData.html",
22+
"debounce": "/utils/debounce/functions/debounce.html",
23+
"emberConcurrency": "/utils/emberConcurrency/functions/trackedTask.html",
24+
"trackedFunction": "/utils/function/functions/trackedFunction.html"
25+
},
26+
"entryPointStrategy": "resolve",
827
"readme": "../README.md",
928
"exclude": [],
1029
"json": "./docs.json",
1130
"out": "dist",
31+
"emit": "docs",
1232
"pretty": true,
33+
"skipErrorChecking": true,
1334
"excludePrivate": true,
1435
"excludeProtected": false,
1536
"excludeExternals": true,
16-
"disableSources": true,
1737
"searchInComments": true,
38+
"disableSources": false,
1839
"categorizeByGroup": false,
19-
"plugin": [
20-
]
40+
"plugin": []
2141
}

ember-resources/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"@glimmer/component": "^1.1.2",
109109
"@glimmer/tracking": "^1.1.2",
110110
"@glint/template": "^1.0.0-beta.3 || ^1.0.0",
111-
"ember-async-data": "^1.0.0",
111+
"ember-async-data": "^1.0.1",
112112
"ember-concurrency": "^2.0.0",
113113
"ember-source": "^3.28.0 || ^4.0.0 || ^5.0.0"
114114
},
@@ -127,7 +127,7 @@
127127
}
128128
},
129129
"devDependencies": {
130-
"@babel/core": "7.21.3",
130+
"@babel/core": "7.21.4",
131131
"@babel/eslint-parser": "^7.19.1",
132132
"@babel/plugin-proposal-class-properties": "7.18.6",
133133
"@babel/plugin-proposal-decorators": "7.21.0",
@@ -153,7 +153,7 @@
153153
"@typescript-eslint/eslint-plugin": "^5.54.0",
154154
"@typescript-eslint/parser": "^5.54.0",
155155
"concurrently": "^7.6.0",
156-
"ember-async-data": "^1.0.0",
156+
"ember-async-data": "^1.0.1",
157157
"ember-source": "4.11.0",
158158
"ember-template-lint": "5.7.1",
159159
"eslint": "^8.35.0",
@@ -162,9 +162,9 @@
162162
"prettier-plugin-ember-template-tag": "^0.3.2",
163163
"rollup": "3.20.0",
164164
"rollup-plugin-copy": "^3.4.0",
165-
"rollup-plugin-ts": "^3.0.0",
166-
"tslib": "^2.4.0",
167-
"typescript": "~5.0.0"
165+
"rollup-plugin-ts": "^3.2.0",
166+
"tslib": "^2.5.0",
167+
"typescript": "~5.0.3"
168168
},
169169
"publishConfig": {
170170
"registry": "https://registry.npmjs.org"

0 commit comments

Comments
 (0)