Compare commits

..

24 Commits

Author SHA1 Message Date
b0ab335426 Merge branch 'main' into pierremtb/adhoc/pnpm 2025-02-28 16:05:57 -05:00
b1e6f84a1f New machine-api types 2025-02-28 18:39:15 +00:00
39ed99be2b Merge branch 'main' into pierremtb/adhoc/pnpm 2025-02-28 13:37:57 -05:00
ff6c1b9c68 New machine-api types 2025-02-27 21:29:42 +00:00
eda485362e WIP 2025-02-27 16:28:23 -05:00
07e98916d3 More pnpming 2025-02-27 16:15:20 -05:00
d715a8b7af WIP 2025-02-27 15:34:25 -05:00
239ef48b3a Merge branch 'main' into pierremtb/adhoc/pnpm 2025-02-27 15:29:32 -05:00
2ca58020cc --force 2025-02-26 16:48:25 -05:00
1ca6c80707 Temp test for e2e corepack 2025-02-26 16:31:18 -05:00
19007862a6 Fix more tsc and lint madness 2025-02-26 13:18:43 -05:00
1e597e9cbe Merge branch 'main' into pierremtb/adhoc/pnpm 2025-02-26 12:20:04 -05:00
4eaa5460b8 Fix a bunch of things 2025-02-26 11:49:53 -05:00
dd3799cfb7 Trigger CI 2025-02-26 11:32:22 -05:00
0d79d0ff6d New machine-api types 2025-02-26 16:20:39 +00:00
08fdcb1c1c Add more pnpm setups 2025-02-26 11:18:18 -05:00
087336b8ae Fix electron 2025-02-26 11:02:33 -05:00
fea5350cb9 Remove yarn 2025-02-26 10:41:39 -05:00
400733f10e Add mkdirp 2025-02-26 10:35:33 -05:00
7f1383d314 Add rimraf and insatll-pnpm step 2025-02-26 10:32:34 -05:00
d2adb5bfad WIP 2025-02-26 10:30:12 -05:00
fbed6bbcf7 - run: corepack enable 2025-02-26 10:04:13 -05:00
291ad31bd0 Force some CI 2025-02-26 10:01:34 -05:00
929473a0ad WIP: attempt at pnpm migration (working dev package build) 2025-02-26 09:58:53 -05:00
2354 changed files with 123964 additions and 6995866 deletions

View File

@ -1,3 +1,3 @@
[codespell] [codespell]
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,./public/kcl-samples,./rust/kcl-lib/tests/kcl_samples,tsconfig.tsbuildinfo skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,pnpm-lock.yaml,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,tsconfig.tsbuildinfo,src/lib/machine-api.d.ts

View File

@ -1,6 +1,4 @@
rust/**/*.ts src/wasm-lib/*
!rust/kcl-language-server/client/src/**/*.ts
*.typegen.ts *.typegen.ts
packages/codemirror-lsp-client/dist/* packages/codemirror-lsp-client/dist/*
e2e/playwright/snapshots/prompt-to-edit/* e2e/playwright/snapshots/prompt-to-edit/*
.vscode-test

View File

@ -4,7 +4,6 @@
"project": "./tsconfig.json" "project": "./tsconfig.json"
}, },
"plugins": [ "plugins": [
"react-perf",
"css-modules", "css-modules",
"jest", "jest",
"jsx-a11y", "jsx-a11y",

View File

@ -1,8 +0,0 @@
FROM node:slim
COPY . /action
WORKDIR /action
RUN npm install --production
ENTRYPOINT ["node", "/action/main.js"]

View File

@ -1,21 +0,0 @@
# github-release
Copy-pasted from
https://github.com/bytecodealliance/wasmtime/tree/8acfdbdd8aa550d1b84e0ce1e6222a6605d14e38/.github/actions/github-release
An action used to publish GitHub releases for `wasmtime`.
As of the time of this writing there's a few actions floating around which
perform github releases but they all tend to have their set of drawbacks.
Additionally nothing handles deleting releases which we need for our rolling
`dev` release.
To handle all this, this action rolls its own implementation using the
actions/toolkit repository and packages published there. These run in a Docker
container and take various inputs to orchestrate the release from the build.
More comments can be found in `main.js`.
Testing this is really hard. If you want to try though run `npm install` and
then `node main.js`. You'll have to configure a bunch of env vars though to get
anything reasonably working.

View File

@ -1,15 +0,0 @@
name: "wasmtime github releases"
description: "wasmtime github releases"
inputs:
token:
description: ""
required: true
name:
description: ""
required: true
files:
description: ""
required: true
runs:
using: "docker"
image: "Dockerfile"

View File

@ -1,143 +0,0 @@
const core = require("@actions/core");
const path = require("path");
const fs = require("fs");
const github = require("@actions/github");
const glob = require("glob");
function sleep(milliseconds) {
return new Promise((resolve) => setTimeout(resolve, milliseconds));
}
async function runOnce() {
// Load all our inputs and env vars. Note that `getInput` reads from `INPUT_*`
const files = core.getInput("files");
const name = core.getInput("name");
const token = core.getInput("token");
const slug = process.env.GITHUB_REPOSITORY;
const owner = slug.split("/")[0];
const repo = slug.split("/")[1];
const sha = process.env.HEAD_SHA;
core.info(`files: ${files}`);
core.info(`name: ${name}`);
const options = {
request: {
timeout: 30000,
},
};
const octokit = github.getOctokit(token, options);
// Delete the previous release since we can't overwrite one. This may happen
// due to retrying an upload or it may happen because we're doing the dev
// release.
const releases = await octokit.paginate("GET /repos/:owner/:repo/releases", { owner, repo });
for (const release of releases) {
if (release.tag_name !== name) {
continue;
}
const release_id = release.id;
core.info(`deleting release ${release_id}`);
await octokit.rest.repos.deleteRelease({ owner, repo, release_id });
}
// We also need to update the `dev` tag while we're at it on the `dev` branch.
if (name == "nightly") {
try {
core.info(`updating nightly tag`);
await octokit.rest.git.updateRef({
owner,
repo,
ref: "tags/nightly",
sha,
force: true,
});
} catch (e) {
core.error(e);
core.info(`creating nightly tag`);
await octokit.rest.git.createTag({
owner,
repo,
tag: "nightly",
message: "nightly release",
object: sha,
type: "commit",
});
}
}
// Creates an official GitHub release for this `tag`, and if this is `dev`
// then we know that from the previous block this should be a fresh release.
core.info(`creating a release`);
const release = await octokit.rest.repos.createRelease({
owner,
repo,
name,
tag_name: name,
target_commitish: sha,
prerelease: name === "nightly",
});
const release_id = release.data.id;
// Upload all the relevant assets for this release as just general blobs.
for (const file of glob.sync(files)) {
const size = fs.statSync(file).size;
const name = path.basename(file);
await runWithRetry(async function () {
// We can't overwrite assets, so remove existing ones from a previous try.
let assets = await octokit.rest.repos.listReleaseAssets({
owner,
repo,
release_id,
});
for (const asset of assets.data) {
if (asset.name === name) {
core.info(`delete asset ${name}`);
const asset_id = asset.id;
await octokit.rest.repos.deleteReleaseAsset({ owner, repo, asset_id });
}
}
core.info(`upload ${file}`);
const headers = { "content-length": size, "content-type": "application/octet-stream" };
const data = fs.createReadStream(file);
await octokit.rest.repos.uploadReleaseAsset({
data,
headers,
name,
url: release.data.upload_url,
});
});
}
}
async function runWithRetry(f) {
const retries = 10;
const maxDelay = 4000;
let delay = 1000;
for (let i = 0; i < retries; i++) {
try {
await f();
break;
} catch (e) {
if (i === retries - 1) throw e;
core.error(e);
const currentDelay = Math.round(Math.random() * delay);
core.info(`sleeping ${currentDelay} ms`);
await sleep(currentDelay);
delay = Math.min(delay * 2, maxDelay);
}
}
}
async function run() {
await runWithRetry(runOnce);
}
run().catch((err) => {
core.error(err);
core.setFailed(err.message);
});

View File

@ -1,10 +0,0 @@
{
"name": "wasmtime-github-release",
"version": "0.0.0",
"main": "main.js",
"dependencies": {
"@actions/core": "^1.6",
"@actions/github": "^5.0",
"glob": "^7.1.5"
}
}

View File

@ -7,11 +7,11 @@ if [[ ! -f "test-results/.last-run.json" ]]; then
# if no last run artifact, than run plawright normally # if no last run artifact, than run plawright normally
echo "run playwright normally" echo "run playwright normally"
if [[ "$3" == *ubuntu* ]]; then if [[ "$3" == *ubuntu* ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --shard=$1/$2 || true xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm test:playwright:electron:ubuntu -- --shard=$1/$2 || true
elif [[ "$3" == *windows* ]]; then elif [[ "$3" == *windows* ]]; then
yarn test:playwright:electron:windows -- --shard=$1/$2 || true pnpm test:playwright:electron:windows -- --shard=$1/$2 || true
elif [[ "$3" == *macos* ]]; then elif [[ "$3" == *macos* ]]; then
yarn test:playwright:electron:macos -- --shard=$1/$2 || true pnpm test:playwright:electron:macos -- --shard=$1/$2 || true
else else
echo "Do not run playwright. Unable to detect os runtime." echo "Do not run playwright. Unable to detect os runtime."
exit 1 exit 1
@ -31,11 +31,11 @@ while [[ $retry -le $max_retrys ]]; do
echo "retried=true" >>$GITHUB_OUTPUT echo "retried=true" >>$GITHUB_OUTPUT
echo "run playwright with last failed tests and retry $retry" echo "run playwright with last failed tests and retry $retry"
if [[ "$3" == *ubuntu* ]]; then if [[ "$3" == *ubuntu* ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --last-failed || true xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm test:playwright:electron:ubuntu -- --last-failed || true
elif [[ "$3" == *windows* ]]; then elif [[ "$3" == *windows* ]]; then
yarn test:playwright:electron:windows -- --last-failed || true pnpm test:playwright:electron:windows -- --last-failed || true
elif [[ "$3" == *macos* ]]; then elif [[ "$3" == *macos* ]]; then
yarn test:playwright:electron:macos -- --last-failed || true pnpm test:playwright:electron:macos -- --last-failed || true
else else
echo "Do not run playwright. Unable to detect os runtime." echo "Do not run playwright. Unable to detect os runtime."
exit 1 exit 1

366
.github/dependabot.yml vendored
View File

@ -1,331 +1,41 @@
# DO NOT EDIT THIS FILE. This dependabot file was generated # To get started with Dependabot version updates, you'll need to specify which
# by https://github.com/KittyCAD/ciso Changes to this file should be addressed in # package ecosystems to update and where the package manifests are located.
# the ciso repository. # Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2 version: 2
updates: updates:
- package-ecosystem: github-actions - package-ecosystem: 'npm' # See documentation for possible values
directory: / directories:
schedule: - '/'
interval: weekly - '/packages/codemirror-lang-kcl/'
day: monday - '/packages/codemirror-lsp-client/'
time: '03:00' schedule:
timezone: America/Los_Angeles interval: weekly
open-pull-requests-limit: 5 day: monday
groups: reviewers:
security: - franknoirot
applies-to: security-updates - irev-dev
update-types: - package-ecosystem: 'github-actions' # See documentation for possible values
- major directory: '/' # Location of package manifests
- minor schedule:
- patch interval: weekly
patch: day: monday
applies-to: version-updates reviewers:
update-types: - adamchalmers
- patch - jessfraz
major: - package-ecosystem: 'cargo' # See documentation for possible values
applies-to: version-updates directory: '/src/wasm-lib/' # Location of package manifests
update-types: schedule:
- major interval: weekly
minor: day: monday
applies-to: version-updates reviewers:
update-types: - adamchalmers
- minor - jessfraz
- patch groups:
- package-ecosystem: cargo serde-dependencies:
directory: /rust patterns:
schedule: - "serde*"
interval: weekly wasm-bindgen-deps:
day: monday patterns:
time: '03:00' - "wasm-bindgen*"
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /rust/kcl-language-server
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /packages/codemirror-lang-kcl
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /packages/codemirror-lsp-client
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /.github/actions/github-release
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: pip
directory: /public/kcl-samples
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: pip
directory: /rust/kcl-python-bindings
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: docker
directory: /.github/actions/github-release
schedule:
interval: weekly
day: monday
time: '03:00'
timezone: America/Los_Angeles
open-pull-requests-limit: 5
reviewers:
- adamchalmers
- franknoirot
- irev-dev
- jessfraz
groups:
security:
applies-to: security-updates
update-types:
- major
- minor
- patch
patch:
applies-to: version-updates
update-types:
- patch
major:
applies-to: version-updates
update-types:
- major
minor:
applies-to: version-updates
update-types:
- minor
- patch

View File

@ -10,33 +10,28 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- name: Install dependencies - name: Install dependencies
run: yarn run: pnpm install
- name: Use correct Rust toolchain - name: Setup Rust
shell: bash uses: dtolnay/rust-toolchain@stable
run: | - name: Cache wasm
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Configured below.
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
with:
tool: wasm-pack
- name: Rust Cache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: rust workspaces: './src/wasm-lib'
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- name: build wasm - name: build wasm
run: yarn build:wasm run: pnpm build:wasm
# Upload the WASM bundle as an artifact # Upload the WASM bundle as an artifact
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: wasm-bundle name: wasm-bundle
path: rust/kcl-wasm-lib/pkg path: src/wasm-lib/pkg

View File

@ -5,6 +5,7 @@ on:
push: push:
branches: branches:
- main - main
- pierremtb/adhoc/pnpm
tags: tags:
- 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+'
- 'nightly-v[0-9]+.[0-9]+.[0-9]+' - 'nightly-v[0-9]+.[0-9]+.[0-9]+'
@ -26,84 +27,42 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- id: filter - name: Setup Rust
name: Check for Rust changes uses: dtolnay/rust-toolchain@stable
uses: dorny/paths-filter@v3
- uses: Swatinem/rust-cache@v2
with: with:
filters: | workspaces: './src/wasm-lib'
rust:
- 'rust/**'
- name: Download Wasm Cache # TODO: see if we can fetch from main instead if no diff at src/wasm-lib
id: download-wasm - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
if: ${{ github.event_name == 'pull_request' && steps.filter.outputs.rust == 'false' }}
uses: dawidd6/action-download-artifact@v7
continue-on-error: true
with:
github_token: ${{secrets.GITHUB_TOKEN}}
name: wasm-bundle
workflow: build-and-store-wasm.yml
branch: main
path: rust/kcl-wasm-lib/pkg
- name: Build WASM condition
id: wasm
run: |
set -euox pipefail
# Build wasm if this is a push to main or tag, there are Rust changes, or
# downloading from the wasm cache failed.
if [[ ${{github.event_name}} == 'push' || ${{steps.filter.outputs.rust}} == 'true' || ${{steps.download-wasm.outcome}} == 'failure' ]]; then
echo "should-build-wasm=true" >> $GITHUB_OUTPUT
else
echo "should-build-wasm=false" >> $GITHUB_OUTPUT
fi
- name: Use correct Rust toolchain
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Configured below.
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
with: with:
tool: wasm-pack tool: wasm-pack
- name: Rust Cache
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Run build:wasm - name: Run build:wasm
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }} run: "pnpm build:wasm"
run: "yarn build:wasm"
- name: Set nightly version, product name, release notes, and icons - name: Set nightly version, product name, release notes, and icons
if: ${{ env.IS_NIGHTLY == 'true' }} if: ${{ env.IS_NIGHTLY == 'true' }}
run: | run: |
export VERSION=${GITHUB_REF_NAME#nightly-v} export VERSION=${GITHUB_REF_NAME#nightly-v}
yarn files:set-version pnpm files:set-version
yarn files:flip-to-nightly pnpm files:flip-to-nightly
- name: Set release version - name: Set release version
if: ${{ env.IS_RELEASE == 'true' }} if: ${{ env.IS_RELEASE == 'true' }}
run: | run: |
export VERSION=${GITHUB_REF_NAME#v} export VERSION=${GITHUB_REF_NAME#v}
yarn files:set-version pnpm files:set-version
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
@ -111,7 +70,7 @@ jobs:
path: | path: |
package.json package.json
electron-builder.yml electron-builder.yml
rust/kcl-wasm-lib/pkg/kcl_wasm_lib* src/wasm-lib/pkg/wasm_lib*
release-notes.md release-notes.md
assets/icon.ico assets/icon.ico
assets/icon.png assets/icon.png
@ -161,27 +120,28 @@ jobs:
ls -R prepared-files ls -R prepared-files
cp prepared-files/package.json package.json cp prepared-files/package.json package.json
cp prepared-files/electron-builder.yml electron-builder.yml cp prepared-files/electron-builder.yml electron-builder.yml
cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg mkdir src/wasm-lib/pkg
cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib* rust/kcl-wasm-lib/pkg cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg
cp prepared-files/release-notes.md release-notes.md cp prepared-files/release-notes.md release-notes.md
cp prepared-files/assets/icon.ico assets/icon.ico cp prepared-files/assets/icon.ico assets/icon.ico
cp prepared-files/assets/icon.png assets/icon.png cp prepared-files/assets/icon.png assets/icon.png
- uses: pnpm/action-setup@v4
- name: Sync node version and setup cache - name: Sync node version and setup cache
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' # Set this to npm, yarn or pnpm. cache: 'pnpm' # Set this to npm, pnpm or pnpm.
- name: yarn install - name: pnpm install
# Windows is picky sometimes and fails on fetch. Step takes about ~30s # Windows is picky sometimes and fails on fetch. Step takes about ~30s
uses: nick-fields/retry@v3.0.2 uses: nick-fields/retry@v3.0.1
with: with:
shell: bash
timeout_minutes: 2 timeout_minutes: 2
max_attempts: 3 max_attempts: 3
command: yarn install command: pnpm install
- name: Prepare certificate and variables (Windows only) - name: Prepare certificate and variables (Windows only)
if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }} if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }}
@ -213,7 +173,7 @@ jobs:
if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }} if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }}
# electron-builder doesn't have a concept of release vs debug, # electron-builder doesn't have a concept of release vs debug,
# this is just not doing any codesign or release yml generation, and points to dev infra # this is just not doing any codesign or release yml generation, and points to dev infra
run: yarn tronb:package:dev run: pnpm tronb:package:dev
- name: Build the app (release) - name: Build the app (release)
if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }} if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }}
@ -228,12 +188,11 @@ jobs:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
DEBUG: "electron-notarize*" DEBUG: "electron-notarize*"
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
uses: nick-fields/retry@v3.0.2 uses: nick-fields/retry@v3.0.1
with: with:
shell: bash
timeout_minutes: 10 timeout_minutes: 10
max_attempts: 3 max_attempts: 3
command: yarn tronb:package:prod command: pnpm tronb:package:prod
- name: List artifacts in out/ - name: List artifacts in out/
run: ls -R out run: ls -R out
@ -290,12 +249,11 @@ jobs:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
DEBUG: "electron-notarize*" DEBUG: "electron-notarize*"
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
uses: nick-fields/retry@v3.0.2 uses: nick-fields/retry@v3.0.1
with: with:
shell: bash
timeout_minutes: 10 timeout_minutes: 10
max_attempts: 3 max_attempts: 3
command: yarn tronb:package:prod command: pnpm tronb:package:prod
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ env.IS_RELEASE == 'true' }} if: ${{ env.IS_RELEASE == 'true' }}
@ -435,7 +393,7 @@ jobs:
export TAG="nightly-${VERSION}" export TAG="nightly-${VERSION}"
export PREVIOUS_TAG=$(git tag --list --sort=-committerdate "nightly-v[0-9]*" | head -n2 | tail -n1) export PREVIOUS_TAG=$(git tag --list --sort=-committerdate "nightly-v[0-9]*" | head -n2 | tail -n1)
export NOTES=$(./scripts/get-nightly-changelog.sh) export NOTES=$(./scripts/get-nightly-changelog.sh)
yarn files:set-notes pnpm files:set-notes
- name: Authenticate to Google Cloud - name: Authenticate to Google Cloud
if: ${{ env.IS_NIGHTLY == 'true' }} if: ${{ env.IS_NIGHTLY == 'true' }}
@ -460,4 +418,4 @@ jobs:
- name: Invalidate bucket cache on latest*.yml and last_download.json files - name: Invalidate bucket cache on latest*.yml and last_download.json files
if: ${{ env.IS_NIGHTLY == 'true' }} if: ${{ env.IS_NIGHTLY == 'true' }}
run: yarn files:invalidate-bucket:nightly run: pnpm files:invalidate-bucket:nightly

View File

@ -1,62 +0,0 @@
on:
push:
branches:
- main
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- .github/workflows/cargo-bench.yml
pull_request:
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- .github/workflows/cargo-bench.yml
workflow_dispatch:
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: cargo bench
jobs:
cargo-bench:
name: cargo bench
runs-on:
- runs-on=${{ github.run_id }}
- runner=32cpu-linux-x64
- extras=s3-cache
steps:
- uses: runs-on/action@v1
- uses: actions/checkout@v4
- name: Use correct Rust toolchain
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: rust
- name: Install dependencies
run: |
cargo install cargo-criterion
cargo install cargo-codspeed
cd rust/kcl-lib
cargo add --dev codspeed-criterion-compat --rename criterion
- name: Build the benchmark target(s)
run: |
cd rust
cargo codspeed build --measurement-mode walltime
- name: Run the benchmarks
uses: CodSpeedHQ/action@v3
with:
working-directory: rust
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}
mode: walltime
env:
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}

View File

@ -17,20 +17,23 @@ jobs:
cargocheck: cargocheck:
name: cargo check name: cargo check
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use correct Rust toolchain - name: Install latest rust
shell: bash uses: actions-rs/toolchain@v1
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
cache-workspaces: rust toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1
- name: Run check - name: Run check
run: | run: |
cd rust cd "${{ matrix.dir }}"
# We specifically want to test the disable-println feature # We specifically want to test the disable-println feature
# Since it is not enabled by default, we need to specify it # Since it is not enabled by default, we need to specify it
# This is used in kcl-lsp # This is used in kcl-lsp

View File

@ -23,22 +23,25 @@ jobs:
cargoclippy: cargoclippy:
name: cargo clippy name: cargo clippy
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: taiki-e/install-action@just - uses: taiki-e/install-action@just
- name: Use correct Rust toolchain - name: Install latest rust
shell: bash uses: actions-rs/toolchain@v1
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
cache-workspaces: rust toolchain: stable
components: clippy override: true
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1
- name: Run clippy - name: Run clippy
run: | run: |
cd rust cd "${{ matrix.dir }}"
just lint just lint
# If this fails, run "cargo check" to update Cargo.lock, # If this fails, run "cargo check" to update Cargo.lock,
# then add Cargo.lock to the PR. # then add Cargo.lock to the PR.

View File

@ -26,20 +26,23 @@ jobs:
cargofmt: cargofmt:
name: cargo fmt name: cargo fmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use correct Rust toolchain - name: Install latest rust
shell: bash uses: actions-rs/toolchain@v1
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
cache-workspaces: rust toolchain: stable
components: rustfmt override: true
components: rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1
- name: Run cargo fmt - name: Run cargo fmt
run: | run: |
cd rust cd "${{ matrix.dir }}"
cargo fmt -- --check cargo fmt -- --check
shell: bash shell: bash

View File

@ -5,35 +5,25 @@ on:
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
permissions: permissions: read-all
contents: read
pull-requests: write
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true cancel-in-progress: true
name: cargo test name: cargo test of wasm-lib
jobs: jobs:
cargotest: cargotest:
name: cargo test name: cargo test
runs-on: ubuntu-latest-8-cores runs-on: ubuntu-latest-8-cores
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install latest rust
uses: actions-rs/toolchain@v1
with: with:
token: ${{ steps.app-token.outputs.token }} toolchain: stable
- name: Use correct Rust toolchain override: true
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Configured below.
- name: Install vector - name: Install vector
run: | run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
@ -50,95 +40,22 @@ jobs:
${HOME}/.vector/bin/vector --config /tmp/vector.toml & ${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- uses: taiki-e/install-action@cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest - uses: taiki-e/install-action@nextest
- name: Install just
uses: taiki-e/install-action@just
- name: Install cargo-insta
shell: bash
run: |
cargo install cargo-insta
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2.6.1
with:
workspaces: rust
- name: Fetch the base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Check for path changes
id: path-changes
shell: bash
run: |
set -euo pipefail
# Manual runs or push should run all tests.
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
exit 0
fi
changed_files=$(git diff --name-only origin/${{ github.base_ref }})
echo "$changed_files"
if grep -Evq '^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
else
echo "outside-kcl-samples=false" >> $GITHUB_OUTPUT
fi
- name: cargo test only kcl-samples
id: cargo-test-kcl-samples
if: steps.path-changes.outputs.outside-kcl-samples == 'false'
continue-on-error: true
shell: bash
run: |
set -euo pipefail
cd rust
cargo nextest run --workspace --retries=2 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
RUST_BACKTRACE: full
RUST_MIN_STACK: 10485760000
- name: Commit differences
if: steps.path-changes.outputs.outside-kcl-samples == 'false' && steps.cargo-test-kcl-samples.outcome == 'failure'
shell: bash
run: |
set -euo pipefail
cd rust
just overwrite-sim-test kcl_samples
git add kcl-lib/tests
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
if ! git commit -m "Update kcl-samples simulation test output" ; then
echo "No changes to commit"
# This only runs if tests failed, so we should fail the step.
exit 1
fi
git push origin ${{ github.head_ref }}
env:
# The default is auto, and insta behaves differently in CI vs. not.
INSTA_UPDATE: always
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
# Configure nextest when it's run by insta (via just).
NEXTEST_PROFILE: ci
RUST_BACKTRACE: full
RUST_MIN_STACK: 10485760000
- name: cargo test - name: cargo test
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
shell: bash shell: bash
run: |- run: |-
cd rust cd "${{ matrix.dir }}"
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --test-threads=1 --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
env: env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
RUST_MIN_STACK: 10485760000 RUST_MIN_STACK: 10485760000
- name: Upload to codecov.io - name: Upload to codecov.io
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
uses: codecov/codecov-action@v5 uses: codecov/codecov-action@v5
with: with:
token: ${{secrets.CODECOV_TOKEN}} token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true fail_ci_if_error: true
flags: rust flags: wasm-lib
verbose: true verbose: true
files: lcov.info files: lcov.info

View File

@ -1,48 +0,0 @@
name: Check kcl-samples files for proper header structure
on:
pull_request:
paths:
- 'public/kcl-samples/**/*.kcl'
- .github/workflows/check-kcl-header.yml
branches:
- main
push:
paths:
- 'public/kcl-samples/**/*.kcl'
- .github/workflows/check-kcl-header.yml
branches:
- main
permissions:
contents: read
jobs:
check-kcl-header:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check KCL files for header comment block and blank line
run: |
files=$(find public/kcl-samples -type f -name '*.kcl')
failed_files=()
for file in $files; do
if ! awk '
NR == 1 && $0 !~ /^\/\// { exit 1 }
BEGIN { in_comment = 1 }
NF == 0 && in_comment == 1 { in_comment = 0; next }
$1 !~ /^\/\// && in_comment == 1 { exit 1 }
in_comment == 0 && NF > 0 { exit 0 }
END { if (in_comment == 1) exit 1 }
' "$file"; then
failed_files+=("$file")
fi
done
if [ ${#failed_files[@]} -ne 0 ]; then
echo "One or more KCL files do not begin with a header comment block followed by a blank line:"
printf '%s\n' "${failed_files[@]}"
exit 1
fi

View File

@ -16,17 +16,19 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
working-directory: packages/codemirror-lang-kcl working-directory: packages/codemirror-lang-kcl
- run: yarn tsc - run: pnpm tsc
working-directory: packages/codemirror-lang-kcl working-directory: packages/codemirror-lang-kcl
- name: run unit tests - name: run unit tests
run: yarn test run: pnpm test
working-directory: packages/codemirror-lang-kcl working-directory: packages/codemirror-lang-kcl

View File

@ -1,7 +1,7 @@
name: E2E Tests name: E2E Tests
on: on:
push: push:
branches: [ main ] branches: [ main, pierremtb/adhoc/pnpm]
pull_request: pull_request:
schedule: schedule:
- cron: 0 * * * * # hourly - cron: 0 * * * * # hourly
@ -17,271 +17,7 @@ permissions:
jobs: jobs:
conditions:
runs-on: ubuntu-latest
outputs:
significant: ${{ steps.path-changes.outputs.significant }}
should-run: ${{ steps.should-run.outputs.should-run }}
steps:
- uses: actions/checkout@v4
- name: Fetch the base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Check for path changes
id: path-changes
shell: bash
run: |
set -euo pipefail
# Manual runs or push should run all tests.
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
echo "significant=true" >> $GITHUB_OUTPUT
exit 0
fi
changed_files=$(git diff --name-only origin/${{ github.base_ref }})
echo "$changed_files"
if grep -Evq '^README.md|^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
echo "significant=true" >> $GITHUB_OUTPUT
else
echo "significant=false" >> $GITHUB_OUTPUT
fi
- name: Should run
id: should-run
shell: bash
run: |
set -euo pipefail
# We should run when this is a scheduled run or if there are
# significant changes in the diff.
if [[ ${{ github.event_name }} == 'schedule' || ${{ steps.path-changes.outputs.significant }} == 'true' ]]; then
echo "should-run=true" >> $GITHUB_OUTPUT
else
echo "should-run=false" >> $GITHUB_OUTPUT
fi
- name: Display conditions
shell: bash
run: |
# For debugging purposes.
set -euo pipefail
echo "significant: ${{ steps.path-changes.outputs.significant }}"
echo "should-run: ${{ steps.should-run.outputs.should-run }}"
prepare-wasm:
# seperate job on Ubuntu to build or fetch the wasm blob once on the fastest runner
runs-on: namespace-profile-ubuntu-8-cores
needs: conditions
steps:
- uses: actions/checkout@v4
if: needs.conditions.outputs.should-run == 'true'
- id: filter
if: needs.conditions.outputs.should-run == 'true'
name: Check for Rust changes
uses: dorny/paths-filter@v3
with:
filters: |
rust:
- 'rust/**'
- uses: actions/setup-node@v4
if: needs.conditions.outputs.should-run == 'true'
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
if: needs.conditions.outputs.should-run == 'true'
run: yarn
- name: Download Wasm Cache
id: download-wasm
if: ${{ needs.conditions.outputs.should-run == 'true' && github.event_name != 'schedule' && steps.filter.outputs.rust == 'false' }}
uses: dawidd6/action-download-artifact@v7
continue-on-error: true
with:
github_token: ${{secrets.GITHUB_TOKEN}}
name: wasm-bundle
workflow: build-and-store-wasm.yml
branch: main
path: rust/kcl-wasm-lib/pkg
- name: Build WASM condition
id: wasm
if: needs.conditions.outputs.should-run == 'true'
run: |
set -euox pipefail
# Build wasm if this is a scheduled run, there are Rust changes, or
# downloading from the wasm cache failed.
if [[ ${{github.event_name}} == 'schedule' || ${{steps.filter.outputs.rust}} == 'true' || ${{steps.download-wasm.outcome}} == 'failure' ]]; then
echo "should-build-wasm=true" >> $GITHUB_OUTPUT
else
echo "should-build-wasm=false" >> $GITHUB_OUTPUT
fi
- name: Use correct Rust toolchain
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
shell: bash
run: |
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
- name: Install rust
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Configured below.
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
with:
tool: wasm-pack
- name: Rust Cache
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
uses: Swatinem/rust-cache@v2
with:
workspaces: './rust'
- name: Build Wasm
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
shell: bash
run: yarn build:wasm
- uses: actions/upload-artifact@v4
if: needs.conditions.outputs.should-run == 'true'
with:
name: prepared-wasm
path: |
rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
snapshots:
name: playwright:snapshots:ubuntu
runs-on: namespace-profile-ubuntu-8-cores
needs: [conditions, prepare-wasm]
steps:
- uses: actions/create-github-app-token@v1
if: needs.conditions.outputs.should-run == 'true'
id: app-token
with:
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
if: needs.conditions.outputs.should-run == 'true'
with:
token: ${{ steps.app-token.outputs.token }}
- uses: actions/download-artifact@v4
if: needs.conditions.outputs.should-run == 'true'
name: prepared-wasm
- name: Copy prepared wasm
if: needs.conditions.outputs.should-run == 'true'
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- uses: actions/setup-node@v4
if: needs.conditions.outputs.should-run == 'true'
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
id: deps-install
if: needs.conditions.outputs.should-run == 'true'
run: yarn
- name: Cache Playwright Browsers
if: needs.conditions.outputs.should-run == 'true'
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers
if: needs.conditions.outputs.should-run == 'true'
run: yarn playwright install --with-deps
- name: build web
if: needs.conditions.outputs.should-run == 'true'
run: yarn tronb:vite:dev
- name: Run ubuntu/chrome snapshots
if: needs.conditions.outputs.should-run == 'true'
run: |
yarn test:snapshots
env:
CI: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
with:
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true
- name: Clean up test-results
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
continue-on-error: true
run: rm -r test-results
- name: check for changes
if: ${{ needs.conditions.outputs.should-run == 'true' && matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
shell: bash
id: git-check
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
if git status | grep -q "Changes to be committed"
then echo "modified=true" >> $GITHUB_OUTPUT
else echo "modified=false" >> $GITHUB_OUTPUT
fi
- name: Commit changes, if any
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
shell: bash
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
git push
git push origin ${{ github.head_ref }}
# only upload artifacts if there's actually changes
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
with:
name: playwright-report-ubuntu-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
electron: electron:
needs: [conditions, prepare-wasm]
timeout-minutes: 60 timeout-minutes: 60
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }} name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
strategy: strategy:
@ -294,93 +30,200 @@ jobs:
# TODO: add ref here for main and latest release tag # TODO: add ref here for main and latest release tag
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/create-github-app-token@v1
if: needs.conditions.outputs.should-run == 'true' id: app-token
with:
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- id: filter
name: Check for Rust changes
uses: dorny/paths-filter@v3
with:
filters: |
rust:
- 'src/wasm-lib/**'
- uses: pnpm/action-setup@v4
# TODO: remove this
- run: npm install --global --force corepack@latest
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- uses: KittyCAD/action-install-cli@main
- name: Install dependencies
shell: bash
run: pnpm install
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm.lock') }}
- name: Install Playwright Browsers
shell: bash
run: pnpm playwright install --with-deps
- name: Download Wasm Cache
id: download-wasm
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
uses: dawidd6/action-download-artifact@v7
continue-on-error: true
with:
github_token: ${{secrets.GITHUB_TOKEN}}
name: wasm-bundle
workflow: build-and-store-wasm.yml
branch: main
path: src/wasm-lib/pkg
- name: copy wasm blob
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
shell: bash
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
continue-on-error: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- name: Cache Wasm (because rust diff)
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
uses: Swatinem/rust-cache@v2
with:
workspaces: './src/wasm-lib'
- name: OR Cache Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure'
uses: Swatinem/rust-cache@v2
with:
workspaces: './src/wasm-lib'
- name: install good sed
if: ${{ startsWith(matrix.os, 'macos') }}
shell: bash
run: |
brew install gnu-sed
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- name: Install vector
shell: bash
# TODO: figure out what to do with this, it's failing
if: false
run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
chmod +x /tmp/vector.sh
/tmp/vector.sh -y -no-modify-path
mkdir -p /tmp/vector
cp .github/workflows/vector.toml /tmp/vector.toml
sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml
sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml
sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml
sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
cat /tmp/vector.toml
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- name: Build Wasm (because rust diff)
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
shell: bash
run: pnpm build:wasm
- name: OR Build Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure'
shell: bash
run: pnpm build:wasm
- name: build web
shell: bash
run: pnpm tronb:vite:dev
- name: Run ubuntu/chrome snapshots
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
shell: bash
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
run: |
PLATFORM=web pnpm playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --trace=on --shard=1/1
env:
CI: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }}
with:
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true
- name: Clean up test-results
if: ${{ !cancelled() && (success() || failure()) }}
continue-on-error: true
run: rm -r test-results
- name: check for changes
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
shell: bash
id: git-check
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
if git status | grep -q "Changes to be committed"
then echo "modified=true" >> $GITHUB_OUTPUT
else echo "modified=false" >> $GITHUB_OUTPUT
fi
- name: Commit changes, if any
if: steps.git-check.outputs.modified == 'true'
shell: bash
run: |
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
git push
git push origin ${{ github.head_ref }}
# only upload artifacts if there's actually changes
- uses: actions/upload-artifact@v4
if: steps.git-check.outputs.modified == 'true'
with:
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
- uses: actions/download-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }}
continue-on-error: true
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
- name: Run playwright/electron flow (with retries)
id: retry
if: ${{ !cancelled() && (success() || failure()) }}
uses: nick-fields/retry@v3.0.1
with:
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
timeout_minutes: 30
max_attempts: 25
env:
CI: true
FAIL_ON_CONSOLE_ERRORS: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
include-hidden-files: true
retention-days: 30
overwrite: true
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true
- uses: actions/download-artifact@v4
if: needs.conditions.outputs.should-run == 'true'
name: prepared-wasm
- name: Copy prepared wasm
if: needs.conditions.outputs.should-run == 'true'
run: |
ls -R prepared-wasm
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
mkdir rust/kcl-wasm-lib/pkg
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
- uses: actions/setup-node@v4
if: needs.conditions.outputs.should-run == 'true'
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
id: deps-install
if: needs.conditions.outputs.should-run == 'true'
run: yarn
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Build web
if: needs.conditions.outputs.should-run == 'true'
run: yarn tronb:vite:dev
- name: Install good sed
if: startsWith(matrix.os, 'macos')
shell: bash
run: |
brew install gnu-sed
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
# TODO: Add back axiom logs
- uses: actions/download-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
continue-on-error: true
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
- name: Run playwright/electron flow (with retries)
id: retry
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && steps.deps-install.outcome == 'success' }}
uses: nick-fields/retry@v3.0.2
with:
shell: bash
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
timeout_minutes: 30
max_attempts: 25
env:
CI: true
FAIL_ON_CONSOLE_ERRORS: true
NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
with:
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/
include-hidden-files: true
retention-days: 30
overwrite: true
- uses: actions/upload-artifact@v4
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
with:
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/
include-hidden-files: true
retention-days: 30
overwrite: true

View File

@ -18,13 +18,14 @@ jobs:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- run: yarn generate:machine-api - run: pnpm generate:machine-api
- run: yarn fmt - run: pnpm fmt
- name: check for changes - name: check for changes
id: git-check id: git-check
run: | run: |

View File

@ -5,7 +5,6 @@ on:
paths: paths:
- .github/workflows/generate-website-docs.yml - .github/workflows/generate-website-docs.yml
- 'docs/**' - 'docs/**'
- 'public/kcl-samples/**'
pull_request: pull_request:
paths: paths:
- .github/workflows/generate-website-docs.yml - .github/workflows/generate-website-docs.yml
@ -40,21 +39,9 @@ jobs:
# cleanup old # cleanup old
rm -rf documentation/content/pages/docs/kcl/*.md rm -rf documentation/content/pages/docs/kcl/*.md
rm -rf documentation/content/pages/docs/kcl/types rm -rf documentation/content/pages/docs/kcl/types
rm -rf documentation/content/pages/docs/kcl/settings
rm -rf documentation/content/pages/docs/kcl/consts
# move new # move new
mv -f docs/kcl/*.md documentation/content/pages/docs/kcl/ mv -f docs/kcl/*.md documentation/content/pages/docs/kcl/
mv -f docs/kcl/types documentation/content/pages/docs/kcl/ mv -f docs/kcl/types documentation/content/pages/docs/kcl/
mv -f docs/kcl/settings documentation/content/pages/docs/kcl/
mv -f docs/kcl/consts documentation/content/pages/docs/kcl/
- name: move kcl-samples
shell: bash
run: |
mkdir -p documentation/content/pages/docs/kcl-samples
# cleanup old
rm -rf documentation/content/pages/docs/kcl-samples/*
# move new
mv -f public/kcl-samples/* documentation/content/pages/docs/kcl-samples/
- name: commit the changes in the docs repo - name: commit the changes in the docs repo
shell: bash shell: bash
run: | run: |

View File

@ -1,401 +0,0 @@
name: kcl-language-server
on:
push:
branches:
- main
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-language-server/**'
- '**.rs'
- .github/workflows/kcl-language-server.yml
tags:
- 'kcl-*'
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-language-server/**'
- '**.rs'
- .github/workflows/kcl-language-server.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTFLAGS: ""
RUSTUP_MAX_RETRIES: 10
FETCH_DEPTH: 0 # pull in the tags for the version string
MACOSX_DEPLOYMENT_TARGET: 10.15
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
jobs:
test:
name: vscode tests
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
yarn install
cd rust/kcl-language-server
yarn install
- name: Run tests
run: |
cd rust/kcl-language-server
yarn build
yarn test-compile
ls -la dist
xvfb-run -a yarn test
if: runner.os == 'Linux'
- name: Run tests
run: |
cd rust/kcl-language-server
yarn test
if: runner.os != 'Linux'
build-release:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target:
win32-x64
#- os: windows-latest
#target: i686-pc-windows-msvc
#code-target:
#win32-ia32
#- os: windows-latest
#target: aarch64-pc-windows-msvc
#code-target: win32-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target:
linux-x64
#- os: ubuntu-latest
#target: aarch64-unknown-linux-musl
#code-target: linux-arm64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
- os: ubuntu-latest
target: arm-unknown-linux-gnueabihf
code-target: linux-armhf
- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64
name: build-release (${{ matrix.target }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
RA_TARGET: ${{ matrix.target }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Use correct Rust toolchain
shell: bash
run: |
rm rust/rust-toolchain.toml
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: rust
components: rust-src
target: ${{ matrix.target }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Update apt repositories
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf' || matrix.os == 'ubuntu-latest'
run: sudo apt-get update
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Install deps
shell: bash
run: |
sudo apt install -y \
ca-certificates \
clang \
cmake \
curl \
g++ \
gcc \
gcc-mingw-w64-i686 \
gcc-mingw-w64 \
jq \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
libssl-dev \
libxml2-dev \
mingw-w64 \
wget \
zlib1g-dev
cargo install cross
- name: Install AArch64 target toolchain
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get install gcc-aarch64-linux-gnu
- name: Install ARM target toolchain
if: matrix.target == 'arm-unknown-linux-gnueabihf'
run: sudo apt-get install gcc-arm-linux-gnueabihf
- name: build
run: |
cd rust
cargo kcl-language-server-release build --client-patch-version ${{ github.run_number }}
- name: Install dependencies
run: |
cd rust/kcl-language-server
yarn install
- name: Package Extension (release)
if: startsWith(github.event.ref, 'refs/tags/')
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
- name: Package Extension (nightly)
if: startsWith(github.event.ref, 'refs/tags/') == false
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
- name: remove server
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
cd rust/kcl-language-server
rm -rf server
- name: Package Extension (no server, release)
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/')
run: |
cd rust/kcl-language-server
npx vsce package -o ../build/kcl-language-server-no-server.vsix
- name: Package Extension (no server, nightly)
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/') == false
run: |
cd rust/kcl-language-server
npx vsce package -o ../build/kcl-language-server-no-server.vsix --pre-release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.target }}
path: ./rust/build
build-release-x86_64-unknown-linux-musl:
name: build-release (x86_64-unknown-linux-musl)
runs-on: ubuntu-latest
env:
RA_TARGET: x86_64-unknown-linux-musl
# For some reason `-crt-static` is not working for clang without lld
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
container:
image: alpine:latest
volumes:
- /usr/local/cargo/registry:/usr/local/cargo/registry
steps:
- name: Install dependencies
run: |
apk add --no-cache \
bash \
curl \
git \
clang \
lld \
musl-dev \
nodejs \
yarn \
npm
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Use correct Rust toolchain
shell: bash
run: |
rm rust/rust-toolchain.toml
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: rust
components: rust-src
target: ${{ matrix.target }}
- name: build
run: |
cd rust
cargo kcl-language-server-release build --client-patch-version ${{ github.run_number }}
- name: Install dependencies
run: |
cd rust/kcl-language-server
yarn install
- name: Package Extension (release)
if: startsWith(github.event.ref, 'refs/tags/')
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64
- name: Package Extension (release)
if: startsWith(github.event.ref, 'refs/tags/') == false
run: |
cd rust/kcl-language-server
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64 --pre-release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-x86_64-unknown-linux-musl
path: ./rust/build
publish:
name: publish
runs-on: ubuntu-latest
needs: ["build-release", "build-release-x86_64-unknown-linux-musl"]
if: startsWith(github.event.ref, 'refs/tags')
permissions:
contents: write
steps:
- run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: 'echo "TAG: $TAG"'
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Install Nodejs
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- run: 'echo "HEAD_SHA: $HEAD_SHA"'
- uses: actions/download-artifact@v4
with:
name: release-aarch64-apple-darwin
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-apple-darwin
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-unknown-linux-gnu
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-unknown-linux-musl
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-aarch64-unknown-linux-gnu
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-arm-unknown-linux-gnueabihf
path: rust/build
- uses: actions/download-artifact@v4
with:
name: release-x86_64-pc-windows-msvc
path:
rust/build
#- uses: actions/download-artifact@v4
#with:
#name: release-i686-pc-windows-msvc
#path:
#build
#- uses: actions/download-artifact@v4
#with:
#name: release-aarch64-pc-windows-msvc
#path: rust/build
- run: ls -al ./rust/build
- name: Publish Release
uses: ./.github/actions/github-release
with:
files: "rust/build/*"
name: ${{ env.TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: move files to dir for upload
shell: bash
run: |
cd rust
mkdir -p releases/language-server/${{ env.TAG }}
cp -r build/* releases/language-server/${{ env.TAG }}
- name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v2.1.8"
with:
credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}"
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2.1.2
with:
project_id: kittycadapi
- name: "upload files to gcp"
id: upload-files
uses: google-github-actions/upload-cloud-storage@v2.2.2
with:
path: rust/releases
destination: dl.kittycad.io
- run: rm rust/build/kcl-language-server-no-server.vsix
- name: Publish Extension (Code Marketplace, release)
# token from https://dev.azure.com/kcl-language-server/
run: |
cd rust/kcl-language-server
npx vsce publish --pat ${{ secrets.VSCE_PAT }} --packagePath ../build/kcl-language-server-*.vsix
- name: Publish Extension (OpenVSX, release)
run: |
cd rust/kcl-language-server
npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../build/kcl-language-server-*.vsix
timeout-minutes: 2

View File

@ -1,182 +0,0 @@
# This file is autogenerated by maturin v1.6.0 and then modified
# To update, run
#
# maturin generate-ci github
#
name: kcl-python-bindings
on:
push:
branches:
- main
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-python-bindings/**'
- '**.rs'
- .github/workflows/kcl-python-bindings.yml
tags:
- 'kcl-*'
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-python-bindings/**'
- '**.rs'
- .github/workflows/kcl-python-bindings.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: x86_64
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
before-script-linux: |
yum install openssl-devel -y
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-x86_64
path: rust/kcl-python-bindings/dist
windows:
runs-on: windows-16-cores
strategy:
matrix:
target:
- x64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: rust/kcl-python-bindings/dist
macos:
runs-on: macos-latest
strategy:
matrix:
target:
- x86_64
- aarch64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: rust/kcl-python-bindings/dist
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@just
- name: Run tests
run: |
cd rust/kcl-python-bindings
just setup-uv
just test
env:
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install codespell
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install pip --upgrade
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: rust/kcl-python-bindings/dist
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
needs: [linux-x86_64, windows, macos, sdist]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: rust/kcl-python-bindings
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: do uv things
run: |
cd rust/kcl-python-bindings
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install pip --upgrade
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
working-directory: rust/kcl-python-bindings
command: upload
args: --non-interactive --skip-existing wheels-*/*

View File

@ -16,10 +16,12 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- name: Find tag workflow id - name: Find tag workflow id
id: tag_workflow_id id: tag_workflow_id
@ -105,7 +107,7 @@ jobs:
- name: Override release notes - name: Override release notes
env: env:
NOTES: ${{ github.event.release.body }} NOTES: ${{ github.event.release.body }}
run: yarn files:set-notes run: pnpm files:set-notes
- name: Authenticate to Google Cloud - name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v2.1.8' uses: 'google-github-actions/auth@v2.1.8'
@ -126,7 +128,7 @@ jobs:
destination: 'dl.kittycad.io/releases/modeling-app' destination: 'dl.kittycad.io/releases/modeling-app'
- name: Invalidate bucket cache on latest*.yml and last_download.json files - name: Invalidate bucket cache on latest*.yml and last_download.json files
run: yarn files:invalidate-bucket run: pnpm files:invalidate-bucket
- name: Upload release files to Github - name: Upload release files to Github
if: ${{ github.event_name == 'release' }} if: ${{ github.event_name == 'release' }}

View File

@ -1,24 +0,0 @@
name: ruff
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches: main
paths:
- '**.py'
- .github/workflows/ruff.yml
pull_request:
paths:
- '**.py'
- .github/workflows/ruff.yml
permissions:
contents: read
pull-requests: write
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3

View File

@ -20,61 +20,63 @@ jobs:
runs-on: 'ubuntu-22.04' runs-on: 'ubuntu-22.04'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- run: yarn fmt-check - run: pnpm fmt-check
yarn-build-wasm: yarn-build-wasm:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3 - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: pnpm build:wasm
yarn-tsc: yarn-tsc:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
workspaces: './rust' workspaces: './src/wasm-lib'
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3 - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: pnpm build:wasm
- run: yarn tsc - run: pnpm tsc
yarn-lint: yarn-lint:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install - run: pnpm lint
- run: yarn lint
python-codespell: python-codespell:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
@ -94,27 +96,29 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3 - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: pnpm build:wasm
- run: yarn simpleserver:bg - run: pnpm simpleserver:bg
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
- name: Install Chromium Browser - name: Install Chromium Browser
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn playwright install chromium --with-deps run: pnpm playwright install chromium --with-deps
- name: run unit tests for kcl samples - name: run unit tests for kcl samples
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn test:unit:kcl-samples run: pnpm test:unit:kcl-samples
env: env:
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
@ -123,27 +127,29 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'pnpm'
- run: yarn install - run: pnpm install
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3 - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with: with:
tool: wasm-pack tool: wasm-pack
- run: yarn build:wasm - run: pnpm build:wasm
- run: yarn simpleserver:bg - run: pnpm simpleserver:bg
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
- name: Install Chromium Browser - name: Install Chromium Browser
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn playwright install chromium --with-deps run: pnpm playwright install chromium --with-deps
- name: run unit tests - name: run unit tests
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: xvfb-run -a yarn test:unit run: pnpm test:unit
env: env:
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}

View File

@ -23,11 +23,13 @@ jobs:
with: with:
token: ${{ steps.app-token.outputs.token }} token: ${{ steps.app-token.outputs.token }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
- run: yarn install - run: pnpm install
- name: Push tag - name: Push tag
run: | run: |

41
.gitignore vendored
View File

@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies # dependencies
node_modules /node_modules
/.pnp /.pnp
.pnp.js .pnp.js
@ -9,7 +9,7 @@ node_modules
/coverage /coverage
# production # production
build /build
# misc # misc
.DS_Store .DS_Store
@ -26,19 +26,16 @@ yarn-error.log*
.idea .idea
.vscode .vscode
.helix .helix
src/wasm-lib/.idea
src/wasm-lib/.vscode
# rust # rust
rust/target src/wasm-lib/target
rust/kcl-lib/bindings src/wasm-lib/bindings
public/kcl_wasm_lib_bg.wasm src/wasm-lib/kcl/bindings
rust/lcov.info public/wasm_lib_bg.wasm
rust/kcl-wasm-lib/pkg src/wasm-lib/lcov.info
*.snap.new src/wasm-lib/grackle/test_json_output
rust/kcl-lib/fuzz/Cargo.lock
rust/kcl-language-server-release/Cargo.lock
# kcl language server package
rust/kcl-language-server/dist/
e2e/playwright/playwright-secrets.env e2e/playwright/playwright-secrets.env
e2e/playwright/temp1.png e2e/playwright/temp1.png
@ -51,33 +48,27 @@ e2e/playwright/export-snapshots/*
!e2e/playwright/export-snapshots/*.png !e2e/playwright/export-snapshots/*.png
!e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png !e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png
/public/kcl-samples.zip /kcl-samples
/public/kcl-samples/.github
/public/kcl-samples/screenshots/main.kcl
/public/kcl-samples/step/main.kcl
/test-results/ /test-results/
/playwright-report/ /playwright-report/
/blob-report/ /blob-report/
/playwright/.cache/ /playwright/.cache/
/src/lang/std/artifactMapCache /src/lang/std/artifactMapCache
## generated files ## generated files
src/**/*.typegen.ts src/**/*.typegen.ts
src/wasm-lib/grackle/stdlib_cube_partial.json
Mac_App_Distribution.provisionprofile Mac_App_Distribution.provisionprofile
*.tsbuildinfo *.tsbuildinfo
src/wasm-lib/pkg
.eslintcache .eslintcache
venv
.vite/ .vite/
# electron # electron
out/ out/
*.snap.new
# python
__pycache__/
uv.lock
dist
venv
.vscode-test

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh" . "$(dirname -- "$0")/_/husky.sh"
yarn fmt-check pnpm fmt-check

View File

@ -7,10 +7,11 @@ coverage
*.rs *.rs
*.hbs *.hbs
target target
src/wasm-lib/pkg
src/wasm-lib/kcl/bindings
e2e/playwright/export-snapshots e2e/playwright/export-snapshots
e2e/playwright/snapshots/prompt-to-edit e2e/playwright/snapshots/prompt-to-edit
# XState generated files # XState generated files
src/machines/**.typegen.ts src/machines/**.typegen.ts
.vscode-test

View File

@ -1,25 +1,25 @@
.PHONY: dev .PHONY: dev
KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs) WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs)
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts) TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts) XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
dev: node_modules public/wasm_lib_bg.wasm $(XSTATE_TYPEGENS) dev: node_modules public/wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
yarn start pnpm start
# I'm sorry this is so specific to my setup you may as well ignore this. # I'm sorry this is so specific to my setup you may as well ignore this.
# This is so you don't have to deal with electron windows popping up constantly. # This is so you don't have to deal with electron windows popping up constantly.
# It should work for you other Linux users. # It should work for you other Linux users.
lee-electron-test: lee-electron-test:
Xephyr -br -ac -noreset -screen 1200x500 :2 & Xephyr -br -ac -noreset -screen 1200x500 :2 &
DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn tron:test -g "when using the file tree" DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm tron:test -g "when using the file tree"
killall Xephyr killall Xephyr
$(XSTATE_TYPEGENS): $(TS_SRC) $(XSTATE_TYPEGENS): $(TS_SRC)
yarn xstate typegen 'src/**/*.ts?(x)' pnpm xstate typegen 'src/**/*.ts?(x)'
public/kcl_wasm_lib_bg.wasm: $(KCL_WASM_LIB_FILES) public/wasm_lib_bg.wasm: $(WASM_LIB_FILES)
yarn build:wasm pnpm build:wasm
node_modules: package.json yarn.lock node_modules: package.json yarn.lock
yarn install pnpm install

128
README.md
View File

@ -40,7 +40,7 @@ The 3D view in Modeling App is just a video stream from our hosted geometry engi
[Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1) [Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1)
[Original demo slides](https://github.com/user-attachments/files/19010536/demo.pdf) [Original demo slides](https://github.com/KittyCAD/Eng/files/10398178/demo.pdf)
## Get started ## Get started
@ -52,49 +52,45 @@ Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=r
On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7. On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7.
Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected. Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected.
``` ```
fnm install --corepack-enabled fnm install --corepack-enabled
fnm use fnm use
``` ```
Install the NPM dependencies with: Install the NPM dependencies with:
``` ```
yarn install pnpm install
``` ```
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference: This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
``` ```
# macOS/Linux # macOS/Linux
yarn install:rust pnpm install:rust
yarn install:wasm-pack:sh pnpm install:wasm-pack:sh
# Windows # Windows
yarn install:rust:windows pnpm install:rust:windows
yarn install:wasm-pack:cargo pnpm install:wasm-pack:cargo
``` ```
Then to build the WASM layer, run: Then to build the WASM layer, run:
```
# macOS/Linux
pnpm build:wasm
# Windows
pnpm build:wasm:windows
```
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `pnpm install:tools:windows`.
``` ```
# macOS/Linux # macOS/Linux
yarn build:wasm pnpm fetch:wasm
# Windows # Windows
yarn build:wasm:windows pnpm fetch:wasm:windows
```
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `yarn install:tools:windows`.
```
# macOS/Linux
yarn fetch:wasm
# Windows
yarn fetch:wasm:windows
``` ```
That will build the WASM binary and put in the `public` dir (though gitignored). That will build the WASM binary and put in the `public` dir (though gitignored).
@ -102,7 +98,7 @@ That will build the WASM binary and put in the `public` dir (though gitignored).
Finally, to run the web app only, run: Finally, to run the web app only, run:
``` ```
yarn start pnpm start
``` ```
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again. If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
@ -122,28 +118,27 @@ Third-Party Cookies".
## Desktop ## Desktop
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then To spin up the desktop app, `pnpm install` and `pnpm build:wasm` need to have been done before hand then
``` ```
yarn tron:start pnpm tron:start
``` ```
This will start the application and hot-reload on changes. This will start the application and hot-reload on changes.
Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows). Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows).
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables) To package the app for your platform with electron-builder, run `pnpm tronb:package:dev` (or `pnpm tronb:package:prod` to point to the .env.production variables)
## Checking out commits / Bisecting ## Checking out commits / Bisecting
Which commands from setup are one off vs need to be run every time? Which commands from setup are one off vs need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale: The following will need to be run when checking out a new commit and guarantees the build is not stale:
```bash ```bash
yarn install pnpm install
yarn build:wasm pnpm build:wasm
yarn start # or yarn build:local && yarn serve for slower but more production-like build pnpm start # or pnpm build:local && pnpm serve for slower but more production-like build
``` ```
## Before submitting a PR ## Before submitting a PR
@ -153,10 +148,10 @@ Before you submit a contribution PR to this repo, please ensure that:
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins. - There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
- You have separated out refactoring commits from feature commits as much as possible - You have separated out refactoring commits from feature commits as much as possible
- You have run all of the following commands locally: - You have run all of the following commands locally:
- `yarn fmt` - `pnpm fmt`
- `yarn tsc` - `pnpm tsc`
- `yarn test` - `pnpm test`
- Here they are all together: `yarn fmt && yarn tsc && yarn test` - Here they are all together: `pnpm fmt && pnpm tsc && pnpm test`
## Release a new version ## Release a new version
@ -190,12 +185,11 @@ Manually test against this [list](https://github.com/KittyCAD/modeling-app/issue
##### Updater-test builds ##### Updater-test builds
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version. The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available. The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket). If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
``` ```
# Windows (PowerShell) # Windows (PowerShell)
& 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe' & 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe'
@ -211,14 +205,15 @@ If the prompt doesn't show up, start the app in command line to grab the electro
Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well. Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well.
Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_. Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_.
A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent. A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent.
#### 5. Close the issue #### 5. Close the issue
If everything is well and the release is out to the public, the issue tracking the release shall be closed. If everything is well and the release is out to the public, the issue tracking the release shall be closed.
## Fuzzing the parser ## Fuzzing the parser
Make sure you install cargo fuzz: Make sure you install cargo fuzz:
@ -228,7 +223,7 @@ $ cargo install cargo-fuzz
``` ```
```bash ```bash
$ cd rust/kcl-lib $ cd src/wasm-lib/kcl
# list the fuzz targets # list the fuzz targets
$ cargo fuzz list $ cargo fuzz list
@ -256,7 +251,6 @@ snapshottoken=<your-snapshot-token>
For a portable way to run Playwright you'll need Docker. For a portable way to run Playwright you'll need Docker.
#### Generic example #### Generic example
After that, open a terminal and run: After that, open a terminal and run:
```bash ```bash
@ -266,9 +260,10 @@ docker run --network host --rm --init -it playwright/chrome:playwright-x.xx.x
and in another terminal, run: and in another terminal, run:
```bash ```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite> PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm playwright test --project="Google Chrome" <test suite>
``` ```
#### Specific example #### Specific example
open a terminal and run: open a terminal and run:
@ -280,24 +275,25 @@ docker run --network host --rm --init -it playwright/chrome:playwright-1.46.0
and in another terminal, run: and in another terminal, run:
```bash ```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
``` ```
run a specific test change the test from `test('...` to `test.only('...` run a specific test change the test from `test('...` to `test.only('...`
(note if you commit this, the tests will instantly fail without running any of the tests) (note if you commit this, the tests will instantly fail without running any of the tests)
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date. **Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
run headed run headed
``` ```
yarn playwright test --headed pnpm playwright test --headed
``` ```
run with step through debugger run with step through debugger
``` ```
PWDEBUG=1 yarn playwright test PWDEBUG=1 pnpm playwright test
``` ```
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying. However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
@ -308,7 +304,7 @@ Or comment out browsers in `playwright.config.ts`.
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome' note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `yarn playwright codegen -b wk --load-storage ./store localhost:3000` You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `pnpm playwright codegen -b wk --load-storage ./store localhost:3000`
<details> <details>
<summary> <summary>
@ -351,21 +347,21 @@ However because much of our tests involve clicking in the stream at specific loc
If you already haven't, run the following: If you already haven't, run the following:
``` ```
yarn pnpm install
yarn build:wasm pnpm build:wasm
yarn start pnpm start
``` ```
and finally: and finally:
``` ```
yarn test:unit pnpm test:unit
``` ```
For individual testing: For individual testing:
``` ```
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false pnpm test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
``` ```
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default. Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default.
@ -379,19 +375,17 @@ Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testin
- `just` - `just`
#### Setting KITTYCAD_API_TOKEN #### Setting KITTYCAD_API_TOKEN
Use the production zoo.dev token, set this environment variable before running the tests Use the production zoo.dev token, set this environment variable before running the tests
#### Installing cargonextest #### Installing cargonextest
``` ```
cd rust cd src/wasm-lib
cargo search cargo-nextest cargo search cargo-nextest
cargo install cargo-nextest cargo install cargo-nextest
``` ```
#### just #### just
install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries) install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries)
#### Running the tests #### Running the tests
@ -401,7 +395,7 @@ install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-bina
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest # Make sure you installed cargo-nextest
# Make sure you installed just # Make sure you installed just
cd rust cd src/wasm-lib
just test just test
``` ```
@ -409,7 +403,7 @@ just test
# Without just # Without just
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest # Make sure you installed cargo-nextest
cd rust cd src/wasm-lib
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1 export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1
``` ```
@ -418,14 +412,13 @@ Where `XXX` is an API token from the production engine (NOT the dev environment)
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
``` ```
cd rust cd src/wasm-lib
KITTYCAD_API_TOKEN=XXX cargo run nextest KITTYCAD_API_TOKEN=XXX cargo run nextest
``` ```
### Mapping CI CD jobs to local commands ### Mapping CI CD jobs to local commands
When you see the CI CD fail on jobs you may wonder three things When you see the CI CD fail on jobs you may wonder three things
- Do I have a bug in my code? - Do I have a bug in my code?
- Is the test flaky? - Is the test flaky?
- Is there a bug in `main`? - Is there a bug in `main`?
@ -439,16 +432,17 @@ Part of the CI CD pipeline performs static analysis on the code. Use the followi
The following set of commands should get us closer to one and done commands to instantly retest issues. The following set of commands should get us closer to one and done commands to instantly retest issues.
``` ```
yarn test-setup pnpm test-setup
``` ```
> Gotcha, are packages up to date and is the wasm built? > Gotcha, are packages up to date and is the wasm built?
``` ```
yarn tsc pnpm tsc
yarn fmt-check pnpm fmt-check
yarn lint pnpm lint
yarn test:unit:local pnpm test:unit:local
``` ```
> Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests. > Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests.
@ -460,10 +454,10 @@ yarn test:unit:local
These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping. These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping.
``` ```
yarn test:playwright:electron:local pnpm test:playwright:electron:local
yarn test:playwright:electron:windows:local pnpm test:playwright:electron:windows:local
yarn test:playwright:electron:macos:local pnpm test:playwright:electron:macos:local
yarn test:playwright:electron:ubuntu:local pnpm test:playwright:electron:ubuntu:local
``` ```
> Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally. > Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally.
@ -499,7 +493,7 @@ PS: for the debug panel, the following JSON is useful for snapping the camera
## KCL ## KCL
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/rust/kcl-lib). For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl).
### Logging ### Logging

View File

@ -9,7 +9,7 @@ Compute the absolute value of a number.
```js ```js
abs(num: number): number abs(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ abs(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the arccosine of a number (in radians).
```js ```js
acos(num: number): number acos(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ acos(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -13,7 +13,7 @@ angleToMatchLengthX(
tag: TagIdentifier, tag: TagIdentifier,
to: number, to: number,
sketch: Sketch, sketch: Sketch,
): number ) -> number
``` ```
@ -21,13 +21,13 @@ angleToMatchLengthX(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
| `to` | [`number`](/docs/kcl/types/number) | | Yes | | `to` | `number` | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -13,7 +13,7 @@ angleToMatchLengthY(
tag: TagIdentifier, tag: TagIdentifier,
to: number, to: number,
sketch: Sketch, sketch: Sketch,
): number ) -> number
``` ```
@ -21,13 +21,13 @@ angleToMatchLengthY(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
| `to` | [`number`](/docs/kcl/types/number) | | Yes | | `to` | `number` | | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -40,7 +40,7 @@ sketch001 = startSketchOn('XZ')
angle = angleToMatchLengthY(seg01, 15, %), angle = angleToMatchLengthY(seg01, 15, %),
length = 5 length = 5
}, %) }, %)
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
extrusion = extrude(sketch001, length = 5) extrusion = extrude(sketch001, length = 5)

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLine" title: "angledLine"
excerpt: "Draw a line segment relative to the current origin using the polar measure of some angle and distance." excerpt: "Draw a line segment relative to the current origin using the polar"
layout: manual layout: manual
--- ---
Draw a line segment relative to the current origin using the polar measure of some angle and distance. Draw a line segment relative to the current origin using the polar
measure of some angle and distance.
```js ```js
angledLine( angledLine(
data: AngledLineData, data: AngledLineData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ angledLine(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes | | `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples
@ -35,10 +35,10 @@ angledLine(
```js ```js
exampleSketch = startSketchOn(XZ) exampleSketch = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> yLine(endAbsolute = 15) |> yLineTo(15, %)
|> angledLine({ angle = 30, length = 15 }, %) |> angledLine({ angle = 30, length = 15 }, %)
|> line(end = [8, -10]) |> line(end = [8, -10])
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
example = extrude(exampleSketch, length = 10) example = extrude(exampleSketch, length = 10)

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineOfXLength" title: "angledLineOfXLength"
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension." excerpt: "Create a line segment from the current 2-dimensional sketch origin"
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension. Create a line segment from the current 2-dimensional sketch origin
along some angle (in degrees) for some relative length in the 'x' dimension.
```js ```js
angledLineOfXLength( angledLineOfXLength(
data: AngledLineData, data: AngledLineData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ angledLineOfXLength(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes | | `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineOfYLength" title: "angledLineOfYLength"
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension." excerpt: "Create a line segment from the current 2-dimensional sketch origin"
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension. Create a line segment from the current 2-dimensional sketch origin
along some angle (in degrees) for some relative length in the 'y' dimension.
```js ```js
angledLineOfYLength( angledLineOfYLength(
data: AngledLineData, data: AngledLineData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ angledLineOfYLength(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes | | `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineThatIntersects" title: "angledLineThatIntersects"
excerpt: "Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment." excerpt: "Draw an angled line from the current origin, constructing a line segment"
layout: manual layout: manual
--- ---
Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment. Draw an angled line from the current origin, constructing a line segment
such that the newly created line intersects the desired target line segment.
```js ```js
angledLineThatIntersects( angledLineThatIntersects(
data: AngledLineThatIntersectsData, data: AngledLineThatIntersectsData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ angledLineThatIntersects(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes | | `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineToX" title: "angledLineToX"
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension." excerpt: "Create a line segment from the current 2-dimensional sketch origin"
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension. Create a line segment from the current 2-dimensional sketch origin
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
```js ```js
angledLineToX( angledLineToX(
data: AngledLineToData, data: AngledLineToData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ angledLineToX(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes | | `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -1,19 +1,19 @@
--- ---
title: "angledLineToY" title: "angledLineToY"
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension." excerpt: "Create a line segment from the current 2-dimensional sketch origin"
layout: manual layout: manual
--- ---
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension. Create a line segment from the current 2-dimensional sketch origin
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
```js ```js
angledLineToY( angledLineToY(
data: AngledLineToData, data: AngledLineToData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ angledLineToY(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes | | `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ arc(
data: ArcData, data: ArcData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -24,12 +24,12 @@ arc(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes | | `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -1,10 +1,10 @@
--- ---
title: "arcTo" title: "arcTo"
excerpt: "Draw a three point arc." excerpt: "Draw a 3 point arc."
layout: manual layout: manual
--- ---
Draw a three point arc. Draw a 3 point arc.
The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end. The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end.
@ -13,7 +13,7 @@ arcTo(
data: ArcToData, data: ArcToData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ arcTo(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`ArcToData`](/docs/kcl/types/ArcToData) | Data to draw a three point arc (arcTo). | Yes | | `data` | [`ArcToData`](/docs/kcl/types/ArcToData) | Data to draw a three point arc (arcTo). | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the arcsine of a number (in radians).
```js ```js
asin(num: number): number asin(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ asin(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(asin(0.5)), angle = toDegrees(asin(0.5)),
length = 20 length = 20
}, %) }, %)
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
extrude001 = extrude(sketch001, length = 5) extrude001 = extrude(sketch001, length = 5)

View File

@ -1,18 +1,18 @@
--- ---
title: "assert" title: "assert"
excerpt: "Check a value at runtime, and raise an error if the argument provided is false." excerpt: "Check a value at runtime, and raise an error if the argument provided"
layout: manual layout: manual
--- ---
Check a value at runtime, and raise an error if the argument provided is false. Check a value at runtime, and raise an error if the argument provided
is false.
```js ```js
assert( assert(
data: bool, data: bool,
message: string, message: string,
): () ) -> ()
``` ```
@ -20,8 +20,8 @@ assert(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`bool`](/docs/kcl/types/bool) | | Yes | | `data` | `bool` | | Yes |
| `message` | [`string`](/docs/kcl/types/string) | | Yes | | `message` | `string` | | Yes |
### Returns ### Returns

View File

@ -1,12 +1,12 @@
--- ---
title: "assertEqual" title: "assertEqual"
excerpt: "Check that a numerical value equals another at runtime, otherwise raise an error." excerpt: "Check that a numerical value equals another at runtime,"
layout: manual layout: manual
--- ---
Check that a numerical value equals another at runtime, otherwise raise an error. Check that a numerical value equals another at runtime,
otherwise raise an error.
```js ```js
assertEqual( assertEqual(
@ -14,7 +14,7 @@ assertEqual(
right: number, right: number,
epsilon: number, epsilon: number,
message: string, message: string,
): () ) -> ()
``` ```
@ -22,10 +22,10 @@ assertEqual(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | [`number`](/docs/kcl/types/number) | | Yes | | `left` | `number` | | Yes |
| `right` | [`number`](/docs/kcl/types/number) | | Yes | | `right` | `number` | | Yes |
| `epsilon` | [`number`](/docs/kcl/types/number) | | Yes | | `epsilon` | `number` | | Yes |
| `message` | [`string`](/docs/kcl/types/string) | | Yes | | `message` | `string` | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertGreaterThan" title: "assertGreaterThan"
excerpt: "Check that a numerical value is greater than another at runtime, otherwise raise an error." excerpt: "Check that a numerical value is greater than another at runtime,"
layout: manual layout: manual
--- ---
Check that a numerical value is greater than another at runtime, otherwise raise an error. Check that a numerical value is greater than another at runtime,
otherwise raise an error.
```js ```js
assertGreaterThan( assertGreaterThan(
left: number, left: number,
right: number, right: number,
message: string, message: string,
): () ) -> ()
``` ```
@ -21,9 +21,9 @@ assertGreaterThan(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | [`number`](/docs/kcl/types/number) | | Yes | | `left` | `number` | | Yes |
| `right` | [`number`](/docs/kcl/types/number) | | Yes | | `right` | `number` | | Yes |
| `message` | [`string`](/docs/kcl/types/string) | | Yes | | `message` | `string` | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertGreaterThanOrEq" title: "assertGreaterThanOrEq"
excerpt: "Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error." excerpt: "Check that a numerical value is greater than or equal to another at runtime,"
layout: manual layout: manual
--- ---
Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error. Check that a numerical value is greater than or equal to another at runtime,
otherwise raise an error.
```js ```js
assertGreaterThanOrEq( assertGreaterThanOrEq(
left: number, left: number,
right: number, right: number,
message: string, message: string,
): () ) -> ()
``` ```
@ -21,9 +21,9 @@ assertGreaterThanOrEq(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | [`number`](/docs/kcl/types/number) | | Yes | | `left` | `number` | | Yes |
| `right` | [`number`](/docs/kcl/types/number) | | Yes | | `right` | `number` | | Yes |
| `message` | [`string`](/docs/kcl/types/string) | | Yes | | `message` | `string` | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertLessThan" title: "assertLessThan"
excerpt: "Check that a numerical value is less than to another at runtime, otherwise raise an error." excerpt: "Check that a numerical value is less than to another at runtime,"
layout: manual layout: manual
--- ---
Check that a numerical value is less than to another at runtime, otherwise raise an error. Check that a numerical value is less than to another at runtime,
otherwise raise an error.
```js ```js
assertLessThan( assertLessThan(
left: number, left: number,
right: number, right: number,
message: string, message: string,
): () ) -> ()
``` ```
@ -21,9 +21,9 @@ assertLessThan(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | [`number`](/docs/kcl/types/number) | | Yes | | `left` | `number` | | Yes |
| `right` | [`number`](/docs/kcl/types/number) | | Yes | | `right` | `number` | | Yes |
| `message` | [`string`](/docs/kcl/types/string) | | Yes | | `message` | `string` | | Yes |
### Returns ### Returns

View File

@ -1,19 +1,19 @@
--- ---
title: "assertLessThanOrEq" title: "assertLessThanOrEq"
excerpt: "Check that a numerical value is less than or equal to another at runtime, otherwise raise an error." excerpt: "Check that a numerical value is less than or equal to another at runtime,"
layout: manual layout: manual
--- ---
Check that a numerical value is less than or equal to another at runtime, otherwise raise an error. Check that a numerical value is less than or equal to another at runtime,
otherwise raise an error.
```js ```js
assertLessThanOrEq( assertLessThanOrEq(
left: number, left: number,
right: number, right: number,
message: string, message: string,
): () ) -> ()
``` ```
@ -21,9 +21,9 @@ assertLessThanOrEq(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `left` | [`number`](/docs/kcl/types/number) | | Yes | | `left` | `number` | | Yes |
| `right` | [`number`](/docs/kcl/types/number) | | Yes | | `right` | `number` | | Yes |
| `message` | [`string`](/docs/kcl/types/string) | | Yes | | `message` | `string` | | Yes |
### Returns ### Returns

View File

@ -9,7 +9,7 @@ Compute the arctangent of a number (in radians).
```js ```js
atan(num: number): number atan(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ atan(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(atan(1.25)), angle = toDegrees(atan(1.25)),
length = 20 length = 20
}, %) }, %)
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
extrude001 = extrude(sketch001, length = 5) extrude001 = extrude(sketch001, length = 5)

View File

@ -12,7 +12,7 @@ Compute the four quadrant arctangent of Y and X (in radians).
atan2( atan2(
y: number, y: number,
x: number, x: number,
): number ) -> number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ atan2(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `y` | [`number`](/docs/kcl/types/number) | | Yes | | `y` | `number` | | Yes |
| `x` | [`number`](/docs/kcl/types/number) | | Yes | | `x` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -41,7 +41,7 @@ sketch001 = startSketchOn('XZ')
angle = toDegrees(atan2(1.25, 2)), angle = toDegrees(atan2(1.25, 2)),
length = 20 length = 20
}, %) }, %)
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
extrude001 = extrude(sketch001, length = 5) extrude001 = extrude(sketch001, length = 5)

View File

@ -1,19 +1,19 @@
--- ---
title: "bezierCurve" title: "bezierCurve"
excerpt: "Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape." excerpt: "Draw a smooth, continuous, curved line segment from the current origin to"
layout: manual layout: manual
--- ---
Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape. Draw a smooth, continuous, curved line segment from the current origin to
the desired (x, y), using a number of control points to shape the curve's shape.
```js ```js
bezierCurve( bezierCurve(
data: BezierData, data: BezierData,
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,12 +22,12 @@ bezierCurve(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes | | `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the smallest integer greater than or equal to a number.
```js ```js
ceil(num: number): number ceil(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ ceil(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10]) |> line(endAbsolute = [12, 10])
|> line(end = [ceil(7.02986), 0]) |> line(end = [ceil(7.02986), 0])
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
extrude001 = extrude(sketch001, length = 5) extrude001 = extrude(sketch001, length = 5)

File diff suppressed because one or more lines are too long

View File

@ -1,20 +1,19 @@
--- ---
title: "circle" title: "circle"
excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point." excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at"
layout: manual layout: manual
--- ---
Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point. Construct a 2-dimensional circle, of the specified radius, centered at
the provided (x, y) origin point.
```js ```js
circle( circle(
sketchOrSurface: SketchOrSurface, data: CircleData,
center: [number], sketchSurfaceOrGroup: SketchOrSurface,
radius: number,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -22,21 +21,20 @@ circle(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchOrSurface` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes | | `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
| `center` | [`[number]`](/docs/kcl/types/number) | The center of the circle. | Yes | | `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the circle. | Yes | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this circle | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples
```js ```js
exampleSketch = startSketchOn("-XZ") exampleSketch = startSketchOn("-XZ")
|> circle(center = [0, 0], radius = 10) |> circle({ center = [0, 0], radius = 10 }, %)
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)
``` ```
@ -50,7 +48,7 @@ exampleSketch = startSketchOn("XZ")
|> line(end = [0, 30]) |> line(end = [0, 30])
|> line(end = [-30, 0]) |> line(end = [-30, 0])
|> close() |> close()
|> hole(circle(center = [0, 15], radius = 5), %) |> hole(circle({ center = [0, 15], radius = 5 }, %), %)
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)
``` ```

View File

@ -15,7 +15,7 @@ circleThreePoint(
p3: [number], p3: [number],
sketchSurfaceOrGroup: SketchOrSurface, sketchSurfaceOrGroup: SketchOrSurface,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -23,15 +23,15 @@ circleThreePoint(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes | | `p1` | `[number]` | 1st point to derive the circle. | Yes |
| `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes | | `p2` | `[number]` | 2nd point to derive the circle. | Yes |
| `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes | | `p3` | `[number]` | 3rd point to derive the circle. | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes | | `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -1,18 +1,18 @@
--- ---
title: "close" title: "close"
excerpt: "Construct a line segment from the current origin back to the profile's origin, ensuring the resulting 2-dimensional sketch is not open-ended." excerpt: "Construct a line segment from the current origin back to the profile's"
layout: manual layout: manual
--- ---
Construct a line segment from the current origin back to the profile's origin, ensuring the resulting 2-dimensional sketch is not open-ended. Construct a line segment from the current origin back to the profile's
origin, ensuring the resulting 2-dimensional sketch is not open-ended.
```js ```js
close( close(
sketch: Sketch, sketch: Sketch,
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -21,11 +21,11 @@ close(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch you want to close | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | The sketch you want to close | Yes |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `0.39
We merely provide these functions for convenience and readability, as `10 * cm()` is more readable that your intent is "I want 10 centimeters" than `10 * 10`, if the project settings are in millimeters. We merely provide these functions for convenience and readability, as `10 * cm()` is more readable that your intent is "I want 10 centimeters" than `10 * 10`, if the project settings are in millimeters.
```js ```js
cm(): number cm() -> number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ cm(): number
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -21,7 +21,7 @@ exampleSketch = startSketchOn("XZ")
angle = 30, angle = 30,
length = 2 * E ^ 2, length = 2 * E ^ 2,
}, %) }, %)
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
example = extrude(exampleSketch, length = 10) example = extrude(exampleSketch, length = 10)

View File

@ -18,7 +18,7 @@ std::math::PI: number = 3.14159265358979323846264338327950288_
circumference = 70 circumference = 70
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> circle(center = [0, 0], radius = circumference/ (2 * PI)) |> circle({ center = [0, 0], radius = circumference/ (2 * PI) }, %)
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)
``` ```

View File

@ -21,7 +21,7 @@ exampleSketch = startSketchOn("XZ")
angle = 50, angle = 50,
length = 10 * TAU, length = 10 * TAU,
}, %) }, %)
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
example = extrude(exampleSketch, length = 5) example = extrude(exampleSketch, length = 5)

View File

@ -1,25 +0,0 @@
---
title: "KCL Constants"
excerpt: "Documentation for the KCL constants."
layout: manual
---
## Table of Contents
### `std`
- [`HALF_TURN`](/docs/kcl/consts/std-HALF_TURN)
- [`QUARTER_TURN`](/docs/kcl/consts/std-QUARTER_TURN)
- [`THREE_QUARTER_TURN`](/docs/kcl/consts/std-THREE_QUARTER_TURN)
- [`XY`](/docs/kcl/consts/std-XY)
- [`XZ`](/docs/kcl/consts/std-XZ)
- [`YZ`](/docs/kcl/consts/std-YZ)
- [`ZERO`](/docs/kcl/consts/std-ZERO)
### `std::math`
- [`E`](/docs/kcl/consts/std-math-E)
- [`PI`](/docs/kcl/consts/std-math-PI)
- [`TAU`](/docs/kcl/consts/std-math-TAU)

View File

@ -11,7 +11,7 @@ Return the value of Eulers number `e`.
**DEPRECATED** use the constant E **DEPRECATED** use the constant E
```js ```js
e(): number e() -> number
``` ```
### Tags ### Tags
@ -22,7 +22,7 @@ e(): number
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -31,7 +31,7 @@ e(): number
exampleSketch = startSketchOn("XZ") exampleSketch = startSketchOn("XZ")
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %) |> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
example = extrude(exampleSketch, length = 10) example = extrude(exampleSketch, length = 10)

View File

@ -1,18 +1,18 @@
--- ---
title: "extrude" title: "extrude"
excerpt: "Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid." excerpt: "Extend a 2-dimensional sketch through a third dimension in order to"
layout: manual layout: manual
--- ---
Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid. Extend a 2-dimensional sketch through a third dimension in order to
You can provide more than one sketch to extrude, and they will all be extruded in the same direction. create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
```js ```js
extrude( extrude(
sketchSet: SketchSet, sketchSet: SketchSet,
length: number, length: number,
): SolidSet ) -> SolidSet
``` ```
@ -20,8 +20,8 @@ extrude(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch or set of sketches should be extruded | Yes | | `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes |
| `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes | | `length` | `number` | How far to extrude the given sketches | Yes |
### Returns ### Returns

View File

@ -15,7 +15,7 @@ fillet(
tags: [EdgeReference], tags: [EdgeReference],
tolerance?: number, tolerance?: number,
tag?: TagDeclarator, tag?: TagDeclarator,
): Solid ) -> Solid
``` ```
@ -24,14 +24,14 @@ fillet(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be filletted | Yes | | `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be filletted | Yes |
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the fillet | Yes | | `radius` | `number` | The radius of the fillet | Yes |
| `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to fillet | Yes | | `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to fillet | Yes |
| `tolerance` | [`number`](/docs/kcl/types/number) | The tolerance for this fillet | No | | `tolerance` | `number` | The tolerance for this fillet | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this fillet | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this fillet | No |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) [`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the largest integer less than or equal to a number.
```js ```js
floor(num: number): number floor(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ floor(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(endAbsolute = [12, 10]) |> line(endAbsolute = [12, 10])
|> line(end = [floor(7.02986), 0]) |> line(end = [floor(7.02986), 0])
|> yLine(endAbsolute = 0) |> yLineTo(0, %)
|> close() |> close()
extrude001 = extrude(sketch001, length = 5) extrude001 = extrude(sketch001, length = 5)

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `12`.
We merely provide these functions for convenience and readability, as `10 * ft()` is more readable that your intent is "I want 10 feet" than `10 * 304.8`, if the project settings are in millimeters. We merely provide these functions for convenience and readability, as `10 * ft()` is more readable that your intent is "I want 10 feet" than `10 * 304.8`, if the project settings are in millimeters.
```js ```js
ft(): number ft() -> number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ ft(): number
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Get the next adjacent edge to the edge given.
```js ```js
getNextAdjacentEdge(tag: TagIdentifier): Uuid getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
``` ```
@ -17,7 +17,7 @@ getNextAdjacentEdge(tag: TagIdentifier): Uuid
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
### Returns ### Returns

View File

@ -9,7 +9,7 @@ Get the opposite edge to the edge given.
```js ```js
getOppositeEdge(tag: TagIdentifier): Uuid getOppositeEdge(tag: TagIdentifier) -> Uuid
``` ```
@ -17,7 +17,7 @@ getOppositeEdge(tag: TagIdentifier): Uuid
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
### Returns ### Returns

View File

@ -9,7 +9,7 @@ Get the previous adjacent edge to the edge given.
```js ```js
getPreviousAdjacentEdge(tag: TagIdentifier): Uuid getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
``` ```
@ -17,7 +17,7 @@ getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes | | `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
### Returns ### Returns

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ Create a helix on a cylinder.
helixRevolutions( helixRevolutions(
data: HelixRevolutionsData, data: HelixRevolutionsData,
solid: Solid, solid: Solid,
): Solid ) -> Solid
``` ```
@ -21,18 +21,18 @@ helixRevolutions(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`HelixRevolutionsData`](/docs/kcl/types/HelixRevolutionsData) | Data for helix revolutions. | Yes | | `data` | [`HelixRevolutionsData`](/docs/kcl/types/HelixRevolutionsData) | Data for helix revolutions. | Yes |
| `solid` | [`Solid`](/docs/kcl/types/Solid) | | Yes | | `solid` | [`Solid`](/docs/kcl/types/Solid) | A solid is a collection of extrude surfaces. | Yes |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) [`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
### Examples ### Examples
```js ```js
part001 = startSketchOn('XY') part001 = startSketchOn('XY')
|> circle(center = [5, 5], radius = 10) |> circle({ center = [5, 5], radius = 10 }, %)
|> extrude(length = 10) |> extrude(length = 10)
|> helixRevolutions({ |> helixRevolutions({
angleStart = 0, angleStart = 0,

View File

@ -12,7 +12,7 @@ Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
hole( hole(
holeSketch: SketchSet, holeSketch: SketchSet,
sketch: Sketch, sketch: Sketch,
): Sketch ) -> Sketch
``` ```
@ -21,11 +21,11 @@ hole(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes | | `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples
@ -37,8 +37,8 @@ exampleSketch = startSketchOn(XY)
|> line(end = [5, 0]) |> line(end = [5, 0])
|> line(end = [0, -5]) |> line(end = [0, -5])
|> close() |> close()
|> hole(circle(center = [1, 1], radius = .25), %) |> hole(circle({ center = [1, 1], radius = .25 }, %), %)
|> hole(circle(center = [1, 4], radius = .25), %) |> hole(circle({ center = [1, 4], radius = .25 }, %), %)
example = extrude(exampleSketch, length = 1) example = extrude(exampleSketch, length = 1)
``` ```
@ -57,7 +57,7 @@ fn squareHoleSketch() {
} }
exampleSketch = startSketchOn(-XZ) exampleSketch = startSketchOn(-XZ)
|> circle(center = [0, 0], radius = 3) |> circle({ center = [0, 0], radius = 3 }, %)
|> hole(squareHoleSketch(), %) |> hole(squareHoleSketch(), %)
example = extrude(exampleSketch, length = 1) example = extrude(exampleSketch, length = 1)
``` ```

View File

@ -12,7 +12,7 @@ Remove volume from a 3-dimensional shape such that a wall of the provided thickn
hollow( hollow(
thickness: number, thickness: number,
solid: Solid, solid: Solid,
): Solid ) -> Solid
``` ```
@ -20,12 +20,12 @@ hollow(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `thickness` | [`number`](/docs/kcl/types/number) | | Yes | | `thickness` | `number` | | Yes |
| `solid` | [`Solid`](/docs/kcl/types/Solid) | | Yes | | `solid` | [`Solid`](/docs/kcl/types/Solid) | A solid is a collection of extrude surfaces. | Yes |
### Returns ### Returns
[`Solid`](/docs/kcl/types/Solid) [`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
### Examples ### Examples
@ -70,11 +70,17 @@ case = startSketchOn('-XZ')
|> extrude(length = 65) |> extrude(length = 65)
thing1 = startSketchOn(case, 'end') thing1 = startSketchOn(case, 'end')
|> circle(center = [-size / 2, -size / 2], radius = 25) |> circle({
center = [-size / 2, -size / 2],
radius = 25
}, %)
|> extrude(length = 50) |> extrude(length = 50)
thing2 = startSketchOn(case, 'end') thing2 = startSketchOn(case, 'end')
|> circle(center = [size / 2, -size / 2], radius = 25) |> circle({
center = [size / 2, -size / 2],
radius = 25
}, %)
|> extrude(length = 50) |> extrude(length = 50)
hollow(0.5, case) hollow(0.5, case)

View File

@ -18,7 +18,7 @@ Note: The import command currently only works when using the native Modeling App
import( import(
filePath: String, filePath: String,
options?: ImportFormat, options?: ImportFormat,
): ImportedGeometry ) -> ImportedGeometry
``` ```

View File

@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `1`.
We merely provide these functions for convenience and readability, as `10 * inch()` is more readable that your intent is "I want 10 inches" than `10 * 25.4`, if the project settings are in millimeters. We merely provide these functions for convenience and readability, as `10 * inch()` is more readable that your intent is "I want 10 inches" than `10 * 25.4`, if the project settings are in millimeters.
```js ```js
inch(): number inch() -> number
``` ```
### Tags ### Tags
@ -26,7 +26,7 @@ inch(): number
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -12,26 +12,17 @@ layout: manual
* [`Modules`](kcl/modules) * [`Modules`](kcl/modules)
* [`Settings`](kcl/settings) * [`Settings`](kcl/settings)
* [`Known Issues`](kcl/known-issues) * [`Known Issues`](kcl/known-issues)
* [`Constants`](kcl/consts)
### Standard library ### Standard library
* **Primitive types** * **`std`**
* [`bool`](kcl/types/bool) * [`HALF_TURN`](kcl/const_std-HALF_TURN)
* [`number`](kcl/types/number) * [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN)
* [`string`](kcl/types/string) * [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN)
* [`tag`](kcl/types/tag) * [`XY`](kcl/const_std-XY)
* **std** * [`XZ`](kcl/const_std-XZ)
* [`HALF_TURN`](kcl/consts/std-HALF_TURN) * [`YZ`](kcl/const_std-YZ)
* [`Plane`](kcl/types/Plane) * [`ZERO`](kcl/const_std-ZERO)
* [`QUARTER_TURN`](kcl/consts/std-QUARTER_TURN)
* [`Sketch`](kcl/types/Sketch)
* [`Solid`](kcl/types/Solid)
* [`THREE_QUARTER_TURN`](kcl/consts/std-THREE_QUARTER_TURN)
* [`XY`](kcl/consts/std-XY)
* [`XZ`](kcl/consts/std-XZ)
* [`YZ`](kcl/consts/std-YZ)
* [`ZERO`](kcl/consts/std-ZERO)
* [`abs`](kcl/abs) * [`abs`](kcl/abs)
* [`acos`](kcl/acos) * [`acos`](kcl/acos)
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX) * [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
@ -132,12 +123,14 @@ layout: manual
* [`toRadians`](kcl/toRadians) * [`toRadians`](kcl/toRadians)
* [`translate`](kcl/translate) * [`translate`](kcl/translate)
* [`xLine`](kcl/xLine) * [`xLine`](kcl/xLine)
* [`xLineTo`](kcl/xLineTo)
* [`yLine`](kcl/yLine) * [`yLine`](kcl/yLine)
* [`yLineTo`](kcl/yLineTo)
* [`yd`](kcl/yd) * [`yd`](kcl/yd)
* **std::math** * **`std::math`**
* [`E`](kcl/consts/std-math-E) * [`E`](kcl/const_std-math-E)
* [`PI`](kcl/consts/std-math-PI) * [`PI`](kcl/const_std-math-PI)
* [`TAU`](kcl/consts/std-math-TAU) * [`TAU`](kcl/const_std-math-TAU)
* [`cos`](kcl/std-math-cos) * [`cos`](kcl/std-math-cos)
* [`sin`](kcl/std-math-sin) * [`sin`](kcl/std-math-sin)
* [`tan`](kcl/std-math-tan) * [`tan`](kcl/std-math-tan)

View File

@ -11,7 +11,7 @@ Convert a number to an integer.
DEPRECATED use floor(), ceil(), or round(). DEPRECATED use floor(), ceil(), or round().
```js ```js
int(num: number): number int(num: number) -> number
``` ```
### Tags ### Tags
@ -23,11 +23,11 @@ int(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples
@ -37,7 +37,7 @@ n = int(ceil(5 / 2))
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3") assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
// Draw n cylinders. // Draw n cylinders.
startSketchOn('XZ') startSketchOn('XZ')
|> circle(center = [0, 0], radius = 2) |> circle({ center = [0, 0], radius = 2 }, %)
|> extrude(length = 5) |> extrude(length = 5)
|> patternTransform( |> patternTransform(
instances = n, instances = n,

View File

@ -13,7 +13,9 @@ once fixed in engine will just start working here with no language changes.
If you see a red line around your model, it means this is happening. If you see a red line around your model, it means this is happening.
- **Import**: Right now you can import a file, even if that file has brep data - **Import**: Right now you can import a file, even if that file has brep data
you cannot edit it, after v1, the engine will account for this. you cannot edit it, after v1, the engine will account for this. You also cannot
currently move or transform the imported objects at all, once we have assemblies
this will work.
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet - **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet
cases work currently. cases work currently.

View File

@ -1,15 +1,15 @@
--- ---
title: "lastSegX" title: "lastSegX"
excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d sketch." excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d"
layout: manual layout: manual
--- ---
Extract the 'x' axis value of the last line segment in the provided 2-d sketch. Extract the 'x' axis value of the last line segment in the provided 2-d
sketch.
```js ```js
lastSegX(sketch: Sketch): number lastSegX(sketch: Sketch) -> number
``` ```
@ -21,7 +21,7 @@ lastSegX(sketch: Sketch): number
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -1,15 +1,15 @@
--- ---
title: "lastSegY" title: "lastSegY"
excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d sketch." excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d"
layout: manual layout: manual
--- ---
Extract the 'y' axis value of the last line segment in the provided 2-d sketch. Extract the 'y' axis value of the last line segment in the provided 2-d
sketch.
```js ```js
lastSegY(sketch: Sketch): number lastSegY(sketch: Sketch) -> number
``` ```
@ -21,7 +21,7 @@ lastSegY(sketch: Sketch): number
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Compute the angle of the given leg for x.
legAngX( legAngX(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
): number ) -> number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ legAngX(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes | | `hypotenuse` | `number` | | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | | Yes | | `leg` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Compute the angle of the given leg for y.
legAngY( legAngY(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
): number ) -> number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ legAngY(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes | | `hypotenuse` | `number` | | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | | Yes | | `leg` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -12,7 +12,7 @@ Compute the length of the given leg.
legLen( legLen(
hypotenuse: number, hypotenuse: number,
leg: number, leg: number,
): number ) -> number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ legLen(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes | | `hypotenuse` | `number` | | Yes |
| `leg` | [`number`](/docs/kcl/types/number) | | Yes | | `leg` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -14,7 +14,7 @@ line(
endAbsolute?: [number], endAbsolute?: [number],
end?: [number], end?: [number],
tag?: TagDeclarator, tag?: TagDeclarator,
): Sketch ) -> Sketch
``` ```
@ -23,13 +23,13 @@ line(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `endAbsolute` | [`[number]`](/docs/kcl/types/number) | Which absolute point should this line go to? Incompatible with `end`. | No | | `endAbsolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No |
| `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No | | `end` | `[number]` | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
### Returns ### Returns
[`Sketch`](/docs/kcl/types/Sketch) [`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the natural logarithm of the number.
```js ```js
ln(num: number): number ln(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ ln(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ The result might not be correctly rounded owing to implementation details; `log2
log( log(
num: number, num: number,
base: number, base: number,
): number ) -> number
``` ```
### Tags ### Tags
@ -24,12 +24,12 @@ log(
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
| `base` | [`number`](/docs/kcl/types/number) | | Yes | | `base` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

View File

@ -9,7 +9,7 @@ Compute the base 10 logarithm of the number.
```js ```js
log10(num: number): number log10(num: number) -> number
``` ```
### Tags ### Tags
@ -21,11 +21,11 @@ log10(num: number): number
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `num` | [`number`](/docs/kcl/types/number) | | Yes | | `num` | `number` | | Yes |
### Returns ### Returns
[`number`](/docs/kcl/types/number) `number`
### Examples ### Examples

Some files were not shown because too many files have changed in this diff Show More