Skip to content

Commit cf088b5

Browse files
authored
chore: Monorepo refactor (#6)
1 parent 978fcb6 commit cf088b5

38 files changed

+153
-107
lines changed

.github/actions/setup/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Basic Setup
2-
description: Install PNPM, Node, and dependencies
2+
description: Install Bun and dependencies
33
runs:
44
using: composite
55
steps:

.github/workflows/validate.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ on:
77
- main
88

99
jobs:
10-
checks:
10+
npm-checks:
1111
runs-on: ubuntu-22.04
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: ./.github/actions/setup
15-
- run: bun build:npm
1615
- run: bun check
17-
build:
16+
working-directory: npm
17+
- run: bun test
18+
working-directory: npm
19+
web-checks:
1820
runs-on: ubuntu-22.04
1921
steps:
2022
- uses: actions/checkout@v4
2123
- uses: ./.github/actions/setup
22-
- run: bun build:web:nuxt
23-
tests:
24+
- run: bun check
25+
working-directory: web
26+
web-build:
2427
runs-on: ubuntu-22.04
2528
steps:
2629
- uses: actions/checkout@v4
2730
- uses: ./.github/actions/setup
28-
- uses: bun test
31+
- run: bun run build:nuxt
32+
working-directory: web

.gitignore

-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
11
node_modules
2-
.output
3-
.data
4-
.nuxt
5-
.nitro
6-
.cache
7-
dist
8-
coverage
9-
.cutlistrc
102
.DS_Store
11-
.env
12-
.env.*
13-
!.env.example

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# onshape-cutlist
1+
# @aklinker1/cutlist
22

33
Website and NPM tool for generating cutlists for an onshape assembly.
44

bun.lockb

58.3 KB
Binary file not shown.

npm/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
coverage

build.npm.ts npm/build.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Cleanup
22
import { rmdir } from 'node:fs/promises';
3-
await rmdir('dist/npm', { recursive: true }).catch(() => {});
3+
await rmdir('dist', { recursive: true }).catch(() => {});
44
import pkg from './package.json';
55

66
// Build Declaration File
@@ -12,13 +12,13 @@ if (tsc.exitCode != null && tsc.exitCode > 0) process.exit(tsc.exitCode);
1212

1313
// Build JS
1414
await Bun.build({
15-
entrypoints: ['src/index.ts'],
16-
outdir: 'dist/npm',
15+
entrypoints: ['src/index.ts', 'src/onshape.ts'],
16+
outdir: 'dist',
1717
target: 'node',
1818
splitting: true,
1919
external: Object.keys(pkg.dependencies).concat(
2020
Object.keys(pkg.devDependencies),
2121
),
2222
});
2323

24-
console.log('\x1b[1m\x1b[32m✔\x1b[0m Build \x1b[36mdist/npm\x1b[0m');
24+
console.log('\x1b[1m\x1b[32m✔\x1b[0m Build \x1b[36mdist\x1b[0m');

npm/package.json

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "@aklinker1/cutlist",
3+
"version": "0.4.0",
4+
"type": "module",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/aklinker1/cutlist"
8+
},
9+
"keywords": [
10+
"onshape",
11+
"cutlist",
12+
"woodworking"
13+
],
14+
"license": "MIT",
15+
"author": {
16+
"name": "Aaron Klinker",
17+
"email": "aaronklinker1+npm@gmail.com"
18+
},
19+
"files": [
20+
"dist"
21+
],
22+
"exports": {
23+
".": {
24+
"import": {
25+
"types": "./dist/index.d.ts",
26+
"import": "./dist/index.js"
27+
}
28+
},
29+
"./onshape": {
30+
"import": {
31+
"types": "./dist/onshape.d.ts",
32+
"import": "./dist/onshape.js"
33+
}
34+
}
35+
},
36+
"module": "./dist/index.js",
37+
"types": "./dist/index.d.ts",
38+
"scripts": {
39+
"check": "check -b ../node_modules/.bin",
40+
"dev": "bun test --watch",
41+
"build": "bun build.ts",
42+
"prepare": "bun run build"
43+
},
44+
"dependencies": {
45+
"@antfu/utils": "^0.7.7",
46+
"base64-js": "^1.5.1",
47+
"consola": "^3.2.3",
48+
"ofetch": "^1.3.3",
49+
"zod": "^3.22.4"
50+
},
51+
"devDependencies": {
52+
"publint": "^0.2.7",
53+
"typescript": "^5.0.0"
54+
}
55+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/index.ts npm/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { BoardLayout, Rectangle } from './geometry';
66
import { Distance } from './units';
77

88
export * from './types';
9+
export * from './units';
910

1011
export async function getBoardLayouts(
1112
onshape: OnshapeApiClient,

src/onshape.ts npm/src/onshape.ts

File renamed without changes.

src/types.ts npm/src/types.ts

File renamed without changes.

src/units.ts npm/src/units.ts

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"extends": "./tsconfig.json",
2+
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"noEmit": false,
55
"declaration": true,
66
"emitDeclarationOnly": true,
7-
"outDir": "dist/npm"
7+
"outDir": "dist"
88
},
99
"include": ["src/**/*"],
10-
"exclude": ["src/cli.ts", "src/**/*.test.ts"]
10+
"exclude": ["src/**/*.test.ts"]
1111
}

npm/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../tsconfig.json"
3+
}

package.json

+13-64
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,22 @@
11
{
2-
"name": "onshape-cutlist",
3-
"version": "0.4.0",
4-
"type": "module",
5-
"repository": {
6-
"type": "git",
7-
"url": "https://github.com/aklinker1/onshape-cutlist"
8-
},
9-
"keywords": [
10-
"onshape",
11-
"cutlist",
12-
"woodworking"
13-
],
14-
"license": "MIT",
15-
"author": {
16-
"name": "Aaron Klinker",
17-
"email": "aaronklinker1+npm@gmail.com"
18-
},
19-
"files": [
20-
"bin",
21-
"dist/npm"
2+
"private": true,
3+
"workspaces": [
4+
"npm",
5+
"web"
226
],
23-
"bin": {
24-
"cutlist": "./bin/cutlist.mjs"
25-
},
26-
"exports": {
27-
".": {
28-
"import": {
29-
"types": "./dist/npm/index.d.ts",
30-
"import": "./dist/npm/index.js"
31-
}
32-
}
33-
},
34-
"module": "./dist/npm/index.js",
35-
"types": "./dist/npm/index.d.ts",
367
"scripts": {
37-
"dev": "nuxt dev",
38-
"build:npm": "bun build.npm.ts",
39-
"build:web": "bun build:web:nuxt && bun build:web:docker",
40-
"build:web:nuxt": "nuxt build",
41-
"build:web:docker": "docker build . -t aklinker1/cutlist --platform=linux/amd64",
42-
"preview:web": "nuxt preview",
43-
"preview:web:docker": "docker run -it -p 3000:3000 --env-file .env aklinker1/cutlist",
44-
"publish:web:docker": "bun build:web && docker push aklinker1/cutlist",
45-
"prepare": "simple-git-hooks",
46-
"postinstall": "nuxt prepare"
47-
},
48-
"dependencies": {
49-
"@antfu/utils": "^0.7.7",
50-
"@tanstack/vue-query": "^5.28.4",
51-
"base64-js": "^1.5.1",
52-
"consola": "^3.2.3",
53-
"js-yaml": "^4.1.0",
54-
"ofetch": "^1.3.3",
55-
"zod": "^3.22.4"
8+
"dev": "bun --cwd web dev",
9+
"check": "bun --cwd npm check && bun --cwd web check",
10+
"prepare": "simple-git-hooks"
5611
},
5712
"devDependencies": {
58-
"@aklinker1/check": "^1.1.0",
59-
"@nuxt/ui": "^2.14.2",
6013
"@types/bun": "latest",
61-
"@types/js-yaml": "^4.0.9",
62-
"@vueuse/core": "^10.9.0",
63-
"@vueuse/nuxt": "^10.9.0",
6414
"lint-staged": "^15.2.2",
65-
"nuxt": "^3.11.0",
6615
"prettier": "^3.2.5",
67-
"publint": "^0.2.7",
68-
"simple-git-hooks": "^2.11.0",
69-
"typescript": "^5.0.0",
70-
"vue": "^3.4.21",
71-
"vue-router": "^4.3.0"
16+
"simple-git-hooks": "^2.11.0"
7217
},
7318
"simple-git-hooks": {
74-
"pre-commit": "pnpm lint-staged"
19+
"pre-commit": "bun lint-staged"
7520
},
7621
"lint-staged": {
7722
"*": "prettier --ignore-unknown --write"
@@ -80,5 +25,9 @@
8025
"excludeAuthors": [
8126
"aaronklinker1@gmail.com"
8227
]
28+
},
29+
"dependencies": {
30+
"@aklinker1/check": "^1.3.1",
31+
"standard-version": "^9.5.0"
8332
}
8433
}

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
// https://nuxt.com/docs/guide/concepts/typescript
3-
"extends": "./.nuxt/tsconfig.json",
43
"compilerOptions": {
54
// Enable latest features
65
"lib": ["ESNext"],

.dockerignore web/.dockerignore

File renamed without changes.

.env.example web/.env.example

File renamed without changes.

web/.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.output
3+
.nuxt
4+
.nitro
5+
.env
6+
.env.*
7+
!.env.example

Dockerfile web/Dockerfile

File renamed without changes.

web/components/LayoutList.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
2-
import type { BoardLayout } from '~~/src';
3-
import { Distance } from '~~/src/units';
2+
import type { BoardLayout } from '@aklinker1/cutlist';
3+
import { Distance } from '@aklinker1/cutlist';
44
55
defineProps<{
66
layouts: BoardLayout[];

web/components/LayoutListItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { Distance } from '~~/src/units';
2+
import { Distance } from '@aklinker1/cutlist';
33
44
const props = defineProps<{
55
layout: BoardLayout;

web/components/MainSidebar.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
2-
import type { Config, Project } from '~~/src';
3-
import { Distance } from '~~/src/units';
2+
import type { Config, Project } from '@aklinker1/cutlist';
3+
import { Distance } from '@aklinker1/cutlist';
44
55
const url = useAssemblyUrl();
66
@@ -64,7 +64,7 @@ const tab = ref<'bom' | 'stock' | 'settings' | 'warnings'>('bom');
6464
color="black"
6565
variant="ghost"
6666
square
67-
to="https://github.com/aklinker1/onshape-cutlist/wiki"
67+
to="https://github.com/aklinker1/cutlist/wiki"
6868
target="_blank"
6969
>
7070
User Manual
@@ -75,7 +75,7 @@ const tab = ref<'bom' | 'stock' | 'settings' | 'warnings'>('bom');
7575
color="black"
7676
variant="ghost"
7777
square
78-
to="https://github.com/aklinker1/onshape-cutlist"
78+
to="https://github.com/aklinker1/cutlist"
7979
target="_blank"
8080
>
8181
GitHub

web/components/StockMatrixInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { StockMatrix } from '~~/src';
2+
import { StockMatrix } from '@aklinker1/cutlist';
33
import { z } from 'zod';
44
import YAML from 'js-yaml';
55

web/composables/useBladeWidth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Distance } from '~~/src/units';
1+
import { Distance } from '@aklinker1/cutlist';
22

33
/**
44
* Returns the blade width in standard units based off the settings.

web/composables/useBoardLayoutsQuery.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useQuery } from '@tanstack/vue-query';
22
import { useOnshapeUrl } from './useOnshapeUrl';
3-
import { type Project, getBoardLayouts, type Config } from '~~/src';
3+
import { type Project, getBoardLayouts, type Config } from '@aklinker1/cutlist';
44

55
export default function () {
66
const onshape = useOnshapeApi();

web/composables/useFormatDistance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Distance, toFraction } from '~~/src/units';
1+
import { Distance, toFraction } from '@aklinker1/cutlist';
22

33
export default function () {
44
const unit = useDistanceUnit();

web/composables/useOnshapeApi.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineOnshapeApi } from '~~/src/onshape';
1+
import { defineOnshapeApi } from '@aklinker1/cutlist/onshape';
22

33
export default createGlobalState(() =>
44
defineOnshapeApi({

web/composables/useStock.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { StockMatrix } from '~~/src';
1+
import type { StockMatrix } from '@aklinker1/cutlist';
22

33
export default createGlobalState(() =>
44
useLocalStorage<StockMatrix[]>('@cutlist/stock', [

nuxt.config.ts web/nuxt.config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { resolve } from 'node:path';
22

33
// https://nuxt.com/docs/api/configuration/nuxt-config
44
export default defineNuxtConfig({
5-
srcDir: 'web',
65
modules: ['@nuxt/ui', '@vueuse/nuxt'],
76
ssr: true, // SSG
87
runtimeConfig: {

0 commit comments

Comments
 (0)