about summary refs log tree commit diff
path: root/scripts/post-embed-build.js
blob: c0897e1b701d3aa3ffb8f0c480768737e107817e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const path = require('node:path')
const fs = require('node:fs')

const projectRoot = path.join(__dirname, '..')

// copy embed assets to embedr

const embedAssetSource = path.join(projectRoot, 'bskyembed', 'dist', 'static')

const embedAssetDest = path.join(projectRoot, 'bskyweb', 'embedr-static')

fs.cpSync(embedAssetSource, embedAssetDest, {recursive: true})

const embedEmbedJSSource = path.join(
  projectRoot,
  'bskyembed',
  'dist',
  'embed.js',
)

const embedEmbedJSDest = path.join(
  projectRoot,
  'bskyweb',
  'embedr-static',
  'embed.js',
)

fs.cpSync(embedEmbedJSSource, embedEmbedJSDest)

// copy entrypoint(s) to embedr

// additional entrypoints will need more work, but this'll do for now
const embedHomeHtmlSource = path.join(
  projectRoot,
  'bskyembed',
  'dist',
  'index.html',
)

const embedHomeHtmlDest = path.join(
  projectRoot,
  'bskyweb',
  'embedr-templates',
  'home.html',
)

fs.copyFileSync(embedHomeHtmlSource, embedHomeHtmlDest)

const embedPostHtmlSource = path.join(
  projectRoot,
  'bskyembed',
  'dist',
  'post.html',
)

const embedPostHtmlDest = path.join(
  projectRoot,
  'bskyweb',
  'embedr-templates',
  'postEmbed.html',
)

fs.copyFileSync(embedPostHtmlSource, embedPostHtmlDest)

console.log(`Copied embed assets to embedr`)