Skip to content

Commit 1b03f46

Browse files
toil(front): include static assets into the front service (#26)
## Description Static assets are no longer fetched from our google bucket, but rather from each individual deployment of semaphore (both on saas and CE) ## Type of Change <!-- Mark relevant items with an [x] --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [x] Performance improvement - [x] Code refactoring - [ ] Enterprise Edition feature - [ ] Test updates ## Impact ### Community Edition Impact <!-- Describe the impact on CE users --> ### Enterprise Edition Impact <!-- Describe the impact on EE users --> ## Testing <!-- How has this been tested? --> - [ ] Unit tests added/updated - [ ] Integration tests added/updated - [x] Manual testing performed - [ ] Not applicable ## Documentation <!-- Mark relevant items with an [x] --> - [ ] Documentation update required - [ ] Documentation updated - [x] No documentation changes needed ## Related Issues <!-- Link related issues below. Insert the issue link or issue number --> - Closes (renderedtext/project-tasks#2120) ## Checklist <!-- Mark relevant items with an [x] --> - [x] Code follows project style guidelines - [x] Self review performed - [x] Comments added to hard-to-understand areas - [x] Tests prove change is effective - [ ] ~Relevant documentation updated~ - [ ] Changelog updated if needed - [ ] ~CI/CD changes required~ --------- Signed-off-by: VeljkoMaksimovic <[email protected]>
1 parent b9c9095 commit 1b03f46

File tree

402 files changed

+7492
-55
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+7492
-55
lines changed

front/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ assets/.nyc_output
4545
out/
4646
cover/
4747
lcov*
48+
49+
docker-compose.override.yml

front/assets/build.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const esbuild = require('esbuild')
2+
const fs = require('fs-extra')
3+
const path = require('path')
24

35
const bundle = true
46
const logLevel = process.env.ESBUILD_LOG_LEVEL || 'silent'
@@ -8,6 +10,23 @@ const plugins = [
810
// Add and configure plugins here
911
]
1012

13+
const outputDir = '../priv/static/assets'
14+
15+
// Function to copy static assets
16+
const copyAssets = () => {
17+
console.log('Copying original assets to output directory...')
18+
19+
fs.ensureDirSync(path.join(outputDir, 'css'))
20+
fs.ensureDirSync(path.join(outputDir, 'fonts'))
21+
fs.ensureDirSync(path.join(outputDir, 'images'))
22+
23+
fs.copySync('css', path.join(outputDir, 'css'), { overwrite: true })
24+
fs.copySync('fonts', path.join(outputDir, 'fonts'), { overwrite: true })
25+
fs.copySync('images', path.join(outputDir, 'images'), { overwrite: true })
26+
27+
console.log('Assets copied successfully')
28+
}
29+
1130
const buildOptions = {
1231
minify: true,
1332
sourcemap: (process.env.MIX_ENV || 'prod') != 'prod',
@@ -35,12 +54,18 @@ const buildOptions = {
3554
if (watch) {
3655
esbuild.context(buildOptions).then(context => {
3756
context.watch()
57+
copyAssets()
3858
process.stdin.on('close', () => {
3959
context.dispose()
4060
process.exit(0)
4161
})
4262
process.stdin.resume()
4363
})
4464
} else {
45-
esbuild.build(buildOptions)
65+
esbuild.build(buildOptions).then(() => {
66+
copyAssets()
67+
}).catch(error => {
68+
console.error('Build error:', error)
69+
process.exit(1)
70+
})
4671
}

front/assets/css/app-semaphore-min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)