xs-dev 0.14.2 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/commands/include.js +9 -7
- package/build/commands/remove.js +5 -5
- package/build/commands/scan.js +8 -4
- package/build/toolbox/setup/esp32.js +2 -2
- package/build/toolbox/setup/fontbm.js +7 -3
- package/build/toolbox/update/esp32.js +4 -4
- package/docs/astro.config.mjs +13 -0
- package/docs/public/favicon.ico +0 -0
- package/docs/public/make-scrollable-code-focusable.js +3 -0
- package/docs/src/components/Footer/AvatarList.astro +149 -0
- package/docs/src/components/Footer/Footer.astro +16 -0
- package/docs/src/components/HeadCommon.astro +41 -0
- package/docs/src/components/HeadSEO.astro +34 -0
- package/docs/src/components/Header/Header.astro +133 -0
- package/docs/src/components/Header/LanguageSelect.css +47 -0
- package/docs/src/components/Header/LanguageSelect.tsx +49 -0
- package/docs/src/components/Header/Search.css +39 -0
- package/docs/src/components/Header/Search.tsx +65 -0
- package/docs/src/components/Header/SidebarToggle.tsx +44 -0
- package/docs/src/components/Header/SkipToContent.astro +22 -0
- package/docs/src/components/LeftSidebar/LeftSidebar.astro +118 -0
- package/docs/src/components/PageContent/PageContent.astro +41 -0
- package/docs/src/components/RightSidebar/MoreMenu.astro +70 -0
- package/docs/src/components/RightSidebar/RightSidebar.astro +27 -0
- package/docs/src/components/RightSidebar/TableOfContents.tsx +49 -0
- package/docs/src/components/RightSidebar/ThemeToggleButton.css +37 -0
- package/docs/src/components/RightSidebar/ThemeToggleButton.tsx +83 -0
- package/docs/src/config.ts +43 -0
- package/docs/src/languages.ts +10 -0
- package/docs/src/layouts/MainLayout.astro +122 -0
- package/docs/src/pages/en/features/include.md +48 -0
- package/docs/src/pages/en/features/init.md +57 -0
- package/docs/src/pages/en/features/run.md +63 -0
- package/docs/src/pages/en/features/scan.md +28 -0
- package/docs/src/pages/en/features/setup.md +55 -0
- package/docs/src/pages/en/features/teardown.md +13 -0
- package/docs/src/pages/en/features/update.md +21 -0
- package/docs/src/pages/en/introduction.md +68 -0
- package/docs/src/pages/index.astro +5 -0
- package/docs/src/pages/search-index.json.ts +18 -0
- package/docs/src/styles/index.css +382 -0
- package/docs/src/styles/theme.css +125 -0
- package/docs/tailwind.config.cjs +7 -0
- package/docs/tsconfig.json +15 -0
- package/package.json +24 -6
- package/docs/commands.md +0 -3
- package/docs/plugins.md +0 -47
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact';
|
|
2
|
+
import { h, Fragment } from 'preact';
|
|
3
|
+
import { useState, useEffect, useRef } from 'preact/hooks';
|
|
4
|
+
|
|
5
|
+
const TableOfContents: FunctionalComponent<{ headers: any[] }> = ({ headers = [] }) => {
|
|
6
|
+
const itemOffsets = useRef([]);
|
|
7
|
+
const [activeId, setActiveId] = useState<string>(undefined);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const getItemOffsets = () => {
|
|
11
|
+
const titles = document.querySelectorAll('article :is(h1, h2, h3, h4)');
|
|
12
|
+
itemOffsets.current = Array.from(titles).map((title) => ({
|
|
13
|
+
id: title.id,
|
|
14
|
+
topOffset: title.getBoundingClientRect().top + window.scrollY,
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
getItemOffsets();
|
|
19
|
+
window.addEventListener('resize', getItemOffsets);
|
|
20
|
+
|
|
21
|
+
return () => {
|
|
22
|
+
window.removeEventListener('resize', getItemOffsets);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<h2 class="heading">On this page</h2>
|
|
29
|
+
<ul>
|
|
30
|
+
<li class={`header-link depth-2 ${activeId === 'overview' ? 'active' : ''}`.trim()}>
|
|
31
|
+
<a href="#overview">Overview</a>
|
|
32
|
+
</li>
|
|
33
|
+
{headers
|
|
34
|
+
.filter(({ depth }) => depth > 1 && depth < 4)
|
|
35
|
+
.map((header) => (
|
|
36
|
+
<li
|
|
37
|
+
class={`header-link depth-${header.depth} ${
|
|
38
|
+
activeId === header.slug ? 'active' : ''
|
|
39
|
+
}`.trim()}
|
|
40
|
+
>
|
|
41
|
+
<a href={`#${header.slug}`}>{header.text}</a>
|
|
42
|
+
</li>
|
|
43
|
+
))}
|
|
44
|
+
</ul>
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default TableOfContents;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.theme-toggle {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 0.25em;
|
|
5
|
+
padding: 0.33em 0.67em;
|
|
6
|
+
border-radius: 99em;
|
|
7
|
+
background-color: var(--theme-code-inline-bg);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.theme-toggle > label:focus-within {
|
|
11
|
+
outline: 2px solid transparent;
|
|
12
|
+
box-shadow: 0 0 0 0.08em var(--theme-accent), 0 0 0 0.12em white;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.theme-toggle > label {
|
|
16
|
+
color: var(--theme-code-inline-text);
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
opacity: 0.5;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.theme-toggle .checked {
|
|
25
|
+
color: var(--theme-accent);
|
|
26
|
+
opacity: 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
input[name='theme-toggle'] {
|
|
30
|
+
position: absolute;
|
|
31
|
+
opacity: 0;
|
|
32
|
+
top: 0;
|
|
33
|
+
right: 0;
|
|
34
|
+
bottom: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
z-index: -1;
|
|
37
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact';
|
|
2
|
+
import { h, Fragment } from 'preact';
|
|
3
|
+
import { useState, useEffect } from 'preact/hooks';
|
|
4
|
+
import './ThemeToggleButton.css';
|
|
5
|
+
|
|
6
|
+
const themes = ['light', 'dark'];
|
|
7
|
+
|
|
8
|
+
const icons = [
|
|
9
|
+
<svg
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
width="20"
|
|
12
|
+
height="20"
|
|
13
|
+
viewBox="0 0 20 20"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
fillRule="evenodd"
|
|
18
|
+
d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"
|
|
19
|
+
clipRule="evenodd"
|
|
20
|
+
/>
|
|
21
|
+
</svg>,
|
|
22
|
+
<svg
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
width="20"
|
|
25
|
+
height="20"
|
|
26
|
+
viewBox="0 0 20 20"
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
>
|
|
29
|
+
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" />
|
|
30
|
+
</svg>,
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const ThemeToggle: FunctionalComponent = () => {
|
|
34
|
+
const [theme, setTheme] = useState(() => {
|
|
35
|
+
if (import.meta.env.SSR) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
|
|
39
|
+
return localStorage.getItem('theme');
|
|
40
|
+
}
|
|
41
|
+
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
42
|
+
return 'dark';
|
|
43
|
+
}
|
|
44
|
+
return 'light';
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const root = document.documentElement;
|
|
49
|
+
if (theme === 'light') {
|
|
50
|
+
root.classList.remove('theme-dark');
|
|
51
|
+
} else {
|
|
52
|
+
root.classList.add('theme-dark');
|
|
53
|
+
}
|
|
54
|
+
}, [theme]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div class="theme-toggle">
|
|
58
|
+
{themes.map((t, i) => {
|
|
59
|
+
const icon = icons[i];
|
|
60
|
+
const checked = t === theme;
|
|
61
|
+
return (
|
|
62
|
+
<label className={checked ? ' checked' : ''}>
|
|
63
|
+
{icon}
|
|
64
|
+
<input
|
|
65
|
+
type="radio"
|
|
66
|
+
name="theme-toggle"
|
|
67
|
+
checked={checked}
|
|
68
|
+
value={t}
|
|
69
|
+
title={`Use ${t} theme`}
|
|
70
|
+
aria-label={`Use ${t} theme`}
|
|
71
|
+
onChange={() => {
|
|
72
|
+
localStorage.setItem('theme', t);
|
|
73
|
+
setTheme(t);
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
</label>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default ThemeToggle;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const SITE = {
|
|
2
|
+
title: 'xs-dev Documentation',
|
|
3
|
+
description: 'CLI for automating the setup and usage of Moddable XS tools',
|
|
4
|
+
defaultLanguage: 'en_US',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const OPEN_GRAPH = {
|
|
8
|
+
twitter: 'hipsterbrown',
|
|
9
|
+
github: 'hipsterbrown',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const KNOWN_LANGUAGES = {
|
|
13
|
+
English: 'en',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Uncomment this to add an "Edit this page" button to every page of documentation.
|
|
17
|
+
export const GITHUB_EDIT_URL = `https://github.com/hipsterbrown/xs-dev/blob/main/docs/`
|
|
18
|
+
|
|
19
|
+
// Uncomment this to add an "Join our Community" button to every page of documentation.
|
|
20
|
+
// export const COMMUNITY_INVITE_URL = `https://astro.build/chat`;
|
|
21
|
+
|
|
22
|
+
// Uncomment this to enable site search.
|
|
23
|
+
// See "Algolia" section of the README for more information.
|
|
24
|
+
// export const ALGOLIA = {
|
|
25
|
+
// indexName: 'XXXXXXXXXX',
|
|
26
|
+
// appId: 'XXXXXXXXXX',
|
|
27
|
+
// apiKey: 'XXXXXXXXXX',
|
|
28
|
+
// }
|
|
29
|
+
|
|
30
|
+
export const SIDEBAR = {
|
|
31
|
+
en: [
|
|
32
|
+
{ text: '', header: true },
|
|
33
|
+
{ text: 'Features', header: true },
|
|
34
|
+
{ text: 'Introduction', link: 'en/introduction' },
|
|
35
|
+
{ text: 'Setup', link: 'en/features/setup' },
|
|
36
|
+
{ text: 'Updates', link: 'en/features/update' },
|
|
37
|
+
{ text: 'Teardown', link: 'en/features/teardown' },
|
|
38
|
+
{ text: 'Device Discovery', link: 'en/features/scan' },
|
|
39
|
+
{ text: 'Project Creation', link: 'en/features/init' },
|
|
40
|
+
{ text: 'Build & Run', link: 'en/features/run' },
|
|
41
|
+
{ text: 'SDK Module Management', link: 'en/features/include' },
|
|
42
|
+
],
|
|
43
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KNOWN_LANGUAGES } from './config'
|
|
2
|
+
|
|
3
|
+
export { KNOWN_LANGUAGES }
|
|
4
|
+
export const KNOWN_LANGUAGE_CODES = Object.values(KNOWN_LANGUAGES)
|
|
5
|
+
export const langPathRegex = /\/([a-z]{2}-?[A-Z]{0,2})\//
|
|
6
|
+
|
|
7
|
+
export function getLanguageFromURL(pathname: string) {
|
|
8
|
+
const langCodeMatch = pathname.match(langPathRegex)
|
|
9
|
+
return langCodeMatch ? langCodeMatch[1] : 'en'
|
|
10
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
import HeadCommon from '../components/HeadCommon.astro';
|
|
3
|
+
import HeadSEO from '../components/HeadSEO.astro';
|
|
4
|
+
import Header from '../components/Header/Header.astro';
|
|
5
|
+
import Footer from '../components/Footer/Footer.astro';
|
|
6
|
+
import PageContent from '../components/PageContent/PageContent.astro';
|
|
7
|
+
import LeftSidebar from '../components/LeftSidebar/LeftSidebar.astro';
|
|
8
|
+
import RightSidebar from '../components/RightSidebar/RightSidebar.astro';
|
|
9
|
+
import * as CONFIG from '../config';
|
|
10
|
+
|
|
11
|
+
const { content = {} } = Astro.props;
|
|
12
|
+
const currentPage = new URL(Astro.request.url).pathname;
|
|
13
|
+
const currentFile = `src/pages${currentPage.replace(/\/$/, '')}.md`;
|
|
14
|
+
const githubEditUrl = CONFIG.GITHUB_EDIT_URL && CONFIG.GITHUB_EDIT_URL + currentFile;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<html dir={content.dir ?? 'ltr'} lang={content.lang ?? 'en-us'} class="initial">
|
|
18
|
+
<head>
|
|
19
|
+
<HeadCommon />
|
|
20
|
+
<HeadSEO {content} canonicalURL={Astro.canonicalURL} />
|
|
21
|
+
<title>{content.title ? `${content.title} 🚀 ${CONFIG.SITE.title}` : CONFIG.SITE.title}</title>
|
|
22
|
+
<style>
|
|
23
|
+
body {
|
|
24
|
+
width: 100%;
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-rows: var(--theme-navbar-height) 1fr;
|
|
27
|
+
--gutter: 0.5rem;
|
|
28
|
+
--doc-padding: 2rem;
|
|
29
|
+
}
|
|
30
|
+
.layout {
|
|
31
|
+
display: grid;
|
|
32
|
+
grid-auto-flow: column;
|
|
33
|
+
grid-template-columns:
|
|
34
|
+
minmax(var(--gutter), 1fr)
|
|
35
|
+
minmax(0, var(--max-width))
|
|
36
|
+
minmax(var(--gutter), 1fr);
|
|
37
|
+
overflow-x: hidden;
|
|
38
|
+
}
|
|
39
|
+
.layout :global(> *) {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
}
|
|
43
|
+
.grid-sidebar {
|
|
44
|
+
height: 100vh;
|
|
45
|
+
position: sticky;
|
|
46
|
+
top: 0;
|
|
47
|
+
padding: 0;
|
|
48
|
+
}
|
|
49
|
+
#grid-left {
|
|
50
|
+
position: fixed;
|
|
51
|
+
background-color: var(--theme-bg);
|
|
52
|
+
z-index: 10;
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
#grid-main {
|
|
56
|
+
padding: var(--doc-padding) var(--gutter);
|
|
57
|
+
grid-column: 2;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
height: 100%;
|
|
61
|
+
}
|
|
62
|
+
#grid-right {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
:global(.mobile-sidebar-toggle) {
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
}
|
|
68
|
+
:global(.mobile-sidebar-toggle) #grid-left {
|
|
69
|
+
display: block;
|
|
70
|
+
top: 2rem;
|
|
71
|
+
}
|
|
72
|
+
@media (min-width: 50em) {
|
|
73
|
+
.layout {
|
|
74
|
+
overflow: initial;
|
|
75
|
+
grid-template-columns:
|
|
76
|
+
20rem
|
|
77
|
+
minmax(0, var(--max-width));
|
|
78
|
+
gap: 1em;
|
|
79
|
+
}
|
|
80
|
+
#grid-left {
|
|
81
|
+
display: flex;
|
|
82
|
+
padding-left: 2rem;
|
|
83
|
+
position: sticky;
|
|
84
|
+
grid-column: 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@media (min-width: 72em) {
|
|
89
|
+
.layout {
|
|
90
|
+
grid-template-columns:
|
|
91
|
+
20rem
|
|
92
|
+
minmax(0, var(--max-width))
|
|
93
|
+
18rem;
|
|
94
|
+
padding-left: 0;
|
|
95
|
+
padding-right: 0;
|
|
96
|
+
margin: 0 auto;
|
|
97
|
+
}
|
|
98
|
+
#grid-right {
|
|
99
|
+
grid-column: 3;
|
|
100
|
+
display: flex;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
104
|
+
</head>
|
|
105
|
+
|
|
106
|
+
<body>
|
|
107
|
+
<Header {currentPage} />
|
|
108
|
+
<main class="layout">
|
|
109
|
+
<aside id="grid-left" class="grid-sidebar" title="Site Navigation">
|
|
110
|
+
<LeftSidebar {currentPage} />
|
|
111
|
+
</aside>
|
|
112
|
+
<div id="grid-main">
|
|
113
|
+
<PageContent {content} {githubEditUrl}>
|
|
114
|
+
<slot />
|
|
115
|
+
</PageContent>
|
|
116
|
+
</div>
|
|
117
|
+
<aside id="grid-right" class="grid-sidebar" title="Table of Contents">
|
|
118
|
+
<RightSidebar {content} {githubEditUrl} />
|
|
119
|
+
</aside>
|
|
120
|
+
</main>
|
|
121
|
+
</body>
|
|
122
|
+
</html>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Include
|
|
3
|
+
description: Manage modules from Moddable SDK
|
|
4
|
+
layout: ../../../layouts/MainLayout.astro
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Manage modules from Moddable
|
|
8
|
+
|
|
9
|
+
The Moddable SdK ships with many first-party modules to support various features, peripherals, sensors, etc. The `include` command will update the project `manifest.json` with the selected module:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
xs-dev include network/wifi
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or select from available modules:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
xs-dev include
|
|
19
|
+
xs-dev include files
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Select a device
|
|
23
|
+
|
|
24
|
+
When the `--device` flag is present, the module is added to the `platforms` section of the `manifest.json` for the specified device. When `device` is not provided, the module is added to the global manifest section to be used for all devices. For example, the following adds the module for use on `esp32` devices only:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
xs-dev include files/flash --device esp32
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Remove a module
|
|
31
|
+
|
|
32
|
+
Updates the `manifest.json` to remove the module.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
xs-dev remove network/wifi
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or remove all modules that contain a string. This removes all modules that contain `"wifi"`.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
xs-dev remove wifi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The `--device` flag works for the `remove` command as well:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
xs-dev remove network/mqtt --device esp32
|
|
48
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Init
|
|
3
|
+
description: Scaffold new Moddable projects
|
|
4
|
+
layout: ../../../layouts/MainLayout.astro
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Scaffold new Moddable projects
|
|
8
|
+
|
|
9
|
+
The default template creates a `main.js` and minimally configured `manifest.json` for running in the simulator.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
xs-dev init my-project
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## TypeScript
|
|
16
|
+
|
|
17
|
+
The `--typescript` flag will create a project with Moddable types and a `main.ts` to get started:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
xs-dev init my-typed-project --typescript
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## IO (ECMA 419)
|
|
24
|
+
|
|
25
|
+
The `--io` flag sets up the project to use the [TC53 IO manifest](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/io/io.md) in the generated `mainfest.json`:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
xs-dev init my-io-project --io
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Moddable example
|
|
32
|
+
|
|
33
|
+
For the `--example` flag, it can be used as a boolean to select a project from the list of available [Moddable examples](https://github.com/Moddable-OpenSource/moddable/tree/public/examples):
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
xs-dev init my-example-project --example
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or select from a filtered list of projects:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
xs-dev init my-http-project --example http
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or if the complete example name is passed, it will be selected by default:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
xs-dev init my-mqtt-project --example network/mqtt/mqttbasic
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Overwrite
|
|
52
|
+
|
|
53
|
+
An existing directory matching the project name can be overwritten with the `--overwrite` flag:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
xs-dev init my-existing-project --overwrite
|
|
57
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Run
|
|
3
|
+
description: Build and run Moddable projects or examples
|
|
4
|
+
layout: ../../../layouts/MainLayout.astro
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Run Moddable projects
|
|
8
|
+
|
|
9
|
+
Within a project directory, the `run` command will invoke [`mcconfig`](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/tools/tools.md#mcconfig) to generate the `make` file based on the `manifest.json` followed by building and running the project in the current environment simulator:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
xs-dev run
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
When not in the project directory, a path can be passed to `run`:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
xs-dev run path/to/project
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Moddable examples
|
|
22
|
+
|
|
23
|
+
Use the `--example` flag to run a project included with the Moddable SDK:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
xs-dev run --example helloworld
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The `--list-examples` provides a searchable list of available example projects:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
xs-dev run --list-examples
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Select a device target
|
|
36
|
+
|
|
37
|
+
The `--device` flag allows for selecting a supported [device or simulator target](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/tools/tools.md#arguments):
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
xs-dev run --device esp32
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To dynamically select the device, use the `--list-devices` flag:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
xs-dev run --list-devices
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This can be used in tandem with the `--example` or `--list-examples` flags to run an example project on a connected device:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
xs-dev run --list-devices --list-examples
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Select a port address
|
|
56
|
+
|
|
57
|
+
The `--port` flag accepts a path to port for connected device (defaults to: `UPLOAD_PORT` environment variable):
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
xs-dev run --port /dev/cu.usbserial-0001 --device esp8266
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
_This value can be discovered using the [`scan`](./scan) command._
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Scan
|
|
3
|
+
description: Discover connected device targets
|
|
4
|
+
layout: ../../../layouts/MainLayout.astro
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Discovery available devices
|
|
8
|
+
|
|
9
|
+
This command will use the [`esptool.py`](https://github.com/espressif/esptool) and/or [`picotool`](https://github.com/raspberrypi/picotool) command line tools to find available device targets connected over USB to the local dev environment.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
xs-dev scan
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This will provide info with the port address, device name, and discovered features:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
✔ Found the following available devices!
|
|
19
|
+
Port Device Features
|
|
20
|
+
/dev/cu.usbserial-0001 ESP8266EX WiFi
|
|
21
|
+
/dev/cu.usbserial-DN02N5XK ESP32-D0WDQ6 (revision 0) WiFi, BT, Dual Core, Coding Scheme None
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The port can be used with the [`run`](./run) command to specify a device, if multiple are connected:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
xs-dev run --port /dev/cu.usbserial-0001 --device esp8266
|
|
28
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Setup
|
|
3
|
+
description: xs-dev platform setup
|
|
4
|
+
layout: ../../../layouts/MainLayout.astro
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Moddable Platform Setup
|
|
8
|
+
|
|
9
|
+
This command downloads and builds the [Moddable developer tooling](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/tools/tools.md) for the current OS (Windows support coming soon).
|
|
10
|
+
|
|
11
|
+
[After installing the CLI](/en/introduction#installation), call the `setup` command:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
xs-dev setup
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This process mostly automates the instructions provided by [Moddable's "Getting Started" documentation](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/Moddable%20SDK%20-%20Getting%20Started.md) with a few exceptions.
|
|
18
|
+
|
|
19
|
+
**On macOS:**
|
|
20
|
+
|
|
21
|
+
[Homebrew](https://brew.sh/) is assumed to be installed.
|
|
22
|
+
|
|
23
|
+
The [Xcode Command Line tools](https://developer.apple.com/xcode/) are required; `setup` will check for their existence before continuing.
|
|
24
|
+
|
|
25
|
+
A symlink for [`xsbug.app`](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/xs/xsbug.md) is created in `/Applications` for easy access through Launchpad.
|
|
26
|
+
|
|
27
|
+
**On Unix environments:**
|
|
28
|
+
|
|
29
|
+
The [`moddable` git repo](https://github.com/Moddable-OpenSource/moddable) is cloned into `~/.local/share` instead of a new/existing `~/Projects` directory.
|
|
30
|
+
|
|
31
|
+
## Device Setup
|
|
32
|
+
|
|
33
|
+
While the `setup` command provides the Moddable SDK for the dev environment, the `--device` flag selects another platform target SDK to set up. It ensures the Moddable SDK has been installed first.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
xs-dev setup --device esp32
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use the `--list-devices` flag to get a prompt for supported device tooling to install.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
xs-dev setup --list-devices
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Additional related tooling
|
|
46
|
+
|
|
47
|
+
There are some utilities that are not included in the Moddable SDK or other platform tooling but can be helpful with some common development tasks. The `--tool` flag allows for installing one of these related tools, which may not be easily done from a typical package manager.
|
|
48
|
+
|
|
49
|
+
**Supported tools:**
|
|
50
|
+
|
|
51
|
+
[`fontbm`](https://github.com/vladimirgamalyan/fontbm): BMFont compatible, cross-platform (Linux/macOS/Windows) command line bitmap font generator (FreeType2 based render)
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
xs-dev setup --tool fontbm
|
|
55
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Teardown
|
|
3
|
+
description: Clean up dev environment
|
|
4
|
+
layout: ../../../layouts/MainLayout.astro
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Clean up environment changes
|
|
8
|
+
|
|
9
|
+
Remove all installed git repos and toolchains, unset environment changes. This is all or nothing currently; there's no filter for selecting an individual platform or device tooling.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
xs-dev teardown
|
|
13
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Update
|
|
3
|
+
description: Stay up to date with the latest tooling
|
|
4
|
+
layout: ../../../layouts/MainLayout.astro
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SDK & Tooling Updates
|
|
8
|
+
|
|
9
|
+
Stay up to date with the latest tooling from Moddable and supported device targets. As with the [`setup`](./setup) command, the current dev environment (Mac or Linux) is the default selected target:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
xs-dev update
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The `--device` flag allows for selecting a different target platform:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
xs-dev update --device esp32
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
_There may be some platforms that are supported by the `setup` command but not `update` yet._
|