Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanenko3 committed May 9, 2022
1 parent 38c9003 commit 5c725d6
Show file tree
Hide file tree
Showing 16 changed files with 4,548 additions and 4,643 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"php": ">=8.0",
"laravel/nova": "^4.0"
},
"repositories": [
{
"type": "path",
"url": "../nova"
}
],
"autoload": {
"psr-4": {
"Stepanenko3\\NovaMarkdown\\": "src/"
Expand All @@ -22,12 +28,6 @@
]
}
},
"repositories": [
{
"type": "path",
"url": "../nova"
}
],
"config": {
"sort-packages": true
},
Expand Down
4 changes: 2 additions & 2 deletions dist/js/entry.js → dist/js/field.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions dist/js/entry.js.LICENSE.txt → dist/js/field.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
* (c) 2021 Evan You
* @license MIT
*/

/*! https://mths.be/punycode v1.4.1 by @mathias */
2 changes: 1 addition & 1 deletion dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"/js/entry.js": "/js/entry.js"
"/js/field.js": "/js/field.js"
}
40 changes: 40 additions & 0 deletions nova.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 ''
}

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: 13 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
{
"private": true,
"scripts": {
"dev": "mix",
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "mix --production",
"format": "prettier --write 'resources/**/*.{css,js,vue}'"
"prod": "npm run production",
"production": "mix --production",
"nova:install": "npm --prefix='../../vendor/laravel/nova' ci"
},
"devDependencies": {
"@inertiajs/inertia": "^0.11.0",
"@vue/babel-plugin-jsx": "^1.1.1",
"axios": "^0.26.1",
"cross-env": "^7.0.3",
"form-backend-validation": "^2.4.0",
"laravel-mix": "^6.0.43",
"postcss": "^8.4.12",
"prettier": "^2.6.2",
"resolve-url-loader": "^5.0.0",
"sass": "^1.50.0",
"sass-loader": "^12.6.0",
"terser-webpack-plugin": "^5.3.1",
"vue-loader": "^17.0.0",
"vue-template-compiler": "^2.6.14",
"vuex": "^4.0.2"
"@vue/compiler-sfc": "^3.2.22",
"form-backend-validation": "^2.3.3",
"laravel-mix": "^6.0.41",
"lodash": "^4.17.21",
"postcss": "^8.3.11",
"vue-loader": "^16.8.3"
},
"dependencies": {
"codemirror": "^5.65.3",
"markdown-it": "^12.3.2",
"marked": "^4.0.14",
"simplemde": "^1.11.2",
"vue": "^3.2.31"
"simplemde": "^1.11.2"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions resources/js/entry.js

This file was deleted.

9 changes: 9 additions & 0 deletions resources/js/field.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import IndexField from './components/IndexField'
import DetailField from './components/DetailField'
import FormField from './components/FormField'

Nova.booting((app, store) => {
app.component('index-nova-markdown', IndexField)
app.component('detail-nova-markdown', DetailField)
app.component('form-nova-markdown', FormField)
})
1 change: 0 additions & 1 deletion resources/sass/entry.scss

This file was deleted.

37 changes: 11 additions & 26 deletions src/FieldServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Stepanenko3\NovaMarkdown;

use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;
Expand All @@ -15,23 +14,6 @@ class FieldServiceProvider extends ServiceProvider
* @return void
*/
public function boot()
{
$this->publishResources();
$this->serveAssets();
$this->declareConfig();
}

/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}

private function publishResources()
{
$this->publishes(
[
Expand All @@ -40,21 +22,24 @@ private function publishResources()
],
'config'
);
}

private function serveAssets()
{
Nova::serving(function (ServingNova $event) {
Nova::script('markdown', __DIR__.'/../dist/js/entry.js');
// Nova::style('markdown', __DIR__.'/../dist/css/entry.css');
Nova::script('nova-markdown', __DIR__.'/../dist/js/field.js');
});
}

private function declareConfig()
{
$this->mergeConfigFrom(
__DIR__.'/../config/nova-markdown.php',
'nova-markdown'
);
}

/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
2 changes: 1 addition & 1 deletion src/Markdown.php → src/NovaMarkdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Markdown extends Field implements FilterableField
*
* @var string
*/
public $component = 'markdown';
public $component = 'nova-markdown';

/**
* Indicates if the element should be shown on the index view.
Expand Down
24 changes: 8 additions & 16 deletions webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
let mix = require('laravel-mix');
let path = require('path');
let mix = require('laravel-mix')
let path = require('path')

require('./nova.mix')

mix
.setPublicPath('dist')
.js('resources/js/entry.js', 'js')
.vue({ version: 3 })
.webpackConfig({
externals: {
vue: 'Vue',
},
output: {
uniqueName: 'stepanenko3/nova-markdown',
},
})
.alias({
'laravel-nova': path.join(__dirname, 'vendor/laravel/nova/resources/js/mixins/packages.js'),
});
.setPublicPath('dist')
.js('resources/js/field.js', 'js')
.vue({ version: 3 })
.nova('stepanenko3/nova-markdown')
Loading

0 comments on commit 5c725d6

Please sign in to comment.