about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorMary <148872143+mary-ext@users.noreply.github.com>2024-09-23 21:38:04 +0700
committerGitHub <noreply@github.com>2024-09-23 23:38:04 +0900
commit4e8d86db317864257f6416cd867d7bb07baca6d0 (patch)
treefeb393ae802c935a23d98acc227114bf0ed09f76 /scripts
parent7e2456b906563464c8e43867e62f07df9109bc2b (diff)
downloadvoidsky-4e8d86db317864257f6416cd867d7bb07baca6d0.tar.zst
Let Expo/Webpack handle CSS assets (#3942)
* chore: handle built css assets

* chore: let prettier handle css code

* refactor: let webpack build css assets

* chore: prettier on bskyembed

* chore: touch empty.txt on css directory

* chore: do the same to the workflow
Diffstat (limited to 'scripts')
-rw-r--r--scripts/post-web-build.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/scripts/post-web-build.js b/scripts/post-web-build.js
index baaa7cb8b..7bbee3855 100644
--- a/scripts/post-web-build.js
+++ b/scripts/post-web-build.js
@@ -20,7 +20,30 @@ console.log(`Writing ${templateFile}`)
 const outputFile = entrypoints
   .map(name => {
     const file = path.basename(name)
-    return `<script defer="defer" src="/static/js/${file}"></script>`
+    const ext = path.extname(file)
+
+    if (ext === '.js') {
+      return `<script defer="defer" src="/static/js/${file}"></script>`
+    }
+    if (ext === '.css') {
+      return `<link rel="stylesheet" href="/static/css/${file}">`
+    }
+
+    return ''
   })
   .join('\n')
 fs.writeFileSync(templateFile, outputFile)
+
+function copyFiles(sourceDir, targetDir) {
+  const files = fs.readdirSync(path.join(projectRoot, sourceDir))
+  files.forEach(file => {
+    const sourcePath = path.join(projectRoot, sourceDir, file)
+    const targetPath = path.join(projectRoot, targetDir, file)
+    fs.copyFileSync(sourcePath, targetPath)
+    console.log(`Copied ${sourcePath} to ${targetPath}`)
+  })
+}
+
+copyFiles('web-build/static/js', 'bskyweb/static/js')
+copyFiles('web-build/static/css', 'bskyweb/static/css')
+copyFiles('web-build/static/media', 'bskyweb/static/media')