Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions bin/only-commit-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,32 @@ function findBuiltFiles( dir ) {
}

const isProbablyBuilt = filePath.endsWith('.css');
const basename = path.basename( filePath, '.css' );

// `.css` files exactly 2 directories below `_imports/` are source files
// in the reorganized third-party library structure (e.g. Bootstrap 4/5).
// They use `.css` extension by convention and are not build artifacts.
const isLibrarySource = /_imports\/[^/]+\/[^/]+\/[^/]+\.css$/.test( relativePath );

// `core-styles.*.css` files are consumer-facing entry points in `_imports/`;
// they aggregate @imports for a client library and must be published.
const isEntryPoint = /_imports\/core-styles\.[^/]+\.css$/.test( relativePath );

// Files whose name starts with `demo` / `example`, or contains `.demo`,
// are Fractal-only demo helpers and are never compiled into the package.
const isDemoOrExample = /(?:^demo(?:[.-]|$)|\.demo(?:[.-]|$)|^example(?:[.-]|$))/.test( basename );

// `_imports/vendors/` exists on epic/v3 but is removed on epic/v3--reorg;
// this rule becomes a no-op once the reorg merges in.
const isVendored = relativePath.includes( '_imports/vendors' );

const shouldIgnore = (
/_imports\/[^/]+\/[^/]+\/[^/]+\.css$/.test(relativePath) ||
isLibrarySource ||
filePath.endsWith('fractality.server.refresh.css') ||
relativePath.includes('_imports/vendors') ||
filePath.endsWith('README.css')
isVendored ||
filePath.endsWith('README.css') ||
isEntryPoint ||
isDemoOrExample
);

if ( isProbablyBuilt && ! shouldIgnore ) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/_imports/components/c-tag.postcss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url("../tools/x-tag.css");
@import url("../tools/x-tag.postcss");

@import url("./c-tag.selectors.postcss");

Expand Down
2 changes: 1 addition & 1 deletion src/lib/_imports/objects/o-offset-content.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Content that should be:
Styleguide Objects.OffsetContent
*/
@import url("../tools/media-queries.postcss");
@import url("../tools/x-offset-content.css");
@import url("../tools/x-offset-content.postcss");

.o-offset-content--left,
.o-offset-content--right {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/_imports/tools/x-offset-content.demo.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* This CSS is ONLY for the pattern library. It is NOT part of the pattern. */

@import url("./x-offset-content.css");
@import url("./x-offset-content.postcss");

.x-offset-content--left,
.x-offset-content--right {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/_imports/tools/x-pill.demo.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url("./x-pill.css");
@import url("./x-pill.postcss");

/* FAQ: Wrapped to deter clients from using `.x-pill` */
/* HACK: Not in `x-pill/demo.css` because it is not processed */
Expand Down
2 changes: 1 addition & 1 deletion src/lib/_imports/tools/x-tag.demo.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url("./x-tag.css");
@import url("./x-tag.postcss");

/* FAQ: Wrapped to deter clients from using `.x-tag` */
/* HACK: Not in `x-tag/demo.css` because it is not processed */
Expand Down
File renamed without changes.