Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(s => {
let d = path.dirname(s.toString())
if (d === '.') {
d = ''
} else {
d = `/${d}`
}
return ` `
})
.sort()
.join('\n')
const iosContent = iosFiles
.map(s => ` `)
.sort()
.join('\n')
await replace({
files: [path.join(__dirname, '../plugin.xml')],
// tslint:disable-next-line:max-line-length
from: /([\s\S]*ANDROID_BEGIN -->\n)[\s\S]*(\n\s+\n)[\s\S]*(\n\s+
export async function fixPlatform(platformDir, appId) {
const appBuilderPath = path.join(platformDir, 'scripts', 'classes', 'app-builder.js');
if (process.platform === 'win32') {
try {
await replace({
files: appBuilderPath,
from: './gradlew',
to: 'gradlew'
});
} catch (err) {
console.log('WARN: Could not rename ./gradle to gradle');
}
try {
await replace({
files: appBuilderPath,
from: "const apkPath = path.join('android', 'app', 'build', 'outputs', 'apk');",
to: `const apkPath = path.join('c:/', '${appId}', 'tmp', 'ShoutemApp', 'app', 'outputs', 'apk');`
});
} catch (err) {
console.log('WARN: Could not adapt client for c:\\tmp build directory');
}
try {
await replace({
files: path.join(platformDir, 'android', 'build.gradle'),
from: '// buildDir = "C:/tmp/',
to: `buildDir = "C:/tmp/${appId}/`
})
} catch (err) {
console.log('WARN: Could not set the tmp build directory for android app');
changes.forEach(change =>
replace(change)
.then(changedFiles => {
console.log('Modified files:', changedFiles.join(', '));
})
.catch(error => {
console.error('Error occurred:', error);
})
);
return new Promise((resolve, reject) => {
const options = {
files: [
path.join(destinationDir, 'README.md'),
path.join(destinationDir, 'package.json'),
],
replace: '{{PROJECT_NAME}}',
with: projectName,
};
replace(options, (err) => {
if (err) {
reject(err)
} else {
resolve();
}
});
});
}
function renameReferences(inFiles, files) {
const { from, to } = files.reduce(
(toRename, { oldPath, newPath }) => ({
from: [
...toRename.from,
new RegExp(oldPath.replace(`${DIST_PATH}/`, ''), 'g'),
],
to: [...toRename.to, newPath.replace(`${DIST_PATH}/`, '')],
}),
{ from: [], to: [] }
);
return replace({ from, to, files: inFiles });
}
{
xcodeSchemes: {
Release: ['Staging'],
Debug: [],
},
},
'./package.json',
)
const options = {
files: './ios/test/AppDelegate.m',
from: 'initialProperties:nil',
to: 'initialProperties:{@"environment" : ENVIRONMENT}',
}
replace(options)
}
static replaceInFile(options) {
return replace(options);
}
static folderContains(folder, fileNames) {
export async function replacePlaceholderNameWithProjectName(projectDir: string, projectName: string): Promise {
const options = {
files: path.join(projectDir, '**'),
from: /\[PROJ_NAME_PLACEHOLDER\]/g,
to: sanitizeName(projectName),
glob: {
dot: true
}
};
const modifiedFiles = await replaceInFile(options);
await replaceFilenameInFiles(projectDir, '[PROJ_NAME_PLACEHOLDER]', projectName);
}