Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
"changelog": [ "@svitejs/changesets-changelog-github-compact", { "repo": "sveltejs/cli" } ],
"changelog": ["@svitejs/changesets-changelog-github-compact", { "repo": "sveltejs/cli" }],
"commit": false,
"fixed": [ ],
"linked": [ ],
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [ "@sveltejs/*", "community-addon-template" ]
"ignore": ["community-addon-template"]
}
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages/cli/tests/snapshots/*
packages/sv/lib/cli/tests/snapshots/*
39 changes: 27 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,43 @@ We follow the standard fork-based workflow:
Please keep your pull requests focused to feature or issue. Focused smaller changes are easier to review and faster to merge.

## Preparing

This is a monorepo, meaning the repo holds multiple packages. It requires the use of [pnpm](https://pnpm.io/). You can [install pnpm](https://pnpm.io/installation) with:

```sh
npm i -g pnpm
```

For running certain packages and tests locally you will need to install [docker](https://docs.docker.com/get-started/get-docker).
_(Optional)_ For running certain packages and tests locally you will need to install [docker](https://docs.docker.com/get-started/get-docker).
Linux users, you will have to ensure 'sudo' is not required. See [docker post install](https://docs.docker.com/engine/install/linux-postinstall/)

`pnpm` commands run in the project's root directory will run on all sub-projects. You can checkout the code and install the dependencies with:

```sh
git clone https://github.com/sveltejs/cli.git
cd cli
pnpm install
```

## Build and run

To build the project and all packages. Run the 'build' script:

```sh
# from root of project
pnpm build
```

This outputs into /packages/PACKAGE/dist/.

Run the 'cli' package:

```sh
pnpm sv
```

Run build with watch mode:

```sh
pnpm dev
```
Expand All @@ -54,29 +60,30 @@ pnpm dev
For each add-on we have integration tests setup. These install the deps, build the app, run the dev server and then run a few small snippets against the add-on to see if the changes introduced by the add-on are working as expected.

Run all tests:

```sh
# from root of project
pnpm test
```

Run tests with vitest ui:

```sh
# from root of project
pnpm test:ui
```

Run package specific tests by specifying a project flag to the package and running the test command. Eg:
```sh
pnpm test --project core # addons / create / migrate / etc.
```
We split tests into packages & sub projects.
Run specific tests by specifying a project flag to the package and running the test command. Eg:

To run a individual test. `cd` into the package. Run the local `test` script to that package, with a path arg to the individual piece you want tested. Eg:
```sh
pnpm test [path-to-test]
pnpm test --project cli # core / addons / create / migrate
```

To debug a failing test. A good starting point is to `cd` into the failing tests dir. Proceed to `build` it. Then `preview` it. From here you will have increased information to help in the debug process. Eg:
Example of how to debug an addon failing test. Once, you ran the test command, you will have a directory in `.test-output` with the test id. A good starting point is to `cd` into the failing tests dir. Proceed to `build` it. Then `preview` it. From here you will have increased information to help in the debug process. Eg:

```sh
pnpm test --project addons tailwind # to debug the tailwind addon failing test
# Each test is a standalone app
cd .test-output/addons/[addon-test]/[test-id]
pnpm build
Expand All @@ -91,32 +98,40 @@ There are a few guidelines we follow:

- Ensure `pnpm lint` and `pnpm check` pass. You can run `pnpm format` to format the code
- linting

```sh
# from root of project
pnpm lint
```

- formatting

```sh
# from root of project
pnpm format
```

- type checking

```sh
# from root of project
pnpm check
```

## svelte-migrate

To run svelte-migrate locally:

```sh
# from root of project
node ./packages/migrate/bin.js
node ./packages/migrate/bin.js
```

## Generating changelogs
Only publish a change set if it is in 'sv' or 'svelte-migrate' as all other packages are bundled.
For changes to be reflected in package changelogs:

Here is the command to generate a change set:

```sh
# from root of project
pnpm changeset:publish
pnpm changeset
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Read the [SvelteKit documentation](https://svelte.dev/docs/kit) for more details

| Package | Changelog | Documentation |
| ---------------------------------- | ------------------------------------------ | ------------------------------------------------------- |
| [sv](packages/cli) | [Changelog](packages/cli/CHANGELOG.md) | [Documentation](https://svelte.dev/docs/cli/overview) |
| [sv](packages/sv) | [Changelog](packages/sv/CHANGELOG.md) | [Documentation](https://svelte.dev/docs/cli/overview) |
| [svelte-migrate](packages/migrate) | [Changelog](packages/migrate/CHANGELOG.md) | [Documentation](https://svelte.dev/docs/cli/sv-migrate) |

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion community-addon-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ After that, feel free to open a pull request to [`sv`](https://github.com/svelte

## Things to be aware of

Community add-ons are **not permitted** to have any external dependencies outside of `@sveltejs/cli-core`. If the use of a dependency is absolutely necessary, then they can be bundled using a bundler of your choosing (e.g. Rollup, Rolldown, tsup, etc.).
Community add-ons are **not permitted** to have any external dependencies outside of `sv`. If the use of a dependency is absolutely necessary, then they can be bundled using a bundler of your choosing (e.g. Rollup, Rolldown, tsup, etc.).
3 changes: 1 addition & 2 deletions community-addon-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
],
"exports": "./src/index.js",
"dependencies": {
"@sveltejs/cli-core": "workspace:*"
"sv": "workspace:*"
},
"devDependencies": {
"@playwright/test": "^1.56.1",
"sv": "workspace:*",
"vitest": "4.0.7"
},
"keywords": [
Expand Down
7 changes: 2 additions & 5 deletions community-addon-template/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { defineAddon, defineAddonOptions } from '@sveltejs/cli-core';
import { imports } from '@sveltejs/cli-core/js';
import * as svelte from '@sveltejs/cli-core/svelte';
import { parseSvelte } from '@sveltejs/cli-core/parsers';
import { defineAddon, defineAddonOptions, js, svelte, parseSvelte } from 'sv/core';

export const options = defineAddonOptions()
.add('demo', {
Expand Down Expand Up @@ -29,7 +26,7 @@ export default defineAddon({
if (!options.demo) return content;
const { ast, generateCode } = parseSvelte(content);
const scriptAst = svelte.ensureScript(ast, { langTs: typescript });
imports.addDefault(scriptAst, { from: '../addon-template-demo.txt?raw', as: 'demo' });
js.imports.addDefault(scriptAst, { from: '../addon-template-demo.txt?raw', as: 'demo' });
return generateCode();
});
}
Expand Down
1 change: 1 addition & 0 deletions community-addon-template/vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const ONE_MINUTE = 1000 * 60;

export default defineConfig({
test: {
name: 'community-addon-template',
include: ['tests/**/*.test.{js,ts}'],
exclude: ['tests/setup/*'],
testTimeout: ONE_MINUTE * 3,
Expand Down
11 changes: 5 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ export default [
},
{
ignores: [
'packages/create/shared/**/*',
'packages/create/scripts/**/*',
'packages/create/templates/**/*',
'**/temp/*',
'**/.test-output/*',
'**/dist/*',
'packages/**/tests/**/{output,input}.ts',
'packages/cli/tests/snapshots/*',
'rolldown.config.js',
'packages/sv/lib/create/shared/**/*',
'packages/sv/lib/create/scripts/**/*',
'packages/sv/lib/create/templates/**/*',
'packages/sv/lib/cli/tests/snapshots/*',
'packages/sv/lib/**/tests/**/{output,input}.ts',
'community-addon-template/tests/*'
]
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"devDependencies": {
"@changesets/cli": "^2.29.7",
"@playwright/test": "^1.56.1",
"@sveltejs/create": "workspace:*",
"@sveltejs/eslint-config": "^8.3.4",
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
"@types/node": "^22.19.1",
Expand Down
21 changes: 0 additions & 21 deletions packages/addons/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/addons/tsconfig.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/cli/lib/index.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/cli/lib/tsconfig.json

This file was deleted.

8 changes: 0 additions & 8 deletions packages/core/README.md

This file was deleted.

63 changes: 0 additions & 63 deletions packages/core/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions packages/core/tests/js/vite/with-variable/run.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/core/tests/svelte/common/ensure-script/run.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/core/tests/svelte/common/keep-script-ts/run.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/core/tests/tsconfig.json

This file was deleted.

10 changes: 0 additions & 10 deletions packages/core/tsconfig.json

This file was deleted.

Loading
Loading