Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function extractTemplateAppAsync(
templateSpec: PackageSpec,
targetPath: string,
config: AppJSONConfig | BareAppConfig
) {
let tarStream = await pacote.tarball.stream(templateSpec, {
cache: path.join(UserSettings.dotExpoHomeDirectory(), 'template-cache'),
});
await fs.mkdirp(targetPath);
await new Promise((resolve, reject) => {
const extractStream = tar.x({
cwd: targetPath,
strip: 1,
// TODO(ville): pending https://github.com/DefinitelyTyped/DefinitelyTyped/pull/36598
// @ts-ignore property missing from the type definition
transform: createFileTransform(config),
onentry(entry: ReadEntry) {
if (config.name) {
// Rewrite paths for bare workflow
entry.path = entry.path
.replace(/HelloWorld/g, config.name)
.replace(/helloworld/g, config.name.toLowerCase());