Skip to content

Commit 8a7b9a1

Browse files
authored
feat(core): better configuration options for target inference (#787)
1 parent 2d2cb5b commit 8a7b9a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+513
-108
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4646
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
NPM_CONFIG_PROVENANCE: 'true'
4748
VERBOSE_LOGGING: 'true'
4849

4950
post-release-smoke-tests:

apps/docs-site/docusaurus.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ module.exports = {
101101
// Please change this to your repo.
102102
editUrl: 'https://github.com/nx-dotnet/nx-dotnet/edit/master/docs/',
103103
path: '../../docs',
104+
sidebarItemsGenerator: sidebarItemsSorter,
104105
},
105106
blog: {
106107
showReadingTime: true,
@@ -114,4 +115,50 @@ module.exports = {
114115
},
115116
],
116117
],
118+
// plugins: [
119+
// [
120+
// '@docusaurus/plugin-content-docs',
121+
// {
122+
123+
// path: '../../docs',
124+
// },
125+
// ],
126+
// ],
117127
};
128+
129+
async function sidebarItemsSorter({
130+
defaultSidebarItemsGenerator,
131+
docs,
132+
...args
133+
}) {
134+
function sortCategoriesFirst(items, docsMap) {
135+
const categories = [];
136+
const docs = [];
137+
138+
for (const item of items) {
139+
if (item.type === 'category') {
140+
categories.push(item);
141+
} else {
142+
docs.push(item);
143+
}
144+
}
145+
146+
const index = docs.findIndex((item) => item.id === 'index');
147+
if (index !== -1) {
148+
const [doc] = docs.splice(index, 1);
149+
categories.unshift(doc);
150+
}
151+
const sorted = [...categories, ...docs];
152+
153+
for (const item of sorted) {
154+
if (item.items) {
155+
item.items = sortCategoriesFirst(item.items, docsMap);
156+
}
157+
}
158+
159+
return sorted;
160+
}
161+
const docsMap = new Map(docs.map((doc) => [doc.id, doc]));
162+
const sidebarItems = await defaultSidebarItemsGenerator({ docs, ...args });
163+
return sortCategoriesFirst(sidebarItems, docsMap);
164+
}

apps/docs-site/project.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
"outputPath": "dist/apps/docs-site"
1111
}
1212
},
13-
"prebuild": {
14-
"executor": "nx:run-commands",
15-
"options": {
16-
"commands": ["echo"]
17-
}
18-
},
1913
"serve": {
2014
"executor": "@nx-plus/docusaurus:dev-server",
2115
"options": {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)