Skip to content

Commit

Permalink
merge CJs changes and resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
becky-gilbert committed Mar 2, 2024
2 parents 092ef2b + d316490 commit 7e368e3
Show file tree
Hide file tree
Showing 27 changed files with 745 additions and 367 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": ["@lookit/lookit-api"]
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
coverage
coverage
Procfile
55 changes: 42 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

Here is the monorepo containing packages developed by Lookit to be used with jsPsych on the lookit.mit.edu project.

## Linting/Formating

Lint and formating is done at the monorepo level.

To auto fix linting/formating issues:

```
npm run fix
```

Unfixable issues will be diplayed as errors.

## Create new package

We are using npm workspaces for managing our packages.
Expand Down Expand Up @@ -45,12 +33,18 @@ And add the following to `package.json`:
],
```

Update the following in `package.json`:

```json
"main": "dist/index.js",
```

At the root of the new package run the following commands:

```sh
mkdir src
echo "export default {}" > src/index.ts
touch tsconfig.json rollup.config.mjs jest.config.cjs
touch tsconfig.json rollup.config.mjs rollup.config.dev.mjs jest.config.cjs
cd ../..
```

Expand All @@ -75,6 +69,19 @@ import { makeRollupConfig } from "@jspsych/config/rollup";
export default makeRollupConfig("<camelcase name of new package>");
```

Edit `rollup.config.dev.mjs`:

```mjs
import { makeRollupConfig } from "@jspsych/config/rollup";

import { makeDevConfig } from "../../rollup-dev.mjs";

const rollupConfig = makeRollupConfig("lookitInitJsPsych");
const port = 10001; // this needs to change for each package

export default makeDevConfig(rollupConfig, port);
```

Edit `jest.config.cjs`

```cjs
Expand Down Expand Up @@ -105,6 +112,18 @@ Build all packages:
npm run build
```

## Linting/Formating

Lint and formating is done at the monorepo level.

To auto fix linting/formating issues:

```
npm run fix
```

Unfixable issues will be diplayed as errors.

## Change log

Adding a change log through `changeset` is done with the following command:
Expand All @@ -114,3 +133,13 @@ npm run changeset
```

Make sure to add the change log found in the `.changeset` directory to the PR.

## Run Dev Server

To run a development server:

```
npm run dev -w @lookit/<name of package>
```

When the server has started, you should see something very similar to `<script src="http://127.0.0.1:10001/index.browser.js"></script>` printed out. Add this html to `web/templates/web/jspsych-study-detail.html` in the Django lookit api project to test the package in your local development environment.
Loading

0 comments on commit 7e368e3

Please sign in to comment.