resourcepacker
Advanced tools
Comparing version 1.0.2 to 1.0.3
# Changelog | ||
## 1.0.3 | ||
*2021-01-02* | ||
- Added support for pack version 7 (*Minecraft* 1.17+). | ||
- Added a warning when initialising inside an existing project. | ||
- Changed the output folder name to more accurately combine the release and development versions. | ||
- Changed the output of `rpkr` (without any parameters) to display a welcome message instead of an error. | ||
- Bumped copyfiles dependency from 2.3.0 to 2.4.1. | ||
## 1.0.2 | ||
*2020-08-08* | ||
- Fixed special characters in custom parameter names not being escaped during substituting. | ||
- Fixed special characters in custom parameter names not being escaped when substituting. | ||
@@ -7,0 +15,0 @@ ## 1.0.1 |
60
index.js
#!/usr/bin/env node | ||
const RPKR_VERSION = '1.0.1'; | ||
const RPKR_VERSION = '1.0.3'; | ||
@@ -14,6 +14,6 @@ const fs = require('fs'); | ||
name: process.cwd().split(/\/|\\/).slice(-1)[0], | ||
packver: 'v1', | ||
mcver: '1.16.x', | ||
packver: 'v1.0', | ||
mcver: '1.16.4', | ||
mcsnap: null, | ||
description: null, | ||
description: 'Default resource pack configuration.', | ||
languages: null, | ||
@@ -39,8 +39,16 @@ files: [ | ||
6: ['1.16.x'], | ||
7: ['1.17.x'], | ||
}; | ||
function init() { | ||
fs.writeFile('.rpkr.json', jsonformat(CONFIG), err => { | ||
if (err) throw "FSWriteError: Cannot write to .rpkr.json configuration file"; | ||
else log("Successfully created config file .rpkr.json with default settings"); | ||
function init(force) { | ||
if (fs.existsSync('.rpkr.json') && !force.includes('f')) { | ||
log('Warning: This folder is already initialised with an .rpkr.json configuration file.'); | ||
log('Type `rpkr init force` to overwrite it with default settings.'); | ||
} | ||
else fs.writeFile('.rpkr.json', jsonformat(CONFIG), err => { | ||
if (err) throw 'FSWriteError: Cannot write to .rpkr.json configuration file.'; | ||
else { | ||
if (force.includes('f')) log('Warning: Overwriting existing .rpkr.json configuration file.'); | ||
log(`Successfully created .rpkr.json configuration file with default settings.`); | ||
} | ||
}); | ||
@@ -54,4 +62,12 @@ } | ||
let { files, name, packver, mcver, mcsnap, description, languages } = config; | ||
let outputFolder = output || `${name} ${packver} (${mcsnap || mcver})`; | ||
let qualifiedName = mcver; | ||
if (mcsnap) { | ||
if (mcsnap.match(/\d\dw\d\d\w/)) qualifiedName = mcsnap; // snapshot | ||
if (mcsnap.match(/\w+\d+/)) qualifiedName = mcver + '-' + mcsnap; // short name of pre and rc | ||
else qualifiedName = mcver + ' ' + mcsnap; // full name of pre and rc | ||
} | ||
let outputFolder = output || `${name} ${packver} (${qualifiedName})`; | ||
log(`Packaging version ${packver} of '${name}'...`); | ||
@@ -64,3 +80,3 @@ copyfiles( | ||
log(`${success ? 'S' : 'Uns'}uccessfully packaged version ${packver} of '${name}' for Minecraft ${mcver}`); | ||
} | ||
}; | ||
if (err) log('Error: ' + err), success(false); | ||
@@ -79,3 +95,3 @@ else if (description) { | ||
description = description | ||
.replace(/&(?=[0-9a-fk-or])/g, '§') // formatting codes | ||
.replace(/&([0-9a-fk-or])/g, '§$1') // formatting codes | ||
.replace(RegExp(`<${escapeRegex(item)}>`, 'g'), config[item]) // custom parameters | ||
@@ -98,4 +114,4 @@ } | ||
err => { | ||
if (err) log("FSWriteError: Could not create automatic pack.mcmeta file"), success(false); | ||
else log("Created automatic pack.mcmeta file"), success(true); | ||
if (err) log('FSWriteError: Could not create automatic pack.mcmeta file'), success(false); | ||
else log('Created automatic pack.mcmeta file'), success(true); | ||
} | ||
@@ -111,13 +127,19 @@ ); | ||
const arg = n => process.argv[n + 1] || ''; | ||
if (arg(1).includes('h')) { | ||
if (!arg(1)) { | ||
log('Welcome to resourcepacker, the simple way to package Minecraft resource packs.'); | ||
log('Type `rpkr help` for a list of commands.'); | ||
} | ||
else if (arg(1).includes('h')) { | ||
log(` | ||
rpkr help Display this help message | ||
rpkr init Initialize this directory with an rpkr configuration file | ||
rpkr pack [<output folder>] Package your resource pack | ||
rpkr version Display the current version of resourcepacker | ||
rpkr help Display this help message | ||
rpkr init Initialise this directory with a configuration file | ||
rpkr init [force] Overwite the existing configuration file with default settings | ||
rpkr pack Package your resource pack into a folder described by the configuration file | ||
rpkr pack [<name>] Package your resource pack into a set named output folder | ||
rpkr version Display the current version of resourcepacker | ||
`.trimRight()); | ||
} | ||
else if (arg(1).includes('v')) log('The current version of resourcepacker is ' + RPKR_VERSION); | ||
else if (arg(1) === 'init') init(); | ||
else if (arg(1) === 'init') init(arg(2)); | ||
else if (arg(1) === 'pack') package(arg(2)); | ||
else log('Unknown command; type `rpkr help` for help'); |
{ | ||
"name": "resourcepacker", | ||
"version": "1.0.2", | ||
"description": "Easily and cleanly packages Minecraft resource packs from a messy working directory", | ||
"version": "1.0.3", | ||
"description": "Packages Minecraft resource packs easily and cleanly from a messy working directory", | ||
"keywords": [ | ||
@@ -26,5 +26,5 @@ "minecraft", | ||
"dependencies": { | ||
"copyfiles": "^2.3.0", | ||
"copyfiles": "^2.4.1", | ||
"json-format": "^1.0.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14312
124
Updatedcopyfiles@^2.4.1