-
Notifications
You must be signed in to change notification settings - Fork 270
Rename generated types file #826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Changes from all commits
44bbb71
61749d3
8a2bce7
8e99cd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -119,18 +119,18 @@ | |||||||||||||||||||||
| if (windows_os()) { | ||||||||||||||||||||||
| // `json_encode` always uses Unix line endings | ||||||||||||||||||||||
| 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'), | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| preg_replace('/\r?\n/', "\r\n", file_get_contents(base_path('resources/js/ziggy-types.d.ts'))), | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| ); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 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'); | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| }); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| test('generate dts file without generating routes file', function () { | ||||||||||||||||||||||
| artisan('ziggy:generate --types-only'); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| expect(base_path('resources/js/ziggy.d.ts'))->toBeFile(); | ||||||||||||||||||||||
| expect(base_path('resources/js/ziggy-types.d.ts'))->toBeFile(); | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| expect(base_path('resources/js/ziggy.js'))->not->toBeFile(); | ||||||||||||||||||||||
| }); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -139,8 +139,8 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| artisan('ziggy:generate --types-only'); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 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(); | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| expect(base_path('resources/js/ziggy-types.d.ts'))->not->toBeFile(); | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| }); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| test('generate correct routes and dts files based on provided arguments', function (string $args, array $files) { | ||||||||||||||||||||||
|
|
@@ -153,11 +153,11 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| expect(array_map(base_path(...), $files))->each->toBeFile(); | ||||||||||||||||||||||
| })->with([ | ||||||||||||||||||||||
| ['resources/js/x.js --types', ['resources/js/x.js', 'resources/js/x.d.ts']], | ||||||||||||||||||||||
| ['resources/js/y.ts --types', ['resources/js/y.js', 'resources/js/y.d.ts']], | ||||||||||||||||||||||
| ['resources/js/z.d.ts --types', ['resources/js/z.js', 'resources/js/z.d.ts']], | ||||||||||||||||||||||
| ['resources/scripts/foo --types', ['resources/scripts/foo.js', 'resources/scripts/foo.d.ts']], | ||||||||||||||||||||||
| ['resources/js --types', ['resources/js/ziggy.js', 'resources/js/ziggy.d.ts']], | ||||||||||||||||||||||
| ['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']], | ||||||||||||||||||||||
|
Comment on lines
+156
to
+160
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| ]); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| class CustomFile extends File | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.