Skip to content

Commit

Permalink
Move exports related to Sky to a separate entrypoint in `machine-extr…
Browse files Browse the repository at this point in the history
…actor` package (#402)

* Move exports related to Sky to a separate entrypoint in `machine-extractor` package

* add changeset

* run tests after build
  • Loading branch information
Andarist authored Nov 15, 2023
1 parent 32b7be0 commit b157f29
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-tigers-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@xstate/machine-extractor': patch
---

Moved exports related to Sky to a separate entrypoint.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
cache: 'yarn'

- run: yarn
- run: yarn turbo run lint test
- run: yarn deps:build
- run: yarn turbo run build
- run: yarn vscode:dev
- run: yarn turbo run lint test
- run: (cd apps/extension/client && npx vsce package --yarn)
- uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/sky/writeConfigToFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SkyConfig } from '@statelyai/sky';
import {
modifySkyConfigSource,
skyConfigExtractFromFile,
} from '@xstate/machine-extractor';
} from '@xstate/machine-extractor/sky';
import 'dotenv/config';
import * as fs from 'fs/promises';
import fetch from 'isomorphic-fetch';
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@
"preconstruct": {
"packages": [
"packages/*"
]
],
"exports": {
"importConditionDefaultExport": "default"
},
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"importsConditions": true
}
},
"turbo": {
"globalDependencies": [
Expand Down Expand Up @@ -80,7 +86,7 @@
"@changesets/changelog-github": "^0.4.3",
"@changesets/cli": "^2.21.0",
"@manypkg/cli": "^0.19.1",
"@preconstruct/cli": "^2.5.0",
"@preconstruct/cli": "^2.8.1",
"@types/node": "^16.0.1",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
Expand Down
28 changes: 28 additions & 0 deletions packages/machine-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
"name": "@xstate/machine-extractor",
"version": "0.12.1",
"main": "dist/xstate-machine-extractor.cjs.js",
"module": "dist/xstate-machine-extractor.esm.js",
"exports": {
".": {
"types": {
"import": "./dist/xstate-machine-extractor.cjs.mjs",
"default": "./dist/xstate-machine-extractor.cjs.js"
},
"module": "./dist/xstate-machine-extractor.esm.js",
"import": "./dist/xstate-machine-extractor.cjs.mjs",
"default": "./dist/xstate-machine-extractor.cjs.js"
},
"./sky": {
"types": {
"import": "./sky/dist/xstate-machine-extractor-sky.cjs.mjs",
"default": "./sky/dist/xstate-machine-extractor-sky.cjs.js"
},
"module": "./sky/dist/xstate-machine-extractor-sky.esm.js",
"import": "./sky/dist/xstate-machine-extractor-sky.cjs.mjs",
"default": "./sky/dist/xstate-machine-extractor-sky.cjs.js"
},
"./package.json": "./package.json"
},
"author": "Matt Pocock",
"license": "MIT",
"scripts": {
Expand Down Expand Up @@ -30,5 +52,11 @@
"patch-package": "^6.4.7",
"typescript": "^5.0.4",
"xstate": "^4.33.4"
},
"preconstruct": {
"entrypoints": [
"index.ts",
"sky/index.ts"
]
}
}
4 changes: 4 additions & 0 deletions packages/machine-extractor/sky/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "dist/xstate-machine-extractor-sky.cjs.js",
"module": "dist/xstate-machine-extractor-sky.esm.js"
}
3 changes: 0 additions & 3 deletions packages/machine-extractor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ export * from './extractMachinesFromFile';
export * from './getMachineExtractResult';
export * from './getMachineNodesFromFile';
export * from './groupByUniqueName';
export * from './sky/skyConfigExtractFromFile';
export * from './sky/skyConfigModifySource';
export * from './sky/skyConfigUtils';
export * from './stateNode';
export * from './types';
export * from './utils';
3 changes: 3 additions & 0 deletions packages/machine-extractor/src/sky/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './skyConfigExtractFromFile';
export * from './skyConfigModifySource';
export * from './skyConfigUtils';
3 changes: 2 additions & 1 deletion packages/shared/forEachAction/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/xstate-tools-shared-forEachAction.cjs.js"
"main": "dist/xstate-tools-shared-forEachAction.cjs.js",
"module": "dist/xstate-tools-shared-forEachAction.esm.js"
}
22 changes: 22 additions & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
"name": "@xstate/tools-shared",
"version": "4.0.3",
"main": "dist/xstate-tools-shared.cjs.js",
"module": "dist/xstate-tools-shared.esm.js",
"exports": {
".": {
"types": {
"import": "./dist/xstate-tools-shared.cjs.mjs",
"default": "./dist/xstate-tools-shared.cjs.js"
},
"module": "./dist/xstate-tools-shared.esm.js",
"import": "./dist/xstate-tools-shared.cjs.mjs",
"default": "./dist/xstate-tools-shared.cjs.js"
},
"./forEachAction": {
"types": {
"import": "./forEachAction/dist/xstate-tools-shared-forEachAction.cjs.mjs",
"default": "./forEachAction/dist/xstate-tools-shared-forEachAction.cjs.js"
},
"module": "./forEachAction/dist/xstate-tools-shared-forEachAction.esm.js",
"import": "./forEachAction/dist/xstate-tools-shared-forEachAction.cjs.mjs",
"default": "./forEachAction/dist/xstate-tools-shared-forEachAction.cjs.js"
},
"./package.json": "./package.json"
},
"license": "MIT",
"dependencies": {
"@xstate/machine-extractor": "^0.12.1"
Expand Down
14 changes: 10 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1645,10 +1645,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@preconstruct/cli@^2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@preconstruct/cli/-/cli-2.5.0.tgz#f66ac50aa9a3f7801efacffc8040fdf9b6d7f483"
integrity sha512-EIpiKdSS2KD3hvSKMftJB8jY36YNYoe1+v2u3UcLY0kutqSpxfh/kBKaYmLvXmBQhBo21ccYARB8itwFLOVKjw==
"@preconstruct/cli@^2.8.1":
version "2.8.1"
resolved "https://registry.yarnpkg.com/@preconstruct/cli/-/cli-2.8.1.tgz#7d7f9fa32e1bfd355d79062a9ccc5af4c97b3915"
integrity sha512-PX5w+au06iY/QaT+9RLmRlIfavRCRoMTC/krwtNrgPEnubR9e6P+QlywrKmwiEvkzbR9AEzGnRZL8uNRDDMzrQ==
dependencies:
"@babel/code-frame" "^7.5.5"
"@babel/core" "^7.7.7"
Expand Down Expand Up @@ -1687,6 +1687,7 @@
semver "^7.3.4"
terser "^5.16.8"
v8-compile-cache "^2.1.1"
zod "^3.21.4"

"@preconstruct/hook@^0.4.0":
version "0.4.0"
Expand Down Expand Up @@ -7764,3 +7765,8 @@ yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

zod@^3.21.4:
version "3.22.4"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff"
integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==

0 comments on commit b157f29

Please sign in to comment.