Skip to content

Commit

Permalink
use swc to transpile js Assets, update all the js deps for transpilation
Browse files Browse the repository at this point in the history
  • Loading branch information
marudor committed Sep 29, 2023
1 parent 75c893b commit 21e4629
Show file tree
Hide file tree
Showing 9 changed files with 1,137 additions and 1,921 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ vendor/bundle
# Ignore all logfiles and tempfiles.
log/*.log
tmp

tabletFix/node_modules
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ COPY Gemfile /app
COPY Gemfile.lock /app
VOLUME /app/public/system
RUN bundle config --local build.sassc --disable-march-tune-native
RUN bundle config set force_ruby_platform true
RUN bundle install
COPY . /app
RUN bundle exec rake assets:precompile
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["rails", "server", "--binding", "[::]", "--port", "80"]
EXPOSE 80

FROM node:18-alpine as tabletFix
FROM node:20-alpine as tabletFix
RUN corepack enable
RUN apk add --no-cache brotli
WORKDIR /app
COPY tabletFix/ /app
RUN pnpm i
COPY --from=main /app/public/assets /app/assets
RUN pnpm i --frozen-lockfile
RUN pnpm tabletFix

FROM main
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ services:
- db

backend:
ports:
- "3000:80"
environment:
RAILS_ENV: production
SENTRY_DSN:
build:
context: .
dockerfile: Dockerfile
image: chaosdorf/mete
build: .
volumes:
- system:/app/public/system
restart: on-failure
Expand Down
3 changes: 0 additions & 3 deletions tabletFix/.babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion tabletFix/.browserlistrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ios 8
ios 9
last 2 versions
8 changes: 8 additions & 0 deletions tabletFix/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"minify": {
"compress": true
}
}
}
33 changes: 0 additions & 33 deletions tabletFix/compress.mjs

This file was deleted.

19 changes: 7 additions & 12 deletions tabletFix/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
{
"name": "tablet-fix",
"packageManager": "pnpm@7.5.2",
"packageManager": "pnpm@8.8.0",
"scripts": {
"compile": "babel assets -d assets",
"compile": "swc assets -d assets",
"gzip": "run-p gzipJS gzipCSS",
"gzipJS": "rm -f assets/*.js.gz && gzip -9 -k assets/*.js",
"gzipCSS": "rm -f assets/*.css.gz && gzip -9 -k assets/*.css",
"compressJS": "node compress.mjs",
"compressCSS": "postcss -r assets/*.css",
"compress": "run-p compressJS compressCSS",
"compress": "postcss -r assets/*.css",
"brotli": "run-p brotliJS brotliCSS",
"brotliJS": "rm -f assets/*.js.br && brotli assets/*.js",
"brotliCSS": "rm -f assets/*.css.br && brotli assets/*.css",
"tabletFix": "run-s compile compress gzip brotli"
},
"dependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.4.0-0",
"@babel/preset-env": "^7.16.11",
"cssnano": "^5.1.7",
"@swc/cli": "^0.1.62",
"cssnano": "^6.0.1",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.13",
"postcss-cli": "^10.0.0",
"terser": "^5.13.1"
"postcss": "^8.4.31",
"postcss-cli": "^10.1.0"
}
}
Loading

0 comments on commit 21e4629

Please sign in to comment.