Reference lang source code directly from components

This commit is contained in:
Sam Nolan 2022-03-25 10:27:17 +11:00
parent e836520b9f
commit 543dde9144
8 changed files with 36 additions and 38 deletions

View File

@ -32,37 +32,28 @@ jobs:
name: Language build and test
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' || needs.pre_check.outputs.should_skip_components != 'true' }}
if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/squiggle-lang
steps:
- uses: actions/checkout@v2
# - name: Install packages from monorepo level
# run: cd ../../ && yarn
- name: Install packages
run: yarn
- name: Install dependencies from monorepo level
run: cd ../../ && yarn
# - name: Install dependencies
# run: yarn
- name: Build rescript codebase
run: yarn build
- name: Run tests
run: yarn test
- name: Run tsc and webpack
run: yarn bundle
- name: Cache lang build and bundle outputs
uses: actions/cache@v3
id: lang-outputs
with:
path: |
lib
dist
node_modules
key: ${{ github.sha }}
components-build-test:
name: Components build and test
runs-on: ubuntu-latest
needs: [pre_check, lang-build-test]
needs: [pre_check]
if: ${{ needs.pre_check.outputs.should_skip_components != 'true' }}
defaults:
run:
@ -70,19 +61,12 @@ jobs:
working-directory: packages/components
steps:
- uses: actions/checkout@v2
- name: Gain lang build and bundle outputs from cache
uses: actions/cache@v3
id: lang-outputs
with:
path: |
lib
dist
node_modules
key: ${{ github.sha }}
# - name: Install packages from monorepo level
# run: cd ../../ && yarn
- name: Install packages for components package
run: yarn
- name: Build rescript in squiggle-lang
run: cd ../squiggle-lang && yarn build
- name: Install dependencies from monorepo level
run: cd ../../ && yarn
# - name: Install dependencies for components package
# run: yarn
- name: Run tsc and webpack # I'm uncertain if bundle comes before build, it was jotted down in a readme that way but it may have been erroneous.
run: yarn bundle
- name: Build storybook
@ -99,7 +83,7 @@ jobs:
working-directory: packages/website
steps:
- uses: actions/checkout@v2
- name: Install packages
- name: Install dependencies
run: yarn
- name: Build website assets
run: yarn build

View File

@ -28,7 +28,7 @@
"scripts": {
"start": "cross-env REACT_APP_FAST_REFRESH=false && start-storybook -p 6006 -s public",
"build": "build-storybook -s public",
"bundle": "tsc && webpack",
"bundle": "webpack",
"all": "yarn bundle && yarn build"
},
"eslintConfig": {
@ -80,7 +80,6 @@
"@types/react": "17.0.39"
},
"source": "./src/index.ts",
"module": "dist/index.js",
"main": "dist/bundle.js",
"types": "dist/index.d.ts"
"types": "dist/src/index.d.ts"
}

View File

@ -10,7 +10,7 @@ import type {
} from "@quri/squiggle-lang";
import { createClassFromSpec } from "react-vega";
import * as chartSpecification from "./spec-distributions.json";
import * as percentilesSpec from "./spec-pertentiles.json";
import * as percentilesSpec from "./spec-percentiles.json";
let SquiggleVegaChart = createClassFromSpec({
spec: chartSpecification as Spec,

View File

@ -1,5 +1,8 @@
{
"compilerOptions": {
"paths": {
"@quri/squiggle-lang": ["../squiggle-lang/src/js"]
},
"module": "commonjs",
"jsx": "react",
"resolveJsonModule": true,
@ -7,12 +10,19 @@
"esModuleInterop": true,
"removeComments": true,
"preserveConstEnums": true,
"composite": true,
"outDir": "./dist",
"declarationDir": "./dist",
"declaration": true,
"sourceMap": true
},
"files": ["src/spec-distributions.json","src/spec-percentiles.json"],
"target": "ES6",
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
"include": ["src/**/*", "src/*"],
"exclude": ["node_modules", "**/*.spec.ts"],
"references": [
{
"path": "../squiggle-lang"
}
]
}

View File

@ -8,13 +8,17 @@ module.exports = {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
loader: "ts-loader",
options: { projectReferences: true },
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".js", ".tsx", ".ts"],
alias: {
"@quri/squiggle-lang": path.resolve(__dirname, '../squiggle-lang/src/js')
},
},
output: {
filename: "bundle.js",

View File

@ -4,7 +4,7 @@
"homepage": "https://squiggle-language.com",
"scripts": {
"build": "rescript build -with-deps",
"bundle": "tsc && webpack",
"bundle": "webpack",
"start": "rescript build -w -with-deps",
"clean": "rescript clean",
"test": "jest",

View File

@ -9,7 +9,8 @@
"sourceMap": true,
"outDir": "./dist",
"declarationDir": "./dist",
"declaration": true
"declaration": true,
"composite": true
},
"target": "ES6",
"include": ["src/**/*"],