Skip to content

Commit

Permalink
Move library source to memory-viz workspace (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-yz-liu authored Apr 16, 2024
1 parent becfe7b commit 4d72b15
Show file tree
Hide file tree
Showing 27 changed files with 180 additions and 433 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
cache: npm
- name: Install npm packages
run: npm ci
- name: Build
run: npm run build-dev
- name: Run jest tests
run: npm run test-cov
- name: Coveralls (jest)
Expand Down
5 changes: 3 additions & 2 deletions demo/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const config: Config = {
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: false,
// collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
Expand Down Expand Up @@ -74,7 +74,7 @@ const config: Config = {
// maxWorkers: "50%",

// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: ["node_modules", "../src", "../dist"],
// moduleDirectories: ["node_modules"],

// An array of file extensions your modules use
// moduleFileExtensions: [
Expand All @@ -92,6 +92,7 @@ const config: Config = {
moduleNameMapper: {
// Force module roughjs to resolve with the CJS entry point, because Jest does not support package.json.exports. Elaborated in PR#15.
roughjs: require.resolve("roughjs"),
"memory-viz": require.resolve("../memory-viz/src"),
},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
Expand Down
1 change: 1 addition & 0 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@mui/icons-material": "^5.15.14",
"@mui/material": "^5.15.7",
"@picocss/pico": "^1.5.10",
"memory-viz": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12"
Expand Down
2 changes: 1 addition & 1 deletion demo/src/SvgDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef, useEffect } from "react";
import mem from "../../src/index"; // TODO: replace with import of the package after it's been published
import mem from "memory-viz";
import { configDataPropTypes } from "./MemoryModelsUserInput";

type SvgDisplayPropTypes = {
Expand Down
2 changes: 1 addition & 1 deletion demo/src/__tests__/App.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import App from "../App";
import mem from "../../../src/index";
import mem from "memory-viz";

describe("App", () => {
beforeEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions demo/src/__tests__/SvgDisplay.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import SvgDisplay from "../SvgDisplay";
import mem from "../../../src/index";
import mem from "memory-viz";
const { draw } = mem;

const mockMemoryModels = {
Expand All @@ -10,7 +10,7 @@ const mockMemoryModels = {
render: jest.fn(),
};

jest.mock("../../../src/index", () => ({
jest.mock("memory-viz", () => ({
draw: jest.fn(() => mockMemoryModels),
}));

Expand Down
4 changes: 4 additions & 0 deletions demo/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = [
externals: {
fs: "fs",
},
externalsType: "window",
plugins: [
new HtmlWebpackPlugin({
title: "MemoryViz Demo",
Expand All @@ -55,6 +56,9 @@ module.exports = [
],
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json", ".css"],
alias: {
"memory-viz": path.resolve(__dirname, "../memory-viz/src"),
},
},
},
];
Loading

0 comments on commit 4d72b15

Please sign in to comment.