generator-folklore 3.0.3 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/app/index.js +3 -51
- package/lib/generators/babel/index.js +28 -101
- package/lib/generators/babel/templates/config.js +16 -0
- package/lib/generators/browserslist/index.js +4 -9
- package/lib/generators/build/index.js +40 -29
- package/lib/generators/cli/index.js +92 -0
- package/lib/generators/cli/templates/cli.js +22 -0
- package/lib/generators/cli/templates/commands/default.js +16 -0
- package/lib/generators/docs/index.js +1 -2
- package/lib/generators/editorconfig/index.js +12 -22
- package/lib/generators/eslint/index.js +12 -13
- package/lib/generators/{html → html-project}/index.js +60 -73
- package/lib/generators/{html → html-project}/templates/folklore.png +0 -0
- package/lib/generators/{html → html-project}/templates/gitignore +0 -0
- package/lib/generators/{html → html-project}/templates/index.html.ejs +4 -1
- package/lib/generators/intl/index.js +93 -0
- package/lib/generators/laravel/index.js +5 -5
- package/lib/generators/laravel-mediatheque/index.js +133 -0
- package/lib/generators/laravel-mediatheque/templates/app/Models/Media.php +9 -0
- package/lib/generators/laravel-mediatheque/templates/app/Models/MediaFile.php +9 -0
- package/lib/generators/laravel-panneau/index.js +49 -28
- package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +19 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Page.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Pages/Home.php +9 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +37 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlocksCollection.php +8 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +47 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/PagesCollection.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Models/Block.php +3 -13
- package/lib/generators/laravel-panneau/templates/app/Models/Page.php +3 -60
- package/lib/generators/laravel-panneau/templates/app/Panneau/Composers/AppComposer.php +50 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +22 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +87 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +51 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +34 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +18 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/AccountController.php +41 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/Controller.php +19 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/HomeController.php +16 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/PagesController.php +24 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UploadController.php +27 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UsersController.php +32 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/AccountUpdateRequest.php +29 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/UploadRequest.php +29 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php +39 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +8 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php +56 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PagesCollection.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UserResource.php +24 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +48 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Policies/PanneauPolicy.php +32 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +110 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +27 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +42 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +28 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +92 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +57 -0
- package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +42 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +14 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Page.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Pages/HomePage.php +10 -0
- package/lib/generators/laravel-panneau/templates/app.blade.php +8 -0
- package/lib/generators/laravel-panneau/templates/index.js +32 -0
- package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +62 -0
- package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +62 -0
- package/lib/generators/laravel-panneau/templates/layout.blade.php +17 -48
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +68 -0
- package/lib/generators/{js/templates/src/lib/.gitkeep → laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlug.jsx} +0 -0
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlugLocalized.jsx +43 -0
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/index.js +2 -0
- package/lib/generators/laravel-panneau/templates/resources/assets/styles/panneau.scss +2 -0
- package/lib/generators/laravel-panneau/templates/routes.php +30 -0
- package/lib/generators/laravel-project/index.js +504 -0
- package/lib/generators/laravel-project/templates/env +41 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/AppComposer.php +48 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/IntlComposer.php +10 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/MetaComposer.php +48 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/RoutesComposer.php +19 -0
- package/lib/generators/laravel-project/templates/laravel/app/Contracts/Resources/User.php +10 -0
- package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php +18 -0
- package/lib/generators/laravel-project/templates/laravel/app/Http/Middleware/TrustProxies.php +28 -0
- package/lib/generators/laravel-project/templates/laravel/app/Http/Resources/UserResource.php +21 -0
- package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +50 -0
- package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +45 -0
- package/lib/generators/laravel-project/templates/laravel/app/Providers/RouteServiceProvider.php +64 -0
- package/lib/generators/laravel-project/templates/laravel/app/Providers/ViewServiceProvider.php +33 -0
- package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +36 -0
- package/lib/generators/laravel-project/templates/laravel/app/Resources/User.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/config/app.php +216 -0
- package/lib/generators/laravel-project/templates/laravel/config/auth.php +116 -0
- package/lib/generators/laravel-project/templates/laravel/config/services.php +39 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/content.php +5 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/errors.php +17 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/meta.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/routes.php +4 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/auth.php +19 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/content.php +5 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/errors.php +17 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/meta.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/pagination.php +19 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/passwords.php +22 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/routes.php +12 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/validation.php +146 -0
- package/lib/generators/{js/templates/styles → laravel-project/templates/laravel/resources/assets/fonts}/.gitkeep +0 -0
- package/lib/generators/{laravel-panneau/templates/app/Schemas/Fields → laravel-project/templates/laravel/resources/assets/img}/.gitkeep +0 -0
- package/lib/generators/laravel-project/templates/laravel/resources/assets/img/folklore.png +0 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/body.blade.php +3 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/gpt.blade.php +16 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/head.blade.php +1 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/app.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/401.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/403.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/404.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/500.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/layout.blade.php +33 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/all.blade.php +4 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/base.blade.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/facebook.blade.php +4 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/opengraph.blade.php +9 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/twitter.blade.php +5 -0
- package/lib/generators/laravel-project/templates/laravel/routes/web.php +12 -0
- package/lib/generators/lerna-package/index.js +1 -3
- package/lib/generators/lerna-repository/index.js +1 -3
- package/lib/generators/node-project/index.js +164 -0
- package/lib/generators/node-project/templates/index.js +0 -0
- package/lib/generators/npm-package/index.js +3 -5
- package/lib/generators/prettier/index.js +19 -6
- package/lib/generators/prettier/templates/prettierrc.json +3 -1
- package/lib/generators/{js → react-app}/index.js +22 -52
- package/lib/generators/{js → react-app}/templates/_package.json +0 -0
- package/lib/generators/react-app/templates/index.js +23 -0
- package/lib/generators/react-app/templates/src/components/App.jsx +46 -0
- package/lib/generators/react-app/templates/src/components/Container.jsx +40 -0
- package/lib/generators/{js → react-app}/templates/src/components/buttons/Button.jsx +4 -18
- package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +27 -0
- package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +62 -0
- package/lib/generators/{js → react-app}/templates/src/components/pages/Error.jsx +10 -14
- package/lib/generators/react-app/templates/src/components/pages/Home.jsx +32 -0
- package/lib/generators/{js → react-app}/templates/src/components/partials/PageMeta.jsx +11 -11
- package/lib/generators/{js → react-app}/templates/src/contexts/KeysContext.jsx +0 -0
- package/lib/generators/react-app/templates/src/lib/.gitkeep +0 -0
- package/lib/generators/{js → react-app}/templates/src/lib/PropTypes.js +0 -0
- package/lib/generators/{js → react-app}/templates/src/lib/utils.js +0 -0
- package/lib/generators/react-app/templates/src/polyfills/index.js +6 -0
- package/lib/generators/react-app/templates/src/polyfills/intl-en.js +2 -0
- package/lib/generators/react-app/templates/src/polyfills/intl-fr.js +2 -0
- package/lib/generators/react-app/templates/src/polyfills/should.js +14 -0
- package/lib/generators/react-app/templates/styles/.gitkeep +0 -0
- package/lib/generators/{js/templates/styles/buttons/button.scss → react-app/templates/styles/buttons/button.module.scss} +1 -0
- package/lib/generators/{js/templates/styles/layouts/main.scss → react-app/templates/styles/layouts/main.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/menus/menu.scss → react-app/templates/styles/menus/menu.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/pages/error.scss → react-app/templates/styles/pages/error.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/pages/home.scss → react-app/templates/styles/pages/home.module.scss} +0 -0
- package/lib/generators/rollup/index.js +54 -0
- package/lib/generators/rollup/templates/config.js +50 -0
- package/lib/generators/scss/index.js +3 -16
- package/lib/generators/scss/templates/{main.scss → styles.scss} +0 -0
- package/lib/generators/server/index.js +81 -0
- package/lib/generators/server/templates/server.js +59 -0
- package/lib/generators/storybook/index.js +1 -7
- package/lib/generators/stylelint/index.js +13 -14
- package/lib/lib/generator.js +9 -0
- package/lib/lib/utils.js +17 -0
- package/package.json +2 -2
- package/lib/generators/babel/templates/babel-preset-react.js +0 -7
- package/lib/generators/babel/templates/babel-preset.js +0 -57
- package/lib/generators/babel/templates/babelrc +0 -5
- package/lib/generators/babel/templates/utils/processScss.js +0 -10
- package/lib/generators/babel/templates/utils/transformRequireIgnore.js +0 -80
- package/lib/generators/html/templates/index.js +0 -9
- package/lib/generators/html/templates/root.js +0 -23
- package/lib/generators/html/templates/utils.js +0 -7
- package/lib/generators/js/templates/browserslistrc +0 -9
- package/lib/generators/js/templates/config.js +0 -33
- package/lib/generators/js/templates/index.js +0 -41
- package/lib/generators/js/templates/src/actions/LayoutActions.js +0 -12
- package/lib/generators/js/templates/src/actions/SiteActions.js +0 -22
- package/lib/generators/js/templates/src/components/App.jsx +0 -52
- package/lib/generators/js/templates/src/components/Root.jsx +0 -70
- package/lib/generators/js/templates/src/components/layouts/Main.jsx +0 -52
- package/lib/generators/js/templates/src/components/menus/Menu.jsx +0 -60
- package/lib/generators/js/templates/src/components/messages/Success.jsx +0 -36
- package/lib/generators/js/templates/src/components/pages/Home.jsx +0 -32
- package/lib/generators/js/templates/src/components/partials/Label.jsx +0 -32
- package/lib/generators/js/templates/src/reducers/LayoutReducer.js +0 -32
- package/lib/generators/js/templates/src/reducers/SiteReducer.js +0 -36
- package/lib/generators/js/templates/src/reducers/index.js +0 -7
- package/lib/generators/js/templates/src/vendor/polyfills/intl-en.js +0 -2
- package/lib/generators/js/templates/src/vendor/polyfills/intl-fr.js +0 -2
- package/lib/generators/laravel-panneau/templates/_composer.json +0 -6
- package/lib/generators/laravel-panneau/templates/_package.json +0 -11
- package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/HomeController.php +0 -14
- package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/PagesController.php +0 -11
- package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/File.php +0 -13
- package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Picture.php +0 -13
- package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Video.php +0 -34
- package/lib/generators/laravel-panneau/templates/app/Providers/PanneauServiceProvider.php +0 -23
- package/lib/generators/laravel-panneau/templates/app/Reducers/SlugExtractReducer.php +0 -18
- package/lib/generators/laravel-panneau/templates/app/Resources/Pages.php +0 -54
- package/lib/generators/laravel-panneau/templates/app/Schemas/Blocks/Base.php +0 -22
- package/lib/generators/laravel-panneau/templates/app/Schemas/Bubbles/Base.php +0 -22
- package/lib/generators/laravel-panneau/templates/app/Schemas/Pages/Base.php +0 -36
- package/lib/generators/laravel-panneau/templates/resources/lang/en/panneau.php +0 -12
- package/lib/generators/laravel-panneau/templates/resources/lang/fr/panneau.php +0 -12
@@ -0,0 +1,504 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
+
|
5
|
+
var _glob = _interopRequireDefault(require("glob"));
|
6
|
+
|
7
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
8
|
+
|
9
|
+
var _passwordGenerator = _interopRequireDefault(require("password-generator"));
|
10
|
+
|
11
|
+
var _path = _interopRequireDefault(require("path"));
|
12
|
+
|
13
|
+
var _yeomanRemote = _interopRequireDefault(require("yeoman-remote"));
|
14
|
+
|
15
|
+
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
16
|
+
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
|
+
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
20
|
+
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
22
|
+
|
23
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
24
|
+
|
25
|
+
module.exports = class LaravelProjectGenerator extends _generator.default {
|
26
|
+
static safeDbString(str) {
|
27
|
+
return str.replace(/[-s.]+/gi, '_').replace(/[^a-z0-9]+/gi, '');
|
28
|
+
}
|
29
|
+
|
30
|
+
static getPassword() {
|
31
|
+
return (0, _passwordGenerator.default)(20, false);
|
32
|
+
}
|
33
|
+
|
34
|
+
constructor(...args) {
|
35
|
+
super(...args);
|
36
|
+
this.argument('project-name', {
|
37
|
+
type: String,
|
38
|
+
required: false
|
39
|
+
});
|
40
|
+
this.argument('project-host', {
|
41
|
+
type: String,
|
42
|
+
required: false
|
43
|
+
});
|
44
|
+
this.option('laravel-version', {
|
45
|
+
type: String,
|
46
|
+
desc: 'Laravel version',
|
47
|
+
defaults: '9'
|
48
|
+
});
|
49
|
+
this.option('laravel-branch', {
|
50
|
+
type: String,
|
51
|
+
desc: 'Laravel repository branch'
|
52
|
+
});
|
53
|
+
this.option('url', {
|
54
|
+
type: String,
|
55
|
+
desc: 'Project url',
|
56
|
+
defaults: 'https://<%= project_host %>'
|
57
|
+
});
|
58
|
+
this.option('local-url', {
|
59
|
+
type: String,
|
60
|
+
desc: 'Project local url',
|
61
|
+
defaults: 'https://<%= project_host %>.test:8080'
|
62
|
+
});
|
63
|
+
this.option('proxy-url', {
|
64
|
+
type: String,
|
65
|
+
desc: 'Project proxy url',
|
66
|
+
defaults: 'https://<%= project_host %>.test'
|
67
|
+
});
|
68
|
+
this.option('assets-path', {
|
69
|
+
type: String,
|
70
|
+
desc: 'Path for assets',
|
71
|
+
defaults: 'resources/assets'
|
72
|
+
});
|
73
|
+
this.option('public-path', {
|
74
|
+
type: String,
|
75
|
+
desc: 'Path for build',
|
76
|
+
defaults: 'public'
|
77
|
+
});
|
78
|
+
this.option('js-path', {
|
79
|
+
type: String,
|
80
|
+
desc: 'Path for the javascript',
|
81
|
+
defaults: 'js'
|
82
|
+
});
|
83
|
+
this.option('styles-path', {
|
84
|
+
type: String,
|
85
|
+
desc: 'Path for the styles',
|
86
|
+
defaults: 'styles'
|
87
|
+
});
|
88
|
+
this.option('db-host', {
|
89
|
+
type: String,
|
90
|
+
desc: 'Database host',
|
91
|
+
defaults: 'localhost'
|
92
|
+
});
|
93
|
+
this.option('db-username', {
|
94
|
+
type: String,
|
95
|
+
desc: 'Database username',
|
96
|
+
defaults: 'homestead'
|
97
|
+
});
|
98
|
+
this.option('db-password', {
|
99
|
+
type: String,
|
100
|
+
desc: 'Database password',
|
101
|
+
defaults: 'secret'
|
102
|
+
});
|
103
|
+
this.option('db-name', {
|
104
|
+
type: String,
|
105
|
+
desc: 'Database name'
|
106
|
+
});
|
107
|
+
this.option('panneau', {
|
108
|
+
type: Boolean,
|
109
|
+
desc: 'Add panneau',
|
110
|
+
defaults: false
|
111
|
+
});
|
112
|
+
this.option('mediatheque', {
|
113
|
+
type: Boolean,
|
114
|
+
desc: 'Add mediatheque',
|
115
|
+
defaults: false
|
116
|
+
});
|
117
|
+
this.option('auth', {
|
118
|
+
type: Boolean,
|
119
|
+
desc: 'Add auth',
|
120
|
+
defaults: false
|
121
|
+
});
|
122
|
+
}
|
123
|
+
|
124
|
+
get prompting() {
|
125
|
+
return {
|
126
|
+
welcome() {
|
127
|
+
if (this.options.quiet) {
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
|
131
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
132
|
+
console.log('Laravel Generator');
|
133
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
134
|
+
},
|
135
|
+
|
136
|
+
prompts() {
|
137
|
+
const prompts = [];
|
138
|
+
|
139
|
+
if (!this.options['project-name']) {
|
140
|
+
prompts.push(_generator.default.prompts.project_name);
|
141
|
+
}
|
142
|
+
|
143
|
+
if (!this.options['project-host']) {
|
144
|
+
prompts.push({
|
145
|
+
type: 'input',
|
146
|
+
name: 'project-host',
|
147
|
+
message: 'What is the host of the project?',
|
148
|
+
default: answers => {
|
149
|
+
const projectName = this.options['project-name'] || answers['project-name'];
|
150
|
+
return projectName.match(/.[^.]+$/) ? projectName : `${projectName}.com`;
|
151
|
+
}
|
152
|
+
});
|
153
|
+
}
|
154
|
+
|
155
|
+
if (!this.options['db-name']) {
|
156
|
+
prompts.push({
|
157
|
+
type: 'input',
|
158
|
+
name: 'db-name',
|
159
|
+
message: 'What is the name of the database?',
|
160
|
+
default: answers => {
|
161
|
+
const projectName = this.options['project-name'] || answers['project-name'];
|
162
|
+
return projectName.match(/^([^.]+)/)[1];
|
163
|
+
}
|
164
|
+
});
|
165
|
+
}
|
166
|
+
|
167
|
+
const featuresChoices = [!this.options.mediatheque && {
|
168
|
+
name: 'Mediatheque',
|
169
|
+
value: 'mediatheque',
|
170
|
+
checked: true
|
171
|
+
}, !this.options.panneau && {
|
172
|
+
name: 'Panneau',
|
173
|
+
value: 'panneau',
|
174
|
+
checked: false
|
175
|
+
}, !this.options.auth && {
|
176
|
+
name: 'Auth',
|
177
|
+
value: 'auth',
|
178
|
+
checked: false
|
179
|
+
}].filter(Boolean);
|
180
|
+
|
181
|
+
if (featuresChoices.length) {
|
182
|
+
prompts.push({
|
183
|
+
type: 'checkbox',
|
184
|
+
name: 'features',
|
185
|
+
choices: featuresChoices,
|
186
|
+
message: 'Which features?',
|
187
|
+
default: featuresChoices.filter(it => it.checked || false).map(it => it.name)
|
188
|
+
});
|
189
|
+
}
|
190
|
+
|
191
|
+
if (!prompts.length) {
|
192
|
+
return null;
|
193
|
+
}
|
194
|
+
|
195
|
+
return this.prompt(prompts).then(answers => {
|
196
|
+
if (answers['project-name']) {
|
197
|
+
this.options['project-name'] = answers['project-name'];
|
198
|
+
}
|
199
|
+
|
200
|
+
if (answers['project-host']) {
|
201
|
+
this.options['project-host'] = answers['project-host'];
|
202
|
+
}
|
203
|
+
|
204
|
+
if (answers['db-name']) {
|
205
|
+
this.options['db-name'] = answers['db-name'];
|
206
|
+
}
|
207
|
+
|
208
|
+
const features = answers.features || [];
|
209
|
+
|
210
|
+
if (features.indexOf('panneau') !== -1) {
|
211
|
+
this.options.panneau = true;
|
212
|
+
}
|
213
|
+
|
214
|
+
if (features.indexOf('auth') !== -1) {
|
215
|
+
this.options.auth = true;
|
216
|
+
}
|
217
|
+
|
218
|
+
if (features.indexOf('mediatheque') !== -1) {
|
219
|
+
this.options.mediatheque = true;
|
220
|
+
}
|
221
|
+
});
|
222
|
+
}
|
223
|
+
|
224
|
+
};
|
225
|
+
}
|
226
|
+
|
227
|
+
configuring() {
|
228
|
+
const assetsPath = _lodash.default.get(this.options, 'assets-path', '').replace(/\/$/, '');
|
229
|
+
|
230
|
+
const publicPath = _lodash.default.get(this.options, 'public-path');
|
231
|
+
|
232
|
+
const jsPath = _lodash.default.get(this.options, 'js-path');
|
233
|
+
|
234
|
+
const jsSrcPath = _path.default.join(assetsPath, jsPath);
|
235
|
+
|
236
|
+
const stylesPath = _lodash.default.get(this.options, 'styles-path');
|
237
|
+
|
238
|
+
const stylesSrcPath = _path.default.join(assetsPath, stylesPath);
|
239
|
+
|
240
|
+
this.composeWith('folklore:prettier', {
|
241
|
+
'skip-install': true,
|
242
|
+
quiet: true
|
243
|
+
});
|
244
|
+
this.composeWith('folklore:eslint', {
|
245
|
+
'skip-install': true,
|
246
|
+
quiet: true
|
247
|
+
});
|
248
|
+
this.composeWith('folklore:stylelint', {
|
249
|
+
'skip-install': true,
|
250
|
+
quiet: true
|
251
|
+
});
|
252
|
+
this.composeWith('folklore:browserslist', {
|
253
|
+
'skip-install': true,
|
254
|
+
quiet: true
|
255
|
+
});
|
256
|
+
this.composeWith('folklore:editorconfig', {
|
257
|
+
quiet: true,
|
258
|
+
'skip-install': true
|
259
|
+
});
|
260
|
+
this.composeWith('folklore:react-app', {
|
261
|
+
'project-name': this.options['project-name'],
|
262
|
+
path: jsSrcPath,
|
263
|
+
'styles-path': stylesSrcPath,
|
264
|
+
quiet: true,
|
265
|
+
'skip-install': true
|
266
|
+
});
|
267
|
+
this.composeWith('folklore:scss', {
|
268
|
+
'project-name': this.options['project-name'],
|
269
|
+
path: stylesSrcPath,
|
270
|
+
react: true,
|
271
|
+
quiet: true,
|
272
|
+
'skip-install': true
|
273
|
+
});
|
274
|
+
this.composeWith('folklore:build', {
|
275
|
+
'src-path': assetsPath,
|
276
|
+
'entry-path': _path.default.join(jsSrcPath, 'index.js'),
|
277
|
+
'build-path': publicPath,
|
278
|
+
quiet: true,
|
279
|
+
'skip-install': true
|
280
|
+
});
|
281
|
+
this.composeWith('folklore:intl', {
|
282
|
+
'translations-path': _path.default.join(jsSrcPath, '**/*.{js,jsx}'),
|
283
|
+
'output-path': './lang',
|
284
|
+
'without-id-only': true,
|
285
|
+
quiet: true,
|
286
|
+
'skip-install': true
|
287
|
+
});
|
288
|
+
|
289
|
+
if (this.options.mediatheque) {
|
290
|
+
this.composeWith('folklore:laravel-mediatheque', {
|
291
|
+
'project-name': this.options['project-name'],
|
292
|
+
'skip-install': true
|
293
|
+
});
|
294
|
+
} // if (this.options.panneau) {
|
295
|
+
// this.composeWith('folklore:laravel-panneau', {
|
296
|
+
// 'project-name': this.options['project-name'],
|
297
|
+
// 'js-path': jsSrcPath,
|
298
|
+
// 'styles-path': stylesSrcPath,
|
299
|
+
// 'skip-install': skipInstall,
|
300
|
+
// 'install-npm': true,
|
301
|
+
// quiet: true,
|
302
|
+
// });
|
303
|
+
// }
|
304
|
+
// if (this.options.auth) {
|
305
|
+
// this.composeWith('folklore:laravel-auth', {
|
306
|
+
// 'project-name': this.options['project-name'],
|
307
|
+
// 'js-path': jsSrcPath,
|
308
|
+
// 'styles-path': stylesSrcPath,
|
309
|
+
// 'skip-install': skipInstall,
|
310
|
+
// 'install-npm': true,
|
311
|
+
// quiet: true,
|
312
|
+
// });
|
313
|
+
// }
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
get writing() {
|
318
|
+
return {
|
319
|
+
laravel() {
|
320
|
+
const done = this.async();
|
321
|
+
const {
|
322
|
+
'laravel-version': laravelVersion = null,
|
323
|
+
'laravel-branch': laravelBranch = null
|
324
|
+
} = this.options;
|
325
|
+
const versionBranch = laravelVersion !== 'latest' && laravelVersion !== null ? `${laravelVersion.indexOf('.') !== -1 ? laravelVersion : `${laravelVersion}.x`}` : null;
|
326
|
+
const branch = laravelBranch || versionBranch;
|
327
|
+
|
328
|
+
const remoteCallback = (err, cachePath) => {
|
329
|
+
const destinationPath = this.destinationPath();
|
330
|
+
|
331
|
+
const files = _glob.default.sync('**', {
|
332
|
+
dot: true,
|
333
|
+
nodir: true,
|
334
|
+
cwd: cachePath
|
335
|
+
});
|
336
|
+
|
337
|
+
let source;
|
338
|
+
let destination;
|
339
|
+
files.forEach(file => {
|
340
|
+
source = _path.default.join(cachePath, file);
|
341
|
+
destination = _path.default.join(destinationPath, file);
|
342
|
+
|
343
|
+
if (!this.fs.exists(destination)) {
|
344
|
+
this.fs.copy(source, destination);
|
345
|
+
}
|
346
|
+
});
|
347
|
+
done();
|
348
|
+
};
|
349
|
+
|
350
|
+
if (branch !== null) {
|
351
|
+
(0, _yeomanRemote.default)('laravel', 'laravel', branch, remoteCallback);
|
352
|
+
} else {
|
353
|
+
(0, _yeomanRemote.default)('laravel', 'laravel', remoteCallback);
|
354
|
+
}
|
355
|
+
},
|
356
|
+
|
357
|
+
removeFiles() {
|
358
|
+
const files = ['package.json', 'config/app.php', 'config/auth.php', 'routes/web.php', 'vite.config.js', 'resources/css', 'resources/js', 'resources/views/welcome.blade.php', 'app/Http/Controllers/HomeController.php', 'app/Http/Middleware/TrustProxies.php', 'app/Models/User.php'];
|
359
|
+
files.forEach(file => {
|
360
|
+
const filePath = this.destinationPath(file);
|
361
|
+
this.fs.delete(filePath);
|
362
|
+
});
|
363
|
+
},
|
364
|
+
|
365
|
+
composerJSON() {
|
366
|
+
this.composerJson.merge({
|
367
|
+
require: {
|
368
|
+
'folklore/laravel-folklore': 'v1.x-dev',
|
369
|
+
'folklore/laravel-locale': 'v8.x-dev',
|
370
|
+
'folklore/laravel-image': 'v1.x-dev'
|
371
|
+
}
|
372
|
+
});
|
373
|
+
},
|
374
|
+
|
375
|
+
packageJSON() {
|
376
|
+
this.packageJson.merge({
|
377
|
+
scripts: {
|
378
|
+
clean: 'rm -rf public/static && rm -rf public/precache-*',
|
379
|
+
'build:scripts': 'flklr build --load-env ./resources/assets/js/index.js',
|
380
|
+
'build:views': 'php artisan assets:view',
|
381
|
+
build: 'npm run clean && npm run build:scripts && npm run build:views',
|
382
|
+
start: 'npm run server',
|
383
|
+
server: 'flklr serve --load-env ./resources/assets/js/index.js'
|
384
|
+
}
|
385
|
+
});
|
386
|
+
},
|
387
|
+
|
388
|
+
env() {
|
389
|
+
const url = _lodash.default.template(_lodash.default.get(this.options, 'url'))({
|
390
|
+
project_host: this.options['project-host'],
|
391
|
+
project_name: this.options['project-name']
|
392
|
+
}).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
|
393
|
+
|
394
|
+
const urlLocal = _lodash.default.template(_lodash.default.get(this.options, 'local-url'))({
|
395
|
+
project_host: this.options['project-host'],
|
396
|
+
project_name: this.options['project-name']
|
397
|
+
}).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
|
398
|
+
|
399
|
+
const urlProxy = _lodash.default.template(_lodash.default.get(this.options, 'proxy-url', _lodash.default.get(this.options, 'local-url')))({
|
400
|
+
project_host: this.options['project-host'],
|
401
|
+
project_name: this.options['project-name']
|
402
|
+
}).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
|
403
|
+
|
404
|
+
const templateData = {
|
405
|
+
project_name: this.options['project-name'],
|
406
|
+
db_host: this.options['db-host'],
|
407
|
+
db_username: this.options['db-username'],
|
408
|
+
db_password: this.options['db-password'],
|
409
|
+
db_name: this.options['db-name'],
|
410
|
+
url: urlLocal,
|
411
|
+
proxy_url: urlProxy
|
412
|
+
};
|
413
|
+
|
414
|
+
const prodTemplateData = _objectSpread(_objectSpread({}, templateData), {}, {
|
415
|
+
url,
|
416
|
+
db_username: this.options['db-name']
|
417
|
+
});
|
418
|
+
|
419
|
+
const src = this.templatePath('env');
|
420
|
+
const dest = this.destinationPath('.env');
|
421
|
+
this.fs.copyTpl(src, dest, templateData);
|
422
|
+
const srcExample = this.templatePath('env');
|
423
|
+
const destExample = this.destinationPath('.env.example');
|
424
|
+
this.fs.copyTpl(srcExample, destExample, templateData); // const srcProd = this.templatePath('env.prod');
|
425
|
+
// const destProd = this.destinationPath('.env.prod');
|
426
|
+
// this.fs.copyTpl(srcProd, destProd, prodTemplateData);
|
427
|
+
},
|
428
|
+
|
429
|
+
files() {
|
430
|
+
const templatePath = this.templatePath('laravel');
|
431
|
+
const destinationPath = this.destinationPath();
|
432
|
+
|
433
|
+
const files = _glob.default.sync('**', {
|
434
|
+
dot: true,
|
435
|
+
nodir: true,
|
436
|
+
cwd: templatePath
|
437
|
+
});
|
438
|
+
|
439
|
+
files.forEach(file => {
|
440
|
+
const source = _path.default.join(templatePath, file);
|
441
|
+
|
442
|
+
const destination = _path.default.join(destinationPath, file);
|
443
|
+
|
444
|
+
if (file.match(/\.php$/i)) {
|
445
|
+
this.fs.copyTpl(source, destination, {
|
446
|
+
options: this.options
|
447
|
+
});
|
448
|
+
} else {
|
449
|
+
this.fs.copy(source, destination);
|
450
|
+
}
|
451
|
+
});
|
452
|
+
}
|
453
|
+
|
454
|
+
};
|
455
|
+
}
|
456
|
+
|
457
|
+
get install() {
|
458
|
+
return {
|
459
|
+
async npm() {
|
460
|
+
if (this.options['skip-install']) {
|
461
|
+
return;
|
462
|
+
}
|
463
|
+
|
464
|
+
await this.spawnCommand('npm', ['install']);
|
465
|
+
},
|
466
|
+
|
467
|
+
async composer() {
|
468
|
+
if (this.options['skip-install']) {
|
469
|
+
return;
|
470
|
+
}
|
471
|
+
|
472
|
+
await this.spawnCommand('composer', ['install']);
|
473
|
+
},
|
474
|
+
|
475
|
+
async keyGenerate() {
|
476
|
+
if (this.options['skip-install']) {
|
477
|
+
return;
|
478
|
+
}
|
479
|
+
|
480
|
+
await this.spawnCommand('php', ['artisan', 'key:generate']);
|
481
|
+
},
|
482
|
+
|
483
|
+
async vendorPublish() {
|
484
|
+
if (this.options['skip-install']) {
|
485
|
+
return;
|
486
|
+
}
|
487
|
+
|
488
|
+
await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\ServiceProvider']);
|
489
|
+
await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\Locale\\LocaleServiceProvider']);
|
490
|
+
await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\Image\\ServiceProvider']);
|
491
|
+
},
|
492
|
+
|
493
|
+
async valet() {
|
494
|
+
if (this.options['skip-install']) {
|
495
|
+
return;
|
496
|
+
}
|
497
|
+
|
498
|
+
await this.spawnCommand('valet', ['link', '--secure', this.options['project-host']]);
|
499
|
+
}
|
500
|
+
|
501
|
+
};
|
502
|
+
}
|
503
|
+
|
504
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
APP_NAME=Laravel
|
2
|
+
APP_ENV=local
|
3
|
+
APP_KEY=
|
4
|
+
APP_DEBUG=true
|
5
|
+
APP_URL=<%= url %>
|
6
|
+
|
7
|
+
LOG_CHANNEL=stack
|
8
|
+
LOG_DEPRECATIONS_CHANNEL=null
|
9
|
+
LOG_LEVEL=debug
|
10
|
+
|
11
|
+
DB_CONNECTION=mysql
|
12
|
+
DB_HOST=127.0.0.1
|
13
|
+
DB_PORT=3306
|
14
|
+
DB_DATABASE=<%= db_name %>
|
15
|
+
DB_USERNAME=<%= db_username %>
|
16
|
+
DB_PASSWORD=<%= db_password %>
|
17
|
+
|
18
|
+
BROADCAST_DRIVER=log
|
19
|
+
CACHE_DRIVER=file
|
20
|
+
FILESYSTEM_DISK=local
|
21
|
+
QUEUE_CONNECTION=sync
|
22
|
+
SESSION_DRIVER=file
|
23
|
+
SESSION_LIFETIME=120
|
24
|
+
|
25
|
+
MEMCACHED_HOST=127.0.0.1
|
26
|
+
|
27
|
+
REDIS_HOST=127.0.0.1
|
28
|
+
REDIS_PASSWORD=null
|
29
|
+
REDIS_PORT=6379
|
30
|
+
|
31
|
+
MAIL_MAILER=smtp
|
32
|
+
MAIL_HOST=mailhog
|
33
|
+
MAIL_PORT=1025
|
34
|
+
MAIL_USERNAME=null
|
35
|
+
MAIL_PASSWORD=null
|
36
|
+
MAIL_ENCRYPTION=null
|
37
|
+
MAIL_FROM_ADDRESS="dev@folklore.email"
|
38
|
+
MAIL_FROM_NAME="${APP_NAME}"
|
39
|
+
|
40
|
+
# react-scripts variables
|
41
|
+
FLKLR_PROXY=<%= proxy_url %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Composers;
|
4
|
+
|
5
|
+
use Illuminate\Http\Request;
|
6
|
+
use Illuminate\View\View;
|
7
|
+
use App\Http\Resources\UserResource;
|
8
|
+
|
9
|
+
class AppComposer
|
10
|
+
{
|
11
|
+
|
12
|
+
/**
|
13
|
+
* The request
|
14
|
+
*
|
15
|
+
* @var \Illuminate\Http\Request
|
16
|
+
*/
|
17
|
+
protected $request;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Create a new profile composer.
|
21
|
+
*
|
22
|
+
* @param \Illuminate\Http\Request $request
|
23
|
+
* @return void
|
24
|
+
*/
|
25
|
+
public function __construct(Request $request)
|
26
|
+
{
|
27
|
+
$this->request = $request;
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Bind data to the view.
|
32
|
+
*
|
33
|
+
* @param View $view
|
34
|
+
* @return void
|
35
|
+
*/
|
36
|
+
public function compose(View $view)
|
37
|
+
{
|
38
|
+
$site = $this->request->site();
|
39
|
+
$user = $this->request->user();
|
40
|
+
|
41
|
+
$view->props = [
|
42
|
+
'routes' => $view->routes,
|
43
|
+
'intl' => $view->intl,
|
44
|
+
'user' => !is_null($user) ? new UserResource($user) : null,
|
45
|
+
'site' => $site,
|
46
|
+
];
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Composers;
|
4
|
+
|
5
|
+
use Illuminate\Http\Request;
|
6
|
+
use Illuminate\View\View;
|
7
|
+
use Illuminate\Http\Resources\Json\JsonResource;
|
8
|
+
|
9
|
+
class MetaComposer
|
10
|
+
{
|
11
|
+
/**
|
12
|
+
* The request
|
13
|
+
*
|
14
|
+
* @var \Illuminate\Http\Request
|
15
|
+
*/
|
16
|
+
protected $request;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Create a new profile composer.
|
20
|
+
*
|
21
|
+
* @param \Illuminate\Http\Request $request
|
22
|
+
* @return void
|
23
|
+
*/
|
24
|
+
public function __construct(Request $request)
|
25
|
+
{
|
26
|
+
$this->request = $request;
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Bind data to the view.
|
31
|
+
*
|
32
|
+
* @param View $view
|
33
|
+
* @return void
|
34
|
+
*/
|
35
|
+
public function compose(View $view)
|
36
|
+
{
|
37
|
+
$locale = $this->request->locale();
|
38
|
+
$view->title = trans('meta.title');
|
39
|
+
$view->description = trans('meta.description');
|
40
|
+
$view->image = asset(trans('meta.image'));
|
41
|
+
$view->url = $this->request->url();
|
42
|
+
$view->canonical = $this->request->url();
|
43
|
+
$view->siteName = trans('meta.siteName');
|
44
|
+
$view->appId = config('services.facebook.client_id');
|
45
|
+
|
46
|
+
$page = $view->page instanceof JsonResource ? $view->page->resource : $view->page;
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Composers;
|
4
|
+
|
5
|
+
use Illuminate\View\View;
|
6
|
+
use Illuminate\Http\Request;
|
7
|
+
use Illuminate\Routing\Router;
|
8
|
+
use Folklore\Composers\RoutesComposer as BaseRoutesComposer;
|
9
|
+
|
10
|
+
class RoutesComposer extends BaseRoutesComposer
|
11
|
+
{
|
12
|
+
protected $routes = [];
|
13
|
+
|
14
|
+
protected $routesLocalized = [
|
15
|
+
'home',
|
16
|
+
];
|
17
|
+
|
18
|
+
protected $withoutParametersPatterns = true;
|
19
|
+
}
|
package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Http\Controllers;
|
4
|
+
|
5
|
+
use Illuminate\Http\Request;
|
6
|
+
|
7
|
+
class HomeController extends Controller
|
8
|
+
{
|
9
|
+
public function index(Request $request)
|
10
|
+
{
|
11
|
+
return view('app');
|
12
|
+
}
|
13
|
+
|
14
|
+
public function redirect(Request $request)
|
15
|
+
{
|
16
|
+
return redirect()->to(app('url')->routeWithLocale('home'));
|
17
|
+
}
|
18
|
+
}
|