Esempio n. 1
0
    def update_typescript(path):
        """
        Update modules for {N} project
        :param path: Path to {N} project
        :return: Output of command that update nativescript-typescript plugin.
        """

        # Escape path with spaces
        if " " in path:
            path = "\"" + path + "\""

        if USE_YARN == "True":
            Npm.uninstall(package="nativescript-typescript", folder=path)
            output = Npm.install(package=TYPESCRIPT_PACKAGE, folder=path)
        else:
            Npm.uninstall(package="nativescript-typescript", option="--save", folder=path)
            output = Npm.install(package=TYPESCRIPT_PACKAGE, option="--save", folder=path)
            if Npm.version() > 3:
                assert "ERR" not in output, "Something went wrong when typescript are installed."

        # Update TS dependencies
        update_script = os.path.join(TEST_RUN_HOME, path,
                                     "node_modules", ".bin", "ns-upgrade-tsconfig")
        run(update_script)
        if USE_YARN == "True":
            Npm.yarn_install(folder=path)
        else:
            Npm.install(folder=path)

        return output
Esempio n. 2
0
    def update_webpack(path):
        """
        Update modules for {N} project
        :param path: Path to {N} project
        :return: Output of command that update nativescript-dev-webpack plugin.
        """

        # Escape path with spaces
        if " " in path:
            path = "\"" + path + "\""

        if USE_YARN == "True":
            Npm.uninstall(package="nativescript-dev-webpack", option="--dev", folder=path)
            output = Npm.install(package=WEBPACK_PACKAGE, option="--dev", folder=path)
        else:
            Npm.uninstall(package="nativescript-dev-webpack", option="--save-dev", folder=path)
            output = Npm.install(package=WEBPACK_PACKAGE, option="--save-dev", folder=path)
            if Npm.version() > 3:
                assert "ERR" not in output, "Something went wrong when webpack are installed."

        # Update webpack dependencies
        update_script = os.path.join(TEST_RUN_HOME, path,
                                     "node_modules", ".bin", "update-ns-webpack --deps --configs")
        run(update_script)
        if USE_YARN == "True":
            Folder.cleanup(folder=os.path.join(TEST_RUN_HOME, path, "node_modules"))
            Npm.yarn_install(folder=path)
        else:
            Npm.install(folder=path)
        return output
Esempio n. 3
0
    def update_angular(path):
        """
        Update modules for {N} project
        :param path: Path to {N} project
        :return: Output of command that update nativescript-angular plugin.
        """

        # Escape path with spaces
        if " " in path:
            path = "\"" + path + "\""

        if USE_YARN == "True":
            Npm.uninstall(package="nativescript-angular", folder=path)
            output = Npm.install(package=ANGULAR_PACKAGE, folder=path)
        else:
            Npm.uninstall(package="nativescript-angular", option="--save", folder=path)
            output = Npm.install(package=ANGULAR_PACKAGE, option="--save", folder=path)
            if Npm.version() > 3:
                assert "ERR" not in output, "Something went wrong when angular are installed."

        # Update NG dependencies
        update_script = os.path.join(TEST_RUN_HOME, path,
                                     "node_modules", ".bin", "update-app-ng-deps")
        update_out = run(update_script)
        assert "Angular dependencies updated" in update_out

        if USE_YARN == "True":
            Npm.yarn_install(folder=path)
        else:
            Npm.install(folder=path)

        return output
Esempio n. 4
0
    def update_typescript(path):
        """
        Update modules for {N} project
        :param path: Path to {N} project
        :return: Output of command that update nativescript-typescript plugin.
        """

        # Escape path with spaces
        if " " in path:
            path = "\"" + path + "\""

        if USE_YARN == "True":
            Npm.uninstall(package="nativescript-typescript", folder=path)
            output = Npm.install(package=TYPESCRIPT_PACKAGE, folder=path)
        else:
            Npm.uninstall(package="nativescript-typescript",
                          option="--save",
                          folder=path)
            output = Npm.install(package=TYPESCRIPT_PACKAGE,
                                 option="--save",
                                 folder=path)
            if Npm.version() > 3:
                assert "ERR" not in output, "Something went wrong when typescript are installed."

        # Update TS dependencies
        update_script = os.path.join(TEST_RUN_HOME, path, "node_modules",
                                     ".bin", "ns-upgrade-tsconfig")
        run(update_script)
        if USE_YARN == "True":
            Npm.yarn_install(folder=path)
        else:
            Npm.install(folder=path)

        return output
Esempio n. 5
0
    def update_webpack(path):
        """
        Update modules for {N} project
        :param path: Path to {N} project
        :return: Output of command that update nativescript-dev-webpack plugin.
        """

        # Escape path with spaces
        if " " in path:
            path = "\"" + path + "\""

        if USE_YARN == "True":
            Npm.uninstall(package="nativescript-dev-webpack",
                          option="--dev",
                          folder=path)
            output = Npm.install(package=WEBPACK_PACKAGE,
                                 option="--dev",
                                 folder=path)
        else:
            Npm.uninstall(package="nativescript-dev-webpack",
                          option="--save-dev",
                          folder=path)
            output = Npm.install(package=WEBPACK_PACKAGE,
                                 option="--save-dev",
                                 folder=path)
            if Npm.version() > 3:
                assert "ERR" not in output, "Something went wrong when webpack are installed."

        # Update webpack dependencies
        update_script = os.path.join(TEST_RUN_HOME, path, "node_modules",
                                     ".bin",
                                     "update-ns-webpack --deps --configs")
        run(update_script)
        if USE_YARN == "True":
            Folder.cleanup(
                folder=os.path.join(TEST_RUN_HOME, path, "node_modules"))
            Npm.yarn_install(folder=path)
        else:
            Npm.install(folder=path)
        return output
Esempio n. 6
0
    def update_angular(path):
        """
        Update modules for {N} project
        :param path: Path to {N} project
        :return: Output of command that update nativescript-angular plugin.
        """

        # Escape path with spaces
        if " " in path:
            path = "\"" + path + "\""

        if USE_YARN == "True":
            Npm.uninstall(package="nativescript-angular", folder=path)
            output = Npm.install(package=ANGULAR_PACKAGE, folder=path)
        else:
            Npm.uninstall(package="nativescript-angular",
                          option="--save",
                          folder=path)
            output = Npm.install(package=ANGULAR_PACKAGE,
                                 option="--save",
                                 folder=path)
            if Npm.version() > 3:
                assert "ERR" not in output, "Something went wrong when angular are installed."

        # Update NG dependencies
        update_script = os.path.join(TEST_RUN_HOME, path, "node_modules",
                                     ".bin", "update-app-ng-deps")
        update_out = run(update_script)
        assert "Angular dependencies updated" in update_out

        if USE_YARN == "True":
            Npm.yarn_install(folder=path)
        else:
            Npm.install(folder=path)

        return output