-
-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3107 from Hugos68/feature/cli-improvements-3
Feature: CLI Improvements 3
- Loading branch information
Showing
88 changed files
with
1,141 additions
and
721 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
--- | ||
'@skeletonlabs/skeleton-cli': patch | ||
--- | ||
|
||
Feature: The `class:` directive will also be transformed when they're not also an identifier. |
This file contains 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 @@ | ||
--- | ||
'@skeletonlabs/skeleton-cli': patch | ||
--- | ||
|
||
Bugfix: transformations on the package.json now preserve the original indentation. |
This file contains 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 @@ | ||
--- | ||
'@skeletonlabs/skeleton-cli': patch | ||
--- | ||
|
||
Feature: `app.html` is now transformed. |
This file contains 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 @@ | ||
--- | ||
'@skeletonlabs/skeleton-cli': patch | ||
--- | ||
|
||
Feature: Better error handling is now in place. |
This file contains 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 @@ | ||
--- | ||
'@skeletonlabs/skeleton-cli': patch | ||
--- | ||
|
||
Feature: `<packagemanager> install` is now ran at the end of the migration. |
This file contains 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 @@ | ||
--- | ||
'@skeletonlabs/skeleton-cli': patch | ||
--- | ||
|
||
Feature: Rename all components imports and usages. |
This file contains 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 @@ | ||
--- | ||
'@skeletonlabs/skeleton-cli': patch | ||
--- | ||
|
||
Feature: Removed components have their imports removed. |
This file contains 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 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
35 changes: 35 additions & 0 deletions
35
...ges/skeleton-cli/src/commands/migrate/migrations/skeleton-3/transformers/transform-app.ts
This file contains 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,35 @@ | ||
import { type AST, parse } from 'svelte/compiler'; | ||
import MagicString from 'magic-string'; | ||
import { walk } from 'zimmerframe'; | ||
|
||
function transformApp(code: string, theme: string) { | ||
const s = new MagicString(code); | ||
const ast = parse(code, { | ||
modern: true | ||
}); | ||
walk( | ||
ast.fragment as AST.SvelteNode, | ||
{}, | ||
{ | ||
RegularElement(node, ctx) { | ||
if (node.name === 'body') { | ||
const dataThemeAttribute = node.attributes.find((attribute) => { | ||
return attribute.type === 'Attribute' && attribute.name === 'data-theme'; | ||
}); | ||
const newDataThemeAttribute = `data-theme="${theme}"`; | ||
if (dataThemeAttribute) { | ||
s.update(dataThemeAttribute.start, dataThemeAttribute.end, newDataThemeAttribute); | ||
} else { | ||
s.appendLeft(node.start + '<body'.length, ` ${newDataThemeAttribute}`); | ||
} | ||
} | ||
ctx.next(); | ||
} | ||
} | ||
); | ||
return { | ||
code: s.toString() | ||
}; | ||
} | ||
|
||
export { transformApp }; |
This file contains 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
58 changes: 0 additions & 58 deletions
58
...eton-cli/src/commands/migrate/migrations/skeleton-3/transformers/transform-module.test.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.