Closed Kocal closed 2 years ago
Hum, the CI fails and I think it's because the Node.js version is outdated. I was able to reproduce the issue on local with Node 8, but everything works fine with Node 10.:
Given Node.js 8 is unmaintened since a long time ago (https://nodejs.org/en/about/releases/), I think it won't be a problem to setup Node.js 10 on Travis.
I've fixed some bugs I faced when trying to use my pull request on an existing project, and confirm the following code works (no types errors, and routes are generated correctly):
import Routing, { RouteParams } from '../../../vendor/friendsofsymfony/jsrouting-bundle/Resources';
import routes from '../../_generated/routes.json';
Routing.setRoutingData(routes);
export function generateRoute(name: string, params: RouteParams = {}, absolute = false): string {
return Routing.generate(name, params, absolute);
}
Friendly ping @tobias-93
* The TypeScript module `FOS` does not exist anymore. TBH I was not able to re-introduce this behaviour and didn't spend too much time on this, since the majority of users will just do a `import { Routing } from 'vendor/friendsofsymfony/jsrouting-bundle'` I guess
This makes it a BC break for people loading the router and the routes separately rather than using a webpack (see the first code snippet in the doc at https://symfony.com/doc/current/bundles/FOSJsRoutingBundle/usage.html)
@tobias-93 The text has been removed and a more generic route (feed_post
=> eg: /feed/post.xml
which deals with defaults and requirements) has been added.
@stof Sorry, maybe I was not clear enough. I was speaking about the TypeScript definition, FOS
module does not exist anymore since. But fos.Router.setData
is still a globally-accessible function:
Hi everyone, is there any news on this? Thanks!
Hi @Kocal,
Sorry, this bundle has been under my radar for a long time. Please rebase on the newest master and rework the tests for Github Actions, and I will have a new look on merging this.
Hi @tobias-93, no worries! The PR has been rebased.
I will do the same for #408.
Thanks
@Kocal awesome, thanks! I will make a 3.0 release with this new implementation, including support for SF 6 and dropping old PHP versions.
Perfect! :)
Hi :wave:
This PR is a proposal for migrating the codebase to TypeScript. This way:
Some things to know:
@babel/typescript-preset
js/router.js
file has been migrated to TypeScript. But I didn't rewrite the whole file, just adapting it to make TypeScript and tests happyFOS
does not exist anymore. TBH I was not able to re-introduce this behaviour and didn't spend too much time on this, since the majority of users will just do aimport { Routing } from 'vendor/friendsofsymfony/jsrouting-bundle'
I guessWDYT? Thanks!