npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sounisi5011/metalsmith-netlify-published-date

v0.3.2

Published

Get published date and modified date of the each page published by Netlify

Downloads

160

Readme

@sounisi5011/metalsmith-netlify-published-date

Go to the latest release page on npm License: MIT Supported Node.js version: >=8.3.0 Install Size Details Dependencies Status Build Status Maintainability Status

Get published date and modified date of the each page published by Netlify.

Install

npm install @sounisi5011/[email protected]

Usage

There is an example of a working configuration in the ./example/ directory.
Please check: https://github.com/sounisi5011/metalsmith-netlify-published-date/tree/v0.3.2/example

Options

This release is unstable. Some options may be change or remove before version 1.x is released.

To see a list of the latest commit options, see the type definition in the ./src/plugin.ts file: https://github.com/sounisi5011/metalsmith-netlify-published-date/blob/v0.3.2/src/plugin.ts#L32-L64

Also check the test code in the ./test/options/ directory for options available in the JSON file: https://github.com/sounisi5011/metalsmith-netlify-published-date/tree/v0.3.2/test/options

pattern

Only files that match this pattern will be processed.
Specify a glob expression string or an array of strings as the pattern.
Pattern are verified using multimatch v4.0.0.

siteID

Site ID that indicates the website to lookup on Netlify.
When building on Netlify, this value is automatically set from the environment variable URL.
When building in the development environment, you need to specify the siteID option or add the environment variable URL.

accessToken

If you are building a private website on Netlify, you need to specify the accessToken option.
The value to specify for this option can be generated on the following page (Note: you must be logged into Netlify): https://app.netlify.com/user/applications

plugins

Specify the Metalsmith plugins that generate the content to be deployed to Netlify using the date metadata obtained.

Only set plugins that are fast in this option.
A simple plugins that only has the function to convert files using date metadata is ideal.
This is because the plug-ins specified in this option are executed many times to compare with the preview on Netlify.

filename2urlPath

Specify the function of the following features: convert the file name of the before convert files into the path of the Web page published on Netlify.

e.g. If a file with extension .pug is converted to a file with extension .html, the following function should be set:

const netlifyPublishedDate = require('@sounisi5011/metalsmith-netlify-published-date');

netlifyPublishedDate({
    ...
    filename2urlPath: filename => filename.replace(/\.pug$/, '.html'),
    ...
})

Note: The return value of the function is delimited by the path delimiter and then URL escaped. That is, the value that this function must return is not a URL, but a file path before it is converted to a URL.

metadataUpdater

Use metadataUpdater option if you want to update Metalsmith metadata just before executing the build process to determine the modified date.
Content converted with the function specified in this option is used for content comparison.

The page data obtained from the Netlify preview is passed to the first argument. Parse this data and update the Metalsmith metadata passed in the second argument.

See the set-datetime.js file in the ./example/ directory for verbose usage: https://github.com/sounisi5011/metalsmith-netlify-published-date/blob/v0.3.2/example/set-datetime.js

contentsConverter

This function converts the content generated by the plugin specified in the plugins option and the content of the web page obtained from the Netlify preview.
Content converted with the function specified in this option is used for content comparison.

In other words, this function is used to remove HTML elements that should be excluded in the comparison.
See the remove-time-elem.js file in the ./example/ directory for verbose usage: https://github.com/sounisi5011/metalsmith-netlify-published-date/blob/v0.3.2/example/remove-time-elem.js

cacheDir

Specify the directory to save the cache file that holds the response data obtained from Netlify.

If set null, an in-memory cache using the Map object is used.

By default, it is set in the directory where the package is installed.
In a normal configuration, this package is installed under the node_modules/ directory.
For this reason, Netlify probably keep the cache generated by the production build.

Debug mode

This plugin supports debugging output.
To enable, use the following command when running your build script:

DEBUG=@sounisi5011/metalsmith-netlify-published-date,@sounisi5011/metalsmith-netlify-published-date:* node my-website-build.js

For more details, please check the description of debug v4.1.1.

Tests

To run the test suite, first install the dependencies, then run npm test:

npm install
npm test

Contributing

see CONTRIBUTING.md