Skip to content

Commit

Permalink
🧅 Nodejs'ten bun'a geç
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Jan 25, 2024
1 parent e316d8c commit b932ece
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 81 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ jobs:
with:
submodules: true

- name: Node kur
uses: actions/setup-node@v3
with:
node-version: 20
- name: Bun kur
uses: oven-sh/setup-bun@v1

- name: Araçları kur
run: |
yarn
bun i
brew install pngcrush brotli zopfli woff2 webp
pip install fonttools
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ veriyoruz ve bunları `birim/` dizinine koyuyoruz.
Yazılımcıların dApp'i test etmesi için gereken adımlar:
- `git clone --recursive https://github.com/KimlikDAO/dapp`

- `yarn` gerekli build araçlarını ve dev sunucusunu yükler
- `bun i` gerekli build araçlarını ve dev sunucusunu yükler

- `make dev` dev sunucuyu çalıştırır.
- http://localhost:8787/al
Expand Down
34 changes: 17 additions & 17 deletions al/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,33 @@ build/al/sayfa-%.js: al/sayfa.js \
lib/util/dom.js lib/util/çevir.js \
build/al/tanışma/birim.keymap
mkdir -p $(dir $@)
yarn google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(al-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(al-en)" \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $(filter %.js,$^) \
--js_output_file $@
node lib/birimler/deÄŸiÅŸtirici.js $@ $(filter %.keymap,$^)
yarn uglifyjs $@ -m -c toplevel,unsafe -o $@
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(al-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(al-en)" \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $(filter %.js,$^) \
--js_output_file $@
bun lib/birimler/deÄŸiÅŸtirici.js $@ $(filter %.keymap,$^)
bun uglifyjs $@ -m -c toplevel,unsafe -o $@
wc $@

build/al/sayfa.css: al/sayfa.css al/*/*.css birim/kutu.css
mkdir -p $(dir $@)
cat $^ | yarn csso --output $@
cat $^ | bun csso --output $@

build/al/sayfa.keymap: $(call compressions, build/al/sayfa.css)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/al/sayfa.css
bun lib/birimler/hasher.js $@ build/al/sayfa.css

build/al/sayfa-%.keymap: build/ana/sayfa-%.keymap \
$(call compressions, build/al/sayfa-%.js)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/al/sayfa-$*.js
bun lib/birimler/hasher.js $@ build/al/sayfa-$*.js
cat $< >> $@

build/al-%.html: al/sayfa.html \
Expand All @@ -65,4 +65,4 @@ build/al-%.html: al/sayfa.html \
birim/lato-%.birim \
birim/tckt.birim \
birim/telefon.birim
node lib/birimler/iÅŸleyici $< $*
bun lib/birimler/iÅŸleyici.js $< $*
28 changes: 14 additions & 14 deletions al/tanışma/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AL_TANIŞMA_REQUEST_SVG_OUT := $(addprefix build/al/tanışma/, $(AL_TANIŞMA_RE

build/al/tanışma/birim.keymap: $(call compressions, $(AL_TANIŞMA_REQUEST_SVG_OUT) build/al/tanışma/powWorker.js)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ $(AL_TANIŞMA_REQUEST_SVG_OUT) build/al/tanışma/powWorker.js
bun lib/birimler/hasher.js $@ $(AL_TANIŞMA_REQUEST_SVG_OUT) build/al/tanışma/powWorker.js

al/tanışma.birim: al/tanışma/birim.html $(AL_TANIŞMA_INLINE_SVG_OUT) \
build/al/tanışma/birim.keymap
Expand All @@ -18,17 +18,17 @@ build/al/tanışma/powWorker.js: al/tanışma/powWorker.js \
lib/crypto/sha3.js \
lib/util/çevir.js
mkdir -p $(dir $@)
yarn google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--jscomp_error=unusedLocalVariables \
--jscomp_error=strictCheckTypes \
--language_in ECMASCRIPT_NEXT \
--rewrite_polyfills=false \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $^ \
--js_output_file $@
yarn uglifyjs $@ -m -c toplevel,unsafe -o $@
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--jscomp_error=unusedLocalVariables \
--jscomp_error=strictCheckTypes \
--language_in ECMASCRIPT_NEXT \
--rewrite_polyfills=false \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $^ \
--js_output_file $@
bun uglifyjs $@ -m -c toplevel,unsafe -o $@
wc $@
10 changes: 5 additions & 5 deletions ana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ build/ana/sayfa-%.js: ana/sayfa.js \
lib/node/*.d.js lib/node/ipfs.js \
lib/util/dom.js lib/util/çevir.js
mkdir -p $(dir $@)
yarn google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(ana-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(ana-en)" \
Expand All @@ -35,7 +35,7 @@ build/ana/sayfa-%.js: ana/sayfa.js \
--entry_point $< \
--js $^ \
--js_output_file $@
yarn uglifyjs $@ -m -c toplevel,unsafe -o $@
bun uglifyjs $@ -m -c toplevel,unsafe -o $@

build/ana/sayfa-%.css: \
build/birim/lato/l400.css \
Expand All @@ -59,15 +59,15 @@ build/ana/sayfa-%.css: \
birim/telefon/birim.css \
birim/tckt/birim.css
mkdir -p $(dir $@)
cat $^ | yarn csso --output $@
cat $^ | bun csso --output $@

# In dapp, we bundle ana/sayfa.css and birim/ortak.css together since both are tiny.
# In the html call site always pretend no bundling happens and in the Makefile
# callsite depend on build/ana/sayfa-%.keymap
build/ana/sayfa-%.keymap: lib/birimler/hasher.js \
$(call compressions, build/ana/sayfa-%.js build/ana/sayfa-%.css)
mkdir -p $(dir $@)
node $< $@ build/ana/sayfa-$*.js build/ana/sayfa-$*.css
bun $< $@ build/ana/sayfa-$*.js build/ana/sayfa-$*.css
sed -i.bak 's#/ana/sayfa.css#/birim/ortak.css#' $@

build/ana-%.html: ana/sayfa.html \
Expand All @@ -84,4 +84,4 @@ build/ana-%.html: ana/sayfa.html \
birim/tckt.birim \
birim/telefon.birim \
build/ana/ok.isvg
node lib/birimler/iÅŸleyici.js $< $*
bun lib/birimler/iÅŸleyici.js $< $*
4 changes: 2 additions & 2 deletions birim/favicon/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
build/birim/favicon/icon16.png: build/birim/favicon/icon.svg
mkdir -p $(dir $@)
yarn svgexport $^ $@.tmp 16:16
bun svgexport $^ $@.tmp 16:16
pngcrush -brute $@.tmp $@

build/birim/favicon/icon32.png: build/birim/favicon/icon.svg
mkdir -p $(dir $@)
yarn svgexport $^ $@.tmp 32:32
bun svgexport $^ $@.tmp 32:32
pngcrush -brute $@.tmp $@

build/favicon.ico: \
Expand Down
2 changes: 1 addition & 1 deletion birim/tckt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build/TCKT.svg: build/birim/tckt/kapak.svg

build/TCKT.png: build/TCKT.svg
mkdir -p $(dir $@)
yarn svgexport $^ $@ 400:400
bun svgexport $^ $@ 400:400
pngcrush -brute -ow $@

build/TCKT.webp: build/TCKT.png
Expand Down
12 changes: 6 additions & 6 deletions iptal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build/iptal/sayfa-%.js: iptal/sayfa.js \
lib/node/*.d.js lib/node/ipfs.js \
lib/util/dom.js lib/util/çevir.js
mkdir -p $(dir $@)
yarn google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--jscomp_error=unusedLocalVariables \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(iptal-tr)" \
Expand All @@ -26,20 +26,20 @@ build/iptal/sayfa-%.js: iptal/sayfa.js \
--entry_point $< \
--js $^ \
--js_output_file $@
yarn uglifyjs $@ -m -o $@
bun uglifyjs $@ -m -o $@

build/iptal/sayfa.css: iptal/sayfa.css
mkdir -p $(dir $@)
cat $^ | yarn csso --output $@
cat $^ | bun csso --output $@

build/iptal/sayfa.keymap: $(call compressions, build/iptal/sayfa.css)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/iptal/sayfa.css
bun lib/birimler/hasher.js $@ build/iptal/sayfa.css

build/iptal/sayfa-%.keymap: build/ana/sayfa-%.keymap \
$(call compressions, build/iptal/sayfa-%.js)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/iptal/sayfa-$*.js
bun lib/birimler/hasher.js $@ build/iptal/sayfa-$*.js
cat $< >> $@

build/iptal-%.html: iptal/sayfa.html \
Expand All @@ -48,4 +48,4 @@ build/iptal-%.html: iptal/sayfa.html \
birim/başlık.birim \
birim/favicon.birim \
birim/lato-%.birim
node lib/birimler/iÅŸleyici $< $*
bun lib/birimler/iÅŸleyici.js $< $*
12 changes: 6 additions & 6 deletions oyla/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build/oyla/sayfa-%.js: oyla/sayfa.js \
lib/node/*.d.js lib/node/ipfs.js \
lib/util/dom.js lib/util/çevir.js
mkdir -p $(dir $@)
yarn google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(oyla-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(oyla-en)" \
Expand All @@ -25,21 +25,21 @@ build/oyla/sayfa-%.js: oyla/sayfa.js \
--entry_point $< \
--js $^ \
--js_output_file $@
yarn uglifyjs $@ -m -c toplevel,unsafe -o $@
bun uglifyjs $@ -m -c toplevel,unsafe -o $@
wc $@

build/oyla/sayfa.css: oyla/sayfa.css oyla/*/*.css
mkdir -p $(dir $@)
cat $^ | yarn csso --output $@
cat $^ | bun csso --output $@

build/oyla/sayfa.keymap: $(call compressions, build/oyla/sayfa.css)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/oyla/sayfa.css
bun lib/birimler/hasher.js $@ build/oyla/sayfa.css

build/oyla/sayfa-%.keymap: build/ana/sayfa-%.keymap \
$(call compressions, build/oyla/sayfa-%.js)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/oyla/sayfa-$*.js
bun lib/birimler/hasher.js $@ build/oyla/sayfa-$*.js
cat $< >> $@

build/oyla-%.html: oyla/sayfa.html \
Expand All @@ -49,4 +49,4 @@ build/oyla-%.html: oyla/sayfa.html \
birim/favicon.birim \
birim/lato-%.birim \
build/oyla/dropdownok.isvg
node lib/birimler/iÅŸleyici $< $*
bun lib/birimler/iÅŸleyici.js $< $*
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"build": "make build",
"start": "make dev",
"test": "vitest"
"test": "bun vitest"
},
"devDependencies": {
"csso-cli": "^4.0.2",
Expand Down
21 changes: 12 additions & 9 deletions sunucu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build/sunucu/prod.js: sunucu/prod.js \
lib/cloudflare/moduleWorker.d.js lib/cloudflare/types.d.js \
lib/cloudflare/pageWorker.d.js lib/cloudflare/pageWorker.js
mkdir -p $(dir $@)
yarn google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--jscomp_error=checkTypes \
--jscomp_error=strictCheckTypes \
--jscomp_error=unusedLocalVariables \
Expand All @@ -27,7 +27,7 @@ build/sunucu/prod.js: sunucu/prod.js \
--entry_point $< \
--js $^ \
--js_output_file $@
yarn uglifyjs $@ -m -c toplevel,unsafe,drop_console -o $@
bun uglifyjs $@ -m -c toplevel,unsafe,drop_console -o $@
sed -i.bak 's/globalThis.ProdWorker=/export default/g' $@
wc $@

Expand All @@ -41,15 +41,18 @@ build/sitemap: $(call compressions, build/sitemap.txt)

.PHONY: build/sitemap

dev:
node lib/birimler/devSunucu --çalıştır sunucu/dev.toml
dev: lib/birimler/devSunucu.js sunucu/dev.toml
bun $< --çalıştır sunucu/dev.toml

kanarya: build
node lib/birimler/kanaryaSunucu --çalıştır sunucu/dev.toml
kanarya: lib/birimler/kanaryaSunucu.js build sunucu/dev.toml
bun $< --çalıştır sunucu/dev.toml

cf-deployment: build build/sunucu/prod.js build/sitemap sunucu/prod.toml
node lib/cloudflare/uploader sunucu/prod.toml sunucu/Makefile
wrangler deploy \
cf-deployment: lib/cloudflare/uploader.js build \
build/sunucu/prod.js \
build/sitemap \
sunucu/prod.toml
bun lib/cloudflare/uploader.js sunucu/prod.toml sunucu/Makefile
bun wrangler deploy \
--config sunucu/prod.toml \
--compatibility-date $(shell date -v -1d +%Y-%m-%d)

Expand Down
26 changes: 13 additions & 13 deletions tcktm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build/tcktm/sayfa-%.js: tcktm/sayfa.js tcktm/pencere/*.js \
lib/node/*.d.js lib/node/ipfs.js \
lib/util/dom.js lib/util/çevir.js
mkdir -p $(dir $@)
yarn google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(tcktm-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(tcktm-en)" \
Expand All @@ -25,28 +25,28 @@ build/tcktm/sayfa-%.js: tcktm/sayfa.js tcktm/pencere/*.js \
--entry_point $< \
--js $^ \
--js_output_file $@
yarn uglifyjs $@ -m -o $@
bun uglifyjs $@ -m -o $@

build/tcktm/sayfa.css: tcktm/sayfa.css tcktm/*/*.css birim/kutu.css
mkdir -p $(dir $@)
cat $^ | yarn csso --output $@
cat $^ | bun csso --output $@

build/tcktm/sayfa.keymap: $(call compressions, build/tcktm/sayfa.css)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/tcktm/sayfa.css
bun lib/birimler/hasher.js $@ build/tcktm/sayfa.css

build/tcktm/sayfa-%.keymap: build/ana/sayfa-%.keymap \
$(call compressions, build/tcktm/sayfa-%.js)
mkdir -p $(dir $@)
node lib/birimler/hasher $@ build/tcktm/sayfa-$*.js
bun lib/birimler/hasher.js $@ build/tcktm/sayfa-$*.js
cat $< >> $@

build/tcktm-%.html: tcktm/sayfa.html \
build/tcktm/sayfa-%.keymap \
build/tcktm/sayfa.keymap \
birim/başlık.birim \
birim/favicon.birim \
birim/lato-%.birim \
birim/tckt.birim \
build/al/paste.isvg
node lib/birimler/iÅŸleyici $< $*
build/tcktm/sayfa-%.keymap \
build/tcktm/sayfa.keymap \
birim/başlık.birim \
birim/favicon.birim \
birim/lato-%.birim \
birim/tckt.birim \
build/al/paste.isvg
bun lib/birimler/iÅŸleyici.js $< $*

0 comments on commit b932ece

Please sign in to comment.