wikiploy 2.2.0 → 2.2.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/.vscode/extensions.json +3 -1
- package/DEV.md +8 -0
- package/assets/test.css +1 -1
- package/assets/test.js +1 -1
- package/check/UpdateChecker.php +41 -0
- package/check/runner.php +2 -0
- package/check_up.php +18 -9
- package/composer.json +20 -0
- package/composer.lock +1707 -0
- package/package.json +1 -1
- package/phpunit.xml +10 -0
- package/src/WikiployLite.js +1 -2
- package/test/UpdateCheckerTest.php +70 -0
package/package.json
CHANGED
package/phpunit.xml
ADDED
package/src/WikiployLite.js
CHANGED
|
@@ -6,8 +6,7 @@ import DeployConfig from './DeployConfig.js';
|
|
|
6
6
|
|
|
7
7
|
import { promises as fs } from "fs"; // node v11+
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
const version = await verlib.readVersion('./package.json');
|
|
9
|
+
const version = /*version:main:*/'2.2.2'/*:main:version*/;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* MediaWiki deployment automation.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
namespace Wikiploy\Tests;
|
|
3
|
+
|
|
4
|
+
use PHPUnit\Framework\TestCase;
|
|
5
|
+
use Wikiploy\UpdateChecker;
|
|
6
|
+
|
|
7
|
+
class UpdateCheckerTest extends TestCase {
|
|
8
|
+
|
|
9
|
+
/** Basic check of empty string replace. */
|
|
10
|
+
public function testUpdateEmptyVersion() {
|
|
11
|
+
$input = "const version = /*version:main:*/''/*:main:version*/;";
|
|
12
|
+
$expected = "const version = /*version:main:*/'3.0.0'/*:main:version*/;";
|
|
13
|
+
$result = UpdateChecker::updateScriptContent($input, 'main', '3.0.0');
|
|
14
|
+
$this->assertSame($expected, $result);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Preserving other lines of code. */
|
|
18
|
+
public function testUpdateEmptyVersionWithExtraCode() {
|
|
19
|
+
$input = "const version = /*version:main:*/''/*:main:version*/;\nconst def='version:'+version;";
|
|
20
|
+
$expected = "const version = /*version:main:*/'3.0.0'/*:main:version*/;\nconst def='version:'+version;";
|
|
21
|
+
$result = UpdateChecker::updateScriptContent($input, 'main', '3.0.0');
|
|
22
|
+
$this->assertSame($expected, $result);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Replace existing version in single quotes. */
|
|
26
|
+
public function testUpdateExistingSingleQuotedVersion() {
|
|
27
|
+
$input = "const version = /*version:main:*/'1.2.3'/*:main:version*/;";
|
|
28
|
+
$expected = "const version = /*version:main:*/'3.0.0'/*:main:version*/;";
|
|
29
|
+
$result = UpdateChecker::updateScriptContent($input, 'main', '3.0.0');
|
|
30
|
+
$this->assertSame($expected, $result);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Replace existing version in double quotes. */
|
|
34
|
+
public function testUpdateExistingDoubleQuotedVersion() {
|
|
35
|
+
$input = "const version = /*version:main:*/\"2.3\"/*:main:version*/;";
|
|
36
|
+
$expected = "const version = /*version:main:*/\"3.0.0\"/*:main:version*/;";
|
|
37
|
+
$result = UpdateChecker::updateScriptContent($input, 'main', '3.0.0');
|
|
38
|
+
$this->assertSame($expected, $result);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Different marker, many. */
|
|
42
|
+
public function testReplaceByMarkers() {
|
|
43
|
+
$input = "";
|
|
44
|
+
$input .= "const version = /*version:main:*/' '/*:main:version*/;";
|
|
45
|
+
$input .= "const version = /*version:kopytko:*/' '/*:kopytko:version*/;";
|
|
46
|
+
$input .= "const version = /*version:main:*/' '/*:main:version*/;";
|
|
47
|
+
$input .= "const version = /*version:kopytko:*/' '/*:kopytko:version*/;";
|
|
48
|
+
$expected = "";
|
|
49
|
+
$expected .= "const version = /*version:main:*/' '/*:main:version*/;";
|
|
50
|
+
$expected .= "const version = /*version:kopytko:*/'3.7.9'/*:kopytko:version*/;";
|
|
51
|
+
$expected .= "const version = /*version:main:*/' '/*:main:version*/;";
|
|
52
|
+
$expected .= "const version = /*version:kopytko:*/'3.7.9'/*:kopytko:version*/;";
|
|
53
|
+
$expected2 = "";
|
|
54
|
+
$expected2 .= "const version = /*version:main:*/'1.8.4'/*:main:version*/;";
|
|
55
|
+
$expected2 .= "const version = /*version:kopytko:*/'3.7.9'/*:kopytko:version*/;";
|
|
56
|
+
$expected2 .= "const version = /*version:main:*/'1.8.4'/*:main:version*/;";
|
|
57
|
+
$expected2 .= "const version = /*version:kopytko:*/'3.7.9'/*:kopytko:version*/;";
|
|
58
|
+
$result = UpdateChecker::updateScriptContent($input, 'kopytko', '3.7.9');
|
|
59
|
+
$result2 = UpdateChecker::updateScriptContent($result, 'main', '1.8.4');
|
|
60
|
+
$this->assertSame($expected, $result);
|
|
61
|
+
$this->assertSame($expected2, $result2);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** No marker no change. */
|
|
65
|
+
public function testNoVersionMarker() {
|
|
66
|
+
$input = "const version = '1.0.0';";
|
|
67
|
+
$result = UpdateChecker::updateScriptContent($input, 'main', '3.0.0');
|
|
68
|
+
$this->assertSame($input, $result);
|
|
69
|
+
}
|
|
70
|
+
}
|