about summary refs log tree commit diff
path: root/plugins/starterPackAppClipExtension/withFiles.js
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-06-21 21:38:04 -0700
committerGitHub <noreply@github.com>2024-06-21 21:38:04 -0700
commitf089f4578131e83cd177b7809ce0f7b75779dfdc (patch)
tree51978aede2040fb8dc319f0749d3de77c7811fbe /plugins/starterPackAppClipExtension/withFiles.js
parent35f64535cb8dfa0fe46e740a6398f3b991ecfbc7 (diff)
downloadvoidsky-f089f4578131e83cd177b7809ce0f7b75779dfdc.tar.zst
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>
Diffstat (limited to 'plugins/starterPackAppClipExtension/withFiles.js')
-rw-r--r--plugins/starterPackAppClipExtension/withFiles.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/plugins/starterPackAppClipExtension/withFiles.js b/plugins/starterPackAppClipExtension/withFiles.js
new file mode 100644
index 000000000..ad99f5ae4
--- /dev/null
+++ b/plugins/starterPackAppClipExtension/withFiles.js
@@ -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}