Giter Club home page Giter Club logo

deyarn's Introduction

deyarn

A command-line tool for converting projects that use yarn to npm.

The follow-up to npm2yarn. See https://mixmax.com/blog/to-yarn-and-back-again-npm for motivation.

Procedure

deyarn:

  1. Removes yarn.lock if it exists
  2. Removes node_modules to avoid any installation conflicts
  3. Installs your project dependencies using npm, generating a package-lock.json file
  4. Logs a list of manual steps to be taken to complete the transition

This conversion will likely involve the upgrading of some/many of your transitive dependencies, so make sure to test thoroughly! :)

Quick Start

You can use deyarn via npx to quickly convert a project without needing to install deyarn first. Just run the following command in your project directory:

npx deyarn

Note: The directory must be a Git repository.

Alternative Usage

Alternatively you can install deyarn globally (see below) and then run $ deyarn in your project directory instead.

Installation

npm install -g deyarn

or

yarn global add deyarn

Contributing

We welcome your pull requests! Please lint your code.

Changelog

  • 1.0.0 Add initial code

deyarn's People

Contributors

blimmer avatar bradvogel avatar infodusha avatar lukebarton avatar renovate[bot] avatar spencer-brown avatar wearhere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deyarn's Issues

Shouldn't checkout master branch

I was just browsing through your readme and noticed that the command checks out the master branch before starting the process. This enforces a branching model on users unnecessarily. For those using a branching model such as GitFlow, checking out master would mean basing the changes on production code, rather than the develop branch.

I suggest that instead the tool simply branch off of whatever the current branch is, leaving the choice of branching model up to the user.

Not fully working as intended

When I run this command for my react-native project it seems to work, however, I've committed my code to github and then checked out a clean copy. After this it is not runnable with 'npm install' alone; I still need to run 'yarn install' and then go through the process of running deyarn. I'm not sure where exactly the issue is here but I thought I would at least raise an issue as this command is not working as intended for me.

Reconsider setting `engines.yarn` to an invalid version

Please reconsider setting engines.yarn to an invalid version and perhaps instead merge #11. Although the intention for setting engines.yarn was made clear in #7 (comment) and may be appropriate for an application or an internal libary, it's a problematic choice for external libraries, where consumers should be free to use just about any package manager they choose.

This invalid engines.yarn has been removed in packages like mixmaxhq/rollup-plugin-root-import (see mixmaxhq/rollup-plugin-root-import#10) and hopefully soon honeycombio/libhoney-js (see honeycombio/libhoney-js#169). Making this change in deyarn (or perhaps having some configuration/warning around it) will help prevent future issues.

Deprecate in favor of synp

This scripts follows a very naive approach, and while this may work for certain projects, it most certainly fails on bigger projects where deleting and reinstalling would lead to a vast amount of upgrades.

Your Readme.md is clear and honest about its behavior, yet it would be helpful to point people to other tools that convert a yarn.lock into a package-lock.json, and synp does just that:

$ npm install -g synp
$ cd project-using-yarn/
$ synp --source-file yarn.lock 
Created package-lock.json
$ rm yarn.lock
$ npm ci

Didn't create package-lock.json

I used deyarn, but it didn't create a package-lock.json file. Here's the command output:

> npx deyarn
npx: installed 47 in 5.371s

deyarn...


Removing `yarn.lock`.
Removed `yarn.lock`.

Removing `node_modules`.
Removed `node_modules`.

Installing dependencies with npm; generating `package-lock.json`.


Success!

NEXT STEPS:
  1. Perform any testing to ensure that package updates were not problematic.
  2. Update package.json scripts to use npm if necessary:
     {/*consored*/"}
  3. Update your CI configuration if necessary
  4. Update the README if necessary
    - Add preferred npm-install instruction
    - Update any other Yarn commands to use npm instead
  5. Commit the made changes

I had to run npm install manually after using deyarn to get a package-lock.json file created. It looks like the packages were installed during deyarn use, but the package-lock.json file was not created.

npm version used is 6.4.1
node 10.13.0

engines.yarn must return valid semver syntax

Hi! We were using your package to help move us off of yarn and onto NPM. Our node app failed to deploy because the engines.yarn line is invalid. You can only provide a valid SEMVER string here, otherwise this will break deploys.

The solution here is to remove that path, rather than modify it. Oddly enough, edit-json-file doesn't have an option for unset-ing a line, so I added it. You can pull from my fork to add this functionality in now if you'd like. I'm also going to create a pull request momentarily that will include the proposed fix.

Change scripts

Some scripts can call other scripts via yarn.

For example, "docs": "yarn -s code-doc && yarn -s api-doc".

I guess the possible flags can complicate it a bit. The -s flag is for silent.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (local>mixmaxhq/renovate-config)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.