fix openfeature

This commit is contained in:
weyu 2025-03-31 14:38:15 +08:00
parent 05c20a38c7
commit 3d96b9b5f4
2 changed files with 65 additions and 62 deletions

View File

@ -109,75 +109,75 @@ install_hugo_v145(){
} }
# install_postcss(){ install_postcss(){
# log_info "=============================================> 安装 postCSS" log_info "=============================================> 安装 postCSS"
# npm i -D postcss postcss-cli autoprefixer npm i -D postcss postcss-cli autoprefixer
# } }
# check_cdn_change(){ check_cdn_change(){
# log_info "=============================================> 以下文件进行了 cdn 替换,请确认文件在 https://cdn.cncfstack.com 是否存在" log_info "=============================================> 以下文件进行了 cdn 替换,请确认文件在 https://cdn.cncfstack.com 是否存在"
# grep "cdn.cncfstack.com" ./* -R |grep -v "otocn\.sed"|awk -F':' '{print $1}' grep "cdn.cncfstack.com" ./* -R |grep -v "otocn\.sed"|awk -F':' '{print $1}'
# } }
# check_not_change(){ check_not_change(){
# log_info "=============================================> 以下可能的外部文件未被处理" log_info "=============================================> 以下可能的外部文件未被处理"
# # 有些图标表情使用 CDN 的 SVG这类也可以代理。TODO有些svg中会包含地址这类是不需要处理的但是会grep出来。不移除会有大量的无效信息还是不显示svg内容根据实际情况单独处理 # 有些图标表情使用 CDN 的 SVG这类也可以代理。TODO有些svg中会包含地址这类是不需要处理的但是会grep出来。不移除会有大量的无效信息还是不显示svg内容根据实际情况单独处理
# # raw.githubusercontent.com 是 github 的内容,太多输出了,有依赖单独处理吧 # raw.githubusercontent.com 是 github 的内容,太多输出了,有依赖单独处理吧
# grep -iEo "(maxcdn.bootstrapcdn.com|code.jquery.com|cdnjs.cloudflare.com|cdn-images.mailchimp.com|cdn.jsdelivr.net|fonts.googleapis.com|unpkg.com|www.googletagmanager.com)" ./* -R |grep -vE "(\.sh\:|\.md\:|\.toml|index\.rss\.xml|README\.txt\:|otocn\.sed\:|\.svg\:|node_modules)" grep -iEo "(maxcdn.bootstrapcdn.com|code.jquery.com|cdnjs.cloudflare.com|cdn-images.mailchimp.com|cdn.jsdelivr.net|fonts.googleapis.com|unpkg.com|www.googletagmanager.com)" ./* -R |grep -vE "(\.sh\:|\.md\:|\.toml|index\.rss\.xml|README\.txt\:|otocn\.sed\:|\.svg\:|node_modules)"
# } }
# find_and_sed(){ find_and_sed(){
# # 查找可能存在外部地址的文件, # 查找可能存在外部地址的文件,
# # 对于其他文件即使包含外部地址也不需要处理,比如 svg 图片中的google字体地址 # 对于其他文件即使包含外部地址也不需要处理,比如 svg 图片中的google字体地址
# find . -type f \( -iname "*.txt" \ find . -type f \( -iname "*.txt" \
# -o -iname "*.md" \ -o -iname "*.md" \
# -o -iname "*.toml" \ -o -iname "*.toml" \
# -o -iname "*.js" \ -o -iname "*.js" \
# -o -iname "*.mjs" \ -o -iname "*.mjs" \
# -o -iname "*.html" \ -o -iname "*.html" \
# -o -iname "*.css" \ -o -iname "*.css" \
# -o -iname "*.sass" \ -o -iname "*.sass" \
# -o -iname "*.scss" \ -o -iname "*.scss" \
# -o -iname "*.tpl" \ -o -iname "*.tpl" \
# -o -iname "*.rst" \) > ${workdir}/filelist -o -iname "*.rst" \) > ${workdir}/filelist
# # 循环依次处理可能包含外部链接的文件,并进行替换 # 循环依次处理可能包含外部链接的文件,并进行替换
# for file in `cat ${workdir}/filelist` for file in `cat ${workdir}/filelist`
# do do
# sudo sed -i -f ${initdir}/toto.sed $file sudo sed -i -f ${initdir}/toto.sed $file
# done done
# check_cdn_change check_cdn_change
# check_not_change check_not_change
# } }
# # 可以指定处理的路径,这在构建完成后再进行替换时很有用 # 可以指定处理的路径,这在构建完成后再进行替换时很有用
# find_and_sed_v2(){ find_and_sed_v2(){
# path=$1 path=$1
# # 查找可能存在外部地址的文件, # 查找可能存在外部地址的文件,
# # 对于其他文件即使包含外部地址也不需要处理,比如 svg 图片中的google字体地址 # 对于其他文件即使包含外部地址也不需要处理,比如 svg 图片中的google字体地址
# find $path -type f -iname "*.txt" \ find $path -type f -iname "*.txt" \
# -o -iname "*.md" \ -o -iname "*.md" \
# -o -iname "*.toml" \ -o -iname "*.toml" \
# -o -iname "*.js" \ -o -iname "*.js" \
# -o -iname "*.mjs" \ -o -iname "*.mjs" \
# -o -iname "*.html" \ -o -iname "*.html" \
# -o -iname "*.css" \ -o -iname "*.css" \
# -o -iname "*.sass" \ -o -iname "*.sass" \
# -o -iname "*.scss" \ -o -iname "*.scss" \
# -o -iname "*.tpl" \ -o -iname "*.tpl" \
# -o -iname "*.rst" > ${workdir}/filelist -o -iname "*.rst" > ${workdir}/filelist
# # 循环依次处理可能包含外部链接的文件,并进行替换 # 循环依次处理可能包含外部链接的文件,并进行替换
# for file in `cat ${workdir}/filelist` for file in `cat ${workdir}/filelist`
# do do
# sudo sed -i -f ${initdir}/toto.sed $file sudo sed -i -f ${initdir}/toto.sed $file
# done done
# check_cdn_change check_cdn_change
# #check_not_change #check_not_change
# } }

View File

@ -8,9 +8,10 @@ source ${initdir}/libs/common.sh
before_openfeature(){ before_openfeature(){
git submodule update --init --recursive
yarn install yarn install
log_info "=============================================> 配置文件 docusaurus.config.js 添加 umami" log_info "=============================================> 配置文件 docusaurus.config.ts 添加 umami"
#sed -ri "s|themeConfig:\s*\{|plugins: [()=>({name:'umami-analytics',injectHtmlTags:()=>({headTags:[{tagName:'script',attributes:{defer:true,src:'https://umami.cncfstack.com/script.js','data-website-id':'e560133a-5a27-40ad-b816-9896199ffb01'}}]})})],themeConfig: {|g" docusaurus.config.js #sed -ri "s|themeConfig:\s*\{|plugins: [()=>({name:'umami-analytics',injectHtmlTags:()=>({headTags:[{tagName:'script',attributes:{defer:true,src:'https://umami.cncfstack.com/script.js','data-website-id':'e560133a-5a27-40ad-b816-9896199ffb01'}}]})})],themeConfig: {|g" docusaurus.config.js
sed -ri "s|plugins:\s*\[|plugins: [()=>({name:'umami-analytics',injectHtmlTags:()=>({headTags:[{tagName:'script',attributes:{defer:true,src:'https://umami.cncfstack.com/script.js','data-website-id':'2ef83157-07a7-4bff-a911-e05f83e8663b'}}]})}),|g" docusaurus.config.ts sed -ri "s|plugins:\s*\[|plugins: [()=>({name:'umami-analytics',injectHtmlTags:()=>({headTags:[{tagName:'script',attributes:{defer:true,src:'https://umami.cncfstack.com/script.js','data-website-id':'2ef83157-07a7-4bff-a911-e05f83e8663b'}}]})}),|g" docusaurus.config.ts
@ -27,6 +28,8 @@ after_openfeature(){
log_info "=============================================> 开始 npm run build 构建" log_info "=============================================> 开始 npm run build 构建"
yarn run build yarn run build
log_info "=============================================> 当前目录中文件列表" log_info "=============================================> 当前目录中文件列表"
ls -lh ls -lh
@ -40,7 +43,7 @@ save_return(){
cd $workdir cd $workdir
if cat .git/config |grep '/open-feature/openfeature.dev.git' ;then if cat .git/config |grep '/open-feature/openfeature.dev.git' ;then
log_info "=============================================> 匹配到 chaos-mesh" log_info "=============================================> 匹配到 open-feature"
before_openfeature before_openfeature
find_and_sed_v2 "./build" find_and_sed_v2 "./build"
after_openfeature after_openfeature