Starter Packs (#4332)
Co-authored-by: Dan Abramov <dan.abramov@gmail.com> Co-authored-by: Paul Frazee <pfrazee@gmail.com> Co-authored-by: Eric Bailey <git@esb.lol> Co-authored-by: Samuel Newman <mozzius@protonmail.com>
This commit is contained in:
parent
35f64535cb
commit
f089f45781
115 changed files with 6336 additions and 237 deletions
40
plugins/starterPackAppClipExtension/withFiles.js
Normal file
40
plugins/starterPackAppClipExtension/withFiles.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
const {withXcodeProject} = require('@expo/config-plugins')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const FILES = ['AppDelegate.swift', 'ViewController.swift']
|
||||
|
||||
const withFiles = (config, {targetName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
const basePath = path.join(
|
||||
config.modRequest.projectRoot,
|
||||
'modules',
|
||||
targetName,
|
||||
)
|
||||
|
||||
for (const file of FILES) {
|
||||
const sourcePath = path.join(basePath, file)
|
||||
const targetPath = path.join(
|
||||
config.modRequest.platformProjectRoot,
|
||||
targetName,
|
||||
file,
|
||||
)
|
||||
|
||||
fs.mkdirSync(path.dirname(targetPath), {recursive: true})
|
||||
fs.copyFileSync(sourcePath, targetPath)
|
||||
}
|
||||
|
||||
const imagesBasePath = path.join(basePath, 'Images.xcassets')
|
||||
const imagesTargetPath = path.join(
|
||||
config.modRequest.platformProjectRoot,
|
||||
targetName,
|
||||
'Images.xcassets',
|
||||
)
|
||||
fs.cpSync(imagesBasePath, imagesTargetPath, {recursive: true})
|
||||
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {withFiles}
|
Loading…
Add table
Add a link
Reference in a new issue