Skip to content

Commit

Permalink
build: update dependencies and run linter
Browse files Browse the repository at this point in the history
dust some cobwebs off and update the repo
  • Loading branch information
JeffBeltran committed Mar 6, 2024
1 parent 870549e commit 5eec1f6
Show file tree
Hide file tree
Showing 11 changed files with 1,677 additions and 1,377 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Check correct commit formatting
uses: wagoid/commitlint-github-action@v4
with:
firstParent: false

- name: Check formatting
run: yarn prettier-check

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ composer.lock
phpunit.xml
.phpunit.result.cache
.DS_Store
Thumbs.db
Thumbs.db
auth.json
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@
]
}
},
"repositories": [
{
"type": "composer",
"url": "https://nova.laravel.com"
}
],
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"require-dev": {
"laravel/pint": "^1.14"
}
}
2 changes: 1 addition & 1 deletion dist/js/tool.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@prettier/plugin-php": "^0.19.4",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
Expand Down
64 changes: 29 additions & 35 deletions resources/js/components/SanctumLoadingButton.vue
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
<template>
<component v-bind="{ size, align, ...$attrs }" :is="component" ref="button">
<component v-bind="{ size, align, ...$attrs }" :is="component" ref="button">
<span :class="{ invisible: processing || loading }">
<slot />
</span>

<span
v-if="processing || loading"
class="absolute"
style="top: 50%; left: 50%; transform: translate(-50%, -50%)"
>
<span
v-if="processing || loading"
class="absolute"
style="top: 50%; left: 50%; transform: translate(-50%, -50%)"
>
<Loader class="text-white" width="32" />
</span>
</component>
</component>
</template>

<script>
export default {
props: {
size: {
type: String,
default: 'lg',
},
align: {
type: String,
default: 'center',
validator: v => ['left', 'center'].includes(v),
},
props: {
size: {
type: String,
default: "lg",
},
loading: {
type: Boolean,
default: false,
},
align: {
type: String,
default: "center",
validator: (v) => ["left", "center"].includes(v),
},
processing: {
type: Boolean,
default: false,
},
loading: {
type: Boolean,
default: false,
},
component: {
type: String,
default: 'DefaultButton',
},
processing: {
type: Boolean,
default: false,
},
methods: {
focus() {
this.$refs.button.focus()
},
component: {
type: String,
default: "DefaultButton",
},
}
},
};
</script>
6 changes: 3 additions & 3 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
*/

Route::get(
"tokens/{resourceName}/{id}",
'tokens/{resourceName}/{id}',
"\Jeffbeltran\SanctumTokens\Http\SanctumController@tokens"
);
Route::post(
"tokens/{resourceName}/{id}",
'tokens/{resourceName}/{id}',
"\Jeffbeltran\SanctumTokens\Http\SanctumController@createToken"
);
Route::post(
"tokens/{resourceName}/{id}/revoke",
'tokens/{resourceName}/{id}/revoke',
"\Jeffbeltran\SanctumTokens\Http\SanctumController@revoke"
);
6 changes: 3 additions & 3 deletions src/Http/SanctumController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ class SanctumController
public function tokens($resourceName, $id)
{
return Nova::modelInstanceForKey($resourceName)
->with("tokens")
->with('tokens')
->find($id);
}

public function createToken(Request $request, $resourceName, $id)
{
$user = Nova::modelInstanceForKey($resourceName)->find($id);

$abilities = collect(explode(",", $request->abilities))
$abilities = collect(explode(',', $request->abilities))
->map(function ($item) {
return trim($item);
})
Expand All @@ -32,7 +32,7 @@ public function createToken(Request $request, $resourceName, $id)
public function revoke(Request $request, $resourceName, $id)
{
$user = Nova::modelInstanceForKey($resourceName)
->with("tokens")
->with('tokens')
->find($id);

return $user
Expand Down
12 changes: 6 additions & 6 deletions src/SanctumTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
class SanctumTokens extends ResourceTool
{
private $defaultOptions = [
"showAbilities" => true,
"defaultAbilities" => "*",
'showAbilities' => true,
'defaultAbilities' => '*',
];

public function __construct()
Expand All @@ -25,7 +25,7 @@ public function __construct()
*/
public function name()
{
return "Sanctum Tokens";
return 'Sanctum Tokens';
}

/**
Expand All @@ -36,7 +36,7 @@ public function name()
public function hideAbilities()
{
return $this->withMeta([
"showAbilities" => false,
'showAbilities' => false,
]);
}

Expand All @@ -48,7 +48,7 @@ public function hideAbilities()
public function defaultAbilities(array $abilities)
{
return $this->withMeta([
"defaultAbilities" => implode(", ", $abilities),
'defaultAbilities' => implode(', ', $abilities),
]);
}

Expand All @@ -59,6 +59,6 @@ public function defaultAbilities(array $abilities)
*/
public function component()
{
return "SanctumTokens";
return 'SanctumTokens';
}
}
26 changes: 13 additions & 13 deletions src/ToolServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ToolServiceProvider extends ServiceProvider
*
* @var string
*/
public static $name = "sanctum-tokens";
public static $name = 'sanctum-tokens';

/**
* Bootstrap any application services.
Expand All @@ -28,14 +28,14 @@ public function boot()
});

$this->publishes([
__DIR__ . "/../resources/lang" => lang_path(
"vendor/" . static::$name
__DIR__.'/../resources/lang' => lang_path(
'vendor/'.static::$name
),
]);

Nova::serving(function (ServingNova $event) {
Nova::script("sanctum-tokens", __DIR__ . "/../dist/js/tool.js");
Nova::style("sanctum-tokens", __DIR__ . "/../dist/css/tool.css");
Nova::script('sanctum-tokens', __DIR__.'/../dist/js/tool.js');
Nova::style('sanctum-tokens', __DIR__.'/../dist/css/tool.css');
Nova::translations(static::getTranslations());
});
}
Expand All @@ -58,14 +58,14 @@ protected function routes()
{
if (
$this->app->routesAreCached() ||
false === config("sanctum.routes")
config('sanctum.routes') === false
) {
return;
}

Route::middleware(["nova"])
->prefix("nova-vendor/" . static::$name)
->group(__DIR__ . "/../routes/api.php");
Route::middleware(['nova'])
->prefix('nova-vendor/'.static::$name)
->group(__DIR__.'/../routes/api.php');
}

/**
Expand All @@ -74,14 +74,14 @@ protected function routes()
private static function getTranslations(): array
{
$translationFile = lang_path(
"vendor/" . static::$name . "/" . app()->getLocale() . ".json"
'vendor/'.static::$name.'/'.app()->getLocale().'.json'
);

if (!is_readable($translationFile)) {
if (! is_readable($translationFile)) {
$translationFile =
__DIR__ . "/../resources/lang/" . app()->getLocale() . ".json";
__DIR__.'/../resources/lang/'.app()->getLocale().'.json';

if (!is_readable($translationFile)) {
if (! is_readable($translationFile)) {
return [];
}
}
Expand Down

0 comments on commit 5eec1f6

Please sign in to comment.