@flarum/cli 1.0.0 → 2.0.0-beta.12

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 (193) hide show
  1. package/README.md +2 -2
  2. package/bin/run +5 -3
  3. package/boilerplate/skeleton/extension/.gitattributes +17 -3
  4. package/boilerplate/skeleton/extension/.github/workflows/backend.yml +15 -0
  5. package/boilerplate/skeleton/extension/.github/workflows/frontend.yml +20 -0
  6. package/boilerplate/skeleton/extension/.styleci.yml +14 -0
  7. package/boilerplate/skeleton/extension/LICENSE.md +1 -0
  8. package/boilerplate/skeleton/extension/README.md +7 -7
  9. package/boilerplate/skeleton/extension/composer.json +11 -9
  10. package/boilerplate/skeleton/extension/extend.php +10 -10
  11. package/boilerplate/skeleton/extension/gitignore +12 -0
  12. package/boilerplate/skeleton/extension/js/.bundlewatch.config.json +8 -0
  13. package/boilerplate/skeleton/extension/js/admin.js +2 -1
  14. package/boilerplate/skeleton/extension/js/admin.ts +2 -0
  15. package/boilerplate/skeleton/extension/js/forum.js +2 -1
  16. package/boilerplate/skeleton/extension/js/forum.ts +2 -0
  17. package/boilerplate/skeleton/extension/js/gitignore +9 -0
  18. package/boilerplate/skeleton/extension/js/package.json +13 -9
  19. package/boilerplate/skeleton/extension/js/src/admin/index.js +4 -2
  20. package/boilerplate/skeleton/extension/js/src/admin/index.ts +5 -0
  21. package/boilerplate/skeleton/extension/js/src/common/index.js +5 -0
  22. package/boilerplate/skeleton/extension/js/src/common/index.ts +5 -0
  23. package/boilerplate/skeleton/extension/js/src/forum/index.js +4 -2
  24. package/boilerplate/skeleton/extension/js/src/forum/index.ts +5 -0
  25. package/boilerplate/skeleton/extension/js/tsconfig.json +6 -1
  26. package/boilerplate/skeleton/extension/locale/en.yml +1 -1
  27. package/boilerplate/stubs/migration.php +1 -1
  28. package/lib/base-command.d.ts +29 -6
  29. package/lib/base-command.js +145 -59
  30. package/lib/boilersmith/exposed-param-manager.d.ts +8 -0
  31. package/lib/boilersmith/exposed-param-manager.js +31 -0
  32. package/lib/boilersmith/io.d.ts +54 -0
  33. package/lib/boilersmith/io.js +97 -0
  34. package/lib/boilersmith/paths.d.ts +22 -0
  35. package/lib/boilersmith/paths.js +29 -0
  36. package/lib/boilersmith/scaffolding/audit-step-factory.d.ts +5 -0
  37. package/lib/boilersmith/scaffolding/audit-step-factory.js +61 -0
  38. package/lib/boilersmith/scaffolding/infra-step-factory.d.ts +5 -0
  39. package/lib/boilersmith/scaffolding/infra-step-factory.js +34 -0
  40. package/lib/boilersmith/scaffolding/init-step-factory.d.ts +5 -0
  41. package/lib/boilersmith/scaffolding/init-step-factory.js +34 -0
  42. package/lib/boilersmith/scaffolding/module.d.ts +82 -0
  43. package/lib/boilersmith/scaffolding/module.js +116 -0
  44. package/lib/boilersmith/scaffolding/scaffolder.d.ts +32 -0
  45. package/lib/boilersmith/scaffolding/scaffolder.js +203 -0
  46. package/lib/boilersmith/scaffolding/template-param.d.ts +23 -0
  47. package/lib/boilersmith/scaffolding/template-param.js +46 -0
  48. package/lib/boilersmith/step-manager.d.ts +85 -0
  49. package/lib/boilersmith/step-manager.js +234 -0
  50. package/lib/boilersmith/steps/stub-base.d.ts +53 -0
  51. package/lib/boilersmith/steps/stub-base.js +54 -0
  52. package/lib/{utils → boilersmith/utils}/clone-and-fill.d.ts +0 -0
  53. package/lib/{utils → boilersmith/utils}/clone-and-fill.js +2 -2
  54. package/lib/boilersmith/utils/cond-format.d.ts +1 -0
  55. package/lib/boilersmith/utils/cond-format.js +8 -0
  56. package/lib/boilersmith/utils/json-leaf-paths.d.ts +7 -0
  57. package/lib/boilersmith/utils/json-leaf-paths.js +17 -0
  58. package/lib/boilersmith/utils/read-tpl.d.ts +2 -0
  59. package/lib/boilersmith/utils/read-tpl.js +10 -0
  60. package/lib/boilersmith/utils/rename-keys.d.ts +1 -0
  61. package/lib/boilersmith/utils/rename-keys.js +7 -0
  62. package/lib/commands/audit/infra.d.ts +16 -0
  63. package/lib/commands/audit/infra.js +27 -0
  64. package/lib/commands/infra.d.ts +20 -0
  65. package/lib/commands/infra.js +55 -0
  66. package/lib/commands/init.d.ts +4 -3
  67. package/lib/commands/init.js +8 -6
  68. package/lib/commands/make/backend/api-controller.d.ts +4 -3
  69. package/lib/commands/make/backend/api-controller.js +3 -2
  70. package/lib/commands/make/backend/api-serializer-attributes.d.ts +4 -3
  71. package/lib/commands/make/backend/api-serializer-attributes.js +1 -1
  72. package/lib/commands/make/backend/api-serializer.d.ts +4 -3
  73. package/lib/commands/make/backend/api-serializer.js +3 -2
  74. package/lib/commands/make/backend/command.d.ts +4 -3
  75. package/lib/commands/make/backend/command.js +3 -2
  76. package/lib/commands/make/backend/event-listener.d.ts +4 -3
  77. package/lib/commands/make/backend/event-listener.js +3 -2
  78. package/lib/commands/make/backend/handler.d.ts +4 -3
  79. package/lib/commands/make/backend/handler.js +4 -3
  80. package/lib/commands/make/backend/integration-test.d.ts +4 -3
  81. package/lib/commands/make/backend/integration-test.js +3 -2
  82. package/lib/commands/make/backend/job.d.ts +4 -3
  83. package/lib/commands/make/backend/job.js +3 -2
  84. package/lib/commands/make/backend/migration.d.ts +4 -3
  85. package/lib/commands/make/backend/migration.js +3 -2
  86. package/lib/commands/make/backend/model.d.ts +4 -3
  87. package/lib/commands/make/backend/model.js +22 -21
  88. package/lib/commands/make/backend/policy.d.ts +4 -3
  89. package/lib/commands/make/backend/policy.js +3 -2
  90. package/lib/commands/make/backend/repository.d.ts +4 -3
  91. package/lib/commands/make/backend/repository.js +3 -2
  92. package/lib/commands/make/backend/route.d.ts +4 -3
  93. package/lib/commands/make/backend/route.js +1 -1
  94. package/lib/commands/make/backend/service-provider.d.ts +4 -3
  95. package/lib/commands/make/backend/service-provider.js +3 -2
  96. package/lib/commands/make/backend/validator.d.ts +4 -3
  97. package/lib/commands/make/backend/validator.js +3 -2
  98. package/lib/commands/make/frontend/component.d.ts +4 -3
  99. package/lib/commands/make/frontend/component.js +3 -2
  100. package/lib/commands/make/frontend/modal.d.ts +4 -3
  101. package/lib/commands/make/frontend/modal.js +3 -2
  102. package/lib/commands/make/frontend/model.d.ts +4 -3
  103. package/lib/commands/make/frontend/model.js +3 -2
  104. package/lib/commands/update/js-imports.d.ts +4 -3
  105. package/lib/commands/update/js-imports.js +1 -1
  106. package/lib/help.d.ts +5 -6
  107. package/lib/help.js +5 -4
  108. package/lib/index.d.ts +1 -1
  109. package/lib/index.js +3 -2
  110. package/lib/providers/index.d.ts +5 -0
  111. package/lib/providers/index.js +2 -0
  112. package/lib/{provider → providers}/php-provider.d.ts +0 -0
  113. package/lib/{provider → providers}/php-provider.js +2 -2
  114. package/lib/steps/extenders/api-serializer.js +2 -3
  115. package/lib/steps/extenders/base.d.ts +10 -10
  116. package/lib/steps/extenders/base.js +11 -11
  117. package/lib/steps/extenders/console-command.js +2 -3
  118. package/lib/steps/extenders/event.js +2 -3
  119. package/lib/steps/extenders/policy.js +2 -3
  120. package/lib/steps/extenders/route.js +2 -3
  121. package/lib/steps/extenders/service-provider.js +2 -3
  122. package/lib/steps/gen-ext-scaffolder.d.ts +6 -0
  123. package/lib/steps/gen-ext-scaffolder.js +594 -0
  124. package/lib/steps/js/base.d.ts +9 -9
  125. package/lib/steps/js/base.js +13 -12
  126. package/lib/steps/js/model.d.ts +5 -5
  127. package/lib/steps/js/model.js +8 -13
  128. package/lib/steps/misc/composer.d.ts +5 -6
  129. package/lib/steps/misc/composer.js +3 -3
  130. package/lib/steps/misc/git.d.ts +11 -0
  131. package/lib/steps/misc/git.js +20 -0
  132. package/lib/steps/misc/yarn.d.ts +5 -6
  133. package/lib/steps/misc/yarn.js +3 -3
  134. package/lib/steps/stubs/backend/api-controller.d.ts +1 -8
  135. package/lib/steps/stubs/backend/api-controller.js +2 -3
  136. package/lib/steps/stubs/backend/api-serializer.d.ts +4 -9
  137. package/lib/steps/stubs/backend/api-serializer.js +4 -4
  138. package/lib/steps/stubs/backend/command.d.ts +0 -5
  139. package/lib/steps/stubs/backend/command.js +1 -1
  140. package/lib/steps/stubs/backend/event-listener.d.ts +0 -5
  141. package/lib/steps/stubs/backend/event-listener.js +1 -1
  142. package/lib/steps/stubs/backend/handler-command.js +1 -1
  143. package/lib/steps/stubs/backend/handler.js +1 -1
  144. package/lib/steps/stubs/backend/migration.d.ts +4 -5
  145. package/lib/steps/stubs/backend/migration.js +8 -8
  146. package/lib/steps/stubs/backend/model.d.ts +4 -4
  147. package/lib/steps/stubs/backend/model.js +4 -4
  148. package/lib/steps/stubs/backend/policy.d.ts +0 -5
  149. package/lib/steps/stubs/backend/policy.js +1 -1
  150. package/lib/steps/stubs/backend/repository.d.ts +0 -5
  151. package/lib/steps/stubs/backend/repository.js +1 -1
  152. package/lib/steps/stubs/flarum-base.d.ts +9 -0
  153. package/lib/steps/stubs/flarum-base.js +10 -0
  154. package/lib/steps/stubs/frontend/component.js +0 -1
  155. package/lib/steps/stubs/frontend/modal.js +0 -1
  156. package/lib/steps/stubs/frontend/model.d.ts +4 -4
  157. package/lib/steps/stubs/frontend/model.js +3 -3
  158. package/lib/steps/stubs/js-base.d.ts +6 -7
  159. package/lib/steps/stubs/js-base.js +11 -16
  160. package/lib/steps/stubs/php-base.d.ts +7 -8
  161. package/lib/steps/stubs/php-base.js +12 -20
  162. package/lib/steps/update/js-imports.d.ts +5 -6
  163. package/lib/steps/update/js-imports.js +16 -19
  164. package/lib/utils/composer.d.ts +64 -0
  165. package/lib/utils/composer.js +8 -0
  166. package/lib/utils/migration.js +3 -3
  167. package/lib/utils/model-name.js +6 -6
  168. package/lib/utils/validation.d.ts +10 -7
  169. package/lib/utils/validation.js +9 -6
  170. package/oclif.manifest.json +1 -1
  171. package/package.json +55 -36
  172. package/php-subsystem/src/NodeVisitors/AddExtender.php +2 -1
  173. package/boilerplate/skeleton/extension/.github/workflows/build.yml +0 -32
  174. package/boilerplate/skeleton/extension/.github/workflows/lint.yml +0 -32
  175. package/boilerplate/skeleton/extension/.github/workflows/test.yml +0 -78
  176. package/lib/commands/infra/backend-testing.d.ts +0 -14
  177. package/lib/commands/infra/backend-testing.js +0 -26
  178. package/lib/provider/param-provider.d.ts +0 -15
  179. package/lib/provider/param-provider.js +0 -39
  180. package/lib/provider/path-provider.d.ts +0 -19
  181. package/lib/provider/path-provider.js +0 -24
  182. package/lib/steps/infra/backend-testing.d.ts +0 -8
  183. package/lib/steps/infra/backend-testing.js +0 -22
  184. package/lib/steps/infra/base.d.ts +0 -20
  185. package/lib/steps/infra/base.js +0 -36
  186. package/lib/steps/init/extension-skeleton.d.ts +0 -12
  187. package/lib/steps/init/extension-skeleton.js +0 -142
  188. package/lib/steps/step-manager.d.ts +0 -71
  189. package/lib/steps/step-manager.js +0 -173
  190. package/lib/steps/stubs/base.d.ts +0 -49
  191. package/lib/steps/stubs/base.js +0 -58
  192. package/lib/utils/extension-metadata.d.ts +0 -2
  193. package/lib/utils/extension-metadata.js +0 -21
package/README.md CHANGED
@@ -37,7 +37,7 @@ $ npm install -g @flarum/cli
37
37
  $ flarum-cli COMMAND
38
38
  running command...
39
39
  $ flarum-cli (-v|--version|version)
40
- @flarum/cli/1.0.0 linux-x64 node-v14.17.2
40
+ @flarum/cli/2.0.0-beta.12 linux-x64 node-v16.13.0
41
41
  $ flarum-cli --help [COMMAND]
42
42
  USAGE
43
43
  $ flarum-cli COMMAND
@@ -192,7 +192,7 @@ For example:
192
192
  },
193
193
  ]);
194
194
  })
195
- .run(stubPathProviderFactory(), paramProviderFactory, stubPhpProviderFactory());
195
+ .run(new Paths({...}), new PromptsIO(), {php: new PhpProvider(...)});
196
196
  ```
197
197
 
198
198
 
package/bin/run CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('@oclif/command').run()
4
- .then(require('@oclif/command/flush'))
5
- .catch(require('@oclif/errors/handle'))
3
+ require('module-alias').addAlias('boilersmith', `${__dirname}/../lib/boilersmith`);
4
+
5
+ const oclif = require('@oclif/core');
6
+
7
+ oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));
@@ -1,4 +1,18 @@
1
- js/src export-ignore
2
- .git* export-ignore
1
+ .gitattributes export-ignore
2
+ .gitignore export-ignore
3
+ .gitmodules export-ignore
4
+ .github export-ignore
5
+ .travis export-ignore
6
+ .travis.yml export-ignore
7
+ .editorconfig export-ignore
8
+ .styleci.yml export-ignore
3
9
 
4
- js/dist/*.js -diff
10
+ phpunit.xml export-ignore
11
+ tests export-ignore
12
+
13
+ js/dist/* -diff
14
+ js/dist/* linguist-generated
15
+ js/dist-typings/* linguist-generated
16
+ js/yarn.lock -diff
17
+
18
+ * text=auto eol=lf
@@ -0,0 +1,15 @@
1
+ name: <%= params.extensionName %> PHP
2
+
3
+ on: [workflow_dispatch, push, pull_request]
4
+
5
+ # The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
6
+ # This will break your current script.
7
+ # When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
8
+
9
+ jobs:
10
+ run:
11
+ uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
12
+ with:
13
+ enable_backend_testing: <%= modules.backendTesting %>
14
+
15
+ backend_directory: <%= params.backendDirectory %>
@@ -0,0 +1,20 @@
1
+ name: <%= params.extensionName %> JS
2
+
3
+ on: [workflow_dispatch, push, pull_request]
4
+
5
+ # The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
6
+ # This will break your current script.
7
+ # When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
8
+
9
+ jobs:
10
+ run:
11
+ uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
12
+ with:
13
+ enable_bundlewatch: <%= modules.bundlewatch %>
14
+ enable_prettier: <%= modules.prettier %>
15
+ enable_typescript: <%= modules.typescript %>
16
+
17
+ frontend_directory: <%= params.frontendDirectory %>
18
+ main_git_branch: <%= params.mainGitBranch %>
19
+ secrets:
20
+ bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
@@ -0,0 +1,14 @@
1
+ preset: recommended
2
+
3
+ enabled:
4
+ - logical_not_operators_with_successor_space
5
+
6
+ disabled:
7
+ - align_double_arrow
8
+ - blank_line_after_opening_tag
9
+ - multiline_array_trailing_comma
10
+ - new_with_braces
11
+ - phpdoc_align
12
+ - phpdoc_order
13
+ - phpdoc_separation
14
+ - phpdoc_types
@@ -0,0 +1 @@
1
+ <%= params.licenseText %>
@@ -1,27 +1,27 @@
1
- # <%= extensionName %>
1
+ # <%= params.extensionName %>
2
2
 
3
- ![License](https://img.shields.io/badge/license-<%= licenseType %>-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/<%= packageName %>.svg)](https://packagist.org/packages/<%= packageName %>) [![Total Downloads](https://img.shields.io/packagist/dt/<%= packageName %>.svg)](https://packagist.org/packages/<%= packageName %>)
3
+ ![License](https://img.shields.io/badge/license-<%= params.licenseType %>-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/<%= params.packageName %>.svg)](https://packagist.org/packages/<%= params.packageName %>) [![Total Downloads](https://img.shields.io/packagist/dt/<%= params.packageName %>.svg)](https://packagist.org/packages/<%= params.packageName %>)
4
4
 
5
- A [Flarum](http://flarum.org) extension. <%= packageDescription %>
5
+ A [Flarum](http://flarum.org) extension. <%= params.packageDescription %>
6
6
 
7
7
  ## Installation
8
8
 
9
9
  Install with composer:
10
10
 
11
11
  ```sh
12
- composer require <%= packageName %>:"*"
12
+ composer require <%= params.packageName %>:"*"
13
13
  ```
14
14
 
15
15
  ## Updating
16
16
 
17
17
  ```sh
18
- composer update <%= packageName %>:"*"
18
+ composer update <%= params.packageName %>:"*"
19
19
  php flarum migrate
20
20
  php flarum cache:clear
21
21
  ```
22
22
 
23
23
  ## Links
24
24
 
25
- - [Packagist](https://packagist.org/packages/<%= packageName %>)
26
- - [GitHub](https://github.com/<%= packageName %>)
25
+ - [Packagist](https://packagist.org/packages/<%= params.packageName %>)
26
+ - [GitHub](https://github.com/<%= params.packageName %>)
27
27
  - [Discuss](https://discuss.flarum.org/d/PUT_DISCUSS_SLUG_HERE)
@@ -1,37 +1,39 @@
1
1
  {
2
- "name": "<%= packageName %>",<% if (packageDescription) { %>
3
- "description": "<%= packageDescription %>",<% } %>
2
+ "name": "<%= params.packageName %>",<% if (params.packageDescription) { %>
3
+ "description": "<%= params.packageDescription %>",<% } %>
4
4
  "keywords": [
5
5
  "flarum"
6
6
  ],
7
7
  "type": "flarum-extension",
8
- "license": "<%= licenseType %>",
8
+ "license": "<%= params.licenseType %>",
9
9
  "require": {
10
10
  "flarum/core": "^1.0.0"
11
11
  },
12
12
  "require-dev": {
13
13
  "flarum/testing": "^1.0.0"
14
14
  },
15
- "authors": [<% if (authorName && authorEmail) { %>
15
+ "authors": [<% if (params.authorName) { %>
16
16
  {
17
- "name": "<%= authorName %>",<% if (authorEmail) { %>
18
- "email": "<%= authorEmail %>",<% } %>
17
+ "name": "<%= params.authorName %>",<% if (params.authorEmail) { %>
18
+ "email": "<%= params.authorEmail %>",<% } %>
19
19
  "role": "Developer"
20
20
  }
21
21
  <% } %>],
22
+ <% if (params.packageNamespace) { %>
22
23
  "autoload": {
23
24
  "psr-4": {
24
- "<%= packageNamespace %>\\": "src/"
25
+ "<%= params.packageNamespaceEscapedSlash %>\\": "src/"
25
26
  }
26
27
  },
28
+ <% } %>
27
29
  "autoload-dev": {
28
30
  "psr-4": {
29
- "<%= packageNamespace %>\\Tests\\": "tests/"
31
+ "<%= params.packageNamespaceEscapedSlash %>\\Tests\\": "tests/"
30
32
  }
31
33
  },
32
34
  "extra": {
33
35
  "flarum-extension": {
34
- "title": "<%= extensionName %>",
36
+ "title": "<%= params.extensionName %>",
35
37
  "category": "",
36
38
  "icon": {
37
39
  "name": "",
@@ -1,24 +1,24 @@
1
1
  <?php
2
2
 
3
3
  /*
4
- * This file is part of <%= packageName %>.
4
+ * This file is part of <%= params.packageName %>.
5
5
  *
6
- * Copyright (c) <%= year %> <%= authorName %>.
6
+ * Copyright (c) <%= params.year %> <%= params.authorName %>.
7
7
  *
8
8
  * For the full copyright and license information, please view the LICENSE.md
9
9
  * file that was distributed with this source code.
10
10
  */
11
11
 
12
- namespace <%= namespace %>;
12
+ namespace <%= params.packageNamespace %>;
13
13
 
14
14
  use Flarum\Extend;
15
15
 
16
16
  return [
17
- <% if (forum) { %>(new Extend\Frontend('forum'))
18
- <% if (useJs) { %>->js(__DIR__.'/js/dist/forum.js')<% if (!useCss) { %>,<% } %><% } %>
19
- <% if (useCss) { %>->css(__DIR__.'/less/forum.less'),<% } %><% } %>
20
- <% if (admin) { %>(new Extend\Frontend('admin'))
21
- <% if (useJs) { %>->js(__DIR__.'/js/dist/admin.js')<% if (!useCss) { %>,<% } %><% } %>
22
- <% if (useCss) { %>->css(__DIR__.'/less/admin.less'),<% } %><% } %>
23
- <% if (useLocale) { %>new Extend\Locales(__DIR__.'/locale'),<% } %>
17
+ <% if (modules.forum) { %>(new Extend\Frontend('forum'))
18
+ <% if (modules.js) { %>->js(__DIR__.'/js/dist/forum.js')<% if (!modules.css) { %>,<% } %><% } %>
19
+ <% if (modules.css) { %>->css(__DIR__.'/less/forum.less'),<% } %><% } %>
20
+ <% if (modules.admin) { %>(new Extend\Frontend('admin'))
21
+ <% if (modules.js) { %>->js(__DIR__.'/js/dist/admin.js')<% if (!modules.css) { %>,<% } %><% } %>
22
+ <% if (modules.css) { %>->css(__DIR__.'/less/admin.less'),<% } %><% } %>
23
+ <% if (modules.locale) { %>new Extend\Locales(__DIR__.'/locale'),<% } %>
24
24
  ];
@@ -0,0 +1,12 @@
1
+ /vendor
2
+ composer.lock
3
+ composer.phar
4
+
5
+ .DS_Store
6
+ Thumbs.db
7
+ tests/.phpunit.result.cache
8
+ /tests/integration/tmp
9
+ .vagrant
10
+ .idea/*
11
+ .vscode
12
+ js/coverage-ts
@@ -0,0 +1,8 @@
1
+ {
2
+ "files": [
3
+ {
4
+ "path": "./dist/*.js"
5
+ }
6
+ ],
7
+ "defaultCompression": "gzip"
8
+ }
@@ -1 +1,2 @@
1
- export * from './src/admin';
1
+ <% if (modules.jsCommon) { %>export * from './src/common';
2
+ <% } %>export * from './src/admin';
@@ -0,0 +1,2 @@
1
+ <% if (modules.jsCommon) { %>export * from './src/common';
2
+ <% } %>export * from './src/admin';
@@ -1 +1,2 @@
1
- export * from './src/forum';
1
+ <% if (modules.jsCommon) { %>export * from './src/common';
2
+ <% } %>export * from './src/forum';
@@ -0,0 +1,2 @@
1
+ <% if (modules.jsCommon) { %>export * from './src/common';
2
+ <% } %>export * from './src/forum';
@@ -0,0 +1,9 @@
1
+ .pnp.*
2
+ .yarn/*
3
+ !.yarn/patches
4
+ !.yarn/plugins
5
+ !.yarn/releases
6
+ !.yarn/sdks
7
+ !.yarn/versions
8
+
9
+ node_modules
@@ -1,22 +1,26 @@
1
1
  {
2
- "name": "@<%= packageName %>",
3
- "version": "0.0.0",
2
+ "name": "@<%= params.packageName %>",
4
3
  "private": true,
5
4
  "prettier": "@flarum/prettier-config",
6
5
  "dependencies": {
7
- "flarum-webpack-config": "^1.0.0",
8
- "flarum-tsconfig": "^1.0.0",
9
- "@flarum/prettier-config": "^1.0.0",
10
- "webpack": "^4.26.0",
11
- "webpack-cli": "^3.0.7"
12
6
  },
13
7
  "devDependencies": {
14
- "prettier": "^2.3.0"
8
+ "@flarum/prettier-config": "^1.0.0",
9
+ "flarum-tsconfig": "^1.0.2",
10
+ "flarum-webpack-config": "^2.0.0",
11
+ "prettier": "^2.5.1",
12
+ "typescript": "^4.5.4",
13
+ "typescript-coverage-report": "^0.6.1",
14
+ "webpack": "^5.65.0",
15
+ "webpack-cli": "^4.9.1"
15
16
  },
16
17
  "scripts": {
17
18
  "dev": "webpack --mode development --watch",
18
19
  "build": "webpack --mode production",
20
+ "analyze": "cross-env ANALYZER=true yarn build",
19
21
  "format": "prettier --write src",
20
- "format-check": "prettier --check src"
22
+ "format-check": "prettier --check src",
23
+ "check-typings": "tsc --noEmit --emitDeclarationOnly false",
24
+ "check-typings-coverage": "typescript-coverage-report"
21
25
  }
22
26
  }
@@ -1,3 +1,5 @@
1
- app.initializers.add('<%= packageName %>', () => {
2
- console.log('[<%= packageName %>] Hello, admin!');
1
+ import app from 'flarum/admin/app';
2
+
3
+ app.initializers.add('<%= params.packageName %>', () => {
4
+ console.log('[<%= params.packageName %>] Hello, admin!');
3
5
  });
@@ -0,0 +1,5 @@
1
+ import app from 'flarum/admin/app';
2
+
3
+ app.initializers.add('<%= params.packageName %>', () => {
4
+ console.log('[<%= params.packageName %>] Hello, admin!');
5
+ });
@@ -0,0 +1,5 @@
1
+ import app from 'flarum/common/app';
2
+
3
+ app.initializers.add('<%= params.packageName %>', () => {
4
+ console.log('[<%= params.packageName %>] Hello, forum and admin!');
5
+ });
@@ -0,0 +1,5 @@
1
+ import app from 'flarum/common/app';
2
+
3
+ app.initializers.add('<%= params.packageName %>', () => {
4
+ console.log('[<%= params.packageName %>] Hello, forum and admin!');
5
+ });
@@ -1,3 +1,5 @@
1
- app.initializers.add('<%= packageName %>', () => {
2
- console.log('[<%= packageName %>] Hello, forum!');
1
+ import app from 'flarum/forum/app';
2
+
3
+ app.initializers.add('<%= params.packageName %>', () => {
4
+ console.log('[<%= params.packageName %>] Hello, forum!');
3
5
  });
@@ -0,0 +1,5 @@
1
+ import app from 'flarum/forum/app';
2
+
3
+ app.initializers.add('<%= params.packageName %>', () => {
4
+ console.log('[<%= params.packageName %>] Hello, forum!');
5
+ });
@@ -1,7 +1,12 @@
1
1
  {
2
+ // Use Flarum's tsconfig as a starting point
2
3
  "extends": "flarum-tsconfig",
3
- "include": ["src/**/*"],
4
+ // This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
5
+ // and also tells your Typescript server to read core's global typings for
6
+ // access to `dayjs` and `$` in the global namespace.
7
+ "include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*", "@types/**/*"],
4
8
  "compilerOptions": {
9
+ // This will output typings to `dist-typings`
5
10
  "declarationDir": "./dist-typings",
6
11
  "baseUrl": ".",
7
12
  "paths": {
@@ -1,4 +1,4 @@
1
- <%= extensionId %>:
1
+ <%= params.extensionId %>:
2
2
  # For more details on the format
3
3
  # Checkout https://docs.flarum.org/extend/i18n.html#appendix-a-standard-key-format
4
4
  admin:
@@ -5,7 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
5
5
  use Illuminate\Database\Schema\Builder;
6
6
 
7
7
  // HINT: you might want to use a `Flarum\Database\Migration` helper method for simplicity!
8
- // See https://docs.flarum.org/extend/data.html#migrations to learn more about migrations.
8
+ // See https://docs.flarum.org/extend/models.html#migrations to learn more about migrations.
9
9
  return [
10
10
  'up' => function (Builder $schema) {
11
11
  // up migration
@@ -1,7 +1,19 @@
1
- import { Command, flags } from '@oclif/command';
2
- import { StepManager } from './steps/step-manager';
1
+ import { Command, Interfaces } from '@oclif/core';
2
+ import { IO } from 'boilersmith/io';
3
+ import { StepManager } from 'boilersmith/step-manager';
4
+ import { FlarumProviders } from './providers';
5
+ export declare enum LocationType {
6
+ FLARUM_EXTENSION = 0,
7
+ FLARUM_CORE = 1,
8
+ FLARUM_MONOREPO = 2
9
+ }
3
10
  export default abstract class BaseCommand extends Command {
4
- static flags: flags.Input<any>;
11
+ protected STUB_PATH: string;
12
+ protected dry: boolean;
13
+ protected locationType?: LocationType;
14
+ protected args: Record<string, any>;
15
+ protected flags: any;
16
+ static flags: Interfaces.FlagInput<any>;
5
17
  static args: {
6
18
  name: string;
7
19
  description: string;
@@ -11,8 +23,19 @@ export default abstract class BaseCommand extends Command {
11
23
  protected welcomeMessage(): string;
12
24
  protected goodbyeMessage(): string;
13
25
  protected additionalPreRunChecks(_extRoot: string): Promise<void>;
14
- protected abstract steps(stepManager: StepManager): StepManager;
15
- protected getFlarumExtensionRoot(currDir: string): Promise<string>;
26
+ protected abstract steps(stepManager: StepManager<FlarumProviders>): StepManager<FlarumProviders>;
27
+ protected genIO(): IO;
28
+ protected monorepoPaths(options: {
29
+ includeCore: boolean;
30
+ includeExtensions: boolean;
31
+ includePhpPackages: boolean;
32
+ includeJSPackages: boolean;
33
+ }): string[];
34
+ protected isFlarumCore(path: string): boolean;
35
+ protected getFlarumExtensionRoot(currDir: string): Promise<{
36
+ path: string;
37
+ type: LocationType;
38
+ }>;
16
39
  protected confirmExtDir(extRoot: string): Promise<void>;
17
40
  protected ensureComposerInstallRan(extRoot: string): Promise<void>;
18
41
  /**
@@ -20,6 +43,6 @@ export default abstract class BaseCommand extends Command {
20
43
  * If true, files should be overriden.
21
44
  * If user says no, will exit and not return anything.
22
45
  */
23
- protected confirmOverrideFiles(dir: string, pattern: string, confirmationMessage: string): Promise<boolean>;
46
+ protected confirmOverrideFiles(dir: string, pattern: string | string[], confirmationMessage: string): Promise<boolean>;
24
47
  protected deleteFiles(dir: string, pattern: string): Promise<void>;
25
48
  }