@jspsych/config 1.1.0 → 1.2.0
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 +10 -0
- package/gulp.js +39 -17
- package/package.json +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @jspsych/config
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2431](https://github.com/jspsych/jsPsych/pull/2431) [`87f332f9`](https://github.com/jspsych/jsPsych/commit/87f332f92540eef028bbed7284e30c1cf614cc96) Thanks [@bjoluc](https://github.com/bjoluc)! - Implement an `updateUnpkgLinks` Gulp task to update each unpkg link with a precise version number to the corresponding package's current version as defined in the package's `package.json`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#2505](https://github.com/jspsych/jsPsych/pull/2505) [`9486bc50`](https://github.com/jspsych/jsPsych/commit/9486bc509f8fe4b4ac4b93510ddd8fd17e5f1b05) Thanks [@bjoluc](https://github.com/bjoluc)! - Fix css path rewriting in `createCoreDistArchive` Gulp task when `link` tags do not end in `/>`
|
|
12
|
+
|
|
3
13
|
## 1.1.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/gulp.js
CHANGED
|
@@ -13,6 +13,20 @@ const { dest, src } = gulp;
|
|
|
13
13
|
|
|
14
14
|
const readJsonFile = (filename) => JSON.parse(readFileSync(filename, "utf8"));
|
|
15
15
|
|
|
16
|
+
const getAllPackages = () =>
|
|
17
|
+
glob
|
|
18
|
+
// Get an array of all package.json filenames
|
|
19
|
+
.sync("packages/*/package.json")
|
|
20
|
+
|
|
21
|
+
// Map file names to package details
|
|
22
|
+
.map((filename) => {
|
|
23
|
+
const packageJson = readJsonFile(filename);
|
|
24
|
+
return {
|
|
25
|
+
name: packageJson.name,
|
|
26
|
+
version: packageJson.version,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
16
30
|
const getVersionFileContents = () =>
|
|
17
31
|
[
|
|
18
32
|
"Included in this release:\n",
|
|
@@ -25,19 +39,7 @@ const getVersionFileContents = () =>
|
|
|
25
39
|
"/";
|
|
26
40
|
|
|
27
41
|
return (
|
|
28
|
-
|
|
29
|
-
// Get an array of all package.json filenames
|
|
30
|
-
.sync("packages/*/package.json")
|
|
31
|
-
|
|
32
|
-
// Map file names to package details
|
|
33
|
-
.map((filename) => {
|
|
34
|
-
const packageJson = readJsonFile(filename);
|
|
35
|
-
return {
|
|
36
|
-
name: packageJson.name,
|
|
37
|
-
version: packageJson.version,
|
|
38
|
-
};
|
|
39
|
-
})
|
|
40
|
-
|
|
42
|
+
getAllPackages()
|
|
41
43
|
// Filter packages that should not be listed
|
|
42
44
|
.filter(({ name }) => !["@jspsych/config", "@jspsych/test-utils"].includes(name))
|
|
43
45
|
|
|
@@ -85,15 +87,15 @@ export const createCoreDistArchive = () =>
|
|
|
85
87
|
// Rewrite script source paths
|
|
86
88
|
.pipe(
|
|
87
89
|
replace(
|
|
88
|
-
/<script src="(.*)\/packages\/(.*)\/dist\/index\.browser\.js"
|
|
89
|
-
'<script src="$1/dist/$2.js"
|
|
90
|
+
/<script src="(.*)\/packages\/(.*)\/dist\/index\.browser\.js"/g,
|
|
91
|
+
'<script src="$1/dist/$2.js"'
|
|
90
92
|
)
|
|
91
93
|
)
|
|
92
94
|
// Rewrite jspsych css source paths
|
|
93
95
|
.pipe(
|
|
94
96
|
replace(
|
|
95
|
-
/<link rel="stylesheet" href="(.*)\/packages\/jspsych\/css\/(.*)"
|
|
96
|
-
'<link rel="stylesheet" href="$1/dist/$2"
|
|
97
|
+
/<link rel="stylesheet" href="(.*)\/packages\/jspsych\/css\/(.*)"/g,
|
|
98
|
+
'<link rel="stylesheet" href="$1/dist/$2"'
|
|
97
99
|
)
|
|
98
100
|
),
|
|
99
101
|
|
|
@@ -105,3 +107,23 @@ export const createCoreDistArchive = () =>
|
|
|
105
107
|
)
|
|
106
108
|
.pipe(zip("dist.zip"))
|
|
107
109
|
.pipe(dest("."));
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Updates each unpkg link with a precise version number to the corresponding package's current
|
|
113
|
+
* version as defined in the package's `package.json`. Only considers `.md` and `.html` files.
|
|
114
|
+
*/
|
|
115
|
+
export const updateUnpkgLinks = () => {
|
|
116
|
+
const packageVersions = new Map(getAllPackages().map(({ name, version }) => [name, version]));
|
|
117
|
+
|
|
118
|
+
return src(["./**/*.{md,html}"])
|
|
119
|
+
.pipe(
|
|
120
|
+
replace(
|
|
121
|
+
/"https:\/\/unpkg\.com\/(@?.*)@(\d+.\d+.\d+)(\/[^"]*)?"/g,
|
|
122
|
+
(url, packageName, currentVersion, path) => {
|
|
123
|
+
const latestVersion = packageVersions.get(packageName) ?? currentVersion;
|
|
124
|
+
return `"https://unpkg.com/${packageName}@${latestVersion}${path ?? ""}"`;
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
.pipe(dest("./"));
|
|
129
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jspsych/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Shared (build) configuration for jsPsych packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -27,10 +27,6 @@
|
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=14.0.0"
|
|
29
29
|
},
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "",
|
|
32
|
-
"tsc": ""
|
|
33
|
-
},
|
|
34
30
|
"repository": {
|
|
35
31
|
"type": "git",
|
|
36
32
|
"url": "git+https://github.com/jspsych/jsPsych.git",
|