Skip to content

Commit

Permalink
Further monorepo efforts.
Browse files Browse the repository at this point in the history
Giving up sometimes is harder than not giving up.
  • Loading branch information
javagl committed Nov 29, 2023
1 parent 0014a62 commit fc90b0e
Show file tree
Hide file tree
Showing 47 changed files with 237 additions and 190 deletions.
5 changes: 4 additions & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
"description": "3D Tiles tools basic utility classes",
"type": "module",
"source": "./src/index.ts",
"types": "./build/index.d.ts",
"exports": "./build/src/index.js",
"types": "./build/src/index.d.ts",

"dependencies": {
"@3d-tiles-tools/structure": "0.3.0",
"pino": "^8.15.0",
"pino-pretty": "^10.2.0"
},
"devDependencies": {
"@3d-tiles-tools/spec-helpers": "0.3.0",
"typescript": "^4.8.3"
},

Expand Down
36 changes: 20 additions & 16 deletions packages/base/specs/contentTypes/ContentDataTypesSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,114 +2,118 @@ import { ContentDataTypes } from "../../src/contentTypes/ContentDataTypes.js";
import { BufferedContentData } from "../../src/contentTypes/BufferedContentData.js";
import { ContentDataTypeRegistry } from "../../src/contentTypes/ContentDataTypeRegistry.js";

const SPECS_DATA_BASE_DIRECTORY = "../../specs/data/";

describe("ContentDataTypeRegistry.findContentDataType", function () {
it("detects GLB", async function () {
const contentUri = "../../specs/data/contentTypes/content.glb";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.glb";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_GLB);
});

it("detects B3DM", async function () {
const contentUri = "../../specs/data/contentTypes/content.b3dm";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.b3dm";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_B3DM);
});

it("detects I3DM", async function () {
const contentUri = "../../specs/data/contentTypes/content.i3dm";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.i3dm";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_I3DM);
});

it("detects CMPT", async function () {
const contentUri = "../../specs/data/contentTypes/content.cmpt";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.cmpt";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_CMPT);
});

it("detects PNTS", async function () {
const contentUri = "../../specs/data/contentTypes/content.pnts";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.pnts";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_PNTS);
});

it("detects GEOM", async function () {
const contentUri = "../../specs/data/contentTypes/content.geom";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.geom";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_GEOM);
});

it("detects VCTR", async function () {
const contentUri = "../../specs/data/contentTypes/content.vctr";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.vctr";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_VCTR);
});

it("detects SUBT", async function () {
const contentUri = "../../specs/data/contentTypes/content.subtree";
const contentUri =
SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.subtree";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_SUBT);
});

it("detects PNG", async function () {
const contentUri = "../../specs/data/contentTypes/content.png";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.png";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_PNG);
});

it("detects JPEG", async function () {
const contentUri = "../../specs/data/contentTypes/content.jpg";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.jpg";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_JPEG);
});

it("detects GIF", async function () {
const contentUri = "../../specs/data/contentTypes/content.gif";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.gif";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_GIF);
});

it("detects GEOJSON", async function () {
const contentUri = "../../specs/data/contentTypes/content.geojson";
const contentUri =
SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.geojson";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_GEOJSON);
});

it("detects 3TZ", async function () {
const contentUri = "../../specs/data/contentTypes/content.3tz";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.3tz";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_3TZ);
});

it("detects glTF", async function () {
const contentUri = "../../specs/data/contentTypes/content.gltf";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.gltf";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_GLTF);
});

it("detects tileset", async function () {
const contentUri = "../../specs/data/contentTypes/content.json";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.json";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toEqual(ContentDataTypes.CONTENT_TYPE_TILESET);
});

it("returns undefined for unknown content types", async function () {
const contentUri = "../../specs/data/contentTypes/content.txt";
const contentUri = SPECS_DATA_BASE_DIRECTORY + "contentTypes/content.txt";
const c = BufferedContentData.create(contentUri);
const type = await ContentDataTypeRegistry.findContentDataType(c);
expect(type).toBeUndefined();
Expand Down
2 changes: 1 addition & 1 deletion packages/base/specs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "../build/specs",
"outDir": "../build/specs"
},
"include": [
"./**/*"
Expand Down
5 changes: 1 addition & 4 deletions packages/base/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"declaration": true,
"composite": true,
"rootDir": ".",
"outDir": "../build/src",
"paths": {
"@3d-tiles-tools/structure": ["../packages/structure/build/src/index.d.ts"],
}
"outDir": "../build/src"
},
"include": [
"./**/*"
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "3D Tiles tools command line interface",
"type": "module",
"source": "./src/main.ts",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"bin": {
"3d-tiles-tools": "./build/main"
},
Expand All @@ -16,6 +16,7 @@
"yargs": "^17.5.1"
},
"devDependencies": {
"@3d-tiles-tools/spec-helpers": "0.3.0",
"@types/yargs": "^17.0.22"
},

Expand Down
3 changes: 0 additions & 3 deletions packages/cli/specs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"compilerOptions": {
"rootDir": ".",
"outDir": "../build/specs",
"paths": {
"@3d-tiles-tools/spec-helpers": ["../packages/spec-helpers/build/src/index.d.ts"],
}
},
"include": [
"./**/*"
Expand Down
5 changes: 0 additions & 5 deletions packages/cli/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"composite": true,
"rootDir": ".",
"outDir": "../build/src",
"paths": {
"@3d-tiles-tools/base": ["../packages/base/build/src/index.d.ts"],
"@3d-tiles-tools/tilesets": ["../packages/tilesets/build/src/index.d.ts"],
"@3d-tiles-tools/tools": ["../packages/tools/build/src/index.d.ts"],
}
},
"include": [
"./**/*"
Expand Down
3 changes: 2 additions & 1 deletion packages/gltf-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "3D Tiles tools implementations of glTF extensions",
"type": "module",
"source": "./src/index.ts",
"types": "./build/index.d.ts",
"exports": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"dependencies": {
"@gltf-transform/core": "^3.2.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/gltf-extensions/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"declaration": true,
"composite": true,
"rootDir": ".",
"outDir": "../build/src",
"outDir": "../build/src"
},
"include": [
"./**/*"
Expand Down
4 changes: 0 additions & 4 deletions packages/gltf-extensions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
"references": [
{ "path": "./src/tsconfig.json" },
],
"include": [
"src/**/*",
"../../src/cesium.d.ts",
]
}
5 changes: 3 additions & 2 deletions packages/ktx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "3D Tiles tools KTX utilities",
"type": "module",
"source": "./src/index.ts",
"types": "./build/index.d.ts",
"exports": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"dependencies": {
"@3d-tiles-tools/base": "0.3.0",
"sharp": "^0.32.1"
Expand All @@ -16,7 +17,7 @@
"scripts": {
"about:build": "echo 'Run the TypeScript compiler to generate the build output.'",
"build": "npx tsc --build --verbose --force && npm run build-copy",
"build-copy": "npx copyfiles --flat ./src/ktx/external/basis_encoder.wasm build/ktx/external"
"build-copy": "npx copyfiles --flat ./src/ktx/external/basis_encoder.wasm build/src/ktx/external"
}
}

Expand Down
5 changes: 2 additions & 3 deletions packages/ktx/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"composite": true,
"rootDir": ".",
"outDir": "../build/src",
"paths": {
"@3d-tiles-tools/base": ["../packages/base/build/src/index.d.ts"],
}
"allowJs": true,
"checkJs": false,
},
"include": [
"./**/*"
Expand Down
3 changes: 2 additions & 1 deletion packages/metadata/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "3D Tiles tools 3D Metadata implementation",
"type": "module",
"source": "./src/index.ts",
"types": "./build/index.d.ts",
"exports": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"dependencies": {
"@3d-tiles-tools/base": "0.3.0",
"@3d-tiles-tools/structure": "0.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("metadata/MetadataEntityModelBasic", function () {

beforeEach(async function () {
const tileset = await SpecHelpers.readJsonUnchecked(
"specs/data/TilesetWithFullMetadata/tileset.json"
"../../specs/data/TilesetWithFullMetadata/tileset.json"
);
metadataEntityModel = MetadataEntityModels.create(
tileset.schema,
Expand Down
4 changes: 0 additions & 4 deletions packages/metadata/specs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
"compilerOptions": {
"rootDir": ".",
"outDir": "../build/specs",
"paths": {
"@3d-tiles-tools/spec-helpers": ["../packages/spec-helpers/build/src/index.d.ts"],
"@3d-tiles-tools/structure": ["../packages/structure/build/src/index.d.ts"],
}
},
"include": [
"./**/*"
Expand Down
4 changes: 0 additions & 4 deletions packages/metadata/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"composite": true,
"rootDir": ".",
"outDir": "../build/src",
"paths": {
"@3d-tiles-tools/base": ["../packages/base/build/src/index.d.ts"],
"@3d-tiles-tools/structure": ["../packages/structure/build/src/index.d.ts"],
}
},
"include": [
"./**/*"
Expand Down
3 changes: 3 additions & 0 deletions packages/spec-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.3.0",
"description": "3D Tiles tools spec helper classes",
"type": "module",
"source": "./src/index.ts",
"exports": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"dependencies": {
"@3d-tiles-tools/base": "0.3.0",
"@3d-tiles-tools/structure": "0.3.0",
Expand Down
5 changes: 0 additions & 5 deletions packages/spec-helpers/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"composite": true,
"rootDir": ".",
"outDir": "../build/src",
"paths": {
"@3d-tiles-tools/structure": ["../packages/structure/build/src/index.d.ts"],
"@3d-tiles-tools/base": ["../packages/base/build/src/index.d.ts"],
"@3d-tiles-tools/tilesets": ["../packages/tilesets/build/src/index.d.ts"],
}
},
"include": [
"./**/*"
Expand Down
4 changes: 2 additions & 2 deletions packages/structure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "3D Tiles tools type definitions for the basic JSON structures",
"type": "module",
"source": "./src/index.ts",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"devDependencies": {
"typescript": "^4.8.3"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/tilesets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "3D Tiles tools tileset representation",
"type": "module",
"source": "./src/index.ts",
"types": "./build/index.d.ts",
"exports": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"dependencies": {
"@3d-tiles-tools/structure": "0.3.0",
"@3d-tiles-tools/base": "0.3.0",
Expand All @@ -15,6 +16,7 @@
"node-stream-zip": "^1.15.0"
},
"devDependencies": {
"@3d-tiles-tools/spec-helpers": "0.3.0",
"@types/archiver": "^5.3.1",
"@types/better-sqlite3": "^7.6.2",
"typescript": "^4.8.3"
Expand Down
Loading

0 comments on commit fc90b0e

Please sign in to comment.