Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-10808

cordova template should have api to specify directory name with template content

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Master
    • cordova-cli
    • None

    Description

      When creating an app using a template from npm like:

      cordova create myapp --template my-cool-cdv-template

      App is created with content of root of the npm pacakge.

      By doing this all files are copied from the template.

      In some cases some files are not desire to end up in the new app, files that are related to testing, packaging, source control, etc..
      Some files are:
      package.json
      And some time you want the new app to have a package.json provided by the template but not the template's pacakge.json

      We should implement same way we do cordova-app-hello-world npm package
      main module exports an object with a property dirname

      Example:
      Content of package.tgz from npm
      package.json
      lib/
      .gitignore
      template_content/
      template_content/package.json
      template_content/www
      template_content/config.xml
      index.js

      Content of package.json
      {
      "name": "my-cool-cdv-template",
      "main": "./index.js"
      }

      Content of index.js:
      path=require('path');
      module.exports = {
      "dirname": path.join(__dirname,'template_content')
      }

      This also allows to run npm install after copying the template files and the template deliverable included a package.json, for example to have dev tools and scripts to be install for the development of the cordova app.

      Attachments

        Activity

          People

            csantana Carlos Santana
            csantana Carlos Santana
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: