impr: Migliorata generazione dei barrel
This commit is contained in:
parent
bca3b837cf
commit
6faa79e999
|
@ -3,8 +3,13 @@
|
|||
"resources/js"
|
||||
],
|
||||
"delete": true,
|
||||
"exclude": [
|
||||
"_material.ts",
|
||||
"app.ts",
|
||||
"styles.ts"
|
||||
],
|
||||
"include": [
|
||||
".(ts|tsx)$"
|
||||
".(?<!d\\.)(ts|tsx)$"
|
||||
],
|
||||
"location": "all",
|
||||
"singleQuotes": true
|
||||
|
|
|
@ -3,3 +3,5 @@ extends:
|
|||
- '@maicol07'
|
||||
globals:
|
||||
__: true
|
||||
rules:
|
||||
import/export: 'off'
|
||||
|
|
|
@ -563,7 +563,7 @@
|
|||
<inspection_tool class="JSUnresolvedReactComponent" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JSUnresolvedVariable" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JSUnusedAssignment" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JSUnusedGlobalSymbols" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JSUnusedGlobalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnusedLocalSymbols" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JSUrlImportUsage" enabled="true" level="INFORMATION" enabled_by_default="true" />
|
||||
<inspection_tool class="JSValidateJSDoc" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class FixBarrelsGeneration extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'osm:barrels-generation-fix';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Fix barrels generation by automatically removing /index at the end of an export';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
final public function handle(): int
|
||||
{
|
||||
foreach ($this->glob(resource_path('js/**/index.ts'), GLOB_NOSORT) as $file) {
|
||||
$content = File::get($file);
|
||||
File::put($file, str_replace('/index', '', $content));
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param int $flags
|
||||
* @return array|false
|
||||
*
|
||||
* @source https://gist.github.com/funkjedi/3feee27d873ae2297b8e2370a7082aad
|
||||
*/
|
||||
private function glob(string $pattern, int $flags = 0): bool|array
|
||||
{
|
||||
if (!str_contains($pattern, '**')) {
|
||||
$files = File::glob($pattern, $flags);
|
||||
} else {
|
||||
$position = strpos($pattern, '**');
|
||||
$rootPattern = substr($pattern, 0, $position - 1);
|
||||
$restPattern = substr($pattern, $position + 2);
|
||||
|
||||
$patterns = [$rootPattern . $restPattern];
|
||||
$rootPattern .= '/*';
|
||||
while ($dirs = File::glob($rootPattern, GLOB_ONLYDIR)) {
|
||||
$rootPattern .= '/*';
|
||||
foreach ($dirs as $dir) {
|
||||
$patterns[] = $dir . $restPattern;
|
||||
}
|
||||
}
|
||||
$files = [];
|
||||
foreach ($patterns as $pat) {
|
||||
$files[] = $this->glob($pat, $flags);
|
||||
}
|
||||
$files = array_merge(...$files);
|
||||
}
|
||||
return array_unique($files);
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
"build:dev": "vite build --mode development",
|
||||
"build:watch": "vite build --watch",
|
||||
"dev": "php artisan osm:dev-server-fix && vite",
|
||||
"generate-barrels": "barrelsby -c ./.barrelsby.config.json",
|
||||
"generate-barrels": "barrelsby -c ./.barrelsby.config.json && php artisan osm:barrels-generation-fix && eslint --fix \"resources/js/**/index.ts\"",
|
||||
"serve": "php artisan serve",
|
||||
"serve-dev": "concurrently --raw pnpm:serve pnpm:dev",
|
||||
"serve-watch": "concurrently --raw pnpm:serve pnpm:watch",
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
// noinspection JSUnusedGlobalSymbols
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export {default as DataTable} from './DataTable';
|
||||
export {default as TableCell} from './TableCell';
|
||||
export {default as TableColumn} from './TableColumn';
|
||||
export {default as TableFooter} from './TableFooter';
|
||||
export {default as TableRow} from './TableRow';
|
||||
export * from './DataTable';
|
||||
export * from './TableCell';
|
||||
export * from './TableColumn';
|
||||
export * from './TableFooter';
|
||||
export * from './TableRow';
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './RecordsPage';
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
export * from './extend';
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './recordsPage';
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/* eslint-disable import/export */
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export {default as Component} from './Component';
|
||||
export * from './Component';
|
||||
export * from './DataTable';
|
||||
export * from './extend';
|
||||
export * from './InertiaLink';
|
||||
export * from './layout';
|
||||
export {default as LoadingButton} from './LoadingButton';
|
||||
export {default as Mdi} from './Mdi';
|
||||
export {default as Page} from './Page';
|
||||
export * from './LoadingButton';
|
||||
export * from './Mdi';
|
||||
export * from './Page';
|
||||
export * from './Pages';
|
||||
|
|
|
@ -4,9 +4,9 @@ import {
|
|||
Vnode
|
||||
} from 'mithril';
|
||||
|
||||
import {isMobile} from '../../utils';
|
||||
import Component from '../Component';
|
||||
import DrawerEntry from './Drawer/DrawerEntry';
|
||||
import {isMobile} from '../../../utils';
|
||||
import Component from '../../Component';
|
||||
import DrawerEntry from './DrawerEntry';
|
||||
|
||||
export interface DrawerAttributes {
|
||||
open: boolean;
|
|
@ -6,13 +6,13 @@ import Component from '../../Component';
|
|||
import InertiaLink from '../../InertiaLink';
|
||||
import Mdi from '../../Mdi';
|
||||
|
||||
export interface DrawerAttributes {
|
||||
export interface DrawerEntryAttributes {
|
||||
route: string;
|
||||
icon: MaterialIcons;
|
||||
}
|
||||
|
||||
export default class DrawerEntry extends Component<DrawerAttributes> {
|
||||
view(vnode: Vnode<DrawerAttributes>) {
|
||||
export default class DrawerEntry extends Component<DrawerEntryAttributes> {
|
||||
view(vnode: Vnode<DrawerEntryAttributes>) {
|
||||
return (
|
||||
<InertiaLink className="drawer-item" href={route(vnode.attrs.route)}
|
||||
onclick={this.onclick.bind(this)}>
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './Drawer';
|
||||
export * from './DrawerEntry';
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './TopAppBarAction';
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
export * from './Drawer';
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './Drawer';
|
||||
export * from './Footer';
|
||||
export * from './TopAppBar';
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './Model';
|
||||
|
|
|
@ -9,7 +9,7 @@ import redaxios from 'redaxios';
|
|||
|
||||
import LoadingButton from '../Components/LoadingButton';
|
||||
import Mdi from '../Components/Mdi';
|
||||
import Page from '../Components/Page';
|
||||
import Page, {PageAttributes} from '../Components/Page';
|
||||
import type {ErrorResponse} from '../typings';
|
||||
import {
|
||||
getFormData,
|
||||
|
@ -18,7 +18,7 @@ import {
|
|||
validatePassword
|
||||
} from '../utils';
|
||||
|
||||
export default class AdminSetupPage extends Page {
|
||||
export class AdminSetupPage extends Page {
|
||||
loading: Cash;
|
||||
|
||||
view() {
|
||||
|
@ -89,9 +89,10 @@ export default class AdminSetupPage extends Page {
|
|||
);
|
||||
}
|
||||
|
||||
oncreate(vnode: VnodeDOM) {
|
||||
oncreate(vnode: VnodeDOM<PageAttributes>) {
|
||||
super.oncreate(vnode);
|
||||
this.loading = $(this.element).find('#login-button mwc-circular-progress');
|
||||
this.loading = $(this.element)
|
||||
.find('#login-button mwc-circular-progress');
|
||||
$(this.element)
|
||||
.find('#create-account-button')
|
||||
.on('click', this.onCreateAccountButtonClicked.bind(this));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Page from '../Components/Page';
|
||||
|
||||
export default class Dashboard extends Page {
|
||||
export class Dashboard extends Page {
|
||||
contents() {
|
||||
return (
|
||||
<div>
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
showSnackbar
|
||||
} from '../utils';
|
||||
|
||||
export default class LoginPage extends Page {
|
||||
export class LoginPage extends Page {
|
||||
loading: Cash;
|
||||
forgotPasswordLoading: Cash;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import redaxios from 'redaxios';
|
|||
|
||||
import LoadingButton from '../Components/LoadingButton';
|
||||
import Mdi from '../Components/Mdi';
|
||||
import Page from '../Components/Page';
|
||||
import Page, {PageAttributes} from '../Components/Page';
|
||||
import {ErrorResponse} from '../typings';
|
||||
import {
|
||||
getFormData,
|
||||
|
@ -23,11 +23,11 @@ import {
|
|||
validatePassword
|
||||
} from '../utils';
|
||||
|
||||
export default class ResetPasswordPage extends Page {
|
||||
export class ResetPasswordPage extends Page {
|
||||
loading: Cash;
|
||||
parameters: URLSearchParams;
|
||||
|
||||
oninit(vnode: Vnode) {
|
||||
oninit(vnode: Vnode<PageAttributes>) {
|
||||
super.oninit(vnode);
|
||||
this.parameters = new URLSearchParams(window.location.search);
|
||||
}
|
||||
|
@ -87,13 +87,13 @@ export default class ResetPasswordPage extends Page {
|
|||
);
|
||||
}
|
||||
|
||||
oncreate(vnode: VnodeDOM) {
|
||||
oncreate(vnode: VnodeDOM<PageAttributes>) {
|
||||
super.oncreate(vnode);
|
||||
this.loading = $(this.element)
|
||||
.find('#reset-password mwc-circular-progress');
|
||||
}
|
||||
|
||||
async onResetPasswordButtonClicked(event: PointerEvent) {
|
||||
async onResetPasswordButtonClicked(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
this.loading.show();
|
||||
const form = $(this.element)
|
||||
|
|
|
@ -17,8 +17,11 @@ import type {Vnode, VnodeDOM} from 'mithril';
|
|||
import redaxios, {Response} from 'redaxios';
|
||||
|
||||
import Mdi from '../Components/Mdi';
|
||||
import Page from '../Components/Page';
|
||||
import {getFormData, showSnackbar} from '../utils';
|
||||
import Page, {PageAttributes} from '../Components/Page';
|
||||
import {
|
||||
getFormData,
|
||||
showSnackbar
|
||||
} from '../utils';
|
||||
|
||||
function getFlag(language: string, slot: string = 'graphic', styles: CSS.Properties = {}) {
|
||||
if (!styles.display) {
|
||||
|
@ -38,14 +41,14 @@ function getFlag(language: string, slot: string = 'graphic', styles: CSS.Propert
|
|||
);
|
||||
}
|
||||
|
||||
export default class SetupPage extends Page {
|
||||
languages() {
|
||||
export class SetupPage extends Page {
|
||||
languages(vnode: Vnode<PageAttributes>) {
|
||||
const listItems: Vnode[] = [];
|
||||
|
||||
for (const lang of this.page.props.languages) {
|
||||
for (const lang of vnode.attrs.page.props.languages) {
|
||||
const language = lang as string;
|
||||
const attributes = {
|
||||
selected: this.page.props.locale === lang
|
||||
selected: vnode.attrs.page.props.locale === lang
|
||||
};
|
||||
const langCode = language.replace('_', '-');
|
||||
listItems.push(
|
||||
|
@ -69,7 +72,7 @@ export default class SetupPage extends Page {
|
|||
return listItems;
|
||||
}
|
||||
|
||||
view() {
|
||||
view(vnode: Vnode<PageAttributes>) {
|
||||
const examplesTexts: Record<string, string> = {};
|
||||
|
||||
for (const example of ['localhost', 'root', 'mysql', 'openstamanager']) {
|
||||
|
@ -233,7 +236,7 @@ export default class SetupPage extends Page {
|
|||
<mwc-layout-grid-cell>
|
||||
<h4>{__('Lingua')}</h4>
|
||||
<material-select id="language-select" name="locale">
|
||||
{this.languages()}
|
||||
{this.languages(vnode)}
|
||||
</material-select>
|
||||
<hr />
|
||||
<h4>{__('Licenza')}</h4>
|
||||
|
@ -243,7 +246,7 @@ export default class SetupPage extends Page {
|
|||
)}
|
||||
</p>
|
||||
<text-area
|
||||
value={this.page.props.license as string}
|
||||
value={vnode.attrs.page.props.license as string}
|
||||
rows={15}
|
||||
cols={40}
|
||||
disabled
|
||||
|
@ -283,13 +286,18 @@ export default class SetupPage extends Page {
|
|||
);
|
||||
}
|
||||
|
||||
oncreate(vnode: VnodeDOM) {
|
||||
oncreate(vnode: VnodeDOM<PageAttributes>) {
|
||||
super.oncreate(vnode);
|
||||
$('mwc-fab#contrast-switcher').on('click', function (this: HTMLElement) {
|
||||
$(this).toggleClass('contrast-light').toggleClass('contrast-dark');
|
||||
$('body').toggleClass('mdc-high-contrast');
|
||||
});
|
||||
$('#language-select').on('action', (event: Event) => this.onLanguageSelected(event as Event & {detail: {index: number}}));
|
||||
$('mwc-fab#contrast-switcher')
|
||||
.on('click', function (this: HTMLElement) {
|
||||
$(this)
|
||||
.toggleClass('contrast-light')
|
||||
.toggleClass('contrast-dark');
|
||||
$('body')
|
||||
.toggleClass('mdc-high-contrast');
|
||||
});
|
||||
$('#language-select')
|
||||
.on('action', (event: Event) => this.onLanguageSelected(event as Event & {detail: {index: number}}));
|
||||
}
|
||||
|
||||
async onTestButtonClicked() {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// noinspection JSUnusedGlobalSymbols
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export {default as AdminSetupPage} from './AdminSetupPage';
|
||||
export {default as Dashboard} from './Dashboard';
|
||||
export {default as LoginPage} from './LoginPage';
|
||||
export {default as ResetPasswordPage} from './ResetPasswordPage';
|
||||
export {default as SetupPage} from './SetupPage';
|
||||
export * from './AdminSetupPage';
|
||||
export * from './LoginPage';
|
||||
export * from './ResetPasswordPage';
|
||||
export * from './SetupPage';
|
||||
|
|
|
@ -15,7 +15,7 @@ import {ifDefined} from 'lit/directives/if-defined.js';
|
|||
|
||||
// noinspection HtmlUnknownAttribute
|
||||
@customElement('icon-button')
|
||||
export default class IconButton extends MWCIconButton {
|
||||
export class IconButton extends MWCIconButton {
|
||||
static styles = [...MWCIconButton.styles, css`${unsafeCSS(styles)}`];
|
||||
|
||||
@property({type: Boolean}) declare tight: boolean;
|
||||
|
|
|
@ -3,7 +3,7 @@ import {css} from 'lit';
|
|||
import {customElement} from 'lit/decorators.js';
|
||||
|
||||
@customElement('material-drawer')
|
||||
export default class MaterialDrawer extends MWCDrawer {
|
||||
export class MaterialDrawer extends MWCDrawer {
|
||||
static styles = [
|
||||
...MWCDrawer.styles,
|
||||
css`
|
||||
|
|
|
@ -5,7 +5,7 @@ import {css, html} from 'lit';
|
|||
import {customElement} from 'lit/decorators.js';
|
||||
|
||||
@customElement('material-select')
|
||||
export default class Select extends MWCSelect {
|
||||
export class Select extends MWCSelect {
|
||||
static styles = [
|
||||
...MWCSelect.styles,
|
||||
css`
|
||||
|
|
|
@ -2,7 +2,7 @@ import {TextArea as MWCTextArea} from '@material/mwc-textarea';
|
|||
import {customElement} from 'lit/decorators.js';
|
||||
|
||||
@customElement('text-area')
|
||||
export default class TextArea extends MWCTextArea {
|
||||
export class TextArea extends MWCTextArea {
|
||||
private _initialValidationMessage: string | undefined;
|
||||
|
||||
get nativeValidationMessage() {
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
import {customElement, property} from 'lit/decorators.js';
|
||||
|
||||
@customElement('text-field')
|
||||
export default class TextField extends MWCTextField {
|
||||
export class TextField extends MWCTextField {
|
||||
static styles = [...MWCTextField.styles, css`${unsafeCSS(styles)}`];
|
||||
|
||||
@property({type: Boolean}) declare comfortable: boolean;
|
||||
|
|
|
@ -3,7 +3,7 @@ import {css} from 'lit';
|
|||
import {customElement} from 'lit/decorators.js';
|
||||
|
||||
@customElement('top-app-bar')
|
||||
export default class TopAppBar extends MWCTopAppBar {
|
||||
export class TopAppBar extends MWCTopAppBar {
|
||||
static styles = [...MWCTopAppBar.styles, css`
|
||||
header.mdc-top-app-bar {
|
||||
border-bottom: 1px solid var(--mdc-theme-outline-color, #e0e0e0);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
// noinspection JSUnusedGlobalSymbols
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export {default as IconButton} from './IconButton';
|
||||
export {default as MaterialDrawer} from './MaterialDrawer';
|
||||
export {default as Select} from './Select';
|
||||
export {default as TextArea} from './TextArea';
|
||||
export {default as TextField} from './TextField';
|
||||
export {default as TopAppBar} from './TopAppBar';
|
||||
export * from './IconButton';
|
||||
export * from './MaterialDrawer';
|
||||
export * from './Select';
|
||||
export * from './TextArea';
|
||||
export * from './TopAppBar';
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './Components';
|
||||
export * from './Models';
|
||||
export * from './typings';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* This file exports only from files that has exportable types definition or interfaces.
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './forms';
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from './Request';
|
||||
export * from './utils';
|
||||
|
|
Loading…
Reference in New Issue