-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* 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
There are no files selected for viewing
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.' | ||
); | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.