mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-12 13:42:38 +00:00
Fix svelte-check errors (#8127)
Some checks are pending
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
90371ecada
commit
9103e96606
19
common/scripts/svelte-check-show.sh
Executable file
19
common/scripts/svelte-check-show.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
roots=$(rush list -p --json | grep "path" | cut -f 2 -d ':' | cut -f 2 -d '"')
|
||||
files="svelte-check.log svelte-check-err.log"
|
||||
for file in $roots; do
|
||||
for check in $files; do
|
||||
f="$file/.svelte-check/$check"
|
||||
if [ -f $f ]; then
|
||||
if grep -q "error" "$f"; then
|
||||
if ! grep -q "0 errors" "$f"; then
|
||||
if ! grep -q "error.ts" "$f"; then
|
||||
echo "\nErrors in $f\n"
|
||||
cat "$f" | grep -B1 "Error:" | grep -v "^--$" | sed "s/Error:/$(echo '\033[31m')Error:$(echo '\033[0m')/"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
@ -1,10 +1,47 @@
|
||||
const { join, dirname } = require("path")
|
||||
const { join, dirname } = require('path')
|
||||
const { readFileSync, existsSync, mkdirSync, createWriteStream } = require('fs')
|
||||
const { spawn } = require('child_process')
|
||||
|
||||
function parseSvelteCheckLog(logContent) {
|
||||
const lines = logContent.split('\n')
|
||||
const errors = []
|
||||
let currentError = null
|
||||
|
||||
let pline = ''
|
||||
for (const line of lines) {
|
||||
if (line.includes('Error:')) {
|
||||
// Start of a new error
|
||||
if (currentError) {
|
||||
errors.push(currentError)
|
||||
}
|
||||
currentError = {
|
||||
file: pline,
|
||||
message: line.split('Error:')[1].trim()
|
||||
}
|
||||
} else if (line.includes('====================================')) {
|
||||
// End of log, push last error if exists
|
||||
if (currentError) {
|
||||
errors.push(currentError)
|
||||
}
|
||||
break
|
||||
}
|
||||
pline = line
|
||||
}
|
||||
|
||||
// Print errors
|
||||
if (errors.length === 0) {
|
||||
console.log('No errors found')
|
||||
} else {
|
||||
errors.forEach((error) => {
|
||||
console.log(`File: ${error.file}`)
|
||||
console.log(`Message: \x1b[31m ${error.message} \x1b[0m\n`)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function execProcess(cmd, logFile, args, useConsole) {
|
||||
let compileRoot = dirname(dirname(process.argv[1]))
|
||||
console.log("Svelte check...\n", process.cwd(), args)
|
||||
console.log('Svelte check...\n')
|
||||
|
||||
if (!existsSync(join(process.cwd(), '.svelte-check'))) {
|
||||
mkdirSync(join(process.cwd(), '.svelte-check'))
|
||||
@ -15,16 +52,15 @@ async function execProcess(cmd, logFile, args, useConsole) {
|
||||
const stdoutFilePath = `.svelte-check/${logFile}.log`
|
||||
const stderrFilePath = `.svelte-check/${logFile}-err.log`
|
||||
|
||||
|
||||
const outPromise = new Promise((resolve) => {
|
||||
if (compileOut.stdout != null) {
|
||||
let outPipe = createWriteStream(stdoutFilePath)
|
||||
compileOut.stdout.pipe(outPipe)
|
||||
compileOut.stdout.on('end', function (data) {
|
||||
outPipe.close()
|
||||
if( useConsole ) {
|
||||
console.log(readFileSync(stdoutFilePath).toString())
|
||||
console.log(readFileSync(stderrFilePath).toString())
|
||||
if (useConsole) {
|
||||
const data = readFileSync(stdoutFilePath).toString() + readFileSync(stderrFilePath).toString()
|
||||
parseSvelteCheckLog(data)
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
@ -47,7 +83,7 @@ async function execProcess(cmd, logFile, args, useConsole) {
|
||||
})
|
||||
|
||||
let editCode = 0
|
||||
const closePromise = new Promise(resolve => {
|
||||
const closePromise = new Promise((resolve) => {
|
||||
compileOut.on('close', (code) => {
|
||||
editCode = code
|
||||
resolve()
|
||||
@ -61,30 +97,26 @@ async function execProcess(cmd, logFile, args, useConsole) {
|
||||
await Promise.all([outPromise, errPromise, closePromise])
|
||||
|
||||
if (editCode !== 0) {
|
||||
const data = readFileSync(stdoutFilePath)
|
||||
const errData = readFileSync(stderrFilePath)
|
||||
console.error('\n' + data.toString() + '\n' + errData.toString())
|
||||
if( !useConsole) {
|
||||
const data = readFileSync(stdoutFilePath).toString()
|
||||
const errData = readFileSync(stderrFilePath).toString()
|
||||
parseSvelteCheckLog(data)
|
||||
console.error('\n' + errData.toString())
|
||||
}
|
||||
process.exit(editCode)
|
||||
}
|
||||
}
|
||||
|
||||
let args = [] // process.argv.slice(2)
|
||||
let useConsole = false
|
||||
for(const a of process.argv.slice(2)) {
|
||||
if( a === '--console') {
|
||||
for (const a of process.argv.slice(2)) {
|
||||
if (a === '--console') {
|
||||
useConsole = true
|
||||
} else {
|
||||
args.push(a)
|
||||
}
|
||||
}
|
||||
let st = performance.now()
|
||||
execProcess(
|
||||
'svelte-check',
|
||||
'svelte-check', [
|
||||
'--output', 'human',
|
||||
...args
|
||||
], useConsole)
|
||||
.then(() => {
|
||||
console.log("Svelte check time: ", Math.round((performance.now() - st) * 100) / 100)
|
||||
})
|
||||
|
||||
execProcess('svelte-check', 'svelte-check', ['--output', 'human', ...args], useConsole).then(() => {
|
||||
console.log('Svelte check time: ', Math.round((performance.now() - st) * 100) / 100)
|
||||
})
|
||||
|
@ -40,7 +40,6 @@
|
||||
"eslint-config-standard-with-typescript": "^40.0.0",
|
||||
"prettier": "^3.1.0",
|
||||
"typescript": "^5.3.3",
|
||||
"svelte": "^4.2.19",
|
||||
"jest": "^29.7.0",
|
||||
"ts-jest": "^29.1.1",
|
||||
"@types/jest": "^29.5.5"
|
||||
|
@ -29,7 +29,7 @@ index 3aa8590..6b64999 100644
|
||||
+++ b/${fileName}
|
||||
`
|
||||
|
||||
$: diffFiles = parseDiff(prefix + patch ?? '')
|
||||
$: diffFiles = parseDiff(prefix + patch)
|
||||
</script>
|
||||
|
||||
{#each diffFiles as diffFile}
|
||||
|
@ -24,14 +24,11 @@
|
||||
import attachment, { Attachment } from '@hcengineering/attachment'
|
||||
import { AttachmentPresenter } from '@hcengineering/attachment-resources'
|
||||
import { getEmbeddedLabel } from '@hcengineering/platform'
|
||||
import core, { Ref } from '@hcengineering/core'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
|
||||
export let currentMessage: SharedMessage
|
||||
export let newMessage: boolean
|
||||
|
||||
let editor: HTMLDivElement
|
||||
$: if (editor) editor.innerHTML = currentMessage.content
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const hasError = (currentMessage as unknown as NewMessage)?.status === 'error'
|
||||
|
||||
|
@ -63,9 +63,8 @@
|
||||
{/if}
|
||||
{#if isError}
|
||||
<div class="error-color top-divider mt-2 pt-2">
|
||||
Error: {errorMessage?.error
|
||||
? JSON.parse(errorMessage.error)?.data?.error_description
|
||||
: undefined ?? 'unknown error'}
|
||||
Error: {(errorMessage?.error ? JSON.parse(errorMessage.error)?.data?.error_description : undefined) ??
|
||||
'unknown error'}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
@ -69,7 +69,7 @@
|
||||
<div class="flex-row-center flex-gap-4">
|
||||
<Label label={love.string.StartWithMutedMic} />
|
||||
<Toggle
|
||||
on={!$myPreferences?.micEnabled ?? false}
|
||||
on={!($myPreferences?.micEnabled ?? false)}
|
||||
on:change={(e) => {
|
||||
saveMicPreference($myPreferences, e.detail)
|
||||
}}
|
||||
@ -78,7 +78,7 @@
|
||||
<div class="flex-row-center flex-gap-4">
|
||||
<Label label={love.string.StartWithoutVideo} />
|
||||
<Toggle
|
||||
on={!$myPreferences?.camEnabled ?? false}
|
||||
on={!($myPreferences?.camEnabled ?? false)}
|
||||
on:change={(e) => {
|
||||
saveCamPreference($myPreferences, e.detail)
|
||||
}}
|
||||
|
@ -92,8 +92,7 @@
|
||||
}
|
||||
)
|
||||
const countSorting = (a: Doc, b: Doc) =>
|
||||
(tagElements?.get(b._id as Ref<TagElement>)?.count ?? 0) -
|
||||
(tagElements?.get(a._id as Ref<TagElement>)?.count ?? 0) ?? 0
|
||||
(tagElements?.get(b._id as Ref<TagElement>)?.count ?? 0) - (tagElements?.get(a._id as Ref<TagElement>)?.count ?? 0)
|
||||
|
||||
let visibleCategories: TagCategory[] = []
|
||||
</script>
|
||||
|
@ -52,8 +52,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
let content: HTMLElement
|
||||
|
||||
$: if (oldLabel !== object?.name) {
|
||||
oldLabel = object?.name
|
||||
rawLabel = object?.name
|
||||
@ -102,7 +100,6 @@
|
||||
bind:this={descriptionBox}
|
||||
identifier={object?._id}
|
||||
placeholder={testManagement.string.DescriptionPlaceholder}
|
||||
boundary={content}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -37,8 +37,6 @@
|
||||
|
||||
let descriptionBox: AttachmentStyleBoxCollabEditor
|
||||
|
||||
let content: HTMLElement
|
||||
|
||||
$: descriptionKey = hierarchy.getAttribute(testManagement.class.TestResult, 'description')
|
||||
|
||||
onMount(() => dispatch('open', { ignoreKeys: [] }))
|
||||
@ -57,7 +55,6 @@
|
||||
bind:this={descriptionBox}
|
||||
identifier={object?._id}
|
||||
placeholder={testManagement.string.DescriptionPlaceholder}
|
||||
boundary={content}
|
||||
/>
|
||||
</div>
|
||||
{#if !withoutActivity}
|
||||
@ -67,8 +64,7 @@
|
||||
props={{
|
||||
object,
|
||||
showCommenInput: true,
|
||||
focusIndex: 1000,
|
||||
boundary: content
|
||||
focusIndex: 1000
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -51,8 +51,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
let content: HTMLElement
|
||||
|
||||
$: if (oldLabel !== object?.name) {
|
||||
oldLabel = object?.name
|
||||
rawLabel = object?.name
|
||||
@ -98,7 +96,6 @@
|
||||
bind:this={descriptionBox}
|
||||
identifier={object?._id}
|
||||
placeholder={testManagement.string.DescriptionPlaceholder}
|
||||
boundary={content}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -48,8 +48,6 @@
|
||||
export let requestSideSpace: ((width: number) => void) | undefined = undefined
|
||||
export let enableInlineComments: boolean = true
|
||||
|
||||
let element: HTMLElement
|
||||
|
||||
let collaborativeEditor: CollaborativeTextEditor
|
||||
|
||||
export function commands (): TextEditorCommandHandler | undefined {
|
||||
@ -68,7 +66,7 @@
|
||||
const { idx, focusManager } = registerFocus(focusIndex, {
|
||||
focus: () => {
|
||||
focus()
|
||||
return element !== null
|
||||
return true
|
||||
},
|
||||
isFocus: () => isFocused(),
|
||||
canBlur: () => false
|
||||
|
@ -6,7 +6,7 @@ export const InlinePopupExtension: Extension<BubbleMenuOptions> = BubbleMenu.ext
|
||||
return {
|
||||
...this.parent?.(),
|
||||
pluginKey: 'inline-popup',
|
||||
element: null,
|
||||
element: null as any,
|
||||
tippyOptions: {
|
||||
maxWidth: '46rem',
|
||||
zIndex: 500,
|
||||
|
@ -124,7 +124,7 @@
|
||||
id: s._id,
|
||||
component: StatusPresenter,
|
||||
props: { value: s, size: 'small', space: value.space },
|
||||
isSelected: selectedStatus?._id === s._id ?? false
|
||||
isSelected: selectedStatus?._id === s._id
|
||||
}
|
||||
})
|
||||
$: smallgap = size === 'inline' || size === 'small'
|
||||
|
@ -106,7 +106,7 @@
|
||||
id: s._id,
|
||||
component: StatusPresenter,
|
||||
props: { value: s, size: 'small' },
|
||||
isSelected: selectedStatus?._id === s._id ?? false
|
||||
isSelected: selectedStatus?._id === s._id
|
||||
}
|
||||
}) ?? []
|
||||
const handleStatusEditorOpened = (event: MouseEvent) => {
|
||||
|
@ -58,10 +58,6 @@
|
||||
asideFloat = false
|
||||
asideShown = false
|
||||
}
|
||||
let docWidth: number
|
||||
let docSize: boolean = false
|
||||
$: if (docWidth <= 900 && !docSize) docSize = true
|
||||
$: if (docWidth > 900 && docSize) docSize = false
|
||||
|
||||
const handleViewModeChanged = (newMode: MilestoneViewMode) => {
|
||||
if (newMode === undefined || newMode === mode) {
|
||||
|
@ -48,7 +48,7 @@
|
||||
}
|
||||
}
|
||||
const targetClass = getTargetClass()
|
||||
$: isState = targetClass === core.class.Status ?? false
|
||||
$: isState = targetClass === core.class.Status
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
async function getCountStates (ids: Array<Ref<Doc>>): Promise<number> {
|
||||
|
Loading…
Reference in New Issue
Block a user