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*
/junit.xml
/dist/
/static/
/static-test/
/public/
/dist/
/soapbox.zip
.idea
.DS_Store

Wyświetl plik

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

3
.gitignore vendored
Wyświetl plik

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

Wyświetl plik

@ -97,20 +97,23 @@ nginx-test:
changes:
- "installation/mastodon.conf"
build-production:
build:
stage: test
before_script:
- apt-get update -y && apt-get install -y zip
script:
- yarn build
# - yarn manage:translations en
# # Fail if files got changed.
# # https://stackoverflow.com/a/9066385
# - 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:
NODE_ENV: production
artifacts:
paths:
- static
- soapbox.zip
docs-deploy:
stage: deploy
@ -130,16 +133,20 @@ review:
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_SLUG.git.soapbox.pub
before_script:
- apt-get update -y && apt-get install -y unzip
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
pages:
stage: deploy
before_script: []
before_script:
- apt-get update -y && apt-get install -y unzip
script:
# artifacts are kept between jobs
- mv static public
- unzip soapbox.zip -d public
variables:
NODE_ENV: production
artifacts:

Wyświetl plik

@ -14,4 +14,4 @@ ENV FALLBACK_PORT=4444
ENV BACKEND_URL=http://localhost:4444
ENV CSP=
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',
BACKEND_URL: sanitizeURL(BACKEND_URL),
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',
SENTRY_DSN,
},

Wyświetl plik

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

Wyświetl plik

@ -12,7 +12,7 @@ NODE_ENV=development
- `yarn dev` - Run the local dev server.
## Building
- `yarn build` - Compile without a dev server, into `/static` directory.
- `yarn build` - Compile without a dev server, into `/dist` directory.
## Translations
- `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',
build: {
// Relative to the root
outDir: '../static',
outDir: '../dist',
assetsDir: 'packs',
assetsInlineLimit: 0,
rollupOptions: {