Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.

Package: Add @wordpress/custom-templated-path-webpack-plugin package #93

Merged
merged 1 commit into from
Mar 21, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Mar 18, 2018

This pull request seeks to add a new package: @wordpress/custom-templated-path-webpack-plugin. This has been extracted from an inline class definition in Gutenberg's webpack.config.js, and updated for Webpack 4+ .

Refer to included README.md for more information.

Testing instructions:

See: WordPress/gutenberg#5687

@codecov
Copy link

codecov bot commented Mar 18, 2018

Codecov Report

Merging #93 into master will decrease coverage by 2.08%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
- Coverage   73.45%   71.36%   -2.09%     
==========================================
  Files          35       38       +3     
  Lines         437      461      +24     
  Branches       82       86       +4     
==========================================
+ Hits          321      329       +8     
- Misses         98      112      +14     
- Partials       18       20       +2
Impacted Files Coverage Δ
.../custom-templated-path-webpack-plugin/src/index.js 0% <0%> (ø)
...d-path-webpack-plugin/test/fixtures/entry/index.js 0% <0%> (ø)
...ath-webpack-plugin/test/fixtures/webpack.config.js 88.88% <88.88%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c62e78...712e599. Read the comment docs.

@@ -0,0 +1,33 @@
{
"name": "@wordpress/custom-templated-path-webpack-plugin",
"version": "1.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This initial version here needs to not be 1.0.0, @gziolo has used "version": "1.0.1-0", in the past which has worked fine though I think we should use 1.0.0-alpha.

This all because Lerna bumps this version upon release, if it were to stay at 1.0.0 then Lerna would only be able to publish a patch 1.0.1, minor 1.1.0, or major 2.0.0 release and a 1.0.0 version would never be published.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that's annoying 😄 Maybe it'd be fine to publish an initial release manually, without Lerna?

@aduth aduth merged commit 7025e0f into master Mar 21, 2018
@aduth aduth deleted the add/custom-templated-path-plugin branch March 21, 2018 19:40
plugins: [
new CustomTemplatedPathPlugin( {
basename( path, data ) {
console.log(data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it wasn’t expected to be landed 😃

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least it's in a test file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to add this to jest-console 😎

@gziolo
Copy link
Member

gziolo commented Mar 21, 2018

By the way, what was the reason you avoided import/export statements? In src subfolder it’s perfectly fine to use all Babel friendly code. Build step generates 2 versions by default.

@aduth
Copy link
Member Author

aduth commented Mar 21, 2018

Because it doesn't transpile to CommonJS-compatible. If using export default, consuming projects need to require via require( '@wordpress/custom-templated-path-webpack-plugin' ).default (note .default).

@gziolo
Copy link
Member

gziolo commented Mar 21, 2018

Right, that reminds me I sort of did the same for node based packages 😃
The only difference is that I put them in the root folder to skip Babel magic. Both work similar.
I think it isn’t the case for tests though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants