Skip to content

Releases: tomas-light/nice-web-routes

2.0.0

08 Jul 21:49
3e85523
Compare
Choose a tag to compare
  • 🚀 add support for array string in search params;
const routes = createNiceWebRoutes({
  meeting: {
    new: {},
  },
});
routes.meeting.new.url({ memberIds: ['foo', 'bar', 'zoo'] }) // '/meeting/new?memberIds=foo&memberIds=bar&memberIds=zoo'
  • 🚀 add setBaseRoute method to change base route after routes are created;
const routes = createObjectNiceWebRoutes(
  {
    home: {},
    welcome: {},
  },
  { parentRoute: '/en' }
);

routes.home.url(); // "/en/home"
routes.welcome.url(); // "/en/welcome"

routes.setBaseRoute('/de');

routes.home.url(); // "/de/home"
routes.welcome.url(); // "/de/welcome"
  • 🚧🔨 changed factories signature, now parentRoute and currentSegmentName should be passed as options object;
// before
const routes = createNiceWebRoutes(
  {
    home: {},
    welcome: {},
  },
  '/en',
  '/some-segment'
);

// after
const routes = createNiceWebRoutes(
  {
    home: {},
    welcome: {},
  },
  {
    parentRoute: '/en',
    currentSegmentName: '/some-segment',
  }
);
  • 🔨 configure esm modules;
    Now here is cjs and esm directories with related module setup
    image

add test coverage to pipeline

18 Mar 12:49
Compare
Choose a tag to compare
1.0.4_coverage

fix coverage config

Release 1.0.4

02 Feb 12:56
Compare
Choose a tag to compare

Features:

  • add type constraints for parametrized urls
 import { createNiceWebRoutes } from 'nice-web-routes';

const routes = createNiceWebRoutes({
  user: {
    // typed parameter
    form: (form: 'create' | 'edit') => ({}),
  },
});

routes.user.form('create').url(); // '/user/create'
routes.user.form('edit').url(); // '/user/edit'
routes.user.form('something').url(); // error because it violates type constraint of 'create' | 'edit' | undefined

Breaking changes:

  • renamed UrlBuilderImpl to urlBuilderImpl in FactoryConfig

Release 1.0.3

14 Jan 16:55
Compare
Choose a tag to compare

First release