@prosopo/procaptcha-bundle 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/vite.config.ts ADDED
@@ -0,0 +1,47 @@
1
+ import * as fs from 'fs'
2
+ import * as path from 'path'
3
+ import { ViteFrontendConfig } from '@prosopo/config'
4
+ import { defineConfig } from 'vite'
5
+ import { loadEnv } from '@prosopo/cli'
6
+ // load env using our util because vite loadEnv is not working for .env.development
7
+ loadEnv()
8
+
9
+ // Vite doesn't find the tsconfig for some reason
10
+ process.env.TS_NODE_PROJECT = path.resolve('./tsconfig.json')
11
+
12
+ // Package specific config
13
+ const copyTo = '../../demos/client-bundle-example/src'
14
+ const bundleName = 'procaptcha'
15
+ const packageName = '@prosopo/procaptcha-bundle'
16
+ const entry = './src/index.tsx'
17
+ const copyOptions = copyTo
18
+ ? {
19
+ srcDir: './dist/bundle',
20
+ destDir: copyTo,
21
+ bundleName: bundleName,
22
+ }
23
+ : undefined
24
+ const tsConfigPaths = [path.resolve('./tsconfig.json')]
25
+ const packagesDir = path.resolve('..')
26
+ // Get all folders in packagesDir
27
+ const packages = fs.readdirSync(packagesDir).filter((f) => fs.statSync(path.join(packagesDir, f)).isDirectory())
28
+ for (const packageName of packages) {
29
+ // Add the tsconfig for each package to tsConfigPaths
30
+ tsConfigPaths.push(path.resolve(`../${packageName}/tsconfig.json`))
31
+ }
32
+ // Merge with generic frontend config
33
+ export default defineConfig(async ({ command, mode }) => {
34
+ const frontendConfig = await ViteFrontendConfig(
35
+ packageName,
36
+ bundleName,
37
+ path.resolve(),
38
+ entry,
39
+ command,
40
+ mode,
41
+ copyOptions,
42
+ tsConfigPaths
43
+ )
44
+ return {
45
+ ...frontendConfig,
46
+ }
47
+ })
package/dist/index.html DELETED
@@ -1 +0,0 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>React App</title><script defer="defer" src="procaptcha_bundle.main.bundle.js"></script></head><body><div id="root"></div></body></html>
Binary file