INNER CODE UNIT · JavaScript
dockerCommands
composerize/composerize · packages/composerize/src/index.js:241
const dockerCommands = input.split(/^(?:\s*\$)?\s*(?:docker|podman)\s+/gm);
let convertedExistingComposeFile = existingComposeFile;
if (existingComposeFile) {
if (composeVersion === 'v2x')
convertedExistingComposeFile = Composeverter.migrateFromV3xToV2x(convertedExistingComposeFile, { indent });
else if (composeVersion === 'latest')
convertedExistingComposeFile = Composeverter.migrateToCommonSpec(convertedExistingComposeFile, { indent });
}
dockerCommands.forEach((dockerCommand) => {
const command = String(dockerCommand);
if (!command) return;
if (!command.match(/^\s*(run|create|container\s+run|service\s+create)/)) {
globalComposeCreationComments.push(`# ignored : docker/podman ${command}\n`);
return;
}
const { composeFile, composeCreationComments } = getComposeFileJson(
`docker ${command}`,
convertedExistingComposeFile,