Skip to content

Commit 8e79050

Browse files
committed
feat(plugin): prep gltf generator
1 parent 25865c2 commit 8e79050

File tree

13 files changed

+433
-6
lines changed

13 files changed

+433
-6
lines changed

libs/plugin/generators.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@
44
"factory": "./src/generators/init/init",
55
"schema": "./src/generators/init/schema.json",
66
"description": "init generator"
7+
},
8+
"gltf": {
9+
"factory": "./src/generators/gltf/gltf",
10+
"schema": "./src/generators/gltf/schema.json",
11+
"description": "gltf generator"
712
}
813
},
914
"schematics": {
1015
"init": {
1116
"factory": "./src/generators/init/compat",
1217
"schema": "./src/generators/init/schema.json",
1318
"description": "init generator"
19+
},
20+
"gltf": {
21+
"factory": "./src/generators/gltf/compat",
22+
"schema": "./src/generators/gltf/schema.json",
23+
"description": "gltf generator"
1424
}
1525
}
1626
}

libs/plugin/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
},
2121
"dependencies": {
2222
"@nx/devkit": "^20.0.0",
23+
"@rosskevin/gltfjsx": "7.0.20",
2324
"nx": "^20.0.0",
2425
"ts-morph": "^25.0.0",
2526
"tslib": "^2.3.0"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { convertNxGenerator } from '@nx/devkit';
2+
import gltfGenerator from './gltf';
3+
4+
export default convertNxGenerator(gltfGenerator);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const variable = "<%= name %>";
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Tree } from '@nx/devkit';
2+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
3+
4+
import { gltfGenerator } from './gltf';
5+
6+
describe('gltf generator', () => {
7+
let tree: Tree;
8+
9+
beforeEach(() => {
10+
tree = createTreeWithEmptyWorkspace();
11+
});
12+
13+
it('should run successfully', async () => {
14+
await gltfGenerator(tree, {});
15+
expect(true).toBe(true);
16+
});
17+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Tree } from '@nx/devkit';
2+
3+
export interface GltfGeneratorSchema {}
4+
5+
export async function gltfGenerator(tree: Tree, options: GltfGeneratorSchema) {
6+
const test = await import('@rosskevin/gltfjsx');
7+
console.log(test);
8+
// await formatFiles(tree);
9+
}
10+
11+
export default gltfGenerator;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$id": "Gltf",
3+
"title": "Generate component from GLTF",
4+
"type": "object",
5+
"properties": {
6+
"name": {
7+
"type": "string",
8+
"description": "",
9+
"$default": {
10+
"$source": "argv",
11+
"index": 0
12+
},
13+
"x-prompt": "What name would you like to use?"
14+
}
15+
},
16+
"required": ["name"]
17+
}

libs/plugin/src/generators/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export { default as initGenerator } from './init/init';
1+
export { default as gltfGenerator, type GltfGeneratorSchema } from './gltf/gltf';
2+
export { default as initGenerator, type InitGeneratorSchema } from './init/init';

libs/plugin/tsconfig.lib.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"outDir": "../../dist/out-tsc",
55
"declaration": true,
66
"types": ["node"],
7-
"moduleResolution": "node"
7+
"module": "node16",
8+
"moduleResolution": "node16"
89
},
910
"include": ["src/**/*.ts"],
1011
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]

libs/plugin/tsconfig.spec.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../../dist/out-tsc",
5-
"module": "commonjs",
6-
"moduleResolution": "node10",
7-
"types": ["jest", "node"]
5+
"module": "node16",
6+
"moduleResolution": "node16",
7+
"types": ["jest", "node"],
8+
"allowJs": true
89
},
910
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
1011
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"@nx/web": "20.4.2",
4141
"@nx/workspace": "20.4.2",
4242
"@phenomnomnominal/tsquery": "^6.1.3",
43+
"@rosskevin/gltfjsx": "^7.0.20",
4344
"@schematics/angular": "19.1.6",
4445
"@storybook/addon-essentials": "^8.5.3",
4546
"@storybook/addon-interactions": "^8.5.3",

0 commit comments

Comments
 (0)