Пример #1
0
def app(args):
  """

  :param args:
  """
  if args.type.upper() == 'REACT':
    from epyk.web import react

    node_app = react.React(args.server)
    node_app.clis.react()
    node_app.create(args.name)

  elif args.type.upper() == 'VUE':
    from epyk.web import vue

    node_app = vue.VueJs(args.server)
    node_app.clis.vue()
    node_app.create(args.name)
    node_app.cli(args.name).linter()
    node_app.cli(args.name).add_router()

  elif args.type.upper() == 'ANGULAR':
    from epyk.web import angular

    node_app = angular.Angular(args.server)
    node_app.clis.angular()
    node_app.create(args.name)
    node_app.router(args.name)
Пример #2
0
  def publish(self, server: str, app_path: str, selector: str, name: Optional[str] = None, module: Optional[str] = None,
              target_folder: str = "apps", auto_route: bool = False):
    """
    Description:
    ------------
    Publish the HTML page to a distant web server.

    Usage:
    -----

      page = Report()
      page.ui.text("This is a text")

    Attributes:
    ----------
    :param str server: The webserver type (angular, react, vue, node, deno).
    :param str app_path: The webserver path.
    :param str selector:
    :param Optional[str] name: Optional. The application name in the webserver.
    :param Optional[str] module:
    :param str target_folder:
    :param bool auto_route:
    """
    from epyk.web import angular, node, vue, react, deno

    app = None
    component = module or selector.capitalize()
    if server.upper() == 'NODE':
      app = node.Node(app_path=app_path, name=name or 'node')
      app.page(report=self.page, selector=selector, name=component, target_folder=target_folder)
      if auto_route:
        app.launcher(component, target_folder)
    elif server.upper() == 'DENO':
      app = deno.Deno(app_path=app_path, name=name or 'deno')
      app.page(report=self.page, selector=selector, name=component, target_folder=target_folder)
      if auto_route:
        app.launcher(component, target_folder)
    elif server.upper() == 'ANGULAR':
      app = angular.Angular(app_path=app_path, name=name or 'angular')
      app.page(report=self.page, selector=selector, name=component, target_folder=target_folder)
      if auto_route:
        app.route().add(component, selector, target_folder)
    elif server.upper() == 'VUE':
      app = vue.VueJs(app_path=app_path, name=name or 'vue')
      app.page(report=self.page, selector=selector, name=component, auto_route=auto_route,
               target_folder=target_folder)
    elif server.upper() == 'REACT':
      app = react.React(app_path=app_path, name=name or 'react')
      app.page(report=self.page, selector=selector or 'app-root', name=module, auto_route=auto_route,
               target_folder=target_folder)
    app.publish()
    return app
Пример #3
0
    def angular(self, server, app, selector=None, name=None):
        """
    Description:
    ------------

    Attributes:
    ----------
    :param server:
    :param app:
    :param selector:
    :param name:
    """
        name = name or os.path.split(sys.argv[0])[1][:-3]
        selector = selector or os.path.split(sys.argv[0])[1][:-3]
        return angular.Angular(server, app).page(selector,
                                                 name,
                                                 report=self.page)
Пример #4
0
  def angular(self, server, app, selector: str = None, name: str = None):
    """
    Description:
    ------------
    Entry point to a local Angular setup.
    This will allow the framework to convert modules and integrate them to an external Angular App.

    Attributes:
    ----------
    :param server:
    :param app:
    :param str selector:
    :param str name:
    """
    name = name or os.path.split(sys.argv[0])[1][:-3]
    selector = selector or os.path.split(sys.argv[0])[1][:-3]
    return angular.Angular(server, app).page(selector, name, page=self.page)
Пример #5
0
def angular(args):
    """
  Description:
  ------------
  Create an Angular application derived from the main NodeJs server.
  Then Angular CLI must be available on the NodeJs server.

  Attributes:
  ----------
  :param parser: -s, The nodeJs server path
  :param parser: -n, The Angular application name
  """
    from epyk.web import angular

    node_app = angular.Angular(args.server)
    node_app.clis.angular()
    node_app.create(args.name)
    node_app.router(args.name)
Пример #6
0
  def publish(self, server, app_path, selector, name=None, module=None, target_folder="apps", auto_route=False):
    """
    Description:
    ------------
    Publish the HTML page to a distant web server.

    Attributes:
    ----------
    :param server: String. The webserver type (angular, react, vue, node, deno)
    :param app_path: String. The webserver path
    :param name: String. The application name in the webserver
    """
    from epyk.web import angular, node, vue, react, deno

    app = None
    component = module or selector.capitalize()
    if server.upper() == 'NODE':
      app = node.Node(app_path=app_path, name=name or 'node')
      app.page(report=self._report, selector=selector, name=component, target_folder=target_folder)
      if auto_route:
        app.launcher(component, target_folder)
    elif server.upper() == 'DENO':
      app = deno.Deno(app_path=app_path, name=name or 'deno')
      app.page(report=self._report, selector=selector, name=component, target_folder=target_folder)
      if auto_route:
        app.launcher(component, target_folder)
    elif server.upper() == 'ANGULAR':
      app = angular.Angular(app_path=app_path, name=name or 'angular')
      app.page(report=self._report, selector=selector, name=component, target_folder=target_folder)
      if auto_route:
        app.route().add(component, selector, target_folder)
    elif server.upper() == 'VUE':
      app = vue.VueJs(app_path=app_path, name=name or 'vue')
      app.page(report=self._report, selector=selector, name=component, auto_route=auto_route, target_folder=target_folder)
    elif server.upper() == 'REACT':
      app = react.React(app_path=app_path, name=name or 'react')
      app.page(report=self._report, selector=selector or 'app-root', name=module, auto_route=auto_route, target_folder=target_folder)
    app.publish()
    return app
Пример #7
0
"""
Change the Angular App home page
"""

if __name__ == '__main__':
    from epyk.core.Page import Report
    from epyk.web import angular

    page = Report()

    page.ui.text("#This is a text", options={"markdown": True})
    page.ui.button("This is a test").click([page.js.alert("test")])

    # Link the report to a Angular Python object
    node_app = angular.Angular(r"C:\Angular")
    node_app.home_page(page, "angular-apps2")