@wp-blocks/make-pot 1.0.1 → 1.0.2
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/README.md +58 -58
- package/jest.config.json +5 -1
- package/lib/cli/parseCli.js.map +1 -1
- package/lib/extractors/index.js +2 -2
- package/lib/extractors/index.js.map +1 -1
- package/lib/fs/glob.js +2 -2
- package/lib/fs/glob.js.map +1 -1
- package/lib/parser/exec.js +1 -1
- package/lib/parser/exec.js.map +1 -1
- package/lib/parser/makePot.js +4 -2
- package/lib/parser/makePot.js.map +1 -1
- package/lib/parser/process.js +1 -1
- package/lib/parser/process.js.map +1 -1
- package/package.json +6 -6
- package/tests/{getFiles.old.ts → getFiles.test.ts} +114 -114
- package/tests/{getStrings.old.ts → getStrings.test.ts} +85 -76
- package/tests/{ingnoreFunction.old.ts → ignoreFunction.test.ts} +126 -128
- package/tests/{jsonParse.ts → jsonParse.test.ts} +51 -61
- package/tests/{extract-2.test.ts → tree.test.ts} +49 -1
- package/.github/workflows/node.js.yml +0 -33
- package/.github/workflows/tsDoc.yml +0 -52
- package/tests/makePot.old.ts +0 -46
- package/tests/treeJs.old.ts +0 -16
- package/tests/treePhp.old.ts +0 -31
- package/tests/treeTs.old.ts +0 -16
- package/tests/utils.old.ts +0 -28
|
@@ -1,76 +1,85 @@
|
|
|
1
|
-
import { describe, expect } from '@jest/globals'
|
|
2
|
-
import { Args, DomainType } from '../src/types'
|
|
3
|
-
import { getFiles } from '../src/glob'
|
|
4
|
-
import { getStrings } from '../src/parser/process'
|
|
5
|
-
|
|
6
|
-
const args: Args = {
|
|
7
|
-
slug: 'plugin-slug',
|
|
8
|
-
paths: { cwd: 'tests/fixtures/sourcedir/', out: 'tests/fixtures/' },
|
|
9
|
-
domain: 'plugin' as DomainType,
|
|
10
|
-
patterns: {
|
|
11
|
-
include: ['**'],
|
|
12
|
-
exclude: [
|
|
13
|
-
'node_modules',
|
|
14
|
-
'vendor',
|
|
15
|
-
'dist',
|
|
16
|
-
'tests',
|
|
17
|
-
'package-lock.json',
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
describe('getStrings', () => {
|
|
23
|
-
it('Should build pot file', async () => {
|
|
24
|
-
const files = await getFiles(args as Args, {
|
|
25
|
-
include: ['file.php'],
|
|
26
|
-
exclude: ['node_modules', 'dist'],
|
|
27
|
-
})
|
|
28
|
-
const dataExtracted = await getStrings({ ...args } as Args, files)
|
|
29
|
-
|
|
30
|
-
expect(dataExtracted).toMatchSnapshot()
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
import { describe, expect } from '@jest/globals'
|
|
2
|
+
import { Args, DomainType } from '../src/types'
|
|
3
|
+
import { getFiles } from '../src/fs/glob'
|
|
4
|
+
import { getStrings } from '../src/parser/process'
|
|
5
|
+
|
|
6
|
+
const args: Args = {
|
|
7
|
+
slug: 'plugin-slug',
|
|
8
|
+
paths: { cwd: 'tests/fixtures/sourcedir/', out: 'tests/fixtures/' },
|
|
9
|
+
domain: 'plugin' as DomainType,
|
|
10
|
+
patterns: {
|
|
11
|
+
include: ['**'],
|
|
12
|
+
exclude: [
|
|
13
|
+
'node_modules',
|
|
14
|
+
'vendor',
|
|
15
|
+
'dist',
|
|
16
|
+
'tests',
|
|
17
|
+
'package-lock.json',
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('getStrings', () => {
|
|
23
|
+
it('Should build pot file', async () => {
|
|
24
|
+
const files = await getFiles(args as Args, {
|
|
25
|
+
include: ['file.php'],
|
|
26
|
+
exclude: ['node_modules', 'dist'],
|
|
27
|
+
})
|
|
28
|
+
const dataExtracted = await getStrings({ ...args } as Args, files)
|
|
29
|
+
|
|
30
|
+
expect(dataExtracted).toMatchSnapshot()
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe('getFiles', () => {
|
|
35
|
+
it('Should build pot file from fixtures block.json', async () => {
|
|
36
|
+
const currentArgs = {
|
|
37
|
+
...args,
|
|
38
|
+
paths: { cwd: 'tests/fixtures/block/', out: 'tests/fixtures/' },
|
|
39
|
+
patterns: {
|
|
40
|
+
include: ['block.json'],
|
|
41
|
+
exclude: ['node_modules'],
|
|
42
|
+
},
|
|
43
|
+
} as Args
|
|
44
|
+
const files = await getFiles(currentArgs as Args, currentArgs.patterns)
|
|
45
|
+
const dataExtracted = await getStrings(currentArgs as Args, files)
|
|
46
|
+
|
|
47
|
+
const expected = [
|
|
48
|
+
{
|
|
49
|
+
'': {
|
|
50
|
+
description: {
|
|
51
|
+
comments: {
|
|
52
|
+
extracted: 'description',
|
|
53
|
+
reference: 'tests\\fixtures\\block\\block.json',
|
|
54
|
+
},
|
|
55
|
+
msgctxt: undefined,
|
|
56
|
+
msgid: 'description',
|
|
57
|
+
msgid_plural: '',
|
|
58
|
+
msgstr: [],
|
|
59
|
+
},
|
|
60
|
+
keywords: {
|
|
61
|
+
comments: {
|
|
62
|
+
extracted: 'keywords',
|
|
63
|
+
reference: 'tests\\fixtures\\block\\block.json',
|
|
64
|
+
},
|
|
65
|
+
msgctxt: undefined,
|
|
66
|
+
msgid: 'keywords',
|
|
67
|
+
msgid_plural: '',
|
|
68
|
+
msgstr: [],
|
|
69
|
+
},
|
|
70
|
+
title: {
|
|
71
|
+
comments: {
|
|
72
|
+
extracted: 'title',
|
|
73
|
+
reference: 'tests\\fixtures\\block\\block.json',
|
|
74
|
+
},
|
|
75
|
+
msgctxt: undefined,
|
|
76
|
+
msgid: 'title',
|
|
77
|
+
msgid_plural: '',
|
|
78
|
+
msgstr: [],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
expect(dataExtracted).toMatchObject(expected)
|
|
84
|
+
})
|
|
85
|
+
})
|
|
@@ -1,128 +1,126 @@
|
|
|
1
|
-
import { describe, expect } from '@jest/globals'
|
|
2
|
-
import { Glob, Path } from 'glob'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'**/
|
|
51
|
-
'
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
'
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
expect(foundDirs
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
128
|
-
})
|
|
1
|
+
import { describe, expect } from '@jest/globals'
|
|
2
|
+
import { Glob, Path } from 'glob'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import { minimatch } from 'minimatch'
|
|
5
|
+
import { ignoreFunc } from '../src/fs/glob'
|
|
6
|
+
|
|
7
|
+
describe('includes or not', () => {
|
|
8
|
+
it('paths includes', () => {
|
|
9
|
+
expect(
|
|
10
|
+
path
|
|
11
|
+
.normalize(
|
|
12
|
+
'D:\\vvv-local\\www\\phpeighttwo\\public_html\\wp-content\\plugins\\makePot\\tests\\fixtures'
|
|
13
|
+
)
|
|
14
|
+
.includes('tests')
|
|
15
|
+
).toBe(true)
|
|
16
|
+
expect(
|
|
17
|
+
path.normalize(
|
|
18
|
+
path.relative(
|
|
19
|
+
'D:\\vvv-local\\www\\phpeighttwo\\public_html\\wp-content\\plugins\\makePot\\tests\\fixtures',
|
|
20
|
+
'tests'
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
).toBe('..')
|
|
24
|
+
expect(
|
|
25
|
+
minimatch(path.normalize('block/SvgControls.tsx'), 'block/**')
|
|
26
|
+
).toBe(true)
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const tests = [
|
|
31
|
+
{
|
|
32
|
+
title: 'defaults',
|
|
33
|
+
src: '.',
|
|
34
|
+
exclude: [
|
|
35
|
+
'.git',
|
|
36
|
+
'node_modules',
|
|
37
|
+
'vendor',
|
|
38
|
+
'build',
|
|
39
|
+
'dist',
|
|
40
|
+
'uploads',
|
|
41
|
+
'Gruntfile.js',
|
|
42
|
+
'webpack.config.js',
|
|
43
|
+
'**/*.min.js',
|
|
44
|
+
'tsconfig.js',
|
|
45
|
+
'**.test.**',
|
|
46
|
+
'tests',
|
|
47
|
+
'coverage',
|
|
48
|
+
'**/extractors**',
|
|
49
|
+
'**/*.js.map',
|
|
50
|
+
'**/lib/c**.d.ts',
|
|
51
|
+
'**/**tt**',
|
|
52
|
+
],
|
|
53
|
+
result: 20,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: 'exclude file.php',
|
|
57
|
+
src: 'tests/fixtures/sourcedir',
|
|
58
|
+
exclude: ['file.php'],
|
|
59
|
+
result: [
|
|
60
|
+
'theme.json',
|
|
61
|
+
'svgTools.ts',
|
|
62
|
+
'plugin-header.php',
|
|
63
|
+
'package.json',
|
|
64
|
+
'file2.txt',
|
|
65
|
+
'vendor' + path.sep + 'index.php',
|
|
66
|
+
'node_modules' + path.sep + 'module' + path.sep + 'block.json',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: 'exclude node_modules and vendor',
|
|
71
|
+
src: 'tests/fixtures/sourcedir',
|
|
72
|
+
exclude: ['node_modules', 'vendor'],
|
|
73
|
+
result: [
|
|
74
|
+
'theme.json',
|
|
75
|
+
'svgTools.ts',
|
|
76
|
+
'plugin-header.php',
|
|
77
|
+
'package.json',
|
|
78
|
+
'file2.txt',
|
|
79
|
+
'file.php',
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: 'globstar path',
|
|
84
|
+
src: 'tests/fixtures',
|
|
85
|
+
exclude: ['**/*.php', '**/*.json', 'block/**'],
|
|
86
|
+
result: 15,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: 'should exclude globstar',
|
|
90
|
+
src: 'tests/fixtures/',
|
|
91
|
+
exclude: ['**'],
|
|
92
|
+
result: [],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
title: 'should remove excluded patterns',
|
|
96
|
+
src: 'tests/fixtures/node_modules',
|
|
97
|
+
exclude: [],
|
|
98
|
+
result: ['block.json'],
|
|
99
|
+
},
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
describe('testing the ignoreFunc used to ignore files', () => {
|
|
103
|
+
tests.forEach((test) => {
|
|
104
|
+
it('should ignore files ' + test.title, () => {
|
|
105
|
+
const foundDirs: string[] = []
|
|
106
|
+
|
|
107
|
+
const dirs = new Glob('**', {
|
|
108
|
+
ignore: {
|
|
109
|
+
ignored: (p: Path) => ignoreFunc(p, test.exclude),
|
|
110
|
+
},
|
|
111
|
+
nodir: true,
|
|
112
|
+
cwd: path.join(process.cwd(), test.src),
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
for (const dir of dirs) {
|
|
116
|
+
foundDirs.push(dir)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (typeof test.result === 'number') {
|
|
120
|
+
expect(foundDirs.length).toBeGreaterThanOrEqual(test.result)
|
|
121
|
+
} else {
|
|
122
|
+
expect(foundDirs).toStrictEqual(test.result)
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
})
|
|
@@ -1,61 +1,51 @@
|
|
|
1
|
-
import { describe, expect } from '@jest/globals'
|
|
2
|
-
import { parseJsonFile } from '../src/extractors/json'
|
|
3
|
-
import fs from 'fs'
|
|
4
|
-
|
|
5
|
-
describe('should parse json', () => {
|
|
6
|
-
it('theme.json', async () => {
|
|
7
|
-
const expected = {
|
|
8
|
-
'block style label': {
|
|
9
|
-
label: {
|
|
10
|
-
comments: {
|
|
11
|
-
reference: 'block/block.json',
|
|
12
|
-
},
|
|
13
|
-
msgctxt: 'block style label',
|
|
14
|
-
msgid: 'label',
|
|
15
|
-
msgstr: [],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
'block description': {
|
|
19
|
-
description: {
|
|
20
|
-
comments: {
|
|
21
|
-
reference: 'block/block.json',
|
|
22
|
-
},
|
|
23
|
-
msgctxt: 'block description',
|
|
24
|
-
msgid: 'description',
|
|
25
|
-
msgstr: [],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
'block keyword': {
|
|
29
|
-
undefined: {
|
|
30
|
-
comments: {
|
|
31
|
-
reference: 'block/block.json',
|
|
32
|
-
},
|
|
33
|
-
msgctxt: 'block keyword',
|
|
34
|
-
msgid: undefined,
|
|
35
|
-
msgstr: [],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'tests/fixtures/block/block.json',
|
|
53
|
-
'utf8'
|
|
54
|
-
),
|
|
55
|
-
filename: 'block.json',
|
|
56
|
-
filepath: 'block/block.json',
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
expect(result).toEqual(expected)
|
|
60
|
-
})
|
|
61
|
-
})
|
|
1
|
+
import { describe, expect } from '@jest/globals'
|
|
2
|
+
import { parseJsonFile } from '../src/extractors/json'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
|
|
5
|
+
describe('should parse json', () => {
|
|
6
|
+
it('theme.json', async () => {
|
|
7
|
+
const expected = {
|
|
8
|
+
'block style label': {
|
|
9
|
+
label: {
|
|
10
|
+
comments: {
|
|
11
|
+
reference: 'block/block.json',
|
|
12
|
+
},
|
|
13
|
+
msgctxt: 'block style label',
|
|
14
|
+
msgid: 'label',
|
|
15
|
+
msgstr: [],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
'block description': {
|
|
19
|
+
description: {
|
|
20
|
+
comments: {
|
|
21
|
+
reference: 'block/block.json',
|
|
22
|
+
},
|
|
23
|
+
msgctxt: 'block description',
|
|
24
|
+
msgid: 'description',
|
|
25
|
+
msgstr: [],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
'block keyword': {
|
|
29
|
+
undefined: {
|
|
30
|
+
comments: {
|
|
31
|
+
reference: 'block/block.json',
|
|
32
|
+
},
|
|
33
|
+
msgctxt: 'block keyword',
|
|
34
|
+
msgid: undefined,
|
|
35
|
+
msgstr: [],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const result = await parseJsonFile({
|
|
41
|
+
fileContent: fs.readFileSync(
|
|
42
|
+
'tests/fixtures/block/block.json',
|
|
43
|
+
'utf8'
|
|
44
|
+
),
|
|
45
|
+
filename: 'block.json',
|
|
46
|
+
filepath: 'block/block.json',
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
expect(result).toEqual(expected)
|
|
50
|
+
})
|
|
51
|
+
})
|
|
@@ -1,7 +1,55 @@
|
|
|
1
1
|
import { describe, expect } from '@jest/globals'
|
|
2
2
|
import { doTree } from '../src/parser/tree'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
|
|
5
|
+
import path from 'path'
|
|
6
|
+
|
|
7
|
+
describe('doTree js', () => {
|
|
8
|
+
const filepath = 'tests/fixtures/block/javascript.js'
|
|
9
|
+
let filePath: string
|
|
10
|
+
let fileContent: string
|
|
11
|
+
beforeAll(() => {
|
|
12
|
+
filePath = path.join(process.cwd(), filepath)
|
|
13
|
+
console.log('My file path is: ' + filePath)
|
|
14
|
+
fileContent = fs.readFileSync(filePath, 'utf8')
|
|
15
|
+
})
|
|
16
|
+
test('Should parse TSX file and extract strings', () => {
|
|
17
|
+
const fileParsed = doTree(fileContent, filepath)
|
|
18
|
+
expect(fileParsed).toMatchSnapshot()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
describe('doTree php', () => {
|
|
23
|
+
const filepath = 'tests/fixtures/sourcedir/file.php'
|
|
24
|
+
let filePath: string
|
|
25
|
+
let fileContent: string
|
|
26
|
+
beforeAll(() => {
|
|
27
|
+
filePath = path.join(process.cwd(), filepath)
|
|
28
|
+
console.log('My file path is: ' + filePath)
|
|
29
|
+
fileContent = fs.readFileSync(filePath, 'utf8')
|
|
30
|
+
})
|
|
31
|
+
test('Should parse TSX file and extract strings', () => {
|
|
32
|
+
const fileParsed = doTree(fileContent, filepath)
|
|
33
|
+
expect(fileParsed).toMatchSnapshot()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('doTree tsx file', () => {
|
|
38
|
+
const filepath = 'tests/fixtures/block/SvgControls.tsx'
|
|
39
|
+
let filePath: string
|
|
40
|
+
let fileContent: string
|
|
41
|
+
beforeAll(() => {
|
|
42
|
+
filePath = path.join(process.cwd(), filepath)
|
|
43
|
+
console.log('My file path is: ' + filePath)
|
|
44
|
+
fileContent = fs.readFileSync(filePath, 'utf8')
|
|
45
|
+
})
|
|
46
|
+
test('Should parse TSX file and extract strings', () => {
|
|
47
|
+
const fileParsed = doTree(fileContent, filepath)
|
|
48
|
+
expect(fileParsed).toMatchSnapshot()
|
|
49
|
+
})
|
|
50
|
+
})
|
|
3
51
|
|
|
4
|
-
describe('
|
|
52
|
+
describe('doTree php test file', () => {
|
|
5
53
|
/** see wp cli tests */
|
|
6
54
|
it('should extract translations and comments from code content', () => {
|
|
7
55
|
const content = `<?php
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
3
|
-
|
|
4
|
-
name: Node.js CI
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ "master" ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ "master" ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ${{ matrix.os }}
|
|
16
|
-
|
|
17
|
-
strategy:
|
|
18
|
-
matrix:
|
|
19
|
-
node-version: [lts/*, latest]
|
|
20
|
-
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
21
|
-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
22
|
-
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v3
|
|
25
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
26
|
-
uses: actions/setup-node@v3
|
|
27
|
-
with:
|
|
28
|
-
node-version: ${{ matrix.node-version }}
|
|
29
|
-
cache: 'npm'
|
|
30
|
-
- run: npm install
|
|
31
|
-
- run: npm run build --if-present
|
|
32
|
-
- run: npm test
|
|
33
|
-
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Simple workflow for deploying static content to GitHub Pages
|
|
2
|
-
name: TypeDoc generation
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
release:
|
|
6
|
-
branches: [ "master" ]
|
|
7
|
-
# Allows you to run this workflow manually from the Actions tab
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
11
|
-
permissions:
|
|
12
|
-
contents: read
|
|
13
|
-
pages: write
|
|
14
|
-
id-token: write
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
# Single deploy job since we're just deploying
|
|
18
|
-
deploy:
|
|
19
|
-
name: Deploy Documentation
|
|
20
|
-
|
|
21
|
-
# Deploy to the github-pages environment
|
|
22
|
-
environment:
|
|
23
|
-
name: github-pages
|
|
24
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
25
|
-
|
|
26
|
-
# Specify runner + deployment step
|
|
27
|
-
runs-on: ubuntu-latest
|
|
28
|
-
steps:
|
|
29
|
-
- name: Checkout code
|
|
30
|
-
uses: actions/checkout@v3
|
|
31
|
-
|
|
32
|
-
- name: TypeDoc Action
|
|
33
|
-
uses: erikyo/tsdoc-action@v1
|
|
34
|
-
with:
|
|
35
|
-
source_dir: ./src/**/*
|
|
36
|
-
output_dir: ./docs
|
|
37
|
-
skipErrorChecking: true
|
|
38
|
-
darkHighlightTheme: dark-plus
|
|
39
|
-
basePath: ./src/
|
|
40
|
-
|
|
41
|
-
- name: Setup Pages
|
|
42
|
-
uses: actions/configure-pages@v3
|
|
43
|
-
|
|
44
|
-
- name: Upload artifact
|
|
45
|
-
uses: actions/upload-pages-artifact@v2
|
|
46
|
-
with:
|
|
47
|
-
# Upload entire repository
|
|
48
|
-
path: './docs'
|
|
49
|
-
|
|
50
|
-
- name: Deploy to GitHub Pages
|
|
51
|
-
id: deployment
|
|
52
|
-
uses: actions/deploy-pages@v2
|