expensify-common 1.0.1 → 2.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 +15 -6
- package/dist/API.d.ts +11 -0
- package/{lib/API.jsx → dist/API.js} +230 -165
- package/dist/APIDeferred.d.ts +7 -0
- package/{lib/APIDeferred.jsx → dist/APIDeferred.js} +35 -53
- package/dist/BrowserDetect.d.ts +19 -0
- package/dist/BrowserDetect.js +107 -0
- package/dist/CONST.d.ts +813 -0
- package/{lib/CONST.jsx → dist/CONST.js} +245 -167
- package/dist/Cookie.d.ts +68 -0
- package/{lib/Cookie.jsx → dist/Cookie.js} +23 -36
- package/dist/CredentialsWrapper.d.ts +32 -0
- package/dist/CredentialsWrapper.js +52 -0
- package/dist/Device.d.ts +8 -0
- package/dist/Device.js +15 -0
- package/dist/ExpenseRule.d.ts +39 -0
- package/{lib/ExpenseRule.jsx → dist/ExpenseRule.js} +12 -14
- package/dist/ExpensiMark.d.ts +142 -0
- package/dist/ExpensiMark.js +1026 -0
- package/dist/Func.d.ts +40 -0
- package/{lib/Func.jsx → dist/Func.js} +19 -25
- package/dist/Log.d.ts +3 -0
- package/dist/Log.js +41 -0
- package/dist/Logger.d.ts +77 -0
- package/dist/Logger.js +126 -0
- package/dist/Network.d.ts +6 -0
- package/{lib/Network.jsx → dist/Network.js} +48 -45
- package/dist/Num.d.ts +95 -0
- package/{lib/Num.jsx → dist/Num.js} +20 -40
- package/dist/PageEvent.d.ts +25 -0
- package/dist/PageEvent.js +28 -0
- package/dist/PubSub.d.ts +2 -0
- package/{lib/PubSub.jsx → dist/PubSub.js} +27 -39
- package/dist/ReportHistoryStore.d.ts +64 -0
- package/dist/ReportHistoryStore.js +261 -0
- package/dist/Templates.d.ts +2 -0
- package/{lib/Templates.jsx → dist/Templates.js} +33 -48
- package/dist/Url.d.ts +22 -0
- package/dist/Url.js +30 -0
- package/dist/components/CopyText.d.ts +45 -0
- package/{lib/components/CopyText.jsx → dist/components/CopyText.js} +16 -23
- package/dist/components/StepProgressBar.d.ts +22 -0
- package/dist/components/StepProgressBar.js +68 -0
- package/dist/components/form/element/combobox.d.ts +237 -0
- package/{lib → dist}/components/form/element/combobox.js +361 -516
- package/dist/components/form/element/dropdown.d.ts +35 -0
- package/dist/components/form/element/dropdown.js +66 -0
- package/dist/components/form/element/dropdownItem.d.ts +55 -0
- package/dist/components/form/element/dropdownItem.js +118 -0
- package/dist/components/form/element/onOffSwitch.d.ts +94 -0
- package/dist/components/form/element/onOffSwitch.js +195 -0
- package/dist/components/form/element/switch.d.ts +58 -0
- package/{lib → dist}/components/form/element/switch.js +29 -66
- package/dist/fastMerge.d.ts +9 -0
- package/dist/fastMerge.js +77 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +71 -0
- package/dist/jquery.expensifyIframify.d.ts +10 -0
- package/{lib → dist}/jquery.expensifyIframify.js +52 -93
- package/dist/mixins/PubSub.d.ts +20 -0
- package/{lib/mixins/PubSub.jsx → dist/mixins/PubSub.js} +12 -11
- package/dist/mixins/extraClasses.d.ts +8 -0
- package/{lib → dist}/mixins/extraClasses.js +8 -12
- package/dist/mixins/validationClasses.d.ts +12 -0
- package/dist/mixins/validationClasses.js +58 -0
- package/dist/str.d.ts +613 -0
- package/{lib → dist}/str.js +176 -160
- package/dist/tlds.d.ts +2 -0
- package/dist/tlds.js +4 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +13 -0
- package/package.json +47 -18
- package/.editorconfig +0 -34
- package/.eslintrc.js +0 -11
- package/.github/CODEOWNERS +0 -2
- package/.github/CONTRIBUTING.md +0 -163
- package/.github/ISSUE_TEMPLATE.md +0 -3
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/workflows/cla.yml +0 -39
- package/.github/workflows/lint.yml +0 -29
- package/.github/workflows/test.yml +0 -29
- package/CLA.md +0 -20
- package/Gruntfile.js +0 -13
- package/__tests__/ExpensiMark-test.js +0 -340
- package/__tests__/Logger-test.js +0 -55
- package/__tests__/Str-test.js +0 -53
- package/babel.config.js +0 -12
- package/grunt/configloader.js +0 -17
- package/grunt/configs/chokidar.js +0 -23
- package/grunt/configs/eslint.js +0 -15
- package/grunt/task/watch.js +0 -3
- package/grunt/taskloader.js +0 -25
- package/lib/BrowserDetect.jsx +0 -91
- package/lib/ExpensiMark.js +0 -253
- package/lib/Log.jsx +0 -36
- package/lib/Logger.jsx +0 -154
- package/lib/PageEvent.jsx +0 -23
- package/lib/ReportHistoryStore.jsx +0 -194
- package/lib/components/StepProgressBar.js +0 -49
- package/lib/components/form/element/dropdown.js +0 -90
- package/lib/components/form/element/dropdownItem.js +0 -178
- package/lib/components/form/element/onOffSwitch.jsx +0 -229
- package/lib/mixins/validationClasses.js +0 -23
- package/lib/tlds.jsx +0 -3
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
import ExpensiMark from '../lib/ExpensiMark';
|
|
3
|
-
|
|
4
|
-
const parser = new ExpensiMark();
|
|
5
|
-
|
|
6
|
-
// Words wrapped in * successfully replaced with <strong></strong>
|
|
7
|
-
test('Test bold markdown replacement', () => {
|
|
8
|
-
const boldTestStartString = 'This is a *sentence,* and it has some *punctuation, words, and spaces*. '
|
|
9
|
-
+ '*test* * testing* test*test*test.';
|
|
10
|
-
const boldTestReplacedString = 'This is a <strong>sentence,</strong> and it has some <strong>punctuation, words, and spaces</strong>. '
|
|
11
|
-
+ '<strong>test</strong> <strong> testing</strong> test*test*test.';
|
|
12
|
-
|
|
13
|
-
expect(parser.replace(boldTestStartString)).toBe(boldTestReplacedString);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// Words wrapped in * successfully replaced with <strong></strong>
|
|
17
|
-
test('Test quote markdown replacement', () => {
|
|
18
|
-
const quoteTestStartString = '>This is a *quote* that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
|
|
19
|
-
const quoteTestReplacedString = '<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>Here is a >quote that did not<br><pre>here is a codefenced quote<br>>it should not be quoted</pre>';
|
|
20
|
-
|
|
21
|
-
expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// Words wrapped in _ successfully replaced with <em></em>
|
|
25
|
-
test('Test italic markdown replacement', () => {
|
|
26
|
-
const italicTestStartString = 'This is a _sentence,_ and it has some _punctuation, words, and spaces_. _test_ _ testing_ test_test_test.';
|
|
27
|
-
const italicTestReplacedString = 'This is a <em>sentence,</em> and it has some <em>punctuation, words, and spaces</em>. <em>test</em> <em> testing</em> test_test_test.';
|
|
28
|
-
expect(parser.replace(italicTestStartString)).toBe(italicTestReplacedString);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Words wrapped in ~ successfully replaced with <del></del>
|
|
32
|
-
test('Test strikethrough markdown replacement', () => {
|
|
33
|
-
const strikethroughTestStartString = 'This is a ~sentence,~ and it has some ~punctuation, words, and spaces~. ~test~ ~ testing~ test~test~test.';
|
|
34
|
-
const strikethroughTestReplacedString = 'This is a <del>sentence,</del> and it has some <del>punctuation, words, and spaces</del>. <del>test</del> <del> testing</del> test~test~test.';
|
|
35
|
-
expect(parser.replace(strikethroughTestStartString)).toBe(strikethroughTestReplacedString);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Markdown style links replaced successfully
|
|
39
|
-
test('Test markdown style links', () => {
|
|
40
|
-
const testString = 'Go to [Expensify](https://www.expensify.com) to learn more. [Expensify](www.expensify.com) [Expensify](expensify.com) [It\'s really the coolest](expensify.com) [`Some` Special cases - + . = , \'](expensify.com/some?query=par|am)';
|
|
41
|
-
const resultString = 'Go to <a href="https://www.expensify.com" target="_blank">Expensify</a> to learn more. <a href="http://www.expensify.com" target="_blank">Expensify</a> <a href="http://expensify.com" target="_blank">Expensify</a> <a href="http://expensify.com" target="_blank">It's really the coolest</a> <a href="http://expensify.com/some?query=par|am" target="_blank"><code>Some</code> Special cases - + . = , '</a>';
|
|
42
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Critical Markdown style links replaced successfully
|
|
46
|
-
test('Test critical markdown style links', () => {
|
|
47
|
-
const testString = 'Testing '
|
|
48
|
-
+ '[first](https://www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878) '
|
|
49
|
-
+ '[first no https://](www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878) '
|
|
50
|
-
+ '[second](http://necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled) '
|
|
51
|
-
+ '[second no http://](necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled) '
|
|
52
|
-
+ '[third](https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash) '
|
|
53
|
-
+ '[third no https://](github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash) '
|
|
54
|
-
+ '[link `[inside another link](https://google.com)`](https://google.com) '
|
|
55
|
-
+ '[link with an @ in it](https://google.com) '
|
|
56
|
-
+ '[link with [brackets] inside of it](https://google.com) '
|
|
57
|
-
+ '[link with smart quotes ‘’“”](https://google.com) '
|
|
58
|
-
+ '[link with someone@expensify.com email in it](https://google.com)';
|
|
59
|
-
const resultString = 'Testing '
|
|
60
|
-
+ '<a href="https://www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878" target="_blank">first</a> '
|
|
61
|
-
+ '<a href="http://www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878" target="_blank">first no https://</a> '
|
|
62
|
-
+ '<a href="http://necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled" target="_blank">second</a> '
|
|
63
|
-
+ '<a href="http://necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled" target="_blank">second no http://</a> '
|
|
64
|
-
+ '<a href="https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash" target="_blank">third</a> '
|
|
65
|
-
+ '<a href="http://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash" target="_blank">third no https://</a> '
|
|
66
|
-
+ '<a href="https://google.com" target="_blank">link <code>[inside another link](https://google.com)</code></a> '
|
|
67
|
-
+ '<a href="https://google.com" target="_blank">link with an @ in it</a> '
|
|
68
|
-
+ '<a href="https://google.com" target="_blank">link with [brackets] inside of it</a> '
|
|
69
|
-
+ '<a href="https://google.com" target="_blank">link with smart quotes ‘’“”</a> '
|
|
70
|
-
+ '<a href="https://google.com" target="_blank">link with someone@expensify.com email in it</a>';
|
|
71
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// HTML encoded strings unaffected by parser
|
|
75
|
-
test('Test HTML encoded strings', () => {
|
|
76
|
-
const rawHTMLTestStartString = '<em>This is</em> a <strong>test</strong>. None of <h1>these strings</h1> should display <del>as</del> <div>HTML</div>.';
|
|
77
|
-
const rawHTMLTestReplacedString = '<em>This is</em> a <strong>test</strong>. None of <h1>these strings</h1> should display <del>as</del> <div>HTML</div>.';
|
|
78
|
-
expect(parser.replace(rawHTMLTestStartString)).toBe(rawHTMLTestReplacedString);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// New lines characters \\n were successfully replaced with <br>
|
|
82
|
-
test('Test newline markdown replacement', () => {
|
|
83
|
-
const newLineTestStartString = 'This sentence has a newline \n Yep just had one \n Oh there it is another one';
|
|
84
|
-
const newLineReplacedString = 'This sentence has a newline <br> Yep just had one <br> Oh there it is another one';
|
|
85
|
-
expect(parser.replace(newLineTestStartString)).toBe(newLineReplacedString);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// Period replacement test
|
|
89
|
-
test('Test period replacements', () => {
|
|
90
|
-
const periodTestStartString = 'This test ensures that words with trailing... periods.. are. not converted to links.';
|
|
91
|
-
expect(parser.replace(periodTestStartString)).toBe(periodTestStartString);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
test('Test code fencing', () => {
|
|
95
|
-
let codeFenceExampleMarkdown = '```\nconst javaScript = \'javaScript\'\n```';
|
|
96
|
-
expect(parser.replace(codeFenceExampleMarkdown)).toBe('<pre>const javaScript = 'javaScript'</pre>');
|
|
97
|
-
|
|
98
|
-
codeFenceExampleMarkdown = '```const javaScript = \'javaScript\'\n```';
|
|
99
|
-
expect(parser.replace(codeFenceExampleMarkdown)).toBe('<pre>const javaScript = 'javaScript'</pre>');
|
|
100
|
-
|
|
101
|
-
codeFenceExampleMarkdown = '```\nconst javaScript = \'javaScript\'```';
|
|
102
|
-
expect(parser.replace(codeFenceExampleMarkdown)).toBe('<pre>const javaScript = 'javaScript'</pre>');
|
|
103
|
-
|
|
104
|
-
codeFenceExampleMarkdown = '```const javaScript = \'javaScript\'```';
|
|
105
|
-
expect(parser.replace(codeFenceExampleMarkdown)).toBe('<pre>const javaScript = 'javaScript'</pre>');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('Test code fencing with spaces and new lines', () => {
|
|
109
|
-
let codeFenceExample = '```\nconst javaScript = \'javaScript\'\n const php = \'php\'\n```';
|
|
110
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>const javaScript = 'javaScript'<br>    const php = 'php'</pre>');
|
|
111
|
-
|
|
112
|
-
codeFenceExample = '```const javaScript = \'javaScript\'\n const php = \'php\'\n```';
|
|
113
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>const javaScript = 'javaScript'<br>    const php = 'php'</pre>');
|
|
114
|
-
|
|
115
|
-
codeFenceExample = '```\nconst javaScript = \'javaScript\'\n const php = \'php\'```';
|
|
116
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>const javaScript = 'javaScript'<br>    const php = 'php'</pre>');
|
|
117
|
-
|
|
118
|
-
codeFenceExample = '```const javaScript = \'javaScript\'\n const php = \'php\'```';
|
|
119
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>const javaScript = 'javaScript'<br>    const php = 'php'</pre>');
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
test('Test inline code blocks', () => {
|
|
123
|
-
const inlineCodeStartString = 'My favorite language is `JavaScript`. How about you?';
|
|
124
|
-
expect(parser.replace(inlineCodeStartString)).toBe('My favorite language is <code>JavaScript</code>. How about you?');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
test('Test inline code blocks with ExpensiMark syntax inside', () => {
|
|
128
|
-
const inlineCodeStartString = '`This is how you can write ~strikethrough~, *bold*, and _italics_`';
|
|
129
|
-
expect(parser.replace(inlineCodeStartString)).toBe('<code>This is how you can write ~strikethrough~, *bold*, and _italics_</code>');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test('Test inline code blocks inside ExpensiMark', () => {
|
|
133
|
-
const testString = '_`test`_'
|
|
134
|
-
+ '*`test`*'
|
|
135
|
-
+ '~`test`~';
|
|
136
|
-
const resultString = '<em><code>test</code></em>'
|
|
137
|
-
+ '<strong><code>test</code></strong>'
|
|
138
|
-
+ '<del><code>test</code></del>';
|
|
139
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test('Test code fencing with ExpensiMark syntax inside', () => {
|
|
143
|
-
let codeFenceExample = '```\nThis is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)\n```';
|
|
144
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>This is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)</pre>');
|
|
145
|
-
|
|
146
|
-
codeFenceExample = '```This is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)\n```';
|
|
147
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>This is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)</pre>');
|
|
148
|
-
|
|
149
|
-
codeFenceExample = '```\nThis is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)```';
|
|
150
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>This is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)</pre>');
|
|
151
|
-
|
|
152
|
-
codeFenceExample = '```This is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)```';
|
|
153
|
-
expect(parser.replace(codeFenceExample)).toBe('<pre>This is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)</pre>');
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
test('Test combination replacements', () => {
|
|
157
|
-
const urlTestStartString = '<em>Here</em> is a _combination test_ that <marquee>sees</marquee> if ~https://www.example.com~ https://otherexample.com links get rendered first followed by *other markup* or if _*two work together*_ as well. This sentence also has a newline \n Yep just had one.';
|
|
158
|
-
const urlTestReplacedString = '<em>Here</em> is a <em>combination test</em> that <marquee>sees</marquee> if <del><a href="https://www.example.com" target="_blank">https://www.example.com</a></del> <a href="https://otherexample.com"'
|
|
159
|
-
+ ' target="_blank">https://otherexample.com</a> links get rendered first followed by <strong>other markup</strong> or if <em><strong>two work together</strong></em> as well. This sentence also has a newline <br> Yep just had one.';
|
|
160
|
-
expect(parser.replace(urlTestStartString)).toBe(urlTestReplacedString);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
test('Test wrapped URLs', () => {
|
|
164
|
-
const wrappedUrlTestStartString = '~https://www.example.com~ _http://www.test.com_ *http://www.asdf.com/_test*';
|
|
165
|
-
const wrappedUrlTestReplacedString = '<del><a href="https://www.example.com" target="_blank">https://www.example.com</a></del> <em><a href="http://www.test.com" target="_blank">http://www.test.com</a></em>'
|
|
166
|
-
+ ' <strong><a href="http://www.asdf.com/_test" target="_blank">http://www.asdf.com/_test</a></strong>';
|
|
167
|
-
expect(parser.replace(wrappedUrlTestStartString)).toBe(wrappedUrlTestReplacedString);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
test('Test url replacements', () => {
|
|
171
|
-
const urlTestStartString = 'Testing '
|
|
172
|
-
+ 'foo.com '
|
|
173
|
-
+ 'www.foo.com '
|
|
174
|
-
+ 'http://www.foo.com '
|
|
175
|
-
+ 'http://foo.com/blah_blah '
|
|
176
|
-
+ 'http://foo.com/blah_blah/ '
|
|
177
|
-
+ 'http://foo.com/blah_blah_(wikipedia) '
|
|
178
|
-
+ 'http://www.example.com/wpstyle/?p=364 '
|
|
179
|
-
+ 'https://www.example.com/foo/?bar=baz&inga=42&quux '
|
|
180
|
-
+ 'http://foo.com/(something)?after=parens '
|
|
181
|
-
+ 'http://code.google.com/events/#&product=browser '
|
|
182
|
-
+ 'http://foo.bar/?q=Test%20URL-encoded%20stuff '
|
|
183
|
-
+ 'http://www.test.com/path?param=123#123 '
|
|
184
|
-
+ 'http://1337.net '
|
|
185
|
-
+ 'http://a.b-c.de/ '
|
|
186
|
-
+ 'https://sd1.sd2.docs.google.com/ '
|
|
187
|
-
+ 'https://expensify.cash/#/r/1234 '
|
|
188
|
-
+ 'https://github.com/Expensify/ReactNativeChat/pull/6.45 '
|
|
189
|
-
+ 'https://github.com/Expensify/Expensify/issues/143,231 '
|
|
190
|
-
+ 'testRareTLDs.beer '
|
|
191
|
-
+ 'test@expensify.com '
|
|
192
|
-
+ 'test.completelyFakeTLD '
|
|
193
|
-
+ 'https://www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878) '
|
|
194
|
-
+ 'http://necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled '
|
|
195
|
-
+ 'https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash '
|
|
196
|
-
+ 'https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash '
|
|
197
|
-
+ 'mm..food '
|
|
198
|
-
+ 'upwork.com/jobs/~016781e062ce860b84 '
|
|
199
|
-
+ 'https://bastion1.sjc/logs/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:\'2125cbe0-28a9-11e9-a79c-3de0157ed580\',interval:auto,query:(language:lucene,query:\'\'),sort:!(timestamp,desc))';
|
|
200
|
-
|
|
201
|
-
const urlTestReplacedString = 'Testing '
|
|
202
|
-
+ '<a href="http://foo.com" target="_blank">foo.com</a> '
|
|
203
|
-
+ '<a href="http://www.foo.com" target="_blank">www.foo.com</a> '
|
|
204
|
-
+ '<a href="http://www.foo.com" target="_blank">http://www.foo.com</a> '
|
|
205
|
-
+ '<a href="http://foo.com/blah_blah" target="_blank">http://foo.com/blah_blah</a> '
|
|
206
|
-
+ '<a href="http://foo.com/blah_blah/" target="_blank">http://foo.com/blah_blah/</a> '
|
|
207
|
-
+ '<a href="http://foo.com/blah_blah_(wikipedia)" target="_blank">http://foo.com/blah_blah_(wikipedia)</a> '
|
|
208
|
-
+ '<a href="http://www.example.com/wpstyle/?p=364" target="_blank">http://www.example.com/wpstyle/?p=364</a> '
|
|
209
|
-
+ '<a href="https://www.example.com/foo/?bar=baz&inga=42&quux" target="_blank">https://www.example.com/foo/?bar=baz&inga=42&quux</a> '
|
|
210
|
-
+ '<a href="http://foo.com/(something)?after=parens" target="_blank">http://foo.com/(something)?after=parens</a> '
|
|
211
|
-
+ '<a href="http://code.google.com/events/#&product=browser" target="_blank">http://code.google.com/events/#&product=browser</a> '
|
|
212
|
-
+ '<a href="http://foo.bar/?q=Test%20URL-encoded%20stuff" target="_blank">http://foo.bar/?q=Test%20URL-encoded%20stuff</a> '
|
|
213
|
-
+ '<a href="http://www.test.com/path?param=123#123" target="_blank">http://www.test.com/path?param=123#123</a> '
|
|
214
|
-
+ '<a href="http://1337.net" target="_blank">http://1337.net</a> '
|
|
215
|
-
+ '<a href="http://a.b-c.de/" target="_blank">http://a.b-c.de/</a> '
|
|
216
|
-
+ '<a href="https://sd1.sd2.docs.google.com/" target="_blank">https://sd1.sd2.docs.google.com/</a> '
|
|
217
|
-
+ '<a href="https://expensify.cash/#/r/1234" target="_blank">https://expensify.cash/#/r/1234</a> '
|
|
218
|
-
+ '<a href="https://github.com/Expensify/ReactNativeChat/pull/6.45" target="_blank">https://github.com/Expensify/ReactNativeChat/pull/6.45</a> '
|
|
219
|
-
+ '<a href="https://github.com/Expensify/Expensify/issues/143,231" target="_blank">https://github.com/Expensify/Expensify/issues/143,231</a> '
|
|
220
|
-
+ '<a href="http://testRareTLDs.beer" target="_blank">testRareTLDs.beer</a> '
|
|
221
|
-
+ '<a href="mailto:test@expensify.com">test@expensify.com</a> '
|
|
222
|
-
+ 'test.completelyFakeTLD '
|
|
223
|
-
+ '<a href="https://www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878" target="_blank">https://www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878</a>) '
|
|
224
|
-
+ '<a href="http://necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled" target="_blank">http://necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled</a> '
|
|
225
|
-
+ '<a href="https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash" target="_blank">https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash</a> '
|
|
226
|
-
+ '<a href="https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash" target="_blank">https://github.com/Expensify/Expensify.cash/issues/123#:~:text=Please%20work/Expensify.cash</a> '
|
|
227
|
-
+ 'mm..food '
|
|
228
|
-
+ '<a href="http://upwork.com/jobs/~016781e062ce860b84" target="_blank">upwork.com/jobs/~016781e062ce860b84</a> '
|
|
229
|
-
+ '<a href="https://bastion1.sjc/logs/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:'2125cbe0-28a9-11e9-a79c-3de0157ed580',interval:auto,query:(language:lucene,query:''),sort:!(timestamp,desc))" target="_blank">https://bastion1.sjc/logs/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:'2125cbe0-28a9-11e9-a79c-3de0157ed580',interval:auto,query:(language:lucene,query:''),sort:!(timestamp,desc))</a>';
|
|
230
|
-
|
|
231
|
-
expect(parser.replace(urlTestStartString)).toBe(urlTestReplacedString);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
test('Test markdown style link with various styles', () => {
|
|
235
|
-
const testString = 'Go to ~[Expensify](https://www.expensify.com)~ '
|
|
236
|
-
+ '_[Expensify](https://www.expensify.com)_ '
|
|
237
|
-
+ '*[Expensify](https://www.expensify.com)* '
|
|
238
|
-
+ '[Expensify!](https://www.expensify.com) '
|
|
239
|
-
+ '[Expensify?](https://www.expensify.com) '
|
|
240
|
-
+ '[Expensify](https://www.expensify-test.com) '
|
|
241
|
-
+ '[Expensify](https://www.expensify.com/settings?param={%22section%22:%22account%22}) '
|
|
242
|
-
+ '[Expensify](https://www.expensify.com/settings?param=(%22section%22+%22account%22)) '
|
|
243
|
-
+ '[Expensify](https://www.expensify.com/settings?param=[%22section%22:%22account%22])';
|
|
244
|
-
|
|
245
|
-
const resultString = 'Go to <del><a href="https://www.expensify.com" target="_blank">Expensify</a></del> '
|
|
246
|
-
+ '<em><a href="https://www.expensify.com" target="_blank">Expensify</a></em> '
|
|
247
|
-
+ '<strong><a href="https://www.expensify.com" target="_blank">Expensify</a></strong> '
|
|
248
|
-
+ '<a href="https://www.expensify.com" target="_blank">Expensify!</a> '
|
|
249
|
-
+ '<a href="https://www.expensify.com" target="_blank">Expensify?</a> '
|
|
250
|
-
+ '<a href="https://www.expensify-test.com" target="_blank">Expensify</a> '
|
|
251
|
-
+ '<a href="https://www.expensify.com/settings?param={%22section%22:%22account%22}" target="_blank">Expensify</a> '
|
|
252
|
-
+ '<a href="https://www.expensify.com/settings?param=(%22section%22+%22account%22)" target="_blank">Expensify</a> '
|
|
253
|
-
+ '<a href="https://www.expensify.com/settings?param=[%22section%22:%22account%22]" target="_blank">Expensify</a>';
|
|
254
|
-
|
|
255
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
test('Test links that end in a comma autolink correctly', () => {
|
|
259
|
-
const testString = 'https://github.com/Expensify/Expensify/issues/143231,';
|
|
260
|
-
const resultString = '<a href="https://github.com/Expensify/Expensify/issues/143231" target="_blank">https://github.com/Expensify/Expensify/issues/143231</a>,';
|
|
261
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
test('Test links inside two backticks are not autolinked', () => {
|
|
265
|
-
const testString = '`https://github.com/Expensify/Expensify/issues/143231`';
|
|
266
|
-
const resultString = '<code>https://github.com/Expensify/Expensify/issues/143231</code>';
|
|
267
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
test('Test a period at the end of a link autolinks correctly', () => {
|
|
271
|
-
const testString = 'https://github.com/Expensify/ReactNativeChat/pull/645.';
|
|
272
|
-
const resultString = '<a href="https://github.com/Expensify/ReactNativeChat/pull/645" target="_blank">https://github.com/Expensify/ReactNativeChat/pull/645</a>.';
|
|
273
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
test('Test a url ending with a question mark autolinks correctly', () => {
|
|
277
|
-
const testString = 'https://github.com/Expensify/ReactNativeChat/pull/645?';
|
|
278
|
-
const resultString = '<a href="https://github.com/Expensify/ReactNativeChat/pull/645" target="_blank">https://github.com/Expensify/ReactNativeChat/pull/645</a>?';
|
|
279
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
test('Test a url ending with a closing parentheses autolinks correctly', () => {
|
|
283
|
-
const testString = 'https://github.com/Expensify/ReactNativeChat/pull/645)';
|
|
284
|
-
const resultString = '<a href="https://github.com/Expensify/ReactNativeChat/pull/645" target="_blank">https://github.com/Expensify/ReactNativeChat/pull/645</a>)';
|
|
285
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
test('Test markdown style email link with various styles', () => {
|
|
289
|
-
const testString = 'Go to ~[Expensify](concierge@expensify.com)~ '
|
|
290
|
-
+ '_[Expensify](concierge@expensify.com)_ '
|
|
291
|
-
+ '*[Expensify](concierge@expensify.com)* '
|
|
292
|
-
+ '[Expensify!](no-concierge1@expensify.com) '
|
|
293
|
-
+ '[Expensify?](concierge?@expensify.com) ';
|
|
294
|
-
|
|
295
|
-
const resultString = 'Go to <del><a href="mailto:concierge@expensify.com">Expensify</a></del> '
|
|
296
|
-
+ '<em><a href="mailto:concierge@expensify.com">Expensify</a></em> '
|
|
297
|
-
+ '<strong><a href="mailto:concierge@expensify.com">Expensify</a></strong> '
|
|
298
|
-
+ '<a href="mailto:no-concierge1@expensify.com">Expensify!</a> '
|
|
299
|
-
+ '<a href="mailto:concierge?@expensify.com">Expensify?</a> ';
|
|
300
|
-
|
|
301
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
test('Test general email link with various styles', () => {
|
|
305
|
-
const testString = 'Go to concierge@expensify.com '
|
|
306
|
-
+ 'no-concierge@expensify.com '
|
|
307
|
-
+ 'concierge!@expensify.com '
|
|
308
|
-
+ 'concierge1?@expensify.com ';
|
|
309
|
-
|
|
310
|
-
const resultString = 'Go to <a href="mailto:concierge@expensify.com">concierge@expensify.com</a> '
|
|
311
|
-
+ '<a href="mailto:no-concierge@expensify.com">no-concierge@expensify.com</a> '
|
|
312
|
-
+ '<a href="mailto:concierge!@expensify.com">concierge!@expensify.com</a> '
|
|
313
|
-
+ '<a href="mailto:concierge1?@expensify.com">concierge1?@expensify.com</a> ';
|
|
314
|
-
|
|
315
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
test('Test markdown and url links with inconsistent starting and closing parens', () => {
|
|
319
|
-
const testString = '[google](http://google.com/(something)?after=parens) '
|
|
320
|
-
+ '([google](http://google.com/(something)?after=parens)) '
|
|
321
|
-
+ '([google](https://google.com/)) '
|
|
322
|
-
+ '([google](http://google.com/(something)?after=parens)))) '
|
|
323
|
-
+ '((([google](http://google.com/(something)?after=parens) '
|
|
324
|
-
+ '(http://foo.com/(something)?after=parens) '
|
|
325
|
-
+ '(((http://foo.com/(something)?after=parens '
|
|
326
|
-
+ '(((http://foo.com/(something)?after=parens))) '
|
|
327
|
-
+ 'http://foo.com/(something)?after=parens))) ';
|
|
328
|
-
|
|
329
|
-
const resultString = '<a href="http://google.com/(something)?after=parens" target="_blank">google</a> '
|
|
330
|
-
+ '(<a href="http://google.com/(something)?after=parens" target="_blank">google</a>) '
|
|
331
|
-
+ '(<a href="https://google.com/" target="_blank">google</a>) '
|
|
332
|
-
+ '(<a href="http://google.com/(something)?after=parens" target="_blank">google</a>))) '
|
|
333
|
-
+ '(((<a href="http://google.com/(something)?after=parens" target="_blank">google</a> '
|
|
334
|
-
+ '(<a href="http://foo.com/(something)?after=parens" target="_blank">http://foo.com/(something)?after=parens</a>) '
|
|
335
|
-
+ '(((<a href="http://foo.com/(something)?after=parens" target="_blank">http://foo.com/(something)?after=parens</a> '
|
|
336
|
-
+ '(((<a href="http://foo.com/(something)?after=parens" target="_blank">http://foo.com/(something)?after=parens</a>))) '
|
|
337
|
-
+ '<a href="http://foo.com/(something)?after=parens" target="_blank">http://foo.com/(something)?after=parens</a>))) ';
|
|
338
|
-
|
|
339
|
-
expect(parser.replace(testString)).toBe(resultString);
|
|
340
|
-
});
|
package/__tests__/Logger-test.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import Logger from '../lib/Logger';
|
|
2
|
-
|
|
3
|
-
const mockServerLoggingCallback = jest.fn();
|
|
4
|
-
const mockClientLoggingCallback = jest.fn();
|
|
5
|
-
|
|
6
|
-
const Log = new Logger({
|
|
7
|
-
serverLoggingCallback: mockServerLoggingCallback,
|
|
8
|
-
clientLoggingCallback: mockClientLoggingCallback,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('Test Log.info()', () => {
|
|
12
|
-
Log.info('Test', true);
|
|
13
|
-
expect(mockServerLoggingCallback).toHaveBeenCalled();
|
|
14
|
-
expect(mockServerLoggingCallback).toHaveBeenCalledWith({
|
|
15
|
-
parameters: {},
|
|
16
|
-
api_setCookie: false,
|
|
17
|
-
message: '[info] Test',
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('Test Log.alert()', () => {
|
|
22
|
-
Log.alert('Test', 0, {}, false);
|
|
23
|
-
expect(mockServerLoggingCallback).toHaveBeenCalled();
|
|
24
|
-
expect(mockServerLoggingCallback).toHaveBeenCalledWith({
|
|
25
|
-
parameters: {},
|
|
26
|
-
api_setCookie: false,
|
|
27
|
-
message: '[alrt] Test',
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('Test Log.warn()', () => {
|
|
32
|
-
Log.warn('Test', 0);
|
|
33
|
-
expect(mockServerLoggingCallback).toHaveBeenCalled();
|
|
34
|
-
expect(mockServerLoggingCallback).toHaveBeenCalledWith({
|
|
35
|
-
parameters: {},
|
|
36
|
-
api_setCookie: false,
|
|
37
|
-
message: '[warn] Test',
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('Test Log.hmmm()', () => {
|
|
42
|
-
Log.hmmm('Test', 0);
|
|
43
|
-
expect(mockServerLoggingCallback).toHaveBeenCalled();
|
|
44
|
-
expect(mockServerLoggingCallback).toHaveBeenCalledWith({
|
|
45
|
-
parameters: {},
|
|
46
|
-
api_setCookie: false,
|
|
47
|
-
message: '[hmmm] Test',
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('Test Log.client()', () => {
|
|
52
|
-
Log.client('Test');
|
|
53
|
-
expect(mockClientLoggingCallback).toHaveBeenCalled();
|
|
54
|
-
expect(mockClientLoggingCallback).toHaveBeenCalledWith('Test');
|
|
55
|
-
});
|
package/__tests__/Str-test.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import Str from '../lib/str';
|
|
2
|
-
|
|
3
|
-
const buildTestURLForType = (type) => `https://chat.expensify.com/chat-attachments/5/w_eadf5d35cfce6a98e2dd3607cf8463b1e46219e4.${type}?authToken=12345`;
|
|
4
|
-
|
|
5
|
-
describe('Str.isImage', () => {
|
|
6
|
-
it('Correctly identifies all valid image types', () => {
|
|
7
|
-
expect(Str.isImage(buildTestURLForType('gif'))).toBeTruthy();
|
|
8
|
-
expect(Str.isImage(buildTestURLForType('jpeg'))).toBeTruthy();
|
|
9
|
-
expect(Str.isImage(buildTestURLForType('jpg'))).toBeTruthy();
|
|
10
|
-
expect(Str.isImage(buildTestURLForType('bmp'))).toBeTruthy();
|
|
11
|
-
expect(Str.isImage(buildTestURLForType('png'))).toBeTruthy();
|
|
12
|
-
expect(Str.isImage(buildTestURLForType('GIF'))).toBeTruthy();
|
|
13
|
-
expect(Str.isImage(buildTestURLForType('JPEG'))).toBeTruthy();
|
|
14
|
-
expect(Str.isImage(buildTestURLForType('JPG'))).toBeTruthy();
|
|
15
|
-
expect(Str.isImage(buildTestURLForType('BMP'))).toBeTruthy();
|
|
16
|
-
expect(Str.isImage(buildTestURLForType('PNG'))).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('Does not confirm these types', () => {
|
|
20
|
-
// Note: These are types that React Native does not support as images so attempt to prevent their addition here
|
|
21
|
-
expect(Str.isImage(buildTestURLForType('tiff'))).toBeFalsy();
|
|
22
|
-
expect(Str.isImage(buildTestURLForType('webp'))).toBeFalsy();
|
|
23
|
-
expect(Str.isImage(buildTestURLForType('psd'))).toBeFalsy();
|
|
24
|
-
expect(Str.isImage(buildTestURLForType('pdf'))).toBeFalsy();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('Str.isPDF', () => {
|
|
29
|
-
it('Correctly identifies PDF', () => {
|
|
30
|
-
expect(Str.isPDF(buildTestURLForType('pdf'))).toBeTruthy();
|
|
31
|
-
expect(Str.isPDF(buildTestURLForType('PDF'))).toBeTruthy();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe('Str.isValidURL', () => {
|
|
36
|
-
it('Correctly identifies valid urls', () => {
|
|
37
|
-
expect(Str.isValidURL('http://expensify.com')).toBeTruthy();
|
|
38
|
-
expect(Str.isValidURL('https://www.expensify.com/')).toBeTruthy();
|
|
39
|
-
expect(Str.isValidURL('expensify.com ')).toBeFalsy();
|
|
40
|
-
expect(Str.isValidURL(' expensify.com')).toBeFalsy();
|
|
41
|
-
expect(Str.isValidURL('expensify .com')).toBeFalsy();
|
|
42
|
-
expect(Str.isValidURL('test')).toBeFalsy();
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('Str.stripHTML', () => {
|
|
47
|
-
it('Correctly strips HTML/XML tags', () => {
|
|
48
|
-
expect(Str.stripHTML('<strong>hello</strong>')).toBe('hello');
|
|
49
|
-
expect(Str.stripHTML('<img onerror=\'alert("could run arbitrary JS here")\' src=bogus>')).toBe('');
|
|
50
|
-
expect(Str.stripHTML('hello')).toBe('hello');
|
|
51
|
-
expect(Str.stripHTML(0)).toBe('');
|
|
52
|
-
});
|
|
53
|
-
});
|
package/babel.config.js
DELETED
package/grunt/configloader.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const chokidarConfig = require('./configs/chokidar');
|
|
2
|
-
const eslintConfig = require('./configs/eslint');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This will load all of the configs in the `./configs` folder and add
|
|
6
|
-
* them to grunt
|
|
7
|
-
*
|
|
8
|
-
* @param {Grunt} grunt
|
|
9
|
-
* @return {Grunt}
|
|
10
|
-
*/
|
|
11
|
-
module.exports = (grunt) => {
|
|
12
|
-
grunt.initConfig({
|
|
13
|
-
eslint: eslintConfig,
|
|
14
|
-
chokidar: chokidarConfig(grunt)
|
|
15
|
-
});
|
|
16
|
-
return grunt;
|
|
17
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Grunt config object
|
|
3
|
-
* Paths are relative to the Gruntfile.js (in the root)
|
|
4
|
-
*/
|
|
5
|
-
module.exports = function (grunt) {
|
|
6
|
-
// On watch events, we want to configure the tasks to only process
|
|
7
|
-
// the files that have changed
|
|
8
|
-
grunt.event.on('chokidar', function (action, filepath, target) {
|
|
9
|
-
grunt.config('eslint.js.src', filepath);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
files: ['**/*.js', '**/*.jsx'],
|
|
14
|
-
tasks: ['eslint'],
|
|
15
|
-
options: {
|
|
16
|
-
spawn: false,
|
|
17
|
-
|
|
18
|
-
// This checks to see if we are inside the vm, if we are we use polling because fsevents
|
|
19
|
-
// are not forwarded over an NFS connection.
|
|
20
|
-
usePolling: process.cwd().indexOf('/vagrant') !== -1
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
};
|
package/grunt/configs/eslint.js
DELETED
package/grunt/task/watch.js
DELETED
package/grunt/taskloader.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const glob = require('glob');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Load all of our files from the task folder and have them register with grunt
|
|
5
|
-
* @param {Grunt} grunt
|
|
6
|
-
*/
|
|
7
|
-
module.exports = function (grunt) {
|
|
8
|
-
// This path is relative from Gruntfile.js
|
|
9
|
-
const files = glob.sync('./grunt/task/*');
|
|
10
|
-
|
|
11
|
-
if (!files || !files.length) {
|
|
12
|
-
grunt.fail.warn('no tasks found');
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
for (let i = 0; i < files.length; i++) {
|
|
17
|
-
grunt.verbose.writeln(`Loading task file: ${files[i]}`);
|
|
18
|
-
|
|
19
|
-
// Disable this lint rule so that we can have our debug output before requiring the file.
|
|
20
|
-
// This path is relative to this file, so we have to remove the grunt part
|
|
21
|
-
const task = require(files[i].replace('/grunt', ''));
|
|
22
|
-
|
|
23
|
-
task(grunt);
|
|
24
|
-
}
|
|
25
|
-
};
|