11#! /bin/bash
22
33EXTENSION_NAME=" Pixely-Sort-&-Save"
4+ DIST_DIR=" dist_firefox"
45FILES_TO_INCLUDE=" ."
56EXCLUDE_LIST=(
67 " --exclude=compactar_extensao.sh"
8+ " --exclude=gerar_pasta_chrome.sh"
79 " --exclude=${EXTENSION_NAME} .xpi"
810 " --exclude=README.md"
11+ " --exclude=manifest.chrome.json"
12+ " --exclude=manifest.firefox.json"
913 " --exclude=LICENSE"
1014 " --exclude=screenshot/*"
1115 " --exclude=.git/*"
1216 " --exclude=.gitignore"
1317 " --exclude=*.zip"
1418 " --exclude=*.env"
1519 " --exclude=*.vscode/*"
20+ " --exclude=dist_*/*"
1621)
1722
1823EXCLUDE_CMD=" ${EXCLUDE_LIST[*]} "
1924
20- echo " --- Removendo versões anteriores --- "
21-
22- if [ -f " ${EXTENSION_NAME} .xpi " ]; then
23- echo " Removendo .xpi anterior: ${EXTENSION_NAME} .xpi "
24- rm " ${EXTENSION_NAME} .xpi "
25+ # Criar diretório de distribuição se não existir
26+ echo " --- Preparando ambiente --- "
27+ if [ ! -d " ${DIST_DIR} " ]; then
28+ echo " Criando diretório ${DIST_DIR} "
29+ mkdir -p " ${DIST_DIR} "
2530fi
2631
27- if [ -f " ${EXTENSION_NAME} .zip" ]; then
28- echo " Removendo .zip anterior: ${EXTENSION_NAME} .zip"
29- rm " ${EXTENSION_NAME} .zip"
32+ # Remover versão anterior
33+ echo " --- Removendo versões anteriores ---"
34+ if [ -f " ${DIST_DIR} /${EXTENSION_NAME} .xpi" ]; then
35+ echo " Removendo .xpi anterior: ${DIST_DIR} /${EXTENSION_NAME} .xpi"
36+ rm " ${DIST_DIR} /${EXTENSION_NAME} .xpi"
3037fi
38+ echo " "
3139
40+ # Criar cópia temporária do manifest.firefox.json para manifest.json
41+ echo " --- Preparando manifest.json ---"
42+ if [ -f " manifest.firefox.json" ]; then
43+ echo " Criando cópia temporária do manifest.firefox.json"
44+ cp manifest.firefox.json manifest.json
45+ MANIFEST_COPIED=true
46+ else
47+ echo " Arquivo manifest.firefox.json não encontrado!"
48+ MANIFEST_COPIED=false
49+ fi
3250echo " "
3351
52+ # Criar arquivo XPI
3453echo " --- Criando arquivo .xpi ---"
35- echo " Criando arquivo compactado: ${EXTENSION_NAME} .xpi"
36- zip -q -r " ${EXTENSION_NAME} .xpi" ${FILES_TO_INCLUDE} ${EXCLUDE_CMD}
54+ echo " Criando arquivo compactado: ${DIST_DIR} / ${ EXTENSION_NAME} .xpi"
55+ zip -q -r " ${DIST_DIR} / ${ EXTENSION_NAME} .xpi" ${FILES_TO_INCLUDE} ${EXCLUDE_CMD}
3756echo " .xpi criado com sucesso!"
3857echo " "
3958
40- echo " --- Criando arquivo .zip ---"
41- echo " Criando arquivo compactado: ${EXTENSION_NAME} .zip"
42- zip -q -r " ${EXTENSION_NAME} .zip" ${FILES_TO_INCLUDE} ${EXCLUDE_CMD}
43- echo " .zip criado com sucesso!"
44- echo " "
59+ # Remover a cópia temporária do manifest.json se foi criada
60+ if [ " $MANIFEST_COPIED " = true ]; then
61+ echo " --- Limpando arquivos temporários ---"
62+ echo " Removendo cópia temporária do manifest.json"
63+ rm manifest.json
64+ echo " "
65+ fi
4566
46- echo " --- Todas as tarefas de compactação concluídas! ---"
67+ echo " --- Todas as tarefas de compactação concluídas! ---"
68+ echo " Arquivo .xpi disponível em: ${DIST_DIR} /${EXTENSION_NAME} .xpi"
0 commit comments