samrith-s / parcel-plugin-structurize

A plugin to customize the output (dist) directory structure during production.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[🚧] v2 - Roadmap

samrith-s opened this issue Β· comments

When I first created this plugin over a year ago, I had no plans to maintain it. It was just something to fulfil a requirement at work.

This project is doing reasonably well, and though I don't provide regular updates, I am keen on giving it a complete revamp. This issue will be the point of discussion for everything pertaining to v2 of this plugin.

Releases

Foundation

The plugin now uses Typescript. This choice has been made keeping in mind the number of people making the switch to it and also in terms of maintainability and code discoverability.

As of 19/08/2020, the plugin engine support is currently:

"node": ">=12"

The previous version supported up to node@v8. If there is a strong enough case, I might still consider adding support for node@v10.

v2 Feature List

Support user-defined structures βœ…

Users will have fine-grained control over where certain files go and can group using a multitude of options.
Example:

[
	{
		"files": ".{jpg,png,gif,bmp,webp}",
		"folder": "images"
	},
	{
		"files": "*.svg",
		"folder": "vectors"
	}
]
Configuration file βœ…

Configuration using parcel-structurize.json or parcel-plugin-structurize key in package.json. This will help the user declutter package.json. The plugin will still ship with sane defaults to power zero-config integration.

Rework file targeting to enable multiple different sources of inputs βœ…

Remove the restriction of the plugin wherein it acts only on .html input sources. If there are no .html input sources, there is a lot of redundant code that runs. This rework should also make the plugin faster.

Better logging βœ…

Provide a map of all the resources changes upon completion. Right now user sees no information about updates to the output.

Contributions & Testing

To help test this, simple clone the repository and checkout to the v2 branch (it is already the default branch). To test it out in your project, you can run:

yarn add -D parcel-plugin-structurize@next

Bugs

To report bugs please use the v2 bug report template.

Dropped features

Custom tags

With the new configuration users can provide tags that the plugin should target Tags can be any valid HTML selector.
Example:

[
	{
		"files": ".{css,svg}",
		"folder": "assets",
		"source": "link[rel='stylesheet'], img[src*='.svg']"
	}
]

The plugin no longer iterates over HTML files to find and replace instances. This also means JSDOM is no longer a dependency.

Enable use of either globs or regexes

The files option in the new configuration will be able to accept glob patterns or regexes for more fine-tuning.
Example:

[
	{
		// glob match - Selects all CSS and SVG files
		"files": ".{css,svg}",
		"folder": "assets"
	},
	{
		// regex match - Selects all files with names <file-name>.vendor.js,
		"files": /(vendor\.js)$/,
		"folder": "vendor"
	}
]

Glob pattern already allows specifying complicated matches. Regex support is hence dropped.

The beta version has been released. Check out the releases for more information.

Official release of v2. You can read more about it here.

Note: The verbose configuration flag yields no result as of now. It is planned for sometime in the near future. No timelines guaranteed.