forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1const {withXcodeProject} = require('@expo/config-plugins')
2const path = require('path')
3const fs = require('fs')
4
5const FILES = ['AppDelegate.swift', 'ViewController.swift']
6
7const withFiles = (config, {targetName}) => {
8 // eslint-disable-next-line no-shadow
9 return withXcodeProject(config, config => {
10 const basePath = path.join(
11 config.modRequest.projectRoot,
12 'modules',
13 targetName,
14 )
15
16 for (const file of FILES) {
17 const sourcePath = path.join(basePath, file)
18 const targetPath = path.join(
19 config.modRequest.platformProjectRoot,
20 targetName,
21 file,
22 )
23
24 fs.mkdirSync(path.dirname(targetPath), {recursive: true})
25 fs.copyFileSync(sourcePath, targetPath)
26 }
27
28 const imagesBasePath = path.join(basePath, 'Images.xcassets')
29 const imagesTargetPath = path.join(
30 config.modRequest.platformProjectRoot,
31 targetName,
32 'Images.xcassets',
33 )
34 fs.cpSync(imagesBasePath, imagesTargetPath, {recursive: true})
35
36 return config
37 })
38}
39
40module.exports = {withFiles}