0.4.1 release notes

published by rimarok on 27/01/2021 motifs-js release

In these release notes are detailed motifs-js@0.4.1 new features, changes and fixes.

Work focused on improving WEBSITE mapping (lighten description, most notably) and generating a basic sitemap.

Some time has also been spent in updating the README introduction, "what is …" and "how to" section.

WEBSITE mapping

While we didn't changed the logic behind the provision > mapping process, we greatly improved the way to describe mapping.

WEBSITE_FOLDER

An abstraction has been put on FILE/FOLDER with the introduction of WEBSITEPAGE and WEBSITEFOLDER.

WEBSITE_FOLDER exposes both .shape() and .build() methods.

This logical separation allows us to minimaly describe website folder's content (using .shape(content: {})) and to make it build in a dedicated scope (inside WEBSITE.build() (see on GitHub)).

The mapping file now looks like (ex. this website) :

export default (
  data,
  options
) => ({
  '': websitePageMotif.shape(
    homeTemplate,
    data
  ),
  'motifs': websiteFolderMotif.shape(
    data.motifs.reduce(
      (acc, motif) => ({
        ...acc,
        [motif.id]: websitePageMotif.shape(
          motifTemplate,
          {
            ...data,
            motif
          }
        )
      }),
      {}
    )
  )
})

For comparaison and information on issue #46.

WEBSITE_PAGE

As for WEBSITEFOLDER, WEBSITEPAGE has been reworked to expose .shape(name, data) (description) and .build() encapsulated in WEBSITE_FOLDER.build() method (see on GitHub).

Now, as shown above, path is made of nested object property name.

FOLDER & WEBSITE build improvements

FOLDER nested path

FOLDER create(path: string) now allows path to be nested (ex: a/b/c).

More information on issue #38.

WEBSITE_PAGE creates its own folder

While we'd want to add this feature on PAGE build() too, we started by implementing a minimal safe-path mechanism on WEBSITE_PAGE.

In mapping, WEBSITE_PAGE can now be shaped at the root of its "url" parent, instead of having to create an encapsulating FOLDER.

More information on issue #20.

Sitemap

We achieved building a sitemap.xml file at the root of target website.

The sitemap now only exposes urlset > url > loc property. But conception has been made to allow other properties to be added (ex: lastmod, changefreq), while none has been tested.

This process is included in WEBSITE .build() method.

Article

Article has been previously moved from imrok repo to core motifs-js.

A .create() method has been added to incrementaly generates article folder and file.

Content has been moved from :id/:id.article.js file to :id/content.md to benefit from Markdown hints.

Article also check for images inside src folder to copy them in dest.

Conclusion and roadmap

This was a well deserved improvement for WEBSITE build, though we now have four instances to maintain.

Update on every repo was quite easy (just refactor the mapping) file, and successfully implements atomic change.

Roadmap

Next steps should seek SPEC improvements, notably to ouput logging and notify failing tests at the end of a run.

More details on issue #48.

Another axis would be to consolidate existing code base with "basics" (GLOBAL, COMMAND) refactoring and tests.

Addition of new MOTIFS, description and for some implementation, should follow :

See the full MOTIFS-todo list on issue #35.

Stay tuned !

Retour Releases / Accueil