create-swdg-frontend 0.1.6 → 0.2.0

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 (469) hide show
  1. package/README.md +31 -13
  2. package/bin/index.js +3 -244
  3. package/lib/argv.js +43 -0
  4. package/lib/cli.js +141 -0
  5. package/lib/constants.js +24 -0
  6. package/lib/gis.js +92 -0
  7. package/lib/manifest.js +23 -0
  8. package/lib/prompts.js +55 -0
  9. package/lib/scaffold.js +118 -0
  10. package/package.json +6 -2
  11. package/scripts/sync-template.js +120 -0
  12. package/scripts/validate-template.mjs +74 -0
  13. package/stubs/tsconfig.node.json +11 -0
  14. package/stubs/types-env.d.ts +9 -0
  15. package/stubs/vite.config.ts +64 -0
  16. package/template/.env.example +6 -0
  17. package/template/.github/workflows/ci.yml +23 -0
  18. package/template/.github/workflows/release.yml +69 -0
  19. package/template/.husky/commit-msg +42 -42
  20. package/template/.husky/pre-commit +2 -2
  21. package/template/.husky/prepare-commit-msg +0 -0
  22. package/template/.lintstagedrc +5 -5
  23. package/template/.prettierignore +26 -26
  24. package/template/.prettierrc.cjs +10 -10
  25. package/template/.stylelintignore +1 -1
  26. package/template/.stylelintrc.json +12 -6
  27. package/template/README.md +99 -36
  28. package/template/auto-imports.d.ts +10 -0
  29. package/template/commitlint.config.cjs +64 -64
  30. package/template/docs/MAINTAINER.md +77 -0
  31. package/template/docs/ONBOARDING.md +284 -0
  32. package/template/docs/TESTING.md +104 -0
  33. package/template/eslint.config.js +97 -96
  34. package/template/index.html +17 -17
  35. package/template/interface/user.ts +5 -5
  36. package/template/package.json +88 -86
  37. package/template/pnpm-lock.yaml +6360 -0
  38. package/template/postcss.config.js +5 -0
  39. package/template/scripts/gen-api.cjs +280 -230
  40. package/template/scripts/release.mjs +53 -59
  41. package/template/scripts/set-release-version.mjs +46 -0
  42. package/template/scripts/test-pipeline.mjs +85 -0
  43. package/template/scripts/test-scaffold.mjs +197 -0
  44. package/template/scripts/test-template.mjs +52 -0
  45. package/template/scripts/verify.mjs +28 -0
  46. package/template/scripts/vite-plugin-cesium-dev.ts +56 -0
  47. package/template/src/App.vue +6 -6
  48. package/template/src/api/README.md +7 -3
  49. package/template/src/assets/favicon.svg +49 -49
  50. package/template/src/components/Body/index.vue +80 -16
  51. package/template/src/components/CesiumViewer/index.vue +36 -0
  52. package/template/src/components/Header/index.vue +19 -8
  53. package/template/src/components/OnboardingDeck/index.vue +449 -0
  54. package/template/src/data/onboardingSlides.ts +208 -0
  55. package/template/src/directive/focus.ts +9 -9
  56. package/template/src/layout/BasicLayout.vue +28 -28
  57. package/template/src/main.ts +25 -33
  58. package/template/src/router/index.ts +30 -24
  59. package/template/src/router/routeUtils.ts +13 -0
  60. package/template/src/stores/README.md +3 -3
  61. package/template/src/stores/useCounter.ts +12 -12
  62. package/template/src/styles/alerts.less +85 -85
  63. package/template/src/styles/global.css +326 -326
  64. package/template/src/styles/shell.css +232 -0
  65. package/template/src/utils/alert.ts +58 -58
  66. package/template/src/utils/axios-middleware.js +180 -0
  67. package/template/src/utils/cesium/index.ts +71 -0
  68. package/template/src/utils/components.ts +21 -21
  69. package/template/src/utils/composables/useAlert.ts +14 -14
  70. package/template/src/utils/composables/useFeatureGis.ts +24 -0
  71. package/template/src/utils/http.ts +5 -0
  72. package/template/src/views/examples/cesium/index.vue +85 -0
  73. package/template/src/views/examples/guide/index.vue +42 -0
  74. package/template/src/views/examples/test/index.vue +63 -0
  75. package/template/src/views/index.vue +8 -9
  76. package/template/src/vite-env.d.ts +1 -1
  77. package/template/tests/README.md +7 -6
  78. package/template/tests/e2e/README.md +3 -3
  79. package/template/tests/setup.ts +1 -1
  80. package/template/tests/unit/onboardingSlides.test.ts +20 -0
  81. package/template/tests/unit/router.utils.test.ts +21 -0
  82. package/template/tests/unit/scaffold.lib.test.ts +44 -0
  83. package/template/tests/unit/useFeatureGis.test.ts +14 -0
  84. package/template/tests/utils/helpers.ts +1 -1
  85. package/template/tsconfig.json +51 -51
  86. package/template/tsconfig.node.json +11 -11
  87. package/template/types/README.md +3 -3
  88. package/template/types/env.d.ts +13 -0
  89. package/template/types/global.d.ts +9 -9
  90. package/template/vite.config.ts +89 -75
  91. package/template/vitest.config.ts +22 -9
  92. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_0.json +0 -1012
  93. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_1.json +0 -1012
  94. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_10.json +0 -1012
  95. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_11.json +0 -1012
  96. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_12.json +0 -1012
  97. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_13.json +0 -1012
  98. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_14.json +0 -1012
  99. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_15.json +0 -1012
  100. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_16.json +0 -1012
  101. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_17.json +0 -1012
  102. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_18.json +0 -1012
  103. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_19.json +0 -1012
  104. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_2.json +0 -1012
  105. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_20.json +0 -1012
  106. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_21.json +0 -1012
  107. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_22.json +0 -1012
  108. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_23.json +0 -1012
  109. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_24.json +0 -1012
  110. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_25.json +0 -1012
  111. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_26.json +0 -1012
  112. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_27.json +0 -438
  113. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_3.json +0 -1012
  114. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_4.json +0 -1012
  115. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_5.json +0 -1012
  116. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_6.json +0 -1012
  117. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_7.json +0 -1012
  118. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_8.json +0 -1012
  119. package/template/public/Cesium1.119/Assets/IAU2006_XYS/IAU2006_XYS_9.json +0 -1012
  120. package/template/public/Cesium1.119/Assets/Images/bing_maps_credit.png +0 -0
  121. package/template/public/Cesium1.119/Assets/Images/cesium_credit.png +0 -0
  122. package/template/public/Cesium1.119/Assets/Images/google_earth_credit.png +0 -0
  123. package/template/public/Cesium1.119/Assets/Images/ion-credit.png +0 -0
  124. package/template/public/Cesium1.119/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
  125. package/template/public/Cesium1.119/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
  126. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
  127. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
  128. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
  129. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
  130. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
  131. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
  132. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
  133. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
  134. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
  135. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
  136. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
  137. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
  138. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
  139. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
  140. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
  141. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
  142. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
  143. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
  144. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
  145. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
  146. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
  147. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
  148. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
  149. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
  150. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
  151. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
  152. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
  153. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
  154. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
  155. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
  156. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
  157. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
  158. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
  159. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
  160. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
  161. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
  162. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
  163. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
  164. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
  165. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
  166. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
  167. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
  168. package/template/public/Cesium1.119/Assets/Textures/NaturalEarthII/tilemapresource.xml +0 -14
  169. package/template/public/Cesium1.119/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
  170. package/template/public/Cesium1.119/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
  171. package/template/public/Cesium1.119/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
  172. package/template/public/Cesium1.119/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
  173. package/template/public/Cesium1.119/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
  174. package/template/public/Cesium1.119/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
  175. package/template/public/Cesium1.119/Assets/Textures/maki/airfield.png +0 -0
  176. package/template/public/Cesium1.119/Assets/Textures/maki/airport.png +0 -0
  177. package/template/public/Cesium1.119/Assets/Textures/maki/alcohol-shop.png +0 -0
  178. package/template/public/Cesium1.119/Assets/Textures/maki/america-football.png +0 -0
  179. package/template/public/Cesium1.119/Assets/Textures/maki/art-gallery.png +0 -0
  180. package/template/public/Cesium1.119/Assets/Textures/maki/bakery.png +0 -0
  181. package/template/public/Cesium1.119/Assets/Textures/maki/bank.png +0 -0
  182. package/template/public/Cesium1.119/Assets/Textures/maki/bar.png +0 -0
  183. package/template/public/Cesium1.119/Assets/Textures/maki/baseball.png +0 -0
  184. package/template/public/Cesium1.119/Assets/Textures/maki/basketball.png +0 -0
  185. package/template/public/Cesium1.119/Assets/Textures/maki/beer.png +0 -0
  186. package/template/public/Cesium1.119/Assets/Textures/maki/bicycle.png +0 -0
  187. package/template/public/Cesium1.119/Assets/Textures/maki/building.png +0 -0
  188. package/template/public/Cesium1.119/Assets/Textures/maki/bus.png +0 -0
  189. package/template/public/Cesium1.119/Assets/Textures/maki/cafe.png +0 -0
  190. package/template/public/Cesium1.119/Assets/Textures/maki/camera.png +0 -0
  191. package/template/public/Cesium1.119/Assets/Textures/maki/campsite.png +0 -0
  192. package/template/public/Cesium1.119/Assets/Textures/maki/car.png +0 -0
  193. package/template/public/Cesium1.119/Assets/Textures/maki/cemetery.png +0 -0
  194. package/template/public/Cesium1.119/Assets/Textures/maki/cesium.png +0 -0
  195. package/template/public/Cesium1.119/Assets/Textures/maki/chemist.png +0 -0
  196. package/template/public/Cesium1.119/Assets/Textures/maki/cinema.png +0 -0
  197. package/template/public/Cesium1.119/Assets/Textures/maki/circle-stroked.png +0 -0
  198. package/template/public/Cesium1.119/Assets/Textures/maki/circle.png +0 -0
  199. package/template/public/Cesium1.119/Assets/Textures/maki/city.png +0 -0
  200. package/template/public/Cesium1.119/Assets/Textures/maki/clothing-store.png +0 -0
  201. package/template/public/Cesium1.119/Assets/Textures/maki/college.png +0 -0
  202. package/template/public/Cesium1.119/Assets/Textures/maki/commercial.png +0 -0
  203. package/template/public/Cesium1.119/Assets/Textures/maki/cricket.png +0 -0
  204. package/template/public/Cesium1.119/Assets/Textures/maki/cross.png +0 -0
  205. package/template/public/Cesium1.119/Assets/Textures/maki/dam.png +0 -0
  206. package/template/public/Cesium1.119/Assets/Textures/maki/danger.png +0 -0
  207. package/template/public/Cesium1.119/Assets/Textures/maki/disability.png +0 -0
  208. package/template/public/Cesium1.119/Assets/Textures/maki/dog-park.png +0 -0
  209. package/template/public/Cesium1.119/Assets/Textures/maki/embassy.png +0 -0
  210. package/template/public/Cesium1.119/Assets/Textures/maki/emergency-telephone.png +0 -0
  211. package/template/public/Cesium1.119/Assets/Textures/maki/entrance.png +0 -0
  212. package/template/public/Cesium1.119/Assets/Textures/maki/farm.png +0 -0
  213. package/template/public/Cesium1.119/Assets/Textures/maki/fast-food.png +0 -0
  214. package/template/public/Cesium1.119/Assets/Textures/maki/ferry.png +0 -0
  215. package/template/public/Cesium1.119/Assets/Textures/maki/fire-station.png +0 -0
  216. package/template/public/Cesium1.119/Assets/Textures/maki/fuel.png +0 -0
  217. package/template/public/Cesium1.119/Assets/Textures/maki/garden.png +0 -0
  218. package/template/public/Cesium1.119/Assets/Textures/maki/gift.png +0 -0
  219. package/template/public/Cesium1.119/Assets/Textures/maki/golf.png +0 -0
  220. package/template/public/Cesium1.119/Assets/Textures/maki/grocery.png +0 -0
  221. package/template/public/Cesium1.119/Assets/Textures/maki/hairdresser.png +0 -0
  222. package/template/public/Cesium1.119/Assets/Textures/maki/harbor.png +0 -0
  223. package/template/public/Cesium1.119/Assets/Textures/maki/heart.png +0 -0
  224. package/template/public/Cesium1.119/Assets/Textures/maki/heliport.png +0 -0
  225. package/template/public/Cesium1.119/Assets/Textures/maki/hospital.png +0 -0
  226. package/template/public/Cesium1.119/Assets/Textures/maki/ice-cream.png +0 -0
  227. package/template/public/Cesium1.119/Assets/Textures/maki/industrial.png +0 -0
  228. package/template/public/Cesium1.119/Assets/Textures/maki/land-use.png +0 -0
  229. package/template/public/Cesium1.119/Assets/Textures/maki/laundry.png +0 -0
  230. package/template/public/Cesium1.119/Assets/Textures/maki/library.png +0 -0
  231. package/template/public/Cesium1.119/Assets/Textures/maki/lighthouse.png +0 -0
  232. package/template/public/Cesium1.119/Assets/Textures/maki/lodging.png +0 -0
  233. package/template/public/Cesium1.119/Assets/Textures/maki/logging.png +0 -0
  234. package/template/public/Cesium1.119/Assets/Textures/maki/london-underground.png +0 -0
  235. package/template/public/Cesium1.119/Assets/Textures/maki/marker-stroked.png +0 -0
  236. package/template/public/Cesium1.119/Assets/Textures/maki/marker.png +0 -0
  237. package/template/public/Cesium1.119/Assets/Textures/maki/minefield.png +0 -0
  238. package/template/public/Cesium1.119/Assets/Textures/maki/mobilephone.png +0 -0
  239. package/template/public/Cesium1.119/Assets/Textures/maki/monument.png +0 -0
  240. package/template/public/Cesium1.119/Assets/Textures/maki/museum.png +0 -0
  241. package/template/public/Cesium1.119/Assets/Textures/maki/music.png +0 -0
  242. package/template/public/Cesium1.119/Assets/Textures/maki/oil-well.png +0 -0
  243. package/template/public/Cesium1.119/Assets/Textures/maki/park.png +0 -0
  244. package/template/public/Cesium1.119/Assets/Textures/maki/park2.png +0 -0
  245. package/template/public/Cesium1.119/Assets/Textures/maki/parking-garage.png +0 -0
  246. package/template/public/Cesium1.119/Assets/Textures/maki/parking.png +0 -0
  247. package/template/public/Cesium1.119/Assets/Textures/maki/pharmacy.png +0 -0
  248. package/template/public/Cesium1.119/Assets/Textures/maki/pitch.png +0 -0
  249. package/template/public/Cesium1.119/Assets/Textures/maki/place-of-worship.png +0 -0
  250. package/template/public/Cesium1.119/Assets/Textures/maki/playground.png +0 -0
  251. package/template/public/Cesium1.119/Assets/Textures/maki/police.png +0 -0
  252. package/template/public/Cesium1.119/Assets/Textures/maki/polling-place.png +0 -0
  253. package/template/public/Cesium1.119/Assets/Textures/maki/post.png +0 -0
  254. package/template/public/Cesium1.119/Assets/Textures/maki/prison.png +0 -0
  255. package/template/public/Cesium1.119/Assets/Textures/maki/rail-above.png +0 -0
  256. package/template/public/Cesium1.119/Assets/Textures/maki/rail-light.png +0 -0
  257. package/template/public/Cesium1.119/Assets/Textures/maki/rail-metro.png +0 -0
  258. package/template/public/Cesium1.119/Assets/Textures/maki/rail-underground.png +0 -0
  259. package/template/public/Cesium1.119/Assets/Textures/maki/rail.png +0 -0
  260. package/template/public/Cesium1.119/Assets/Textures/maki/religious-christian.png +0 -0
  261. package/template/public/Cesium1.119/Assets/Textures/maki/religious-jewish.png +0 -0
  262. package/template/public/Cesium1.119/Assets/Textures/maki/religious-muslim.png +0 -0
  263. package/template/public/Cesium1.119/Assets/Textures/maki/restaurant.png +0 -0
  264. package/template/public/Cesium1.119/Assets/Textures/maki/roadblock.png +0 -0
  265. package/template/public/Cesium1.119/Assets/Textures/maki/rocket.png +0 -0
  266. package/template/public/Cesium1.119/Assets/Textures/maki/school.png +0 -0
  267. package/template/public/Cesium1.119/Assets/Textures/maki/scooter.png +0 -0
  268. package/template/public/Cesium1.119/Assets/Textures/maki/shop.png +0 -0
  269. package/template/public/Cesium1.119/Assets/Textures/maki/skiing.png +0 -0
  270. package/template/public/Cesium1.119/Assets/Textures/maki/slaughterhouse.png +0 -0
  271. package/template/public/Cesium1.119/Assets/Textures/maki/soccer.png +0 -0
  272. package/template/public/Cesium1.119/Assets/Textures/maki/square-stroked.png +0 -0
  273. package/template/public/Cesium1.119/Assets/Textures/maki/square.png +0 -0
  274. package/template/public/Cesium1.119/Assets/Textures/maki/star-stroked.png +0 -0
  275. package/template/public/Cesium1.119/Assets/Textures/maki/star.png +0 -0
  276. package/template/public/Cesium1.119/Assets/Textures/maki/suitcase.png +0 -0
  277. package/template/public/Cesium1.119/Assets/Textures/maki/swimming.png +0 -0
  278. package/template/public/Cesium1.119/Assets/Textures/maki/telephone.png +0 -0
  279. package/template/public/Cesium1.119/Assets/Textures/maki/tennis.png +0 -0
  280. package/template/public/Cesium1.119/Assets/Textures/maki/theatre.png +0 -0
  281. package/template/public/Cesium1.119/Assets/Textures/maki/toilets.png +0 -0
  282. package/template/public/Cesium1.119/Assets/Textures/maki/town-hall.png +0 -0
  283. package/template/public/Cesium1.119/Assets/Textures/maki/town.png +0 -0
  284. package/template/public/Cesium1.119/Assets/Textures/maki/triangle-stroked.png +0 -0
  285. package/template/public/Cesium1.119/Assets/Textures/maki/triangle.png +0 -0
  286. package/template/public/Cesium1.119/Assets/Textures/maki/village.png +0 -0
  287. package/template/public/Cesium1.119/Assets/Textures/maki/warehouse.png +0 -0
  288. package/template/public/Cesium1.119/Assets/Textures/maki/waste-basket.png +0 -0
  289. package/template/public/Cesium1.119/Assets/Textures/maki/water.png +0 -0
  290. package/template/public/Cesium1.119/Assets/Textures/maki/wetland.png +0 -0
  291. package/template/public/Cesium1.119/Assets/Textures/maki/zoo.png +0 -0
  292. package/template/public/Cesium1.119/Assets/Textures/moonSmall.jpg +0 -0
  293. package/template/public/Cesium1.119/Assets/Textures/pin.svg +0 -1
  294. package/template/public/Cesium1.119/Assets/Textures/waterNormals.jpg +0 -0
  295. package/template/public/Cesium1.119/Assets/Textures/waterNormalsSmall.jpg +0 -0
  296. package/template/public/Cesium1.119/Assets/approximateTerrainHeights.json +0 -10924
  297. package/template/public/Cesium1.119/Cesium.js +0 -185772
  298. package/template/public/Cesium1.119/ThirdParty/Workers/package.json +0 -3
  299. package/template/public/Cesium1.119/ThirdParty/Workers/pako_deflate.min.js +0 -1681
  300. package/template/public/Cesium1.119/ThirdParty/Workers/pako_inflate.min.js +0 -1489
  301. package/template/public/Cesium1.119/ThirdParty/Workers/z-worker-pako.js +0 -1070
  302. package/template/public/Cesium1.119/ThirdParty/basis_transcoder.wasm +0 -0
  303. package/template/public/Cesium1.119/ThirdParty/draco_decoder.wasm +0 -0
  304. package/template/public/Cesium1.119/ThirdParty/google-earth-dbroot-parser.js +0 -11424
  305. package/template/public/Cesium1.119/Widgets/Animation/Animation.css +0 -127
  306. package/template/public/Cesium1.119/Widgets/Animation/lighter.css +0 -78
  307. package/template/public/Cesium1.119/Widgets/BaseLayerPicker/BaseLayerPicker.css +0 -112
  308. package/template/public/Cesium1.119/Widgets/BaseLayerPicker/lighter.css +0 -28
  309. package/template/public/Cesium1.119/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css +0 -104
  310. package/template/public/Cesium1.119/Widgets/CesiumInspector/CesiumInspector.css +0 -115
  311. package/template/public/Cesium1.119/Widgets/CesiumWidget/CesiumWidget.css +0 -119
  312. package/template/public/Cesium1.119/Widgets/CesiumWidget/lighter.css +0 -14
  313. package/template/public/Cesium1.119/Widgets/FullscreenButton/FullscreenButton.css +0 -8
  314. package/template/public/Cesium1.119/Widgets/Geocoder/Geocoder.css +0 -72
  315. package/template/public/Cesium1.119/Widgets/Geocoder/lighter.css +0 -17
  316. package/template/public/Cesium1.119/Widgets/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +0 -27
  317. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
  318. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
  319. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
  320. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/bingAerial.png +0 -0
  321. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/bingAerialLabels.png +0 -0
  322. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/bingRoads.png +0 -0
  323. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/blueMarble.png +0 -0
  324. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/earthAtNight.png +0 -0
  325. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png +0 -0
  326. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/mapboxSatellite.png +0 -0
  327. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/mapboxStreets.png +0 -0
  328. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/mapboxTerrain.png +0 -0
  329. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/naturalEarthII.png +0 -0
  330. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/openStreetMap.png +0 -0
  331. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/sentinel-2.png +0 -0
  332. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
  333. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
  334. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/stamenToner.png +0 -0
  335. package/template/public/Cesium1.119/Widgets/Images/ImageryProviders/stamenWatercolor.png +0 -0
  336. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/Mouse.svg +0 -84
  337. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/MouseLeft.svg +0 -76
  338. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/MouseMiddle.svg +0 -76
  339. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/MouseRight.svg +0 -76
  340. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/Touch.svg +0 -120
  341. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/TouchDrag.svg +0 -129
  342. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/TouchRotate.svg +0 -76
  343. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/TouchTilt.svg +0 -135
  344. package/template/public/Cesium1.119/Widgets/Images/NavigationHelp/TouchZoom.svg +0 -74
  345. package/template/public/Cesium1.119/Widgets/Images/TerrainProviders/CesiumWorldTerrain.png +0 -0
  346. package/template/public/Cesium1.119/Widgets/Images/TerrainProviders/Ellipsoid.png +0 -0
  347. package/template/public/Cesium1.119/Widgets/Images/TimelineIcons.png +0 -0
  348. package/template/public/Cesium1.119/Widgets/Images/info-loading.gif +0 -0
  349. package/template/public/Cesium1.119/Widgets/InfoBox/InfoBox.css +0 -94
  350. package/template/public/Cesium1.119/Widgets/InfoBox/InfoBoxDescription.css +0 -178
  351. package/template/public/Cesium1.119/Widgets/NavigationHelpButton/NavigationHelpButton.css +0 -95
  352. package/template/public/Cesium1.119/Widgets/NavigationHelpButton/lighter.css +0 -38
  353. package/template/public/Cesium1.119/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +0 -15
  354. package/template/public/Cesium1.119/Widgets/ProjectionPicker/ProjectionPicker.css +0 -46
  355. package/template/public/Cesium1.119/Widgets/SceneModePicker/SceneModePicker.css +0 -72
  356. package/template/public/Cesium1.119/Widgets/SelectionIndicator/SelectionIndicator.css +0 -22
  357. package/template/public/Cesium1.119/Widgets/Timeline/Timeline.css +0 -103
  358. package/template/public/Cesium1.119/Widgets/Timeline/lighter.css +0 -18
  359. package/template/public/Cesium1.119/Widgets/VRButton/VRButton.css +0 -8
  360. package/template/public/Cesium1.119/Widgets/Viewer/Viewer.css +0 -107
  361. package/template/public/Cesium1.119/Widgets/VoxelInspector/VoxelInspector.css +0 -18
  362. package/template/public/Cesium1.119/Widgets/lighter.css +0 -246
  363. package/template/public/Cesium1.119/Widgets/lighterShared.css +0 -46
  364. package/template/public/Cesium1.119/Widgets/shared.css +0 -103
  365. package/template/public/Cesium1.119/Widgets/widgets.css +0 -1376
  366. package/template/public/Cesium1.119/Workers/chunk-3C7WC463.js +0 -611
  367. package/template/public/Cesium1.119/Workers/chunk-3JW36LZF.js +0 -166
  368. package/template/public/Cesium1.119/Workers/chunk-4BTGX3WJ.js +0 -264
  369. package/template/public/Cesium1.119/Workers/chunk-4WRMLZA7.js +0 -128
  370. package/template/public/Cesium1.119/Workers/chunk-7Z5IIKOJ.js +0 -8046
  371. package/template/public/Cesium1.119/Workers/chunk-ABGXSJNX.js +0 -341
  372. package/template/public/Cesium1.119/Workers/chunk-AMQUWUD4.js +0 -269
  373. package/template/public/Cesium1.119/Workers/chunk-ATPDRNKI.js +0 -28
  374. package/template/public/Cesium1.119/Workers/chunk-BMHPVZ4H.js +0 -199
  375. package/template/public/Cesium1.119/Workers/chunk-CBEO3SHS.js +0 -1102
  376. package/template/public/Cesium1.119/Workers/chunk-CV7DLCWG.js +0 -485
  377. package/template/public/Cesium1.119/Workers/chunk-DQO6B4EQ.js +0 -76
  378. package/template/public/Cesium1.119/Workers/chunk-ED3TLP6D.js +0 -91
  379. package/template/public/Cesium1.119/Workers/chunk-EFZKO5RU.js +0 -42
  380. package/template/public/Cesium1.119/Workers/chunk-F5IHREXR.js +0 -2678
  381. package/template/public/Cesium1.119/Workers/chunk-FKRG4HDY.js +0 -516
  382. package/template/public/Cesium1.119/Workers/chunk-FYOYUPXG.js +0 -399
  383. package/template/public/Cesium1.119/Workers/chunk-GFN7NNSJ.js +0 -65
  384. package/template/public/Cesium1.119/Workers/chunk-HEEMUCG6.js +0 -92
  385. package/template/public/Cesium1.119/Workers/chunk-HSWA4OEL.js +0 -672
  386. package/template/public/Cesium1.119/Workers/chunk-IAC5XVZV.js +0 -287
  387. package/template/public/Cesium1.119/Workers/chunk-II4VNKYR.js +0 -50
  388. package/template/public/Cesium1.119/Workers/chunk-ILGBPNP6.js +0 -28
  389. package/template/public/Cesium1.119/Workers/chunk-IRH46BDL.js +0 -124
  390. package/template/public/Cesium1.119/Workers/chunk-IUA6FAOZ.js +0 -31
  391. package/template/public/Cesium1.119/Workers/chunk-K4ASOM65.js +0 -331
  392. package/template/public/Cesium1.119/Workers/chunk-KCIZBVXL.js +0 -258
  393. package/template/public/Cesium1.119/Workers/chunk-KF5NF354.js +0 -162
  394. package/template/public/Cesium1.119/Workers/chunk-KRKI6AAO.js +0 -773
  395. package/template/public/Cesium1.119/Workers/chunk-KZNJOCYU.js +0 -162
  396. package/template/public/Cesium1.119/Workers/chunk-O5IJ3OGP.js +0 -857
  397. package/template/public/Cesium1.119/Workers/chunk-OO23RBLX.js +0 -183
  398. package/template/public/Cesium1.119/Workers/chunk-P37AI2DW.js +0 -85
  399. package/template/public/Cesium1.119/Workers/chunk-PDMQLSBL.js +0 -108
  400. package/template/public/Cesium1.119/Workers/chunk-PEYJTJPE.js +0 -73
  401. package/template/public/Cesium1.119/Workers/chunk-POASMU2N.js +0 -2372
  402. package/template/public/Cesium1.119/Workers/chunk-PXCJYT2S.js +0 -73
  403. package/template/public/Cesium1.119/Workers/chunk-Q6L7X3LP.js +0 -538
  404. package/template/public/Cesium1.119/Workers/chunk-QB3MDM4J.js +0 -1670
  405. package/template/public/Cesium1.119/Workers/chunk-R6KGAEF6.js +0 -392
  406. package/template/public/Cesium1.119/Workers/chunk-RXTBM4OI.js +0 -57
  407. package/template/public/Cesium1.119/Workers/chunk-SB224QGV.js +0 -72
  408. package/template/public/Cesium1.119/Workers/chunk-T6BE4RZK.js +0 -37
  409. package/template/public/Cesium1.119/Workers/chunk-TAMCUKAR.js +0 -814
  410. package/template/public/Cesium1.119/Workers/chunk-TMSETF7M.js +0 -579
  411. package/template/public/Cesium1.119/Workers/chunk-TOGHF3VN.js +0 -376
  412. package/template/public/Cesium1.119/Workers/chunk-UH2WFNTA.js +0 -111
  413. package/template/public/Cesium1.119/Workers/chunk-V7JEDBOE.js +0 -573
  414. package/template/public/Cesium1.119/Workers/chunk-VBIROZR5.js +0 -633
  415. package/template/public/Cesium1.119/Workers/chunk-W23CU777.js +0 -271
  416. package/template/public/Cesium1.119/Workers/chunk-X5IHHI6X.js +0 -173
  417. package/template/public/Cesium1.119/Workers/chunk-XHX2UPDO.js +0 -217
  418. package/template/public/Cesium1.119/Workers/combineGeometry.js +0 -53
  419. package/template/public/Cesium1.119/Workers/createBoxGeometry.js +0 -45
  420. package/template/public/Cesium1.119/Workers/createBoxOutlineGeometry.js +0 -189
  421. package/template/public/Cesium1.119/Workers/createCircleGeometry.js +0 -148
  422. package/template/public/Cesium1.119/Workers/createCircleOutlineGeometry.js +0 -105
  423. package/template/public/Cesium1.119/Workers/createCoplanarPolygonGeometry.js +0 -293
  424. package/template/public/Cesium1.119/Workers/createCoplanarPolygonOutlineGeometry.js +0 -143
  425. package/template/public/Cesium1.119/Workers/createCorridorGeometry.js +0 -830
  426. package/template/public/Cesium1.119/Workers/createCorridorOutlineGeometry.js +0 -417
  427. package/template/public/Cesium1.119/Workers/createCylinderGeometry.js +0 -47
  428. package/template/public/Cesium1.119/Workers/createCylinderOutlineGeometry.js +0 -170
  429. package/template/public/Cesium1.119/Workers/createEllipseGeometry.js +0 -58
  430. package/template/public/Cesium1.119/Workers/createEllipseOutlineGeometry.js +0 -51
  431. package/template/public/Cesium1.119/Workers/createEllipsoidGeometry.js +0 -46
  432. package/template/public/Cesium1.119/Workers/createEllipsoidOutlineGeometry.js +0 -45
  433. package/template/public/Cesium1.119/Workers/createFrustumGeometry.js +0 -45
  434. package/template/public/Cesium1.119/Workers/createFrustumOutlineGeometry.js +0 -164
  435. package/template/public/Cesium1.119/Workers/createGeometry.js +0 -159
  436. package/template/public/Cesium1.119/Workers/createGroundPolylineGeometry.js +0 -911
  437. package/template/public/Cesium1.119/Workers/createPlaneGeometry.js +0 -185
  438. package/template/public/Cesium1.119/Workers/createPlaneOutlineGeometry.js +0 -93
  439. package/template/public/Cesium1.119/Workers/createPolygonGeometry.js +0 -884
  440. package/template/public/Cesium1.119/Workers/createPolygonOutlineGeometry.js +0 -359
  441. package/template/public/Cesium1.119/Workers/createPolylineGeometry.js +0 -349
  442. package/template/public/Cesium1.119/Workers/createPolylineVolumeGeometry.js +0 -262
  443. package/template/public/Cesium1.119/Workers/createPolylineVolumeOutlineGeometry.js +0 -177
  444. package/template/public/Cesium1.119/Workers/createRectangleGeometry.js +0 -787
  445. package/template/public/Cesium1.119/Workers/createRectangleOutlineGeometry.js +0 -299
  446. package/template/public/Cesium1.119/Workers/createSimplePolylineGeometry.js +0 -294
  447. package/template/public/Cesium1.119/Workers/createSphereGeometry.js +0 -84
  448. package/template/public/Cesium1.119/Workers/createSphereOutlineGeometry.js +0 -83
  449. package/template/public/Cesium1.119/Workers/createTaskProcessorWorker.js +0 -28
  450. package/template/public/Cesium1.119/Workers/createVectorTileClampedPolylines.js +0 -289
  451. package/template/public/Cesium1.119/Workers/createVectorTileGeometries.js +0 -258
  452. package/template/public/Cesium1.119/Workers/createVectorTilePoints.js +0 -79
  453. package/template/public/Cesium1.119/Workers/createVectorTilePolygons.js +0 -275
  454. package/template/public/Cesium1.119/Workers/createVectorTilePolylines.js +0 -176
  455. package/template/public/Cesium1.119/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -375
  456. package/template/public/Cesium1.119/Workers/createVerticesFromHeightmap.js +0 -1772
  457. package/template/public/Cesium1.119/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -425
  458. package/template/public/Cesium1.119/Workers/createWallGeometry.js +0 -320
  459. package/template/public/Cesium1.119/Workers/createWallOutlineGeometry.js +0 -229
  460. package/template/public/Cesium1.119/Workers/decodeDraco.js +0 -227
  461. package/template/public/Cesium1.119/Workers/decodeGoogleEarthEnterprisePacket.js +0 -1836
  462. package/template/public/Cesium1.119/Workers/decodeI3S.js +0 -924
  463. package/template/public/Cesium1.119/Workers/transcodeKTX2.js +0 -3180
  464. package/template/public/Cesium1.119/Workers/transferTypedArrayTest.js +0 -34
  465. package/template/public/Cesium1.119/Workers/upsampleQuantizedTerrainMesh.js +0 -534
  466. package/template/public/Cesium1.119/index.cjs +0 -185632
  467. package/template/public/Cesium1.119/index.js +0 -182874
  468. package/template/src/views/Test/index.vue +0 -23
  469. package/template/tests/unit/example.test.ts +0 -7
@@ -0,0 +1,118 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { spawn } from 'node:child_process';
4
+ import { TEMPLATE_DIR } from './constants.js';
5
+ import { applyGisIntegration, removeGisIntegration } from './gis.js';
6
+ import { writeProjectManifest } from './manifest.js';
7
+
8
+ export async function pathExists(p) {
9
+ try {
10
+ await fs.access(p);
11
+ return true;
12
+ } catch {
13
+ return false;
14
+ }
15
+ }
16
+
17
+ async function isDirEmpty(p) {
18
+ try {
19
+ return (await fs.readdir(p)).length === 0;
20
+ } catch {
21
+ return true;
22
+ }
23
+ }
24
+
25
+ export async function copyTemplate(destDir, { forceEmpty = false } = {}) {
26
+ if (await pathExists(destDir)) {
27
+ const empty = await isDirEmpty(destDir);
28
+ if (!empty && !forceEmpty) {
29
+ throw new Error('TARGET_NOT_EMPTY');
30
+ }
31
+ await fs.rm(destDir, { recursive: true, force: true });
32
+ }
33
+ await fs.mkdir(destDir, { recursive: true });
34
+ await fs.cp(TEMPLATE_DIR, destDir, { recursive: true });
35
+ }
36
+
37
+ export async function updatePackageName(destDir, name) {
38
+ const pkgPath = path.join(destDir, 'package.json');
39
+ const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf8'));
40
+ pkg.name = name;
41
+ await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
42
+ }
43
+
44
+ export async function updateIndexTitle(destDir, title) {
45
+ const indexPath = path.join(destDir, 'index.html');
46
+ try {
47
+ const html = await fs.readFile(indexPath, 'utf8');
48
+ const next = html.replace(
49
+ /<title>.*?<\/title>/i,
50
+ `<title>${title}</title>`
51
+ );
52
+ await fs.writeFile(indexPath, next, 'utf8');
53
+ } catch {
54
+ // ignore
55
+ }
56
+ }
57
+
58
+ export async function runInstall(destDir, pm) {
59
+ const child = spawn(pm, ['install'], { cwd: destDir, stdio: 'inherit' });
60
+ await new Promise((resolve, reject) => {
61
+ child.on('exit', (code) => {
62
+ if (code === 0) resolve();
63
+ else reject(new Error(`${pm} install failed with code ${code}`));
64
+ });
65
+ });
66
+ }
67
+
68
+ export async function initGit(destDir) {
69
+ const child = spawn('git', ['init'], { cwd: destDir, stdio: 'inherit' });
70
+ await new Promise((resolve, reject) => {
71
+ child.on('exit', (code) => {
72
+ if (code === 0) resolve();
73
+ else reject(new Error(`git init failed with code ${code}`));
74
+ });
75
+ });
76
+ }
77
+
78
+ export async function verifyProject(destDir, pm) {
79
+ const child = spawn(pm, ['run', 'typecheck'], {
80
+ cwd: destDir,
81
+ stdio: 'inherit',
82
+ });
83
+ await new Promise((resolve, reject) => {
84
+ child.on('exit', (code) => {
85
+ if (code === 0) resolve();
86
+ else reject(new Error('Post-scaffold typecheck failed'));
87
+ });
88
+ });
89
+ }
90
+
91
+ export async function applyFeatures(destDir, { gis }) {
92
+ if (gis) {
93
+ await applyGisIntegration(destDir);
94
+ } else {
95
+ await removeGisIntegration(destDir);
96
+ }
97
+ }
98
+
99
+ export async function finalizeProject(destDir, context) {
100
+ await writeProjectManifest(destDir, {
101
+ features: { gis: context.gis },
102
+ packageManager: context.pm,
103
+ });
104
+ }
105
+
106
+ /** 供 CLI 与集成测试复用的创建流程(不含 install / git / verify) */
107
+ export async function createProject(
108
+ destDir,
109
+ { projectName, gis, pm = 'pnpm' }
110
+ ) {
111
+ await copyTemplate(destDir);
112
+ await updatePackageName(destDir, projectName);
113
+ await updateIndexTitle(destDir, projectName);
114
+ await applyFeatures(destDir, { gis });
115
+ await finalizeProject(destDir, { gis, pm });
116
+ }
117
+
118
+ export { TEMPLATE_DIR };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-swdg-frontend",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "description": "Scaffold a new SWDG frontend project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,11 +8,15 @@
8
8
  },
9
9
  "files": [
10
10
  "bin",
11
+ "lib",
12
+ "stubs",
13
+ "scripts",
11
14
  "template"
12
15
  ],
13
16
  "scripts": {
14
17
  "sync-template": "node scripts/sync-template.js",
15
- "prepublishOnly": "node scripts/sync-template.js"
18
+ "validate-template": "node scripts/validate-template.mjs",
19
+ "prepublishOnly": "node scripts/sync-template.js && node scripts/validate-template.mjs"
16
20
  },
17
21
  "engines": {
18
22
  "node": ">=18"
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { spawn } from 'node:child_process';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+
11
+ const DEFAULT_REPO = 'http://10.20.124.70/bim/frontend-framework.git';
12
+ const repo = process.env.TEMPLATE_REPO || DEFAULT_REPO;
13
+ const localSource = process.env.TEMPLATE_DIR;
14
+ const autoLocalSource = path.resolve(__dirname, '../..');
15
+ const branch = process.env.TEMPLATE_BRANCH || 'main';
16
+ const templateDir = path.resolve(__dirname, '../template');
17
+
18
+ const excludes = new Set([
19
+ '.git',
20
+ 'node_modules',
21
+ 'dist',
22
+ '.DS_Store',
23
+ '.cursor',
24
+ '.vscode',
25
+ 'create-swdg',
26
+ 'create-frontend-framework',
27
+ 'swdg',
28
+ 'package-lock.json',
29
+ 'pnpm-lock.yaml',
30
+ 'openapi-generator-cli.jar',
31
+ 'tsconfig.tsbuildinfo',
32
+ 'auto-imports.d.ts',
33
+ 'components.d.ts',
34
+ '_tmp-swdg-test',
35
+ 'my-app',
36
+ 'public/Cesium1.119',
37
+ ]);
38
+
39
+ function run(cmd, args, options = {}) {
40
+ return new Promise((resolve, reject) => {
41
+ const child = spawn(cmd, args, { stdio: 'inherit', ...options });
42
+ child.on('exit', (code) => {
43
+ if (code === 0) resolve();
44
+ else
45
+ reject(new Error(`${cmd} ${args.join(' ')} failed with code ${code}`));
46
+ });
47
+ });
48
+ }
49
+
50
+ async function pathExists(targetPath) {
51
+ try {
52
+ await fs.access(targetPath);
53
+ return true;
54
+ } catch {
55
+ return false;
56
+ }
57
+ }
58
+
59
+ async function copyDir(src, dest) {
60
+ const entries = await fs.readdir(src, { withFileTypes: true });
61
+ await fs.mkdir(dest, { recursive: true });
62
+
63
+ for (const entry of entries) {
64
+ if (excludes.has(entry.name)) continue;
65
+ const from = path.join(src, entry.name);
66
+ const to = path.join(dest, entry.name);
67
+
68
+ if (entry.isDirectory()) {
69
+ await copyDir(from, to);
70
+ } else if (entry.isSymbolicLink()) {
71
+ const link = await fs.readlink(from);
72
+ await fs.symlink(link, to);
73
+ } else {
74
+ await fs.copyFile(from, to);
75
+ }
76
+ }
77
+ }
78
+
79
+ async function main() {
80
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'swdg-template-'));
81
+ const tempRepo = path.join(tempRoot, 'repo');
82
+
83
+ if (
84
+ localSource ||
85
+ (await pathExists(path.join(autoLocalSource, 'package.json')))
86
+ ) {
87
+ const absLocal = localSource ? path.resolve(localSource) : autoLocalSource;
88
+ console.log(`Syncing template from local path: ${absLocal}`);
89
+ await fs.rm(templateDir, { recursive: true, force: true });
90
+ await fs.mkdir(templateDir, { recursive: true });
91
+ await copyDir(absLocal, templateDir);
92
+ console.log('Template synced.');
93
+ return;
94
+ }
95
+
96
+ console.log(`Cloning template from ${repo} (${branch})...`);
97
+ await run('git', [
98
+ 'clone',
99
+ '--depth',
100
+ '1',
101
+ '--branch',
102
+ branch,
103
+ repo,
104
+ tempRepo,
105
+ ]);
106
+
107
+ await fs.rm(templateDir, { recursive: true, force: true });
108
+ await fs.mkdir(templateDir, { recursive: true });
109
+
110
+ console.log('Syncing template...');
111
+ await copyDir(tempRepo, templateDir);
112
+
113
+ await fs.rm(tempRoot, { recursive: true, force: true });
114
+ console.log('Template synced.');
115
+ }
116
+
117
+ main().catch((err) => {
118
+ console.error(err?.message ?? err);
119
+ process.exit(1);
120
+ });
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 校验 create-swdg/template 可 install / typecheck / build。
4
+ * 在 create-swdg 包内自包含,供 prepublishOnly 与 monorepo test:template 使用。
5
+ */
6
+ import fs from 'node:fs/promises';
7
+ import path from 'node:path';
8
+ import { spawn } from 'node:child_process';
9
+ import { fileURLToPath } from 'node:url';
10
+
11
+ const packageRoot = path.resolve(
12
+ path.dirname(fileURLToPath(import.meta.url)),
13
+ '..'
14
+ );
15
+ const templateDir = path.join(packageRoot, 'template');
16
+
17
+ function run(cmd, args, cwd, env = process.env) {
18
+ return new Promise((resolve, reject) => {
19
+ const child = spawn(cmd, args, {
20
+ cwd,
21
+ stdio: 'inherit',
22
+ shell: true,
23
+ env,
24
+ });
25
+ child.on('exit', (code) => {
26
+ if (code === 0) resolve();
27
+ else reject(new Error(`${cmd} ${args.join(' ')} exited ${code}`));
28
+ });
29
+ });
30
+ }
31
+
32
+ async function assertTemplateLayout() {
33
+ const required = [
34
+ 'package.json',
35
+ 'vite.config.ts',
36
+ 'src/main.ts',
37
+ 'src/router/index.ts',
38
+ 'src/views/index.vue',
39
+ 'docs/ONBOARDING.md',
40
+ ];
41
+ for (const rel of required) {
42
+ try {
43
+ await fs.access(path.join(templateDir, rel));
44
+ } catch {
45
+ throw new Error(`template missing required file: ${rel}`);
46
+ }
47
+ }
48
+ }
49
+
50
+ async function main() {
51
+ console.log('\n▶ validate-template\n');
52
+ console.log(` template: ${templateDir}`);
53
+
54
+ await assertTemplateLayout();
55
+
56
+ console.log(' · pnpm install');
57
+ await run('pnpm', ['install'], templateDir);
58
+
59
+ console.log(' · typecheck');
60
+ await run('pnpm', ['run', 'typecheck'], templateDir);
61
+
62
+ console.log(' · production build');
63
+ await run('pnpm', ['run', 'build'], templateDir, {
64
+ ...process.env,
65
+ VITE_FEATURE_GIS: 'true',
66
+ });
67
+
68
+ console.log('\n✓ validate-template passed\n');
69
+ }
70
+
71
+ main().catch((err) => {
72
+ console.error(`\n✗ validate-template failed: ${err.message}\n`);
73
+ process.exit(1);
74
+ });
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true
9
+ },
10
+ "include": ["vite.config.ts"]
11
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_DEMO_PROXY_TARGET?: string;
5
+ }
6
+
7
+ interface ImportMeta {
8
+ readonly env: ImportMetaEnv;
9
+ }
@@ -0,0 +1,64 @@
1
+ import { defineConfig, loadEnv } from 'vite';
2
+ import vue from '@vitejs/plugin-vue';
3
+ import AutoImport from 'unplugin-auto-import/vite';
4
+ import Components from 'unplugin-vue-components/vite';
5
+ import copyPlugin from 'rollup-plugin-copy';
6
+ import path from 'path';
7
+
8
+ export default defineConfig(({ mode }) => {
9
+ const env = loadEnv(mode, process.cwd(), '');
10
+
11
+ return {
12
+ base: './',
13
+ build: {
14
+ sourcemap: true,
15
+ emptyOutDir: false,
16
+ rollupOptions: {
17
+ plugins: [
18
+ copyPlugin({
19
+ targets: [{ src: 'src/assets/**/*', dest: 'dist/assets' }],
20
+ }),
21
+ ],
22
+ },
23
+ outDir: 'dist',
24
+ assetsDir: 'assets',
25
+ },
26
+ plugins: [vue(), AutoImport({}), Components({})],
27
+ resolve: {
28
+ alias: {
29
+ '@': path.resolve(__dirname, './src'),
30
+ '@assets': path.resolve(__dirname, './src/assets'),
31
+ '@style': path.resolve(__dirname, './src/styles'),
32
+ '@stores': path.resolve(__dirname, './src/stores'),
33
+ '@components': path.resolve(__dirname, './src/components'),
34
+ '@utils': path.resolve(__dirname, './src/utils'),
35
+ '@api': path.resolve(__dirname, './src/api'),
36
+ '@types': path.resolve(__dirname, './types'),
37
+ '@views': path.resolve(__dirname, './src/views'),
38
+ '@composables': path.resolve(__dirname, './src/utils/composables'),
39
+ '@router': path.resolve(__dirname, './src/router'),
40
+ '@directive': path.resolve(__dirname, './src/directive'),
41
+ '@layout': path.resolve(__dirname, './src/layout'),
42
+ '@interface': path.resolve(__dirname, './interface'),
43
+ },
44
+ },
45
+ css: {
46
+ preprocessorOptions: {
47
+ less: {
48
+ javascriptEnabled: true,
49
+ },
50
+ },
51
+ },
52
+ server: {
53
+ host: '0.0.0.0',
54
+ port: 3000,
55
+ open: true,
56
+ proxy: {
57
+ '/demo': {
58
+ target: env.VITE_DEMO_PROXY_TARGET,
59
+ changeOrigin: true,
60
+ },
61
+ },
62
+ },
63
+ };
64
+ });
@@ -0,0 +1,6 @@
1
+ # 复制为 .env 后按需修改
2
+ VITE_DEMO_PROXY_TARGET=http://127.0.0.1:8888
3
+
4
+ # 模板默认含 Cesium;脚手架 --no-gis 会移除此行
5
+ VITE_FEATURE_GIS=true
6
+ # VITE_CESIUM_ION_ACCESS_TOKEN=
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ release-gate:
11
+ runs-on: ubuntu-latest
12
+ timeout-minutes: 30
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: pnpm/action-setup@v4
16
+ with:
17
+ version: 9
18
+ - uses: actions/setup-node@v4
19
+ with:
20
+ node-version: 22
21
+ cache: pnpm
22
+ - run: pnpm install --frozen-lockfile
23
+ - run: pnpm test:ci
@@ -0,0 +1,69 @@
1
+ name: Release to npm
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v[0-9]+.[0-9]+.[0-9]+'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 45
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Resolve version from tag
20
+ id: meta
21
+ run: |
22
+ TAG="${GITHUB_REF_NAME}"
23
+ VERSION="${TAG#v}"
24
+ if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
25
+ echo "Invalid tag: $TAG (expected vX.Y.Z)"
26
+ exit 1
27
+ fi
28
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
29
+ echo "Publishing version: $VERSION"
30
+
31
+ - uses: pnpm/action-setup@v4
32
+ with:
33
+ version: 9
34
+
35
+ - uses: actions/setup-node@v4
36
+ with:
37
+ node-version: 22
38
+ cache: pnpm
39
+
40
+ - name: Align package versions
41
+ run: node scripts/set-release-version.mjs "${{ steps.meta.outputs.version }}"
42
+
43
+ - name: Install dependencies
44
+ run: pnpm install --frozen-lockfile
45
+
46
+ - name: Release test pipeline
47
+ run: pnpm test:ci
48
+
49
+ - uses: actions/setup-node@v4
50
+ with:
51
+ node-version: 22
52
+ registry-url: https://registry.npmjs.org
53
+
54
+ - name: Publish create-swdg-frontend
55
+ working-directory: create-swdg
56
+ run: npm publish --access public
57
+ env:
58
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
59
+
60
+ - name: Publish swdg
61
+ working-directory: swdg
62
+ run: npm publish --access public
63
+ env:
64
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
65
+
66
+ - name: Summary
67
+ run: |
68
+ echo "Published create-swdg-frontend@${{ steps.meta.outputs.version }}"
69
+ echo "Published swdg@${{ steps.meta.outputs.version }}"
@@ -1,42 +1,42 @@
1
- npx commitlint --edit "$1" || (
2
- echo ""
3
- echo "提交格式:"
4
- echo " <type>[scope]: <subject>"
5
- echo " type 和 subject 必填,scope 可选。"
6
- echo ""
7
- echo "详细说明:"
8
- echo "1. type(提交类型):"
9
- echo " 描述提交的目的,必须是以下之一:"
10
- echo " - feat 新功能开发"
11
- echo " - fix 问题修复"
12
- echo " - update 更新现有功能"
13
- echo " - docs 文档调整"
14
- echo " - style 代码格式调整(不影响功能)"
15
- echo " - refactor 代码重构(非功能变更)"
16
- echo " - perf 性能优化"
17
- echo " - test 添加或修改测试代码"
18
- echo " - chore 构建工具或依赖的变更"
19
- echo " - revert 回滚到上一次提交"
20
- echo " - build 构建相关的变更"
21
- echo " - ci CI/CD 配置或脚本调整"
22
- echo ""
23
- echo "2. scope(范围模块,可选):"
24
- echo " - 可选字段,表明受影响的模块,例如 auth, api, ui 等。"
25
- echo " - 如果省略,则提交格式为:<type>: <subject>"
26
- echo ""
27
- echo "3. subject(简要描述):"
28
- echo " - 用一句话清晰描述本次提交的目的。"
29
- echo " - 必须清晰、简短,不超过 72 个字符。"
30
- echo " - 支持中文描述,可以用句号(。)结尾。"
31
- echo " - subject 必须全部使用小写字母,不能使用句首大写、首字母大写、帕斯卡命名或全大写。(例如:update: gis弹窗添加基础功能, 地图定位)"
32
- echo ""
33
- echo "提交信息示例:"
34
- echo " feat(auth): 添加用户登录功能"
35
- echo " fix: 修复用户接口返回错误问题"
36
- echo " update(ui): 优化表单组件样式"
37
- echo " style: 调整代码格式,去除无用空格"
38
- echo ""
39
- echo "错误原因:提交信息不符合以上规范,请根据提示修改!"
40
- echo ""
41
- exit 1
42
- )
1
+ npx commitlint --edit "$1" || (
2
+ echo ""
3
+ echo "提交格式:"
4
+ echo " <type>[scope]: <subject>"
5
+ echo " type 和 subject 必填,scope 可选。"
6
+ echo ""
7
+ echo "详细说明:"
8
+ echo "1. type(提交类型):"
9
+ echo " 描述提交的目的,必须是以下之一:"
10
+ echo " - feat 新功能开发"
11
+ echo " - fix 问题修复"
12
+ echo " - update 更新现有功能"
13
+ echo " - docs 文档调整"
14
+ echo " - style 代码格式调整(不影响功能)"
15
+ echo " - refactor 代码重构(非功能变更)"
16
+ echo " - perf 性能优化"
17
+ echo " - test 添加或修改测试代码"
18
+ echo " - chore 构建工具或依赖的变更"
19
+ echo " - revert 回滚到上一次提交"
20
+ echo " - build 构建相关的变更"
21
+ echo " - ci CI/CD 配置或脚本调整"
22
+ echo ""
23
+ echo "2. scope(范围模块,可选):"
24
+ echo " - 可选字段,表明受影响的模块,例如 auth, api, ui 等。"
25
+ echo " - 如果省略,则提交格式为:<type>: <subject>"
26
+ echo ""
27
+ echo "3. subject(简要描述):"
28
+ echo " - 用一句话清晰描述本次提交的目的。"
29
+ echo " - 必须清晰、简短,不超过 72 个字符。"
30
+ echo " - 支持中文描述,可以用句号(。)结尾。"
31
+ echo " - subject 必须全部使用小写字母,不能使用句首大写、首字母大写、帕斯卡命名或全大写。(例如:update: gis弹窗添加基础功能, 地图定位)"
32
+ echo ""
33
+ echo "提交信息示例:"
34
+ echo " feat(auth): 添加用户登录功能"
35
+ echo " fix: 修复用户接口返回错误问题"
36
+ echo " update(ui): 优化表单组件样式"
37
+ echo " style: 调整代码格式,去除无用空格"
38
+ echo ""
39
+ echo "错误原因:提交信息不符合以上规范,请根据提示修改!"
40
+ echo ""
41
+ exit 1
42
+ )
@@ -1,2 +1,2 @@
1
- # 运行 lint-staged
2
- npx lint-staged
1
+ # 运行 lint-staged
2
+ npx lint-staged
File without changes
@@ -1,5 +1,5 @@
1
- {
2
- "*.{js,ts}": ["eslint --fix", "prettier --write"],
3
- "*.vue": ["stylelint --fix", "prettier --write"],
4
- "*.{less,css}": ["prettier --write"]
5
- }
1
+ {
2
+ "*.{js,ts}": ["eslint --fix", "prettier --write"],
3
+ "*.vue": ["stylelint --fix", "prettier --write"],
4
+ "*.{less,css}": ["prettier --write"]
5
+ }
@@ -1,26 +1,26 @@
1
- # 忽略构建输出目录
2
- dist
3
- out
4
-
5
- # 忽略依赖目录
6
- node_modules
7
-
8
- # 忽略 Vite 自动生成的文件
9
- index.html
10
-
11
- # 忽略所有 .d.ts 文件
12
- *.d.ts
13
-
14
- # 忽略环境配置文件
15
- .env
16
- .env.local
17
- .env.*.local
18
-
19
- # 忽略自动生成的组件声明文件
20
- src/components.d.ts
21
-
22
- android
23
-
24
- dev-dist
25
-
26
- public/**
1
+ # 忽略构建输出目录
2
+ dist
3
+ out
4
+
5
+ # 忽略依赖目录
6
+ node_modules
7
+
8
+ # 忽略 Vite 自动生成的文件
9
+ index.html
10
+
11
+ # 忽略所有 .d.ts 文件
12
+ *.d.ts
13
+
14
+ # 忽略环境配置文件
15
+ .env
16
+ .env.local
17
+ .env.*.local
18
+
19
+ # 忽略自动生成的组件声明文件
20
+ src/components.d.ts
21
+
22
+ android
23
+
24
+ dev-dist
25
+
26
+ public/**