Skip to content

Commit

Permalink
fix ts warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
benzaita committed Jul 7, 2019
1 parent 6b2e270 commit d80a033
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -47,7 +47,7 @@ $ npm install -g dockerized-cli
$ dockerized COMMAND
running command...
$ dockerized (-v|--version|version)
dockerized-cli/0.4.0 darwin-x64 node-v11.6.0
dockerized-cli/0.4.0 darwin-x64 node-v8.15.1
$ dockerized --help [COMMAND]
USAGE
$ dockerized COMMAND
Expand Down Expand Up @@ -146,11 +146,11 @@ USAGE
$ dockerized init
OPTIONS
-C, --composeFile=composeFile [default: .dockerized/docker-compose.dockerized.yml] Docker-Compose file to create
-D, --dockerFile=dockerFile [default: .dockerized/Dockerfile.dockerized] Dockerfile to create
--withGoCache Includes a volume for GOPATH
--[no-]withNestedDocker Includes support for running Docker inside Docker
--withYarnCache Includes support for utilizing yarn cache
--composeFile=composeFile [default: .dockerized/docker-compose.dockerized.yml] Docker-Compose file to create
--dockerFile=dockerFile [default: .dockerized/Dockerfile.dockerized] Dockerfile to create
--withGoCache Includes a volume for GOPATH
--[no-]withNestedDocker Includes support for running Docker inside Docker
--withYarnCache Includes support for utilizing yarn cache
EXAMPLE
$ dockerized init
Expand Down
2 changes: 1 addition & 1 deletion src/commands/compose.ts
Expand Up @@ -6,7 +6,7 @@ import runDockerCompose from '../utils/run-docker-compose';

const readConfig = createReadConfig();

function execDockerComposeCommand(command, baseDir, dockerComposeFile) {
function execDockerComposeCommand(command: string[], baseDir: string, dockerComposeFile: string) {
return runDockerCompose({
rejectOnNonZeroExitCode: false,
baseDir,
Expand Down
14 changes: 7 additions & 7 deletions src/commands/init.ts
Expand Up @@ -13,8 +13,8 @@ const composeConfig = {
dockerfile: '',
},
entrypoint: ['sh', '-c'],
environment: [],
volumes: [],
environment: [] as string[],
volumes: [] as string[],
// eslint-disable-next-line @typescript-eslint/camelcase
network_mode: '',
},
Expand All @@ -34,12 +34,10 @@ export default class Init extends Command {

public static flags = {
composeFile: flags.string({
char: 'C',
description: 'Docker-Compose file to create',
default: '.dockerized/docker-compose.dockerized.yml',
}),
dockerFile: flags.string({
char: 'D',
description: 'Dockerfile to create',
default: '.dockerized/Dockerfile.dockerized',
}),
Expand Down Expand Up @@ -70,13 +68,13 @@ export default class Init extends Command {
throw new Error('already initialized');
}

if (fs.existsSync(flags.composeFile)) {
if (flags.composeFile === undefined || fs.existsSync(flags.composeFile)) {
throw new Error(
`will not overwrite ${flags.composeFile}. Use --composeFile to choose a different name`,
);
}

if (fs.existsSync(flags.dockerFile)) {
if (flags.dockerFile === undefined || fs.existsSync(flags.dockerFile)) {
throw new Error(`will not overwrite ${flags.dockerFile}. Use --dockerFile to choose a different name`);
}

Expand All @@ -91,12 +89,14 @@ export default class Init extends Command {
if (flags.withYarnCache) {
composeConfig.services.dockerized.volumes.push('yarn-cache:/data/yarn-cache');
composeConfig.services.dockerized.environment.push('YARN_CACHE_FOLDER=/data/yarn-cache');
// @ts-ignore
composeConfig.volumes['yarn-cache'] = {};
}

if (flags.withGoCache) {
composeConfig.services.dockerized.volumes.push('go-cache:/go');
composeConfig.services.dockerized.environment.push('GOPATH=/go');
// @ts-ignore
composeConfig.volumes['go-cache'] = {};
}

Expand All @@ -106,7 +106,7 @@ export default class Init extends Command {
composeConfig.services.dockerized.network_mode = 'host';
}

fs.writeFileSync(config.composeFile, yaml.safeDump(composeConfig));
fs.writeFileSync(config.composeFile as string, yaml.safeDump(composeConfig));

fs.writeFileSync(flags.dockerFile, dockerConfig);

Expand Down
6 changes: 3 additions & 3 deletions src/operations/exec.ts
Expand Up @@ -11,9 +11,9 @@ const debug = createDebug('dockerized:exec');
export interface CreateExecInput {
config: Config;
baseDir: string;
runInContainer: typeof _runInContainer;
runDockerCompose: typeof _runDockerCompose;
writeConfig: typeof _writeConfig;
runInContainer?: typeof _runInContainer;
runDockerCompose?: typeof _runDockerCompose;
writeConfig?: typeof _writeConfig;
}

export default function createExec({
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -8,7 +8,7 @@
"allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"declaration": false, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
Expand Down

0 comments on commit d80a033

Please sign in to comment.