@jspsych/config 1.2.0 → 1.3.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @jspsych/config
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`3463e977`](https://github.com/jspsych/jsPsych/commit/3463e9778f3c2787b9c75c0f9bd7d19cc79798b3) Thanks [@becky-gilbert](https://github.com/becky-gilbert)! - Add the updatePluginVersions gulp task. This task looks at each of the docs/plugins markdown files, finds the page title and "Current version" string, adds the current version number (from the package.json file), and uses the package name as the page title.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#2631](https://github.com/jspsych/jsPsych/pull/2631) [`e77371e9`](https://github.com/jspsych/jsPsych/commit/e77371e94b3496361138d681c16840829f4c5cd2) Thanks [@bjoluc](https://github.com/bjoluc)! - Update dependencies, including Jest v27 to v28. The changelogs have been carefully checked and no breaking changes are to be expected in packages using `@jspsych/config`. Check out the [Jest 28 blog post](https://jestjs.io/blog/2022/04/25/jest-28) for a summary of the changes in Jest.
12
+
13
+ * [#2632](https://github.com/jspsych/jsPsych/pull/2632) [`a17f423f`](https://github.com/jspsych/jsPsych/commit/a17f423f18df24c73baeb06d4079f9f2f9211386) Thanks [@bjoluc](https://github.com/bjoluc)! - Apply Babel Rollup plugin to `.ts` files in the `index.browser.min.js` build. It was erroneously ignoring transpiled `.ts` files before.
14
+
3
15
  ## 1.2.0
4
16
 
5
17
  ### Minor Changes
package/gulp.js CHANGED
@@ -127,3 +127,26 @@ export const updateUnpkgLinks = () => {
127
127
  )
128
128
  .pipe(dest("./"));
129
129
  };
130
+
131
+ /**
132
+ * Substitutes the string "current-plugin-version" or version number that follows the text "Current version: "
133
+ * in the plugin docs pages with the package's current version, as defined in the package's `package.json`.
134
+ * Only considers `.md` files in `docs/plugins` folder.
135
+ * Gets the package name from the docs page title (i.e. following "# "), ignoring the string " plugin" in the title.
136
+ */
137
+ export const updatePluginVersions = () => {
138
+ const packageVersions = new Map(getAllPackages().map(({ name, version }) => [name, version]));
139
+
140
+ return src(["././docs/plugins/*.md"])
141
+ .pipe(
142
+ replace(
143
+ /\# (.+?)(?: plugin)?[\s]*?[\n]*Current version: (\d+.\d+.\d+|current-plugin-version)\./gi,
144
+ (match_str, packageName, currentVersionText) => {
145
+ const fullPackageName = "@jspsych/plugin-" + packageName;
146
+ const latestVersion = packageVersions.get(fullPackageName) ?? currentVersionText;
147
+ return `# ${packageName}\n\nCurrent version: ${latestVersion}.`;
148
+ }
149
+ )
150
+ )
151
+ .pipe(dest("./docs/plugins"));
152
+ };
package/jest.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  const ts = require("typescript");
2
- const { pathsToModuleNameMapper } = require("ts-jest/utils");
2
+ const { pathsToModuleNameMapper } = require("ts-jest");
3
3
 
4
+ /** @type { (dirname: string) => import('@jest/types').Config.InitialOptions } */
4
5
  module.exports.makePackageConfig = (dirname) => {
5
6
  const packageJson = require(dirname + "/package.json");
6
7
  const packageBaseName = packageJson.name.replace("@jspsych/", "");
@@ -14,15 +15,13 @@ module.exports.makePackageConfig = (dirname) => {
14
15
 
15
16
  return {
16
17
  preset: "ts-jest",
17
- moduleNameMapper: pathsToModuleNameMapper(tsCompilerOptions.paths, {
18
- prefix: "<rootDir>/",
19
- }),
18
+ moduleNameMapper: pathsToModuleNameMapper(tsCompilerOptions.paths, { prefix: "<rootDir>/" }),
20
19
  testEnvironment: "jsdom",
21
20
  testEnvironmentOptions: {
22
21
  fetchExternalResources: true,
23
22
  pretendToBeVisual: true,
23
+ url: "http://localhost/",
24
24
  },
25
- testURL: "http://localhost/",
26
25
  displayName: {
27
26
  name: packageBaseName,
28
27
  color: packageBaseName === "jspsych" ? "white" : "cyanBright",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jspsych/config",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Shared (build) configuration for jsPsych packages",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,31 +39,31 @@
39
39
  },
40
40
  "homepage": "https://www.jspsych.org/latest/developers/configuration",
41
41
  "dependencies": {
42
- "@babel/cli": "7.15.7",
43
- "@babel/core": "7.15.5",
44
- "@babel/preset-env": "7.15.6",
45
- "@rollup/plugin-babel": "5.3.0",
46
- "@rollup/plugin-commonjs": "19.0.0",
42
+ "@babel/cli": "7.17.10",
43
+ "@babel/core": "7.17.10",
44
+ "@babel/preset-env": "7.17.10",
45
+ "@rollup/plugin-babel": "5.3.1",
46
+ "@rollup/plugin-commonjs": "22.0.0",
47
47
  "@rollup/plugin-json": "4.1.0",
48
- "@rollup/plugin-node-resolve": "13.0.5",
48
+ "@rollup/plugin-node-resolve": "13.3.0",
49
49
  "@types/gulp": "4.0.9",
50
- "@types/jest": "27.0.2",
51
- "babel-preset-minify": "0.5.1",
52
- "canvas": "2.8.0",
50
+ "@types/jest": "27.5.1",
51
+ "babel-preset-minify": "0.5.2",
52
+ "canvas": "2.9.1",
53
53
  "gulp": "4.0.2",
54
54
  "gulp-cli": "2.3.0",
55
55
  "gulp-file": "^0.4.0",
56
56
  "gulp-rename": "2.0.0",
57
57
  "gulp-replace": "1.1.3",
58
58
  "gulp-zip": "5.1.0",
59
- "jest": "27.2.4",
60
- "jest-environment-jsdom": "27.2.4",
59
+ "jest": "28.1.0",
60
+ "jest-environment-jsdom": "28.1.0",
61
61
  "merge-stream": "2.0.0",
62
- "rollup": "2.58.0",
62
+ "rollup": "2.73.0",
63
63
  "rollup-plugin-terser": "7.0.2",
64
- "rollup-plugin-typescript2": "0.30.0",
65
- "ts-jest": "27.0.5",
66
- "tslib": "2.3.1",
67
- "typescript": "4.4.3"
64
+ "rollup-plugin-typescript2": "0.31.2",
65
+ "ts-jest": "28.0.2",
66
+ "tslib": "2.4.0",
67
+ "typescript": "^4.6.4"
68
68
  }
69
69
  }
package/rollup.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_EXTENSIONS as babelDefaultExtensions } from "@babel/core";
1
2
  import { babel } from "@rollup/plugin-babel";
2
3
  import commonjs from "@rollup/plugin-commonjs";
3
4
  import json from "@rollup/plugin-json";
@@ -81,6 +82,8 @@ const makeConfig = ({
81
82
  babel({
82
83
  babelHelpers: "bundled",
83
84
  extends: "@jspsych/config/babel",
85
+ // https://github.com/ezolenko/rollup-plugin-typescript2#rollupplugin-babel
86
+ extensions: [...babelDefaultExtensions, ".ts"],
84
87
  })
85
88
  ),
86
89
  output: [