Skip to content

Commit 7e0f2ff

Browse files
committed
Merge remote-tracking branch 'origin/main' into dev
2 parents ef52f89 + 58704a9 commit 7e0f2ff

File tree

583 files changed

+193584
-213774
lines changed

Some content is hidden

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

583 files changed

+193584
-213774
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ name: Docs CI
22

33
on:
44
push:
5-
branches: [ main, docs/ui ]
5+
branches: [main, docs/ui]
66
pull_request:
7-
branches: [ main, docs/ui ]
7+
branches: [main, docs/ui]
88

99
jobs:
1010
build:
11-
1211
runs-on: ubuntu-latest
1312

1413
steps:
@@ -19,7 +18,14 @@ jobs:
1918
node-version: 19
2019
cache: 'npm'
2120
- run: npm ci
22-
- run: npm run lint:check --if-present
21+
- run: npm run lint --if-present
2322
- run: npm run build --if-present
2423
env:
25-
NODE_OPTIONS: "--max_old_space_size=4096"
24+
NODE_OPTIONS: '--max_old_space_size=4096'
25+
# disabled because the output of textlint marks warnings as errors
26+
# # re-run lint:text with junit output for github annotations
27+
# - run: npm run lint:text -- --format junit --output-file lint-report.xml
28+
# - uses: mikepenz/action-junit-report@v3
29+
# if: always()
30+
# with:
31+
# report_paths: 'lint-report.xml'

.textlintrc

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"rules": {
3+
"terminology": {
4+
"severity": "warning",
5+
"defaultTerms": false,
6+
// Some terms borrowed from https://github.com/cypress-io/cypress-documentation/blob/main/.textlintrc
7+
"terms": [
8+
// NativeScript specifics
9+
["absolute[- ]?layout(s?)", "AbsoluteLayout$1"],
10+
["dock[- ]?layout(s?)", "DockLayout$1"],
11+
["flex(?:box)?[- ]?layout(s?)", "FlexboxLayout$1"],
12+
["grid[- ]?layout(s?)", "GridLayout$1"],
13+
["root[- ]?layout(s?)", "RootLayout$1"],
14+
["stack[- ]?layout(s?)", "StackLayout$1"],
15+
["wrap[- ]?layout(s?)", "WrapLayout$1"],
16+
["activity[- ]?indicator(s?)", "ActivityIndicator$1"],
17+
["date[- ]?picker(s?)", "DatePicker$1"],
18+
["html[- ]?view(s?)", "HtmlView$1"],
19+
["list[- ]?picker(s?)", "ListPicker$1"],
20+
["list[- ]?view(s?)", "ListView$1"],
21+
["place[- ]?holder(s?)", "Placeholder$1"],
22+
["scroll[- ]?view(s?)", "ScrollView$1"],
23+
["search[- ]?bar(s?)", "SearchBar$1"],
24+
["segmented[- ]?bar(s?)", "SegmentedBar$1"],
25+
["tab[- ]?view(s?)", "TabView$1"],
26+
["text[- ]?field(s?)", "TextField$1"],
27+
["text[- ]?view(s?)", "TextView$1"],
28+
["time[- ]?picker(s?)", "TimePicker$1"],
29+
["web[- ]?view(s?)", "WebView$1"],
30+
["action[- ]?bar(s?)", "ActionBar$1"],
31+
32+
// Prefer simple
33+
["callback function", "callback"],
34+
35+
// Brands and Technologies
36+
"JavaScript",
37+
"TypeScript",
38+
"NativeScript",
39+
["ns", "NativeScript"],
40+
"GitHub",
41+
["VSCode", "VS Code"],
42+
"webpack",
43+
["WebSocket(s?)", "WebSocket$1"],
44+
"WiFi",
45+
"API",
46+
["API['’]?s", "APIs"],
47+
"CLI",
48+
"CSS",
49+
50+
// Words and phrases
51+
["\\(s\\)he", "they"],
52+
["he or she", "they"],
53+
["he/she", "they"],
54+
["crazy", "complex"],
55+
["crazier", "more complex"],
56+
["craziest", "most complex"],
57+
["dumb", "unintended"],
58+
["insane", "outrageous"],
59+
["blacklist", "block"],
60+
["whitelist", "allow"],
61+
["will be executed", "will be called"],
62+
63+
// Prefer American spelling
64+
["behaviour", "behavior"],
65+
["cancelled", "canceled"],
66+
["cancelling", "canceling"],
67+
["centre", "center"],
68+
["colour", "color"],
69+
["customise", "customize"],
70+
["customisation", "customization"],
71+
["favourite", "favorite"],
72+
["labelled", "labeled"],
73+
["licence", "license"],
74+
["organise", "organize"],
75+
76+
// Common misspellings
77+
["gaurantee", "guarantee"],
78+
79+
// Words we would like to not use altogether
80+
["obviously", ""],
81+
["basically", ""],
82+
["simply", ""],
83+
["of( )?course", ""],
84+
["clearly", ""],
85+
["just", ""],
86+
["everyone knows", ""],
87+
["easy", ""],
88+
["which will( be)?", ""],
89+
["which is the", ""],
90+
91+
// Words we would like to not use at the start of a sentence
92+
["^so", ""],
93+
["^and", ""],
94+
["^but", ""],
95+
["^however", ""],
96+
97+
// Single word
98+
["change[- ]log(s?)", "changelog$1"],
99+
["code[- ]base(es?)", "codebase$1"],
100+
["e[- ]mail(s?)", "email$1"],
101+
["end[- ]point(s?)", "endpoint$1"],
102+
["file[- ]name(s?)", "filename$1"],
103+
["can[- ]not", "cannot$1"],
104+
["back-?end(s?)", "backend$1"],
105+
["front-?end(s?)", "frontend$1"],
106+
["full-?stack(s?)", "fullstack$1"],
107+
108+
// Multiple words
109+
["open-?source(ed?)", "open source$1"],
110+
111+
// Hyphenated
112+
["end ?to ?end", "end-to-end"],
113+
["retryability", "retry-ability"],
114+
["retriability", "retry-ability"],
115+
116+
// Shortened words
117+
["repo\\b", "repository"],
118+
["repos\\b", "repositories"]
119+
]
120+
}
121+
},
122+
"filters": {
123+
"comments": true
124+
}
125+
}

.vitepress/config.mts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import { defineConfig } from 'vitepress'
2+
import apiSidebar from '../content/api/sidebar.json'
3+
import mainSidebar from '../content/sidebar'
4+
import nav from './nav'
5+
import './theme/cliLanguage'
6+
import path from 'node:path'
7+
8+
const isDev = process.env.NODE_ENV !== 'production'
9+
const branch = process.env.CF_PAGES_BRANCH ?? 'main'
10+
11+
export default defineConfig({
12+
srcDir: './content',
13+
lang: 'en-US',
14+
title: 'NativeScript',
15+
description: 'NativeScript docs',
16+
ignoreDeadLinks: true,
17+
cleanUrls: true,
18+
lastUpdated: true,
19+
appearance: false,
20+
themeConfig: {
21+
editLink: {
22+
...(isDev && {
23+
text: 'Edit in VS Code',
24+
}),
25+
// pattern:
26+
// 'https://github.com/NativeScript/docs/blob/main/content/:filePath',
27+
pattern: isDev
28+
? `vscode://file/${path.resolve(__dirname, '../content/:filePath')}`
29+
: `https://pr.new/github.com/NativeScript/docs/edit/${branch}/content/:filePath?initialPath=:path`,
30+
},
31+
algolia: {
32+
appId: '',
33+
apiKey: '8d41b4ae92a02aea355e1dc8cfad1899',
34+
indexName: 'nativescript',
35+
},
36+
nav,
37+
sidebar: {
38+
'/api': apiSidebar,
39+
'/': mainSidebar,
40+
},
41+
},
42+
markdown: {
43+
headers: true,
44+
},
45+
async transformPageData(pageData, { siteConfig }) {
46+
// const contributors = await githubAuthors.getAuthorsForFilePath(
47+
// path.resolve(siteConfig.srcDir, pageData.relativePath)
48+
// )
49+
// pageData.frontmatter.contributors ??= contributors ?? []
50+
51+
pageData.frontmatter.contributors = transformContributors(
52+
pageData.frontmatter.contributors
53+
)
54+
},
55+
})
56+
57+
function transformContributors(contributors?: string[] | false) {
58+
// explicitly set to false to disable contributors list
59+
if (contributors === false) {
60+
return []
61+
}
62+
63+
// if not set, default to NativeScript
64+
if (!contributors) {
65+
return [
66+
{
67+
username: 'NativeScript',
68+
avatarURL: 'https://github.com/NativeScript.png?size=24',
69+
profileURL: 'https://github.com/NativeScript',
70+
},
71+
]
72+
}
73+
74+
// otherwise, transform the list of usernames into a list of objects
75+
return contributors.map((username: string) => {
76+
return {
77+
username,
78+
avatarURL: `https://github.com/${username}.png?size=24`,
79+
profileURL: `https://github.com/${username}`,
80+
}
81+
})
82+
}

.vitepress/config.ts

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

.vitepress/nav.ts

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,53 @@
11
export default [
2-
...(process.env.NODE_ENV !== "production"
2+
...(process.env.NODE_ENV !== 'production'
33
? [
44
{
5-
text: "[DEV] Reference",
6-
link: "/dev-reference",
7-
activeMatch: "^/dev-reference",
8-
icon: "CodeBracketIcon",
5+
text: '[DEV] Reference',
6+
link: '/dev-reference',
7+
activeMatch: '^/dev-reference',
8+
icon: 'CodeBracketIcon',
99
},
1010
]
1111
: []),
1212
{
13-
text: "Docs",
14-
link: "/",
15-
activeMatch: "^/(?!plugins|best-practices|api|dev-reference)",
16-
icon: "AcademicCapIcon",
13+
text: 'Docs',
14+
link: '/',
15+
activeMatch: '^/(?!plugins|best-practices|api|dev-reference|tutorials)',
16+
icon: 'BookOpenIcon',
1717
},
1818
{
19-
text: "Preview",
20-
link: "/soon",
21-
icon: "DevicePhoneMobileIcon",
19+
text: 'Preview',
20+
link: 'https://preview.nativescript.org',
21+
icon: 'DevicePhoneMobileIcon',
22+
target: '_blank',
2223
},
2324
{
24-
text: "Plugins",
25-
link: "/soon",
26-
activeMatch: "^/plugins",
27-
icon: "CubeTransparentIcon",
25+
text: 'Tutorials',
26+
link: '/tutorials/',
27+
activeMatch: '^/tutorials',
28+
icon: 'AcademicCapIcon',
2829
},
2930
{
30-
text: "Best Practices",
31-
link: "/soon",
32-
activeMatch: "^/best-practices",
33-
icon: "CheckIcon",
31+
text: 'Plugins',
32+
link: '/soon',
33+
activeMatch: '^/plugins',
34+
icon: 'CubeTransparentIcon',
3435
},
36+
// {
37+
// text: 'Best Practices',
38+
// link: '/soon',
39+
// activeMatch: '^/best-practices',
40+
// icon: 'CheckIcon',
41+
// },
3542
{
36-
text: "Integrations",
37-
link: "/soon",
38-
icon: "CpuChipIcon",
43+
text: 'Integrations',
44+
link: '/soon',
45+
icon: 'CpuChipIcon',
3946
},
4047
{
41-
text: "API Reference",
42-
link: "/api/",
43-
activeMatch: "^/api",
44-
icon: "CodeBracketIcon",
48+
text: 'API Reference',
49+
link: '/api/',
50+
activeMatch: '^/api',
51+
icon: 'CodeBracketIcon',
4552
},
46-
];
53+
]

.vitepress/theme/vitepress-theme.d.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { DefaultTheme } from 'vitepress';
2+
import { Theme } from 'vitepress';
3+
4+
export declare type NSNavItem = DefaultTheme.NavItem & {
5+
icon?: string;
6+
};
7+
8+
export declare type NSSidebarGroup = DefaultTheme.SidebarItem & {
9+
items?: NSSidebarItem[];
10+
};
11+
12+
export declare type NSSidebarItem = DefaultTheme.SidebarItem & {
13+
icon?: string;
14+
hidden?: boolean;
15+
visible?: boolean;
16+
collapsible?: boolean;
17+
hideChildren?: boolean;
18+
type?: string;
19+
};
20+
21+
export declare type NSThemeConfig = DefaultTheme.Config & {
22+
mainURL?: string;
23+
sidebar?: NSSidebarGroup[];
24+
nav?: NSNavItem[];
25+
};
26+
27+
declare const theme: (enhanceApp: Theme['enhanceApp']) => Theme;
28+
export default theme;
29+
30+
export { }

0 commit comments

Comments
 (0)