Skip to content

Commit

Permalink
fix build errors in GH actions by moving rollup-plugin-serve and watc…
Browse files Browse the repository at this point in the history
…h into separate script (npm run dev)
  • Loading branch information
becky-gilbert committed Feb 2, 2024
1 parent 52ddf67 commit 02481fe
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
3 changes: 2 additions & 1 deletion packages/lookit-initjspsych/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "jest --coverage",
"build": "rollup --config --watch"
"build": "rollup --config",
"dev": "rollup --config rollup.config.dev.mjs --watch"
},
"author": "",
"license": "ISC",
Expand Down
26 changes: 26 additions & 0 deletions packages/lookit-initjspsych/rollup.config.dev.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { makeRollupConfig } from "@jspsych/config/rollup";
import serve from 'rollup-plugin-serve';

let rollupConfig = makeRollupConfig("lookitInitJsPsych");

const host = 'localhost';
const port = 10001; // this needs to change for each package
const content_dir = 'dist/';

rollupConfig.plugins = [
// options: https://github.com/thgh/rollup-plugin-serve/tree/master?tab=readme-ov-file#options
serve({
contentBase: content_dir,
historyApiFallback: true,
host: host,
port: port,
onListening: function (server) {
const address = server.address();
const host = (address.address === '::' || address.address === '::1') ? 'localhost' : address.address;
const protocol = this.https ? 'https' : 'http';
console.log(`Server listening at ${protocol}://${host}:${address.port}/`);
}
})
];

export default rollupConfig;
25 changes: 1 addition & 24 deletions packages/lookit-initjspsych/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
import { makeRollupConfig } from "@jspsych/config/rollup";
import serve from 'rollup-plugin-serve';

let rollupConfig = makeRollupConfig("lookitInitJsPsych");

const host = 'localhost';
const port = 10001; // this needs to change for each package
const content_dir = 'dist/';

rollupConfig.plugins = [
// options: https://github.com/thgh/rollup-plugin-serve/tree/master?tab=readme-ov-file#options
serve({
contentBase: content_dir,
historyApiFallback: true,
host: host,
port: port,
onListening: function (server) {
const address = server.address();
const host = (address.address === '::' || address.address === '::1') ? 'localhost' : address.address;
const protocol = this.https ? 'https' : 'http';
console.log(`Server listening at ${protocol}://${host}:${address.port}/`);
}
})
];

export default rollupConfig;
export default makeRollupConfig("lookitInitJsPsych");

0 comments on commit 02481fe

Please sign in to comment.