Skip to content

Commit c0d343c

Browse files
committed
adjust package json
1 parent 129aa21 commit c0d343c

File tree

17 files changed

+23536
-31037
lines changed

17 files changed

+23536
-31037
lines changed

.release-it.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"releaseName": "Release ${version}"
4141
},
4242
"hooks": {
43-
"before:bump": "pnpm exec nx run-many --target=package --projects=core,soba,postprocessing,cannon --parallel=false",
43+
"before:bump": "pnpm exec nx run-many --target=package --projects=core,soba,postprocessing --parallel=false",
4444
"after:bump": ["git checkout -- package.json"]
4545
}
4646
}

libs/core/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"options": {
2929
"commands": [
3030
"pnpm exec nx build core",
31-
"node ./tools/scripts/generate-json.mjs",
32-
"pnpm exec nx build plugin"
31+
"pnpm exec nx build plugin",
32+
"node ./tools/scripts/generate-json.mjs"
3333
],
3434
"parallel": false
3535
}

libs/plugin/generators.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,33 @@
77
"factory": "./src/generators/init/generator",
88
"schema": "./src/generators/init/schema.json",
99
"description": "Init Angular Three with proper packages and config"
10+
},
11+
"soba": {
12+
"factory": "./src/generators/init-soba/generator",
13+
"schema": "./src/generators/init-soba/schema.json",
14+
"description": "Init Angular Three Soba with proper packages "
15+
},
16+
"postprocessing": {
17+
"factory": "./src/generators/init-postprocessing/generator",
18+
"schema": "./src/generators/init-postprocessing/schema.json",
19+
"description": "Init Angular Three Postprocessing with proper packages "
1020
}
1121
},
1222
"schematics": {
1323
"ng-add": {
1424
"factory": "./src/generators/init/compat",
1525
"schema": "./src/generators/init/schema.json",
1626
"description": "Add Angular Three with proper packages and config"
27+
},
28+
"soba": {
29+
"factory": "./src/generators/init-soba/compat",
30+
"schema": "./src/generators/init-soba/schema.json",
31+
"description": "Init Angular Three Soba with proper packages "
32+
},
33+
"postprocessing": {
34+
"factory": "./src/generators/init-postprocessing/compat",
35+
"schema": "./src/generators/init-postprocessing/schema.json",
36+
"description": "Init Angular Three Postprocessing with proper packages "
1737
}
1838
}
1939
}
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 init from './generator';
3+
4+
export default convertNxGenerator(init);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { readJson, Tree } from '@nx/devkit';
2+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
3+
import { ANGULAR_THREE_VERSION, POSTPROCESSING_VERSION } from '../versions';
4+
import init from './generator';
5+
6+
describe('init generator', () => {
7+
let appTree: Tree;
8+
9+
beforeEach(() => {
10+
appTree = createTreeWithEmptyWorkspace();
11+
});
12+
13+
it('should add three dependencies', async () => {
14+
await init(appTree);
15+
16+
const packageJson = readJson(appTree, 'package.json');
17+
18+
expect(packageJson.dependencies['angular-three-postprocessing']).toEqual(ANGULAR_THREE_VERSION);
19+
expect(packageJson.dependencies['postprocessing']).toEqual(POSTPROCESSING_VERSION);
20+
});
21+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { addDependenciesToPackageJson, installPackagesTask, logger, readJson, type Tree } from '@nx/devkit';
2+
import { ANGULAR_THREE_VERSION, POSTPROCESSING_VERSION } from '../versions';
3+
4+
export default async function (tree: Tree) {
5+
logger.log('Initializing Angular Three Postprocessing...');
6+
7+
const packageJson = readJson(tree, 'package.json');
8+
9+
const version =
10+
packageJson['dependencies']?.['angular-three'] ||
11+
packageJson['devDependencies']?.['angular-three'] ||
12+
ANGULAR_THREE_VERSION;
13+
14+
addDependenciesToPackageJson(
15+
tree,
16+
{
17+
'angular-three-postprocessing': version,
18+
postprocessing: POSTPROCESSING_VERSION,
19+
},
20+
{},
21+
);
22+
23+
return () => {
24+
installPackagesTask(tree);
25+
};
26+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "http://json-schema.org/schema",
3+
"cli": "nx",
4+
"$id": "Init",
5+
"title": "Init Angular Three Postprocessing"
6+
}
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 init from './generator';
3+
4+
export default convertNxGenerator(init);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { readJson, Tree } from '@nx/devkit';
2+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
3+
import { ANGULAR_THREE_VERSION, THREE_STDLIB_VERSION } from '../versions';
4+
import init from './generator';
5+
6+
describe('init generator', () => {
7+
let appTree: Tree;
8+
9+
beforeEach(() => {
10+
appTree = createTreeWithEmptyWorkspace();
11+
});
12+
13+
it('should add three dependencies', async () => {
14+
await init(appTree);
15+
16+
const packageJson = readJson(appTree, 'package.json');
17+
18+
expect(packageJson.dependencies['angular-three-soba']).toEqual(ANGULAR_THREE_VERSION);
19+
expect(packageJson.dependencies['three-stdlib']).toEqual(THREE_STDLIB_VERSION);
20+
});
21+
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { addDependenciesToPackageJson, installPackagesTask, logger, readJson, type Tree } from '@nx/devkit';
2+
import {
3+
ANGULAR_THREE_VERSION,
4+
MESH_LINE_VERSION,
5+
STATS_GL_VERSION,
6+
THREE_MESH_BVH_VERSION,
7+
THREE_STDLIB_VERSION,
8+
TROIKA_THREE_TEXT_VERSION,
9+
} from '../versions';
10+
11+
export default async function (tree: Tree) {
12+
logger.log('Initializing Angular Three Soba...');
13+
14+
const packageJson = readJson(tree, 'package.json');
15+
16+
const version =
17+
packageJson['dependencies']?.['angular-three'] ||
18+
packageJson['devDependencies']?.['angular-three'] ||
19+
ANGULAR_THREE_VERSION;
20+
21+
addDependenciesToPackageJson(
22+
tree,
23+
{
24+
'angular-three-soba': version,
25+
meshline: MESH_LINE_VERSION,
26+
'three-stdlib': THREE_STDLIB_VERSION,
27+
'stats-gl': STATS_GL_VERSION,
28+
'three-mesh-bvh': THREE_MESH_BVH_VERSION,
29+
'troika-three-text': TROIKA_THREE_TEXT_VERSION,
30+
},
31+
{},
32+
);
33+
34+
return () => {
35+
installPackagesTask(tree);
36+
};
37+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "http://json-schema.org/schema",
3+
"cli": "nx",
4+
"$id": "Init",
5+
"title": "Init Angular Three Soba"
6+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
export const ANGULAR_THREE_VERSION = '^2.0.0';
22
export const THREE_VERSION = '^0.155.0';
33
export const THREE_TYPE_VERSION = '^0.155.0';
4+
5+
export const THREE_STDLIB_VERSION = '^2.0.0';
6+
export const STATS_GL_VERSION = '^1.0.0';
7+
export const MESH_LINE_VERSION = '^3.1.0';
8+
export const THREE_MESH_BVH_VERSION = '^0.6.0';
9+
export const TROIKA_THREE_TEXT_VERSION = '^0.47.0';
10+
11+
export const POSTPROCESSING_VERSION = '^6.0.0';

libs/plugin/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
export { default as initPostprocessingGenerator } from './generators/init-postprocessing/generator';
2+
export { default as initSobaGenerator } from './generators/init-soba/generator';
13
export { default as initGenerator } from './generators/init/generator';

libs/postprocessing/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
"three": ">=0.148.0"
3030
},
3131
"dependencies": {
32-
"tslib": "^2.3.0",
33-
"@nx/devkit": "^16.0.0",
34-
"nx": "^16.0.0"
32+
"tslib": "^2.3.0"
3533
},
3634
"sideEffects": false
3735
}

libs/soba/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@angular/common": "^16.0.0",
3030
"@angular/core": "^16.0.0",
3131
"angular-three": "^2.0.0",
32-
"meshline": "^3.1.6",
32+
"meshline": "^3.1.0",
3333
"stats-gl": "^1.0.0",
3434
"stats.js": "^0.17.0",
3535
"three": ">=0.148.0",
@@ -38,8 +38,6 @@
3838
"troika-three-text": "^0.47.0"
3939
},
4040
"dependencies": {
41-
"@nx/devkit": "^16.0.0",
42-
"nx": "^16.0.0",
4341
"tslib": "^2.3.0"
4442
},
4543
"sideEffects": false

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0",
44
"license": "MIT",
55
"scripts": {
6+
"release": "dotenv release-it --",
67
"storybook": "nx storybook soba",
78
"generate-soba": "node tools/scripts/generate-soba-json.mjs"
89
},
@@ -51,6 +52,7 @@
5152
"@typescript-eslint/eslint-plugin": "6.2.0",
5253
"@typescript-eslint/parser": "6.2.0",
5354
"autoprefixer": "^10.4.0",
55+
"dotenv-cli": "^7.2.1",
5456
"eslint": "~8.46.0",
5557
"eslint-config-prettier": "8.9.0",
5658
"glsl-noise": "^0.0.0",

0 commit comments

Comments
 (0)