Skip to content

Commit

Permalink
Merge pull request #113 from kirschbaum-development/feature/nova-4-su…
Browse files Browse the repository at this point in the history
…pport

Nova 4 Upgrade
  • Loading branch information
luisdalmolin authored Feb 15, 2023
2 parents 4670bfa + f10a4d1 commit 94c92a4
Show file tree
Hide file tree
Showing 25 changed files with 312 additions and 216 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
phpunit:
runs-on: ubuntu-latest
container:
image: kirschbaumdevelopment/laravel-test-runner:7.3.0
image: kirschbaumdevelopment/laravel-test-runner:8.0

services:
mysql:
Expand All @@ -23,8 +23,7 @@ jobs:
fetch-depth: 1

- name: Configure composer for Nova
run: |
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_PASSWORD }}"
run: composer config 'http-basic.nova.laravel.com' '${{ secrets.NOVA_USERNAME }}' '${{ secrets.NOVA_LICENSE_KEY }}'

- name: Install composer dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
php-cs-fixer:
runs-on: ubuntu-latest
container:
image: kirschbaumdevelopment/laravel-test-runner:7.3.0
image: kirschbaumdevelopment/laravel-test-runner:8.0

steps:
- uses: actions/checkout@v1
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ composer.phar
composer.lock
phpunit.xml
.phpunit.result.cache
.php-cs-fixer.cache
.DS_Store
Thumbs.db
.php_cs.cache

auth.json
32 changes: 14 additions & 18 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setFinder($finder)
->setRules([
'@PSR2' => true,
Expand All @@ -20,9 +20,14 @@
],
'no_singleline_whitespace_before_semicolons' => true,
'no_extra_blank_lines' => [
'break', 'case', 'continue', 'curly_brace_block', 'default',
'extra', 'parenthesis_brace_block', 'return',
'square_brace_block', 'switch', 'throw', 'use', 'useTrait', 'use_trait',
'tokens' => [
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'throw',
'use',
]
],
'cast_spaces' => [
'space' => 'single',
Expand All @@ -43,7 +48,7 @@
// 'increment_style' => ['style' => 'post'],
'short_scalar_cast' => true,
'class_attributes_separation' => [
'elements' => ['const', 'method', 'property'],
'elements' => ['method' => 'one',],
],
'no_mixed_echo_print' => [
'use' => 'echo',
Expand All @@ -54,7 +59,7 @@
],
'no_empty_statement' => true,
'unary_operator_spaces' => true, // $number ++ becomes $number++
'hash_to_slash_comment' => true, // # becomes //
'single_line_comment_style' => true, // # becomes //
'standardize_not_equals' => true, // <> becomes !=
'native_function_casing' => true,
'ternary_operator_spaces' => true,
Expand All @@ -64,16 +69,7 @@
],
'function_typehint_space' => true,
'no_leading_import_slash' => true,
'blank_line_before_statement' => [
'statements' => [
'break', 'case', 'continue',
'declare', 'default', 'die',
'do', 'exit', 'for', 'foreach',
'goto', 'if', 'include',
'include_once', 'require', 'require_once',
'return', 'switch', 'throw', 'try', 'while', 'yield',
],
],
'blank_line_before_statement' => true,
'combine_consecutive_unsets' => true,
'method_chaining_indentation' => true,
'no_whitespace_in_blank_line' => true,
Expand All @@ -84,7 +80,7 @@
'compact_nullable_typehint' => true,
'explicit_string_variable' => true,
'no_leading_namespace_whitespace' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'single_blank_line_before_namespace' => true,
Expand Down Expand Up @@ -113,7 +109,7 @@
'protected',
'private',
],
'sortAlgorithm' => 'none',
'sort_algorithm' => 'none',
],
'return_type_declaration' => [
'space_before' => 'none',
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"license": "MIT",
"require": {
"php": ">=7.1.0"
"php": "^7.4|^8.0"
},
"repositories": [
{
Expand All @@ -16,11 +16,10 @@
}
],
"require-dev": {
"codedungeon/phpunit-result-printer": "^0.26.2",
"orchestra/testing": "^4.0",
"phpunit/phpunit": "^8.3",
"orchestra/testbench": "^7.4",
"phpunit/phpunit": "^9.5.10",
"mockery/mockery": "^1.1",
"laravel/nova": "*"
"laravel/nova": "4.2"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions dist/css/field.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 2 additions & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions dist/js/field.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* vuex v4.1.0
* (c) 2022 Evan You
* @license MIT
*/

/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/

/**!
* Sortable 1.14.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
2 changes: 1 addition & 1 deletion dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/js/field.js": "/js/field.js",
"/css/field.css": "/css/field.css"
}
}
40 changes: 40 additions & 0 deletions mix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const mix = require('laravel-mix');
const webpack = require('webpack');
const path = require('path');

class NovaExtension {
name() {
return 'nova-extension';
}

register(name) {
this.name = name;
}

webpackPlugins() {
return new webpack.ProvidePlugin({
_: 'lodash',
Errors: 'form-backend-validation',
});
}

webpackConfig(webpackConfig) {
webpackConfig.externals = {
vue: 'Vue',
};

webpackConfig.resolve.alias = {
...(webpackConfig.resolve.alias || {}),
'laravel-nova': path.join(
__dirname,
'../../vendor/laravel/nova/resources/js/mixins/packages.js'
),
};

webpackConfig.output = {
uniqueName: this.name,
};
}
}

mix.extend('nova', new NovaExtension())
33 changes: 19 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
"production": "mix --production"
},
"devDependencies": {
"cross-env": "^5.0.0",
"laravel-mix": "^1.0",
"laravel-nova": "^1.0"
},
"dependencies": {
"vue": "^2.5.0",
"vuedraggable": "^2.20.0",
"@inertiajs/inertia": "^0.11.0",
"@vue/babel-plugin-jsx": "^1.1.0",
"@vue/compiler-sfc": "^3.2.22",
"form-backend-validation": "^2.3.3",
"inflector-js": "^1.0.1",
"laravel-mix": "^6.0.41",
"lodash": "^4.17.21",
"postcss": "^8.3.11",
"vue-loader": "^16.8.3",
"vuex": "^4.0.2",
"lodash.template": "^4.5.0",
"mem": "^4.0.0",
"js-yaml": "^3.13.1",
"webpack-dev-server": "^3.1.11"
}
"webpack-dev-server": "^3.1.11",
"vuedraggable": "^4.1.0"
},
"dependencies": {}
}
32 changes: 11 additions & 21 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
<testsuites>
<testsuite name="Nova Inline Relationship Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Nova Inline Relationship Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
22 changes: 22 additions & 0 deletions phpunit.xml.dist.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Nova Inline Relationship Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
Empty file added resources/css/field.css
Empty file.
47 changes: 25 additions & 22 deletions resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<template>
<div class="flex border-b border-40">
<div class="w-1/4 py-4">
<slot>
<h4 class="font-normal text-80" v-text="field.singularLabel"></h4>
</slot>
</div>

<div class="w-3/4 py-4">
<div>
<relationship-detail-item v-for="(item, index) in value"
:id="index"
:key="index"
:value="item"
:model-id="field.models[index]||0"
:model-key="field.modelKey"
:label="field.singularLabel"
:is-singular="field.singular"
:settings="field.settings"
:collapsed="collapsed">
</relationship-detail-item>
<PanelItem :index="index" :field="field">
<template #value>
<div class="w-1/4 py-4">
<slot>
<h4 class="font-normal text-80" v-text="field.singular ? field.singularLabel : field.pluralLabel"></h4>
</slot>
</div>

<div class="w-3/4 py-4">
<div>
<relationship-detail-item v-for="(item, index) in value"
:id="index"
:key="index"
:value="item"
:model-id="field.models[index]||0"
:model-key="field.modelKey"
:label="field.singularLabel"
:is-singular="field.singular"
:settings="field.settings"
:collapsed="collapsed">
</relationship-detail-item>
</div>
</div>
</div>
</div>
</template>
</PanelItem>
</template>

<script>
Expand All @@ -31,6 +33,7 @@
components: { RelationshipDetailItem },
props: [
'index',
'field',
'resource',
'resourceId',
Expand Down
Loading

0 comments on commit 94c92a4

Please sign in to comment.