Skip to content

Commit

Permalink
rename bleep to build
Browse files Browse the repository at this point in the history
the secret (if not bloodless) coup is complete
  • Loading branch information
schlawg committed Dec 18, 2022
1 parent dca16b8 commit aadebf8
Show file tree
Hide file tree
Showing 28 changed files with 64 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
id: ab
- run: pnpm link --dir ui/round "$GITHUB_WORKSPACE/ab"
if: steps.ab.outcome == 'success'
- run: ./ui/bleep -p
- run: ./ui/build -p
- run: cd ui && pnpm run test && cd -
- run: mkdir assets && mv public assets/ && cp LICENSE COPYING.md README.md assets/ && git log -n 1 --pretty=oneline > assets/commit.txt
- run: cd assets && tar -cvpJf ../assets.tar.xz . && cd -
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
project/.bloop/
conf/application.conf
conf/version.conf
ui/@build/bleep/bleep.config.json
ui/@build/build-config.json

logs
project/metals.sbt
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"lint": "eslint . --ext .ts",
"lila-journal": "journalctl --user -fu lila -o cat",
"serverlog": "multitail -cT ansi -l 'pnpm lila-journal' -cT ansi -ke '^[0-9\\.]{10} ' -I .metals/metals.log",
"multilog": "multitail -cT ansi -l 'pnpm lila-journal' -cT ansi -L 'ui/bleep -w' -cT ansi -ke '^[0-9\\.]{10} ' -I .metals/metals.log"
"multilog": "multitail -cT ansi -l 'pnpm lila-journal' -cT ansi -L 'ui/build -w' -cT ansi -ke '^[0-9\\.]{10} ' -I .metals/metals.log"
}
}
24 changes: 23 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ packages:
- 'ui'
- 'ui/*'
- 'ui/@types/*'
- 'ui/@build/*'
8 changes: 0 additions & 8 deletions ui/@build/bleep/readme

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion ui/@build/bleep/package.json → ui/@build/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "bleep",
"name": "build",
"version": "2.0.0",
"private": true,
"author": "Thibault Duplessis",
Expand Down
8 changes: 8 additions & 0 deletions ui/@build/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Usage examples:

build # builds all client assets in dev mode (inline sources)
build -w # builds all client assets and watches for changes
build -p # builds minified client assets (prod builds)
build analyse site msg # specify isolated modules (don't build everything)
build -w dasher chart # watch mode works for isolated modules as well

File renamed without changes.
6 changes: 3 additions & 3 deletions ui/@build/bleep/src/esbuild.ts → ui/@build/src/esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function esbuild(): Promise<void> {
}
/*
const onStartPlugin = {
name: 'bleepOnStart',
name: 'lichessOnStart',
setup(build: es.PluginBuild) {
build.onStart(() => env.log(c.grey('Bundling') + ' modules', { ctx: 'esbuild' }));
},
Expand All @@ -51,7 +51,7 @@ const onStartPlugin = {
const fileFilter = new RegExp(`\\${path.sep}ui\\${path.sep}(.+\\.ts)$`);
const onLoadPlugin = {
// more like onMurderScrollbackBuffer
name: 'bleepOnLoad',
name: 'lichessOnLoad',
setup(build: es.PluginBuild) {
build.onLoad({ filter: fileFilter }, (o: es.OnLoadArgs): es.OnLoadResult | undefined => {
env.log(`Bundling '${c.cyan(fileFilter.exec(o.path)![1])}'`, { ctx: 'esbuild' });
Expand All @@ -61,7 +61,7 @@ const onLoadPlugin = {
};*/

const onEndPlugin = {
name: 'bleepOnEnd',
name: 'lichessOnEnd',
setup(build: es.PluginBuild) {
build.onEnd((result: es.BuildResult) => {
for (const err of result.errors) {
Expand Down
23 changes: 10 additions & 13 deletions ui/@build/bleep/src/main.ts → ui/@build/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as fs from 'node:fs';
import { build, postBuild } from './build';

export function main() {
const configPath = path.resolve(__dirname, '../bleep.config.json');
const configPath = path.resolve(__dirname, '../build-config.json');
const config = fs.existsSync(configPath) ? JSON.parse(fs.readFileSync(configPath, 'utf8')) : undefined;
init(path.resolve(__dirname, '../../../..'), config);
init(path.resolve(__dirname, '../../..'), config);

if (ps.argv.includes('--help') || ps.argv.includes('-h')) {
console.log(fs.readFileSync(path.resolve(__dirname, '../readme'), 'utf8'));
Expand All @@ -22,7 +22,7 @@ export function main() {
build(ps.argv.slice(2).filter(x => !x.startsWith('-')));
}

export interface BleepOpts {
export interface BuildOpts {
sass?: boolean; // compile scss, default = true
esbuild?: boolean; // bundle with esbuild, default = true
tsc?: boolean; // use tsc for type checking, default = true
Expand Down Expand Up @@ -56,12 +56,12 @@ export interface LichessBundle {
output: string; // abs path to bundle destination
}

export function init(root: string, opts?: BleepOpts) {
export function init(root: string, opts?: BuildOpts) {
env.rootDir = root;
env.opts = opts ? opts : { log: {} };
if (env.opts.log && env.opts.log.color !== false) {
env.opts.log.color = {
bleep: 'green',
build: 'green',
sass: 'magenta',
tsc: 'yellow',
esbuild: 'blue',
Expand Down Expand Up @@ -96,7 +96,7 @@ export const colors = {

class Env {
rootDir: string; // absolute path to lila project root
opts: BleepOpts; // configure logging mostly
opts: BuildOpts; // configure logging mostly
watch = false;
prod = false;
exitCode = new Map<'sass' | 'tsc' | 'esbuild', number | false>();
Expand Down Expand Up @@ -129,19 +129,16 @@ class Env {
get buildDir(): string {
return path.join(this.uiDir, '@build');
}
get bleepDir(): string {
return path.join(this.buildDir, 'bleep');
}
warn(d: any, ctx = 'bleep') {
warn(d: any, ctx = 'build') {
this.log(d, { ctx: ctx, warn: true });
}
error(d: any, ctx = 'bleep') {
error(d: any, ctx = 'build') {
this.log(d, { ctx: ctx, error: true });
}
good(ctx = 'bleep') {
good(ctx = 'build') {
this.log(colors.good('No errors') + env.watch ? ` - ${colors.grey('Watching')}...` : '', { ctx: ctx });
}
log(d: any, { ctx = 'bleep', error = false, warn = false } = {}) {
log(d: any, { ctx = 'build', error = false, warn = false } = {}) {
let text: string =
typeof d === 'string'
? d
Expand Down
2 changes: 1 addition & 1 deletion ui/@build/bleep/src/parse.ts → ui/@build/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { LichessModule, env } from './main';
export const parseModules = async (): Promise<[Map<string, LichessModule>, Map<string, string[]>]> => {
const moduleList: LichessModule[] = [];

for (const dir of (await globArray('*/package.json')).map(pkg => path.dirname(pkg))) {
for (const dir of (await globArray('[^@]*/package.json')).map(pkg => path.dirname(pkg))) {
moduleList.push(await parseModule(dir));
}
const modules = new Map(moduleList.map(mod => [mod.name, mod]));
Expand Down
2 changes: 1 addition & 1 deletion ui/@build/bleep/src/sass.ts → ui/@build/src/sass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function sass(): Promise<void> {
watcher.on('change', onChanges.bind(null, dir));
watcher.on('error', (err: Error) => env.error(err, 'sass'));
watcher.on('close', () => {
env.error('Watcher closed unexpectedly. Exiting', 'bleep');
env.error('Watcher closed unexpectedly. Exiting');
ps.exit(-1);
});
}
Expand Down
2 changes: 1 addition & 1 deletion ui/@build/bleep/src/tsc.ts → ui/@build/src/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { env, colors as c, errorMark, lines } from './main';
export async function tsc(onSuccess: () => void) {
if (!env.tsc) return onSuccess();

const cfgPath = path.join(env.buildDir, 'bleep', 'dist', 'build.tsconfig.json');
const cfgPath = path.join(env.buildDir, 'dist', 'build.tsconfig.json');
const cfg: any = { files: [] };
cfg.references = buildModules.filter(x => x.hasTsconfig).map(x => ({ path: path.join(x.root, 'tsconfig.json') }));
await fs.promises.writeFile(cfgPath, JSON.stringify(cfg));
Expand Down
2 changes: 1 addition & 1 deletion ui/@build/bleep/tsconfig.json → ui/@build/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig_module.base.json",
"extends": "../tsconfig_module.base.json",
"include": ["src/*.ts"],
"exclude": [],
"compilerOptions": {
Expand Down
1 change: 1 addition & 0 deletions ui/analyse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"author": "Thibault Duplessis",
"license": "AGPL-3.0-or-later",
"devDependencies": {
"@types/cash": "8.0.0",
"@types/debounce-promise": "^3.1.4",
"@types/highcharts": "=4.2.57",
"@types/lichess": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion ui/bleep → ui/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ UI_DIR=$(dirname $(readlink -f "${BASH_SOURCE:-$0}"))
cd "$UI_DIR/.."
pnpm i

cd "$UI_DIR/@build/bleep"
cd "$UI_DIR/@build"
pnpm -s dev "$@"
1 change: 1 addition & 0 deletions ui/challenge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"snabbdom": "^3.3.1"
},
"devDependencies": {
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"typescript": "^4"
},
Expand Down
1 change: 1 addition & 0 deletions ui/chess/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"snabbdom": "^3.3.1"
},
"devDependencies": {
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"typescript": "^4"
},
Expand Down
Loading

0 comments on commit aadebf8

Please sign in to comment.