forked from HashLips/hashlips_art_engine
-
Notifications
You must be signed in to change notification settings - Fork 209
Nested folders improvements patch #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bruceballad
wants to merge
20
commits into
nftchef:nested-folder-structure
Choose a base branch
from
bruceballad:nested-folders-improvements-patch
base: nested-folder-structure
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ee78b0e
resetNameIndex fix
bruceballad 86fa0c0
Improvements
bruceballad 89b17cf
Improvements part-2
bruceballad 8a78b3b
New removeMetadataContent utility
bruceballad 649e158
Merge branch 'nftchef:nested-folder-structure' into nested-folders-im…
bruceballad 1a9fc9e
Merge branch 'nftchef:nested-folder-structure' into nested-folders-im…
bruceballad 17fbecf
Delete 3shadow?blend=multiply&opacity=50.png
bruceballad f4656f6
Changes based on the requests from nftchef
bruceballad d912608
Merge branch 'nested-folder-structure' into nested-folders-improvemen…
bruceballad c9d4fa9
small comment clean up.
bruceballad d509238
Merge branch 'nftchef:nested-folder-structure' into nested-folders-im…
bruceballad 978c1b7
Merge branch 'nftchef:nested-folder-structure' into nested-folders-im…
bruceballad fc45eb1
Merge branch 'nftchef:nested-folder-structure' into nested-folders-im…
bruceballad 70b9cd4
Fix for using createPreviewCollage.js with JPEG outputs
bruceballad a4c6c8d
fix _offset console message + edition reports with name
bruceballad a38859d
Fix for using updateBaseUri.js with JPEG outputs
bruceballad 064e4b7
adds bypass DNA
bruceballad 328829c
Merge branch 'nested-folder-structure' into nested-folders-improvemen…
bruceballad 3fc7161
Merge branch 'nested-folder-structure' into nested-folders-improvemen…
bruceballad 3d139dc
Small Update
bruceballad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| --------------- | ||
| This utility can be used for removing unwanted data from json files such as "dna" or "external_url". | ||
bruceballad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Created by modifying removeTrait.js utility. | ||
| Use by running the following command; | ||
| ``` | ||
| node utils/removeMetadataContent.js "Background" | ||
| ``` | ||
| or for additional logging, use with the `-d` flag | ||
| ``` | ||
| node utils/removeMetadataContent.js "Background" -d | ||
| ``` | ||
| - BB | ||
| --------------- | ||
| */ | ||
|
|
||
|
|
||
| "use strict"; | ||
|
|
||
| const isLocal = typeof process.pkg === "undefined"; | ||
| const basePath = isLocal ? process.cwd() : path.dirname(process.execPath); | ||
| const fs = require("fs"); | ||
| const path = require("path"); | ||
| const { Command } = require("commander"); | ||
| const program = new Command(); | ||
|
|
||
| const chalk = require("chalk"); | ||
| const jsonDir = `${basePath}/build/json`; | ||
| const metadataFilePath = `${basePath}/build/json/_metadata.json`; | ||
|
|
||
| const getIndividualJsonFiles = () => { | ||
| return fs | ||
| .readdirSync(jsonDir) | ||
| .filter((item) => /^[0-9]{1,6}.json/g.test(item)); | ||
| }; | ||
|
|
||
| program | ||
| .argument("<target>") | ||
| .option("-d, --debug", "display some debugging") | ||
| .action((target, options, command) => { | ||
| const jsonFiles = getIndividualJsonFiles(); | ||
| options.debug | ||
| ? console.log( | ||
| `Found ${jsonFiles.length} json files in "${jsonDir}" to process` | ||
| ) | ||
| : null; | ||
|
|
||
| console.log(chalk.greenBright.inverse(`Removing ${target}`)); | ||
| jsonFiles.forEach((filename) => { | ||
| // read the contents | ||
| options.debug ? console.log(`removing ${target} from ${filename}`) : null; | ||
| const contents = JSON.parse(fs.readFileSync(`${jsonDir}/${filename}`)); | ||
|
|
||
| const hasTarget = contents.hasOwnProperty(target); | ||
|
|
||
| if (!hasTarget) { | ||
| console.log(chalk.yellow(`"${target}" not found in ${filename}`)); | ||
| } | ||
| // remove the target from attributes | ||
|
|
||
| delete contents[target] | ||
|
|
||
| // write the file | ||
| fs.writeFileSync( | ||
| `${jsonDir}/${filename}`, | ||
| JSON.stringify(contents, null, 2) | ||
| ); | ||
|
|
||
| options.debug | ||
| ? console.log( | ||
| hasTarget ? chalk.greenBright("Removed \n") : "…skipped \n" | ||
| ) | ||
| : null; | ||
| }); | ||
| }); | ||
|
|
||
| program.parse(); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.