Merge branch 'src-dist' into 'main'

Rename static --> dist, build-production --> build, output .zip with subdir

See merge request soapbox-pub/soapbox!2702
environments/review-main-yi2y9f/deployments/3917
Alex Gleason 2023-09-18 20:28:36 +00:00
commit f5fdccd0d9
9 zmienionych plików z 23 dodań i 14 usunięć

Wyświetl plik

@ -12,10 +12,11 @@
yarn-error.log* yarn-error.log*
/junit.xml /junit.xml
/dist/
/static/ /static/
/static-test/
/public/ /public/
/dist/ /dist/
/soapbox.zip
.idea .idea
.DS_Store .DS_Store

Wyświetl plik

@ -1,6 +1,6 @@
/node_modules/** /node_modules/**
/dist/**
/static/** /static/**
/static-test/**
/public/** /public/**
/tmp/** /tmp/**
/coverage/** /coverage/**

3
.gitignore vendored
Wyświetl plik

@ -11,10 +11,11 @@ yarn-error.log*
/junit.xml /junit.xml
*.timestamp-* *.timestamp-*
/dist/
/static/ /static/
/static-test/
/public/ /public/
/dist/ /dist/
/soapbox.zip
.idea .idea
.DS_Store .DS_Store

Wyświetl plik

@ -97,20 +97,23 @@ nginx-test:
changes: changes:
- "installation/mastodon.conf" - "installation/mastodon.conf"
build-production: build:
stage: test stage: test
before_script:
- apt-get update -y && apt-get install -y zip
script: script:
- yarn build - yarn build
# - yarn manage:translations en # - yarn manage:translations en
# # Fail if files got changed. # # Fail if files got changed.
# # https://stackoverflow.com/a/9066385 # # https://stackoverflow.com/a/9066385
# - git diff --quiet # - git diff --quiet
- cp static/index.html static/404.html - cp dist/index.html dist/404.html
- cd dist && zip -r ../soapbox.zip . && cd ..
variables: variables:
NODE_ENV: production NODE_ENV: production
artifacts: artifacts:
paths: paths:
- static - soapbox.zip
docs-deploy: docs-deploy:
stage: deploy stage: deploy
@ -130,16 +133,20 @@ review:
environment: environment:
name: review/$CI_COMMIT_REF_NAME name: review/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_SLUG.git.soapbox.pub url: https://$CI_COMMIT_REF_SLUG.git.soapbox.pub
before_script:
- apt-get update -y && apt-get install -y unzip
script: script:
- npx -y surge static $CI_COMMIT_REF_SLUG.git.soapbox.pub - unzip soapbox.zip -d dist
- npx -y surge dist $CI_COMMIT_REF_SLUG.git.soapbox.pub
allow_failure: true allow_failure: true
pages: pages:
stage: deploy stage: deploy
before_script: [] before_script:
- apt-get update -y && apt-get install -y unzip
script: script:
# artifacts are kept between jobs # artifacts are kept between jobs
- mv static public - unzip soapbox.zip -d public
variables: variables:
NODE_ENV: production NODE_ENV: production
artifacts: artifacts:

Wyświetl plik

@ -14,4 +14,4 @@ ENV FALLBACK_PORT=4444
ENV BACKEND_URL=http://localhost:4444 ENV BACKEND_URL=http://localhost:4444
ENV CSP= ENV CSP=
COPY installation/docker.conf.template /etc/nginx/templates/default.conf.template COPY installation/docker.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /app/static /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html

Wyświetl plik

@ -38,7 +38,7 @@ export default () => ({
NODE_ENV: NODE_ENV || 'development', NODE_ENV: NODE_ENV || 'development',
BACKEND_URL: sanitizeURL(BACKEND_URL), BACKEND_URL: sanitizeURL(BACKEND_URL),
FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY), FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY),
FE_BUILD_DIR: sanitizePath(FE_BUILD_DIR) || 'static', FE_BUILD_DIR: sanitizePath(FE_BUILD_DIR) || 'dist',
FE_INSTANCE_SOURCE_DIR: FE_INSTANCE_SOURCE_DIR || 'instance', FE_INSTANCE_SOURCE_DIR: FE_INSTANCE_SOURCE_DIR || 'instance',
SENTRY_DSN, SENTRY_DSN,
}, },

Wyświetl plik

@ -155,7 +155,7 @@ Options:
- Any directory name, eg `"public"` - Any directory name, eg `"public"`
Default: `"static"` Default: `"dist"`
### `FE_SUBDIRECTORY` ### `FE_SUBDIRECTORY`

Wyświetl plik

@ -12,7 +12,7 @@ NODE_ENV=development
- `yarn dev` - Run the local dev server. - `yarn dev` - Run the local dev server.
## Building ## Building
- `yarn build` - Compile without a dev server, into `/static` directory. - `yarn build` - Compile without a dev server, into `/dist` directory.
## Translations ## Translations
- `yarn i18n` - Rebuilds app and updates English locale to prepare for translations in other languages. Should always be run after editing i18n strings. - `yarn i18n` - Rebuilds app and updates English locale to prepare for translations in other languages. Should always be run after editing i18n strings.

Wyświetl plik

@ -14,7 +14,7 @@ export default defineConfig({
root: 'app', root: 'app',
build: { build: {
// Relative to the root // Relative to the root
outDir: '../static', outDir: '../dist',
assetsDir: 'packs', assetsDir: 'packs',
assetsInlineLimit: 0, assetsInlineLimit: 0,
rollupOptions: { rollupOptions: {