Skip to content

Commit f7d7248

Browse files
committed
chore: missing scripts
1 parent 51e7475 commit f7d7248

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
function copyDir(src, dest) {
5+
return new Promise((resolve) => {
6+
fs.mkdir(dest, { recursive: true }, (error, res) => resolve(res));
7+
})
8+
.then(
9+
() =>
10+
new Promise((resolve) => {
11+
fs.readdir(src, { withFileTypes: true }, (error, res) => resolve(res));
12+
})
13+
)
14+
.then((entries) =>
15+
Promise.all(
16+
entries.map((entry) => {
17+
const srcPath = path.join(src, entry.name);
18+
const destPath = path.join(dest, entry.name);
19+
20+
return entry.isDirectory()
21+
? copyDir(srcPath, destPath)
22+
: new Promise((resolve) => {
23+
fs.copyFile(srcPath, destPath, (error, res) => resolve(res));
24+
});
25+
})
26+
)
27+
);
28+
}
29+
module.exports = function ($staticConfig, hookArgs) {
30+
const platform = hookArgs.prepareData.platform;
31+
const projectData = hookArgs.projectData;
32+
const dataPath = path.join(__dirname, '..', 'App_Resources', platform === 'android' ? projectData.$devicePlatformsConstants.Android : projectData.$devicePlatformsConstants.iOS);
33+
if (fs.existsSync(dataPath)) {
34+
console.log('copying demo snippets App_Resources files');
35+
if (platform === 'android') {
36+
return copyDir(dataPath, path.join(projectData.platformsDir, platform, 'app'));
37+
} else {
38+
}
39+
}
40+
};

0 commit comments

Comments
 (0)