-
Notifications
You must be signed in to change notification settings - Fork 16
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
Upgrade Path from 1.x to 2.x #276
Comments
Hi, we are currently working on smooth upgrade process |
Let me know if you need any of that tested. Happy to help. Thanks for the enormous work you've put into this! |
famous last words ! Also very keen and happy to test :) |
Hi! There is already an upgrade path but it is not fully documented but would be great if you can test. Here are the first docs |
ok so ... I've started. I'll try to document some of the issues here. My environment is Ubuntu running docker with Wingsuit in a Node 18-alpine container. My general approach was to: delete everything and get a Starterkit up and running. I started with the vanilla SCSS version but that was pretty incomplete so I moved the the Tailwind one and got it installed and spun up (issues below). I then bought in the presets and addons as required from the SCSS Starterkit and made a mixture. Once up, I bought back in a simple example from my old project and got it working, then started adding my own dependencies and fixing stuff along the way until finally adding back in everything from my project and doing a final round of fixes. So yeh, migration in a pretty loose sense. Here are some issues and notes. Yarn Preset Migration Previously, I'd have the following folder structure:
I have a file: component_a:
use: "@group/component_a.twig"
label: "Group/Component A"
component_b:
use: "@group/component_b.twig"
label: "Group/Component B"
component_c:
use: "@group/component_c.twig"
label: "Group/Component C"
component_d:
use: "@group/component_d.twig"
label: "Group/Component D" It would correctly load and display my components in Storybook all nested under 'Group'. Now it doesn't.
Question - what is the purpose of the That being said - I am up and running, the performance increase is great. But I do have a lot of manual refactoring to do (as described above) and will probably look at a bash script to help. More to come I'm sure .... |
Hi! First of all thanks for testing!
Thanks again for your testing. If you like to discuss further we can have a chat/talk on slack |
Hi, I immediately encountered the helpful Drupal-like "pattern not found, possible patterns are xxxxx" message - which is great. I was unaware of the dependencies field so I dealt with it a different way. I made sure that component's Plain card (component being viewed) folder.
/cards/plain-card/plain-card.twig {{ pattern('base_card') }} /cards/plain-card/index.js // index.js is loaded automatically.
include '.../base-card/' Base card (dependency) folder
/cards/base-card/index.js include './base-card.stories.wingsuit.jsx' This does create a lot of dependencies the index.js, but I presume that is what is happening with the 'dependencies' field too ? and it is actually good practice to do it correctly, it just takes more thought. Yes would like to chat - lots more questions :) |
Here is the script I am using to separate out my stories (python). It is saving me a lot of time. It might at least be inspiration for someone writing in node! I am refactoring one by one, and then checking they work and deleting the originals - but you change it to be recursive and forceful. from pathlib import Path
import oyaml as yaml
import os
# The atomic folder and the source story and wingsuit files containing the component bundle.
pattern_dir = '01-atoms/form'
story_file = 'form.stories.wingsuit.jsx'
wingsuit_file = 'form.wingsuit.yml'
base_dir = './source/default/patterns'
output_dir = os.path.join(base_dir, pattern_dir)
orig_story = os.path.join(output_dir, story_file)
orig_wingsuit = os.path.join(output_dir, wingsuit_file)
# Get the contents of the story file, this will be out template.
story_contents = Path(orig_story).read_text()
# Get the contents of the wingsuit file to separate out.
with open(orig_wingsuit, 'r') as file:
# Convert the yaml to an orderedDict (use oyaml not pyaml)
config = yaml.safe_load(file)
# Loop through each item, which corresponds to a component.
for key, value in config.items():
# Restructure.
new_value = {
key: value
}
# Component names should have underscores, but their files should have dashes.
file_key = key.replace('_', '-')
# Construct new file names.
new_story_file = file_key + '.stories.wingsuit.jsx'
new_wingsuit_file = file_key + '.wingsuit.yml'
# The new story is simply the template but replacing the file reference.
new_story_contents = story_contents.replace(wingsuit_file, new_wingsuit_file)
# The new wingsuit is simply the item we are looping through, so yaml.dump it (like json.dumps).
new_wingsuit_contents = yaml.dump(new_value)
# Create the paths.
new_story = os.path.join(output_dir, new_story_file)
new_wingsuit = os.path.join(output_dir, new_wingsuit_file)
# Write the files.
with open(new_story, "w") as text_file:
text_file.write(new_story_contents)
with open(new_wingsuit, "w") as text_file:
text_file.write(new_wingsuit_contents)
# Maybe delete the orig files now ? hmm... maybe keep them for now, rename, check, and manually delete. |
With a few bumps (mostly missing dependencies I believe) I managed to upgrade to 2.0! Previously
Now:
Progress! The 2 critical are:
|
Is your feature request related to a problem? Please describe.
I've been fighting security issues related to npm audit for a a while now on 1.x and wanting/hoping that some of the whoas would be mitigated by updating to 2.x of wingsuit, and hoping the upgrade path is fairly smooth. Granted that both hopes are likely naïve.
Describe the solution you'd like
Clear set of steps to move from 1.x to 2.x
Describe alternatives you've considered
Tried to get
npm
working to install wingsuit 1.x with less dependencies, since less dependencies means less to maintain and keep secure.Additional context
The text was updated successfully, but these errors were encountered: