Vaadin automatically update versions in package-lock.json - vaadin

I`m using Vaadin version 14.1.5
According to migration guide, it not needed to add package-lock.json to version control, if I don`t edit it
But today, without any changes in vaadin version, versions in package-lock.json was updated automatically, and out UI was broken without any changes by hands, just on next rebuild.
Why is this happened? Does it means, that I should always commit my package-lock.json stable version? Or what is correct pattern for working with dependencies in vaadin?

There is a regression in a transitive dependency release from last night used by Webpack to build the frontend files (affecting modern ES6 browsers in this case).
In case you remove the package-lock.json file in your 14 / 15 project, you will likely get a broken frontend build artifact for production build (output of build-frontend).
We are shipping fixes for 14.1 & 14.2 and 15.
In case you have removed the lock file and you need to build things today, you can workaround this by adding the following pin to the package.json:
"terser": "4.6.7",
We are taking steps to make sure this does not repeat - that the dependencies used by the frontend build (not in the app itself) are also locked and can be relied on.

Related

How to install node_modules only one time for one React JS project?

As I am implementing release automation of React JS project using Jenkins, it is required to download node_modules for a project only once and update successively. It doesn't mean one node_ modules for all projects. But one-time install for one project.
For example, Let's consider a project LoginReactApp.
I have to maintain a workspace like D:/jenkins/workspace/LoginReactApp.
So, I have to check out the source under D:/jenkins/workspace/LoginReactApp/LoginReactApp
and based on the package.json file, I need to download it under D:/jenkins/workspace/LoginReactApp/.
After the release process, the LoginReactApp project source will be deleted under D:/jenkins/workspace/LoginReactApp/ and the node_modules folder will not be deleted.
So, next time it is enough to check out only LoginReactApp project source D:/jenkins/workspace/LoginReactApp/ and it refers to already installed node_modules.
I have tried in command prompt below.
D:/jenkins/workspace/LoginReactApp/LoginReactApp>npm install
--production --f --prefix D:/jenkins/workspace/LoginReactApp/
Is it right? For next time it behaves differently.
How to install node_modules only one time for one React JS project?

Where is Swift Package Manager cache located (Swift 5.7)?

After retagging a git commit I'm no longer able to fetch the package, because SP Manager uses some cache which I can't find and clean. Getting error:
Revision 30c16cab9c718416fee2191ff2ac0b6f91eeb511 for base
remoteSourceControl https://github.com/myUser/myRepo version 1.0.0
does not match previously recorded value
I cleaned all known to me places: local .build folder, SPM caches in Home and Library/Caches folders, DerivedData, removed Package.resolved.
Using Swift 5.7, trying to generate via swift package generate-xcodeproj.
Does anyone know where this cache is?
This one solves the issue for me.
rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/org.swift.swiftpm
From https://blog.todosobreios.com/solucionar-problemas-de-swift-pacakge-manager-spm/
It depends on whether you're building via Xcode, or directly via swift build.
Xcode keeps its packages in ~/Library/Developer/Xcode/DerivedData/<your project>/SourcePackages/checkouts/.
SPM keeps them in .build/checkouts of the project folder.
In general, you should never change the commit a version tag points to, for precisely the reasons you experienced. The version numbers form the identity of a package version (not a commit hash, hash of the files, or anything like that). All the systems that are made to work with package rely on the notion that equal version number means they're identical. You're invalidating this assumption, and you'll cause bugs all over. Release a new minor version with your fix, instead.

. Why I am getting an error message? Building a React App

I wanted to start practicing with React to make a simple app. Went ahead and downloaded homebrew and node onto my computer. As I build my app with yarn install I get to the end where it tells you happy hacking. But when I run yarn start it gives me an error message.
-There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "^6.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
/Users/zacharyschneider/node_modules/eslint (version: 5.16.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if /Users/zacharyschneider/node_modules/eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
zacharyschneider#Zacharys-MBP %
A way to solve this issue or help me understand what is going on that would be great or point me in the right direction to find resources.
Thanks for your Help
It seems like you have installed es-lint 5.16.0 manually, and it conflicts with the needed version (6.6.0).
Have you tried the steps suggested in the error message?
Do you explicitly tell the es-lint version in your package.json? Could you share your package.json if you continue to experience the issue?

Cordova updates are resetting project

Every time I
Update my Cordova version
Update a Cordova platform version
Update a plugin
Add a plugin
To an existing app using node e.g.
cordova plugin add [some-plugin]
cordova platform update ios
etc
The update/add process always resets my [platform]/www/ folder to an empty project. I always take a backup before doing this, and put the www files back in. But there is always a conflict, or missed or forgotten files, which just increases the time to update.
This can't be right. Surely the Cordova update process can't really involve wiping out your existing project and starting again.
What am I doing wrong?
With a regular Cordova workflow you shouldn't be making any changes within the platforms directory. The platforms and plugins folders should be considered build artifacts and not checked in to source control. Cordova will automatically recreate them when needed.
When you run cordova prepare it will install all of the plugins you have listed in config.xml and copy the content of your root www folder to the platform www folder.

how add manually a cordova plugin to ios existing project

i've a cordova project created via cordova cli command.
i build the project for Android and iOS platform but... i copied the build project into respective workspace (eclipse/xcode) and i updated that single project.
Now i need to add a plugin.
The project into cordova project folder is now so outdate so i would add the plugin via cli and copy the plugin to the respective project.
I copied successfully the generated plugin into the android project, but i'm not able to do the same thing with iOS.
For example i added the console plugin for iOS
cordova plugin add org.apache.cordova.console
if i open and run the build project it work and i see my message in console, but if i try to copy the generated plugin into my existing project it doesn't work.
nobody could help me to understand how add manually a plugin into my existing project?
update
yes i know, i'll try to explain better
i have my cordova project under folder /Document/cordova
when i made an ios build via command line cordova put the built project under /Document/cordova/platforms/ios
well i copied the folder ios under /workspace/my-project-name
after some work under workspace i see that i need to add a cordova plugin.
i added the plugin via command line and it was added to /Document/cordova/platforms/ios
at this poin i have a project under /Document with plugin but asset outdated and one project updated without plugin under /workspace
i'm trying to copy from built project to /workspace project.
i copied
/workspace/my-project-name/my-project-name/Plugins
/workspace/my-project-name/my-project-name/config.xml
/workspace/my-project-name/www/plugins
/workspace/my-project-name/www/cordova.js
/workspace/my-project-name/www/cordova_plugins.js
but it doesn't work... i missed somethings?
After reading it several times I think I get more less the idea...
Well, I am not sure why do you want to copy the ios project outside the current location. I suppose you have a good reason to do it, however you can always tweak that project instead of going back and forward, cordova will not impact non cordova related files each time you run "cordova build".
Are you familiar with control versioning? Git, SVN, mercurial? If so it is simple just we which files were impacted once you add the plugin and copy those... If no, I suggest using control versioning anyways to help keep track of your code changes.
NOTE: Be aware if you build the cordova projet and then you just want to update the files noted above it is highly likely that it won't work, that is why you run "build" is not a simple file sync. I recommend taking the new cordova project with the plugin added and then just add you personal tweaks on the ios in the other folder. Or just tweak the ios folder inside platforms folder...
I hope you are doing for good reason. Anyway you are missing to copy below file to work
/workspace/my-project-name/my-project-name/platforms/ios/my-project-name/config.xml
Copying the cordova iOS platform folder is not a good idea. The reason is, cordova builds an Xcode project in the platform folder, and there is some sort of caching/built in references to absolute location of the original Xcode project. Therefore it would be unclear to you and to Xcode which file is being referenced from within Xcode. This may have caused some other unnoticed errors in the project as well. So therefore, instead of keeping original project path available along with the new path, I would recommend renaming the original project folder in order to remove the ambiguity. This way, you will assure that the right file versions are referenced.

Resources