Giter Site home page Giter Site logo

laravel-backpack / addon-skeleton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeroen-g/packager-skeleton

4.0 4.0 3.0 59 KB

Skeleton for creating Backpack addons with Laravel Packager. Just add meat.

Home Page: http://backpackforlaravel.com

License: MIT License

PHP 100.00%

addon-skeleton's People

Contributors

4n70w4 avatar eduarguz avatar giovannipds avatar jeroen-g avatar jnoordsij avatar promatik avatar pxpm avatar tabacitu avatar tzsk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

addon-skeleton's Issues

[Refactoring] Move AutomaticServiceProvider from skeleton to CRUD

When doing these PRs I've had to change the AutomaticServiceProvider in all 3 themes, the same way. That's no bueno.

I think at this point it's safe to move the AutomaticServiceProvider to CRUD. If all add-ons and themes extend that one, it means we have a central place for all that code.

This does, however, mean we need to triple-check everything that AutomaticServiceProvider is doing, and go through all packages to use this one, then extensively test that package. It's not a Small task. In fact, I'd say it's a Medium or Large. And we don't really have time for that right now. But considering the fact that this should be non-breaking, I think we can do this later on, in Backpack 6.x. At least for most packages, that just use the AutomaticServiceProvider as-is.

Translation string is ugly

create-dummy-operation::create-dummy-operation.line_name

Right now it looks like we cannot use the vendorName as the namespace, because then a second project won't let us use the same namespace. So we can't do:
promatik::create-dummy-operation.line_name

[Feature Request] .editorconfig file

Consider adding an .editorconfig file to the skeleton… and to all our packages. This should force maintainers and contributors to follow the same code style, without using StyleCI or anything like that. Not sure it’s a 1:1 replacement though but it’s worth a shot.

https://editorconfig.org/

[Bug] Published lang files are not found

Bug report

What I did

I created an addon, then published lang files from my addon

What I expected to happen

I expetected to override some strings and see changes in the UI

What happened

Changes are ignored

What I've already tried to fix it

I changed AutomaticServiceProvider as follows

protected function publishedLangsPath() {
    app()->langPath(). '/vendor/'. $this->vendorNameDotPackageName();
}

I don't like it, because, publish lang files, creates a weird folder 'company_name.package_name' instead of standard 'company_name' .

It's ugly but laravel 9 can find it.

See vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php , in the specific note the inner working of

  • loadNamespaced
  • loadNamespaceOverrides

I've no idea how to add additional overrides or hints from the package itself to be able to autopublish to a company_name folder instead of company_name.package_name and ALSO allow Laravel to find overrides in here.

i tried also to leave publishedLangsPath as

return app()->langPath(). '/vendor/'. $this->vendorName;

but change boot()

from

    if ($this->packageDirectoryExistsAndIsNotEmpty('resources/lang')) {
        $this->loadTranslationsFrom($this->packageLangsPath(), $this->vendorNameDotPackageName());
    }

to

    if ($this->packageDirectoryExistsAndIsNotEmpty('resources/lang')) {
        $this->loadTranslationsFrom($this->packageLangsPath(), $this->vendorName);
    }

This causes the desidered folder name, with only the company, but then every occurrency of

trans('company_name.package_name::package_name.string_key') 

must be replaced with

trans('company_name::package_name.string_key') 

Context to replicate the bug - Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
PHP 8.0.3 (cli) (built: Mar  2 2021 23:34:05) ( ZTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.3, Copyright (c) Zend Technologies

### LARAVEL VERSION:
v9.17.0@091e287678ac723c591509ca6374e4ded4a99b1c

### BACKPACK VERSION:
5.1.0@9e1de794137ceb1ade1fa35e3b9366f97285efb3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.