@jspsych/config 3.3.1 → 3.3.3
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 +14 -0
- package/gulp.js +72 -39
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @jspsych/config
|
|
2
2
|
|
|
3
|
+
## 3.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3660](https://github.com/jspsych/jsPsych/pull/3660) [`181d0068b7ec8fcd76de94f78cec9526b0415ce2`](https://github.com/jspsych/jsPsych/commit/181d0068b7ec8fcd76de94f78cec9526b0415ce2) Thanks [@jodeleeuw](https://github.com/jodeleeuw)! - Fix `createCoreDistArchive` dropping plugins from `dist.zip`. Recent release archives were missing the alphabetical tail of `dist/*.js` (e.g. `plugin-survey-multi-*`, `plugin-video-*`, `plugin-virtual-chinrest`, `plugin-visual-search-circle`, the `plugin-webgazer-*` plugins) along with some `examples/*.html` files. Under gulp 5's streamx-based Vinyl, `merge-stream` would race with `gulp-zip` and finalize the archive before slow upstreams (notably the 3 MB `plugin-survey/dist/index.browser.js`) had finished flushing. The task now drains every substream first and feeds the collected files into `gulp-zip` from a single ordered stream.
|
|
8
|
+
|
|
9
|
+
## 3.3.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#3615](https://github.com/jspsych/jsPsych/pull/3615) [`2ee865dbe93d8d81d41d1287e3eed6dd106ec970`](https://github.com/jspsych/jsPsych/commit/2ee865dbe93d8d81d41d1287e3eed6dd106ec970) Thanks [@Jolg42](https://github.com/Jolg42)! - fix images encoding in dist zip
|
|
14
|
+
|
|
15
|
+
- [#3624](https://github.com/jspsych/jsPsych/pull/3624) [`5241a2335b8fc9038f9c23c8152bec548ef43cb7`](https://github.com/jspsych/jsPsych/commit/5241a2335b8fc9038f9c23c8152bec548ef43cb7) Thanks [@becky-gilbert](https://github.com/becky-gilbert)! - Fix `updatePluginVersions` task so that plugin versions are automatically updated on the plugin documentation pages.
|
|
16
|
+
|
|
3
17
|
## 3.3.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/gulp.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "fs";
|
|
2
2
|
import { sep as pathSeparator } from "path";
|
|
3
|
+
import { Readable } from "stream";
|
|
3
4
|
|
|
4
5
|
import glob from "glob";
|
|
5
6
|
import gulp from "gulp";
|
|
@@ -7,10 +8,21 @@ import file from "gulp-file";
|
|
|
7
8
|
import rename from "gulp-rename";
|
|
8
9
|
import replace from "gulp-replace";
|
|
9
10
|
import zip from "gulp-zip";
|
|
10
|
-
import merge from "merge-stream";
|
|
11
11
|
|
|
12
12
|
const { dest, src } = gulp;
|
|
13
13
|
|
|
14
|
+
// Drains a Vinyl object stream and resolves with the emitted files. We collect
|
|
15
|
+
// every substream up front instead of feeding `gulp-zip` through `merge-stream`
|
|
16
|
+
// because under gulp 5 (streamx-based Vinyl) the zip sink can finalize before
|
|
17
|
+
// slow upstreams flush, silently dropping files from `dist.zip`.
|
|
18
|
+
const collectFiles = (stream) =>
|
|
19
|
+
new Promise((resolve, reject) => {
|
|
20
|
+
const files = [];
|
|
21
|
+
stream.on("data", (vinylFile) => files.push(vinylFile));
|
|
22
|
+
stream.on("end", () => resolve(files));
|
|
23
|
+
stream.on("error", reject);
|
|
24
|
+
});
|
|
25
|
+
|
|
14
26
|
const readJsonFile = (filename) => JSON.parse(readFileSync(filename, "utf8"));
|
|
15
27
|
|
|
16
28
|
const getAllPackages = () =>
|
|
@@ -63,54 +75,75 @@ const getVersionFileContents = () =>
|
|
|
63
75
|
"",
|
|
64
76
|
].join("\n");
|
|
65
77
|
|
|
66
|
-
export const createCoreDistArchive = () =>
|
|
67
|
-
|
|
78
|
+
export const createCoreDistArchive = async () => {
|
|
79
|
+
const fileGroups = await Promise.all([
|
|
68
80
|
// index.browser.js files
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
collectFiles(
|
|
82
|
+
src("packages/*/dist/index.browser.js", { root: "packages/" })
|
|
83
|
+
// Rename dist files
|
|
84
|
+
.pipe(
|
|
85
|
+
rename((path) => {
|
|
86
|
+
const packageName = path.dirname.split(pathSeparator)[0];
|
|
87
|
+
|
|
88
|
+
path.dirname = "/dist";
|
|
89
|
+
path.basename = packageName;
|
|
90
|
+
})
|
|
91
|
+
)
|
|
92
|
+
// Remove sourceMappingURL comments
|
|
93
|
+
.pipe(replace(/\/\/# sourceMappingURL=.*\n/g, ""))
|
|
94
|
+
),
|
|
81
95
|
|
|
82
96
|
// jspsych.css
|
|
83
|
-
src("packages/jspsych/css/jspsych.css").pipe(rename("/dist/jspsych.css")),
|
|
97
|
+
collectFiles(src("packages/jspsych/css/jspsych.css").pipe(rename("/dist/jspsych.css"))),
|
|
84
98
|
|
|
85
99
|
// survey.css
|
|
86
|
-
src("packages/plugin-survey/css/survey.css").pipe(rename("/dist/survey.css")),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
collectFiles(src("packages/plugin-survey/css/survey.css").pipe(rename("/dist/survey.css"))),
|
|
101
|
+
collectFiles(
|
|
102
|
+
src("packages/plugin-survey/css/survey.min.css").pipe(rename("/dist/survey.min.css"))
|
|
103
|
+
),
|
|
104
|
+
|
|
105
|
+
// Examples HTML files
|
|
106
|
+
collectFiles(
|
|
107
|
+
src(["examples/**/*.html"], { base: "." })
|
|
108
|
+
// Rewrite script source paths
|
|
109
|
+
.pipe(
|
|
110
|
+
replace(
|
|
111
|
+
/<script src="(.*)\/packages\/(.*)\/dist\/index\.browser\.js"/g,
|
|
112
|
+
'<script src="$1/dist/$2.js"'
|
|
113
|
+
)
|
|
96
114
|
)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
115
|
+
// Rewrite jspsych css source paths
|
|
116
|
+
.pipe(
|
|
117
|
+
replace(
|
|
118
|
+
/<link rel="stylesheet" href="(.*)\/packages\/jspsych\/css\/(.*)"/g,
|
|
119
|
+
'<link rel="stylesheet" href="$1/dist/$2"'
|
|
120
|
+
)
|
|
103
121
|
)
|
|
104
|
-
|
|
122
|
+
),
|
|
123
|
+
|
|
124
|
+
// Examples files other than HTML (e.g. media files)
|
|
125
|
+
// Note: `encoding: false` means that the files contents are treated as binary.
|
|
126
|
+
// This prevents Gulp from corrupting binary files such as images when it reads them.
|
|
127
|
+
// Needed since Gulp v5.
|
|
128
|
+
collectFiles(src(["examples/**/*", "!examples/**/*.html"], { base: ".", encoding: false })),
|
|
105
129
|
|
|
106
130
|
// VERSION.md
|
|
107
|
-
file("VERSION.md", getVersionFileContents(), { src: true }),
|
|
131
|
+
collectFiles(file("VERSION.md", getVersionFileContents(), { src: true })),
|
|
108
132
|
|
|
109
133
|
// Other files
|
|
110
|
-
src(["*.md", "license.txt"])
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
|
|
134
|
+
collectFiles(src(["*.md", "license.txt"])),
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
// Await the destination's `finish` so gulp doesn't mark this task complete
|
|
138
|
+
// before `dist.zip` is fully written (async-done resolves a returned Promise
|
|
139
|
+
// by its resolved value, not by re-handling a stream the Promise resolves to).
|
|
140
|
+
const writeStream = Readable.from(fileGroups.flat()).pipe(zip("dist.zip")).pipe(dest("."));
|
|
141
|
+
await new Promise((resolve, reject) => {
|
|
142
|
+
writeStream.on("finish", resolve);
|
|
143
|
+
writeStream.on("end", resolve);
|
|
144
|
+
writeStream.on("error", reject);
|
|
145
|
+
});
|
|
146
|
+
};
|
|
114
147
|
|
|
115
148
|
/**
|
|
116
149
|
* Updates each unpkg link with a precise version number to the corresponding package's current
|
|
@@ -141,7 +174,7 @@ export const updateUnpkgLinks = () => {
|
|
|
141
174
|
export const updatePluginVersions = () => {
|
|
142
175
|
const packageVersions = new Map(getAllPackages().map(({ name, version }) => [name, version]));
|
|
143
176
|
|
|
144
|
-
return src(["
|
|
177
|
+
return src(["docs/plugins/*.md"])
|
|
145
178
|
.pipe(
|
|
146
179
|
replace(
|
|
147
180
|
/\# (.+?)(?: plugin)?[\s]*?[\n]*Current version: (\d+.\d+.\d+|current-plugin-version)\./gi,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jspsych/config",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "Shared (build) configuration for jsPsych packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"jest": "29.7.0",
|
|
64
64
|
"jest-canvas-mock": "2.5.0",
|
|
65
65
|
"jest-environment-jsdom": "29.7.0",
|
|
66
|
-
"merge-stream": "2.0.0",
|
|
67
66
|
"rollup": "^4.22.4",
|
|
68
67
|
"rollup-plugin-dts": "6.1.1",
|
|
69
68
|
"rollup-plugin-esbuild": "6.1.1",
|