trmnl_preview 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +24 -18
- data/lib/trmnlp/cli.rb +2 -0
- data/lib/trmnlp/lint/checks/webhook_url_shown.rb +24 -0
- data/lib/trmnlp/lint/diagnostic.rb +2 -1
- data/lib/trmnlp/lint.rb +3 -1
- data/lib/trmnlp/version.rb +1 -1
- data/templates/init/bin/trmnlp +3 -2
- data/templates/run_in_docker +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ddab525950f3e01ae9fd4e07afb80de6561f5c88f5f5a307f46c2578f057c4fa
|
|
4
|
+
data.tar.gz: 38563769627d50fae1b5f3aee125a99f1661ebb703655adc5cce7133e5371d85
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63e93e72f98d094dc6630394a968d30bca3020fc5938f32654b1b3c7c55fad6aa5456ba25c184c12ebfa1a7f0a9ffcb3efd55d1f3699a1a7ae18dbffc8e3ee4c
|
|
7
|
+
data.tar.gz: ac550f4ff63967bd8a4a47e7923919ffa889332706e99129e7e454df4065c303d34d6a7d572321234c435ab301c630cb3085647722b56e52ba1c9bad704773e0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
# Changelog
|
|
3
3
|
|
|
4
|
+
## 0.27.0
|
|
5
|
+
|
|
6
|
+
- `trmnlp lint` reports a webhook recipe with no `copyable_webhook_url` custom field (`webhook_url_shown`), as TRMNL's recipe review does. Without it, people who install the recipe have no field to copy their webhook URL from.
|
|
7
|
+
- A release pinned in a plugin's `bin/trmnlp`, such as `IMAGE=trmnl/trmnlp:v0.24.0`, is used when another copy of the script is on the PATH as `trmnlp`. The plugin ran the PATH copy's image instead. To get the fix in an existing plugin, run `trmnlp init` there and overwrite only `bin/trmnlp`.
|
|
8
|
+
- `trmnlp version` says when it runs in Docker, and in which image, on a second line on stderr. The version stays alone on stdout.
|
|
9
|
+
|
|
4
10
|
## 0.26.0
|
|
5
11
|
|
|
6
12
|
- `trmnlp lint` names the sizes an element has when a size class is missing (`framework_classes_exist`), such as `title--small` to `title--xxlarge` for `title--mega`, and links to the Framework's Element Sizes page. Each element has its own set of sizes.
|
data/README.md
CHANGED
|
@@ -13,16 +13,18 @@ The server watches the filesystem for changes to the Liquid templates, seamlessl
|
|
|
13
13
|
|
|
14
14
|
## Quick Start
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
With [Docker](https://docs.docker.com/get-docker/) installed:
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
|
|
19
|
+
mkdir -p ~/.local/bin # install
|
|
20
|
+
docker run --rm --entrypoint cat trmnl/trmnlp /app/templates/init/bin/trmnlp > ~/.local/bin/trmnlp
|
|
21
|
+
chmod +x ~/.local/bin/trmnlp
|
|
20
22
|
trmnlp init my_plugin # scaffold a project
|
|
21
23
|
cd my_plugin
|
|
22
24
|
trmnlp serve # preview at http://localhost:4567
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
Have Ruby 4.0 or newer? `gem install trmnl_preview` starts faster — see [Installing via RubyGems](#installing-via-rubygems).
|
|
26
28
|
|
|
27
29
|
## Project Structure
|
|
28
30
|
|
|
@@ -227,21 +229,7 @@ The `bin/trmnlp` script is provided as a convenience. It will use the local Ruby
|
|
|
227
229
|
|
|
228
230
|
You can modify the `bin/trmnlp` script to set up environment variables (plugin secrets, etc.) before running the server.
|
|
229
231
|
|
|
230
|
-
**
|
|
231
|
-
|
|
232
|
-
### Installing via RubyGems
|
|
233
|
-
|
|
234
|
-
Prerequisites:
|
|
235
|
-
|
|
236
|
-
- Ruby >= 4.0
|
|
237
|
-
- For PNG rendering (optional):
|
|
238
|
-
- Firefox
|
|
239
|
-
- ImageMagick
|
|
240
|
-
|
|
241
|
-
```sh
|
|
242
|
-
gem install trmnl_preview
|
|
243
|
-
trmnlp serve
|
|
244
|
-
```
|
|
232
|
+
**Docker or gem?** The Docker image has everything trmnlp needs, including Firefox and the tools `trmnlp test` uses. The gem starts a little faster, but needs Ruby 4.0 and those tools installed yourself.
|
|
245
233
|
|
|
246
234
|
### Installing via Docker
|
|
247
235
|
|
|
@@ -328,6 +316,24 @@ cd trmnlp
|
|
|
328
316
|
docker build -t trmnlp .
|
|
329
317
|
```
|
|
330
318
|
|
|
319
|
+
### Installing via RubyGems
|
|
320
|
+
|
|
321
|
+
Prerequisites:
|
|
322
|
+
|
|
323
|
+
- Ruby >= 4.0
|
|
324
|
+
- For PNG rendering and `trmnlp test`:
|
|
325
|
+
- Firefox
|
|
326
|
+
- ImageMagick 7
|
|
327
|
+
- For some `trmnlp test` features ([Testing](docs/testing.md)):
|
|
328
|
+
- libfaketime, for a transform's clock with `now:`
|
|
329
|
+
- zbar, for `have_qr_code`
|
|
330
|
+
- Node 24, Python or PHP, for a transform in that language
|
|
331
|
+
|
|
332
|
+
```sh
|
|
333
|
+
gem install trmnl_preview
|
|
334
|
+
trmnlp serve
|
|
335
|
+
```
|
|
336
|
+
|
|
331
337
|
## `.trmnlp.yml` Reference - Project Config
|
|
332
338
|
|
|
333
339
|
The `.trmnlp.yml` file lives in the root of the plugin project, and is for configuring the local dev server.
|
data/lib/trmnlp/cli.rb
CHANGED
|
@@ -117,6 +117,8 @@ module TRMNLP
|
|
|
117
117
|
puts VERSION
|
|
118
118
|
# Keep the version first when stdout is a pipe and stderr is not.
|
|
119
119
|
$stdout.flush
|
|
120
|
+
# On stderr, so a script that reads the version still gets the number alone.
|
|
121
|
+
warn "Running in Docker (#{ENV.fetch('TRMNLP_IMAGE', 'image unknown')})" if self.class.in_container?
|
|
120
122
|
check_for_update(fresh: true)
|
|
121
123
|
end
|
|
122
124
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../check'
|
|
4
|
+
|
|
5
|
+
module TRMNLP
|
|
6
|
+
module Lint
|
|
7
|
+
module Checks
|
|
8
|
+
# Recipe review asks a webhook recipe to show each install its own
|
|
9
|
+
# webhook URL, so the user can copy it into the service that pushes data.
|
|
10
|
+
class WebhookUrlShown < Check
|
|
11
|
+
MESSAGE = 'Add a custom field with field_type copyable_webhook_url, so people who install this webhook ' \
|
|
12
|
+
'recipe can copy their webhook URL. TRMNL fills it in with the URL of each install.'
|
|
13
|
+
LEARN_MORE = 'https://help.trmnl.com/en/articles/10513740-custom-plugin-form-builder#h_431c22552a'
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def pass?
|
|
18
|
+
source.settings['strategy'] != 'webhook' ||
|
|
19
|
+
source.custom_field_definitions.any? { it['field_type'] == 'copyable_webhook_url' }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -7,7 +7,8 @@ module TRMNLP
|
|
|
7
7
|
class Diagnostic
|
|
8
8
|
SETTINGS_KEYS = {
|
|
9
9
|
'title_casing' => 'name', 'title_length' => 'name',
|
|
10
|
-
'description_length' => 'description', 'recipe_overview_length' => 'recipe_overview'
|
|
10
|
+
'description_length' => 'description', 'recipe_overview_length' => 'recipe_overview',
|
|
11
|
+
'webhook_url_shown' => 'strategy'
|
|
11
12
|
}.freeze
|
|
12
13
|
MARKUP_PATTERNS = {
|
|
13
14
|
'no_async_functions' => /async function/i,
|
data/lib/trmnlp/lint.rb
CHANGED
|
@@ -30,6 +30,7 @@ require_relative 'lint/checks/framework_prefixes_exist'
|
|
|
30
30
|
require_relative 'lint/checks/no_external_qr_codes'
|
|
31
31
|
require_relative 'lint/checks/custom_field_links_embedded'
|
|
32
32
|
require_relative 'lint/checks/files_under_upload_limit'
|
|
33
|
+
require_relative 'lint/checks/webhook_url_shown'
|
|
33
34
|
|
|
34
35
|
module TRMNLP
|
|
35
36
|
# Markup best-practice checks behind `trmnlp lint`.
|
|
@@ -63,7 +64,8 @@ module TRMNLP
|
|
|
63
64
|
Checks::FrameworkPrefixesExist,
|
|
64
65
|
Checks::NoExternalQrCodes,
|
|
65
66
|
Checks::CustomFieldLinksEmbedded,
|
|
66
|
-
Checks::FilesUnderUploadLimit
|
|
67
|
+
Checks::FilesUnderUploadLimit,
|
|
68
|
+
Checks::WebhookUrlShown
|
|
67
69
|
].freeze
|
|
68
70
|
|
|
69
71
|
def self.rule_id(check_type) = check_type.name.split('::').last.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
|
data/lib/trmnlp/version.rb
CHANGED
data/templates/init/bin/trmnlp
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
# Add a tag to stay on one release, v0.22.0 or later: trmnl/trmnlp:v0.22.0
|
|
8
8
|
IMAGE=trmnl/trmnlp
|
|
9
9
|
|
|
10
|
-
# Saved on the PATH as `trmnlp`, this script is what `command -v trmnlp` finds: not a gem.
|
|
10
|
+
# Saved on the PATH as `trmnlp`, this script is what `command -v trmnlp` finds: not a gem. Nor is
|
|
11
|
+
# another copy of it there (it names run_in_docker): that one would run its own image, not the one above.
|
|
11
12
|
GEM="$(command -v trmnlp)"
|
|
12
|
-
if [ -n "$GEM" ] && ! [ "$GEM" -ef "$0" ]
|
|
13
|
+
if [ -n "$GEM" ] && ! [ "$GEM" -ef "$0" ] && ! grep -qs run_in_docker "$GEM"
|
|
13
14
|
then
|
|
14
15
|
exec "$GEM" "$@"
|
|
15
16
|
fi
|
data/templates/run_in_docker
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trmnl_preview
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.27.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rockwell Schrock
|
|
@@ -449,6 +449,7 @@ files:
|
|
|
449
449
|
- lib/trmnlp/lint/checks/title_casing.rb
|
|
450
450
|
- lib/trmnlp/lint/checks/title_length.rb
|
|
451
451
|
- lib/trmnlp/lint/checks/waits_for_dom_load.rb
|
|
452
|
+
- lib/trmnlp/lint/checks/webhook_url_shown.rb
|
|
452
453
|
- lib/trmnlp/lint/checks/yes_no_selects_are_boolean.rb
|
|
453
454
|
- lib/trmnlp/lint/diagnostic.rb
|
|
454
455
|
- lib/trmnlp/lint/source.rb
|