comment-block-replacer 0.1.0 → 0.1.1
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.
- package/CHANGELOG.md +8 -0
- package/package.json +15 -13
- package/test/index.test.js +16 -16
package/CHANGELOG.md
ADDED
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-block-replacer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Process files with comment block replacements",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "uvu test '.test.([mc]js|[jt]sx?)$'",
|
|
9
|
+
"build": "pnpm run types",
|
|
10
|
+
"types": "tsc --emitDeclarationOnly --outDir types",
|
|
11
|
+
"clean": "rimraf types",
|
|
12
|
+
"publish": "git push origin && git push origin --tags",
|
|
13
|
+
"release:patch": "pnpm run build && pnpm version patch && pnpm publish",
|
|
14
|
+
"release:minor": "pnpm run build && pnpm version minor && pnpm publish",
|
|
15
|
+
"release:major": "pnpm run build && pnpm version major && pnpm publish"
|
|
16
|
+
},
|
|
7
17
|
"dependencies": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
18
|
+
"comment-block-transformer": "0.2.0",
|
|
19
|
+
"is-valid-path": "^0.1.1"
|
|
10
20
|
},
|
|
11
21
|
"devDependencies": {
|
|
12
22
|
"typescript": "^5.0.0",
|
|
@@ -15,13 +25,5 @@
|
|
|
15
25
|
"publishConfig": {
|
|
16
26
|
"access": "public"
|
|
17
27
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"build": "pnpm run types",
|
|
21
|
-
"types": "tsc --emitDeclarationOnly --outDir types",
|
|
22
|
-
"clean": "rimraf types",
|
|
23
|
-
"release:patch": "pnpm run build && pnpm version patch && pnpm publish",
|
|
24
|
-
"release:minor": "pnpm run build && pnpm version minor && pnpm publish",
|
|
25
|
-
"release:major": "pnpm run build && pnpm version major && pnpm publish"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
+
"gitHead": "546a15fac58d28315057449adf122a5ab8575901"
|
|
29
|
+
}
|
package/test/index.test.js
CHANGED
|
@@ -52,9 +52,9 @@ test('should process file content with transforms', async () => {
|
|
|
52
52
|
const content = `
|
|
53
53
|
# Test Document
|
|
54
54
|
|
|
55
|
-
<!--
|
|
55
|
+
<!-- block uppercase -->
|
|
56
56
|
hello world
|
|
57
|
-
<!--
|
|
57
|
+
<!-- /block -->
|
|
58
58
|
|
|
59
59
|
Some other content.
|
|
60
60
|
`
|
|
@@ -77,9 +77,9 @@ test('should process file from path', async () => {
|
|
|
77
77
|
const content = `
|
|
78
78
|
# Test File
|
|
79
79
|
|
|
80
|
-
<!--
|
|
80
|
+
<!-- block wordcount -->
|
|
81
81
|
This is a test document with multiple words to count.
|
|
82
|
-
<!--
|
|
82
|
+
<!-- /block -->
|
|
83
83
|
`
|
|
84
84
|
|
|
85
85
|
await fs.writeFile(testFile, content)
|
|
@@ -99,9 +99,9 @@ This is a test document with multiple words to count.
|
|
|
99
99
|
|
|
100
100
|
test('should write to output file when not dry run', async () => {
|
|
101
101
|
const content = `
|
|
102
|
-
<!--
|
|
102
|
+
<!-- block uppercase -->
|
|
103
103
|
test content
|
|
104
|
-
<!--
|
|
104
|
+
<!-- /block -->
|
|
105
105
|
`
|
|
106
106
|
|
|
107
107
|
/** @type {ProcessFileOptions} */
|
|
@@ -124,9 +124,9 @@ test content
|
|
|
124
124
|
|
|
125
125
|
test('should apply transforms to source file when applyTransformsToSource is true', async () => {
|
|
126
126
|
const content = `
|
|
127
|
-
<!--
|
|
127
|
+
<!-- block uppercase -->
|
|
128
128
|
source content
|
|
129
|
-
<!--
|
|
129
|
+
<!-- /block -->
|
|
130
130
|
`
|
|
131
131
|
|
|
132
132
|
await fs.writeFile(testFile, content)
|
|
@@ -150,9 +150,9 @@ source content
|
|
|
150
150
|
test('should detect syntax from file extension', async () => {
|
|
151
151
|
const jsFile = path.join(testDir, 'test.js')
|
|
152
152
|
const content = `
|
|
153
|
-
/*
|
|
153
|
+
/* block uppercase */
|
|
154
154
|
const test = 'hello world'
|
|
155
|
-
/*
|
|
155
|
+
/* /block */
|
|
156
156
|
`
|
|
157
157
|
|
|
158
158
|
await fs.writeFile(jsFile, content)
|
|
@@ -161,8 +161,8 @@ const test = 'hello world'
|
|
|
161
161
|
const options = {
|
|
162
162
|
srcPath: jsFile,
|
|
163
163
|
dryRun: true,
|
|
164
|
-
open: '
|
|
165
|
-
close: '
|
|
164
|
+
open: 'block',
|
|
165
|
+
close: '/block',
|
|
166
166
|
transforms: mockTransforms
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -174,9 +174,9 @@ const test = 'hello world'
|
|
|
174
174
|
|
|
175
175
|
test('should handle missing transforms', async () => {
|
|
176
176
|
const content = `
|
|
177
|
-
<!--
|
|
177
|
+
<!-- block nonexistent -->
|
|
178
178
|
test content
|
|
179
|
-
<!--
|
|
179
|
+
<!-- /block -->
|
|
180
180
|
`
|
|
181
181
|
|
|
182
182
|
/** @type {ProcessFileOptions} */
|
|
@@ -210,9 +210,9 @@ test('should handle both srcPath and content error', async () => {
|
|
|
210
210
|
|
|
211
211
|
test('should handle file with output directory', async () => {
|
|
212
212
|
const content = `
|
|
213
|
-
<!--
|
|
213
|
+
<!-- block uppercase -->
|
|
214
214
|
directory test
|
|
215
|
-
<!--
|
|
215
|
+
<!-- /block -->
|
|
216
216
|
`
|
|
217
217
|
|
|
218
218
|
const outputDir = path.join(testDir, 'output')
|