create-packer 1.7.8 → 1.8.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 (242) hide show
  1. package/bin/clis/createTemp.d.ts +5 -0
  2. package/bin/clis/createTemp.js +57 -0
  3. package/bin/index.js +6 -11
  4. package/bin/utils/index.d.ts +3 -1
  5. package/bin/utils/index.js +24 -4
  6. package/package.json +16 -19
  7. package/template/{doc/docusaurus → docusaurus}/.gitignore +0 -0
  8. package/template/{doc/docusaurus → docusaurus}/.prettierignore +0 -0
  9. package/template/{desktop-app/electron/app → docusaurus}/.prettierrc.js +0 -0
  10. package/template/{doc/docusaurus → docusaurus}/README.md +0 -0
  11. package/template/{doc/docusaurus → docusaurus}/babel.config.js +0 -0
  12. package/template/{doc/docusaurus → docusaurus}/blog/2019-05-28-hola.md +0 -0
  13. package/template/{doc/docusaurus → docusaurus}/blog/2019-05-29-hello-world.md +0 -0
  14. package/template/{doc/docusaurus → docusaurus}/blog/2019-05-30-welcome.md +0 -0
  15. package/template/{doc/docusaurus → docusaurus}/docs/doc1/doc1.mdx +0 -0
  16. package/template/{doc/docusaurus → docusaurus}/docs/doc1/doc2.mdx +0 -0
  17. package/template/{doc/docusaurus → docusaurus}/docs/doc1/doc3.mdx +0 -0
  18. package/template/{doc/docusaurus → docusaurus}/docs/doc1/doc4.mdx +0 -0
  19. package/template/{doc/docusaurus → docusaurus}/docs/doc2/doc1.mdx +0 -0
  20. package/template/{doc/docusaurus → docusaurus}/docs/doc2/doc2.mdx +0 -0
  21. package/template/{doc/docusaurus → docusaurus}/docs/doc2/doc3.mdx +0 -0
  22. package/template/{doc/docusaurus → docusaurus}/docs/doc2/mdx4.mdx +0 -0
  23. package/template/{doc/docusaurus → docusaurus}/docusaurus.config.js +0 -0
  24. package/template/{doc/docusaurus → docusaurus}/package.json +19 -19
  25. package/template/{doc/docusaurus → docusaurus}/sidebars.js +0 -0
  26. package/template/{doc/docusaurus → docusaurus}/src/css/custom.css +0 -0
  27. package/template/{doc/docusaurus → docusaurus}/src/pages/index.tsx +0 -0
  28. package/template/{doc/docusaurus → docusaurus}/src/pages/styles.module.css +0 -0
  29. package/template/{doc/docusaurus → docusaurus}/static/.nojekyll +0 -0
  30. package/template/{doc/docusaurus → docusaurus}/static/img/docusaurus.png +0 -0
  31. package/template/{doc/docusaurus → docusaurus}/static/img/favicon.ico +0 -0
  32. package/template/{doc/docusaurus → docusaurus}/static/img/logo.svg +0 -0
  33. package/template/{doc/docusaurus → docusaurus}/static/img/tutorial/docsVersionDropdown.png +0 -0
  34. package/template/{doc/docusaurus → docusaurus}/static/img/tutorial/localeDropdown.png +0 -0
  35. package/template/{doc/docusaurus → docusaurus}/static/img/undraw_docusaurus_mountain.svg +0 -0
  36. package/template/{doc/docusaurus → docusaurus}/static/img/undraw_docusaurus_react.svg +0 -0
  37. package/template/{doc/docusaurus → docusaurus}/static/img/undraw_docusaurus_tree.svg +0 -0
  38. package/template/{doc/docusaurus → docusaurus}/tsconfig.json +0 -0
  39. package/template/{node/nest → nest}/.eslintrc.js +1 -0
  40. package/template/nest/.gitignore +35 -0
  41. package/template/nest/.prettierrc +4 -0
  42. package/template/{node/nest → nest}/README.md +1 -1
  43. package/template/{node/nest → nest}/nest-cli.json +1 -0
  44. package/template/nest/package.json +71 -0
  45. package/template/nest/src/app.controller.spec.ts +22 -0
  46. package/template/nest/src/app.controller.ts +12 -0
  47. package/template/nest/src/app.module.ts +10 -0
  48. package/template/nest/src/app.service.ts +8 -0
  49. package/template/nest/src/main.ts +10 -0
  50. package/template/{node/nest → nest}/src/utils/transform.interceptor.ts +0 -0
  51. package/template/nest/test/app.e2e-spec.ts +24 -0
  52. package/template/{node/nest → nest}/test/jest-e2e.json +0 -0
  53. package/template/nest/tsconfig.build.json +5 -0
  54. package/template/{node/nest → nest}/tsconfig.json +7 -1
  55. package/template/{web-app/rc-recoil → react-cra}/.env +0 -0
  56. package/template/{web-app/rc-recoil → react-cra}/.gitignore +0 -0
  57. package/template/{desktop-app/electron/app → react-cra}/.prettierignore +0 -0
  58. package/template/{doc/docusaurus → react-cra}/.prettierrc.js +0 -0
  59. package/template/{web-app/rc-recoil → react-cra}/.stylelintrc.js +0 -0
  60. package/template/{web-app/rc-recoil → react-cra}/README.md +0 -0
  61. package/template/{web-app/rc-recoil → react-cra}/craco.config.js +0 -0
  62. package/template/{web-app/rc-recoil → react-cra}/package.json +25 -27
  63. package/template/{web-app/rc-recoil → react-cra}/public/favicon.ico +0 -0
  64. package/template/{web-app/rc-recoil → react-cra}/public/index.html +0 -0
  65. package/template/{web-app/rc-recoil → react-cra}/public/manifest.json +0 -0
  66. package/template/react-cra/src/Layout/index.tsx +8 -0
  67. package/template/{web-app/rc-recoil → react-cra}/src/Layout/typings.ts +0 -0
  68. package/template/{web-app/rc-recoil → react-cra}/src/index.scss +0 -0
  69. package/template/react-cra/src/index.tsx +24 -0
  70. package/template/{web-app/rc-recoil → react-cra}/src/logo.svg +0 -0
  71. package/template/{web-app/rc-recoil → react-cra}/src/pages/home/Home.scss +0 -0
  72. package/template/react-cra/src/pages/home/index.test.tsx +9 -0
  73. package/template/{web-app/rc-recoil → react-cra}/src/pages/home/index.tsx +0 -0
  74. package/template/{web-app/rc-recoil → react-cra}/src/react-app-env.d.ts +0 -0
  75. package/template/{web-app/rc-recoil → react-cra}/src/reportWebVitals.ts +0 -0
  76. package/template/react-cra/src/routes/index.ts +15 -0
  77. package/template/{web-app/rc-recoil → react-cra}/src/setupTests.ts +0 -0
  78. package/template/{web-app/rc-recoil → react-cra}/tsconfig.json +0 -0
  79. package/bin/clis/Create.d.ts +0 -4
  80. package/bin/clis/Create.js +0 -47
  81. package/bin/clis/Project.d.ts +0 -30
  82. package/bin/clis/Project.js +0 -65
  83. package/template/desktop-app/electron/.gitignore +0 -34
  84. package/template/desktop-app/electron/app/.eslintrc +0 -28
  85. package/template/desktop-app/electron/app/.gitignore +0 -19
  86. package/template/desktop-app/electron/app/babel.config.js +0 -19
  87. package/template/desktop-app/electron/app/package.json +0 -106
  88. package/template/desktop-app/electron/app/src/configs/appConfig.ts +0 -8
  89. package/template/desktop-app/electron/app/src/lib/AppWin.ts +0 -17
  90. package/template/desktop-app/electron/app/src/lib/DefaultWin.ts +0 -40
  91. package/template/desktop-app/electron/app/src/main.ts +0 -38
  92. package/template/desktop-app/electron/app/src/utils/updateAction.ts +0 -39
  93. package/template/desktop-app/electron/app/tsconfig.json +0 -20
  94. package/template/desktop-app/electron/app/webpack.config.js +0 -49
  95. package/template/desktop-app/electron/app/yarn.lock +0 -6479
  96. package/template/desktop-app/electron/package.json +0 -20
  97. package/template/desktop-app/electron/utils/package.js +0 -40
  98. package/template/desktop-app/electron/yarn.lock +0 -42
  99. package/template/doc/docusaurus/yarn.lock +0 -9466
  100. package/template/lib/gulp/.eslintrc +0 -40
  101. package/template/lib/gulp/.gitignore +0 -31
  102. package/template/lib/gulp/.prettierignore +0 -7
  103. package/template/lib/gulp/.prettierrc.js +0 -21
  104. package/template/lib/gulp/LICENSE +0 -21
  105. package/template/lib/gulp/README.md +0 -1
  106. package/template/lib/gulp/jest.config.js +0 -8
  107. package/template/lib/gulp/package.json +0 -35
  108. package/template/lib/gulp/scripts/build.js +0 -18
  109. package/template/lib/gulp/src/index.ts +0 -3
  110. package/template/lib/gulp/test/index.test.ts +0 -3
  111. package/template/lib/gulp/tsconfig.json +0 -19
  112. package/template/lib/gulp/yarn.lock +0 -9570
  113. package/template/lib/rollup/.eslintrc +0 -40
  114. package/template/lib/rollup/.gitignore +0 -27
  115. package/template/lib/rollup/.prettierignore +0 -7
  116. package/template/lib/rollup/.prettierrc.js +0 -21
  117. package/template/lib/rollup/LICENSE +0 -21
  118. package/template/lib/rollup/README.md +0 -1
  119. package/template/lib/rollup/jest.config.js +0 -8
  120. package/template/lib/rollup/package.json +0 -35
  121. package/template/lib/rollup/scripts/build.js +0 -8
  122. package/template/lib/rollup/src/index.ts +0 -3
  123. package/template/lib/rollup/test/index.test.ts +0 -3
  124. package/template/lib/rollup/tsconfig.json +0 -21
  125. package/template/lib/rollup/yarn.lock +0 -9570
  126. package/template/node/base/.eslintrc +0 -28
  127. package/template/node/base/.gitignore +0 -15
  128. package/template/node/base/.prettierignore +0 -4
  129. package/template/node/base/.prettierrc.js +0 -20
  130. package/template/node/base/LICENSE +0 -201
  131. package/template/node/base/README.md +0 -9
  132. package/template/node/base/jest.config.js +0 -8
  133. package/template/node/base/package.json +0 -37
  134. package/template/node/base/src/server.ts +0 -0
  135. package/template/node/base/test/server.test.ts +0 -3
  136. package/template/node/base/tsconfig.json +0 -19
  137. package/template/node/base/yarn.lock +0 -4038
  138. package/template/node/nest/.gitignore +0 -15
  139. package/template/node/nest/.prettierignore +0 -4
  140. package/template/node/nest/.prettierrc.js +0 -20
  141. package/template/node/nest/package.json +0 -76
  142. package/template/node/nest/src/app.controller.spec.ts +0 -22
  143. package/template/node/nest/src/app.controller.ts +0 -12
  144. package/template/node/nest/src/app.module.ts +0 -10
  145. package/template/node/nest/src/app.service.ts +0 -8
  146. package/template/node/nest/src/main.ts +0 -10
  147. package/template/node/nest/test/app.e2e-spec.ts +0 -21
  148. package/template/node/nest/tsconfig.build.json +0 -4
  149. package/template/node/nest/yarn.lock +0 -5931
  150. package/template/web-app/rc-recoil/.prettierignore +0 -4
  151. package/template/web-app/rc-recoil/.prettierrc.js +0 -20
  152. package/template/web-app/rc-recoil/src/Layout/index.tsx +0 -12
  153. package/template/web-app/rc-recoil/src/app.store.ts +0 -8
  154. package/template/web-app/rc-recoil/src/index.tsx +0 -23
  155. package/template/web-app/rc-recoil/src/pages/home/home.store.ts +0 -6
  156. package/template/web-app/rc-recoil/src/pages/home/index.test.tsx +0 -15
  157. package/template/web-app/rc-recoil/src/routes/index.ts +0 -11
  158. package/template/web-app/rc-recoil/yarn.lock +0 -12437
  159. package/template/web-app/rc-redux/.env +0 -1
  160. package/template/web-app/rc-redux/.gitignore +0 -30
  161. package/template/web-app/rc-redux/.prettierignore +0 -4
  162. package/template/web-app/rc-redux/.prettierrc.js +0 -20
  163. package/template/web-app/rc-redux/.stylelintrc.js +0 -21
  164. package/template/web-app/rc-redux/README.md +0 -10
  165. package/template/web-app/rc-redux/craco.config.js +0 -14
  166. package/template/web-app/rc-redux/package.json +0 -72
  167. package/template/web-app/rc-redux/public/favicon.ico +0 -0
  168. package/template/web-app/rc-redux/public/index.html +0 -41
  169. package/template/web-app/rc-redux/public/manifest.json +0 -15
  170. package/template/web-app/rc-redux/src/Layout/index.tsx +0 -9
  171. package/template/web-app/rc-redux/src/index.scss +0 -5
  172. package/template/web-app/rc-redux/src/index.tsx +0 -24
  173. package/template/web-app/rc-redux/src/logo.svg +0 -7
  174. package/template/web-app/rc-redux/src/pages/home/Home.scss +0 -0
  175. package/template/web-app/rc-redux/src/pages/home/home.store.ts +0 -7
  176. package/template/web-app/rc-redux/src/pages/home/index.test.tsx +0 -17
  177. package/template/web-app/rc-redux/src/pages/home/index.tsx +0 -10
  178. package/template/web-app/rc-redux/src/react-app-env.d.ts +0 -1
  179. package/template/web-app/rc-redux/src/reportWebVitals.ts +0 -15
  180. package/template/web-app/rc-redux/src/routes/index.ts +0 -11
  181. package/template/web-app/rc-redux/src/serviceWorker.ts +0 -139
  182. package/template/web-app/rc-redux/src/setupTests.ts +0 -5
  183. package/template/web-app/rc-redux/src/store/App.store.ts +0 -9
  184. package/template/web-app/rc-redux/src/store/index.ts +0 -11
  185. package/template/web-app/rc-redux/tsconfig.json +0 -21
  186. package/template/web-app/rc-redux/yarn.lock +0 -12480
  187. package/template/web-app/vue-2.x/.browserslistrc +0 -2
  188. package/template/web-app/vue-2.x/.gitignore +0 -30
  189. package/template/web-app/vue-2.x/.prettierignore +0 -5
  190. package/template/web-app/vue-2.x/.prettierrc.js +0 -20
  191. package/template/web-app/vue-2.x/README.md +0 -29
  192. package/template/web-app/vue-2.x/babel.config.js +0 -3
  193. package/template/web-app/vue-2.x/package.json +0 -31
  194. package/template/web-app/vue-2.x/public/favicon.ico +0 -0
  195. package/template/web-app/vue-2.x/public/index.html +0 -20
  196. package/template/web-app/vue-2.x/src/App.vue +0 -5
  197. package/template/web-app/vue-2.x/src/assets/logo.png +0 -0
  198. package/template/web-app/vue-2.x/src/main.ts +0 -12
  199. package/template/web-app/vue-2.x/src/router/index.ts +0 -21
  200. package/template/web-app/vue-2.x/src/shims-tsx.d.ts +0 -13
  201. package/template/web-app/vue-2.x/src/shims-vue.d.ts +0 -4
  202. package/template/web-app/vue-2.x/src/store/app.ts +0 -19
  203. package/template/web-app/vue-2.x/src/store/index.ts +0 -27
  204. package/template/web-app/vue-2.x/src/views/Home.vue +0 -5
  205. package/template/web-app/vue-2.x/tsconfig.json +0 -22
  206. package/template/web-app/vue-2.x/tslint.json +0 -21
  207. package/template/web-app/vue-2.x/vue.config.js +0 -10
  208. package/template/web-app/vue-2.x/yarn.lock +0 -8128
  209. package/template/web-app/webpack/.editorconfig +0 -14
  210. package/template/web-app/webpack/.gitignore +0 -30
  211. package/template/web-app/webpack/.prettierignore +0 -5
  212. package/template/web-app/webpack/.prettierrc.js +0 -20
  213. package/template/web-app/webpack/.stylelintrc.js +0 -21
  214. package/template/web-app/webpack/LICENSE +0 -191
  215. package/template/web-app/webpack/README.md +0 -4
  216. package/template/web-app/webpack/babel.config.js +0 -17
  217. package/template/web-app/webpack/jest.config.js +0 -27
  218. package/template/web-app/webpack/package.json +0 -85
  219. package/template/web-app/webpack/postcss.config.js +0 -11
  220. package/template/web-app/webpack/src/Layout/index.tsx +0 -9
  221. package/template/web-app/webpack/src/Layout/typings.ts +0 -4
  222. package/template/web-app/webpack/src/global.css +0 -3
  223. package/template/web-app/webpack/src/global.d.ts +0 -8
  224. package/template/web-app/webpack/src/index.html +0 -16
  225. package/template/web-app/webpack/src/index.tsx +0 -20
  226. package/template/web-app/webpack/src/pages/Home/Home.css.json +0 -1
  227. package/template/web-app/webpack/src/pages/Home/Home.module.css +0 -3
  228. package/template/web-app/webpack/src/pages/Home/Home.store.ts +0 -12
  229. package/template/web-app/webpack/src/pages/Home/index.test.tsx +0 -17
  230. package/template/web-app/webpack/src/pages/Home/index.tsx +0 -15
  231. package/template/web-app/webpack/src/pages/Home/typings.ts +0 -1
  232. package/template/web-app/webpack/src/routes/index.ts +0 -16
  233. package/template/web-app/webpack/src/store/App.store.ts +0 -14
  234. package/template/web-app/webpack/src/store/index.ts +0 -11
  235. package/template/web-app/webpack/tsconfig.json +0 -23
  236. package/template/web-app/webpack/tslint.json +0 -21
  237. package/template/web-app/webpack/webpack.config.js +0 -15
  238. package/template/web-app/webpack/webpack_config/config.js +0 -14
  239. package/template/web-app/webpack/webpack_config/genBaseConfig.js +0 -73
  240. package/template/web-app/webpack/webpack_config/genStyleConfig.js +0 -23
  241. package/template/web-app/webpack/webpack_config/jest/fileTransform.js +0 -40
  242. package/template/web-app/webpack/yarn.lock +0 -8474
@@ -1,27 +1,24 @@
1
1
  {
2
- "name": "react_template",
2
+ "name": "react-temp",
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@craco/craco": "^6.1.2",
7
- "@testing-library/jest-dom": "^5.14.1",
8
- "@testing-library/react": "^11.2.7",
9
- "@testing-library/user-event": "^13.1.9",
10
- "@types/jest": "^26.0.23",
11
- "@types/node": "^15.12.2",
12
- "@types/react": "^17.0.11",
13
- "@types/react-dom": "^17.0.7",
14
- "@types/react-router-config": "^5.0.2",
15
- "@types/react-router-dom": "^5.1.7",
16
- "react": "^17.0.2",
17
- "react-dom": "^17.0.2",
18
- "react-router-config": "^5.1.1",
19
- "react-router-dom": "^5.2.0",
20
- "react-scripts": "^4.0.3",
21
- "recoil": "^0.3.1",
22
- "sass": "^1.34.1",
23
- "typescript": "^4.3.2",
24
- "web-vitals": "^2.0.1"
6
+ "@craco/craco": "6.4.3",
7
+ "@testing-library/jest-dom": "5.16.4",
8
+ "@testing-library/react": "13.3.0",
9
+ "@testing-library/user-event": "14.2.1",
10
+ "@types/jest": "27",
11
+ "@types/node": "18.0.0",
12
+ "@types/react": "18.0.14",
13
+ "@types/react-dom": "18.0.5",
14
+ "@types/testing-library__jest-dom": "5.14.5",
15
+ "react": "18.2.0",
16
+ "react-dom": "18.2.0",
17
+ "react-router-dom": "6.3.0",
18
+ "react-scripts": "5.0.1",
19
+ "sass": "1.53.0",
20
+ "typescript": "4.7.4",
21
+ "web-vitals": "2.1.4"
25
22
  },
26
23
  "scripts": {
27
24
  "start": "craco start",
@@ -60,12 +57,13 @@
60
57
  ]
61
58
  },
62
59
  "devDependencies": {
63
- "@types/recoil": "^0.0.9",
64
- "husky": "^4.3.8",
65
- "lint-staged": "^11.0.0",
66
- "prettier": "^2.3.1",
67
- "stylelint": "^13.13.1",
68
- "stylelint-config-standard": "^22.0.0",
69
- "webpack-bundle-analyzer": "^4.4.2"
60
+ "@testing-library/dom": "8.14.0",
61
+ "@types/recoil": "0.0.9",
62
+ "husky": "8.0.1",
63
+ "lint-staged": "13.0.3",
64
+ "prettier": "2.7.1",
65
+ "stylelint": "14.9.1",
66
+ "stylelint-config-standard": "26.0.0",
67
+ "webpack-bundle-analyzer": "4.5.0"
70
68
  }
71
69
  }
@@ -0,0 +1,8 @@
1
+ import React, { PropsWithChildren } from 'react'
2
+ import { LayoutPropsType } from './typings'
3
+
4
+ function Layout({ children }: PropsWithChildren<LayoutPropsType>) {
5
+ return <div>{children}</div>
6
+ }
7
+
8
+ export default Layout
@@ -0,0 +1,24 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import { BrowserRouter, Routes, Route } from 'react-router-dom'
4
+ import Layout from './Layout'
5
+ import routes from './routes'
6
+ import './index.scss'
7
+ import reportWebVitals from './reportWebVitals'
8
+
9
+ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
10
+ root.render(
11
+ <React.StrictMode>
12
+ <BrowserRouter>
13
+ <Layout>
14
+ <Routes>
15
+ {routes.map(({ path, Component }) => {
16
+ return <Route path={path} element={<Component />} />
17
+ })}
18
+ </Routes>
19
+ </Layout>
20
+ </BrowserRouter>
21
+ </React.StrictMode>
22
+ )
23
+
24
+ reportWebVitals()
@@ -0,0 +1,9 @@
1
+ import React from 'react'
2
+ import { render, screen } from '@testing-library/react'
3
+ import Home from './index'
4
+
5
+ test('renders learn react link', () => {
6
+ render(<Home />)
7
+ const linkElement = screen.getByText(/learn react/i)
8
+ expect(linkElement).toBeInTheDocument()
9
+ })
@@ -0,0 +1,15 @@
1
+ import type { FunctionComponent } from 'react'
2
+
3
+ export interface routeType {
4
+ path: string
5
+ Component: FunctionComponent<any>
6
+ }
7
+
8
+ const routes: routeType[] = [
9
+ {
10
+ path: '/',
11
+ Component: require('../pages/home').default
12
+ }
13
+ ]
14
+
15
+ export default routes
@@ -1,4 +0,0 @@
1
- import { Project } from './Project';
2
- export declare class Create extends Project {
3
- onCreate(dirname?: string): Promise<void>;
4
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Create = void 0;
7
- const inquirer = require("inquirer");
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const Project_1 = require("./Project");
10
- const fsExtra = require("fs-extra");
11
- const path = require("path");
12
- const fs = require("fs");
13
- const chalk = require("chalk");
14
- const ora = require("ora");
15
- class Create extends Project_1.Project {
16
- async onCreate(dirname) {
17
- const { tempType } = await inquirer.prompt([
18
- {
19
- type: 'list',
20
- name: 'tempType',
21
- message: 'Select tempType.',
22
- choices: this.tempInfo.map(o => o.name)
23
- }
24
- ]);
25
- const { temp } = await inquirer.prompt([
26
- {
27
- type: 'list',
28
- name: 'temp',
29
- message: 'Select temp.',
30
- choices: lodash_1.default.map(lodash_1.default.find(this.tempInfo, { name: tempType }).temp, t => t.name)
31
- }
32
- ]);
33
- const creating = ora(chalk.yellow('Creating...\n')).start();
34
- const output = path.join(this.cwd, dirname);
35
- if (dirname && fs.existsSync(output)) {
36
- return console.log(chalk.red(`${dirname} already exists!`));
37
- }
38
- if (dirname) {
39
- fsExtra.mkdirSync(output);
40
- }
41
- const tempPath = path.join(this.tempRoot, tempType, temp);
42
- this.onCopy(tempPath, output);
43
- this.onEnd(output);
44
- creating.succeed();
45
- }
46
- }
47
- exports.Create = Create;
@@ -1,30 +0,0 @@
1
- /// <reference types="node" />
2
- import { SpawnOptions } from 'child_process';
3
- export interface projectInfoType {
4
- name: string;
5
- dirname: string;
6
- tempInfo: tempInfoItemType;
7
- src: string;
8
- output: string;
9
- copyFiles: string[];
10
- }
11
- export interface tempInfoItemType {
12
- name: string;
13
- temp: Array<{
14
- name: string;
15
- }>;
16
- }
17
- export declare class Project {
18
- cwd: string;
19
- command: string;
20
- excludes: string[];
21
- tempRoot: string;
22
- tempInfo: Array<tempInfoItemType>;
23
- projectsInfo: Array<projectInfoType>;
24
- constructor();
25
- spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnOptions): void;
26
- getCliFilePath(p?: string): string;
27
- onGetFiles: (src: string, excludes: string[]) => string[];
28
- onCopy(tempPath: any, output: any): void;
29
- onEnd(output: string): void;
30
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Project = void 0;
7
- const path = require("path");
8
- const fs = require("fs");
9
- const fsExtra = require("fs-extra");
10
- const child_process_1 = require("child_process");
11
- const lodash_1 = __importDefault(require("lodash"));
12
- const utils_1 = require("../utils");
13
- class Project {
14
- cwd;
15
- command;
16
- excludes;
17
- tempRoot;
18
- tempInfo;
19
- projectsInfo;
20
- constructor() {
21
- this.cwd = process.cwd();
22
- this.command = utils_1.onGenCommand();
23
- this.excludes = ['node_modules', 'yarn-error.log', 'dist'];
24
- this.tempRoot = path.join(__dirname, '../../template');
25
- this.tempInfo = utils_1.onGetDir(this.tempRoot).map(name => {
26
- return {
27
- name,
28
- temp: utils_1.onGetDir(path.join(this.tempRoot, name)).map(name => {
29
- return { name };
30
- })
31
- };
32
- });
33
- }
34
- spawnSync(command, args, options) {
35
- const { error } = child_process_1.spawnSync(command, args, {
36
- stdio: 'inherit',
37
- cwd: this.cwd,
38
- shell: true,
39
- ...options
40
- });
41
- if (error) {
42
- process.exit(1);
43
- }
44
- }
45
- getCliFilePath(p = '.') {
46
- return path.join(__dirname, '../../', p);
47
- }
48
- onGetFiles = function (src, excludes) {
49
- return fs.readdirSync(src).filter(dir => !lodash_1.default.includes(excludes, dir));
50
- };
51
- onCopy(tempPath, output) {
52
- fsExtra.readdirSync(tempPath).map(name => {
53
- if (name !== 'node_modules') {
54
- fsExtra.copySync(path.join(tempPath, name), path.join(output, name));
55
- }
56
- });
57
- }
58
- onEnd(output) {
59
- child_process_1.spawnSync(this.command, ['install'], {
60
- cwd: output,
61
- stdio: 'inherit'
62
- });
63
- }
64
- }
65
- exports.Project = Project;
@@ -1,34 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
-
3
- # dependencies
4
- node_modules/
5
- /.pnp
6
- .pnp.js
7
-
8
- # testing
9
- coverage/
10
-
11
- # production
12
- build/
13
- dist/
14
- .vscode
15
- .idea
16
- .history
17
- lib/
18
- es/
19
- types/
20
-
21
- # misc
22
- .DS_Store
23
- .env.local
24
- .env.development.local
25
- .env.test.local
26
- .env.production.local
27
-
28
- npm-debug.log*
29
- yarn-debug.log*
30
- yarn-error.log*
31
-
32
-
33
-
34
- main.js
@@ -1,28 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "extends": ["plugin:@typescript-eslint/recommended"],
4
- "parserOptions": {
5
- "ecmaVersion": 2018,
6
- "sourceType": "module",
7
- "ecmaFeatures": {
8
- "jsx": true
9
- },
10
- "useJSXTextNode": true
11
- },
12
- "rules": {
13
- "@typescript-eslint/no-var-requires": 0,
14
- "@typescript-eslint/explicit-function-return-type": "off",
15
- "@typescript-eslint/no-explicit-any": 1,
16
- "@typescript-eslint/no-inferrable-types": [
17
- "warn",
18
- {
19
- "ignoreParameters": true
20
- }
21
- ],
22
- "@typescript-eslint/no-unused-vars": "warn",
23
- "@typescript-eslint/member-delimiter-style": 0,
24
- "@typescript-eslint/class-name-casing": 0,
25
- "semi": ["error", "never"],
26
- "quotes": ["error", "single"]
27
- }
28
- }
@@ -1,19 +0,0 @@
1
- # dependencies
2
- node_modules/
3
- npm-debug.log*
4
- yarn-error.log*
5
-
6
- # production
7
- dist/
8
- build/
9
- view/
10
-
11
- # miscs
12
- .DS_Store
13
- .vscode/
14
- .idea/
15
- .history/
16
- coverage/
17
-
18
-
19
- main.js
@@ -1,19 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- '@babel/typescript',
4
- [
5
- '@babel/env',
6
- {
7
- targets: {
8
- chrome: '79',
9
- },
10
- },
11
- ],
12
- ],
13
- plugins: [
14
- 'lodash',
15
- '@babel/plugin-transform-typescript',
16
- '@babel/proposal-class-properties',
17
- '@babel/proposal-object-rest-spread',
18
- ],
19
- }
@@ -1,106 +0,0 @@
1
- {
2
- "name": "electron-template",
3
- "version": "1.0.0",
4
- "main": "main.js",
5
- "author": "1k",
6
- "license": "MIT",
7
- "private": false,
8
- "repository": "https://github.com/electron/electron-quick-start",
9
- "keywords": [
10
- "Electron",
11
- "typescript",
12
- "quick",
13
- "start",
14
- "tutorial",
15
- "demo"
16
- ],
17
- "scripts": {
18
- "build": "rimraf ./main.js && webpack --env prod",
19
- "build-dev": "rimraf ./main.js && webpack --env dev",
20
- "start": "yarn build-dev && electron ./",
21
- "pre-package": "rimraf ./dist && yarn build",
22
- "package-win": "yarn pre-package && electron-builder --win --x64 --ia32",
23
- "package-win32": "yarn pre-package && electron-builder --win --ia32",
24
- "package-win64": "yarn pre-package && electron-builder --win --x64",
25
- "package-linux": "yarn pre-package && electron-builder --linux",
26
- "package-mac": "yarn pre-package && electron-builder --mac",
27
- "package": "yarn pre-package && electron-builder --win --ia32 --x64 --mac",
28
- "format": "prettier --write \"src/**/*.{ts,js}\" \"./package.json\""
29
- },
30
- "husky": {
31
- "hooks": {
32
- "pre-commit": "npm run format && lint-staged && git add ."
33
- }
34
- },
35
- "lint-staged": {
36
- "./src/**/*.{ts,js}": [
37
- "eslint"
38
- ]
39
- },
40
- "build": {
41
- "appId": "com.electron.app",
42
- "productName": "electron-template",
43
- "artifactName": "${productName}-beta-${version}.${ext}",
44
- "publish": [
45
- {
46
- "provider": "generic",
47
- "url": ""
48
- }
49
- ],
50
- "files": [
51
- "main.js",
52
- "view/",
53
- "package.json",
54
- "node_modules/"
55
- ],
56
- "mac": {
57
- "target": [
58
- "dmg"
59
- ]
60
- },
61
- "win": {
62
- "target": [
63
- "nsis"
64
- ]
65
- },
66
- "linux": {
67
- "target": [
68
- "AppImage"
69
- ],
70
- "category": "Development"
71
- }
72
- },
73
- "devDependencies": {
74
- "@babel/cli": "^7.14.5",
75
- "@babel/core": "^7.14.5",
76
- "@babel/plugin-proposal-class-properties": "^7.14.5",
77
- "@babel/plugin-proposal-object-rest-spread": "^7.14.5",
78
- "@babel/preset-env": "^7.14.5",
79
- "@babel/preset-typescript": "^7.14.5",
80
- "@types/electron-builder": "^2.8.0",
81
- "@types/lodash": "^4.14.170",
82
- "@types/node": "^15.12.2",
83
- "@typescript-eslint/eslint-plugin": "^4.26.1",
84
- "@typescript-eslint/parser": "^4.26.1",
85
- "babel-loader": "^8.2.2",
86
- "babel-plugin-lodash": "^3.3.4",
87
- "cross-env": "^7.0.3",
88
- "electron": "13.1.1",
89
- "electron-builder": "^22.11.7",
90
- "electron-log": "^4.3.5",
91
- "electron-updater": "^4.3.9",
92
- "eslint": "^7.28.0",
93
- "husky": "^4.3.8",
94
- "lint-staged": "^11.0.0",
95
- "prettier": "^2.3.1",
96
- "rollup": "^2.51.2",
97
- "ts-loader": "^9.2.3",
98
- "typescript": "4.3.2",
99
- "webpack": "^4.46.0",
100
- "webpack-cli": "^3.3.12",
101
- "webpackbar": "^4.0.0"
102
- },
103
- "dependencies": {
104
- "lodash": "^4.17.21"
105
- }
106
- }
@@ -1,8 +0,0 @@
1
- let baseHost = './view/index.html'
2
- if (process.env.NODE_ENV === 'development') {
3
- baseHost = 'http://localhost:8080'
4
- }
5
-
6
- export default {
7
- baseHost
8
- }
@@ -1,17 +0,0 @@
1
- import DefaultWin from './DefaultWin'
2
-
3
- class App extends DefaultWin {
4
- public async open() {
5
- this.create({ width: 1366, height: 728 })
6
- this.root.on('closed', () => {
7
- this.root = null
8
- })
9
- await this.loadPage()
10
- this.root.show()
11
- }
12
- public close() {
13
- this.root.close()
14
- }
15
- }
16
-
17
- export default App
@@ -1,40 +0,0 @@
1
- import { BrowserWindow } from 'electron'
2
- import appConfig from '../configs/appConfig'
3
- import _ from 'lodash'
4
-
5
- class DefaultWin {
6
- root: Electron.BrowserWindow
7
- config: Electron.BrowserWindowConstructorOptions
8
- constructor() {
9
- this.root = null
10
- this.config = {
11
- show: true,
12
- center: true,
13
- frame: false,
14
- resizable: false,
15
- hasShadow: true,
16
- transparent: true,
17
- webPreferences: {
18
- devTools: process.env.NODE_ENV === 'development',
19
- // devTools: true,
20
- webviewTag: true,
21
- nodeIntegration: true
22
- }
23
- }
24
- }
25
- create(config: Electron.BrowserWindowConstructorOptions) {
26
- this.config = _.merge(this.config, config)
27
- this.root = new BrowserWindow(this.config)
28
- }
29
- async loadPage(route: string = '') {
30
- if (process.env.NODE_ENV === 'development') {
31
- await this.root.loadURL(appConfig.baseHost + `#${route}`)
32
- } else {
33
- await this.root.loadFile(appConfig.baseHost, {
34
- hash: route
35
- })
36
- }
37
- }
38
- }
39
-
40
- export default DefaultWin
@@ -1,38 +0,0 @@
1
- import { app, ipcMain, session } from 'electron'
2
- import log from 'electron-log'
3
- import AppWin from './lib/AppWin'
4
-
5
- const appWin: AppWin = new AppWin()
6
- // ipcMain
7
- // ------------------yarn start------------------------------------------------------
8
- ipcMain.on('quit-app', function () {
9
- app.quit()
10
- app.exit()
11
- })
12
- // appListen
13
- // ----------------------------------------------------------------------
14
- app.on('window-all-closed', async () => {
15
- await session.defaultSession.clearCache()
16
- app.quit()
17
- app.exit()
18
- })
19
-
20
- if (process.env.NODE_ENV === 'development') {
21
- app.on('web-contents-created', function (e, webContents) {
22
- webContents.openDevTools({
23
- mode: 'detach'
24
- })
25
- })
26
- }
27
- app.once('ready', () => {
28
- appWin.open()
29
- })
30
- app.on('gpu-process-crashed', (e, killed) => {
31
- if (killed) {
32
- log.error('程序被杀')
33
- } else {
34
- log.error('程序崩溃')
35
- }
36
- app.quit()
37
- app.exit()
38
- })
@@ -1,39 +0,0 @@
1
- import { autoUpdater } from 'electron-updater'
2
- const log = require('electron-log')
3
-
4
- export interface updaterInfoType {
5
- message: string
6
- status: 'error' | 'checking' | 'notAvailable' | 'startDownload' | 'download' | 'downloaded'
7
- percent?: string | number
8
- }
9
-
10
- export default {
11
- listenUpdater(onChange: (info: updaterInfoType) => void) {
12
- autoUpdater.on('checking-for-update', () => {
13
- onChange({ message: '正在检查更新...', status: 'checking' })
14
- })
15
- autoUpdater.on('error', () => {
16
- onChange({ message: '检查更新出错', status: 'error' })
17
- })
18
- autoUpdater.on('update-not-available', () => {
19
- onChange({ message: '未检查到新版本!', status: 'notAvailable' })
20
- })
21
- autoUpdater.on('update-available', () => {
22
- onChange({ message: '检查到新版本,正在下载...', status: 'startDownload' })
23
- })
24
- autoUpdater.on('download-progress', (progress: any) => {
25
- onChange({
26
- message: '下载进度',
27
- status: 'download',
28
- percent: progress.percent,
29
- })
30
- })
31
- autoUpdater.on('update-downloaded', () => {
32
- onChange({ message: '下载完成', status: 'downloaded' })
33
- })
34
- // 记录失败日志到本地
35
- // ----------------------------------------------------------------------
36
- log.transports.file.level = 'error'
37
- autoUpdater.logger = log
38
- },
39
- }