Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.env.log.rawmsg(diff);
const confirm = await this.env.prompt({
type: 'confirm',
name: 'confirm',
message: `May we make the above change(s) to '${prettyPath(sshConfigPath)}'?`,
});
if (!confirm) {
// TODO: link to docs about manual git setup
throw new FatalException();
}
}
await writeFile(sshConfigPath, text2, { encoding: 'utf8', mode: 0o600 });
this.env.log.ok(`Your active Ionic SSH key has been set to ${strong(keyPath)}!`);
}
}
export async function write(path: string, doc: et.ElementTree): Promise {
// Cordova hard codes an indentation of 4 spaces, so we'll follow.
const contents = doc.write({ indent: 4 });
await writeFile(path, contents, 'utf8');
}
for (const projectType of projectTypes) {
// TODO: possible to do this without a physical directory?
const ctx = { ...baseCtx, execPath: path.resolve(PROJECTS_DIRECTORY, projectType) };
const executor = await loadExecutor(ctx, []);
const location = await executor.namespace.locate([]);
const formatter = new NamespaceSchemaHelpFormatter({ location, namespace: executor.namespace });
const formatted = await formatter.serialize();
const projectJson = { type: projectType, ...formatted };
// TODO: `serialize()` from base formatter isn't typed properly
projectJson.commands = await Promise.all(projectJson.commands.map(async cmd => this.extractCommand(cmd as CommandHelpSchema)));
projectJson.commands.sort((a, b) => strcmp(a.name, b.name));
await writeFile(path.resolve(STAGING_DIRECTORY, `${projectType}.json`), JSON.stringify(projectJson, undefined, 2) + '\n', { encoding: 'utf8' });
}
process.stdout.write(`${chalk.green('Done.')}\n`);
}
async save(): Promise {
if (!this.saving) {
this.saving = true;
await writeFile(this.configXmlPath, this.write(), { encoding: 'utf8' });
this.saving = false;
}
}
export async function generateImage(image: ImageSchema, src: Sharp, metadata: Metadata, errstream?: NodeJS.WritableStream): Promise {
debug('Generating %o (%ox%o)', image.src, image.width, image.height);
if (image.format === Format.NONE) {
return;
}
if (errstream) {
if (metadata.format !== image.format) {
errstream.write(`WARN: Must perform conversion from ${metadata.format} to png.\n`);
}
}
const pipeline = applyFormatConversion(image.format, transformImage(image, src));
await writeFile(image.src, await pipeline.toBuffer());
}
export async function writeINI(p: string, o: T): Promise {
const ini = await import ('ini');
const contents = ini.encode(o);
await writeFile(p, contents, { encoding: 'utf8' });
}
async run(): Promise {
if (!this.project) {
throw new FatalException(`Cannot run ${input('ionic deploy manifest')} outside a project directory.`);
}
await this.requireNativeIntegration();
const buildDir = await this.project.getDistDir();
const manifest = await this.getFilesAndSizesAndHashesForGlobPattern(buildDir);
const manifestPath = path.resolve(buildDir, 'pro-manifest.json');
await writeFile(manifestPath, JSON.stringify(manifest, undefined, 2), { encoding: 'utf8' });
this.env.log.ok(`Appflow Deploy manifest written to ${input(prettyPath(manifestPath))}!`);
}
default_bits = ${bits}
distinguished_name = req_distinguished_name
[req_distinguished_name]
countryName = ${countryName}
stateOrProvinceName = ${stateOrProvinceName}
localityName = ${localityName}
organizationName = ${organizationName}
commonName = ${commonName}
[SAN]
subjectAltName=DNS:${commonName}
`.trim();
const p = tmpfilepath('ionic-ssl');
await writeFile(p, cnf, { encoding: 'utf8' });
return p;
}
}
const newScope = `${scope}:registry=${url}\n`;
const newUrl = `${urlNoProt}:_authToken=${pk}\n`;
if (npmrc.match(scopeRegex)) {
npmrc = npmrc.replace(scopeRegex, newScope);
} else {
npmrc += newScope;
}
if (npmrc.match(urlRegex)) {
npmrc = npmrc.replace(urlRegex, newUrl);
} else {
npmrc += newUrl;
}
}
await writeFile(path.join(this.e.project.directory, `.npmrc`), npmrc, { encoding: 'utf8' });
}