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.
Files changed (268) hide show
  1. package/README.md +13 -7
  2. package/index.js +236 -109
  3. package/package.json +1 -1
  4. package/templates/common/.agents/skills/lupine-framework/SKILL.md +3 -3
  5. package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +16 -1
  6. package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +1 -1
  7. package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +17 -88
  8. package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +47 -24
  9. package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +1 -0
  10. package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +2 -2
  11. package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +3 -1
  12. package/templates/common/.env.development +2 -0
  13. package/templates/common/.env.mobile +4 -3
  14. package/templates/common/_env +10 -5
  15. package/templates/common/apps/server/README.md +10 -0
  16. package/templates/common/dev/cp-folder.js +9 -4
  17. package/templates/lupine-template-cv-starter/README.md +33 -1
  18. package/templates/lupine-template-cv-starter/app/package.json +20 -0
  19. package/templates/lupine-template-cv-starter/app/src/app.tsx +6 -0
  20. package/templates/lupine-template-cv-starter/app/src/index.native.tsx +4 -0
  21. package/templates/lupine-template-cv-starter/app/src/index.test.tsx +71 -0
  22. package/templates/lupine-template-cv-starter/app/src/index.web.tsx +28 -0
  23. package/templates/lupine-template-cv-starter/app/tsconfig.json +17 -0
  24. package/templates/lupine-template-cv-starter/lupine.json +8 -7
  25. package/templates/lupine-template-cv-starter/web/src/index.html +9 -2
  26. package/templates/lupine-template-cv-starter/web/src/index.tsx +9 -14
  27. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.html +9 -2
  28. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +4 -20
  29. package/templates/lupine-template-doc-starter/README.md +33 -1
  30. package/templates/lupine-template-doc-starter/app/package.json +20 -0
  31. package/templates/lupine-template-doc-starter/app/src/app.tsx +6 -0
  32. package/templates/lupine-template-doc-starter/app/src/index.native.tsx +4 -0
  33. package/templates/lupine-template-doc-starter/app/src/index.test.tsx +78 -0
  34. package/templates/lupine-template-doc-starter/app/src/index.web.tsx +28 -0
  35. package/templates/lupine-template-doc-starter/app/tsconfig.json +17 -0
  36. package/templates/lupine-template-doc-starter/lupine.json +8 -7
  37. package/templates/lupine-template-doc-starter/web/src/index.html +9 -2
  38. package/templates/lupine-template-doc-starter/web/src/index.tsx +9 -14
  39. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html +9 -2
  40. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +4 -20
  41. package/templates/lupine-template-fullstack-note/README.md +83 -0
  42. package/templates/{lupine-template-cv-starter → lupine-template-fullstack-note}/api/package.json +2 -2
  43. package/templates/lupine-template-fullstack-note/api/resources/install.mysql.sql +32 -0
  44. package/templates/lupine-template-fullstack-note/api/resources/install.sqlite.sql +27 -0
  45. package/templates/lupine-template-fullstack-note/api/src/service/answer.ts +39 -0
  46. package/templates/lupine-template-fullstack-note/api/src/service/api.ts +52 -0
  47. package/templates/lupine-template-fullstack-note/api/src/service/db.ts +78 -0
  48. package/templates/lupine-template-fullstack-note/api/src/service/notes-api.ts +86 -0
  49. package/templates/lupine-template-fullstack-note/api/src/service/root-api.ts +19 -0
  50. package/templates/lupine-template-fullstack-note/api/src/service/user-api.ts +182 -0
  51. package/templates/lupine-template-fullstack-note/app/package.json +19 -0
  52. package/templates/lupine-template-fullstack-note/app/src/app.tsx +75 -0
  53. package/templates/lupine-template-fullstack-note/app/src/index.native.tsx +4 -0
  54. package/templates/lupine-template-fullstack-note/app/src/index.test.tsx +373 -0
  55. package/templates/lupine-template-fullstack-note/app/src/index.web.tsx +20 -0
  56. package/templates/lupine-template-fullstack-note/app/src/pages/components.tsx +65 -0
  57. package/templates/lupine-template-fullstack-note/app/src/pages/details.tsx +38 -0
  58. package/templates/lupine-template-fullstack-note/app/src/pages/discover.tsx +25 -0
  59. package/templates/lupine-template-fullstack-note/app/src/pages/home.tsx +76 -0
  60. package/templates/lupine-template-fullstack-note/app/src/pages/inbox.tsx +49 -0
  61. package/templates/lupine-template-fullstack-note/app/src/pages/login.tsx +54 -0
  62. package/templates/lupine-template-fullstack-note/app/src/pages/me.tsx +32 -0
  63. package/templates/lupine-template-fullstack-note/app/src/pages/notes.tsx +128 -0
  64. package/templates/lupine-template-fullstack-note/app/src/pages/settings.tsx +45 -0
  65. package/templates/lupine-template-fullstack-note/app/src/shell/AppMenu.tsx +44 -0
  66. package/templates/lupine-template-fullstack-note/app/src/shell/api.ts +159 -0
  67. package/templates/lupine-template-fullstack-note/app/src/shell/data.ts +20 -0
  68. package/templates/lupine-template-fullstack-note/app/src/shell/locales/ja.ts +80 -0
  69. package/templates/lupine-template-fullstack-note/app/src/shell/locales/zh-CN.ts +80 -0
  70. package/templates/lupine-template-fullstack-note/app/src/shell/texts.ts +14 -0
  71. package/templates/lupine-template-fullstack-note/app/tsconfig.json +17 -0
  72. package/templates/lupine-template-fullstack-note/lupine.json +25 -0
  73. package/templates/lupine-template-fullstack-note/web/assets/favicon.ico +0 -0
  74. package/templates/{lupine-template-doc-starter/api → lupine-template-fullstack-note/web}/package.json +2 -2
  75. package/templates/lupine-template-fullstack-note/web/src/index.html +23 -0
  76. package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
  77. package/templates/lupine-template-fullstack-starter/README.md +64 -14
  78. package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +2 -2
  79. package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +2 -2
  80. package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +2 -2
  81. package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +72 -47
  82. package/templates/lupine-template-fullstack-starter/app/package.json +20 -0
  83. package/templates/lupine-template-fullstack-starter/app/src/app.tsx +76 -0
  84. package/templates/lupine-template-fullstack-starter/app/src/index.native.tsx +4 -0
  85. package/templates/lupine-template-fullstack-starter/app/src/index.test.tsx +276 -0
  86. package/templates/lupine-template-fullstack-starter/app/src/index.web.tsx +28 -0
  87. package/templates/lupine-template-fullstack-starter/app/src/pages/about.tsx +27 -0
  88. package/templates/lupine-template-fullstack-starter/app/src/pages/contact.tsx +41 -0
  89. package/templates/lupine-template-fullstack-starter/app/src/pages/favorite.tsx +27 -0
  90. package/templates/lupine-template-fullstack-starter/app/src/pages/home.tsx +63 -0
  91. package/templates/lupine-template-fullstack-starter/app/src/pages/login.tsx +63 -0
  92. package/templates/lupine-template-fullstack-starter/app/src/pages/mine.tsx +44 -0
  93. package/templates/lupine-template-fullstack-starter/app/src/pages/profile.tsx +58 -0
  94. package/templates/lupine-template-fullstack-starter/app/src/pages/register.tsx +48 -0
  95. package/templates/lupine-template-fullstack-starter/app/src/pages/reset-password.tsx +41 -0
  96. package/templates/lupine-template-fullstack-starter/app/src/pages/settings.tsx +33 -0
  97. package/templates/lupine-template-fullstack-starter/app/src/pages/story.tsx +46 -0
  98. package/templates/lupine-template-fullstack-starter/app/src/shell/api.ts +127 -0
  99. package/templates/lupine-template-fullstack-starter/app/src/shell/parts.tsx +100 -0
  100. package/templates/lupine-template-fullstack-starter/app/src/shell/stories.ts +65 -0
  101. package/templates/lupine-template-fullstack-starter/app/src/shell/texts.ts +79 -0
  102. package/templates/lupine-template-fullstack-starter/app/tsconfig.json +17 -0
  103. package/templates/lupine-template-fullstack-starter/lupine.json +6 -7
  104. package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
  105. package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/home-search-component.tsx +18 -25
  106. package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-card.tsx +17 -8
  107. package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-list.tsx +1 -2
  108. package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.html +1 -0
  109. package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.tsx +13 -28
  110. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-cfg.tsx +23 -19
  111. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-edit.tsx +3 -4
  112. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-list.tsx +2 -3
  113. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-user.tsx +15 -20
  114. package/templates/lupine-template-fullstack-starter/web/src/index.html +8 -2
  115. package/templates/lupine-template-fullstack-starter/web/src/index.tsx +11 -150
  116. package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +7 -25
  117. package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +0 -3
  118. package/templates/lupine-template-fullstack-starter/web/src/styles/theme.ts +1 -2
  119. package/templates/lupine-template-responsive-starter/README.md +46 -2
  120. package/templates/lupine-template-responsive-starter/app/package.json +19 -0
  121. package/templates/lupine-template-responsive-starter/app/src/app.tsx +80 -0
  122. package/templates/lupine-template-responsive-starter/app/src/index.native.tsx +4 -0
  123. package/templates/lupine-template-responsive-starter/app/src/index.test.tsx +283 -0
  124. package/templates/lupine-template-responsive-starter/app/src/index.web.tsx +31 -0
  125. package/templates/lupine-template-responsive-starter/app/src/pages/about.tsx +23 -0
  126. package/templates/lupine-template-responsive-starter/app/src/pages/finance.tsx +48 -0
  127. package/templates/lupine-template-responsive-starter/app/src/pages/mine.tsx +60 -0
  128. package/templates/lupine-template-responsive-starter/app/src/pages/not-found.tsx +9 -0
  129. package/templates/lupine-template-responsive-starter/app/src/pages/note-detail.tsx +43 -0
  130. package/templates/lupine-template-responsive-starter/app/src/pages/note-edit.tsx +45 -0
  131. package/templates/lupine-template-responsive-starter/app/src/pages/note-search.tsx +62 -0
  132. package/templates/lupine-template-responsive-starter/app/src/pages/notes.tsx +71 -0
  133. package/templates/lupine-template-responsive-starter/app/src/pages/settings.tsx +55 -0
  134. package/templates/lupine-template-responsive-starter/app/src/pages/tools.tsx +112 -0
  135. package/templates/lupine-template-responsive-starter/app/src/shell/icons.ts +7 -0
  136. package/templates/lupine-template-responsive-starter/app/src/shell/layout.ts +18 -0
  137. package/templates/lupine-template-responsive-starter/app/src/shell/locales/zh-CN.ts +89 -0
  138. package/templates/lupine-template-responsive-starter/app/src/shell/menu.tsx +81 -0
  139. package/templates/lupine-template-responsive-starter/app/src/shell/nav.ts +12 -0
  140. package/templates/lupine-template-responsive-starter/app/src/shell/store.ts +72 -0
  141. package/templates/lupine-template-responsive-starter/app/src/shell/texts.ts +11 -0
  142. package/templates/lupine-template-responsive-starter/app/tsconfig.json +17 -0
  143. package/templates/lupine-template-responsive-starter/lupine.json +7 -6
  144. package/templates/lupine-template-responsive-starter/web/src/index.html +9 -2
  145. package/templates/lupine-template-responsive-starter/web/src/index.tsx +9 -25
  146. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +12 -6
  147. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +12 -22
  148. package/templates/common/apps/server/src/app-loader.ts +0 -4
  149. package/templates/lupine-template-cv-starter/api/resources/config_default.json +0 -6
  150. package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +0 -4
  151. package/templates/lupine-template-cv-starter/api/src/index.ts +0 -15
  152. package/templates/lupine-template-cv-starter/web/src/client-env-keys.ts +0 -5
  153. package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +0 -15
  154. package/templates/lupine-template-doc-starter/api/resources/config_default.json +0 -6
  155. package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +0 -4
  156. package/templates/lupine-template-doc-starter/api/src/index.ts +0 -15
  157. package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +0 -6
  158. package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +0 -4
  159. package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +0 -5
  160. package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +0 -15
  161. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +0 -16
  162. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +0 -22
  163. package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +0 -52
  164. package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +0 -15
  165. package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +0 -75
  166. package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +0 -162
  167. package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +0 -165
  168. package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +0 -118
  169. package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +0 -122
  170. package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +0 -12
  171. package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +0 -161
  172. package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +0 -163
  173. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +0 -166
  174. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +0 -177
  175. package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +0 -84
  176. package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +0 -48
  177. package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +0 -61
  178. package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +0 -61
  179. package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +0 -23
  180. package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +0 -90
  181. package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +0 -15
  182. package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +0 -105
  183. package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +0 -38
  184. package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +0 -38
  185. package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +0 -58
  186. package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +0 -27
  187. package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +0 -54
  188. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +0 -112
  189. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +0 -112
  190. package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +0 -57
  191. package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +0 -19
  192. package/templates/lupine-template-fullstack-starter/web/src/styles/app.css +0 -0
  193. package/templates/lupine-template-responsive-starter/api/package.json +0 -6
  194. package/templates/lupine-template-responsive-starter/api/resources/config_default.json +0 -6
  195. package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +0 -4
  196. package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +0 -18
  197. package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +0 -76
  198. package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +0 -93
  199. package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +0 -87
  200. package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -81
  201. package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -211
  202. package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -107
  203. package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -110
  204. package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -144
  205. package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -188
  206. package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +0 -95
  207. package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +0 -169
  208. package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -53
  209. package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -32
  210. package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -35
  211. package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -444
  212. package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -318
  213. package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -35
  214. package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +0 -87
  215. package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +0 -45
  216. package/templates/lupine-template-responsive-starter/web/src/styles/app.css +0 -0
  217. package/templates/lupine-template-responsive-starter/web/src/styles/base-css.ts +0 -65
  218. package/templates/lupine-template-responsive-starter/web/src/styles/global.css +0 -2130
  219. package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +0 -17
  220. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/01-experience/index.md +0 -0
  221. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/02-projects/index.md +0 -0
  222. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/03-skills/index.md +0 -0
  223. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/04-education/index.md +0 -0
  224. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/index.md +0 -0
  225. /package/templates/lupine-template-cv-starter/{web → app}/markdown/index.md +0 -0
  226. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/01-experience/index.md +0 -0
  227. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/02-projects/index.md +0 -0
  228. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/03-skills/index.md +0 -0
  229. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/04-education/index.md +0 -0
  230. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/index.md +0 -0
  231. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/01-experience/index.html +0 -0
  232. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/02-projects/index.html +0 -0
  233. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/03-skills/index.html +0 -0
  234. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/04-education/index.html +0 -0
  235. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/index.html +0 -0
  236. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/index.html +0 -0
  237. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
  238. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/01-experience/index.html +0 -0
  239. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/02-projects/index.html +0 -0
  240. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/03-skills/index.html +0 -0
  241. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/04-education/index.html +0 -0
  242. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
  243. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/index.md +0 -0
  244. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/list.md +0 -0
  245. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/install.md +0 -0
  246. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/started.md +0 -0
  247. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/index.md +0 -0
  248. /package/templates/lupine-template-doc-starter/{web → app}/markdown/index.md +0 -0
  249. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/index.md +0 -0
  250. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/list.md +0 -0
  251. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/install.md +0 -0
  252. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/started.md +0 -0
  253. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/index.md +0 -0
  254. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/index.html +0 -0
  255. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/list.html +0 -0
  256. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/install.html +0 -0
  257. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/started.html +0 -0
  258. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/index.html +0 -0
  259. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/index.html +0 -0
  260. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
  261. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/index.html +0 -0
  262. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/list.html +0 -0
  263. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/install.html +0 -0
  264. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/started.html +0 -0
  265. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
  266. /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-note}/api/src/index.ts +0 -0
  267. /package/templates/lupine-template-fullstack-starter/{web/assets/images → app/assets}/sample.png +0 -0
  268. /package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-props.ts +0 -0
package/README.md CHANGED
@@ -1,25 +1,31 @@
1
1
  # create-lupine
2
2
 
3
- Creates a new [lupine.js](https://github.com/uuware/lupine.js) project: a web site or app with lupine.web (front end, SSR) and lupine.api (Node back end).
3
+ Creates a new [lupine.js](https://github.com/uuware/lupine.js) project: an app for the web, iOS, Android, macOS and Windows from one code base (lupine.native), with its web site and server (lupine.web, lupine.api).
4
4
 
5
5
  ```bash
6
6
  npx create-lupine@latest my-app
7
7
  cd my-app
8
8
  npm install
9
- npm run dev # http://localhost:11080
9
+ npm run dev # the site, http://localhost:11080
10
+ npm run native -- macos --app=my-app --run # the app: ios, android, windows, web; test macos
10
11
  ```
11
12
 
12
13
  Templates to choose from:
13
14
 
14
15
  | Template | |
15
16
  | --- | --- |
16
- | `responsive-starter` (tabs or side menu) | an app for phones that runs on the web, too: notes, pages, settings |
17
- | `fullstack-starter` | a web site: pages, frames, sign-in and registration, an admin area, an API with a database |
18
- | `doc-starter` | documentation from Markdown, for GitHub Pages too |
19
- | `cv-starter` | a CV from Markdown |
17
+ | `doc-starter` | documentation from Markdown: sidebar, languages, themes; the server renders the pages; for GitHub Pages too |
18
+ | `cv-starter` | a CV from Markdown, in several languages; for GitHub Pages too |
19
+ | `responsive-starter-tabs`, `responsive-starter-sidemenu` | an app with tabs or a side menu: notes kept on the device, finance, tools, settings with themes and languages |
20
+ | `fullstack-note` | an app with tabs, a side menu, settings, themes and languages, sign-in and notes kept on the server (an API with a database) |
21
+ | `fullstack-starter` | the app with accounts (sign-in, codes by email, registration) talking to an API with a database, and an admin site |
22
+
23
+ A project has the app in `apps/my-app/app`, the page of the site in `apps/my-app/web` and, in the fullstack templates, the server in `apps/my-app/api` (the others use the default server of lupine-build); see the README in `apps/my-app`. An app that calls the server gets its address from `WEB.API_BASE_URL` of `.env.mobile`: `npm run native -- android --app=my-app --release --env=.env.mobile`. The apps for phones and desktops need their tools (Xcode, Android Studio, Visual Studio): `npx lupine-native doctor` tells what is missing. See [Getting started](https://uuware.github.io/lupine.js/en/native/started).
20
24
 
21
25
  `npx create-lupine --update-version` brings the lupine packages of an existing project up to date.
22
26
 
23
- Native apps (iOS, Android, macOS, Windows): start from `apps/native-starter` of the repository, see [Getting started](https://uuware.github.io/lupine.js/en/native/started).
27
+ `npx create-lupine --add-app <name>`, in the folder of a project, adds one more app from a template (`apps/<name>`, with its scripts `npm run <name>:run-mac` ...) and prints what to add to `.env` (`APPS`, `DOMAINS:<name>`); `.env` itself isn't changed.
28
+
29
+ The scripts of a new project: `npm run run-mac`, `run-ios`, `run-android`, `run-exe` (build and start the app), `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 in `dist/release/<name>`).
24
30
 
25
31
  MIT.
package/index.js CHANGED
@@ -70,11 +70,13 @@ for (let i = 0; i < args.length; i++) {
70
70
  }
71
71
  const cwd = process.cwd();
72
72
 
73
+ // Every template is an app for the web, iOS, Android, macOS and Windows (lupine.native, in app/), with a site and
74
+ // a server (web/, api/: lupine.web, lupine.api).
73
75
  const TEMPLATES = [
74
76
  {
75
77
  name: 'doc-starter',
76
78
  dir: 'lupine-template-doc-starter',
77
- display: 'Documentation Starter',
79
+ display: 'Documentation Starter (Markdown, sidebar, languages)',
78
80
  itemType: 'frontend',
79
81
  color: green,
80
82
  needsPress: true,
@@ -82,7 +84,7 @@ const TEMPLATES = [
82
84
  {
83
85
  name: 'cv-starter',
84
86
  dir: 'lupine-template-cv-starter',
85
- display: 'CV Starter',
87
+ display: 'CV Starter (Markdown, languages)',
86
88
  itemType: 'frontend',
87
89
  color: green,
88
90
  needsPress: true,
@@ -91,7 +93,7 @@ const TEMPLATES = [
91
93
  name: 'responsive-starter-tabs',
92
94
  dir: 'lupine-template-responsive-starter',
93
95
  layout: 'tabs',
94
- display: 'Responsive Starter (tabs)',
96
+ display: 'App Starter with tabs (notes on the device, finance, tools, settings)',
95
97
  itemType: 'frontend',
96
98
  color: green,
97
99
  },
@@ -99,27 +101,225 @@ const TEMPLATES = [
99
101
  name: 'responsive-starter-sidemenu',
100
102
  dir: 'lupine-template-responsive-starter',
101
103
  layout: 'sidemenu',
102
- display: 'Responsive Starter (sidemenu)',
104
+ display: 'App Starter with a side menu (notes on the device, finance, tools, settings)',
105
+ itemType: 'frontend',
106
+ color: green,
107
+ },
108
+ {
109
+ name: 'fullstack-note',
110
+ dir: 'lupine-template-fullstack-note',
111
+ display: 'Full-stack Notes (the app with sign-in and notes on the server: tabs, side menu, settings)',
103
112
  itemType: 'frontend',
104
113
  color: green,
105
114
  },
106
115
  {
107
116
  name: 'fullstack-starter',
108
117
  dir: 'lupine-template-fullstack-starter',
109
- display: 'Full-stack Web Starter (pages, accounts, admin, API)',
118
+ display: 'Full-stack Starter (the app with accounts and an API, an admin site, a database)',
110
119
  itemType: 'frontend',
111
120
  color: green,
112
121
  },
113
122
  ];
114
123
 
124
+ const templatesRoot = () => path.resolve(fileURLToPath(import.meta.url), '../templates');
125
+
126
+ /** apps/<appName> from the template: names, the page for GitHub Pages, the id of the app. */
127
+ function scaffoldApp(root, appName, templateObj) {
128
+ const templateDir = path.join(templatesRoot(), templateObj.dir);
129
+ const appsDir = path.join(root, 'apps');
130
+ if (!fs.existsSync(appsDir)) {
131
+ fs.mkdirSync(appsDir);
132
+ }
133
+
134
+ const targetAppDir = path.join(appsDir, appName);
135
+
136
+ function replaceStr(filepath, fromToArr) {
137
+ let content = fs.readFileSync(filepath, 'utf-8');
138
+ for (const { from, to } of fromToArr) {
139
+ content = content.replace(new RegExp(from, 'g'), to);
140
+ }
141
+ fs.writeFileSync(filepath, content);
142
+ }
143
+
144
+ copyDir(templateDir, targetAppDir);
145
+ // if templateDir\web\src\appName exists, rename it to github-pj-name
146
+ const githubName = path.join(targetAppDir, `web/src/${templateObj?.dir}`);
147
+ if (templateObj?.dir && fs.existsSync(githubName)) {
148
+ fs.renameSync(githubName, path.join(targetAppDir, 'web/src/github-pj-name'));
149
+ replaceStr(path.join(targetAppDir, 'web/src/github-pj-name/index.tsx'), [
150
+ { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
151
+ { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
152
+ ]);
153
+ replaceStr(path.join(targetAppDir, 'web/src/github-pj-name/index.html'), [
154
+ { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
155
+ { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
156
+ // the web analytics of the template's own demo page
157
+ { from: '\\s*<!-- Remove Cloudflare Web Analytics[\\s\\S]*?<!-- End Cloudflare Web Analytics -->', to: '' },
158
+ ]);
159
+ replaceStr(path.join(targetAppDir, 'web/src/github-pj-name/404.html'), [
160
+ { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
161
+ { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
162
+ ]);
163
+ replaceStr(path.join(targetAppDir, 'lupine.json'), [
164
+ { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
165
+ { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
166
+ ]);
167
+ }
168
+
169
+ if (templateObj?.layout) {
170
+ const frameFile = path.join(targetAppDir, 'app/src/app.tsx');
171
+ if (fs.existsSync(frameFile)) {
172
+ let content = fs.readFileSync(frameFile, 'utf-8');
173
+ content = content.replace(/const DEFAULT_LAYOUT = '.*';/, `const DEFAULT_LAYOUT = '${templateObj.layout}';`);
174
+ fs.writeFileSync(frameFile, content);
175
+ }
176
+ }
177
+
178
+ changePkgName(path.join(targetAppDir, 'lupine.json'), appName);
179
+ changePkgName(path.join(targetAppDir, 'api', 'package.json'), appName + '-api');
180
+ changePkgName(path.join(targetAppDir, 'web', 'package.json'), appName + '-web');
181
+ // the app (lupine.native): its package, the name of the app and its id (com.example.myproject: change it to yours)
182
+ const appPkgPath = path.join(targetAppDir, 'app', 'package.json');
183
+ if (fs.existsSync(appPkgPath)) {
184
+ const appPkg = JSON.parse(fs.readFileSync(appPkgPath, 'utf-8'));
185
+ appPkg.name = appName + '-app';
186
+ if (appPkg.lupineNative) {
187
+ appPkg.lupineNative.name = appName.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((w) => w[0].toUpperCase() + w.slice(1)).join('') || 'App';
188
+ appPkg.lupineNative.id = `com.example.${appName.toLowerCase().replace(/[^a-z0-9]/g, '') || 'app'}`;
189
+ }
190
+ fs.writeFileSync(appPkgPath, JSON.stringify(appPkg, null, 2) + '\n');
191
+ }
192
+ // the name of the template in its README and in the code (commands, env keys, host names): the name of the project.
193
+ // The links to the template's repository and demo stay; its page for GitHub Pages is web/src/github-pj-name.
194
+ if (templateObj?.dir) {
195
+ const dir = templateObj.dir;
196
+ const rename = (file) => {
197
+ const content = fs.readFileSync(file, 'utf-8');
198
+ const renamed = content
199
+ .replace(new RegExp(`web/src/${dir}`, 'g'), 'web/src/github-pj-name')
200
+ .replace(new RegExp(`(?<!uuware/|github\\.io/)${dir}`, 'g'), appName);
201
+ if (renamed !== content) fs.writeFileSync(file, renamed);
202
+ };
203
+ const walk = (folder) => {
204
+ if (!fs.existsSync(folder)) return;
205
+ for (const entry of fs.readdirSync(folder, { withFileTypes: true })) {
206
+ const file = path.join(folder, entry.name);
207
+ if (entry.isDirectory()) {
208
+ if (entry.name !== 'node_modules' && entry.name !== 'markdown-built' && entry.name !== 'github-pj-name') walk(file);
209
+ } else if (/\.(ts|tsx)$/.test(entry.name)) rename(file);
210
+ }
211
+ };
212
+ const readme = path.join(targetAppDir, 'README.md');
213
+ if (fs.existsSync(readme)) {
214
+ // the pictures of the template (dev/screenshots.js) aren't in the package
215
+ fs.writeFileSync(readme, fs.readFileSync(readme, 'utf-8').replace(/<!-- screenshots[^>]*?-->[\s\S]*?<!-- \/screenshots -->\n*/, ''));
216
+ rename(readme);
217
+ }
218
+ ['app/src', 'web/src', 'api/src'].forEach((folder) => walk(path.join(targetAppDir, folder)));
219
+ }
220
+
221
+ return targetAppDir;
222
+ }
223
+
224
+ /** The scripts of an app: npm run <prefix>run-android ... (clickable in the NPM scripts of the editor). */
225
+ function appScripts(appName, prefix = '') {
226
+ const app = `--app=${appName}`;
227
+ return {
228
+ ...(prefix ? { [`${prefix}build`]: `lupine-build --env=.env.production --dev=0 --obfuscate=0 --apps=${appName}` } : {}),
229
+ [`${prefix}bump`]: `lupine-native bump ${app}`,
230
+ [`${prefix}icons`]: `lupine-native icons ${app}`,
231
+ [`${prefix}build-android`]: `lupine-native android --release ${app}`,
232
+ [`${prefix}run-android`]: `lupine-native android --install --run ${app}`,
233
+ [`${prefix}run-ios`]: `lupine-native ios --install --run ${app}`,
234
+ [`${prefix}run-mac`]: `lupine-native macos --run ${app}`,
235
+ [`${prefix}run-exe`]: `lupine-native windows --run ${app}`,
236
+ };
237
+ }
238
+
239
+ /** The template of --template=, otherwise asked. */
240
+ async function chooseTemplate(template) {
241
+ if (!template || !TEMPLATES.find((t) => t.name === template)) {
242
+ if (template && !TEMPLATES.find((t) => t.name === template)) {
243
+ console.log(`"${template}" isn't a valid template. Please choose from below:`);
244
+ } else {
245
+ console.log('Select a template:');
246
+ }
247
+
248
+ TEMPLATES.forEach((t, i) => {
249
+ console.log(` ${t.color(i + 1 + '. ' + (t.display || t.name))}`);
250
+ });
251
+
252
+ const templateIdx = await prompt(`Select a template (${green('1-' + TEMPLATES.length)}): `);
253
+ const selected = TEMPLATES[parseInt(templateIdx) - 1];
254
+ if (!selected) {
255
+ throw new Error(red('✖ Invalid template selected'));
256
+ }
257
+ template = selected.name;
258
+ }
259
+ return TEMPLATES.find((t) => t.name === template);
260
+ }
261
+
262
+
263
+ /**
264
+ * --add-app [name] [--template=...]: one more app in the project of this folder (apps/<name>, its scripts with the
265
+ * prefix "<name>:"). .env isn't changed (it has your comments and settings): what to add there is printed.
266
+ */
267
+ async function addApp(name, template, versions) {
268
+ const pkgPath = path.join(cwd, 'package.json');
269
+ const pkg = fs.existsSync(pkgPath) ? JSON.parse(fs.readFileSync(pkgPath, 'utf-8')) : null;
270
+ const isProject = pkg && fs.existsSync(path.join(cwd, 'apps')) && fs.existsSync(path.join(cwd, '.env')) && pkg.dependencies?.['lupine.api'];
271
+ if (!isProject) {
272
+ console.log(red('✖ Run it in the folder of a lupine project (package.json with lupine.api, apps/, .env).'));
273
+ return;
274
+ }
275
+ const valid = (n) => /^[a-z0-9][a-z0-9-]*$/.test(n) && !fs.existsSync(path.join(cwd, 'apps', n));
276
+ while (!name || !valid(name)) {
277
+ if (name) console.log(red(`✖ "${name}": lowercase letters, digits and -, and not a folder in apps/ yet.`));
278
+ name = await prompt('Name of the app (the folder in apps/): ');
279
+ }
280
+ const templateObj = await chooseTemplate(template);
281
+ console.log(`\nAdding apps/${name} (${templateObj.name})...`);
282
+ const appDir = scaffoldApp(cwd, name, templateObj);
283
+
284
+ // package.json: the scripts of the app ("<name>:run-android" ...), the packages of the template; nothing is replaced
285
+ pkg.scripts = pkg.scripts || {};
286
+ const scripts = appScripts(name, `${name}:`);
287
+ if (fs.existsSync(path.join(appDir, 'web/src/github-pj-name'))) {
288
+ scripts[`${name}:cp-docs`] = `node dev/cp-folder.js dist/server_root/${name}_web/github-pj-name docs`;
289
+ }
290
+ for (const [k, v] of Object.entries(scripts)) if (!pkg.scripts[k]) pkg.scripts[k] = v;
291
+ if (templateObj.needsPress) {
292
+ pkg.dependencies['lupine.press'] = pkg.dependencies['lupine.press'] || versions['lupine.press'];
293
+ pkg.devDependencies = pkg.devDependencies || {};
294
+ pkg.devDependencies['gray-matter'] = pkg.devDependencies['gray-matter'] || '^4.0.3';
295
+ pkg.devDependencies['marked'] = pkg.devDependencies['marked'] || '^17.0.1';
296
+ }
297
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
298
+
299
+ const apps = (fs.readFileSync(path.join(cwd, '.env'), 'utf-8').match(/^APPS=(.*)$/m)?.[1] || '').trim();
300
+ console.log(green(`\n✔ apps/${name}, and its scripts in package.json (npm run ${name}:run-mac ...)`));
301
+ console.log(`\nNext, by hand:\n`);
302
+ console.log(` 1. .env: add the app to APPS, and the domain the server knows it by (more than one: comma separated):`);
303
+ console.log(bold(` APPS=${apps ? apps + ',' : ''}${name}`));
304
+ console.log(bold(` DOMAINS:${name}=${name}.localhost`));
305
+ console.log(` (${name}.localhost: in the browser on this computer; add the real domain for the server.`);
306
+ console.log(` With SSL for this domain: SSL_KEY_PATH:${name}=... and SSL_CRT_PATH:${name}=...)`);
307
+ console.log(` 2. npm install`);
308
+ console.log(` 3. npm run dev, then http://${name}.localhost:<HTTP_PORT of .env>`);
309
+ console.log(` 4. the id of the app (com.example...): apps/${name}/app/package.json, lupineNative.id`);
310
+ console.log(``);
311
+ }
312
+
115
313
  async function init() {
116
314
  console.log('Fetching latest versions...');
117
315
  const versions = {
118
- 'lupine.api': getLatestVersion('lupine.api', '^1.0.1'),
119
- 'lupine.web': getLatestVersion('lupine.web', '^1.0.1'),
120
- 'lupine.core': getLatestVersion('lupine.core', '^0.1.0'),
121
- 'lupine.web.components': getLatestVersion('lupine.web.components', '^1.2.0'),
122
- 'lupine.press': getLatestVersion('lupine.press', '^1.0.1')
316
+ 'lupine.api': getLatestVersion('lupine.api', '^1.2.44'),
317
+ 'lupine.web': getLatestVersion('lupine.web', '^1.3.1'),
318
+ 'lupine.core': getLatestVersion('lupine.core', '^1.1.2'),
319
+ 'lupine.web.components': getLatestVersion('lupine.web.components', '^1.3.2'),
320
+ 'lupine.native.core': getLatestVersion('lupine.native.core', '^1.1.1'),
321
+ 'lupine.native.components': getLatestVersion('lupine.native.components', '^1.1.1'),
322
+ 'lupine.press': getLatestVersion('lupine.press', '^1.3.1'),
123
323
  };
124
324
 
125
325
  if (argv['update-version']) {
@@ -163,6 +363,8 @@ async function init() {
163
363
  return;
164
364
  }
165
365
 
366
+ if (argv['add-app']) return addApp(argv._[0], argv.template || argv.t, versions);
367
+
166
368
  let targetDir = argv._[0];
167
369
  let template = argv.template || argv.t;
168
370
 
@@ -205,118 +407,45 @@ async function init() {
205
407
  fs.mkdirSync(root, { recursive: true });
206
408
  }
207
409
 
208
- if (!template || !TEMPLATES.find((t) => t.name === template)) {
209
- if (template && !TEMPLATES.find((t) => t.name === template)) {
210
- console.log(`"${template}" isn't a valid template. Please choose from below:`);
211
- } else {
212
- console.log('Select a template:');
213
- }
214
-
215
- TEMPLATES.forEach((t, i) => {
216
- console.log(` ${t.color(i + 1 + '. ' + (t.display || t.name))}`);
217
- });
218
-
219
- const templateIdx = await prompt(`Select a template (${green('1-' + TEMPLATES.length)}): `);
220
- const selected = TEMPLATES[parseInt(templateIdx) - 1];
221
- if (!selected) {
222
- throw new Error(red('✖ Invalid template selected'));
223
- }
224
- template = selected.name;
225
- }
226
-
227
- const templateObj = TEMPLATES.find((t) => t.name === template);
228
- const templateDirName = templateObj?.dir || template;
229
-
230
- const templateDir = path.resolve(fileURLToPath(import.meta.url), '../templates', templateDirName);
231
- const commonDir = path.resolve(fileURLToPath(import.meta.url), '../templates', 'common');
232
-
233
- // ... (copy logic remains same)
410
+ const templateObj = await chooseTemplate(template);
411
+ const commonDir = path.join(templatesRoot(), 'common');
234
412
 
235
413
  console.log(`\nScaffolding project in ${root}...`);
236
414
 
237
415
  copyDir(commonDir, root);
238
416
  fs.renameSync(path.join(root, '_gitignore'), path.join(root, '.gitignore'));
239
417
  fs.renameSync(path.join(root, '_env'), path.join(root, '.env'));
240
-
241
- const appsDir = path.join(root, 'apps');
242
- if (!fs.existsSync(appsDir)) {
243
- fs.mkdirSync(appsDir);
244
- }
418
+ // .env gets the keys and passwords of the project: only its owner reads it
419
+ fs.chmodSync(path.join(root, '.env'), 0o600);
245
420
 
246
421
  const appName = path.basename(root);
247
- const targetAppDir = path.join(appsDir, appName);
248
-
249
- function replaceStr(filepath, fromToArr) {
250
- let content = fs.readFileSync(filepath, 'utf-8');
251
- for (const { from, to } of fromToArr) {
252
- content = content.replace(new RegExp(from, 'g'), to);
253
- }
254
- fs.writeFileSync(filepath, content);
255
- }
256
-
257
- copyDir(templateDir, targetAppDir);
258
- // if templateDir\web\src\appName exists, rename it to github-pj-name
259
- const githubName = path.join(targetAppDir, `web/src/${templateObj?.dir}`);
260
- if (templateObj?.dir && fs.existsSync(githubName)) {
261
- fs.renameSync(githubName, path.join(targetAppDir, 'web/src/github-pj-name'));
262
- replaceStr(path.join(targetAppDir, 'web/src/github-pj-name/index.tsx'), [
263
- { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
264
- { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
265
- ]);
266
- replaceStr(path.join(targetAppDir, 'web/src/github-pj-name/index.html'), [
267
- { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
268
- { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
269
- ]);
270
- replaceStr(path.join(targetAppDir, 'web/src/github-pj-name/404.html'), [
271
- { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
272
- { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
273
- ]);
274
- replaceStr(path.join(targetAppDir, 'lupine.json'), [
275
- { from: `/${templateObj?.dir}`, to: '/github-pj-name' },
276
- { from: `${templateObj?.dir}/`, to: 'github-pj-name/' },
277
- ]);
278
- }
279
-
280
- if (templateObj?.layout) {
281
- const frameFile = path.join(targetAppDir, 'web/src/frames/app-responsive-frame.tsx');
282
- if (fs.existsSync(frameFile)) {
283
- let content = fs.readFileSync(frameFile, 'utf-8');
284
- content = content.replace(/const DEFAULT_LAYOUT = '.*';/, `const DEFAULT_LAYOUT = '${templateObj.layout}';`);
285
- fs.writeFileSync(frameFile, content);
286
- }
287
- }
288
-
289
- changePkgName(path.join(targetAppDir, 'lupine.json'), appName);
290
- changePkgName(path.join(targetAppDir, 'api', 'package.json'), appName + '-api');
291
- changePkgName(path.join(targetAppDir, 'web', 'package.json'), appName + '-web');
422
+ const targetAppDir = scaffoldApp(root, appName, templateObj);
292
423
 
293
424
  const pkg = {
294
425
  name: appName,
295
426
  version: '0.0.0',
296
427
  private: true,
297
428
  workspaces: ['apps/*', 'apps/*/*', 'packages/*'],
298
- '//desktop': 'If you want to build desktop applications, please run `npm run add-electron` first.',
299
429
  scripts: {
300
- 'add-electron': 'npm install -D electron@^35.2.0 electron-builder@^26.0.12',
301
- 'app1:build-win': `electron-builder --win --config apps/${appName}/electron/builder.json`,
302
- 'app1:build-linux': `electron-builder --linux --config apps/${appName}/electron/builder.json`,
303
- 'app1:build-mac': `export CSC_IDENTITY_AUTO_DISCOVERY=true && electron-builder --mac --x64 --config apps/${appName}/electron/builder.json`,
304
- 'app1:unpack-mac': `npx asar extract dist/build/mac-arm64-unpacked/${appName}.app/Contents/Resources/app.asar dist/build/mac-arm64-unpacked/${appName}.app/Contents/Resources/app.asar-unpack`,
305
- 'app1:unpack-linux': `npx asar extract dist/build/linux-arm64-unpacked/resources/app.asar dist/build/linux-arm64-unpacked/resources/app.asar-unpack`,
306
- 'app1:unpack-win': `npx asar extract dist/build/win-unpacked/resources/app.asar dist/build/win-unpacked/resources/app.asar-unpack`,
307
- 'app1:desktop': `electron apps/${appName}/electron/main.js`,
308
- 'app1:sync': `npm run sync --workspace=${appName}-web`,
309
- 'app1:open-ios': `npm run open-ios --workspace=${appName}-web`,
310
- 'app1:open-android': `npm run open-android --workspace=${appName}-web`,
311
430
  dev: 'lupine-build --env=.env.development --dev=1 --cmd=start-dev',
312
431
  build: 'lupine-build --env=.env.production --dev=0 --obfuscate=0',
313
- 'build-mobile': 'lupine-build --env=.env.mobile --dev=0 --mobile=1',
314
432
  'start-dev': 'node dist/server_root/server/server-loader.js --env=.env.development',
315
433
  'start-production': 'node dist/server_root/server/server-loader.js --env=.env.production',
434
+ // the apps: npm run native -- macos --app=<the folder in apps/> --run (ios, android, windows, web; test macos)
435
+ native: 'lupine-native',
436
+ // the app: npm run run-android, run-ios, run-mac, run-exe, build-android, bump, icons
437
+ ...appScripts(appName),
438
+ // a folder with what the server needs (dist/release/<name>): copy it to the server
439
+ release: `lupine-build --env=.env.production --dev=0 --obfuscate=0 --release=dist/release/${appName}`,
316
440
  format: 'prettier --write "**/*.{js,json,css,scss,md,html,yaml,ts,jsx,tsx}"',
317
441
  },
318
442
  dependencies: {
319
- 'lupine.api': 'file:packages/lupine.api',
443
+ 'lupine.api': versions['lupine.api'],
444
+ 'lupine.core': versions['lupine.core'],
445
+ 'lupine.web': versions['lupine.web'],
446
+ 'lupine.web.components': versions['lupine.web.components'],
447
+ 'lupine.native.core': versions['lupine.native.core'],
448
+ 'lupine.native.components': versions['lupine.native.components'],
320
449
  },
321
450
  devDependencies: {
322
451
  typescript: '^5.7.2',
@@ -325,17 +454,13 @@ async function init() {
325
454
  },
326
455
  };
327
456
 
328
- pkg.dependencies = {
329
- 'lupine.api': versions['lupine.api'],
330
- 'lupine.core': versions['lupine.core'],
331
- 'lupine.web.components': versions['lupine.web.components'],
332
- 'lupine.web': versions['lupine.web'],
333
- };
334
-
335
457
  if (templateObj && templateObj.needsPress) {
336
458
  pkg.dependencies['lupine.press'] = versions['lupine.press'];
337
459
  pkg.devDependencies['gray-matter'] = '^4.0.3';
338
460
  pkg.devDependencies['marked'] = '^17.0.1';
461
+ }
462
+ // the page for GitHub Pages: npm run build, then npm run cp-docs
463
+ if (fs.existsSync(path.join(targetAppDir, 'web/src/github-pj-name'))) {
339
464
  pkg.scripts['cp-docs'] = `node dev/cp-folder.js dist/server_root/${appName}_web/github-pj-name docs`;
340
465
  }
341
466
 
@@ -358,13 +483,15 @@ async function init() {
358
483
  });
359
484
 
360
485
  envContent = envContent.replace(/{APP-NAME}/g, appName);
361
- fs.writeFileSync(path.join(root, '.env'), envContent);
486
+ fs.writeFileSync(path.join(root, '.env'), envContent, { mode: 0o600 });
487
+ fs.chmodSync(path.join(root, '.env'), 0o600);
362
488
  }
363
489
 
364
490
  console.log(`\nDone. Now run:\n`);
365
491
  console.log(` cd ${targetDir}`);
366
492
  console.log(` npm install`);
367
- console.log(` npm run dev`);
493
+ console.log(` npm run dev # the site`);
494
+ console.log(` npm run run-mac # the app (run-ios, run-android, run-exe)`);
368
495
  console.log(``);
369
496
  }
370
497
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lupine",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Scaffolding tool for Lupine.js projects",
5
5
  "bin": {
6
6
  "create-lupine": "index.js"
@@ -15,7 +15,7 @@ One TypeScript code base for web sites, Node.js back ends and native apps. State
15
15
 
16
16
  | Writing | Import from | Never in that code |
17
17
  | --- | --- | --- |
18
- | a web page or web component | `lupine.web` (signals, `CssProps`, router, SSR), `lupine.web.components` (components, `createField`) | `lupine.native.*` (except as in references/native-apps.md, "native components in a web page") |
18
+ | a web page or web component | `lupine.web` (signals, `CssProps`, router, SSR, `Icon`, `Redirect`, themes), `lupine.web.components` (editors, PDF viewer), components of `lupine.native.components` (they work in web pages) | `lupine.native.*` (except as in references/native-apps.md, "native components in a web page") |
19
19
  | a native screen (iOS, Android, macOS, Windows, web) | `lupine.native.core` (signals, View, Text, platform functions), `lupine.native.components` (themes, router, forms, overlays) | `document`, `window`, `localStorage`, `lupine.web`, `lupine.web.components`: there is no DOM. Only `src/index.web.tsx` may use the DOM |
20
20
  | a back end | `lupine.api` | DOM, browser APIs |
21
21
 
@@ -34,7 +34,7 @@ Signals come from the framework package (`lupine.web` or `lupine.native.core`);
34
34
  - Styles: `css={...}` with `&` for the component's own class names (`class='&-title'`), theme variables instead of fixed colors. → references/styling-and-themes.md
35
35
  - Pages: `PageRouter`, parameters `/:id`, optional `/?opt`, frames; links are `<a href>`, from code `initializePage(path)`. → references/navigation-and-routing.md
36
36
  - **SSR**: pages are rendered on the server first. At the top of a module use `bindAppGlobalStyle`, not `bindGlobalStyle`; while rendering don't touch `window`, `document` or `localStorage` (check `isFrontEnd()` or do it in `onMount`).
37
- - Phones in the browser: `SliderFrame`, `ActionSheet...Promise` instead of `alert`/`confirm`. → references/mobile-interactions.md
37
+ - Phones in the browser: `ActionSheet.select`, `MessageBox`, `Toast` of lupine.native.components instead of `alert`/`confirm`. → references/mobile-interactions.md
38
38
  - Icons: references/icon-handling.md
39
39
 
40
40
  ## Native specifics (lupine.native)
@@ -55,7 +55,7 @@ API modules and routers, databases, SSR of the web pages, the admin console; wri
55
55
  | Signals, lifecycle, lists, forms, refs (web and native) | [reactivity-and-state.md](./references/reactivity-and-state.md) |
56
56
  | CSS-in-JS, `&` classes, themes and dark mode (web) | [styling-and-themes.md](./references/styling-and-themes.md) |
57
57
  | Router, parameters, SSR, environment and settings (web) | [navigation-and-routing.md](./references/navigation-and-routing.md) |
58
- | SliderFrame, action sheets, the back button (web on phones) | [mobile-interactions.md](./references/mobile-interactions.md) |
58
+ | action sheets, dialogs, sliding pages, the back button (web on phones) | [mobile-interactions.md](./references/mobile-interactions.md) |
59
59
  | Icons (web, admin) | [icon-handling.md](./references/icon-handling.md) |
60
60
  | Native apps: components, styles, navigation, platform functions, tests, the CLI | [native-apps.md](./references/native-apps.md) |
61
61
  | Back end: apps, API routers, databases, security | [backend-api.md](./references/backend-api.md) |
@@ -15,9 +15,17 @@ apps/my-app/api/src/index.ts export const apiModule = new ApiModul
15
15
  ```bash
16
16
  npm run dev # lupine-build --dev=1, then the server: http://localhost:11080, rebuilds on change
17
17
  npm run build # production build into dist/server_root: <app>_web, <app>_api, <app>_data (data isn't touched)
18
+ npm run release # lupine-build ... --release=dist/release/<name>: a folder for the server (dist/server_root, .env files,
19
+ # certificates, package.json); what is there already is kept; --set=KEY=VALUE changes its .env
18
20
  ```
19
21
 
20
- A new app needs its name in `APPS` and a `DOMAINS:<name>=...` line of `.env`.
22
+ To a running server (its Release page endpoints; it only sends, the server is restarted by hand on its Release page):
23
+ `lupine-build --env=.env.production --deploy=https://<domain of the app> --app=<app> [--parts=web,api,server,env]`, or one
24
+ file: `--put=<file> --to=web:/path` (web, data, log; `--overwrite`). The key: `RELEASE_TOKEN` or `--token-file=` (a token of
25
+ its Tokens page, or `<DEV_ADMIN_USER>:<password>`), never on the command line.
26
+
27
+ A new app: `npx create-lupine --add-app <name>` (from a template, with scripts `<name>:run-mac` ...), then its name in `APPS`
28
+ and a `DOMAINS:<name>=...` line of `.env` (by hand).
21
29
 
22
30
  ## The API module
23
31
 
@@ -92,6 +100,13 @@ New tables go into the install scripts of the app (`api/resources/install.sqlite
92
100
 
93
101
  - Every URL that no API and no file answers is rendered by the front end's `PageRouter` on the server (references/navigation-and-routing.md). Async page components load their data with `props.renderPageFunctions.fetchData(url)`, which on the server calls the API inside the process with the request's cookies.
94
102
  - `apiStorage.setWeb(key, value)` + `apiStorage.save()` store settings that the front end reads with `WebConfig.get(key, default)`, without a new release.
103
+ - `apiStorage.setTemp(key, value, ttlSeconds = 3600)` / `getTemp(key)` (undefined when none or expired) / `getTempWithPrefix(prefix)`: strings for all workers, in memory of the primary process, never saved; at most `TEMP_MAX_ENTRIES` (10000) per app, the oldest go.
104
+
105
+ ## WebSockets
106
+
107
+ - `router.ws(path, ...handlers)` gets only upgrade requests; filters run on the way (refuse with an HTTP answer), functions of `use` don't. A handler takes the socket: `new MiniWebSocket(onText, onClose, { protocols, onBinary, pingInterval }).accept(req)`.
108
+ - A socket stays in its worker. For several people use `WsRooms` (the primary relays): `new WsRooms('name', { maxPerRoom, onMessage(client, text), onMembers(room, members) => text })`, `await rooms.join(req, room, info)`, `rooms.publish(room, text, exceptClient)`. A full room closes with 4013 'full'; app close codes are 4000-4999 (Apple's client turns 1012-3999 into 1005).
109
+ - Limits: `WS_MAX_CONNECTIONS` (200 per app), `WS_MAX_PER_IP` (20); a foreign `Origin` is refused (none is allowed: native apps). Example: `apps/native-demo/api/src/service/board-api.ts`.
95
110
 
96
111
  ## Helpers
97
112
 
@@ -12,7 +12,7 @@ The package expects the final app to provide the actual icon implementation. The
12
12
 
13
13
  ## Pattern A: Generated Icon Font
14
14
 
15
- The full-stack template uses `apps/lupine-template-fullstack-starter/web/icons-font.config.js` to generate a font icon bundle. This config defines icon names and source SVG files, then the generated CSS/font makes classes such as `ifc-icon ma-pencil-outline` render correctly.
15
+ The full-stack template uses `apps/lupine-template-fullstack-starter/web/icons-font.config.js` to generate a font icon bundle for the pages of `lupine.api` in `/admin` (its own pages and the app use `<Icon name={icons.x} />` of `lupine.core/icons`). This config defines icon names and source SVG files, then the generated CSS/font makes classes such as `ifc-icon ma-pencil-outline` render correctly.
16
16
 
17
17
  When using this pattern:
18
18