diff --git a/Makefile b/Makefile index 3bdfca882b..a40d37610e 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,11 @@ build-web: ## Compile web bundle, copy to bskyweb directory yarn intl:build yarn build-web +.PHONY: build-web-embed +build-web-embed: ## Compile web embed bundle, copy to bskyweb/embedr* directories + yarn intl:build + yarn build-embed + .PHONY: test test: ## Run all tests NODE_ENV=test EXPO_PUBLIC_ENV=test yarn test diff --git a/bskyweb/.gitignore b/bskyweb/.gitignore index 2582b048c7..fad122a280 100644 --- a/bskyweb/.gitignore +++ b/bskyweb/.gitignore @@ -9,6 +9,7 @@ test-coverage.out static/js/*.js static/js/*.map static/js/*.js.LICENSE.txt +static/js/empty.txt templates/scripts.html templates/*-embed.html static/embed/*.html diff --git a/package.json b/package.json index e4a8de7443..21e632aa45 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build-ios": "yarn use-build-number-with-bump eas build -p ios", "build-android": "yarn use-build-number-with-bump eas build -p android", "build": "yarn use-build-number-with-bump eas build", - "build-embed": "cd bskyembed && yarn build && cd .. && node ./scripts/post-embed-build.js", + "build-embed": "cd bskyembed && yarn build && yarn build-snippet && cd .. && node ./scripts/post-embed-build.js", "start": "expo start --dev-client", "start:prod": "expo start --dev-client --no-dev --minify", "clean-cache": "rm -rf node_modules/.cache/babel-loader/*", diff --git a/scripts/post-embed-build.js b/scripts/post-embed-build.js index 5fb3377bd8..c0897e1b70 100644 --- a/scripts/post-embed-build.js +++ b/scripts/post-embed-build.js @@ -11,6 +11,22 @@ 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