Skip to content

Commit

Permalink
chore: Update dependencies
Browse files Browse the repository at this point in the history
- Update dependencies for the root package.
- Update chalk and yargs for cli package.
- Update yargs for template package.
- Update ESLint configs.
  • Loading branch information
tommy351 committed May 3, 2020
1 parent e8f4831 commit 64ce055
Show file tree
Hide file tree
Showing 28 changed files with 5,733 additions and 3,806 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Expand Up @@ -3,9 +3,12 @@
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier", "jest"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:jest/recommended"
],
"rules": {
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
@@ -1,4 +1,5 @@
{
"tabWidth": 2,
"useTabs": false
"useTabs": false,
"trailingComma": "none"
}
8 changes: 5 additions & 3 deletions examples/getting-started/components/nginx.js
Expand Up @@ -22,9 +22,11 @@ const deployment = new Deployment({
{
image: "nginx",
name: "nginx",
ports: [{
containerPort: 80
}]
ports: [
{
containerPort: 80
}
]
}
]
}
Expand Down
9,375 changes: 5,651 additions & 3,724 deletions package-lock.json

Large diffs are not rendered by default.

55 changes: 26 additions & 29 deletions package.json
Expand Up @@ -26,47 +26,44 @@
}
},
"lint-staged": {
"*.ts": [
"eslint . --ext .js,.ts --fix",
"git add"
]
"*.{js,ts}": "eslint --fix"
},
"engines": {
"node": ">= 8"
},
"devDependencies": {
"@types/execa": "^2.0.0",
"@types/jest": "^24.0.18",
"@types/node": "^12.7.7",
"@types/jest": "^25.2.1",
"@types/node": "^13.13.4",
"@types/pkg-dir": "^2.0.1",
"@types/temp-dir": "^2.0.2",
"@types/tmp": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^2.3.1",
"@typescript-eslint/parser": "^2.3.1",
"codecov": "^3.6.1",
"cross-spawn": "^7.0.0",
"eslint": "^6.4.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-prettier": "^3.1.1",
"execa": "^2.0.4",
"globby": "^10.0.1",
"husky": "^3.0.5",
"jest": "^24.9.0",
"jest-extended": "^0.11.2",
"jest-junit": "^8.0.0",
"@types/tmp": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"codecov": "^3.6.5",
"cross-spawn": "^7.0.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-prettier": "^3.1.3",
"execa": "^4.0.0",
"globby": "^11.0.0",
"husky": "^4.2.5",
"jest": "^25.5.4",
"jest-extended": "^0.11.5",
"jest-junit": "^10.0.0",
"jest-serializer-path": "^0.1.15",
"kubernetes-models": "^0.7.2",
"lerna": "^3.16.4",
"lint-staged": "^9.3.0",
"kubernetes-models": "^0.7.3",
"lerna": "^3.20.2",
"lint-staged": "^10.2.2",
"npm-run-all": "^4.1.5",
"pkg-dir": "^4.2.0",
"prettier": "^1.18.2",
"symlink-dir": "^3.1.1",
"prettier": "^2.0.5",
"symlink-dir": "^4.0.3",
"temp-dir": "^2.0.0",
"tmp-promise": "^2.0.2",
"ts-jest": "^24.1.0",
"ts-node": "^8.4.1",
"typescript": "~3.6.3"
"ts-jest": "^25.4.0",
"ts-node": "^8.10.0",
"typescript": "~3.8.3"
}
}
7 changes: 3 additions & 4 deletions packages/cli/package.json
Expand Up @@ -32,7 +32,7 @@
"@kosko/generate": "^0.4.5",
"@kosko/migrate": "^0.1.3",
"@kosko/require": "^0.1.9",
"chalk": "^2.4.2",
"chalk": "^3.0.0",
"clean-stack": "^2.2.0",
"debug": "^4.1.1",
"exit": "^0.1.2",
Expand All @@ -42,16 +42,15 @@
"make-dir": "^3.0.0",
"signale": "^1.4.0",
"tslib": "^1.10.0",
"yargs": "^14.0.0"
"yargs": "^15.3.1"
},
"devDependencies": {
"@iarna/toml": "^2.2.3",
"@kosko/env": "^0.5.0",
"@types/chalk": "^2.2.0",
"@types/debug": "^4.1.2",
"@types/exit": "^0.1.30",
"@types/jsonpath": "^0.2.0",
"@types/signale": "^1.2.1",
"@types/yargs": "^13.0.2"
"@types/yargs": "^15.0.4"
}
}
6 changes: 2 additions & 4 deletions packages/cli/src/cli/__tests__/command.ts
Expand Up @@ -6,9 +6,7 @@ import { getLogger, parse, setLogger, wrapHandler } from "../command";
jest.mock("signale");

function newYargs(): Argv {
return jest
.requireActual("yargs/yargs")()
.detectLocale(false);
return jest.requireActual("yargs/yargs")().detectLocale(false);
}

describe("getLogger", () => {
Expand Down Expand Up @@ -74,7 +72,7 @@ describe("parse", () => {
let logger: Signale;

beforeEach(async () => {
handler.mockImplementationOnce(async ctx => {
handler.mockImplementationOnce(async (ctx) => {
logger = getLogger(ctx);
});

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/cli/__tests__/error.ts
@@ -1,4 +1,3 @@
// tslint:disable:no-console
import chalk from "chalk";
import cleanStack from "clean-stack";
import exit from "exit";
Expand Down
4 changes: 1 addition & 3 deletions packages/cli/src/cli/command.ts
Expand Up @@ -55,9 +55,7 @@ export function wrapHandler<T extends RootArguments>(
args[HANDLED] = true;
args = setLogger(args, logger);

handler(args)
.then(args[RESOLVE])
.catch(args[REJECT]);
handler(args).then(args[RESOLVE]).catch(args[REJECT]);
};
}

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/cli/error.ts
Expand Up @@ -39,7 +39,6 @@ export function handleError(err: any): void {
msg = formatError(err);
}

// tslint:disable-next-line:no-console
console.error(msg);
exit(code);
}
4 changes: 2 additions & 2 deletions packages/cli/src/commands/__tests__/migrate.ts
Expand Up @@ -95,7 +95,7 @@ describe("given a directory", () => {
test("should call print with result", async () => {
const files = await readDir(fixturePath);
const contents = await Promise.all(
files.map(file => readFile(join(fixturePath, file), "utf8"))
files.map((file) => readFile(join(fixturePath, file), "utf8"))
);
const expected = migrateString(contents.join("---\n"));
expect(print).toHaveBeenCalledWith(expected);
Expand All @@ -115,7 +115,7 @@ describe("given multiple files", () => {

test("should call print with result", async () => {
const contents = await Promise.all(
["only-deployment.yaml", "deployment-and-service.yaml"].map(file =>
["only-deployment.yaml", "deployment-and-service.yaml"].map((file) =>
readFile(join(fixturePath, file), "utf8")
)
);
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/commands/generate/index.ts
Expand Up @@ -67,7 +67,7 @@ async function setupEnv(

if (args.set && args.set.length) {
const reducer = createCLIEnvReducer(args.set);
env.setReducers(reducers => [...reducers, reducer]);
env.setReducers((reducers) => [...reducers, reducer]);
}

return env;
Expand Down Expand Up @@ -169,7 +169,9 @@ export const generateCmd: Command<GenerateArguments> = {
type: "string",
describe: "Output format",
default: PrintFormat.YAML,
choices: Object.keys(PrintFormat).map(key => (PrintFormat as any)[key]),
choices: Object.keys(PrintFormat).map(
(key) => (PrintFormat as any)[key]
),
alias: "o"
})
.option("validate", {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/migrate.ts
Expand Up @@ -34,7 +34,7 @@ async function readFilesInDir(dir: string): Promise<string> {

const files = await readDir(dir);
const contents = await Promise.all(
files.map(file => readFileString(join(dir, file)))
files.map((file) => readFileString(join(dir, file)))
);

return concatFiles(contents);
Expand All @@ -45,7 +45,7 @@ function readFiles(
files: ReadonlyArray<string>
): Promise<ReadonlyArray<string>> {
return Promise.all(
files.map(async file => {
files.map(async (file) => {
if (file === "-") {
debug("Reading from stdin");
return getStdin();
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/validate.ts
Expand Up @@ -5,7 +5,7 @@ const ajvValidate = require("../dist/ajv-validate");

function formatErrors(errors: ErrorObject[]): string {
if (!errors.length) return "No errors";
return errors.map(err => `${err.dataPath} ${err.message}`).join(", ");
return errors.map((err) => `${err.dataPath} ${err.message}`).join(", ");
}

export class ValidationError extends Error {
Expand Down
4 changes: 2 additions & 2 deletions packages/env/src/__tests__/environment.ts
Expand Up @@ -129,7 +129,7 @@ describe("when env is set", () => {
beforeEach(() => {
env.env = "dev";
envPath = join(fixturePath, "environments", env.env);
env.setReducers(reducers => reducers.concat(customReducer));
env.setReducers((reducers) => reducers.concat(customReducer));
});

afterEach(() => {
Expand Down Expand Up @@ -169,7 +169,7 @@ describe("when env is set", () => {
beforeEach(() => {
env.env = "dev";
envPath = join(fixturePath, "environments", env.env);
env.setReducers(reducers => reducers.concat(customReducer));
env.setReducers((reducers) => reducers.concat(customReducer));
env.resetReducers();
});

Expand Down
5 changes: 3 additions & 2 deletions packages/env/src/environment.ts
Expand Up @@ -98,7 +98,8 @@ export class Environment {
private createGlobalReducer(): Reducer {
const reducer: Reducer = {
name: "global",
reduce: values => merge(values, ...this.requireAllEnvs(this.paths.global))
reduce: (values) =>
merge(values, ...this.requireAllEnvs(this.paths.global))
};

return reducer;
Expand All @@ -125,7 +126,7 @@ export class Environment {

const envs = Array.isArray(this.env) ? this.env : [this.env];

return envs.map(env => {
return envs.map((env) => {
const path = formatPath(template, {
environment: env,
component
Expand Down
6 changes: 3 additions & 3 deletions packages/env/src/merge.ts
Expand Up @@ -2,9 +2,9 @@ import deepMerge from "deepmerge";
import isPlainObject from "is-plain-object";

// https://stackoverflow.com/a/48769843
type UnionToIntersection<U> = (U extends any
? (k: U) => void
: never) extends ((k: infer I) => void)
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
k: infer I
) => void
? I
: never;

Expand Down
4 changes: 1 addition & 3 deletions packages/generate/src/__tests__/error.ts
Expand Up @@ -55,9 +55,7 @@ describe("given cause with stack but without trace", () => {

test("should add path and index to stack", () => {
expect(err.stack).toStartWith(
`ValidationError: ${cause.message}\nPath: ${err.path}\nIndex: ${
err.index
}\n${cause.stack}`
`ValidationError: ${cause.message}\nPath: ${err.path}\nIndex: ${err.index}\n${cause.stack}`
);
});
});
2 changes: 1 addition & 1 deletion packages/generate/src/__tests__/generate.ts
Expand Up @@ -251,7 +251,7 @@ describe("given multiple patterns", () => {

describe("and three files", () => {
beforeAll(() => {
tmpFiles = ["a", "b", "c"].map(x => ({
tmpFiles = ["a", "b", "c"].map((x) => ({
path: `${x}.js`,
content: `module.exports = {value: '${x}'}`
}));
Expand Down
6 changes: 4 additions & 2 deletions packages/generate/src/__tests__/print.ts
Expand Up @@ -50,7 +50,7 @@ describe("when format = YAML", () => {

beforeAll(() => {
result = {
manifests: data.map(x => ({ path: "", index: 0, data: x }))
manifests: data.map((x) => ({ path: "", index: 0, data: x }))
};
});

Expand Down Expand Up @@ -81,7 +81,9 @@ describe("when format = JSON", () => {
const data = [{ foo: "bar" }, { bar: "boo" }, { boo: "baz" }];

beforeAll(() => {
result = { manifests: data.map(x => ({ path: "", index: 0, data: x })) };
result = {
manifests: data.map((x) => ({ path: "", index: 0, data: x }))
};
});

test("should write JSON wrapped with List", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/generate/src/extensions.ts
@@ -1,5 +1,5 @@
import requireExtensions from "./requireExtensions";

export function getExtensions(): ReadonlyArray<string> {
return Object.keys(requireExtensions).map(ext => ext.substring(1));
return Object.keys(requireExtensions).map((ext) => ext.substring(1));
}
2 changes: 1 addition & 1 deletion packages/generate/src/generate.ts
Expand Up @@ -61,7 +61,7 @@ async function getComponentValue(id: string): Promise<any> {
export async function generate(options: GenerateOptions): Promise<Result> {
const extensions = (options.extensions || getExtensions()).join(",");
const suffix = `?(.{${extensions}})`;
const patterns = options.components.map(x => x + suffix);
const patterns = options.components.map((x) => x + suffix);
debug("Component patterns", patterns);

const components = await glob(patterns, {
Expand Down
2 changes: 1 addition & 1 deletion packages/generate/src/print.ts
Expand Up @@ -51,7 +51,7 @@ const arrPrinters: PrinterMap<any[]> = {
* @param options
*/
export function print(result: Result, { format, writer }: PrintOptions): void {
const data = result.manifests.map(manifest => manifest.data);
const data = result.manifests.map((manifest) => manifest.data);
if (!data.length) return;

if (data.length > 1) {
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/src/__tests__/migrate.ts
Expand Up @@ -157,7 +157,7 @@ describe("migrate", () => {
});

test("should export ConfigMap instances", () => {
expect(exported).toSatisfyAll(x => x instanceof ConfigMap);
expect(exported).toSatisfyAll((x) => x instanceof ConfigMap);
});
});

Expand Down

0 comments on commit 64ce055

Please sign in to comment.