Skip to content

Commit 1e30363

Browse files
author
Corneliu Tusnea
committed
improved code actions
1 parent eeb4dcf commit 1e30363

File tree

12 files changed

+1936
-85
lines changed

12 files changed

+1936
-85
lines changed

.github/PUBLISHING.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
This document explains how to publish ISL artifacts to Maven Central and GitHub Packages.
44

55
## Prerequisites
6+
https://intuit-teams.slack.com/archives/C044PJN2NDR/p1749599979127989?thread_ts=1749145553.673049&cid=C044PJN2NDR
7+
68

79
### 1. Maven Central (Sonatype OSSRH) Setup
810

@@ -16,24 +18,38 @@ To publish to Maven Central, you need:
1618

1719
```bash
1820
# Generate key
19-
gpg --gen-key
21+
gpg --full-generate-key
22+
# Choose RSA (option 1), key size 3072 or 4096, and set a strong passphrase
23+
24+
# List keys to get the key ID
25+
gpg --list-secret-keys --keyid-format=long
26+
27+
# Export the ASCII-armored secret key (replace KEY_ID with your key ID)
28+
gpg --export-secret-keys --armor KEY_ID
29+
```
30+
31+
**For Windows (PowerShell):**
32+
```powershell
33+
# Generate key
34+
gpg --full-generate-key
2035
21-
# List keys to get the key ID (last 8 characters of the fingerprint)
22-
gpg --list-keys
36+
# List keys
37+
gpg --list-secret-keys --keyid-format=long
2338
24-
# Export the key (replace KEY_ID with your key ID)
25-
gpg --export-secret-keys KEY_ID | base64
39+
# Export and copy to clipboard
40+
gpg --export-secret-keys --armor YOUR_KEY_ID | Set-Clipboard
2641
```
2742

43+
**Note:** You can use the ASCII-armored key directly in the `SIGNING_KEY` secret (starts with `-----BEGIN PGP PRIVATE KEY BLOCK-----`). Base64 encoding is optional.
44+
2845
### 2. GitHub Repository Secrets
2946

3047
Configure the following secrets in your GitHub repository (Settings → Secrets and variables → Actions):
3148

3249
#### Maven Central Secrets:
3350
- `OSSRH_USERNAME`: Your Sonatype JIRA username
3451
- `OSSRH_PASSWORD`: Your Sonatype JIRA password
35-
- `SIGNING_KEY_ID`: Your GPG key ID (last 8 characters)
36-
- `SIGNING_KEY`: Your base64-encoded GPG private key
52+
- `SIGNING_KEY`: Your ASCII-armored GPG private key (or base64-encoded)
3753
- `SIGNING_PASSWORD`: Your GPG key passphrase
3854

3955
#### GitHub Packages:
@@ -167,6 +183,17 @@ signing.secretKeyRingFile=/path/to/.gnupg/secring.gpg
167183

168184
## Troubleshooting
169185

186+
### Issue: "Could not read PGP secret key" or "checksum mismatch"
187+
**Solution:**
188+
1. Use the ASCII-armored format directly (recommended):
189+
```bash
190+
gpg --export-secret-keys --armor YOUR_KEY_ID
191+
```
192+
Copy the entire output (including BEGIN/END markers) into the `SIGNING_KEY` secret
193+
2. Ensure `SIGNING_PASSWORD` matches your GPG key passphrase
194+
3. Verify the key exports correctly before adding to GitHub secrets
195+
4. If using base64 encoding, ensure no extra whitespace or line breaks are introduced
196+
170197
### Issue: "Could not find signing key"
171198
**Solution:** Ensure GPG key is properly exported and base64 encoded. Check `SIGNING_KEY` secret.
172199

isl-transform/src/jmh/resources/shopify-transform.isl

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fun convertAddress( $addr ) {
99
$zip = $addr.zip | trim;
1010
$country = $addr.country_code | trim | upperCase;
1111
$formatted = `${$street}, ${$city}, ${$state} ${$zip}` | trim;
12-
12+
1313
return { street: $street, city: $city, state: $state, zipCode: $zip, country: $country, formatted: $formatted };
1414
}
1515

@@ -21,8 +21,8 @@ fun convertCustomer( $cust ) {
2121
$orders = $cust.orders_count | to.number;
2222
$spent = $cust.total_spent | to.decimal | precision(2);
2323
$addr = @.This.convertAddress( $cust.default_address );
24-
25-
return { id: $cust.id | to.string, fullName: `${$firstName} ${$lastName}` | trim, firstName: $firstName, lastName: $lastName, email: $email, phone: $cust.phone | trim, totalOrders: $orders, lifetimeValue: $spent, address: $addr };
24+
25+
return { id: $cust.id | to.string, fullName: `$firstName ${$lastName}` | trim, firstName: $firstName, lastName: $lastName, email: $email, phone: $cust.phone | trim, totalOrders: $orders, lifetimeValue: $spent, address: $addr };
2626
}
2727

2828
// Helper function: Process and enrich line item
@@ -36,8 +36,10 @@ fun processLineItem( $item ) {
3636
$lineTotal = {{ $price * $qty }} | Math.clamp(0, 999999) | precision(2);
3737
$weightKg = {{ $weight / 1000 }} | precision(3);
3838
$productCode = `${$sku}-${$item.product_id | to.string}` | upperCase;
39-
40-
return { itemId: $item.id | to.string, sku: $sku, productCode: $productCode, name: $name, vendor: $vendor, quantity: $qty, unitPrice: $price, lineTotal: $lineTotal, weight: $weight, weightKg: $weightKg, variantTitle: $item.variant_title | trim };
39+
40+
return $item | to.string;
41+
42+
// return { itemId: $item.id | to.string, sku: `$sku $test` | trim, productCode: $productCode, name: $name, vendor: $vendor, quantity: $qty, unitPrice: $price, lineTotal: $lineTotal, weight: $weight, weightKg: $weightKg, variantTitle: $item.variant_title | trim };
4143
}
4244

4345
// Main entry point
@@ -46,13 +48,21 @@ fun run( $input ) {
4648
$orderId = $input.id | to.string;
4749
$orderNum = $input.order_number | to.string | padStart(8, "0");
4850
$orderName = $input.name | trim;
49-
51+
5052
// Convert customer with enrichment
5153
$customer = @.This.convertCustomer( $input.customer );
52-
54+
55+
56+
57+
$obj.x = 10;
58+
$obj.a.d = 2;
59+
$obj.a.b.c = 1;
60+
$obj.y.z = 20;
61+
$obj.a.b.e = 3;
62+
5363
// Process all line items with enrichment using map with implicit $ iterator
5464
$processedItems = $input.line_items | map( @.This.processLineItem( $ ) );
55-
65+
5666
// Calculate order statistics using map/reduce with implicit $ iterator
5767
$totalItems = $input.line_items | length | to.number;
5868
$quantities = $input.line_items | map( $.quantity | to.number );
@@ -63,34 +73,34 @@ fun run( $input ) {
6373
$premiumCount = $input.line_items | filter( $.price | to.decimal >= 100 ) | length | to.number;
6474
$vendors = $input.line_items | map( $.vendor | trim | titleCase ) | unique | sort;
6575
$vendorCount = $vendors | length | to.number;
66-
76+
6777
// Financial calculations
6878
$subtotal = $input.subtotal_price | to.decimal | precision(2);
6979
$shippingCost = $input.total_shipping_price_set.shop_money.amount | to.decimal | precision(2);
7080
$tax = $input.total_tax | to.decimal | precision(2);
7181
$discounts = $input.total_discounts | to.decimal | precision(2);
7282
$total = $input.total_price | to.decimal | precision(2);
7383
$finalTotal = {{ $total - $discounts }} | Math.clamp(0, 999999) | precision(2);
74-
84+
7585
// Determine shipping method and status with conditionals
7686
$fulfillmentStatus = $input.fulfillment_status | trim | upperCase;
7787
$shippingStatus = if( $fulfillmentStatus == "FULFILLED" ) "DELIVERED" else "PENDING";
7888
$shippingSpeed = if( $shippingCost >= 20 ) "EXPRESS" else "STANDARD";
79-
89+
8090
// Build shipping information
8191
$shippingAddr = @.This.convertAddress( $input.shipping_address );
82-
92+
8393
// Process note attributes using map with implicit $ iterator
8494
$noteKeys = $input.note_attributes | map( $.name | trim );
8595
$noteValues = $input.note_attributes | map( $.value | trim );
86-
96+
8797
// Extract and process tags using map
8898
$tags = $input.tags | split(",") | map( $ | trim | upperCase );
89-
99+
90100
// Status flags with conditionals
91101
$isPaid = if( $input.financial_status | trim | lowerCase == "paid" ) true else false;
92102
$isFulfilled = if( $fulfillmentStatus == "FULFILLED" ) true else false;
93-
103+
94104
// Build final result with all transformations
95105
orderId: $orderId;
96106
orderNumber: $orderNum;
@@ -135,3 +145,5 @@ fun run( $input ) {
135145
isFulfilled: $isFulfilled;
136146
summary: `Order ${$orderNum} - ${$customer.fullName} - ${$finalTotal} ${$input.currency | trim | upperCase} - ${$totalItems} items` | trim;
137147
}
148+
149+

plugin/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
"default": false,
7878
"description": "Use tabs instead of spaces"
7979
},
80+
"isl.formatting.alignProperties": {
81+
"type": "boolean",
82+
"default": false,
83+
"description": "Align object property colons"
84+
},
8085
"isl.linting.enabled": {
8186
"type": "boolean",
8287
"default": true,

plugin/snippets/isl.json

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,172 @@
176176
"${1:\\$date} | to.string(\"${2:yyyy-MM-dd HH:mm:ss}\")"
177177
],
178178
"description": "Format date"
179+
},
180+
"ISL Transform Object Keys": {
181+
"prefix": "transformkeys",
182+
"body": [
183+
"foreach \\$key in ${1:\\$object} | keys",
184+
"\t`\\${\\$key}`: ${1:\\$object}[\\$key]$0",
185+
"endfor"
186+
],
187+
"description": "Transform all keys of an object"
188+
},
189+
"ISL Safe Navigation": {
190+
"prefix": "safe",
191+
"body": [
192+
"${1:\\$value} ?? ${2:defaultValue}"
193+
],
194+
"description": "Null coalescing operator"
195+
},
196+
"ISL Array to Object": {
197+
"prefix": "arrtoobj",
198+
"body": [
199+
"${1:\\$array} | map({",
200+
"\t`\\${${2:\\$item.key}}`: ${3:\\$item.value}",
201+
"})"
202+
],
203+
"description": "Convert array to object"
204+
},
205+
"ISL Conditional Field": {
206+
"prefix": "condfield",
207+
"body": [
208+
"if (${1:condition})",
209+
"\t${2:fieldName}: ${3:value}",
210+
"endif"
211+
],
212+
"description": "Conditional object field"
213+
},
214+
"ISL Error Handling": {
215+
"prefix": "errorhandle",
216+
"body": [
217+
"${1:\\$value} | default(${2:fallbackValue})"
218+
],
219+
"description": "Provide default value on error"
220+
},
221+
"ISL Spread Object": {
222+
"prefix": "spread",
223+
"body": [
224+
"{",
225+
"\t...${1:\\$object},",
226+
"\t${2:newField}: ${3:value}",
227+
"}"
228+
],
229+
"description": "Spread operator to merge objects"
230+
},
231+
"ISL Filter and Map": {
232+
"prefix": "filtermap",
233+
"body": [
234+
"${1:\\$array}",
235+
"\t| filter(${2:condition})",
236+
"\t| map(${3:expression})"
237+
],
238+
"description": "Filter then map array"
239+
},
240+
"ISL Reduce Sum": {
241+
"prefix": "reducesum",
242+
"body": [
243+
"${1:\\$array} | reduce({{ \\$acc + \\$it }}, 0)"
244+
],
245+
"description": "Reduce array to sum"
246+
},
247+
"ISL Template String": {
248+
"prefix": "template",
249+
"body": [
250+
"`${${1:expression}}`"
251+
],
252+
"description": "Template string with interpolation"
253+
},
254+
"ISL Multi-line String": {
255+
"prefix": "multiline",
256+
"body": [
257+
"`${1:line1}",
258+
"${2:line2}",
259+
"${3:line3}`"
260+
],
261+
"description": "Multi-line template string"
262+
},
263+
"ISL Nested Object": {
264+
"prefix": "nested",
265+
"body": [
266+
"{",
267+
"\t${1:field1}: {",
268+
"\t\t${2:nested}: ${3:value}",
269+
"\t}",
270+
"}"
271+
],
272+
"description": "Nested object structure"
273+
},
274+
"ISL Array Destructure": {
275+
"prefix": "destruct",
276+
"body": [
277+
"\\$${1:first} = ${2:\\$array} | first;",
278+
"\\$${3:last} = ${2:\\$array} | last;"
279+
],
280+
"description": "Destructure array"
281+
},
282+
"ISL Chain Modifiers": {
283+
"prefix": "chain",
284+
"body": [
285+
"${1:\\$value}",
286+
"\t| ${2:modifier1}",
287+
"\t| ${3:modifier2}",
288+
"\t| ${4:modifier3}"
289+
],
290+
"description": "Chain multiple modifiers"
291+
},
292+
"ISL Fallback Chain": {
293+
"prefix": "fallback",
294+
"body": [
295+
"${1:\\$primary} ?? ${2:\\$secondary} ?? ${3:default}"
296+
],
297+
"description": "Multiple fallback values"
298+
},
299+
"ISL Custom Object Key": {
300+
"prefix": "dynamickey",
301+
"body": [
302+
"{",
303+
"\t`\\${${1:expression}}`: ${2:value}",
304+
"}"
305+
],
306+
"description": "Object with dynamic key"
307+
},
308+
"ISL Validate and Transform": {
309+
"prefix": "validate",
310+
"body": [
311+
"if (${1:\\$input.field} | isNotEmpty)",
312+
"\t${2:result}: ${1:\\$input.field} | ${3:transform}",
313+
"else",
314+
"\t${2:result}: ${4:defaultValue}",
315+
"endif"
316+
],
317+
"description": "Validate before transforming"
318+
},
319+
"ISL Date Range": {
320+
"prefix": "daterange",
321+
"body": [
322+
"\\$start = ${1:\\$date};",
323+
"\\$end = ${1:\\$date} | date.add(${2:7}, \"${3:DAYS}\");"
324+
],
325+
"description": "Create date range"
326+
},
327+
"ISL Group By": {
328+
"prefix": "groupby",
329+
"body": [
330+
"foreach \\$item in ${1:\\$array}",
331+
"\t\\$key = \\$item.${2:groupField};",
332+
"\t\\$grouped[\\$key] = (\\$grouped[\\$key] ?? []) | push(\\$item);",
333+
"endfor"
334+
],
335+
"description": "Group array by field"
336+
},
337+
"ISL Batch Process": {
338+
"prefix": "batch",
339+
"body": [
340+
"parallel foreach \\$item in ${1:\\$array}",
341+
"\t@.This.${2:processFunction}(\\$item)",
342+
"endfor"
343+
],
344+
"description": "Parallel batch processing"
179345
}
180346
}
181347

0 commit comments

Comments
 (0)