create-lupine 1.2.0 → 1.3.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 +13 -7
- package/index.js +236 -109
- package/package.json +1 -1
- package/templates/common/.agents/skills/lupine-framework/SKILL.md +3 -3
- package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +16 -1
- package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +1 -1
- package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +17 -88
- package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +47 -24
- package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +1 -0
- package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +2 -2
- package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +3 -1
- package/templates/common/.env.development +2 -0
- package/templates/common/.env.mobile +4 -3
- package/templates/common/_env +10 -5
- package/templates/common/apps/server/README.md +10 -0
- package/templates/common/dev/cp-folder.js +9 -4
- package/templates/lupine-template-cv-starter/README.md +33 -1
- package/templates/lupine-template-cv-starter/app/package.json +20 -0
- package/templates/lupine-template-cv-starter/app/src/app.tsx +6 -0
- package/templates/lupine-template-cv-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-cv-starter/app/src/index.test.tsx +71 -0
- package/templates/lupine-template-cv-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-cv-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-cv-starter/lupine.json +8 -7
- package/templates/lupine-template-cv-starter/web/src/index.html +9 -2
- package/templates/lupine-template-cv-starter/web/src/index.tsx +9 -14
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.html +9 -2
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +4 -20
- package/templates/lupine-template-doc-starter/README.md +33 -1
- package/templates/lupine-template-doc-starter/app/package.json +20 -0
- package/templates/lupine-template-doc-starter/app/src/app.tsx +6 -0
- package/templates/lupine-template-doc-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-doc-starter/app/src/index.test.tsx +78 -0
- package/templates/lupine-template-doc-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-doc-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-doc-starter/lupine.json +8 -7
- package/templates/lupine-template-doc-starter/web/src/index.html +9 -2
- package/templates/lupine-template-doc-starter/web/src/index.tsx +9 -14
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html +9 -2
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +4 -20
- package/templates/lupine-template-fullstack-note/README.md +83 -0
- package/templates/{lupine-template-cv-starter → lupine-template-fullstack-note}/api/package.json +2 -2
- package/templates/lupine-template-fullstack-note/api/resources/install.mysql.sql +32 -0
- package/templates/lupine-template-fullstack-note/api/resources/install.sqlite.sql +27 -0
- package/templates/lupine-template-fullstack-note/api/src/service/answer.ts +39 -0
- package/templates/lupine-template-fullstack-note/api/src/service/api.ts +52 -0
- package/templates/lupine-template-fullstack-note/api/src/service/db.ts +78 -0
- package/templates/lupine-template-fullstack-note/api/src/service/notes-api.ts +86 -0
- package/templates/lupine-template-fullstack-note/api/src/service/root-api.ts +19 -0
- package/templates/lupine-template-fullstack-note/api/src/service/user-api.ts +182 -0
- package/templates/lupine-template-fullstack-note/app/package.json +19 -0
- package/templates/lupine-template-fullstack-note/app/src/app.tsx +75 -0
- package/templates/lupine-template-fullstack-note/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-fullstack-note/app/src/index.test.tsx +373 -0
- package/templates/lupine-template-fullstack-note/app/src/index.web.tsx +20 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/components.tsx +65 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/details.tsx +38 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/discover.tsx +25 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/home.tsx +76 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/inbox.tsx +49 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/login.tsx +54 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/me.tsx +32 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/notes.tsx +128 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/settings.tsx +45 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/AppMenu.tsx +44 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/api.ts +159 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/data.ts +20 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/locales/ja.ts +80 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/locales/zh-CN.ts +80 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/texts.ts +14 -0
- package/templates/lupine-template-fullstack-note/app/tsconfig.json +17 -0
- package/templates/lupine-template-fullstack-note/lupine.json +25 -0
- package/templates/lupine-template-fullstack-note/web/assets/favicon.ico +0 -0
- package/templates/{lupine-template-doc-starter/api → lupine-template-fullstack-note/web}/package.json +2 -2
- package/templates/lupine-template-fullstack-note/web/src/index.html +23 -0
- package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
- package/templates/lupine-template-fullstack-starter/README.md +64 -14
- package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +2 -2
- package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +2 -2
- package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +2 -2
- package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +72 -47
- package/templates/lupine-template-fullstack-starter/app/package.json +20 -0
- package/templates/lupine-template-fullstack-starter/app/src/app.tsx +76 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.test.tsx +276 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/about.tsx +27 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/contact.tsx +41 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/favorite.tsx +27 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/home.tsx +63 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/login.tsx +63 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/mine.tsx +44 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/profile.tsx +58 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/register.tsx +48 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/reset-password.tsx +41 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/settings.tsx +33 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/story.tsx +46 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/api.ts +127 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/parts.tsx +100 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/stories.ts +65 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/texts.ts +79 -0
- package/templates/lupine-template-fullstack-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-fullstack-starter/lupine.json +6 -7
- package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/home-search-component.tsx +18 -25
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-card.tsx +17 -8
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-list.tsx +1 -2
- package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.html +1 -0
- package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.tsx +13 -28
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-cfg.tsx +23 -19
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-edit.tsx +3 -4
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-list.tsx +2 -3
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-user.tsx +15 -20
- package/templates/lupine-template-fullstack-starter/web/src/index.html +8 -2
- package/templates/lupine-template-fullstack-starter/web/src/index.tsx +11 -150
- package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +7 -25
- package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +0 -3
- package/templates/lupine-template-fullstack-starter/web/src/styles/theme.ts +1 -2
- package/templates/lupine-template-responsive-starter/README.md +46 -2
- package/templates/lupine-template-responsive-starter/app/package.json +19 -0
- package/templates/lupine-template-responsive-starter/app/src/app.tsx +80 -0
- package/templates/lupine-template-responsive-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-responsive-starter/app/src/index.test.tsx +283 -0
- package/templates/lupine-template-responsive-starter/app/src/index.web.tsx +31 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/about.tsx +23 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/finance.tsx +48 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/mine.tsx +60 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/not-found.tsx +9 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-detail.tsx +43 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-edit.tsx +45 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-search.tsx +62 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/notes.tsx +71 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/settings.tsx +55 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/tools.tsx +112 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/icons.ts +7 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/layout.ts +18 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/locales/zh-CN.ts +89 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/menu.tsx +81 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/nav.ts +12 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/store.ts +72 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/texts.ts +11 -0
- package/templates/lupine-template-responsive-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-responsive-starter/lupine.json +7 -6
- package/templates/lupine-template-responsive-starter/web/src/index.html +9 -2
- package/templates/lupine-template-responsive-starter/web/src/index.tsx +9 -25
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +12 -6
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +12 -22
- package/templates/common/apps/server/src/app-loader.ts +0 -4
- package/templates/lupine-template-cv-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-cv-starter/api/src/index.ts +0 -15
- package/templates/lupine-template-cv-starter/web/src/client-env-keys.ts +0 -5
- package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +0 -15
- package/templates/lupine-template-doc-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-doc-starter/api/src/index.ts +0 -15
- package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +0 -6
- package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +0 -5
- package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +0 -16
- package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +0 -22
- package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +0 -52
- package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +0 -75
- package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +0 -162
- package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +0 -165
- package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +0 -118
- package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +0 -122
- package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +0 -12
- package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +0 -161
- package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +0 -163
- package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +0 -166
- package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +0 -177
- package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +0 -84
- package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +0 -48
- package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +0 -61
- package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +0 -61
- package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +0 -23
- package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +0 -90
- package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +0 -105
- package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +0 -38
- package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +0 -38
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +0 -58
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +0 -27
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +0 -54
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +0 -112
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +0 -112
- package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +0 -57
- package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +0 -19
- package/templates/lupine-template-fullstack-starter/web/src/styles/app.css +0 -0
- package/templates/lupine-template-responsive-starter/api/package.json +0 -6
- package/templates/lupine-template-responsive-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +0 -18
- package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +0 -76
- package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +0 -93
- package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +0 -87
- package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -81
- package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -211
- package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -107
- package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -110
- package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -144
- package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -188
- package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +0 -95
- package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +0 -169
- package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -53
- package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -32
- package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -35
- package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -444
- package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -318
- package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -35
- package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +0 -87
- package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +0 -45
- package/templates/lupine-template-responsive-starter/web/src/styles/app.css +0 -0
- package/templates/lupine-template-responsive-starter/web/src/styles/base-css.ts +0 -65
- package/templates/lupine-template-responsive-starter/web/src/styles/global.css +0 -2130
- package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +0 -17
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/01-experience/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/02-projects/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/03-skills/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/04-education/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/01-experience/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/02-projects/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/03-skills/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/04-education/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/01-experience/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/02-projects/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/03-skills/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/04-education/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/01-experience/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/02-projects/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/03-skills/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/04-education/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/list.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/install.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/started.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/list.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/install.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/started.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/list.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/install.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/started.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/list.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/install.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/started.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
- /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-note}/api/src/index.ts +0 -0
- /package/templates/lupine-template-fullstack-starter/{web/assets/images → app/assets}/sample.png +0 -0
- /package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-props.ts +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lupine-template-cv-starter",
|
|
3
|
+
"nativeOut": "dist/native",
|
|
4
|
+
"nativeApp": "app",
|
|
3
5
|
"markdownEntryPoints": {
|
|
4
|
-
"indir": "
|
|
5
|
-
"outdir": "
|
|
6
|
+
"indir": "app/markdown",
|
|
7
|
+
"outdir": "app/src/markdown-built"
|
|
6
8
|
},
|
|
7
9
|
"webEntryPoints": [
|
|
8
10
|
{
|
|
@@ -16,9 +18,8 @@
|
|
|
16
18
|
"outdir": "/lupine-template-cv-starter"
|
|
17
19
|
}
|
|
18
20
|
],
|
|
19
|
-
"apiEntryPoint": "api/src/index.ts",
|
|
20
21
|
"watchFiles": [
|
|
21
|
-
"
|
|
22
|
+
"app/markdown/**/*.md"
|
|
22
23
|
],
|
|
23
24
|
"copyFiles": [
|
|
24
25
|
{
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
"env": "all",
|
|
36
|
-
"from": "
|
|
37
|
-
"to": "
|
|
37
|
+
"from": "web/src/lupine-template-cv-starter/assets",
|
|
38
|
+
"to": "web/lupine-template-cv-starter/assets"
|
|
38
39
|
}
|
|
39
40
|
]
|
|
40
|
-
}
|
|
41
|
+
}
|
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title><!--META-TITLE--></title>
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<!--META-ENV-START-->
|
|
8
8
|
<!--META-ENV-END-->
|
|
9
9
|
<link rel="shortcut icon" href="{SUBDIR}/assets/favicon.ico?t={hash}" type="image/x-icon" />
|
|
10
|
-
<
|
|
10
|
+
<style>
|
|
11
|
+
html,
|
|
12
|
+
body,
|
|
13
|
+
.lupine-root {
|
|
14
|
+
height: 100%;
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
11
18
|
<script defer src="{SUBDIR}/index.js?t={hash}"></script>
|
|
12
19
|
</head>
|
|
13
20
|
<body>
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { bindRouter, PageRouter,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import { baseCss } from './styles/base-css';
|
|
1
|
+
import { bindRouter, PageRouter, setDefaultPageTitle } from 'lupine.web';
|
|
2
|
+
import { AppPage } from '../../app/src/index.web';
|
|
3
|
+
// the primitives of the app in the page that the server renders
|
|
4
|
+
import 'lupine.native.core/web/server';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
bindTheme('light', pressThemes);
|
|
11
|
-
bindAppGlobalStyle('comm-css', baseCss, false, true);
|
|
12
|
-
setDefaultPageTitle('Lupine.js Doc');
|
|
6
|
+
// The page of the site is the app (app/), in the same bundle: the server renders the page of the address (search
|
|
7
|
+
// engines see the text). keep: the app is made once and stays; when the address changes (its own pages, the back
|
|
8
|
+
// button) it follows the address itself. Pages of the site itself go into pageRouter before it.
|
|
13
9
|
|
|
14
|
-
|
|
10
|
+
setDefaultPageTitle('CV Starter');
|
|
15
11
|
|
|
16
12
|
const pageRouter = new PageRouter();
|
|
17
|
-
pageRouter.use('*',
|
|
18
|
-
|
|
13
|
+
pageRouter.use('*', AppPage, { keep: true });
|
|
19
14
|
bindRouter(pageRouter);
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
href="{SUBDIR}/assets/favicon.ico"
|
|
50
50
|
type="image/x-icon"
|
|
51
51
|
/>
|
|
52
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
52
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
53
53
|
<!--META-ENV-START-->
|
|
54
54
|
<!--META-ENV-END-->
|
|
55
55
|
<link
|
|
@@ -57,7 +57,14 @@
|
|
|
57
57
|
href="{SUBDIR}/assets/favicon.ico?t={hash}"
|
|
58
58
|
type="image/x-icon"
|
|
59
59
|
/>
|
|
60
|
-
<
|
|
60
|
+
<style>
|
|
61
|
+
html,
|
|
62
|
+
body,
|
|
63
|
+
.lupine-root {
|
|
64
|
+
height: 100%;
|
|
65
|
+
margin: 0;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
61
68
|
<script defer src="{SUBDIR}/index.js?t={hash}"></script>
|
|
62
69
|
<!-- Remove Cloudflare Web Analytics if you clone this project -->
|
|
63
70
|
<script
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { bindPressData, PressPage, pressThemes, setPressSubDir } from 'lupine.press';
|
|
3
|
-
import { ClientEnvKeys } from '../client-env-keys';
|
|
4
|
-
import { baseCss } from '../styles/base-css';
|
|
5
|
-
import { markdownConfig } from '../markdown-built/markdown-config';
|
|
1
|
+
import { start } from '../../../app/src/index.web';
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
bindTheme('light', pressThemes);
|
|
11
|
-
bindAppGlobalStyle('comm-css', baseCss, false, true);
|
|
12
|
-
setDefaultPageTitle('Doc Starter');
|
|
13
|
-
|
|
14
|
-
bindPressData(markdownConfig);
|
|
15
|
-
setPressSubDir('/lupine-template-cv-starter');
|
|
16
|
-
|
|
17
|
-
const pageRouter = new PageRouter();
|
|
18
|
-
pageRouter.setSubDir('/lupine-template-cv-starter');
|
|
19
|
-
pageRouter.use('*', PressPage);
|
|
20
|
-
|
|
21
|
-
bindRouter(pageRouter);
|
|
3
|
+
// The page for GitHub Pages (https://<user>.github.io/lupine-template-cv-starter/): the app without the server, in the
|
|
4
|
+
// folder of the project. Its 404.html sends other addresses of the folder to this page. npm run build, then npm run cp-docs.
|
|
5
|
+
start(document.querySelector<HTMLElement>('.lupine-root') || document.body, '/lupine-template-cv-starter');
|
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Doc Starter
|
|
2
2
|
|
|
3
|
-
A documentation site from Markdown files
|
|
3
|
+
A documentation site from Markdown files, one code base for the web, iOS, Android, macOS and Windows: a sidebar from the folders, several languages (`app/markdown/en`, `app/markdown/zh`), light and dark themes. The server renders each page (search engines see the text), and the same app can be published to GitHub Pages. A template of `npx create-lupine` (`doc-starter`).
|
|
4
4
|
|
|
5
5
|
[Live demo](https://uuware.github.io/lupine-template-doc-starter/) · [Repository](https://github.com/uuware/lupine-template-doc-starter)
|
|
6
|
+
|
|
7
|
+
<!-- screenshots macos=1 windows=2 web=/ ios=2,3 android=4,5 -->
|
|
8
|
+
<table>
|
|
9
|
+
<tr><th>macOS</th><th>Windows</th><th>Web</th></tr>
|
|
10
|
+
<tr><td><a href="docs/macos-1-home.png"><img src="docs/macos-1-home.png" width="253" alt="macOS"></a></td><td><a href="docs/windows-2-page.png"><img src="docs/windows-2-page.png" width="253" alt="Windows"></a></td><td><a href="docs/web-1.png"><img src="docs/web-1.png" width="253" alt="Web"></a></td></tr>
|
|
11
|
+
</table>
|
|
12
|
+
<table>
|
|
13
|
+
<tr><th colspan="2">iOS</th><th colspan="2">Android</th></tr>
|
|
14
|
+
<tr><td><a href="docs/ios-2-page.png"><img src="docs/ios-2-page.png" width="183" alt="iOS"></a></td><td><a href="docs/ios-3-sidebar.png"><img src="docs/ios-3-sidebar.png" width="183" alt="iOS"></a></td><td><a href="docs/android-4-chinese.png"><img src="docs/android-4-chinese.png" width="183" alt="Android"></a></td><td><a href="docs/android-5-dark.png"><img src="docs/android-5-dark.png" width="183" alt="Android"></a></td></tr>
|
|
15
|
+
</table>
|
|
16
|
+
<!-- /screenshots -->
|
|
17
|
+
|
|
18
|
+
| Folder | |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `app/markdown` | the pages. `index.md` lists the languages; `<lang>/index.md` has the title, `nav`, `sidebar`, `github-link` and the home page (`layout: home`, `hero`, `features`) |
|
|
21
|
+
| `app/src` | the app: `PressApp` of `lupine.press/native` with the pages that the build makes of the markdown (`app/src/markdown-built`, don't edit) |
|
|
22
|
+
| `web/` | the page of the site, with the app in it; `web/src/lupine-template-doc-starter` is the page for GitHub Pages |
|
|
23
|
+
| `lupine.json` | what `npm run dev` builds; `"nativeApp": "app"` for the apps |
|
|
24
|
+
| no `api/` | the server is the default one of lupine-build: the web files and the pages rendered on the server. For routes of your own add `api/src/index.ts` and `"apiEntryPoint"` in `lupine.json` (as in the fullstack templates) |
|
|
25
|
+
|
|
26
|
+
In a project of create-lupine (and in the repository of this template) the same is in the scripts: `npm run run-mac`, `run-ios`, `run-android`, `run-exe`; `build-android` (the apk for the store), `bump` (the next version), `icons` (the icons of the site from the icon of the app), `release` (a folder for the server).
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run dev # the site, see the address it prints
|
|
30
|
+
npm run native -- macos --app=lupine-template-doc-starter --run
|
|
31
|
+
npm run native -- ios --app=lupine-template-doc-starter --run
|
|
32
|
+
npm run native -- android --app=lupine-template-doc-starter --run
|
|
33
|
+
npm run native -- windows --app=lupine-template-doc-starter --run
|
|
34
|
+
npm run native -- test macos --app=lupine-template-doc-starter # its tests (app/src/index.test.tsx)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
GitHub Pages: `npm run build`, then `npm run cp-docs` copies the page to `docs/`; in the settings of the repository, Pages from the `docs` folder. The folder of the page in `web/src` and the paths in its `index.tsx`, `index.html`, `404.html` and in `lupine.json` are the name of the repository: rename them to yours.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lupine-template-doc-starter-app",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "A documentation site from Markdown files as an app: iOS, Android, macOS, Windows and the web.",
|
|
6
|
+
"lupineNative": {
|
|
7
|
+
"name": "LupineDocs",
|
|
8
|
+
"id": "com.uuware.lupine.docs",
|
|
9
|
+
"entry": {
|
|
10
|
+
"native": "src/index.native.tsx",
|
|
11
|
+
"test": "src/index.test.tsx",
|
|
12
|
+
"web": "src/index.web.tsx"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"lupine.native.components": "^1.1.0",
|
|
17
|
+
"lupine.native.core": "^1.1.0",
|
|
18
|
+
"lupine.press": "^1.3.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PressApp } from 'lupine.press/native';
|
|
2
|
+
// made by lupine-build (and lupine-native) from the files of app/markdown: "markdownEntryPoints" of lupine.json
|
|
3
|
+
import { markdownConfig } from './markdown-built/markdown-config';
|
|
4
|
+
|
|
5
|
+
/** The site: a home page, pages with a sidebar, languages, light and dark themes. */
|
|
6
|
+
export const App = () => <PressApp data={markdownConfig} />;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference path="../../../../node_modules/lupine.native.core/src/native-globals.d.ts" />
|
|
2
|
+
// Walks through the app inside a native shell built with --test: presses the real views.
|
|
3
|
+
// npm run native -- test macos --app=lupine-template-doc-starter
|
|
4
|
+
import { Platform, windowInfo } from 'lupine.native.core';
|
|
5
|
+
import { isWide, router, setLang, setThemePref, theme } from 'lupine.native.components';
|
|
6
|
+
import { runApp } from 'lupine.native.core/native';
|
|
7
|
+
import { App } from './app';
|
|
8
|
+
|
|
9
|
+
const native = globalThis.__lupine;
|
|
10
|
+
const act = (id: string, action: string, arg?: unknown) => native.test!(id, action, arg);
|
|
11
|
+
const text = (id: string) => act(id, 'text');
|
|
12
|
+
const sleep = (ms: number) => new Promise<void>((done) => setTimeout(done, ms));
|
|
13
|
+
const exists = (id: string) => act(id, 'x') !== '<missing>';
|
|
14
|
+
|
|
15
|
+
let passed = 0;
|
|
16
|
+
let failed = 0;
|
|
17
|
+
const check = (name: string, actual: unknown, expected: unknown) => {
|
|
18
|
+
const ok = actual === expected;
|
|
19
|
+
if (ok) passed++;
|
|
20
|
+
else failed++;
|
|
21
|
+
console.log(`TEST ${ok ? 'ok ' : 'FAIL'} ${name}${ok ? '' : ` -> ${JSON.stringify(actual)}, expected ${JSON.stringify(expected)}`}`);
|
|
22
|
+
};
|
|
23
|
+
const shot = async (name: string) => {
|
|
24
|
+
await sleep(250);
|
|
25
|
+
if (Platform.OS === 'macos' || Platform.OS === 'windows') act('', 'screenshot', `shot-${name}.png`);
|
|
26
|
+
console.log(`SHOT ${name}`);
|
|
27
|
+
await sleep(Platform.OS === 'macos' || Platform.OS === 'windows' ? 50 : 2500);
|
|
28
|
+
};
|
|
29
|
+
const press = async (id: string, wait = 600) => {
|
|
30
|
+
check(`press ${id}`, exists(id) && act(id, 'click'), true);
|
|
31
|
+
await sleep(wait);
|
|
32
|
+
};
|
|
33
|
+
/** a page of the sidebar: beside the text on wide windows, in the drawer of the menu button on phones */
|
|
34
|
+
const side = async (link: string) => {
|
|
35
|
+
if (!isWide()) await press('press-menu', 500);
|
|
36
|
+
await press(`press-side-${link}`, 800);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
setThemePref('light');
|
|
40
|
+
setLang('en');
|
|
41
|
+
runApp(App);
|
|
42
|
+
console.log(`TEST window ${JSON.stringify(windowInfo())}`);
|
|
43
|
+
|
|
44
|
+
const main = async () => {
|
|
45
|
+
for (let i = 0; i < 100 && !(act('press-content', 'width') > 0); i++) await sleep(100);
|
|
46
|
+
await sleep(500);
|
|
47
|
+
check('the title of the site', text('press-title'), 'Doc Starter');
|
|
48
|
+
check('the home page', text('press-hero-name'), 'Doc Starter');
|
|
49
|
+
await shot('1-home');
|
|
50
|
+
|
|
51
|
+
await press('press-action-0', 900);
|
|
52
|
+
check('Get Started', router.path(), '/en/guide/started');
|
|
53
|
+
await shot('2-page');
|
|
54
|
+
|
|
55
|
+
await side('/en/guide/install');
|
|
56
|
+
check('a page of the sidebar', router.path(), '/en/guide/install');
|
|
57
|
+
await shot('3-sidebar');
|
|
58
|
+
|
|
59
|
+
await press('press-lang');
|
|
60
|
+
await press('option-zh', 900);
|
|
61
|
+
check('the same page in Chinese', router.path(), '/zh/guide/install');
|
|
62
|
+
check('the title in Chinese', text('press-title'), '文档演示');
|
|
63
|
+
await shot('4-chinese');
|
|
64
|
+
|
|
65
|
+
await press('press-theme');
|
|
66
|
+
check('dark', theme().mode, 'dark');
|
|
67
|
+
await shot('5-dark');
|
|
68
|
+
await press('press-theme');
|
|
69
|
+
|
|
70
|
+
router.back();
|
|
71
|
+
await sleep(600);
|
|
72
|
+
check('back', router.path(), '/en/guide/started');
|
|
73
|
+
await press('press-title', 800);
|
|
74
|
+
check('home again', router.path(), '/');
|
|
75
|
+
|
|
76
|
+
console.log(`TEST RESULT ${failed ? 'FAILED' : 'PASSED'} ${passed} ok, ${failed} failed`);
|
|
77
|
+
};
|
|
78
|
+
main().catch((e) => console.log(`TEST RESULT FAILED ${e && e.stack}`));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { onCleanup, serverRequest, View } from 'lupine.native.core';
|
|
2
|
+
import { router } from 'lupine.native.components';
|
|
3
|
+
import { runApp } from 'lupine.native.core/web';
|
|
4
|
+
import { App } from './app';
|
|
5
|
+
|
|
6
|
+
/** The app follows the address: the address bar shows its page (/en/guide/started), the buttons of the browser go back and forward. */
|
|
7
|
+
export const followAddress = (base?: string) => router.followUrl(base ? { paths: true, base } : undefined);
|
|
8
|
+
|
|
9
|
+
/** The app as a page of the site (web/src/index.tsx: pageRouter.use('*', AppPage, { keep: true })); in the browser it follows the address. */
|
|
10
|
+
export const AppPage = () => {
|
|
11
|
+
if (!serverRequest()) onCleanup(followAddress());
|
|
12
|
+
return (
|
|
13
|
+
<View style={{ height: '100%' }}>
|
|
14
|
+
<App />
|
|
15
|
+
</View>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// A page without the site: lupine-native web starts it in document.body; the page for GitHub Pages
|
|
20
|
+
// (web/src/lupine-template-doc-starter) in its folder.
|
|
21
|
+
export const start = (container: HTMLElement, base?: string) => {
|
|
22
|
+
const stop = followAddress(base);
|
|
23
|
+
const dispose = runApp(App, container);
|
|
24
|
+
return () => {
|
|
25
|
+
dispose();
|
|
26
|
+
stop();
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2020",
|
|
4
|
+
"lib": ["es2020"],
|
|
5
|
+
"types": [],
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"jsxImportSource": "lupine.native.core",
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"skipLibCheck": true
|
|
13
|
+
},
|
|
14
|
+
// the web entries are the only files that may use the DOM, so they aren't checked with these settings
|
|
15
|
+
"include": ["src"],
|
|
16
|
+
"exclude": ["src/**/*.web.tsx"]
|
|
17
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lupine-template-doc-starter",
|
|
3
|
+
"nativeOut": "dist/native",
|
|
4
|
+
"nativeApp": "app",
|
|
3
5
|
"markdownEntryPoints": {
|
|
4
|
-
"indir": "
|
|
5
|
-
"outdir": "
|
|
6
|
+
"indir": "app/markdown",
|
|
7
|
+
"outdir": "app/src/markdown-built"
|
|
6
8
|
},
|
|
7
9
|
"webEntryPoints": [
|
|
8
10
|
{
|
|
@@ -16,9 +18,8 @@
|
|
|
16
18
|
"outdir": "/lupine-template-doc-starter"
|
|
17
19
|
}
|
|
18
20
|
],
|
|
19
|
-
"apiEntryPoint": "api/src/index.ts",
|
|
20
21
|
"watchFiles": [
|
|
21
|
-
"
|
|
22
|
+
"app/markdown/**/*.md"
|
|
22
23
|
],
|
|
23
24
|
"copyFiles": [
|
|
24
25
|
{
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
"env": "all",
|
|
36
|
-
"from": "
|
|
37
|
-
"to": "
|
|
37
|
+
"from": "web/src/lupine-template-doc-starter/assets",
|
|
38
|
+
"to": "web/lupine-template-doc-starter/assets"
|
|
38
39
|
}
|
|
39
40
|
]
|
|
40
|
-
}
|
|
41
|
+
}
|
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title><!--META-TITLE--></title>
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<!--META-ENV-START-->
|
|
8
8
|
<!--META-ENV-END-->
|
|
9
9
|
<link rel="shortcut icon" href="{SUBDIR}/assets/favicon.ico?t={hash}" type="image/x-icon" />
|
|
10
|
-
<
|
|
10
|
+
<style>
|
|
11
|
+
html,
|
|
12
|
+
body,
|
|
13
|
+
.lupine-root {
|
|
14
|
+
height: 100%;
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
11
18
|
<script defer src="{SUBDIR}/index.js?t={hash}"></script>
|
|
12
19
|
</head>
|
|
13
20
|
<body>
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { bindRouter, PageRouter,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import { baseCss } from './styles/base-css';
|
|
1
|
+
import { bindRouter, PageRouter, setDefaultPageTitle } from 'lupine.web';
|
|
2
|
+
import { AppPage } from '../../app/src/index.web';
|
|
3
|
+
// the primitives of the app in the page that the server renders
|
|
4
|
+
import 'lupine.native.core/web/server';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
bindTheme('light', pressThemes);
|
|
11
|
-
bindAppGlobalStyle('comm-css', baseCss, false, true);
|
|
12
|
-
setDefaultPageTitle('Lupine.js Doc');
|
|
6
|
+
// The page of the site is the app (app/), in the same bundle: the server renders the page of the address (search
|
|
7
|
+
// engines see the text). keep: the app is made once and stays; when the address changes (its own pages, the back
|
|
8
|
+
// button) it follows the address itself. Pages of the site itself go into pageRouter before it.
|
|
13
9
|
|
|
14
|
-
|
|
10
|
+
setDefaultPageTitle('Doc Starter');
|
|
15
11
|
|
|
16
12
|
const pageRouter = new PageRouter();
|
|
17
|
-
pageRouter.use('*',
|
|
18
|
-
|
|
13
|
+
pageRouter.use('*', AppPage, { keep: true });
|
|
19
14
|
bindRouter(pageRouter);
|
package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title><!--META-TITLE--></title>
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<!--META-ENV-START-->
|
|
8
8
|
<!--META-ENV-END-->
|
|
9
9
|
<link
|
|
@@ -11,7 +11,14 @@
|
|
|
11
11
|
href="{SUBDIR}/assets/favicon.ico?t={hash}"
|
|
12
12
|
type="image/x-icon"
|
|
13
13
|
/>
|
|
14
|
-
<
|
|
14
|
+
<style>
|
|
15
|
+
html,
|
|
16
|
+
body,
|
|
17
|
+
.lupine-root {
|
|
18
|
+
height: 100%;
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
15
22
|
<script defer src="{SUBDIR}/index.js?t={hash}"></script>
|
|
16
23
|
<!-- Cloudflare Web Analytics -->
|
|
17
24
|
<script
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { bindPressData, PressPage, pressThemes, setPressSubDir } from 'lupine.press';
|
|
3
|
-
import { ClientEnvKeys } from '../client-env-keys';
|
|
4
|
-
import { baseCss } from '../styles/base-css';
|
|
5
|
-
import { markdownConfig } from '../markdown-built/markdown-config';
|
|
1
|
+
import { start } from '../../../app/src/index.web';
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
bindTheme('light', pressThemes);
|
|
11
|
-
bindAppGlobalStyle('comm-css', baseCss, false, true);
|
|
12
|
-
setDefaultPageTitle('Doc Starter');
|
|
13
|
-
|
|
14
|
-
bindPressData(markdownConfig);
|
|
15
|
-
setPressSubDir('/lupine-template-doc-starter');
|
|
16
|
-
|
|
17
|
-
const pageRouter = new PageRouter();
|
|
18
|
-
pageRouter.setSubDir('/lupine-template-doc-starter');
|
|
19
|
-
pageRouter.use('*', PressPage);
|
|
20
|
-
|
|
21
|
-
bindRouter(pageRouter);
|
|
3
|
+
// The page for GitHub Pages (https://<user>.github.io/lupine-template-doc-starter/): the app without the server, in the
|
|
4
|
+
// folder of the project. Its 404.html sends other addresses of the folder to this page. npm run build, then npm run cp-docs.
|
|
5
|
+
start(document.querySelector<HTMLElement>('.lupine-root') || document.body, '/lupine-template-doc-starter');
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Full-stack Notes
|
|
2
|
+
|
|
3
|
+
An app for iOS, Android, macOS, Windows and the web (lupine.native) with accounts and notes kept in the database of its server: the web site that serves the web version of the app (lupine.web), and the API (lupine.api).
|
|
4
|
+
|
|
5
|
+
<!-- screenshots macos=1 windows=17 web=/ ios=1,22 android=4,8 -->
|
|
6
|
+
<table>
|
|
7
|
+
<tr><th>macOS</th><th>Windows</th><th>Web</th></tr>
|
|
8
|
+
<tr><td><a href="docs/macos-1-home.png"><img src="docs/macos-1-home.png" width="253" alt="macOS"></a></td><td><a href="docs/windows-17-notes.png"><img src="docs/windows-17-notes.png" width="253" alt="Windows"></a></td><td><a href="docs/web-1.png"><img src="docs/web-1.png" width="253" alt="Web"></a></td></tr>
|
|
9
|
+
</table>
|
|
10
|
+
<table>
|
|
11
|
+
<tr><th colspan="2">iOS</th><th colspan="2">Android</th></tr>
|
|
12
|
+
<tr><td><a href="docs/ios-1-home.png"><img src="docs/ios-1-home.png" width="183" alt="iOS"></a></td><td><a href="docs/ios-22-home-dark.png"><img src="docs/ios-22-home-dark.png" width="183" alt="iOS"></a></td><td><a href="docs/android-4-chinese.png"><img src="docs/android-4-chinese.png" width="183" alt="Android"></a></td><td><a href="docs/android-8-components.png"><img src="docs/android-8-components.png" width="183" alt="Android"></a></td></tr>
|
|
13
|
+
</table>
|
|
14
|
+
<!-- /screenshots -->
|
|
15
|
+
|
|
16
|
+
| Part | |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `app/` | the app: tabs, a side menu, a list, the notes of the user (`/notes`), sign-in and new accounts (`/login`), settings (theme, language, the server), components, inbox, details. Its settings: `lupineNative` in `app/package.json`; the client of the API: `app/src/shell/api.ts`; the Chinese and Japanese texts: `app/src/shell/locales` |
|
|
19
|
+
| `web/` | the site: `web/src/index.tsx` imports the web version of the app (one bundle) and keeps it in the frame of its router; the server renders the page of the address (with the theme and the language of the cookies); pages of the site itself go into that router |
|
|
20
|
+
| `api/` | the API: routes in `api/src/service/api.ts`; accounts and sessions in `user-api.ts`, notes in `notes-api.ts`, the tables in `db.ts` |
|
|
21
|
+
| `api/resources/` | the tables as SQL (`install.sqlite.sql`, `install.mysql.sql`), for a database made by hand; copied to `data/resources` of the build |
|
|
22
|
+
| `lupine.json` | what `npm run dev` builds; `"nativeApp": "app"` and `"nativeOut": "dist/native"` for `lupine-native` |
|
|
23
|
+
|
|
24
|
+
## First start
|
|
25
|
+
|
|
26
|
+
1. In `.env`: `CRYPTO_KEY`, the key of the sessions (create-lupine fills in a random one; to make one: `node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"`). Without it the API answers every sign-in with the code `no_crypto_key`, and the app says so. A new key signs everybody out.
|
|
27
|
+
2. `npm run dev` with `lupine-template-fullstack-note` in `APPS` and a `DOMAINS:lupine-template-fullstack-note=...` line (empty in a new project: the app gets every host), then open the site (`http://lupine-template-fullstack-note.app.localhost:<HTTP_PORT>/`), Me → Sign in → Create a new account.
|
|
28
|
+
3. Nothing to install: the API creates its tables when they are first needed, in the database of the app (`DB_TYPE` of `.env`; sqlite by default: `sqlite3.db` in `dist/server_root/lupine-template-fullstack-note_data`). For MySQL / MariaDB too; another database: create them from `api/resources/install.*.sql`.
|
|
29
|
+
|
|
30
|
+
Optional in `.env`: `SESSION_EXPIRE_DAYS` (90 by default).
|
|
31
|
+
|
|
32
|
+
## The apps
|
|
33
|
+
|
|
34
|
+
In a project of create-lupine (and in the repository of this template) the same is in the scripts: `npm run run-mac`, `run-ios`, `run-android`, `run-exe`; `build-android` (the apk for the store), `bump` (the next version), `icons` (the icons of the site from the icon of the app), `release` (a folder for the server).
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run native -- macos --app=lupine-template-fullstack-note --run
|
|
38
|
+
npm run native -- ios --app=lupine-template-fullstack-note --run
|
|
39
|
+
npm run native -- android --app=lupine-template-fullstack-note --run
|
|
40
|
+
npm run native -- windows --app=lupine-template-fullstack-note --run
|
|
41
|
+
npm run native -- web --app=lupine-template-fullstack-note --watch # the app alone, as a static page
|
|
42
|
+
npm run native -- test macos --app=lupine-template-fullstack-note # app/src/index.test.tsx
|
|
43
|
+
# the apps for the stores, which call your server (WEB.API_BASE_URL of .env.mobile)
|
|
44
|
+
npm run native -- android --app=lupine-template-fullstack-note --release --env=.env.mobile
|
|
45
|
+
npm run native -- ios --app=lupine-template-fullstack-note --release --env=.env.mobile
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The builds are in `dist/native/lupine-template-fullstack-note-app/<platform>`. The test needs no server: it calls an address where nobody answers, then a fake of the API.
|
|
49
|
+
|
|
50
|
+
## The address of the API
|
|
51
|
+
|
|
52
|
+
The native apps call `WEB.API_BASE_URL` of the env file they are built with (`--env=`; `.env.development` by default, `.env.production` with `--release`), or `lupine-template-fullstack-note.WEB.API_BASE_URL` for this app alone. Put the address of your server (`https://example.com/`) into `.env.mobile` and build the apps for the stores with `--release --env=.env.mobile`: it imports `.env`, and the site, built with `.env.production`, doesn't use it. The key goes into the bundle, so it is public.
|
|
53
|
+
|
|
54
|
+
Without it the app calls `http://lupine-template-fullstack-note.app.localhost:<WEB.API_PORT>`: the server of `npm run dev` on the same computer. The Android emulator uses `http://10.0.2.2:<WEB.API_PORT>` instead. The server finds the app by the host name, so add `lupine-template-fullstack-note.app.localhost` and `10.0.2.2` to its `DOMAINS:` line, unless that line is empty or `*`. A phone needs an address of the computer in the network. Settings shows the address the app uses. Release builds for Android refuse plain `http://`.
|
|
55
|
+
|
|
56
|
+
In the browser the app always calls the site it comes from, and `WEB.API_BASE_URL` is not used.
|
|
57
|
+
|
|
58
|
+
| Route | |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `POST /api/register` | `{ username, password }`: a new account, signed in at once |
|
|
61
|
+
| `POST /api/login` | `{ username, password }` |
|
|
62
|
+
| `POST /api/logout` | the browser forgets the cookie |
|
|
63
|
+
| `GET /api/me` | who is signed in |
|
|
64
|
+
| `GET /api/notes?before=<id>` | the notes of the user, newest first, 100 at a time (`more`: there are older ones; `before`: the id of the last one shown) |
|
|
65
|
+
| `POST /api/notes/add` | `{ text }` |
|
|
66
|
+
| `POST /api/notes/update` | `{ id, text }` (in `api.updateNote` of the app; the page has no editing) |
|
|
67
|
+
| `POST /api/notes/delete` | `{ id }` |
|
|
68
|
+
|
|
69
|
+
Every answer is `{ status: 'ok' | 'error', code, message }`, with an HTTP status that fits (400, 401, 404, 409, 429, 500). The message is English, for logs and curl; the app shows its own text for each code (`messageOf` in `app/src/shell/api.ts`, in the languages of `app/src/shell/locales`), and `offline` when the server isn't reached.
|
|
70
|
+
|
|
71
|
+
## Sessions and security
|
|
72
|
+
|
|
73
|
+
- User names: 3 to 50 characters (letters, digits, `_ . @ -`), kept in lower case. Passwords: 6 to 256 characters, kept as a salted scrypt hash (`CryptoUtils.hashPassword` of lupine.api) and compared in constant time.
|
|
74
|
+
- A sign-in answers the same for an unknown name and a wrong password (`login_failed`), and takes as long. A new account has to tell that a name is taken.
|
|
75
|
+
- After five failed sign-ins in a row a name can't sign in for 15 minutes (`too_many_attempts`). The failures are kept in the database (`$__login_failure`), for every name tried, so the brake works across worker processes and restarts and doesn't tell which names have an account. Someone could keep an account locked this way, and nothing limits new accounts: limit the requests to `/api/login` and `/api/register` in front of the server too (nginx: `limit_req`).
|
|
76
|
+
- The session is a token encrypted with `CRYPTO_KEY` (AES-256 and an HMAC): the id and the name of the user, the time of the sign-in, and a hash of the stored password hash, so a new password ends every session of before. It expires after `SESSION_EXPIRE_DAYS`.
|
|
77
|
+
- In the browser the API sets the httpOnly cookie `_token` (SameSite=lax; Secure on https, also behind a proxy that sends `X-Forwarded-Proto`), so the scripts of the page never hold the token.
|
|
78
|
+
- A native app has no cookie store. It keeps the token from the sign-in answer in `storage` and sends it as `Cookie: lang=...; _token=...`. The API puts the token in the answer only for requests without `Origin`, which browsers always send with a POST, so a script in a page can't get it from there either. Signing out removes it from the device and calls `/api/logout`; the token itself is valid until it expires or the password changes.
|
|
79
|
+
- What writes is a POST. A POST with the `Origin` of another site is refused (`forbidden_origin`); the apps send no `Origin`, so they pass, and browsers are still checked. The notes need a session.
|
|
80
|
+
- Every query of the notes has the id of the user in its `WHERE`, so nobody reaches the notes of another user, not even with their ids. A note has 1 to 2000 characters, a user at most 500 notes.
|
|
81
|
+
- An error of the server (the database ...) is logged and answered with `server_error`, without its details.
|
|
82
|
+
|
|
83
|
+
See [Getting started](https://uuware.github.io/lupine.js/en/native/started).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#-- The tables of the app for MySQL / MariaDB. api/src/service/db.ts makes them itself when they are first needed, so
|
|
2
|
+
#-- this file is only for a database made by hand. $__ is the prefix of the tables (DB_TABLE_PREFIX of .env, tbl_ by
|
|
3
|
+
#-- default). utf8mb4: notes may have emoji.
|
|
4
|
+
|
|
5
|
+
#-- the accounts: password is a salted scrypt hash (scrypt$<salt>$<hash>), username is in lower case
|
|
6
|
+
CREATE TABLE IF NOT EXISTS $__account (
|
|
7
|
+
id INTEGER NOT NULL AUTO_INCREMENT,
|
|
8
|
+
username VARCHAR(50) NOT NULL,
|
|
9
|
+
password VARCHAR(255) NOT NULL,
|
|
10
|
+
created_at VARCHAR(30) NOT NULL,
|
|
11
|
+
PRIMARY KEY (id),
|
|
12
|
+
UNIQUE KEY $__account_username (username)
|
|
13
|
+
) DEFAULT CHARSET=utf8mb4;
|
|
14
|
+
|
|
15
|
+
#-- the notes: account_id is the id of $__account; the times are ISO (UTC)
|
|
16
|
+
CREATE TABLE IF NOT EXISTS $__user_note (
|
|
17
|
+
id INTEGER NOT NULL AUTO_INCREMENT,
|
|
18
|
+
account_id INTEGER NOT NULL,
|
|
19
|
+
text TEXT NOT NULL,
|
|
20
|
+
created_at VARCHAR(30) NOT NULL,
|
|
21
|
+
updated_at VARCHAR(30) NOT NULL,
|
|
22
|
+
PRIMARY KEY (id),
|
|
23
|
+
KEY $__user_note_account (account_id, id)
|
|
24
|
+
) DEFAULT CHARSET=utf8mb4;
|
|
25
|
+
|
|
26
|
+
#-- failed sign-ins of a user name (the brake), for any name: last_at is in milliseconds
|
|
27
|
+
CREATE TABLE IF NOT EXISTS $__login_failure (
|
|
28
|
+
username VARCHAR(50) NOT NULL,
|
|
29
|
+
failures INTEGER NOT NULL DEFAULT 0,
|
|
30
|
+
last_at BIGINT NOT NULL DEFAULT 0,
|
|
31
|
+
PRIMARY KEY (username)
|
|
32
|
+
) DEFAULT CHARSET=utf8mb4;
|