Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
fix(init): linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rudxde committed Mar 1, 2022
1 parent 486fbe5 commit 015764f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/init/src/bin.ts
@@ -1,5 +1,5 @@
import yargs from 'yargs';
import { command } from '.'
import { command } from '.';

yargs
.wrap(process.stdout.columns)
Expand Down
16 changes: 8 additions & 8 deletions packages/init/src/main.ts
Expand Up @@ -4,7 +4,7 @@ import { join as joinPath } from 'path';
import { spawn } from 'child_process';
// import type { Ora } from 'ora';
import { detectIdent } from './detect-ident';
export async function main(args: IInitArgs) {
export async function main(args: IInitArgs): Promise<void> {
// const spinner = (await import('ora')).default('Installing lerna-dockerize').start();
try {
await installLernaDockerize(args);
Expand Down Expand Up @@ -42,10 +42,10 @@ async function installLernaDockerize(args: IInitArgs): Promise<void> {
executable, ['install', ...(args.installAsDevDependency ? ['--save'] : ['--save-dev']), 'lerna-dockerize'],
{
cwd: args.workingDirectory ?? process.cwd(),
stdio: "pipe"
stdio: 'pipe',
});
await new Promise<void>((resolve, reject) => {
installProcess.on("close", (code) => {
installProcess.on('close', (code) => {
if (code !== 0) {
reject(new Error(`The installation of lerna-dockerize failed, the process exited with the unsuccessful statuscode '${code}'.`));
}
Expand All @@ -54,7 +54,7 @@ async function installLernaDockerize(args: IInitArgs): Promise<void> {
});
}

async function addTemplates(args: IInitArgs) {
async function addTemplates(args: IInitArgs): Promise<void> {
const baseDockerfileSrc = joinPath(__dirname, '../../templates/Dockerfile.base');
const templateDockerfileSrc = joinPath(__dirname, '../../templates/Dockerfile.template');
const baseDockerfileDest = joinPath(args.workingDirectory ?? process.cwd(), args.baseDockerfileName);
Expand All @@ -63,7 +63,7 @@ async function addTemplates(args: IInitArgs) {
await fsPromises.copyFile(templateDockerfileSrc, templateDockerfileDest);
}

async function addConfig(args: IInitArgs) {
async function addConfig(args: IInitArgs): Promise<void> {
const lernaConfigPath = joinPath(args.workingDirectory ?? process.cwd(), 'lerna.json');
if (!existsSync(lernaConfigPath)) {
throw new Error(`No lerna.json was found. Please run this command in a project directory!`);
Expand All @@ -74,14 +74,14 @@ async function addConfig(args: IInitArgs) {
lernaConfigObject['lerna-dockerize'] = {};
}
lernaConfigObject['lerna-dockerize'] = {
"templateDockerfileName": args.templateDockerFileName,
"baseDockerfileName": args.baseDockerfileName,
'templateDockerfileName': args.templateDockerFileName,
'baseDockerfileName': args.baseDockerfileName,
};
const indentation = detectIdent(lernaConfig);
await fsPromises.writeFile(lernaConfigPath, JSON.stringify(lernaConfigObject, undefined, indentation));
}

async function addScripts(args: IInitArgs) {
async function addScripts(args: IInitArgs): Promise<void> {
const packageJsonPath = joinPath(args.workingDirectory ?? process.cwd(), 'package.json');
if (!existsSync(packageJsonPath)) {
throw new Error(`No package.json was found. Please run this command in a project directory!`);
Expand Down

0 comments on commit 015764f

Please sign in to comment.