Skip to content

Commit

Permalink
nova funcionalidade e versão 4.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
victorhdsp committed Aug 17, 2024
1 parent 0671bc7 commit 7643907
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/**/node_modules
/**/coverage
/**/coverage
/**/out
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
O projeto ainda está em desenvolvimento e as próximas atualizações serão voltadas para as seguintes tarefas:

- [x] Conversão dos arquivos para o formato web.
- [x] Adicionar sinalização de que a aplicação esta rodando de forma constante.
- [ ] Criação de um backup das imagens para caso de problemas.
- [ ] Modificação dos arquivos estáticos do site, substituindo <img> por <picture> com seus devidos <sources>.
- [ ] Implementação em tempo real para JSX.
Expand Down
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ exports.execute = execute;
const process_1 = require("process");
const convert_1 = require("./convert");
const index_1 = require("./files/index");
const utils_1 = require("./utils");
function execute(src) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, utils_1.twirlTimer)();
const files = yield (0, index_1.getForFiles)(src);
console.log("Todas as imagens foram selecionadas.");
yield (0, convert_1.convertImages)(files);
Expand Down
6 changes: 4 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { exit, exitCode } from "process";
import { convertImages } from "./convert";
import { getForFiles } from "./files/index";
import { twirlTimer } from "./utils";

export async function execute(src: string) {
await twirlTimer();
const files = await getForFiles(src);
console.log("Todas as imagens foram selecionadas.")
console.log("Todas as imagens foram selecionadas.");
await convertImages(files);
console.log("Todas as imagens foram convertidas.")
console.log("Todas as imagens foram convertidas.");
exit(exitCode);
}
22 changes: 22 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.twirlTimer = twirlTimer;
function twirlTimer() {
return __awaiter(this, void 0, void 0, function* () {
var P = ["\\", "|", "/", "-"];
var x = 0;
return setInterval(function () {
process.stdout.write("\r" + P[x++]);
x &= 3;
}, 250);
});
}
8 changes: 8 additions & 0 deletions lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export async function twirlTimer() {
var P = ["\\", "|", "/", "-"];
var x = 0;
return setInterval(function() {
process.stdout.write("\r" + P[x++]);
x &= 3;
}, 250)
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pixelite",
"description": "Comprime as imagens de um diretório especificado, cria um backup fora do diretorio com as imagens originais e substitui as imagens do diretório especificado pelas imagens comprimidas, adicionando tambem uma versão WEBP da imagem",
"version": "4.0.2-2",
"version": "4.0.3",
"main": "./lib/index.js",
"keywords": [
"image",
Expand All @@ -22,7 +22,8 @@
"dev": "ts-node ./bin/index.ts",
"build": "tsc",
"start": "node ./bin/index.js",
"test": "jest"
"test": "jest",
"refresh": "find {bin,lib} -name '*.js' -delete"
},
"bin": {
"pixelite": "./bin/index.js"
Expand Down
Binary file removed src/funcionamento.png
Binary file not shown.

0 comments on commit 7643907

Please sign in to comment.