Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add sveltekit ts project example #46

Merged
merged 11 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,43 @@

Demonstrate how to integrate [maxGraph](https://github.com/maxGraph/maxGraph/) in projects.

⏩ Find the live demo at https://maxgraph.github.io/maxgraph-integration-examples/
⏩ Find the live demo at <https://maxgraph.github.io/maxgraph-integration-examples/>
indaco marked this conversation as resolved.
Show resolved Hide resolved

## Getting started

### Setup

Ensure you are using Node 18 (this is the tested version, it may work with other versions without guarantee)

If you are using `nvm`, run
If you are using `nvm`, run:

```shell
nvm use
```

If the Node version is not installed, `nvm` will state how to install the required version.


### Available projects

- [TypeScript with Lit](./projects/lit-ts/README.md)
- [TypeScript with Parcel](./projects/parcel-ts/README.md)
- [TypeScript with Rollup](./projects/rollup-ts/README.md)
- [TypeScript with ViteJs](./projects/vitejs-ts/README.md)

- [TypeScript with SvelteKit](./projects/sveltekit-ts/README.md)

### <a id="maxgraph-dev-version"></a> Use the maxGraph development version

**Note**: the `maxGraph` development version is tested in a [GitHub Workflow](./.github/workflows/check-typescript-projects.yml) that uses the procedure explained below.

Build [maxGraph](https://github.com/maxGraph/maxGraph/) locally:
- from the `maxGraph` project root, run: `npm install`
- then, from the `packages/core` folder, run: `npm pack`
- the `packages/core` folder or the generated `packages/core/maxgraph-core-***.tgz` file are now ready for use in an external project

- from the `maxGraph` project root, run: `npm install`
- then, from the `packages/core` folder, run: `npm pack`
- the `packages/core` folder or the generated `packages/core/maxgraph-core-***.tgz` file are now ready for use in an external project

In this folder where you clone the `maxgraph-integration-examples` project, go to the folder of the example you want to use. Then you can use one of the following solution
- with [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link): `npm link <path_to_locally_installed_maxgraph>/packages/core`: create a soft link to the maxgraph local folder.

- with [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link): `npm link <path_to_locally_installed_maxgraph>/packages/core`: create a soft link to the maxgraph local folder.
Repack of maxgraph is automatically available in the examples
- alternative: `npm install <path_to_locally_installed_maxgraph>/packages/core/maxgraph-core-0.1.0.tgz`. This changes
- alternative: `npm install <path_to_locally_installed_maxgraph>/packages/core/maxgraph-core-0.1.0.tgz`. This changes
the package.json file. You must run this command again each time you rebuild the maxgraph npm package.
10 changes: 10 additions & 0 deletions projects/sveltekit-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
2 changes: 2 additions & 0 deletions projects/sveltekit-ts/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
engine-strict=true
resolution-mode=highest
16 changes: 16 additions & 0 deletions projects/sveltekit-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# sveltekit-ts

Initialized from [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte)

## Setup

From the project root, run `npm install`.

If you want to use the maxGraph development version (built locally), see the README about maxGraph integration.

## Running the project

Run `npm run dev` and go to http://localhost:5173/

If you want to bundle the application, run `npm run build` and then run `npm run preview` to access to a preview of the
bundle application.
22 changes: 22 additions & 0 deletions projects/sveltekit-ts/package.json
indaco marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "maxgraph-ts-example-built-with-sveltekit",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
tbouffard marked this conversation as resolved.
Show resolved Hide resolved
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@maxgraph/core": "^0.4.0",
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.25.0",
"svelte": "^4.2.0",
"svelte-check": "^3.5.1",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.4.9"
},
"type": "module"
}
Loading