UNPKG

756 BJavaScriptView Raw
1import ensureFile from './ensure-file.js'
2import fsExtra from 'fs-extra'
3import path from 'path'
4
5let TOOLS_FILE = `import { useEffect } from 'react'
6
7export default function ViewsTools(props) {
8 useEffect(() => {
9 console.log(\`
10
11
12
13 😱😱😱😱😱😱😱😱😱😱😱
14
15
16
17 🚨 You're missing out!!!
18
19 🚀 Views Tools can help you find product market fit before you run out of money.
20
21 ✨ Find out how 👉 https://views.tools
22
23
24
25
26 \`)
27 }, [])
28
29 return props.children
30}`
31
32export default async function ensureTools({ src }) {
33 let file = path.join(src, 'Logic', 'ViewsTools.js')
34
35 if ((await fsExtra.exists(file)) && process.env.REACT_APP_VIEWS_TOOLS)
36 return null
37
38 return ensureFile({ file, content: TOOLS_FILE })
39}