Skip to content

Commit

Permalink
Merge pull request #2 from webKrafters/app-logo-link
Browse files Browse the repository at this point in the history
making docs logo availablel for readme
  • Loading branch information
steveswork authored May 3, 2024
2 parents 352d4e0 + 2a7f0c1 commit 060e5cf
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 13 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Auto Immutable JS

<p>
<img
height="240"
src="docs/src/images/logo.svg"
width="640"
></img>
</p>
<p><img height="240" src="logo.svg" width="640"></img></p>

# Introduction

Expand Down
45 changes: 45 additions & 0 deletions logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"files": [
"dist",
"index.js",
"docs/src/images/logo.svg"
"logo.svg"
],
"homepage": "https://github.com/webKrafters/auto-immutable/readme",
"keywords": [
Expand All @@ -51,6 +51,7 @@
},
"scripts": {
"build": "rm -rf dist && tsc && babel dist -d dist",
"postbuild": "node post-build.js",
"test": "jest --coverage --updateSnapshot",
"test:clean": "jest --clearCache",
"test:core": "jest --updateSnapshot",
Expand Down
30 changes: 25 additions & 5 deletions post-build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
var fs = require( 'fs' );
var path = require( 'path' );
const { promisify } = require( 'util' );

fs.writeFileSync(
path.join( 'dist', 'logo.svg' ),
fs.readFileSync( 'logo.svg', 'utf-8' ),
'utf8'
);
const read = promisify( fs.readFile );
const write = promisify( fs.writeFile );

const fOpts = { encoding: 'utf8' };

Promise
.allSettled([
read(
path.join( 'docs', 'src', 'images', 'logo.svg' ),
fOpts
),
read( 'logo.svg', fOpts )
])
.then(([ officialLogo, appLogo ]) => {
if( officialLogo.reason ) {
throw new Error( officialLogo.reason );
}
if( appLogo.reason ) { appLogo.value = '' }
if( appLogo.value === officialLogo.value ) { return }
write( 'logo.svg', officialLogo.value, fOpts );
})
.catch( e => {
console.log( 'FAILED TO PROCESS LOGO TRANSFER\n', e );
} );

0 comments on commit 060e5cf

Please sign in to comment.