Skip to content

Commit

Permalink
Keep uploads when regenerating pfps
Browse files Browse the repository at this point in the history
  • Loading branch information
jandrad committed May 2, 2024
1 parent aaaf434 commit 8f88fe1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 27 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ npm install -g @nefty/cli
$ nefty COMMAND
running command...
$ nefty (--version)
@nefty/cli/0.2.12 darwin-arm64 node-v18.19.1
@nefty/cli/0.2.13 darwin-arm64 node-v18.19.1
$ nefty --help [COMMAND]
USAGE
$ nefty COMMAND
Expand Down Expand Up @@ -273,7 +273,7 @@ DESCRIPTION
Manages a collection's assets.
```

_See code: [src/commands/assets/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/assets/index.ts)_
_See code: [src/commands/assets/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/assets/index.ts)_

## `nefty assets mint INPUT`

Expand All @@ -300,7 +300,7 @@ EXAMPLES
$ nefty assets mint test.xls -c alpacaworlds
```

_See code: [src/commands/assets/mint.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/assets/mint.ts)_
_See code: [src/commands/assets/mint.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/assets/mint.ts)_

## `nefty config`

Expand All @@ -314,7 +314,7 @@ DESCRIPTION
Manages the configuration.
```

_See code: [src/commands/config/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/config/index.ts)_
_See code: [src/commands/config/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/config/index.ts)_

## `nefty config auth`

Expand All @@ -333,7 +333,7 @@ EXAMPLES
$ nefty config auth auth
```

_See code: [src/commands/config/auth.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/config/auth.ts)_
_See code: [src/commands/config/auth.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/config/auth.ts)_

## `nefty config get`

Expand All @@ -350,7 +350,7 @@ EXAMPLES
$ nefty config get
```

_See code: [src/commands/config/get.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/config/get.ts)_
_See code: [src/commands/config/get.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/config/get.ts)_

## `nefty config init`

Expand All @@ -370,7 +370,7 @@ EXAMPLES
$ nefty config init
```

_See code: [src/commands/config/init.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/config/init.ts)_
_See code: [src/commands/config/init.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/config/init.ts)_

## `nefty config set [PROPERTY] [VALUE]`

Expand All @@ -393,7 +393,7 @@ EXAMPLES
$ nefty config set explorerUrl https://waxblock.io
```

_See code: [src/commands/config/set.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/config/set.ts)_
_See code: [src/commands/config/set.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/config/set.ts)_

## `nefty generate`

Expand All @@ -407,7 +407,7 @@ DESCRIPTION
Generates excel files to use in other batch commands.
```

_See code: [src/commands/generate/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/generate/index.ts)_
_See code: [src/commands/generate/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/generate/index.ts)_

## `nefty generate mint-file OUTPUT`

Expand Down Expand Up @@ -439,7 +439,7 @@ EXAMPLES
$ nefty generate mint-file mints.xlsx -c alpacaworlds
```

_See code: [src/commands/generate/mint-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/generate/mint-file.ts)_
_See code: [src/commands/generate/mint-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/generate/mint-file.ts)_

## `nefty generate pfp-file OUTPUT`

Expand Down Expand Up @@ -471,7 +471,7 @@ EXAMPLES
$ nefty generate pfp-file pfp-layers.xlsx -l Body -l Face -l Hair -a
```

_See code: [src/commands/generate/pfp-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/generate/pfp-file.ts)_
_See code: [src/commands/generate/pfp-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/generate/pfp-file.ts)_

## `nefty generate template-file OUTPUT`

Expand Down Expand Up @@ -503,7 +503,7 @@ EXAMPLES
$ nefty generate template-file templates.xlsx -c alpacaworlds
```

_See code: [src/commands/generate/template-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/generate/template-file.ts)_
_See code: [src/commands/generate/template-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/generate/template-file.ts)_

## `nefty generate token-transfer-file OUTPUT`

Expand All @@ -525,7 +525,7 @@ EXAMPLES
$ nefty generate token-transfer-file transfers.xlsx
```

_See code: [src/commands/generate/token-transfer-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/generate/token-transfer-file.ts)_
_See code: [src/commands/generate/token-transfer-file.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/generate/token-transfer-file.ts)_

## `nefty help [COMMAND]`

Expand Down Expand Up @@ -559,7 +559,7 @@ DESCRIPTION
Commands to manage a PFP collection.
```

_See code: [src/commands/pfps/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/pfps/index.ts)_
_See code: [src/commands/pfps/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/pfps/index.ts)_

## `nefty pfps build INPUT`

Expand Down Expand Up @@ -590,7 +590,7 @@ EXAMPLES
$ nefty pfps build ./pfps-folder -c alpacaworls -t 11324 -a alpacaworlds -n "My NFT" -r
```

_See code: [src/commands/pfps/build.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/pfps/build.ts)_
_See code: [src/commands/pfps/build.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/pfps/build.ts)_

## `nefty pfps cover INPUT`

Expand Down Expand Up @@ -622,7 +622,7 @@ EXAMPLES
ff28ca1c5749e6a6369dae7fe7d334b5b5ca40e43f1c345e7f0b4b22b36c0c6b
```

_See code: [src/commands/pfps/cover.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/pfps/cover.ts)_
_See code: [src/commands/pfps/cover.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/pfps/cover.ts)_

## `nefty pfps generate INPUT OUTPUT`

Expand Down Expand Up @@ -652,7 +652,7 @@ EXAMPLES
$ nefty pfps generate pfps-specs.xlsx pfps
```

_See code: [src/commands/pfps/generate.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/pfps/generate.ts)_
_See code: [src/commands/pfps/generate.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/pfps/generate.ts)_

## `nefty pfps mint INPUT`

Expand All @@ -678,7 +678,7 @@ EXAMPLES
$ nefty pfps mint ./pfps-folder
```

_See code: [src/commands/pfps/mint.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/pfps/mint.ts)_
_See code: [src/commands/pfps/mint.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/pfps/mint.ts)_

## `nefty pfps mosaic INPUT`

Expand Down Expand Up @@ -711,7 +711,7 @@ EXAMPLES
ff28ca1c5749e6a6369dae7fe7d334b5b5ca40e43f1c345e7f0b4b22b36c0c6b
```

_See code: [src/commands/pfps/mosaic.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/pfps/mosaic.ts)_
_See code: [src/commands/pfps/mosaic.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/pfps/mosaic.ts)_

## `nefty templates`

Expand All @@ -725,7 +725,7 @@ DESCRIPTION
Manages a collection's templates.
```

_See code: [src/commands/templates/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/templates/index.ts)_
_See code: [src/commands/templates/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/templates/index.ts)_

## `nefty templates create INPUT`

Expand All @@ -749,7 +749,7 @@ EXAMPLES
$ nefty templates create template.xls -c alpacaworlds
```

_See code: [src/commands/templates/create.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/templates/create.ts)_
_See code: [src/commands/templates/create.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/templates/create.ts)_

## `nefty templates export OUTPUT`

Expand Down Expand Up @@ -781,7 +781,7 @@ EXAMPLES
$ nefty templates export templates.xlsx -c alpacaworlds
```

_See code: [src/commands/templates/export.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/templates/export.ts)_
_See code: [src/commands/templates/export.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/templates/export.ts)_

## `nefty tokens`

Expand All @@ -795,7 +795,7 @@ DESCRIPTION
Manages an account's tokens
```

_See code: [src/commands/tokens/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/tokens/index.ts)_
_See code: [src/commands/tokens/index.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/tokens/index.ts)_

## `nefty tokens transfer INPUT`

Expand All @@ -818,5 +818,5 @@ EXAMPLES
$ nefty tokens transfer test.xls
```

_See code: [src/commands/tokens/transfer.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.12/src/commands/tokens/transfer.ts)_
_See code: [src/commands/tokens/transfer.ts](https://github.com/neftyblocks/neftyblocks-cli/blob/v0.2.13/src/commands/tokens/transfer.ts)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nefty/cli",
"version": "0.2.12",
"version": "0.2.13",
"description": "The NeftyBlocks cli will help you manage your collection with commands to create templates, mint assets, and more.",
"keywords": [
"oclif"
Expand Down
17 changes: 15 additions & 2 deletions src/commands/pfps/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { downloadImage, fileExists } from '../../utils/file-utils.js';
import { SingleBar } from 'cli-progress';
import writeXlsxFile from 'write-excel-file/node';
import { generateImage, generatePfps, readPfpLayerSpecs } from '../../services/pfp-service.js';
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { PfpManifest } from '../../types/pfps.js';
import { confirmPrompt, makeSpinner } from '../../utils/tty-utils.js';
import PfpCoverCommand from './cover.js';
Expand Down Expand Up @@ -73,7 +73,6 @@ export default class GeneratePfpsCommand extends BaseCommand {
if (!overwrite) {
return;
} else {
rmSync(manifestPath, { force: true });
rmSync(excelPath, { force: true });
rmSync(imagesFolder, { recursive: true, force: true });
}
Expand Down Expand Up @@ -129,6 +128,20 @@ export default class GeneratePfpsCommand extends BaseCommand {
pfps: [],
};

if (existsSync(manifestPath)) {
try {
const currentManifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
manifest.uploads = currentManifest.uploads;
} catch (error) {
const shouldDelete = await confirmPrompt('Manifest file is corrupted, do you want to delete it?');
if (shouldDelete) {
rmSync(manifestPath, { force: true });
} else {
return;
}
}
}

const headerRow = [
{
type: String,
Expand Down

0 comments on commit 8f88fe1

Please sign in to comment.