Skip to content

Commit

Permalink
Run prettier.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jun 5, 2021
1 parent 1bbac05 commit e682993
Show file tree
Hide file tree
Showing 90 changed files with 7,952 additions and 7,952 deletions.
14 changes: 7 additions & 7 deletions .config/beemo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export default {
module: '@beemo/dev',
drivers: ['babel', 'eslint', 'jest', 'prettier', 'typescript'],
settings: {
decorators: true,
node: true,
react: true,
},
module: '@beemo/dev',
drivers: ['babel', 'eslint', 'jest', 'prettier', 'typescript'],
settings: {
decorators: true,
node: true,
react: true,
},
};
14 changes: 7 additions & 7 deletions .config/beemo/jest.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export default {
coveragePathIgnorePatterns: [
'src/commands',
'src/components',
'tests/__fixtures__',
'tests/helpers.ts',
'website',
],
coveragePathIgnorePatterns: [
'src/commands',
'src/components',
'tests/__fixtures__',
'tests/helpers.ts',
'website',
],
};
12 changes: 6 additions & 6 deletions .config/beemo/typescript.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export default {
compilerOptions: {
outDir: 'build',
// This changes the structure of the DTS output folder, so avoid it.
resolveJsonModule: false,
},
include: ['src/**/*', 'tests/**/*', 'types/**/*'],
compilerOptions: {
outDir: 'build',
// This changes the structure of the DTS output folder, so avoid it.
resolveJsonModule: false,
},
include: ['src/**/*', 'tests/**/*', 'types/**/*'],
};
8 changes: 4 additions & 4 deletions packemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ global.__DEV__ = true;
global.__PROD__ = false;

try {
// Packemon built
require('./lib/bin');
// Packemon built
require('./lib/bin');
} catch {
// TypeScript built (initial setup)
require('./build/bin');
// TypeScript built (initial setup)
require('./build/bin');
}
14 changes: 7 additions & 7 deletions src/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"rules": {
"no-console": "off",
"no-magic-numbers": "off",
"no-use-before-define": "off",
"sort-keys": "off",
"promise/always-return": "off"
}
"rules": {
"no-console": "off",
"no-magic-numbers": "off",
"no-use-before-define": "off",
"sort-keys": "off",
"promise/always-return": "off"
}
}
128 changes: 64 additions & 64 deletions src/Artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,89 @@ import type { Package } from './Package';
import type { ArtifactState, Awaitable, BuildOptions, BuildResult, PackageExports } from './types';

export abstract class Artifact<T extends object = {}> {
readonly builds: T[] = [];
readonly builds: T[] = [];

readonly buildResult: BuildResult = { files: [], time: 0 };
readonly buildResult: BuildResult = { files: [], time: 0 };

readonly package: Package;
readonly package: Package;

state: ArtifactState = 'pending';
state: ArtifactState = 'pending';

constructor(pkg: Package, builds: T[]) {
this.package = pkg;
this.builds = builds;
}
constructor(pkg: Package, builds: T[]) {
this.package = pkg;
this.builds = builds;
}

cleanup(): Awaitable {}
cleanup(): Awaitable {}

isComplete(): boolean {
return this.state === 'passed' || this.state === 'failed';
}
isComplete(): boolean {
return this.state === 'passed' || this.state === 'failed';
}

isRunning(): boolean {
return this.state === 'building';
}
isRunning(): boolean {
return this.state === 'building';
}

startup() {}
startup() {}

toString(): string {
return this.getLabel();
}
toString(): string {
return this.getLabel();
}

protected logWithSource(
message: string,
level: 'error' | 'info' | 'warn',
{
id,
output,
sourceColumn,
sourceFile,
sourceLine,
}: {
id?: string;
output?: string;
sourceColumn?: number;
sourceFile?: string;
sourceLine?: number;
} = {},
) {
let msg = `[${this.package.getName()}${output ? `:${output}` : ''}] ${message}`;
protected logWithSource(
message: string,
level: 'error' | 'info' | 'warn',
{
id,
output,
sourceColumn,
sourceFile,
sourceLine,
}: {
id?: string;
output?: string;
sourceColumn?: number;
sourceFile?: string;
sourceLine?: number;
} = {},
) {
let msg = `[${this.package.getName()}${output ? `:${output}` : ''}] ${message}`;

const meta: string[] = [];
const meta: string[] = [];

if (id) {
meta.push(`id=${id}`);
}
if (id) {
meta.push(`id=${id}`);
}

if (sourceFile) {
meta.push(
`file=${new Path(sourceFile)
.path()
.replace(this.package.project.root.path(), '')
.slice(1)}`,
);
}
if (sourceFile) {
meta.push(
`file=${new Path(sourceFile)
.path()
.replace(this.package.project.root.path(), '')
.slice(1)}`,
);
}

if (sourceLine || sourceColumn) {
meta.push(`line=${sourceLine ?? '?'}:${sourceColumn ?? '?'}`);
}
if (sourceLine || sourceColumn) {
meta.push(`line=${sourceLine ?? '?'}:${sourceColumn ?? '?'}`);
}

if (meta.length > 0) {
msg += applyStyle(` (${meta.join(' ')})`, 'muted');
}
if (meta.length > 0) {
msg += applyStyle(` (${meta.join(' ')})`, 'muted');
}

console[level](msg);
}
console[level](msg);
}

protected async removeFiles(files: PortablePath[]): Promise<unknown> {
return Promise.all(files.map((file) => fs.remove(String(file))));
}
protected async removeFiles(files: PortablePath[]): Promise<unknown> {
return Promise.all(files.map((file) => fs.remove(String(file))));
}

abstract build(options: BuildOptions): Awaitable;
abstract build(options: BuildOptions): Awaitable;

abstract getLabel(): string;
abstract getLabel(): string;

abstract getBuildTargets(): string[];
abstract getBuildTargets(): string[];

abstract getPackageExports(): PackageExports;
abstract getPackageExports(): PackageExports;
}
Loading

0 comments on commit e682993

Please sign in to comment.