Merge branch 'master' of ssh://repo.prod.meissa.de:2222/meissa/dda-masto-embed
This commit is contained in:
commit
e2f74a7109
10 changed files with 200 additions and 168 deletions
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
|
@ -1,3 +0,0 @@
|
||||||
# These are supported funding model platforms
|
|
||||||
|
|
||||||
github: jerger
|
|
117
.github/workflows/stable.yml
vendored
117
.github/workflows/stable.yml
vendored
|
@ -1,117 +0,0 @@
|
||||||
name: stable
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '[0-9]+.[0-9]+.[0-9]+'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stable:
|
|
||||||
name: stable
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [14.x]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
|
|
||||||
- name: test em
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm install -g --save-dev shadow-cljs
|
|
||||||
shadow-cljs compile test
|
|
||||||
|
|
||||||
- name: build em
|
|
||||||
run: |
|
|
||||||
shadow-cljs release frontend
|
|
||||||
sha256sum public/js/main.js > target/dda-masto-embed.js.sha256
|
|
||||||
sha512sum public/js/main.js > target/dda-masto-embed.js.sha512
|
|
||||||
shadow-cljs run shadow.cljs.build-report frontend target/build-report.html
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
id: create_release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.ref }}
|
|
||||||
release_name: Release ${{ github.ref }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
- name: Upload masto-embed.js
|
|
||||||
id: upload-masto-embed-js
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: public/js/main.js
|
|
||||||
asset_name: dda-masto-embed.js
|
|
||||||
asset_content_type: application/javascript
|
|
||||||
|
|
||||||
- name: Upload masto-embed.js.sha256
|
|
||||||
id: upload-masto-embed-js-sha256
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: target/dda-masto-embed.js.sha256
|
|
||||||
asset_name: dda-masto-embed.js.sha256
|
|
||||||
asset_content_type: text/plain
|
|
||||||
|
|
||||||
- name: Upload masto-embed.js.sha512
|
|
||||||
id: upload-masto-embed-js-sha512
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: target/dda-masto-embed.js.sha512
|
|
||||||
asset_name: dda-masto-embed.js.sha512
|
|
||||||
asset_content_type: text/plain
|
|
||||||
|
|
||||||
- name: Upload build report
|
|
||||||
id: build-report
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: target/build-report.html
|
|
||||||
asset_name: build-report.html
|
|
||||||
asset_content_type: text/html
|
|
||||||
|
|
||||||
- name: upload to npm
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
run: |
|
|
||||||
mkdir -p target/npm-build/
|
|
||||||
cp public/js/main.js target/npm-build/dda-masto-embed.js
|
|
||||||
cp target/dda-masto-embed.js.sha256 target/npm-build/
|
|
||||||
cp target/dda-masto-embed.js.sha512 target/npm-build/
|
|
||||||
cp package.json target/npm-build/
|
|
||||||
cp README.md target/npm-build/
|
|
||||||
cp -r doc target/npm-build/
|
|
||||||
cp LICENSE target/npm-build/
|
|
||||||
npm publish target/npm-build --access public
|
|
41
.github/workflows/unstable.yml
vendored
41
.github/workflows/unstable.yml
vendored
|
@ -1,41 +0,0 @@
|
||||||
name: unstable
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '![0-9]+.[0-9]+.[0-9]+'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
unstable:
|
|
||||||
name: unstable
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [14.x]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
|
|
||||||
- name: test em
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm install -g --save-dev shadow-cljs
|
|
||||||
shadow-cljs compile test
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -21,3 +21,5 @@ node_modules/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
/.lsp/
|
/.lsp/
|
||||||
/.clj-kondo/
|
/.clj-kondo/
|
||||||
|
|
||||||
|
*.pyc
|
55
.gitlab-ci.yml
Normal file
55
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
stages:
|
||||||
|
- build_and_test
|
||||||
|
- package
|
||||||
|
- upload
|
||||||
|
|
||||||
|
.cljs-job: &cljs
|
||||||
|
image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.11.3"
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
- .shadow-cljs/
|
||||||
|
- .m2
|
||||||
|
before_script:
|
||||||
|
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
||||||
|
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
||||||
|
- npm install
|
||||||
|
|
||||||
|
.tag_only: &tag_only
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
when: never
|
||||||
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||||
|
|
||||||
|
test-cljs:
|
||||||
|
<<: *cljs
|
||||||
|
stage: build_and_test
|
||||||
|
script:
|
||||||
|
- pyb test_cljs
|
||||||
|
|
||||||
|
report-frontend:
|
||||||
|
<<: *cljs
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- pyb report_frontend
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/build-report.html
|
||||||
|
|
||||||
|
package-frontend:
|
||||||
|
<<: *cljs
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- pyb package_frontend
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/
|
||||||
|
|
||||||
|
release-to-forgejo:
|
||||||
|
<<: *cljs
|
||||||
|
<<: *tag_only
|
||||||
|
stage: upload
|
||||||
|
script:
|
||||||
|
- pyb publish_artifacts
|
||||||
|
|
133
build.py
Normal file
133
build.py
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
from os import environ
|
||||||
|
from subprocess import run
|
||||||
|
from pybuilder.core import init, task
|
||||||
|
from ddadevops import *
|
||||||
|
|
||||||
|
default_task = "dev"
|
||||||
|
base_name = "dda-masto-embed"
|
||||||
|
name = 'dda-masto-embed'
|
||||||
|
MODULE = 'not-used'
|
||||||
|
PROJECT_ROOT_PATH = '.'
|
||||||
|
|
||||||
|
version = "0.2.5"
|
||||||
|
|
||||||
|
@init
|
||||||
|
def initialize(project):
|
||||||
|
project.build_depends_on("ddadevops>=4.7.0")
|
||||||
|
|
||||||
|
input = {
|
||||||
|
"name": name,
|
||||||
|
"module": MODULE,
|
||||||
|
"stage": "notused",
|
||||||
|
"project_root_path": PROJECT_ROOT_PATH,
|
||||||
|
"build_types": [],
|
||||||
|
"mixin_types": ["RELEASE"],
|
||||||
|
"release_primary_build_file": "package.json",
|
||||||
|
"release_secondary_build_files": [
|
||||||
|
"build.py"
|
||||||
|
],
|
||||||
|
"release_artifact_server_url": "https://repo.prod.meissa.de",
|
||||||
|
"release_organisation": "meissa",
|
||||||
|
"release_repository_name": name,
|
||||||
|
"release_artifacts": [
|
||||||
|
f"target/{name}.js",
|
||||||
|
],
|
||||||
|
"release_main_branch": "master",
|
||||||
|
}
|
||||||
|
|
||||||
|
build = ReleaseMixin(project, input)
|
||||||
|
build.initialize_build_dir()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def test(project):
|
||||||
|
test_cljs(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def test_cljs(project):
|
||||||
|
run("shadow-cljs compile test", shell=True, check=True)
|
||||||
|
run("node target/node-tests.js", shell=True, check=True)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def report_frontend(project):
|
||||||
|
run("mkdir -p target/frontend-build", shell=True, check=True)
|
||||||
|
run(
|
||||||
|
"shadow-cljs run shadow.cljs.build-report frontend target/build-report.html",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def package_frontend(project):
|
||||||
|
run("mkdir -p target/", shell=True, check=True)
|
||||||
|
run("shadow-cljs release frontend", shell=True, check=True)
|
||||||
|
run(
|
||||||
|
f"cp public/js/main.js target/{name}.js",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
run(
|
||||||
|
f"sha256sum target/{name}.js > target/{name}.js.sha256",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
run(
|
||||||
|
f"sha512sum target/{name}.js > target/{name}.js.sha512",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def patch(project):
|
||||||
|
linttest(project, "PATCH")
|
||||||
|
release(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def minor(project):
|
||||||
|
linttest(project, "MINOR")
|
||||||
|
release(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def major(project):
|
||||||
|
linttest(project, "MAJOR")
|
||||||
|
release(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def dev(project):
|
||||||
|
linttest(project, "NONE")
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def prepare(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.prepare_release()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def tag(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.tag_bump_and_push_release()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def publish_artifacts(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.publish_artifacts()
|
||||||
|
|
||||||
|
|
||||||
|
def release(project):
|
||||||
|
prepare(project)
|
||||||
|
tag(project)
|
||||||
|
|
||||||
|
|
||||||
|
def linttest(project, release_type):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.update_release_type(release_type)
|
||||||
|
test_cljs(project)
|
|
@ -14,9 +14,9 @@
|
||||||
:output-to "target/node-tests.js"
|
:output-to "target/node-tests.js"
|
||||||
:autorun true}
|
:autorun true}
|
||||||
:lib {:target :node-library
|
:lib {:target :node-library
|
||||||
:output-to "target/lib.js"
|
:output-to "target/dda-masto-embed.js"
|
||||||
:exports {:init dda.masto-embed.app/init}
|
:exports {:init dda.masto-embed.app/init}
|
||||||
:release {:compiler-options {:optimizations :simple}}}
|
:release {:compiler-options {:optimizations :advanced}}}
|
||||||
:frontend {:target :browser
|
:frontend {:target :browser
|
||||||
:modules {:main {:init-fn dda.masto-embed.app/init}}
|
:modules {:main {:init-fn dda.masto-embed.app/init}}
|
||||||
:release {}}}}
|
:release {}}}}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
[:li {:class "list-group-item, card"}
|
[:li {:class "list-group-item, card"}
|
||||||
[:div {:class "card-body"}
|
[:div {:class "card-body"}
|
||||||
[:h2 {:class "card-title"}
|
[:h2 {:class "card-title"}
|
||||||
[:a {:href (get-in status [:account :url])}
|
[:a {:href (get-in status [:url])}
|
||||||
(t/unparse (t/formatters :date) date) " "
|
(t/unparse (t/formatters :date) date) " "
|
||||||
(t/unparse (t/formatters :hour-minute-second) date)]]
|
(t/unparse (t/formatters :hour-minute-second) date)]]
|
||||||
[:p {:class "card-text"}
|
[:p {:class "card-text"}
|
||||||
|
@ -57,11 +57,12 @@
|
||||||
(<p! (api/get-directory host-url))
|
(<p! (api/get-directory host-url))
|
||||||
api/mastojs->edn
|
api/mastojs->edn
|
||||||
(filter #(= account-name (:acct %)))
|
(filter #(= account-name (:acct %)))
|
||||||
(infra/debug)
|
|
||||||
(map :id)
|
(map :id)
|
||||||
first)))
|
first)))
|
||||||
out))
|
out))
|
||||||
|
|
||||||
|
; (infra/debug)
|
||||||
|
|
||||||
(defn account-mode [host-url account-name]
|
(defn account-mode [host-url account-name]
|
||||||
(go
|
(go
|
||||||
(let [account-id (<! (find-account-id host-url account-name))
|
(let [account-id (<! (find-account-id host-url account-name))
|
||||||
|
@ -69,6 +70,8 @@
|
||||||
(<p! (api/get-account-statuses host-url account-id))
|
(<p! (api/get-account-statuses host-url account-id))
|
||||||
api/mastojs->edn)]
|
api/mastojs->edn)]
|
||||||
(->> statuus
|
(->> statuus
|
||||||
|
(filter #(= nil (:reblog %)))
|
||||||
|
(filter #(= nil (:in_reply_to_account_id %)))
|
||||||
(take 4)
|
(take 4)
|
||||||
(masto->html)
|
(masto->html)
|
||||||
(render-html)
|
(render-html)
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
(is (= [:ul {:class "list-group"}
|
(is (= [:ul {:class "list-group"}
|
||||||
'([:li {:class "list-group-item, card"}
|
'([:li {:class "list-group-item, card"}
|
||||||
[:div {:class "card-body"}
|
[:div {:class "card-body"}
|
||||||
[:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/@team"} "2020-05-17" " " "10:12:10"]]
|
[:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"} "2020-05-17" " " "10:12:10"]]
|
||||||
[:p {:class "card-text"} "<p>We've a new asciicast ... </p>"
|
[:p {:class "card-text"} "<p>We've a new asciicast ... </p>"
|
||||||
nil]]])]
|
nil]]])]
|
||||||
(sut/masto->html statuses))))
|
(sut/masto->html statuses))))
|
||||||
|
@ -192,4 +192,4 @@
|
||||||
[:img {:class "card-img-top", :src "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/017/635/original/5634071238f1f91f.png"}]
|
[:img {:class "card-img-top", :src "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/017/635/original/5634071238f1f91f.png"}]
|
||||||
[:h3 {:class "card-title"} "DomainDrivenArchitecture/cryogen-core"]
|
[:h3 {:class "card-title"} "DomainDrivenArchitecture/cryogen-core"]
|
||||||
[:p {:class "card-body"} "Cryogen's core. Contribute to DomainDrivenArchitecture/cryogen-core development by creating an account on GitHub."]]
|
[:p {:class "card-body"} "Cryogen's core. Contribute to DomainDrivenArchitecture/cryogen-core development by creating an account on GitHub."]]
|
||||||
(sut/mastocard->html link-card-with-image))))
|
(sut/mastocard->html link-card-with-image))))
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
[:div {:class "card-body row"}
|
[:div {:class "card-body row"}
|
||||||
[:div {:class "col-sm"}
|
[:div {:class "col-sm"}
|
||||||
[:h2 {:class "card-title"}
|
[:h2 {:class "card-title"}
|
||||||
[:a {:href "https://social.meissa-gmbh.de/@jerger/107937257700481042"} "2022-03-11" " " "09:44:07"]]
|
[:a {:href "https://social.meissa-gmbh.de/@jerger/107937257700481042"} "11.03.2022" " "]]
|
||||||
[:div {:class "card-text"} "<p><span class=\"h-card\"><a href=\"https://social.meissa-gmbh.de/@team\" class=\"u-url mention\">@<span>team</span></a></span> Hier mein erstes Bild :-)</p>"]]
|
[:div {:class "card-text"} "<p><span class=\"h-card\"><a href=\"https://social.meissa-gmbh.de/@team\" class=\"u-url mention\">@<span>team</span></a></span> Hier mein erstes Bild :-)</p>"]]
|
||||||
[:div {:class "col-sm"}
|
[:div {:class "col-sm"}
|
||||||
[:div {:class "media"}
|
[:div {:class "media"}
|
||||||
|
|
Loading…
Reference in a new issue