24 Commits

Author SHA1 Message Date
9573291582 Merge pull request '1.0.1' (#8) from 1.0.1 into main
All checks were successful
Create Version Tag / version-check (push) Successful in 22s
Create Version Tag / build-release (push) Successful in 2m8s
Create Version Tag / publish-release (push) Successful in 27s
Reviewed-on: #8
2025-05-07 12:30:54 -07:00
1a1431c85e chore: changelog and new readme 2025-05-07 13:28:46 -06:00
711880a670 fix: temporarily defaults asciiart to hosted file 2025-05-07 13:16:11 -06:00
4f043d2bd7 fix: banana 2025-05-07 13:07:47 -06:00
43d5916e52 fix: field rename preview 2025-05-07 12:55:19 -06:00
51aaf27fda new version 2025-05-07 10:29:15 -06:00
d5b9ef8f04 cl
All checks were successful
Create Version Tag / version-check (push) Successful in 19s
Create Version Tag / build-release (push) Has been skipped
Create Version Tag / publish-release (push) Has been skipped
2025-05-07 09:53:02 -06:00
22487224f2 fetch depth
All checks were successful
Create Version Tag / version-check (push) Successful in 20s
Create Version Tag / build-release (push) Successful in 2m25s
Create Version Tag / publish-release (push) Successful in 30s
2025-05-07 00:32:25 -06:00
6cc772bbf2 asdf
Some checks failed
Create Version Tag / version-check (push) Successful in 19s
Create Version Tag / build-release (push) Failing after 18s
Create Version Tag / publish-release (push) Has been skipped
2025-05-06 23:45:52 -06:00
430130cdaf asdf
Some checks failed
Create Version Tag / version-check (push) Failing after 18s
Create Version Tag / build-release (push) Has been skipped
Create Version Tag / publish-release (push) Has been skipped
2025-05-06 23:40:23 -06:00
9b11f14c84 fix ci
Some checks failed
Create Version Tag / version-check (push) Failing after 18s
Create Version Tag / build-release (push) Has been skipped
Create Version Tag / publish-release (push) Has been skipped
2025-05-06 23:25:15 -06:00
25378d2d3c unified ci workflow
Some checks failed
Create Version Tag / version-check (push) Successful in 20s
Create Version Tag / build-release (push) Has been skipped
Create Version Tag / publish-release (push) Failing after 17s
2025-05-06 23:13:53 -06:00
237d4c4349 whatever
All checks were successful
Create Version Tag / publish (push) Successful in 19s
2025-05-06 22:51:24 -06:00
b0fe668133 chore: trigger ci
Some checks failed
Create Version Tag / publish (push) Failing after 17s
2025-05-06 22:49:13 -06:00
7ee7d5f291 Merge pull request 'please for the love of god' (#7) from dev into main
Some checks failed
Create Version Tag / publish (push) Failing after 17s
Reviewed-on: #7
2025-05-06 21:11:36 -07:00
37f7a58f96 please for the love of god 2025-05-06 22:10:56 -06:00
4f4aee6a3e Merge pull request 'I'm tired boss' (#6) from dev into main
Some checks failed
Create Version Tag / publish (push) Failing after 14s
Reviewed-on: #6
2025-05-06 20:00:46 -07:00
4691ddc745 I'm tired boss 2025-05-06 21:00:16 -06:00
fa44985594 Merge pull request 'idek' (#5) from dev into main
Some checks failed
Create Version Tag / publish (push) Failing after 8s
Reviewed-on: #5
2025-05-06 19:17:38 -07:00
53cb40ebe8 idek 2025-05-06 20:16:56 -06:00
2113f930a7 Merge pull request 'asdf' (#4) from dev into main
Some checks failed
Create Version Tag / publish (push) Failing after 7s
Reviewed-on: #4
2025-05-06 18:54:14 -07:00
680aae8b4f asdf 2025-05-06 19:52:08 -06:00
969de4aab7 Merge pull request 'again' (#3) from dev into main
Some checks failed
Create Version Tag / publish (push) Failing after 8s
Reviewed-on: #3
2025-05-06 18:47:59 -07:00
673424d755 again 2025-05-06 19:47:18 -06:00
9 changed files with 154 additions and 71 deletions

View File

@@ -1,35 +0,0 @@
name: Build and Release
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_PAT }}
with:
- name: Build and release binaries
uses: bearmetal/ci-actions/deno-publish@main
with:
entrypoint: main.ts
compile-flags: "--allow-read --allow-write --allow-env --allow-net"
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_PAT }}
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: 2.3.1
- name: Publish to JSR
run: deno publish --token ${{ secrets.JSR_TOKEN }}

View File

@@ -0,0 +1,48 @@
name: Create Version Tag
on:
push:
branches:
- main
- "prerelease-*"
jobs:
version-check:
runs-on: ubuntu-latest
outputs:
tag_created: ${{ steps.tag.outputs.tag_created }}
tag_name: ${{ steps.tag.outputs.tag_name }}
steps:
- uses: actions/checkout@v4
- name: Run version check
id: tag
uses: https://git.cyborggrizzly.com/bearmetal/ci-actions/version-check@v1
build-release:
if: needs.version-check.outputs.tag_created == 'true'
needs: version-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build and release binaries
uses: https://git.cyborggrizzly.com/bearmetal/ci-actions/deno-release@main
with:
entrypoint: main.ts
compile-flags: "--allow-read --allow-write --allow-env --allow-net"
env:
GITEA_TOKEN: ${{ secrets.GIT_PAT }}
publish-release:
needs: build-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: 2.3.1
- name: Publish to JSR
run: deno publish --token ${{ secrets.JSR_PAT }}

View File

@@ -1,15 +0,0 @@
name: Create Version Tag
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_PAT }}
- uses: bearmetal/ci-actions/version-check@main

35
CHANGELOG.md Normal file
View File

@@ -0,0 +1,35 @@
# Changelog
## v1.0.1 (2025-07-25)
<!-- auto-changelog -->
### Known Issues
- help flags can cause issues
## v1.0.0 (2025-07-25)
### Features
- Check Code Tool
- reads supplied code files to see if form fields are present and represented
in a switch statement
- Field Rename Tool
- provide a search and replace pattern to bulk rename form fields
- List Form Fields
- Sometimes you just need to see what fields there are
### Known Issues
- Field rename does not represent full change applied to the field, only the
replaced text
- help flags can cause issues
- ascii art is broken (sad face)
- banana doesn't work
## v0.0.0 (never)
this is just here for a reference to the auto-changelog
<!-- auto-changelog -->

View File

@@ -1,7 +1,16 @@
# Emma's Simple Form Field Checker
# BearMetal PDF Tools
Compares a PDF form to a list of CS class files to see if all field names are
present, excluding signature fields.
A collection of tools for working with PDF forms.
## Features
- Check Code Tool
- reads supplied code files to see if form fields are present and represented
in a switch statement
- Field Rename Tool
- provide a search and replace pattern to bulk rename form fields
- List Form Fields
- Sometimes you just need to see what fields there are
## Prereqs
@@ -20,17 +29,51 @@ Deno >=2.2 (not required if downloading .exe)
> If you want it to be a global command, create an executables directory and add
> it to the PATH
### Precompiled
Download the latest release from the
[releases page](https://git.cyborggrizzly.com/BearMetal/pdf-tools/releases)
## Usage
`checkfields <path to PDF> <comma-separated list of paths to CS class files>`
-OR- `checkfields` and follow prompts.
`pdf-tools <tool> <args>` -> `<tool>` is one of the following
### Output
- check-code
- field-rename
- list-form-fields
> All form fields present!
## Contributing
-OR-
Contributions are welcome!
> The following field names are not present in the CS code
## License
> \<list of missing form fields\>
GPL 3.0
---
### About this project
BearMetal PDF Tools is a collection of tools made to fix the current state of
PDF form editing. Adobe Acrobat is a great tool, but it's not always the easiest
to use, nor is it free. It also lacks some features that I find useful, such as
bulk renaming of form fields. There's also a lack of powerful, free, and open
source tools for PDF editing.
This project aims to fill that gap by providing a set of tools that can be used
to edit PDF forms. The tools are written in Deno, a modern and secure runtime
for JavaScript and TypeScript. They are designed to be easy to use and to
provide a great user experience.
The tools are designed to be used in a terminal, and are not designed to be
integrated into other applications. They are also not designed to be used as a
library, but rather as a command line tool.
### About BearMetal
BearMetal is a project that aims to decrapify modern web development. It is a
collection of tools, libraries, and resources that aim to make web development
more accessible and less intimidating. The project is open source and free to
use, and is designed to be used by anyone, regardless of skill level or
experience. You can find a list of libraries and tools on
[JSR](https://jsr.io/@bearmetal).

View File

@@ -6,8 +6,6 @@ import { selectMenuInteractive } from "./selectMenu.ts";
import { TerminalBlock, TerminalLayout } from "./TerminalLayout.ts";
import { cliAlert, cliLog } from "./prompts.ts";
import type { ITool } from "../types.ts";
import { join, toFileUrl } from "@std/path";
import { log } from "util/logfile.ts";
// Register tools here (filename, no extension)
const toolRegistry: [string, Promise<{ default: ITool }>][] = [
@@ -23,6 +21,7 @@ export class PdfToolsCli {
private args = ArgParser.parse(Deno.args).setFlagDefs({
help: ["-h", "--help"],
banana: ["-b", "--banana"],
});
async importTools() {
@@ -43,9 +42,7 @@ export class PdfToolsCli {
private async banana() {
const asciiArt = await getAsciiArt("banana");
const body = this.terminalLayout.getBlock("body");
body.clearAll();
cliLog(colorize(asciiArt, "yellow"), body);
this.closeMessage = colorize(asciiArt, "yellow");
}
private async help() {
@@ -64,6 +61,11 @@ export class PdfToolsCli {
this.terminalLayout.register("title", titleBlock);
const bodyBlock = new TerminalBlock();
this.terminalLayout.register("body", bodyBlock);
if (this.args.getFlag("banana")) {
titleBlock.setFixedHeight(0);
await this.banana();
return;
}
if (this.args.getFlag("help") && !this.args.task) {
await this.help();
return;
@@ -75,12 +77,16 @@ export class PdfToolsCli {
await this.runTool(toCase(task, "title"));
}
} finally {
this.terminalLayout.clearAll();
Deno.stdin.setRaw(false);
if (this.closeMessage) console.log(this.closeMessage);
this.cleanup();
}
}
private cleanup() {
this.terminalLayout.clearAll();
Deno.stdin.setRaw(false);
if (this.closeMessage) console.log(this.closeMessage);
}
private async toolMenu() {
const tools = this.tools.keys().toArray();
const bodyBlock = this.terminalLayout.getBlock("body");

View File

@@ -1,6 +1,6 @@
{
"name": "@bearmetal/pdf-tools",
"version": "1.0.0",
"version": "1.0.1",
"license": "GPL 3.0",
"tasks": {
"dev": "deno run -A --env-file=.env --watch main.ts",

View File

@@ -123,8 +123,9 @@ class RenameFields implements ITool {
const match = patternRegex.exec(name);
if (match) {
const toChange = evaluateChange(change, match);
const preview = name.replace(new RegExp(patternRegex), toChange);
foundUpdates.push([
`${colorize(name, "red")} -> ${colorize(toChange, "green")}`,
`${colorize(name, "red")} -> ${colorize(preview, "green")}`,
() => {
applyRename(field, name, patternRegex, toChange);
},

View File

@@ -26,5 +26,5 @@ function getBearmetalAsciiPath() {
return filename.name;
}
}
return null;
return "https://git.cyborggrizzly.com/BearMetal/pdf-tools/raw/branch/main/asciiart.txt";
}