Skip to content

Commit

Permalink
chore(ts): use double quotes to reduce code gen noise
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed May 20, 2024
1 parent 478e718 commit d05c262
Show file tree
Hide file tree
Showing 259 changed files with 5,127 additions and 5,128 deletions.
1 change: 0 additions & 1 deletion ts/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"singleQuote": true,
"trailingComma": "all"
}
28 changes: 14 additions & 14 deletions ts/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
const common = {
transform: {
'^.+\\.(t|j)s$': ['ts-jest', { tsconfig: './tsconfig.json' }],
"^.+\\.(t|j)s$": ["ts-jest", { tsconfig: "./tsconfig.json" }],
},
rootDir: '.',
setupFiles: ['./test/setup.ts'],
rootDir: ".",
setupFiles: ["./test/setup.ts"],
};

module.exports = {
collectCoverageFrom: [
'<rootDir>/src/**/*.{js,ts}',
'!<rootDir>/src/generated/**/*',
'!<rootDir>/src/deprecated/**/*',
'!<rootDir>/src/patch/index.*',
'!<rootDir>/src/index.*',
"<rootDir>/src/**/*.{js,ts}",
"!<rootDir>/src/generated/**/*",
"!<rootDir>/src/deprecated/**/*",
"!<rootDir>/src/patch/index.*",
"!<rootDir>/src/index.*",
],
projects: [
{
displayName: 'unit',
displayName: "unit",
...common,
testMatch: ['<rootDir>/src/**/*.spec.ts'],
setupFilesAfterEnv: ['./test/setup-unit-tests.ts'],
testMatch: ["<rootDir>/src/**/*.spec.ts"],
setupFilesAfterEnv: ["./test/setup-unit-tests.ts"],
},
{
displayName: 'functional',
displayName: "functional",
...common,
testMatch: ['<rootDir>/test/functional/**/*.spec.ts'],
setupFilesAfterEnv: ['./test/setup-functional-tests.ts'],
testMatch: ["<rootDir>/test/functional/**/*.spec.ts"],
setupFilesAfterEnv: ["./test/setup-functional-tests.ts"],
},
],
};
16 changes: 8 additions & 8 deletions ts/script/generate-exports.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');
const staticExports = require('../static-exports.json');
const fs = require("fs");
const path = require("path");
const staticExports = require("../static-exports.json");

const distDir = path.resolve(__dirname, '../dist/generated');
const distDir = path.resolve(__dirname, "../dist/generated");
const files = fs.readdirSync(distDir);
const paths = files.reduce((acc, file) => {
const match = file.match(/index.(.*)\.d\.ts/);

if (match) {
const dottedPath = match[1];
const slashedPath = dottedPath.replace(/\./g, '/');
const slashedPath = dottedPath.replace(/\./g, "/");
const resolvedPath = fs.existsSync(`./dist/patch/index.${dottedPath}.js`)
? `./dist/patch/index.${dottedPath}`
: `./dist/generated/index.${dottedPath}`;
Expand All @@ -23,17 +23,17 @@ const paths = files.reduce((acc, file) => {
return acc;
}, staticExports);

const tsconfigPaths = path.resolve(__dirname, '../tsconfig.paths.json');
const tsconfigPaths = path.resolve(__dirname, "../tsconfig.paths.json");
fs.writeFileSync(
tsconfigPaths,
JSON.stringify({ compilerOptions: { paths: paths.tsconfig } }, null, 2),
);

const packageJson = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'),
fs.readFileSync(path.resolve(__dirname, "../package.json"), "utf8"),
);
packageJson.exports = paths.package;
fs.writeFileSync(
path.resolve(__dirname, '../package.json'),
path.resolve(__dirname, "../package.json"),
JSON.stringify(packageJson, null, 2),
);
8 changes: 4 additions & 4 deletions ts/script/remove-exports.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

const packageJson = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'),
fs.readFileSync(path.resolve(__dirname, "../package.json"), "utf8"),
);
delete packageJson.exports;
fs.writeFileSync(
path.resolve(__dirname, '../package.json'),
path.resolve(__dirname, "../package.json"),
JSON.stringify(packageJson, null, 2),
);
42 changes: 21 additions & 21 deletions ts/src/deprecated/akash/base/v1beta1/attribute.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable */
import { messageTypeRegistry } from '../../../typeRegistry';
import Long from 'long';
import * as _m0 from 'protobufjs/minimal';
import { messageTypeRegistry } from "../../../typeRegistry";
import Long from "long";
import * as _m0 from "protobufjs/minimal";

export const protobufPackage = 'akash.base.v1beta1';
export const protobufPackage = "akash.base.v1beta1";

/** Attribute represents key value pair */
export interface Attribute {
$type: 'akash.base.v1beta1.Attribute';
$type: "akash.base.v1beta1.Attribute";
key: string;
value: string;
}
Expand All @@ -19,7 +19,7 @@ export interface Attribute {
* this behaviour to be discussed
*/
export interface SignedBy {
$type: 'akash.base.v1beta1.SignedBy';
$type: "akash.base.v1beta1.SignedBy";
/** all_of all keys in this list must have signed attributes */
allOf: string[];
/** any_of at least of of the keys from the list must have signed attributes */
Expand All @@ -28,28 +28,28 @@ export interface SignedBy {

/** PlacementRequirements */
export interface PlacementRequirements {
$type: 'akash.base.v1beta1.PlacementRequirements';
$type: "akash.base.v1beta1.PlacementRequirements";
/** SignedBy list of keys that tenants expect to have signatures from */
signedBy: SignedBy | undefined;
/** Attribute list of attributes tenant expects from the provider */
attributes: Attribute[];
}

function createBaseAttribute(): Attribute {
return { $type: 'akash.base.v1beta1.Attribute', key: '', value: '' };
return { $type: "akash.base.v1beta1.Attribute", key: "", value: "" };
}

export const Attribute = {
$type: 'akash.base.v1beta1.Attribute' as const,
$type: "akash.base.v1beta1.Attribute" as const,

encode(
message: Attribute,
writer: _m0.Writer = _m0.Writer.create(),
): _m0.Writer {
if (message.key !== '') {
if (message.key !== "") {
writer.uint32(10).string(message.key);
}
if (message.value !== '') {
if (message.value !== "") {
writer.uint32(18).string(message.value);
}
return writer;
Expand Down Expand Up @@ -79,8 +79,8 @@ export const Attribute = {
fromJSON(object: any): Attribute {
return {
$type: Attribute.$type,
key: isSet(object.key) ? String(object.key) : '',
value: isSet(object.value) ? String(object.value) : '',
key: isSet(object.key) ? String(object.key) : "",
value: isSet(object.value) ? String(object.value) : "",
};
},

Expand All @@ -95,20 +95,20 @@ export const Attribute = {
object: I,
): Attribute {
const message = createBaseAttribute();
message.key = object.key ?? '';
message.value = object.value ?? '';
message.key = object.key ?? "";
message.value = object.value ?? "";
return message;
},
};

messageTypeRegistry.set(Attribute.$type, Attribute);

function createBaseSignedBy(): SignedBy {
return { $type: 'akash.base.v1beta1.SignedBy', allOf: [], anyOf: [] };
return { $type: "akash.base.v1beta1.SignedBy", allOf: [], anyOf: [] };
}

export const SignedBy = {
$type: 'akash.base.v1beta1.SignedBy' as const,
$type: "akash.base.v1beta1.SignedBy" as const,

encode(
message: SignedBy,
Expand Down Expand Up @@ -183,14 +183,14 @@ messageTypeRegistry.set(SignedBy.$type, SignedBy);

function createBasePlacementRequirements(): PlacementRequirements {
return {
$type: 'akash.base.v1beta1.PlacementRequirements',
$type: "akash.base.v1beta1.PlacementRequirements",
signedBy: undefined,
attributes: [],
};
}

export const PlacementRequirements = {
$type: 'akash.base.v1beta1.PlacementRequirements' as const,
$type: "akash.base.v1beta1.PlacementRequirements" as const,

encode(
message: PlacementRequirements,
Expand Down Expand Up @@ -291,14 +291,14 @@ export type DeepPartial<T> = T extends Builtin
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in Exclude<keyof T, '$type'>]?: DeepPartial<T[K]> }
? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
: Partial<T>;

type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P> | '$type'>,
Exclude<keyof I, KeysOfUnion<P> | "$type">,
never
>;

Expand Down
30 changes: 15 additions & 15 deletions ts/src/deprecated/akash/base/v1beta1/endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable */
import { messageTypeRegistry } from '../../../typeRegistry';
import Long from 'long';
import * as _m0 from 'protobufjs/minimal';
import { messageTypeRegistry } from "../../../typeRegistry";
import Long from "long";
import * as _m0 from "protobufjs/minimal";

export const protobufPackage = 'akash.base.v1beta1';
export const protobufPackage = "akash.base.v1beta1";

/** Endpoint describes a publicly accessible IP service */
export interface Endpoint {
$type: 'akash.base.v1beta1.Endpoint';
$type: "akash.base.v1beta1.Endpoint";
kind: Endpoint_Kind;
}

Expand All @@ -23,13 +23,13 @@ export enum Endpoint_Kind {
export function endpoint_KindFromJSON(object: any): Endpoint_Kind {
switch (object) {
case 0:
case 'SHARED_HTTP':
case "SHARED_HTTP":
return Endpoint_Kind.SHARED_HTTP;
case 1:
case 'RANDOM_PORT':
case "RANDOM_PORT":
return Endpoint_Kind.RANDOM_PORT;
case -1:
case 'UNRECOGNIZED':
case "UNRECOGNIZED":
default:
return Endpoint_Kind.UNRECOGNIZED;
}
Expand All @@ -38,21 +38,21 @@ export function endpoint_KindFromJSON(object: any): Endpoint_Kind {
export function endpoint_KindToJSON(object: Endpoint_Kind): string {
switch (object) {
case Endpoint_Kind.SHARED_HTTP:
return 'SHARED_HTTP';
return "SHARED_HTTP";
case Endpoint_Kind.RANDOM_PORT:
return 'RANDOM_PORT';
return "RANDOM_PORT";
case Endpoint_Kind.UNRECOGNIZED:
default:
return 'UNRECOGNIZED';
return "UNRECOGNIZED";
}
}

function createBaseEndpoint(): Endpoint {
return { $type: 'akash.base.v1beta1.Endpoint', kind: 0 };
return { $type: "akash.base.v1beta1.Endpoint", kind: 0 };
}

export const Endpoint = {
$type: 'akash.base.v1beta1.Endpoint' as const,
$type: "akash.base.v1beta1.Endpoint" as const,

encode(
message: Endpoint,
Expand Down Expand Up @@ -123,14 +123,14 @@ export type DeepPartial<T> = T extends Builtin
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in Exclude<keyof T, '$type'>]?: DeepPartial<T[K]> }
? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
: Partial<T>;

type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P> | '$type'>,
Exclude<keyof I, KeysOfUnion<P> | "$type">,
never
>;

Expand Down
Loading

0 comments on commit d05c262

Please sign in to comment.