Skip to content

Commit 5492653

Browse files
committed
feat(tweakpane): rename tweakpane
1 parent 3dee963 commit 5492653

36 files changed

+493
-86
lines changed

libs/plugin/generators.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"factory": "./src/generators/aux/aux",
1515
"schema": "./src/generators/aux/schema.json",
1616
"description": "aux generator"
17+
},
18+
"migrate-tweakpane": {
19+
"factory": "./src/migrations/migrate-tweakpane/migrate-tweakpane",
20+
"description": "Migration tweakpane"
1721
}
1822
},
1923
"schematics": {
@@ -31,6 +35,10 @@
3135
"factory": "./src/generators/aux/compat",
3236
"schema": "./src/generators/aux/schema.json",
3337
"description": "aux generator"
38+
},
39+
"migrate-tweakpane": {
40+
"factory": "./src/migrations/migrate-tweakpane/compat",
41+
"description": "Migration tweakpane"
3442
}
3543
}
3644
}

libs/plugin/migrations.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"generators": {
3+
"migrate-tweakpane": {
4+
"version": "4.0.0",
5+
"description": "Migration for v4.0.0",
6+
"implementation": "./src/migrations/migrate-tweakpane/migrate-tweakpane"
7+
}
8+
},
9+
"schematics": {
10+
"migrate-tweakpane": {
11+
"version": "4.0.0",
12+
"description": "Migration for v4.0.0",
13+
"implementation": "./src/migrations/migrate-tweakpane/compat"
14+
}
15+
}
16+
}

libs/plugin/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
"input": "./libs/plugin",
3434
"glob": "executors.json",
3535
"output": "."
36+
},
37+
{
38+
"input": "./libs/plugin",
39+
"glob": "migrations.json",
40+
"output": "."
3641
}
3742
]
3843
}
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 migrateTweakpane from './migrate-tweakpane';
3+
4+
export default convertNxGenerator(migrateTweakpane);
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { libraryGenerator, UnitTestRunner } from '@nx/angular/generators';
2+
import { Tree } from '@nx/devkit';
3+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
4+
5+
import update from './migrate-tweakpane';
6+
7+
describe('migrate-tweakpane migration', () => {
8+
let tree: Tree;
9+
10+
beforeEach(() => {
11+
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
12+
});
13+
14+
it('should run successfully', async () => {
15+
await libraryGenerator(tree, {
16+
inlineTemplate: true,
17+
inlineStyle: true,
18+
skipTests: true,
19+
unitTestRunner: UnitTestRunner.None,
20+
directory: `libs/my-lib`,
21+
buildable: false,
22+
skipFormat: true,
23+
standalone: true,
24+
});
25+
26+
// mock file content
27+
tree.write(
28+
'libs/my-lib/src/index.ts',
29+
`
30+
import { NgtTweakPane, NgtTweakFolder, NgtTweakText } from 'angular-three-tweakpane';
31+
32+
const template = \`
33+
<ngt-tweak-pane>
34+
<ngt-tweak-folder>
35+
<ngt-tweak-text></ngt-tweak-text>
36+
</ngt-tweak-folder>
37+
</ngt-tweak-pane>
38+
\`
39+
40+
const imports = [NgtTweakPane, NgtTweakFolder, NgtTweakText];
41+
`,
42+
);
43+
44+
await update(tree);
45+
46+
const updatedContent = tree.read('libs/my-lib/src/index.ts', 'utf-8');
47+
expect(updatedContent).toMatchInlineSnapshot(`
48+
"import {
49+
TweakpanePane,
50+
TweakpaneFolder,
51+
TweakpaneText,
52+
} from 'angular-three-tweakpane';
53+
54+
const template = \`
55+
<tweakpane-pane>
56+
<tweakpane-folder>
57+
<tweakpane-text></tweakpane-text>
58+
</tweakpane-folder>
59+
</tweakpane-pane>
60+
\`;
61+
62+
const imports = [TweakpanePane, TweakpaneFolder, TweakpaneText];
63+
"
64+
`);
65+
});
66+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { formatFiles, getProjects, Tree, visitNotIgnoredFiles } from '@nx/devkit';
2+
3+
export default async function update(host: Tree) {
4+
const projects = getProjects(host);
5+
6+
for (const projectName of projects.keys()) {
7+
const projectConfig = projects.get(projectName);
8+
if (!projectConfig) continue;
9+
10+
visitNotIgnoredFiles(host, projectConfig.root, (path) => {
11+
const fileContent = host.read(path, 'utf-8');
12+
if (fileContent) {
13+
const updatedContent = fileContent
14+
.replaceAll('ngt-tweak', 'tweakpane')
15+
.replace(/NgtTweak([A-Za-z]*)/g, 'Tweakpane$1');
16+
if (fileContent !== updatedContent) {
17+
host.write(path, updatedContent);
18+
}
19+
}
20+
});
21+
}
22+
23+
await formatFiles(host);
24+
}

libs/theatre/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# `angular-three-theatre`

libs/theatre/eslint.config.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const { FlatCompat } = require('@eslint/eslintrc');
2+
const js = require('@eslint/js');
3+
const baseConfig = require('../../eslint.config.js');
4+
5+
const compat = new FlatCompat({
6+
baseDirectory: __dirname,
7+
recommendedConfig: js.configs.recommended,
8+
});
9+
10+
module.exports = [
11+
...baseConfig,
12+
...compat
13+
.config({
14+
extends: ['plugin:@nx/angular', 'plugin:@angular-eslint/template/process-inline-templates'],
15+
})
16+
.map((config) => ({
17+
...config,
18+
files: ['**/*.ts'],
19+
files: ['**/*.ts'],
20+
rules: {
21+
'@angular-eslint/directive-selector': 'off',
22+
'@angular-eslint/component-selector': 'off',
23+
'@angular-eslint/component-class-suffix': 'off',
24+
'@angular-eslint/directive-class-suffix': 'off',
25+
'@angular-eslint/no-input-rename': 'off',
26+
'@typescript-eslint/no-explicit-any': 'off',
27+
'@typescript-eslint/no-empty-function': 'off',
28+
'@typescript-eslint/no-non-null-assertion': 'off',
29+
'@typescript-eslint/ban-types': 'off',
30+
'@typescript-eslint/no-empty-interface': 'off',
31+
'@typescript-eslint/no-unused-vars': [
32+
'warn',
33+
{
34+
argsIgnorePattern: '^_',
35+
varsIgnorePattern: '^_',
36+
},
37+
],
38+
},
39+
})),
40+
{
41+
files: ['**/*.spec.ts'],
42+
rules: {
43+
'@nx/enforce-module-boundaries': 'off',
44+
},
45+
},
46+
{
47+
files: ['web-gl-rendering-context.ts'],
48+
rules: {
49+
'@typescript-eslint/ban-ts-comment': 'off',
50+
},
51+
},
52+
...compat
53+
.config({
54+
extends: ['plugin:@nx/angular-template'],
55+
})
56+
.map((config) => ({
57+
...config,
58+
files: ['**/*.html'],
59+
rules: {
60+
...config.rules,
61+
},
62+
})),
63+
{
64+
files: ['**/*.json'],
65+
rules: {
66+
'@nx/dependency-checks': ['error'],
67+
},
68+
languageOptions: {
69+
parser: require('jsonc-eslint-parser'),
70+
},
71+
},
72+
{
73+
files: ['**/*.ts'],
74+
rules: {
75+
'@angular-eslint/prefer-standalone': 'off',
76+
},
77+
},
78+
];

libs/theatre/ng-package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../../dist/libs/theatre",
4+
"lib": {
5+
"entryFile": "src/index.ts"
6+
}
7+
}

libs/theatre/package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "angular-three-theatre",
3+
"version": "0.0.0-replace",
4+
"publishConfig": {
5+
"access": "public"
6+
},
7+
"type": "module",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/angular-threejs/angular-three/tree/main/libs/theatre"
11+
},
12+
"author": {
13+
"name": "Chau Tran",
14+
"email": "nartc7789@gmail.com",
15+
"url": "https://nartc.me"
16+
},
17+
"description": "TheatreJS for Angular Three",
18+
"keywords": [
19+
"angular",
20+
"threejs",
21+
"renderer",
22+
"theatre"
23+
],
24+
"license": "MIT",
25+
"peerDependencies": {
26+
"@angular/common": ">=19.0.0 <20.0.0",
27+
"@angular/core": ">=19.0.0 <20.0.0",
28+
"@theatre/core": ">=0.7.0 <0.8.0",
29+
"@theatre/studio": ">=0.7.0 <0.8.0"
30+
},
31+
"dependencies": {
32+
"tslib": "^2.7.0"
33+
}
34+
}

libs/theatre/project.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "theatre",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "libs/theatre/src",
5+
"prefix": "platform",
6+
"projectType": "library",
7+
"tags": [],
8+
"targets": {
9+
"build": {
10+
"executor": "@nx/angular:package",
11+
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
12+
"options": {
13+
"project": "libs/theatre/ng-package.json"
14+
},
15+
"configurations": {
16+
"production": {
17+
"tsConfig": "libs/theatre/tsconfig.lib.prod.json"
18+
},
19+
"development": {
20+
"tsConfig": "libs/theatre/tsconfig.lib.json"
21+
}
22+
},
23+
"defaultConfiguration": "production"
24+
},
25+
"test": {
26+
"executor": "@analogjs/vitest-angular:test"
27+
},
28+
"lint": {
29+
"executor": "@nx/eslint:lint",
30+
"outputs": ["{options.outputFile}"]
31+
},
32+
"publish-next": {
33+
"command": "npm publish --tag=next",
34+
"options": {
35+
"cwd": "{workspaceRoot}/dist/{projectRoot}"
36+
}
37+
}
38+
}
39+
}

libs/theatre/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

libs/theatre/src/lib/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export class TheatreProject {}

libs/theatre/src/test-setup.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import '@analogjs/vitest-angular/setup-zone';
2+
3+
import { getTestBed } from '@angular/core/testing';
4+
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
5+
6+
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());

libs/theatre/tsconfig.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2022",
4+
"useDefineForClassFields": false,
5+
"forceConsistentCasingInFileNames": true,
6+
"strict": true,
7+
"noImplicitOverride": true,
8+
"noPropertyAccessFromIndexSignature": true,
9+
"noImplicitReturns": true,
10+
"noFallthroughCasesInSwitch": true
11+
},
12+
"files": [],
13+
"include": [],
14+
"references": [
15+
{
16+
"path": "./tsconfig.lib.json"
17+
},
18+
{
19+
"path": "./tsconfig.spec.json"
20+
}
21+
],
22+
"extends": "../../tsconfig.base.json",
23+
"angularCompilerOptions": {
24+
"enableI18nLegacyMessageIdFormat": false,
25+
"strictInjectionParameters": true,
26+
"strictInputAccessModifiers": true,
27+
"strictTemplates": true
28+
}
29+
}

libs/theatre/tsconfig.lib.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"declaration": true,
6+
"declarationMap": true,
7+
"inlineSources": true,
8+
"types": []
9+
},
10+
"exclude": ["**/*.spec.ts", "test-setup.ts", "**/*.test.ts"],
11+
"include": ["**/*.ts"]
12+
}

libs/theatre/tsconfig.lib.prod.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.lib.json",
3+
"compilerOptions": {
4+
"declarationMap": false
5+
},
6+
"angularCompilerOptions": {
7+
"compilationMode": "partial"
8+
}
9+
}

libs/theatre/tsconfig.spec.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"target": "es2016",
6+
"types": ["node", "vitest/globals"]
7+
},
8+
"files": ["src/test-setup.ts"],
9+
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
10+
}

0 commit comments

Comments
 (0)