Skip to content

Commit

Permalink
epic/v3: do not commit /dist & source files as .postcss (#407)
Browse files Browse the repository at this point in the history
* feat!: remove dist

* conf!: ignore dist

* feat!: prevent publish if .css in src

Need next to:
- Rename source files to .postcss.
- Deal with demo stylesheets.

* feat: log if no dist found in source

* refactor: optimizations

* refactor: renamed vars

* refactor: renamed source .css files to .postcss

* refactor: move **/*.css source to ../*.postcss

* fix/refactor: load .postcsss not .css

* temp: restore dist (rebuilt) to diff

* revert "conf!: ignore dist" (manually)

* chore: delete & ignore dist (again)

I checked diff with base branch. All good:
- Diff had changes (unexpected).
- Diff changes were rmeoval of demo and outdated files.

* chore: ignore dist

* chore: delete util script

* fix: ignore fractal util file
  • Loading branch information
wesleyboar authored Oct 14, 2024
1 parent 1e216d2 commit f5429eb
Show file tree
Hide file tree
Showing 491 changed files with 435 additions and 663 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ node_modules
# PostCSS
.postcssrc.yml

# Core-Styles
dist

# Fractal
demo
## Files used directly by demo but not clients, yet provided via dist
Expand Down
12 changes: 6 additions & 6 deletions HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Load `core-styles.base.css` from a CDN e.g. [JSDeliver].
- Or in CSS:

```css
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.base.css");
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.base.css"\);
```

### 2. Project
Expand All @@ -61,7 +61,7 @@ Load any one of these relevant project-type CSS from a CDN e.g. [JSDeliver]:
- Or in CSS:

```css
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.______.css");
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.______.css"\);
```

Replace `______` with `cms` or `docs` or `portal`.
Expand All @@ -81,7 +81,7 @@ Load stylesheets from your project.
- Or in CSS:

```css
@import url("/your/project/stylesheet.css");
@import url("/your/project/stylesheet.postcss");
```

## Use **Some** of [Core Styles]
Expand Down Expand Up @@ -120,7 +120,7 @@ Load `core-styles.settings.css` from a CDN e.g. [JSDeliver].
- Or in CSS:

```css
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.settings.css");
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.settings.css"\);
```

### Load a [Core Styles] Pattern
Expand All @@ -136,7 +136,7 @@ To use a pattern as is.
- Or in CSS:

```css
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.settings.css");
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.settings.css"\);
```

### Extend a [Core Styles] Pattern
Expand All @@ -157,7 +157,7 @@ To use a pattern but also change it to fit a unique requirement of your site.
- Or in CSS:

```css
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.settings.css");
@import url("https://cdn.jsdelivr.net/npm/@tacc/core-styles@2.25.3/dist/core-styles.settings.css"\);

.c-message--scope-section {
margin-bottom: 1em;
Expand Down
2 changes: 1 addition & 1 deletion bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ARGS = mininmist( process.argv.slice( 2 ) );
const BUILD_ID = ARGS['build-id'] || '';

/* Theme: (default) */
buildStylesheets('src/lib/_imports/**/*!(fractal.server.refresh).css', './dist', {
buildStylesheets('src/lib/_imports/**/*!(fractal.server.refresh).postcss', './dist', {
baseMirrorDir: 'src/lib/_imports',
buildId: BUILD_ID
});
50 changes: 50 additions & 0 deletions bin/only-commit-source.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const fs = require('fs');
const path = require('path');

function findBuiltFiles( dir ) {
let builtFiles = [];
const files = fs.readdirSync( dir );

for ( const file of files ) {
const filePath = path.join( dir, file );
const relativePath = path.relative( path.join( __dirname, '../src'), filePath );
const isDirectory = fs.statSync( filePath ).isDirectory();

if ( isDirectory ) {
builtFiles.push(...findBuiltFiles( filePath ));
continue;
}

const isProbablyBuilt = filePath.endsWith('.css');
const shouldIgnore = (
/^lib\/_imports\/[^/]+\/[^/]+\/[^/]+\.css$/.test(relativePath) ||
filePath.endsWith('fractal.server.refresh.css') ||
relativePath.includes('_imports/vendors') ||
filePath.endsWith('README.css')
);

if ( isProbablyBuilt && ! shouldIgnore ) {
builtFiles.push(filePath);
}
}

return builtFiles;
}

const sourceDir = path.join( __dirname, '../', 'src');
const sourceFiles = findBuiltFiles( sourceDir );

if ( sourceFiles.length > 0 ) {
console.error(
`Found ${sourceFiles.length} dist files in source. Remove to permit publish:`
);
sourceFiles.forEach( file =>
console.error(`- ${file}`)
);

process.exit(1);
} else {
console.log(
'No dist files found in source. Ready to publish.'
);
}
1 change: 0 additions & 1 deletion dist/branding_logos.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/README.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/admonition.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/admonition/demo.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/align.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/align/demo.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.col.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.container.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.figure.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.form.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.modal--cms.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.modal--portal.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.modal.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.nav-tabs.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.pagination.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap.row.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap/bootstrap--form.demo.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap/bootstrap--modal.demo.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap/demo.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap3.breadcrumb.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap3.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/bootstrap5.border-spinner.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/c-app-card.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/c-app-card/demo.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/components/c-button--cms.css

This file was deleted.

Loading

0 comments on commit f5429eb

Please sign in to comment.