在Ember CLI中升级项目的最佳策略是什么?

时间:2018-02-14 08:30:32

标签: ember.js ember-cli

Ember CLI和Ember.js在旧版本中存在一些构建时间问题。一个经常提到的解决方案是将堆栈升级到新版本。这意味着更新整个堆栈。

升级它以避免破坏整个项目的最佳策略是什么?

2 个答案:

答案 0 :(得分:5)

使用ember-cli-update。 README包含有关如何使用全局npm包版本以及插件版本的说明。 它还可以选择运行codemods,以便轻松升级。

我建议最多从LTS迁移到LTS,因为您可能会在项目的依赖项中出现弃用。

答案 1 :(得分:3)

只需按照要升级到的版本的说明进行操作:https://github.com/ember-cli/ember-cli/releases

根据您的落后程度,您可能需要逐步升级。

当一切正常时,始终提交您的更改,以便在出现问题时有一个还原点。

完成Ember升级后,您可能希望升级依赖项。我建议您使用import java.util.*; // Provides TreeMap, Iterator, Scanner import java.io.*; // Provides FileReader, FileNotFoundException public class test2 { public static void main(String[ ] args) { // **THIS CREATES A TREE MAP** TreeMap<String, Integer> frequencyData = new TreeMap<String, Integer>(); Map<String, Set<String>> filenames = new HashMap<String, Set<String>>(); Map<String, Integer> countByWords = new HashMap<String, Integer>(); Map[] mapArray = new Map[5]; mapArray[0] = new HashMap<String, Integer>(); readWordFile(countByWords, frequencyData, filenames); printAllCounts(countByWords, frequencyData, filenames); } public static int getCount(String word, TreeMap<String, Integer> frequencyData) { if (frequencyData.containsKey(word)) { // The word has occurred before, so get its count from the map return frequencyData.get(word); // Auto-unboxed } else { // No occurrences of this word return 0; } } public static void printAllCounts( Map<String, Integer> countByWords, TreeMap<String, Integer> frequencyData, Map<String, Set<String>> filenames) { System.out.println("-----------------------------------------------"); System.out.print("Search for a word: "); String worde; int result = 0; Scanner input = new Scanner(System.in); worde=input.nextLine(); if(!filenames.containsKey(worde)){ System.out.println("The word does not exist"); } else{ for(String filename : filenames.get(worde)){ System.out.println(filename); System.out.println(countByWords.get(worde)); } } System.out.println("\n-----------------------------------------------"); } public static void readWordFile(Map<String, Integer> countByWords ,TreeMap<String, Integer> frequencyData, Map<String, Set<String>> filenames) { Scanner wordFile; String word; // A word read from the file Integer count; // The number of occurrences of the word int counter = 0; int docs = 0; //**FOR LOOP TO READ THE DOCUMENTS** for(int x=0; x<Docs.length; x++) { //start of for loop [* try { wordFile = new Scanner(new FileReader(Docs[x])); } catch (FileNotFoundException e) { System.err.println(e); return; } while (wordFile.hasNext( )) { // Read the next word and get rid of the end-of-line marker if needed: word = wordFile.next( ); // This makes the Word lower case. word = word.toLowerCase(); word = word.replaceAll("[^a-zA-Z0-9\\s]", ""); // Get the current count of this word, add one, and then store the new count: count = countByWords.get(word); if(count != null){ countByWords.put(word, count + 1); } else{ countByWords.put(word, 1); } Set<String> filenamesForWord = filenames.get(word); if (filenamesForWord == null) { filenamesForWord = new HashSet<String>(); } filenamesForWord.add(Docs[x]); filenames.put(word, filenamesForWord); counter++; docs = x + 1; } } //End of for loop *] System.out.println("There are " + counter + " terms in the collection."); System.out.println("There are " + docs + " documents in the collection."); } // Array of documents static String Docs [] = {"Document1.txt", "Document2.txt", "Document3.txt"}; } yarn upgrade-interactive查看您要升级到的新版本是否超出了yarn outdated中指定的版本。

您可以尝试一次升级所有内容,但如果遇到问题,可能需要逐个升级软件包。我通常这样做:升级一切,希望没有问题。如果有问题,那么我重置为上次稳定提交。然后我只升级我认为一次性低风险的软件包,然后逐个升级风险更高的软件包。原因是,有时当您同时升级多个软件包并且测试失败时,可能很难确定导致问题的软件包。

相关问题