Skip to content

Commit

Permalink
remove remaining webpack stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Sep 17, 2024
1 parent a88673b commit 9db6cb0
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
npm ci
npm run build --if-present
- name: Check webpack build changes
- name: Check build changes
run: |
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
Expand Down
1 change: 1 addition & 0 deletions .nextcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
/renovate.json
/stylelint.config.js
/webpack.config.js
/vite.config.ts
/webpack.js
tests
1 change: 1 addition & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ appstore: clean
--exclude=/src \
--exclude=translationfiles \
--exclude=webpack.* \
--exclude=/vite.* \
--exclude=stylelint.config.js \
--exclude=.eslintrc.js \
--exclude=.github \
Expand Down
27 changes: 1 addition & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
"v-click-outside": "^3.2.0",
"vue": "^2.7.12",
"vue-clipboard2": "^0.3.3",
"vue-material-design-icons": "^5.1.2",
"vue2-audio-recorder": "^1.0.4"
"vue-material-design-icons": "^5.1.2"
},
"devDependencies": {
"@nextcloud/babel-config": "^1.0.0",
Expand Down
42 changes: 19 additions & 23 deletions src/assistant.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { TASK_STATUS_STRING } from './constants.js'
// import { linkTo } from '@nextcloud/router'
// import { getRequestToken } from '@nextcloud/auth'
import { showError } from '@nextcloud/dialogs'

// __webpack_nonce__ = btoa(getRequestToken()) // eslint-disable-line
// __webpack_public_path__ = linkTo('assistant', 'js/') // eslint-disable-line
window.assistantPollTimerId = null

// TODO add param to lock on specific task type
Expand Down Expand Up @@ -50,8 +46,8 @@ export async function openAssistantForm({
isInsideViewer = undefined, closeOnResult = false, actionButtons = undefined,
customId = '', identifier = '',
}) {
const { default: Vue } = await import(/* webpackChunkName: "vue-lazy" */'vue')
const { default: AssistantTextProcessingModal } = await import(/* webpackChunkName: "assistant-modal-lazy" */'./components/AssistantTextProcessingModal.vue')
const { default: Vue } = await import('vue')
const { default: AssistantTextProcessingModal } = await import('./components/AssistantTextProcessingModal.vue')
Vue.mixin({ methods: { t, n } })

// fallback to the last used one
Expand Down Expand Up @@ -197,22 +193,22 @@ export async function cancelTaskPolling() {

export async function getTask(taskId) {
window.assistantAbortController = new AbortController()
const { default: axios } = await import(/* webpackChunkName: "axios-lazy" */'@nextcloud/axios')
const { generateOcsUrl } = await import(/* webpackChunkName: "router-gen-lazy" */'@nextcloud/router')
const { default: axios } = await import('@nextcloud/axios')
const { generateOcsUrl } = await import('@nextcloud/router')
const url = generateOcsUrl('taskprocessing/task/{taskId}', { taskId })
return axios.get(url, { signal: window.assistantAbortController.signal })
}

export async function setNotifyReady(taskId) {
const { default: axios } = await import(/* webpackChunkName: "axios-lazy" */'@nextcloud/axios')
const { generateOcsUrl } = await import(/* webpackChunkName: "router-gen-lazy" */'@nextcloud/router')
const { default: axios } = await import('@nextcloud/axios')
const { generateOcsUrl } = await import('@nextcloud/router')
const url = generateOcsUrl('/apps/assistant/api/v1/task/{taskId}/notify', { taskId })
return axios.post(url, {})
}

export async function cancelTask(taskId) {
const { default: axios } = await import(/* webpackChunkName: "axios-lazy" */'@nextcloud/axios')
const { generateOcsUrl } = await import(/* webpackChunkName: "router-gen-lazy" */'@nextcloud/router')
const { default: axios } = await import('@nextcloud/axios')
const { generateOcsUrl } = await import('@nextcloud/router')
const url = generateOcsUrl('taskprocessing/task/{taskId}', { taskId })
return axios.delete(url, {})
}
Expand All @@ -228,8 +224,8 @@ export async function cancelTask(taskId) {
*/
export async function scheduleTask(appId, customId, taskType, inputs) {
window.assistantAbortController = new AbortController()
const { default: axios } = await import(/* webpackChunkName: "axios-lazy" */'@nextcloud/axios')
const { generateOcsUrl } = await import(/* webpackChunkName: "router-gen-lazy" */'@nextcloud/router')
const { default: axios } = await import('@nextcloud/axios')
const { generateOcsUrl } = await import('@nextcloud/router')
saveLastSelectedTaskType(taskType)
const url = generateOcsUrl('taskprocessing/schedule')
const params = {
Expand All @@ -242,8 +238,8 @@ export async function scheduleTask(appId, customId, taskType, inputs) {
}

async function saveLastSelectedTaskType(taskType) {
const { default: axios } = await import(/* webpackChunkName: "axios-lazy" */'@nextcloud/axios')
const { generateUrl } = await import(/* webpackChunkName: "router-gen-lazy" */'@nextcloud/router')
const { default: axios } = await import('@nextcloud/axios')
const { generateUrl } = await import('@nextcloud/router')

const req = {
values: {
Expand All @@ -255,8 +251,8 @@ async function saveLastSelectedTaskType(taskType) {
}

async function getLastSelectedTaskType() {
const { default: axios } = await import(/* webpackChunkName: "axios-lazy" */'@nextcloud/axios')
const { generateUrl } = await import(/* webpackChunkName: "router-gen-lazy" */'@nextcloud/router')
const { default: axios } = await import('@nextcloud/axios')
const { generateUrl } = await import('@nextcloud/router')

const req = {
params: {
Expand Down Expand Up @@ -316,10 +312,10 @@ async function showAssistantTaskResult(taskId) {
* @return {Promise<void>}
*/
export async function openAssistantTask(task, { isInsideViewer = undefined, actionButtons = undefined } = {}) {
const { default: Vue } = await import(/* webpackChunkName: "vue-lazy" */'vue')
const { default: Vue } = await import('vue')
Vue.mixin({ methods: { t, n } })
const { showError } = await import(/* webpackChunkName: "dialogs-lazy" */'@nextcloud/dialogs')
const { default: AssistantTextProcessingModal } = await import(/* webpackChunkName: "assistant-modal-lazy" */'./components/AssistantTextProcessingModal.vue')
const { showError } = await import('@nextcloud/dialogs')
const { default: AssistantTextProcessingModal } = await import('./components/AssistantTextProcessingModal.vue')

const modalId = 'assistantTextProcessingModal'
const modalElement = document.createElement('div')
Expand Down Expand Up @@ -432,8 +428,8 @@ export async function addAssistantMenuEntry() {
menuEntry.id = 'assistant'
headerRight.prepend(menuEntry)

const { default: Vue } = await import(/* webpackChunkName: "vue-lazy" */'vue')
const { default: AssistantHeaderMenuEntry } = await import(/* webpackChunkName: "assistant-header-lazy" */'./components/AssistantHeaderMenuEntry.vue')
const { default: Vue } = await import('vue')
const { default: AssistantHeaderMenuEntry } = await import('./components/AssistantHeaderMenuEntry.vue')
Vue.mixin({ methods: { t, n } })

const View = Vue.extend(AssistantHeaderMenuEntry)
Expand Down
10 changes: 2 additions & 8 deletions src/imageGenerationReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@

import { registerCustomPickerElement, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Components/NcRichText.js'

// import { linkTo } from '@nextcloud/router'
// import { getRequestToken } from '@nextcloud/auth'

// __webpack_nonce__ = btoa(getRequestToken()) // eslint-disable-line
// __webpack_public_path__ = linkTo('assistant', 'js/') // eslint-disable-line

registerCustomPickerElement('assistant_image_generation', async (el, { providerId, accessible }) => {
const { default: Vue } = await import(/* webpackChunkName: "vue-lazy" */'vue')
const { default: Vue } = await import('vue')
Vue.mixin({ methods: { t, n } })
const { default: ImageResultCustomPickerElement } = await import(/* webpackChunkName: "reference-picker-lazy" */'./views/ImageResultCustomPickerElement.vue')
const { default: ImageResultCustomPickerElement } = await import('./views/ImageResultCustomPickerElement.vue')
const Element = Vue.extend(ImageResultCustomPickerElement)

const vueElement = new Element({
Expand Down
9 changes: 2 additions & 7 deletions src/speechToTextReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,11 @@
*/

import { registerCustomPickerElement, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Components/NcRichText.js'
// import { linkTo } from '@nextcloud/router'
// import { getRequestToken } from '@nextcloud/auth'

// __webpack_nonce__ = btoa(getRequestToken()) // eslint-disable-line
// __webpack_public_path__ = linkTo('assistant', 'js/') // eslint-disable-line

registerCustomPickerElement('assistant_speech_to_text', async (el, { providerId, accessible }) => {
const { default: Vue } = await import(/* webpackChunkName: "vue-lazy" */'vue')
const { default: Vue } = await import('vue')
Vue.mixin({ methods: { t, n } })
const { default: TextResultCustomPickerElement } = await import(/* webpackChunkName: "reference-picker-lazy" */'./views/TextResultCustomPickerElement.vue')
const { default: TextResultCustomPickerElement } = await import('./views/TextResultCustomPickerElement.vue')
const Element = Vue.extend(TextResultCustomPickerElement)
const vueElement = new Element({
propsData: {
Expand Down
10 changes: 2 additions & 8 deletions src/textGenerationReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@

import { registerCustomPickerElement, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Components/NcRichText.js'

// import { linkTo } from '@nextcloud/router'
// import { getRequestToken } from '@nextcloud/auth'

// __webpack_nonce__ = btoa(getRequestToken()) // eslint-disable-line
// __webpack_public_path__ = linkTo('assistant', 'js/') // eslint-disable-line

registerCustomPickerElement('assistant_text', async (el, { providerId, accessible }) => {
const { default: Vue } = await import(/* webpackChunkName: "vue-lazy" */'vue')
const { default: Vue } = await import('vue')
Vue.mixin({ methods: { t, n } })
const { default: TextResultCustomPickerElement } = await import(/* webpackChunkName: "reference-picker-lazy" */'./views/TextResultCustomPickerElement.vue')
const { default: TextResultCustomPickerElement } = await import('./views/TextResultCustomPickerElement.vue')
const Element = Vue.extend(TextResultCustomPickerElement)
const vueElement = new Element({
propsData: {
Expand Down
46 changes: 0 additions & 46 deletions webpack.js

This file was deleted.

0 comments on commit 9db6cb0

Please sign in to comment.