Conversation
|
What is the actual underlying issue here? Do you know why this fixes the issues in that discussion thread? |
|
@bakerkretzmar |
|
Do you know why this is a problem or what's actually causing it? |
|
@bakerkretzmar Unfortunately no. I've tried all solutions I have found so far but the problem won't be solved until I rename the file. It could be an editor-related issue, but I think it's not a big deal to generate types in a different named file :) |
|
What is in your |
| $types = config('ziggy.output.types', Types::class); | ||
|
|
||
| $filesystem->put(base_path("{$name}.d.ts"), new $types($ziggy)); | ||
| $filesystem->put(base_path("{$name}-types.d.ts"), new $types($ziggy)); |
There was a problem hiding this comment.
| $filesystem->put(base_path("{$name}-types.d.ts"), new $types($ziggy)); | |
| $filesystem->put(base_path("{$name}-module.d.ts"), new $types($ziggy)); |
| file_put_contents( | ||
| base_path('resources/js/ziggy.d.ts'), | ||
| preg_replace('/\r?\n/', "\r\n", file_get_contents(base_path('resources/js/ziggy.d.ts'))), | ||
| base_path('resources/js/ziggy-types.d.ts'), |
There was a problem hiding this comment.
| base_path('resources/js/ziggy-types.d.ts'), | |
| base_path('resources/js/ziggy-module.d.ts'), |
| base_path('resources/js/ziggy.d.ts'), | ||
| preg_replace('/\r?\n/', "\r\n", file_get_contents(base_path('resources/js/ziggy.d.ts'))), | ||
| base_path('resources/js/ziggy-types.d.ts'), | ||
| preg_replace('/\r?\n/', "\r\n", file_get_contents(base_path('resources/js/ziggy-types.d.ts'))), |
There was a problem hiding this comment.
| preg_replace('/\r?\n/', "\r\n", file_get_contents(base_path('resources/js/ziggy-types.d.ts'))), | |
| preg_replace('/\r?\n/', "\r\n", file_get_contents(base_path('resources/js/ziggy-module.d.ts'))), |
| } | ||
|
|
||
| expect(base_path('resources/js/ziggy.d.ts'))->toEqualFile('./tests/fixtures/ziggy.d.ts'); | ||
| expect(base_path('resources/js/ziggy-types.d.ts'))->toEqualFile('./tests/fixtures/ziggy.d.ts'); |
There was a problem hiding this comment.
| expect(base_path('resources/js/ziggy-types.d.ts'))->toEqualFile('./tests/fixtures/ziggy.d.ts'); | |
| expect(base_path('resources/js/ziggy-module.d.ts'))->toEqualFile('./tests/fixtures/ziggy.d.ts'); |
| artisan('ziggy:generate --types-only'); | ||
|
|
||
| expect(base_path('resources/js/ziggy.d.ts'))->toBeFile(); | ||
| expect(base_path('resources/js/ziggy-types.d.ts'))->toBeFile(); |
There was a problem hiding this comment.
| expect(base_path('resources/js/ziggy-types.d.ts'))->toBeFile(); | |
| expect(base_path('resources/js/ziggy-module.d.ts'))->toBeFile(); |
bram-pkg
left a comment
There was a problem hiding this comment.
I think -module is a better prefix, because the file contains the module declaration for ziggy-js.
|
|
||
| expect(base_path('resources/js/custom.d.ts'))->toBeFile(); | ||
| expect(base_path('resources/js/ziggy.d.ts'))->not->toBeFile(); | ||
| expect(base_path('resources/js/custom-types.d.ts'))->toBeFile(); |
There was a problem hiding this comment.
| expect(base_path('resources/js/custom-types.d.ts'))->toBeFile(); | |
| expect(base_path('resources/js/custom-module.d.ts'))->toBeFile(); |
| expect(base_path('resources/js/custom.d.ts'))->toBeFile(); | ||
| expect(base_path('resources/js/ziggy.d.ts'))->not->toBeFile(); | ||
| expect(base_path('resources/js/custom-types.d.ts'))->toBeFile(); | ||
| expect(base_path('resources/js/ziggy-types.d.ts'))->not->toBeFile(); |
There was a problem hiding this comment.
| expect(base_path('resources/js/ziggy-types.d.ts'))->not->toBeFile(); | |
| expect(base_path('resources/js/ziggy-module.d.ts'))->not->toBeFile(); |
| ['resources/js/x.js --types', ['resources/js/x.js', 'resources/js/x-types.d.ts']], | ||
| ['resources/js/y.ts --types', ['resources/js/y.js', 'resources/js/y-types.d.ts']], | ||
| ['resources/js/z.d.ts --types', ['resources/js/z.js', 'resources/js/z-types.d.ts']], | ||
| ['resources/scripts/foo --types', ['resources/scripts/foo.js', 'resources/scripts/foo-types.d.ts']], | ||
| ['resources/js --types', ['resources/js/ziggy.js', 'resources/js/ziggy-types.d.ts']], |
There was a problem hiding this comment.
| ['resources/js/x.js --types', ['resources/js/x.js', 'resources/js/x-types.d.ts']], | |
| ['resources/js/y.ts --types', ['resources/js/y.js', 'resources/js/y-types.d.ts']], | |
| ['resources/js/z.d.ts --types', ['resources/js/z.js', 'resources/js/z-types.d.ts']], | |
| ['resources/scripts/foo --types', ['resources/scripts/foo.js', 'resources/scripts/foo-types.d.ts']], | |
| ['resources/js --types', ['resources/js/ziggy.js', 'resources/js/ziggy-types.d.ts']], | |
| ['resources/js/x.js --types', ['resources/js/x.js', 'resources/js/x-module.d.ts']], | |
| ['resources/js/y.ts --types', ['resources/js/y.js', 'resources/js/y-module.d.ts']], | |
| ['resources/js/z.d.ts --types', ['resources/js/z.js', 'resources/js/z-module.d.ts']], | |
| ['resources/scripts/foo --types', ['resources/scripts/foo.js', 'resources/scripts/foo-module.d.ts']], | |
| ['resources/js --types', ['resources/js/ziggy.js', 'resources/js/ziggy-module.d.ts']], |


Rename generated types file by adding
-typesto resolve issue discussed here #702