-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
breaking: update svelte-package
#8922
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
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
55524fc
remove config.package, dont generate package.json
Rich-Harris 0915da2
remove automatic package generation
Rich-Harris c52b2c2
oops
Rich-Harris 47bd6b0
migration
dummdidumm ac82d25
docs
dummdidumm a6c16dc
create-svelte
dummdidumm 3628c4f
add files migration, more robust outdir migration
dummdidumm 5455622
changelog
dummdidumm 5f6a616
get some tests passing
dummdidumm 66cf5c2
fix $lib path creation
dummdidumm 7193530
special case
Rich-Harris 05aec7b
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris fe4f9f7
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris 05b549c
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris 5cec3e1
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris da8be8f
doc tweaks
dummdidumm b1afaf7
migrate to export conditions
dummdidumm 03c6906
add warning log before prompt
dummdidumm 86ab0c9
remove test
dummdidumm 3f45335
fix types
dummdidumm 9c443f2
Update documentation/docs/30-advanced/70-packaging.md
dummdidumm 833c546
update link
dummdidumm 4b2aa81
bump package version during migration
dummdidumm 609b49a
fix package.json template
dummdidumm d12f7e1
fix link
dummdidumm 698bf2e
add validation
dummdidumm a6fe310
tabs
Rich-Harris 0abd600
fix
Rich-Harris b33c555
Update packages/package/src/validate.js
Rich-Harris b579f15
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris f108a2b
combine
Rich-Harris b0a605e
Update documentation/docs/30-advanced/70-packaging.md
dummdidumm 45d89a6
Update packages/create-svelte/templates/skeletonlib/package.template.…
dummdidumm 2a8c832
nested conditions
dummdidumm 00502ec
use publint, add svelte field match check
dummdidumm 2c668c6
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris d13f1d9
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris 6fa4730
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris d04620c
Update documentation/docs/30-advanced/70-packaging.md
Rich-Harris d7ddb4c
Update packages/create-svelte/templates/skeletonlib/package.template.…
dummdidumm 9263309
package.json
dummdidumm 92488f4
docs on exports
dummdidumm 2b09af6
update docs
Rich-Harris add1d89
remove default export condition
Rich-Harris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'svelte-migrate': minor | ||
| --- | ||
|
|
||
| feat: add `@sveltejs/package` migration (v1->v2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'create-svelte': major | ||
| --- | ||
|
|
||
| breaking: update library scaffolding for `@sveltejs/package` version 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/package': major | ||
| --- | ||
|
|
||
| breaking: remove `package.json` generation and package options from `svelte.config.js`. New default output directory is `dist`. Read the migration guide at https://github.com/sveltejs/kit/pull/8922 to learn how to update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "title": "Library skeleton project", | ||
| "title": "Library project", | ||
Rich-Harris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "description": "Barebones scaffolding for your new Svelte library" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import fs from 'fs'; | ||
| import colors from 'kleur'; | ||
| import path from 'path'; | ||
| import prompts from 'prompts'; | ||
| import { pathToFileURL } from 'url'; | ||
| import { bail, check_git } from '../../utils.js'; | ||
| import { migrate_config } from './migrate_config.js'; | ||
| import { migrate_pkg } from './migrate_pkg.js'; | ||
|
|
||
| export async function migrate() { | ||
| if (!fs.existsSync('svelte.config.js')) { | ||
| bail('Please re-run this script in a directory with a svelte.config.js'); | ||
| } | ||
| if (!fs.existsSync('package.json')) { | ||
| bail('Please re-run this script in a directory with a package.json'); | ||
| } | ||
|
|
||
| console.log( | ||
| colors | ||
| .bold() | ||
| .yellow( | ||
| '\nThis will update your svelte.config.js and package.json in the current directory\n' | ||
| ) | ||
| ); | ||
|
|
||
| const use_git = check_git(); | ||
|
|
||
| const response = await prompts({ | ||
| type: 'confirm', | ||
| name: 'value', | ||
| message: 'Continue?', | ||
| initial: false | ||
| }); | ||
dummdidumm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (!response.value) { | ||
| process.exit(1); | ||
| } | ||
|
|
||
| const { default: config } = await import(pathToFileURL(path.resolve('svelte.config.js')).href); | ||
| const has_package_config = !!config.package; | ||
|
|
||
| config.package = { | ||
| source: path.resolve(config.kit?.files?.lib ?? config.package?.source ?? 'src/lib'), | ||
| dir: config.package?.dir ?? 'package', | ||
| exports: | ||
| config.package?.exports ?? | ||
| ((/** @type {string} */ filepath) => !/^_|\/_|\.d\.ts$/.test(filepath)), | ||
| files: config.package?.files ?? (() => true), | ||
| emitTypes: config.package?.emitTypes ?? true | ||
| }; | ||
| config.extensions = config.extensions ?? ['.svelte']; | ||
|
|
||
| migrate_pkg(config); | ||
|
|
||
| if (has_package_config) { | ||
| migrate_config(); | ||
| } | ||
|
|
||
| console.log(colors.bold().green('✔ Your project has been migrated')); | ||
|
|
||
| console.log('\nRecommended next steps:\n'); | ||
|
|
||
| const cyan = colors.bold().cyan; | ||
|
|
||
| const tasks = [ | ||
| use_git && cyan('git commit -m "migration to @sveltejs/package v2"'), | ||
| `Review the migration guide at https://github.com/sveltejs/kit/pull/8922`, | ||
| `Read the updated docs at https://kit.svelte.dev/docs/packaging` | ||
| ].filter(Boolean); | ||
|
|
||
| tasks.forEach((task, i) => { | ||
| console.log(` ${i + 1}: ${task}`); | ||
| }); | ||
|
|
||
| console.log(''); | ||
|
|
||
| if (use_git) { | ||
| console.log(`Run ${cyan('git diff')} to review changes.\n`); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.