Skip to content

Commit

Permalink
Add workflow to automatically update assets, fixes displayUsing and…
Browse files Browse the repository at this point in the history
… reduce `lodash` dist (#164)

* Add workflow to automatically update assets.

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* Update Assets

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* Update Assets

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

Signed-off-by: Mior Muhammad Zaki <[email protected]>
Co-authored-by: crynobone <[email protected]>
  • Loading branch information
crynobone and crynobone authored Sep 1, 2022
1 parent de57bd7 commit 0263aea
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: run-tests
name: "Run Tests"

on: [push, pull_request]

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/update-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Update Assets"

on: [workflow_dispatch]

jobs:
update:
name: Update assets

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node 16
uses: actions/setup-node@v2
with:
node-version: '16.x'

- name: Compile Asset
run: |
yarn install
yarn run production
env:
TAILWIND_MODE: build

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update Assets
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/build
/vendor
/node_modules
auth.json
package-lock.json
composer.phar
composer.lock
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
],
"require": {
"php": "^8.0",
"laravel/nova": "^4.0",
"laravel/nova": "^4.13",
"nova-kit/nova-packages-tool": "^1.2",
"spatie/laravel-tags": "^4.0"
},
"require-dev": {
Expand Down
3 changes: 1 addition & 2 deletions dist/js/field.js

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions dist/js/field.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,3 @@
* (c) 2021 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
*/
17 changes: 9 additions & 8 deletions nova.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ class NovaExtension {
webpackConfig(webpackConfig) {
webpackConfig.externals = {
vue: 'Vue',
'laravel-nova': 'LaravelNova'
}

webpackConfig.resolve.alias = {
...(webpackConfig.resolve.alias || {}),
'laravel-nova': path.join(
__dirname,
'vendor/laravel/nova/resources/js/mixins/packages.js'
),
}
// 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())
mix.extend('nova', new NovaExtension())
14 changes: 13 additions & 1 deletion resources/js/components/Nova/DetailField.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
<template>
<PanelItem :index="index" :field="field">
<template #value>
<p v-html="typeof field.value === 'object' ? field.value.join(', ') : field.value"></p>
<p v-html="tagFieldValue"></p>
</template>
</PanelItem>
</template>

<script>
import { FieldValue } from 'laravel-nova';
export default {
mixins: [FieldValue],
props: ['index', 'resource', 'resourceName', 'resourceId', 'field'],
computed: {
tagFieldValue() {
let fieldValue = this.fieldValue
return typeof fieldValue === 'object' ? fieldValue.join(', ') : fieldValue
},
},
};
</script>
14 changes: 13 additions & 1 deletion resources/js/components/Nova/IndexField.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
<template>
<div
class="py-3 tags-index-field"
v-html="typeof field.value === 'object' ? field.value.join(', ') : field.value"
v-html="tagFieldValue"
></div>
</template>

<script>
import { FieldValue } from 'laravel-nova';
export default {
mixins: [FieldValue],
props: ['resourceName', 'field'],
computed: {
tagFieldValue() {
let fieldValue = this.fieldValue
return typeof fieldValue === 'object' ? fieldValue.join(', ') : fieldValue
},
},
};
</script>
2 changes: 1 addition & 1 deletion resources/js/components/Tags/TagsInput.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { h } from 'vue';
import { throttle } from 'lodash';
import throttle from 'lodash/throttle';
export default {
props: {
Expand Down

0 comments on commit 0263aea

Please sign in to comment.