Skip to content

Commit

Permalink
Merge branch 'main' into melpp-spike-two-column
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellewhyte committed Oct 16, 2023
2 parents a7c7ff0 + 77bd12d commit 5611f52
Show file tree
Hide file tree
Showing 97 changed files with 1,691 additions and 764 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ jobs:
id: match
with:
changed-files: ${{ steps.changed.outputs.files }}
files: packages/ # Only look for changes in packages
globs: "!(**/__tests__/*), !(**/__stories__/*), !(**/dist/*)" # Ignore test files
files: "packages/, config/build/" # Only look for changes in packages, build
globs: "!(**/__tests__/*), !(**/__testdata__/*), !(**/__stories__/*), !(**/dist/*)" # Ignore test files
matchAllGlobs: true # Default is to match any of the globs, which ends up matching all files
conjunctive: true # Only match files that match all of the above

- name: Verify changeset entries
uses: Khan/[email protected]
Expand Down Expand Up @@ -292,7 +294,12 @@ jobs:

- name: Calculate short SHA for this commit
id: short-sha
run: echo "short_sha=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
# Why not GITHUB_SHA here? Because that is the last merge-commit
# for the PR (ie. the ephemeral commit that Github creates for
# each PR merging the base branch into the pull request HEAD) for
# Github Action runs). We want to reference the commit that was
# pushed, not this ephemeral commit.
run: echo "short_sha=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)" >> $GITHUB_OUTPUT

# Note: these two actions are locked to the latest version that were
# published when I created this yml file (just for security).
Expand Down
30 changes: 12 additions & 18 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const babelConfig = require("../babel.config");
const util = require("util");
const path = require("path");
const fs = require("fs");
const glob = require("fast-glob");

module.exports = {
core: {
Expand Down Expand Up @@ -49,23 +49,17 @@ module.exports = {
});

const aliases = {};
fs.readdirSync(path.join(__dirname, "../packages")).forEach((name) => {
if (name.startsWith(".")) {
return;
}
const stat = fs.statSync(path.join(__dirname, "../packages", name));
if (stat.isFile()) {
return;
}
const pkgPath = path.join("../packages", name, "package.json");
const pkgJson = require(pkgPath);
aliases["@khanacademy/" + name] = path.join(
__dirname,
"../packages",
name,
pkgJson.source,
);
});
glob.sync(path.join(__dirname, "../packages/*/package.json")).forEach(
(pkgPath) => {
const pkgJson = require(pkgPath);
aliases[pkgJson.name] = path.join(
__dirname,
"../packages",
path.basename(path.dirname(pkgPath)),
pkgJson.source,
);
},
);
fs.readdirSync(path.join(__dirname, "../vendor")).forEach((name) => {
aliases[name] = path.join(__dirname, "../vendor", name);
});
Expand Down
6 changes: 6 additions & 0 deletions config/build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# perseus-build-settings

## 0.2.1

### Patch Changes

- 55d4cd00: Add build step to replace **lib_version** with each package's published package version

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion config/build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "perseus-build-settings",
"version": "0.2.0",
"version": "0.2.1",
"license": "MIT",
"private": true
}
18 changes: 16 additions & 2 deletions config/build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const rootDir = ancesdir(__dirname);
*/

// Kahn's algorithm
// https://en.wikipedia.org/wiki/Topological_sorting#Kahn's_algorithm
// https://en.wikipedia.org/wiki/Topological_sorting#Kahn%27s_algorithm
const topoSort = (yarnWorkspacesOutput) => {
const sorted = [];
// the keys are depended on by the values
Expand Down Expand Up @@ -160,7 +160,7 @@ const getFormats = ({configFormats}) =>
*/
const createConfig = (
commandLineArgs,
{name, format, platform, inputFile, file, plugins},
{name, fullName, version, format, platform, inputFile, file, plugins},
) => {
const valueReplacementMappings = {
__IS_BROWSER__: platform === "browser",
Expand Down Expand Up @@ -188,6 +188,16 @@ const createConfig = (
preventAssignment: true,
values: valueReplacementMappings,
}),
// This replace() plugin instance injects the current package
// version and name into the output bundle. This provides useful
// runtime information anywhere that Perseus is used.
replace({
preventAssignment: true,
include: [makePackageBasedPath(name, "src/version.ts")],
values: {
__lib_version__: version,
},
}),
alias({
entries: {
hubble: path.join(rootDir, "vendor", "hubble"),
Expand Down Expand Up @@ -266,6 +276,8 @@ const getPackageInfo = (commandLineArgs, pkgName) => {
if (formats.has("cjs")) {
configs.push({
name: pkgName,
fullName: pkgJson.name,
version: pkgJson.version,
format: "cjs",
platform: "browser",
file: pkgJson.main,
Expand All @@ -275,6 +287,8 @@ const getPackageInfo = (commandLineArgs, pkgName) => {
if (formats.has("esm")) {
configs.push({
name: pkgName,
fullName: pkgJson.name,
version: pkgJson.version,
format: "esm",
platform: "browser",
file: pkgJson.module,
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@
},
"scripts": {
"gen:parsers": "yarn --cwd packages/kas gen:parsers",
"build": "yarn gen:parsers && rollup -c config/build/rollup.config.js",
"prebuild": "yarn gen:parsers",
"build": "rollup -c config/build/rollup.config.js",
"build:types": "yarn tsc --build tsconfig-build.json",
"build:prodsizecheck": "yarn gen:parsers && rollup -c config/build/rollup.config.js --configEnvironment='production'",
"watch": "rollup -c config/build/rollup.config.js --watch",
"build:prodsizecheck": "yarn build --configEnvironment='production'",
"watch": "yarn build --watch",
"clean": "rm -rf packages/*/dist && rm -rf packages/*/node_modules && rm -rf .nyc_output && rm -f packages/*/*.tsbuildinfo",
"coverage": "cross-env NODE_OPTIONS=--max_old_space_size=8192 yarn run jest --coverage",
"coverage:types": "cross-env NODE_OPTIONS=--max_old_space_size=8192 typescript-coverage-report",
Expand Down
15 changes: 15 additions & 0 deletions packages/kas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @khanacademy/kas

## 0.3.3

### Patch Changes

- Updated dependencies [22a9c408]
- @khanacademy/perseus-core@1.1.2

## 0.3.2

### Patch Changes

- 55d4cd00: Print package name and version when loaded in the page
- Updated dependencies [55d4cd00]
- @khanacademy/perseus-core@1.1.1

## 0.3.1

### Patch Changes
Expand Down
8 changes: 5 additions & 3 deletions packages/kas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A lightweight JavaScript CAS for comparing expressions and equations.",
"author": "Khan Academy",
"license": "MIT",
"version": "0.3.1",
"version": "0.3.3",
"publishConfig": {
"access": "public"
},
Expand All @@ -22,10 +22,12 @@
"gen:parsers": "node src/parser-generator.js",
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
},
"dependencies": {},
"dependencies": {
"@khanacademy/perseus-core": "1.1.2"
},
"devDependencies": {
"jison": "0.4.15",
"perseus-build-settings": "^0.2.0",
"perseus-build-settings": "^0.2.1",
"underscore": "1.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/kas/src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export {libVersion} from "./version";

export * from "./nodes";
export {compare} from "./compare";
10 changes: 10 additions & 0 deletions packages/kas/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is processed by a Rollup plugin (replace) to inject the production
// version number during the release build.
// In dev, you'll never see the version number.

import {addLibraryVersionToPerseusDebug} from "@khanacademy/perseus-core";

const libName = "@khanacademy/kas";
export const libVersion = "__lib_version__";

addLibraryVersionToPerseusDebug(libName, libVersion);
4 changes: 3 additions & 1 deletion packages/kas/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"outDir": "./dist",
"rootDir": "src"
},
"references": []
"references": [
{"path": "../perseus-core/tsconfig-build.json"}
]
}
15 changes: 15 additions & 0 deletions packages/kmath/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @khanacademy/kmath

## 0.1.4

### Patch Changes

- Updated dependencies [22a9c408]
- @khanacademy/perseus-core@1.1.2

## 0.1.3

### Patch Changes

- 55d4cd00: Print package name and version when loaded in the page
- Updated dependencies [55d4cd00]
- @khanacademy/perseus-core@1.1.1

## 0.1.2

### Patch Changes
Expand Down
8 changes: 5 additions & 3 deletions packages/kmath/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Khan Academy's Javascript Numeric Math Utilities",
"author": "Khan Academy",
"license": "MIT",
"version": "0.1.2",
"version": "0.1.4",
"publishConfig": {
"access": "public"
},
Expand All @@ -20,9 +20,11 @@
"scripts": {
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
},
"dependencies": {},
"dependencies": {
"@khanacademy/perseus-core": "1.1.2"
},
"devDependencies": {
"perseus-build-settings": "^0.2.0",
"perseus-build-settings": "^0.2.1",
"underscore": "1.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/kmath/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export {libVersion} from "./version";

export * as number from "./number";
export * as vector from "./vector";
export * as point from "./point";
Expand Down
10 changes: 10 additions & 0 deletions packages/kmath/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is processed by a Rollup plugin (replace) to inject the production
// version number during the release build.
// In dev, you'll never see the version number.

import {addLibraryVersionToPerseusDebug} from "@khanacademy/perseus-core";

const libName = "@khanacademy/kmath";
export const libVersion = "__lib_version__";

addLibraryVersionToPerseusDebug(libName, libVersion);
4 changes: 3 additions & 1 deletion packages/kmath/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"outDir": "./dist",
"rootDir": "src",
},
"references": []
"references": [
{"path": "../perseus-core/tsconfig-build.json"}
]
}
30 changes: 30 additions & 0 deletions packages/math-input/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# @khanacademy/math-input

## 14.1.1

### Patch Changes

- Updated dependencies [22a9c408]
- @khanacademy/perseus-core@1.1.2

## 14.1.0

### Minor Changes

- 5bcf118c: Desktop Expression Widget now uses v2 keypad

## 14.0.1

### Patch Changes

- 4f8afadd: Fix provided-keypad so that it doesn't re-render unnecessarily.
- 7d8905b6: Removes "grid" role from keypad to un-muddle screen reader experience.
- 55d4cd00: Print package name and version when loaded in the page
- Updated dependencies [55d4cd00]
- @khanacademy/perseus-core@1.1.1

## 14.0.0

### Major Changes

- 14138bb0: Move StatefulKeypadContextProvider into math-input
- 14138bb0: Hoist keypad active state into keypad context

## 13.1.0

### Minor Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/math-input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Khan Academy's new expression editor for the mobile web.",
"author": "Khan Academy",
"license": "MIT",
"version": "13.1.0",
"version": "14.1.1",
"publishConfig": {
"access": "public"
},
Expand All @@ -20,7 +20,7 @@
"source": "src/index.ts",
"scripts": {},
"dependencies": {
"@khanacademy/perseus-core": "1.1.0",
"@khanacademy/perseus-core": "1.1.2",
"mathquill": "git+https://[email protected]/Khan/mathquill.git#32d9f351aaa68537170b3120a52e99b8def3a2c3",
"performance-now": "^0.2.0"
},
Expand All @@ -34,7 +34,7 @@
"aphrodite": "^1.1.0",
"jquery": "^2.1.1",
"katex": "^0.11.1",
"perseus-build-settings": "^0.2.0",
"perseus-build-settings": "^0.2.1",
"prop-types": "15.6.1",
"react": "^16.8.0",
"react-dom": "^16.8.0",
Expand Down
Loading

0 comments on commit 5611f52

Please sign in to comment.