prettier-plugin-sfmc 0.1.0 → 0.1.4

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.
Files changed (2) hide show
  1. package/README.md +59 -5
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -69,13 +69,67 @@ When formatting `.html` files, the plugin:
69
69
 
70
70
  This means a single plugin handles all SFMC formatting in HTML email templates.
71
71
 
72
- ## Migration from `prettier-plugin-ampscript` / `prettier-plugin-ssjs`
72
+ ## Ignoring Code
73
73
 
74
- Both plugins have been merged into this single package:
74
+ Prettier provides two ways to exclude code from formatting: ignore comments for specific code sections, and `.prettierignore` for entire files.
75
75
 
76
- 1. Replace `prettier-plugin-ampscript` and `prettier-plugin-ssjs` with `prettier-plugin-sfmc`
77
- 2. Update the `plugins` array in `.prettierrc` if explicitly configured
78
- 3. All `ampscript*` option names are unchanged
76
+ ### SSJS
77
+
78
+ SSJS uses Prettier's built-in JavaScript formatter. Use `// prettier-ignore` to exclude the next statement from formatting:
79
+
80
+ ```js
81
+ // prettier-ignore
82
+ var config = {
83
+ clientId: "abc123",
84
+ clientSecret: "xyz789",
85
+ endpoint: "https://example.com"
86
+ };
87
+ ```
88
+
89
+ Without the comment, Prettier would collapse the aligned spacing.
90
+
91
+ ### AMPscript
92
+
93
+ AMPscript uses block comment syntax. Use `/* prettier-ignore */` to exclude the next statement from formatting:
94
+
95
+ ```ampscript
96
+ %%[
97
+ /* prettier-ignore */
98
+ set @matrix = Concat(
99
+ '1, 0, 0,',
100
+ '0, 1, 0,',
101
+ '0, 0, 1'
102
+ )
103
+ ]%%
104
+ ```
105
+
106
+ ### Ignoring Files: .prettierignore
107
+
108
+ To exclude entire files from formatting, create a `.prettierignore` file in the root of your project. It uses [gitignore syntax](https://git-scm.com/docs/gitignore#_pattern_format).
109
+
110
+ Example:
111
+
112
+ ```text
113
+ # Ignore artifacts:
114
+ build
115
+ coverage
116
+
117
+ # Ignore all HTML files:
118
+ **/*.html
119
+ ```
120
+
121
+ By default Prettier ignores files in version control directories (`.git`, `.svn`, `.hg`) and `node_modules`. Prettier also follows rules in `.gitignore` if present.
122
+
123
+ #### SMS and Mobile Messages
124
+
125
+ For SMS or MobilePush messages, line breaks and exact character placement often matter for delivery and display. Excluding these files from formatting prevents Prettier from altering whitespace that affects message rendering.
126
+
127
+ Example pattern for SFMC DevTools mobile message assets:
128
+
129
+ ```text
130
+ # Preserve exact formatting in mobile messages
131
+ **/*.asset-mobile-meta.amp
132
+ ```
79
133
 
80
134
  ## License
81
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-sfmc",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "Prettier plugin for Salesforce Marketing Cloud — AMPscript formatting and SSJS file registration",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -24,7 +24,7 @@
24
24
  "author": "Joern Berkefeld",
25
25
  "scripts": {
26
26
  "example": "prettier --plugin . example.ampscript",
27
- "test": "node --experimental-vm-modules ../node_modules/jest/bin/jest.js"
27
+ "test": "node ./scripts/run-jest.mjs"
28
28
  },
29
29
  "keywords": [
30
30
  "prettier",
@@ -38,13 +38,13 @@
38
38
  ],
39
39
  "license": "MIT",
40
40
  "dependencies": {
41
- "ampscript-data": "^0.1.1",
42
- "ampscript-parser": "^0.1.0",
43
- "ssjs-data": "^0.1.0"
41
+ "ampscript-data": "^0.1.3",
42
+ "ampscript-parser": "^0.1.1",
43
+ "ssjs-data": "^0.2.2"
44
44
  },
45
45
  "devDependencies": {
46
- "jest": "^29.0.0",
47
46
  "@jest/globals": "^29.0.0",
47
+ "jest": "^29.0.0",
48
48
  "prettier": "^3.7.0"
49
49
  },
50
50
  "peerDependencies": {