Skip to content

Commit cde3b68

Browse files
committed
some cleanup
1 parent bbcd7d6 commit cde3b68

File tree

12 files changed

+53
-66
lines changed

12 files changed

+53
-66
lines changed

build/plugins/build-plugins.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const build = async () => {
3030

3131
console.log(packages.officialPackages.length, "official packages found");
3232

33-
const packageNames: string[] = [];
33+
const packageNames = new Set<string>();
3434

3535
await useTempDir(async (dir) => {
3636
for (const pkg of packages.officialPackages) {
@@ -83,15 +83,15 @@ const build = async () => {
8383
path.join(outDir, folderName, "package.json")
8484
);
8585

86-
packageNames.push(folderName);
86+
packageNames.add(folderName);
8787
} catch (error) {
8888
console.log("error building", file.path, error);
8989
}
9090
}
9191
}
9292
}
9393

94-
writeFileSync(path.join(outDir, "index.json"), JSON.stringify(packageNames));
94+
writeFileSync(path.join(outDir, "index.json"), JSON.stringify([...packageNames]));
9595
});
9696

9797
//todo: convert to vite build
File renamed without changes.

bundled/styles.css

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
@font-face {
22
font-family: "Conthrax";
3-
src: url("../../../../bundled/assets/conthrax-rg.otf") format("opentype");
3+
src: url("assets/conthrax-rg.otf") format("opentype");
44
font-style: normal;
55
font-weight: 100 400;
66
}
77

88
@font-face {
99
font-family: "Conthrax-Bold";
10-
src: url("../../../../bundled/assets/conthrax-hv.otf") format("opentype");
10+
src: url("assets/conthrax-hv.otf") format("opentype");
1111
font-style: normal;
1212
font-weight: 500 900;
1313
}
1414

1515
@font-face {
1616
font-family: "Inter";
17-
src: url("../../../../bundled/assets/Inter-VariableFont_slnt,wght.ttf")
18-
format("truetype");
17+
src: url("assets/Inter-VariableFont_slnt,wght.ttf") format("truetype");
1918
}
2019

2120
:root {
@@ -97,4 +96,4 @@ ul {
9796

9897
td {
9998
padding: 1rem;
100-
}
99+
}

configuration.html

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<html lang="en" style="background: white">
33
<head>
44
<meta charset="utf-8" />
5+
<link rel="stylesheet" href="./bundled/assets/normalize.min.css" />
6+
<link rel="stylesheet" href="./bundled/assets/open-props.1.4.min.css" />
7+
<link rel="stylesheet" href="./bundled/assets/buttons.min.css" />
58
</head>
69

710
<body style="overflow: auto">

index.html

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<!DOCTYPE html>
22
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="stylesheet" href="./bundled/assets/reset.css" />
6+
<link rel="stylesheet" href="./bundled/assets/open-props.1.4.min.css" />
7+
<link rel="stylesheet" href="./bundled/styles.css" />
8+
</head>
39

4-
<head>
5-
<meta charset="utf-8">
6-
<link rel="stylesheet" href="./bundled/styles.css">
7-
</head>
8-
9-
<body>
10-
<div id="app"></div>
11-
<script type="module" src="./src/renderer/core/titan-reactor.ts"></script>
12-
</body>
13-
14-
</html>
10+
<body>
11+
<div id="app"></div>
12+
<script type="module" src="./src/renderer/core/titan-reactor.ts"></script>
13+
</body>
14+
</html>

package.json

+8-10
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@
1111
"test": "jest --watchAll",
1212
"test:once": "jest --runInBand",
1313
"test:debug": "node --inspect node_modules/jest/bin/jest --runInBand",
14-
"clear-cache": "rimraf .cache dist",
14+
"test:build": "http-server .\\dist\\titan-reactor -p 80",
1515
"lint": "yarn eslint . && yarn prettier --check .",
1616
"postinstall": "git apply -v --stat --directory=node_modules/scm-extractor build/patches/scm-extractor.patch",
17-
"build-api-types": "ts-node -T .\\build\\api-types\\index.ts",
18-
"build-plugin-api-docs:host": "typedoc --out docs/host --tsconfig tsconfig.host-api.json build/api-types/host/index.d.ts",
19-
"build-plugin-api-docs:ui": "typedoc --out docs/ui --tsconfig tsconfig.ui-api.json build/api-types/ui/index.d.ts",
20-
"build-api-docs": "yarn build-plugin--api-docs:host && yarn build-plugin--api-docs:ui",
21-
"plugins:build": "ts-node -T .\\build\\plugins\\build-plugins.ts",
22-
"plugins:serve": "http-server .\\dist\\plugins -p 8090 --cors",
17+
"generate:api-types": "ts-node -T .\\build\\api-types\\index.ts",
18+
"generate:plugin-api-docs": "typedoc --out docs/host --tsconfig tsconfig.host-api.json build/api-types/host/index.d.ts && typedoc --out docs/ui --tsconfig tsconfig.ui-api.json build/api-types/ui/index.d.ts",
19+
"build:plugins": "ts-node -T ./esbuild.runtime.ts && ts-node -T .\\build\\plugins\\build-plugins.ts",
20+
"serve:plugins": "http-server .\\dist\\plugins -p 8090 --cors",
2321
"web": "vite -c vite.config.web.ts",
24-
"web:build": "vite build -c vite.config.web.ts",
25-
"runtime:build": "ts-node -T ./esbuild.runtime.ts",
26-
"plugins:all": "yarn runtime:build && yarn plugins:build && yarn plugins:serve"
22+
"build:web": "vite build -c vite.config.web.ts",
23+
"plugins": "yarn build:plugins && yarn serve:plugins",
24+
"build": "yarn build:web && yarn build:plugins"
2725
},
2826
"repository": {
2927
"type": "git",

src/renderer/configuration-ui/index.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ import { MacrosPanel } from "./macros-ui/macros-panel";
99
import { PluginsConfiguration } from "./plugins-configuration";
1010
import { Helmet } from "react-helmet";
1111

12-
import "../../../bundled/assets/normalize.min.css";
13-
import "../../../bundled/assets/open-props.1.4.min.css";
14-
import "../../../bundled/assets/buttons.min.css";
15-
1612
document.title = "Configuration";
1713

1814
const s = document.createElement( "link" );
1915
s.rel = "stylesheet";
2016
s.href = "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap";
2117
document.head.appendChild( s );
2218

23-
2419
const CommandCenter = () => {
2520
const [ banner, setBanner ] = useState( "" );
2621

@@ -67,7 +62,7 @@ const root = createRoot( container! );
6762
// root.render( <CommandCenter /> )
6863

6964
window.opener.postMessage( {
70-
type: "connect"
65+
type: "connect",
7166
} );
7267

7368
window.addEventListener( "message", ( event ) => {
@@ -76,6 +71,6 @@ window.addEventListener( "message", ( event ) => {
7671
window.deps.useSettingsStore.subscribe( ( state ) => {
7772
console.log( "state", state );
7873
} );
79-
root.render( <CommandCenter /> )
74+
root.render( <CommandCenter /> );
8075
}
81-
} );
76+
} );

src/renderer/scenes/iscriptah/iscriptah.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
Vector4,
1414
} from "three";
1515
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
16-
import "../../../../bundled/assets/open-props.1.4.min.css";
17-
import "../../../../bundled/assets/normalize.min.css";
18-
import "../pre-home-scene/styles.css";
16+
// import "../../../../bundled/assets/open-props.1.4.min.css";
17+
// import "../../../../bundled/assets/normalize.min.css";
18+
// import "../pre-home-scene/styles.css";
1919

2020
import App from "./components/app";
2121
import { Surface } from "@image/canvas/surface";
@@ -41,15 +41,14 @@ import { IScriptImage } from "./iscript-sprite";
4141
import { getDirection32 } from "@utils/camera-utils";
4242

4343
const bootup = async () => {
44-
45-
await initializeAssets( );
44+
await initializeAssets();
4645

4746
const janitor = new Janitor( "iscriptah-scene-loader" );
4847

4948
const surface = new Surface();
5049
surface.setDimensions( 300, 300, window.devicePixelRatio );
5150

52-
const renderComposer = new TitanRenderComposer(surface);
51+
const renderComposer = new TitanRenderComposer( surface );
5352

5453
const scene = new Scene();
5554
janitor.mop( scene, "scene" );
@@ -156,7 +155,7 @@ const bootup = async () => {
156155
const renderPass = new RenderPass( scene, cameras[0] );
157156

158157
const postProcessingBundle = {
159-
passes: [renderPass],
158+
passes: [ renderPass ],
160159
};
161160

162161
renderComposer.setBundlePasses( postProcessingBundle );
@@ -186,7 +185,7 @@ const bootup = async () => {
186185
const preload = async () => {
187186
const { header } = block;
188187

189-
const atlas = await loadImageAtlasDirect( block.image.index )// true );
188+
const atlas = await loadImageAtlasDirect( block.image.index ); // true );
190189

191190
const image = isGltfAtlas( atlas )
192191
? new Image3D( atlas )

src/renderer/utils/renderer-utils.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ export const logCapabilities = () => {
77
// log.info( `@init: chrome ${process.versions.chrome}` );
88
log.info( `@init: resolution ${window.innerWidth}x${window.innerHeight}` );
99

10-
getWebGLRenderer(r => {
10+
getWebGLRenderer( ( r ) => {
1111
log.debug( "@init: webgl capabilities" );
1212
for ( const prop of Object.getOwnPropertyNames( r.capabilities ) ) {
1313
const value = r.capabilities[prop as keyof typeof r.capabilities];
1414
if ( typeof value === "function" ) continue;
1515
log.debug( `- ${prop}: ${value}` );
1616
}
17-
17+
1818
log.debug( `- anisotropy: ${r.capabilities.getMaxAnisotropy()}` );
1919
log.debug( `- max precision: ${r.capabilities.getMaxPrecision( "highp" )}` );
2020
log.debug( "webgl extensions" );
21-
log.debug( `- EXT_color_buffer_float ${r.extensions.has( "EXT_color_buffer_float" )}` );
21+
log.debug(
22+
`- EXT_color_buffer_float ${r.extensions.has( "EXT_color_buffer_float" )}`
23+
);
2224
log.debug(
2325
`- OES_texture_float_linear ${r.extensions.has( "OES_texture_float_linear" )}`
2426
);
@@ -32,11 +34,9 @@ export const logCapabilities = () => {
3234
"WEBGL_multisampled_render_to_texture"
3335
)}`
3436
);
35-
36-
r.extensions.init( r.capabilities );
37-
38-
log.debug( `@init: device pixel ratio: ${window.devicePixelRatio}` );
39-
})
4037

38+
r.extensions.init( r.capabilities );
4139

40+
log.debug( `@init: device pixel ratio: ${window.devicePixelRatio}` );
41+
} );
4242
};

src/runtime.html

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<link
5-
rel="stylesheet"
6-
href="https://unpkg.com/[email protected]/open-props.min.css" />
7-
<link
8-
rel="stylesheet"
9-
href="https://unpkg.com/[email protected]/normalize.min.css" />
4+
<link rel="stylesheet" href="assets/open-props.1.4.min.css" />
5+
<link rel="stylesheet" href="assets/normalize.min.css" />
106

117
<style>
128
@font-face {

vite.config.web.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@ import tsConfig from "./tsconfig.json";
66
import { sharedViteConfig } from "./vite.shared";
77
// import mkcert from 'vite-plugin-mkcert'
88

9-
const OUT_DIR = "dist/web";
9+
const OUT_DIR = "dist/titan-reactor";
1010
const TARGET = tsConfig.compilerOptions.target;
1111

1212
// https://vitejs.dev/config/
1313
export default defineConfig((env) => {
14-
console.log(env);
1514
return {
1615
...sharedViteConfig(),
1716
// titan-reactor is the subfolder in the black-sheep-wall public dir
18-
base: env.command === "build" ? "/titan-reactor" : "/",
17+
base: env.command === "build" ? "/" : "/",
1918
define: {
20-
__static: JSON.stringify(
21-
env.command === "build" ? "/resources/bundled" : "/bundled"
22-
),
19+
__static: JSON.stringify(env.command === "build" ? "/" : "/bundled"),
2320
},
2421
logLevel: "info",
2522
publicDir: "bundled",

vite.shared.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import aliases from "./build/aliases";
2-
import { ConfigEnv, UserConfigExport } from "vite";
2+
import { UserConfigExport } from "vite";
33
import path from "path";
44
import tsConfig from "./tsconfig.json";
55

0 commit comments

Comments
 (0)