forked from AkkomaGang/akkoma-fe
Compare commits
6 commits
develop
...
woodpecker
Author | SHA1 | Date | |
---|---|---|---|
01c4aec4f3 | |||
93bca5f851 | |||
079035670a | |||
c30e11139d | |||
c3da5db3dd | |||
c7e9ccd318 |
3 changed files with 50 additions and 22 deletions
48
.woodpecker.yml
Normal file
48
.woodpecker.yml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
pipeline:
|
||||||
|
lint:
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
image: node:16
|
||||||
|
commands:
|
||||||
|
- yarn
|
||||||
|
- yarn lint
|
||||||
|
- yarn stylelint
|
||||||
|
|
||||||
|
test:
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
image: node:16
|
||||||
|
commands:
|
||||||
|
- apt update
|
||||||
|
- apt install firefox-esr -y --no-install-recommends
|
||||||
|
- yarn
|
||||||
|
- yarn unit
|
||||||
|
|
||||||
|
build:
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
image: node:16
|
||||||
|
commands:
|
||||||
|
- yarn
|
||||||
|
- yarn build
|
||||||
|
|
||||||
|
release:
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
image: node:16
|
||||||
|
secrets:
|
||||||
|
- SCW_ACCESS_KEY
|
||||||
|
- SCW_SECRET_KEY
|
||||||
|
- SCW_DEFAULT_ORGANIZATION_ID
|
||||||
|
commands:
|
||||||
|
- apt-get update && apt-get install -y rclone wget zip
|
||||||
|
- wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64
|
||||||
|
- mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli
|
||||||
|
- chmod +x scaleway-cli
|
||||||
|
- ./scaleway-cli object config install type=rclone
|
||||||
|
- zip akkoma-fe.zip -r dist
|
||||||
|
- rclone copyto akkoma-fe.zip scaleway:akkoma-updates/frontend/akkoma-fe.zip
|
|
@ -112,23 +112,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderLink = (attrs, children) => {
|
|
||||||
const updatedLink = attrs['href'].replace(/&/g, '&')
|
|
||||||
const updatedChildren = children.map(child => {
|
|
||||||
if (typeof child === 'string') {
|
|
||||||
return child.replace(attrs['href'], updatedLink)
|
|
||||||
}
|
|
||||||
if (child[0] === '<span>') {
|
|
||||||
return <span>
|
|
||||||
{ child[1] }
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
return child[1]
|
|
||||||
})
|
|
||||||
return <a {...{ attrs }} href={updatedLink}>
|
|
||||||
{ ...updatedChildren }
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
// Processor to use with html_tree_converter
|
// Processor to use with html_tree_converter
|
||||||
const processItem = (item, index, array, what) => {
|
const processItem = (item, index, array, what) => {
|
||||||
// Handle text nodes - just add emoji
|
// Handle text nodes - just add emoji
|
||||||
|
@ -193,9 +176,6 @@ export default {
|
||||||
return renderMention(attrs, children)
|
return renderMention(attrs, children)
|
||||||
} else {
|
} else {
|
||||||
currentMentions = null
|
currentMentions = null
|
||||||
if (attrs['href']) {
|
|
||||||
return renderLink(attrs, children)
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'span':
|
case 'span':
|
||||||
|
|
|
@ -44,12 +44,12 @@ describe('RichContent', () => {
|
||||||
const html = [
|
const html = [
|
||||||
p('Testing 'em all'),
|
p('Testing 'em all'),
|
||||||
'Testing 'em all',
|
'Testing 'em all',
|
||||||
'<a href="http://example.com?a=1&b=2">http://example.com?a=1&b=2</a>'
|
'<a href="http://example.com?a=1">http://example.com?a=1</a>'
|
||||||
].join('')
|
].join('')
|
||||||
const expected = [
|
const expected = [
|
||||||
p('Testing \'em all'),
|
p('Testing \'em all'),
|
||||||
'Testing \'em all',
|
'Testing \'em all',
|
||||||
'<a href="http://example.com?a=1&b=2">http://example.com?a=1&b=2</a>'
|
'<a href="http://example.com?a=1" target="_blank">http://example.com?a=1</a>'
|
||||||
].join('')
|
].join('')
|
||||||
const wrapper = shallowMount(RichContent, {
|
const wrapper = shallowMount(RichContent, {
|
||||||
global,
|
global,
|
||||||
|
|
Loading…
Reference in a new issue