Migrating from 0.1.x
Most conventional 0.1.x themes will work on 0.2.x with a few minor tweaks.
Migration guide
Follow these steps to migrate a 0.1.x theme to 0.2.x:
- Update SALVO-TS:
npm install --save @eastsideco/salvo-ts@0.2 @eastsideco/salov-ts-build@0.2
- Upgrade TS and Sass:
npm install --save typescript@5.1.3 sass@1.63.3
- Update
tsconfig.json:- Change
targetto"ES2016" - Change
libto"es2020"
- Change
- Delete the following lines:src/main.tstsregisterComponents(require.context('./components/', true), process.env.SALVO_BUILD_VARIANT);src/main.tstsregisterComponents(require.context('./components/', true), process.env.SALVO_BUILD_VARIANT);src/utils/formattingtsexport * from '@eastsideco/salvo-ts/lib/imports/formatting';src/utils/formattingtsexport * from '@eastsideco/salvo-ts/lib/imports/formatting';
SALVO-TS is now updated, but there are probably some other changes you need to make to finish upgrading:
*SCSS
- Sass has been updated and no longer supports implicit math without
calc()in interpolations:Deprecatedscssmin-width: #{$size-container + $spacing-border};Deprecatedscssmin-width: #{$size-container + $spacing-border};Replacementscssmin-width: #{calc($size-container + $spacing-border)};Replacementscssmin-width: #{calc($size-container + $spacing-border)}; - Sass has been updated and no longer supports implicit conversion between unitless and unit values:Deprecatedscss$size-container: 500px;min-width: #{calc($size-container + 1)}; // 500px + 1max-width: #{calc($size-container * 2px)}; // 500px * 2pxDeprecatedscss$size-container: 500px;min-width: #{calc($size-container + 1)}; // 500px + 1max-width: #{calc($size-container * 2px)}; // 500px * 2pxReplacementscss$size-container: 500px;min-width: #{calc($size-container + 1px)}; // 500px + 1pxmax-width: #{calc($size-container * 2)}; // 500px * 2Replacementscss$size-container: 500px;min-width: #{calc($size-container + 1px)}; // 500px + 1pxmax-width: #{calc($size-container * 2)}; // 500px * 2
- Sass has been updated and no longer supports implicit math without
Decorators
Decorators must be static and resolvable at build-time, including default values. Move any runtime logic from your decorators into your component constructor or init:
Unsupportedts@Prop({ default: window.pageYOffset }) scrollPosition!: number;Unsupportedts@Prop({ default: window.pageYOffset }) scrollPosition!: number;Replacementts@Prop({ default: 0 }) scrollPosition!: number;init() {this.scrollPosition = window.pageYOffset;}Replacementts@Prop({ default: 0 }) scrollPosition!: number;init() {this.scrollPosition = window.pageYOffset;}
Legacy components
- Legacy components must be manually imported into `src/main.ts:src/main.tstsimport "./components/LegacyExample.js";src/main.tstsimport "./components/LegacyExample.js";
- Support for legacy components will be removed soon. Update your legacy components to standard SALVO-TS components.
- Legacy components must be manually imported into `src/main.ts:
CSS imports
- To optimize loading, TS files should not import CSS files. Move your CSS imports into your SCSS:Unsupported: src/components/ExampleComponent.tstsimport "mylib/foo.css";Unsupported: src/components/ExampleComponent.tstsimport "mylib/foo.css";Replacement: src/components/ExampleComponent.scssscss@import "mylib/foo.css";Replacement: src/components/ExampleComponent.scssscss@import "mylib/foo.css";
- To optimize loading, TS files should not import CSS files. Move your CSS imports into your SCSS:
Component structure
- You must use a component's tag in it's template, or it's assets will not be loaded:Unsupportedhtml<!-- Won't load any stylesheet because it doesn't refer to a component tag --><ul class="navigation-breadcrumbs"><li>Foo</li></ul>Unsupportedhtml<!-- Won't load any stylesheet because it doesn't refer to a component tag --><ul class="navigation-breadcrumbs"><li>Foo</li></ul>Replacementhtml<!-- Will trigger NavigationBreadcrumbs.scss to load --><navigation-breadcrumbs><ul class="navigation-breadcrumbs"><li>Foo</li></ul></navigation-breadcrumbs>Replacementhtml<!-- Will trigger NavigationBreadcrumbs.scss to load --><navigation-breadcrumbs><ul class="navigation-breadcrumbs"><li>Foo</li></ul></navigation-breadcrumbs>
- Component rules are more strictly required. This includes only exporting only one file per component, component names matching their filenames, and the other conventions which were previously advisory. Themes which follow the existing conventions should be fine, but you may need to move classes or rename files to match otherwise.
- You must use a component's tag in it's template, or it's assets will not be loaded: