Git Product home page Git Product logo

cli-create-app's Introduction

cli-create-app

Build Status Build status codecov npm version

The create app command for @dojo/cli.

Usage

To use @dojo/cli-create-app, install the project globally along side dojo cli:

npm install -g @dojo/cli-create-app

Run using:

dojo create [app] --name <appName>

Features

@dojo/cli-create-app generates a skeleton project structure for Dojo 2 into a directory using the the --name argument provided.

All the dependencies are pre-installed using npm including two @dojo/cli commands; @dojo/cli-build-app and @dojo/cli-test-intern.

To start using the application, cd into the directory and run dojo build --mode dev --watch memory --serve which will build and serve the application on port 9999. Open http://localhost:9999 in a modern browser (Chrome, FF, Safari, IE11 or Edge) to run the application.

To build the tests, run dojo build --mode test. This will output to output/test.

When ready to create a production build run dojo build, the output will be available in the output/dist directory.

How do I contribute?

We appreciate your interest! Please see the Dojo 2 Meta Repository for the Contributing Guidelines.

Code Style

This repository uses prettier for code styling rules and formatting. A pre-commit hook is installed automatically and configured to run prettier against all staged files as per the configuration in the projects package.json.

An additional npm script to run prettier (with write set to true) against all src and test project files is available by running:

npm run prettier

Installation

To start working with this package, clone the repository and run npm install.

In order to build the project run grunt dev or grunt dist.

Testing

Test cases MUST be written using Intern using the Object test interface and Assert assertion interface.

90% branch coverage MUST be provided for all code submitted to this repository, as reported by istanbul’s combined coverage results for all supported platforms.

To test locally run:

grunt test

Licensing information

© 2018 JS Foundation. New BSD license.

cli-create-app's People

Contributors

agubler avatar bitpshr avatar bryanforbes avatar edhager avatar jdonaghue avatar kanefreeman avatar kitsonk avatar lzhoucs avatar maier49 avatar matt-gadd avatar mwistrand avatar nicknisi avatar rishson avatar rorticus avatar tomdye avatar umaar avatar vansimke avatar

Stargazers

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

Watchers

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

cli-create-app's Issues

Update Templates for V3

The templates used to create an app need to be updated for version 3. Specifically, they need to point to the new @dojo/framework package instead of the individual core, has, i18n, widget-core, routing, stores, and shim.

Provide visual feedback during npm installation

It takes a while to install the node modules during creation of an new application, although we do not want the default output from npm we should provide the user with some feedback (so they do not think that is has broken)

Add src/main.styl and src/main.ts

Building a freshly-generated application results in the following error messages:

ERROR in multi src/main
Module not found: Error: Cannot resolve 'file' or 'directory' testApp\src\main.styl in testApp
 @ multi src/main

ERROR in multi src/main
Module not found: Error: Cannot resolve 'file' or 'directory' testApp\src\main.ts in testApp
 @ multi src/main

Not sure if we want to change what files the build expects (src/main.styl seems odd) or add these files to app creation.

Generate a more helpful README

Enhancement

At the moment our README is pretty much non-existent. It would be nice if the README included instructions on how to dev, build and test as well as any other useful cli information.

Hello World example!

Add a hello world example for the skeleton app, which should include a custom widget with children.

Support creating more than one app

Problem

We have created several tutorials based on the code produced by dojo create alpha.11.
Now that the boilerplate produced is out of step with the tutorials, we can either update all the tutorials to match the latest boilerplate, or we can introduce a way to produce different types of boilerplate.
The drawback with updating the tutorials, is that the generated is always a moving target and so this activity may have to be undertaken many times.

Intern package is out of date

Bug / Enhancement

If you create an app and run npm install it complains that intern has critical issues. An audit suggests updating to 4.2.0.

Update created app to use Intern 4

The application created by cli-create-app uses Intern 3. Update it to use Intern 4. The following dependencies need to be bumped:

  • cli-test-intern ~0.2.0
  • cli-build-webpack ~0.2.0

Add comments to created app code, or link to a turorial

The code produced has no comments. If a new user runs create then I think the code generated should be very explicit in its intentions, e.g.

const classes = this.classes(
  css.hello,
  this.properties.stranger ? css.upsidedown : null
);

might be better written as:

// always apply the 'hello' class
const classesToApply = this.classes(css.hello);

// if stranger is true, then also apply the upsidedown class from our css
if( this.properties.stranger) {
  classesToApply.push(css.upsidedown);
}

We can either add add comments to the generated code, or we could write a tutorial that explains the generated code, and keep it in sync with any changes to this repo. The advantage of the tutorial approach is that the generated code would also work well for experienced users.

Update dependencies of created app

In working through the tutorials, we should make sure we're keeping the generated app current, specifically the versions of intern, remap-istanbul, the version of ts (in both package.json and tsconfig.json, which by the way are not the same at the moment, one is 2.1.4 and the other is 2.0.3), and remove extra-rxjs from typings.json.

Unpin the deps in the created package.json and remove dojo stores dep

Now we have unpinned the dojo deps, we should have unpinned deps in the generated package.json. I also plan to remove the @dojo/stores dep, as it is not used, and replace with a @dojo/widgets dep. I'll ammend the HelloWorld.ts file to use a @dojo/widgets/Button/Button so that we can demonstrate using a dojo widget.

Empty appName check

Bug

When app name is not properly specified, instead of responding errors, the application proceeds to createDir() which results in the following error:

EACCES: permission denied, mkdir '/src'

For example, running one of the following commands will reproduce this issue: (args.nameis empty string in both cases)

  • dojo create app -n
  • dojo create app -name foo

Package Version: v2.0.0-beta1.2

Clean up templates dependencies and typings

Remove Immutable and RxJS from the app templates package.json and typings.json

Also migrate from @dojo/widgets to @dojo/widget-core and add @dojo/i18n to the dependencies.

Typings incorrectly installed

The reference path for typings installed as part of the create app is not correct, in the typings/index.d.ts file the references get generated with an extra typings directory.

<reference path="typings/globals/extra-rxjs/index.d.ts" />

but should be

<reference path="globals/extra-rxjs/index.d.ts" />

Improvements the application created

Enhancement

We have patterns for routing, pwa, build time renderering, code splitting and stores that we should demonstrate in the application that is created by default.

Perhaps keep a very minimal skeleton as an option.

Readme review

  • summary
    • The create app command for the dojo cli -> The create app command for @dojo/cli
  • features
    • installed build command is cli-build-app, not cli-build-webpack
    • start app running dojo build --mode dev --watch memory --serve
    • build tests with dojo build --mode test, they're built to output/test
    • dojo build creates output/dist

question?
Do we want to include this in the features as we already have the above info in the newly created app's readme?

Use template-literal instead of EJS

Template Literal is fastest, smallest and simplest template engine, because it use JS's literal template feature.

It's 55 times faster than EJS, and it also use less CPU and RAM ressources, so it may be a good idea to use it instead of EJS 😀

Extend the example skeleton to include App container concept

Enhancement

The example should be extended to demonstrate the recommended structure for building an application (to date) and not just a widget.

This would include adding a container App.ts and also adding some functionality using Themeable, properties passing and an example event handler.

Test failure on Windows

Test failure on Windows,

× config - Should strip .template from fileName (0.015s)
AssertionError: expected '/foo/bar\\.gitignore' to equal '/foo/bar/.gitignore'
  at Function.assert.equal  <node_modules\intern\browser_modules\chai\chai.js:2277:10>
  at Test.Should strip .template from fileName [as test]  <tests\unit\config.ts:27:9>
  at <node_modules\intern\lib\Test.js:191:24>
  at <node_modules\intern\browser_modules\dojo\Promise.ts:393:15>
  at runCallbacks  <node_modules\intern\browser_modules\dojo\Promise.ts:11:11>
  at <node_modules\intern\browser_modules\dojo\Promise.ts:317:4>
  at run  <node_modules\intern\browser_modules\dojo\Promise.ts:237:7>
  at <node_modules\intern\browser_modules\dojo\nextTick.ts:44:3>
  at _combinedTickCallback  <internal\process\next_tick.js:73:7>
  at process._tickCallback  <internal\process\next_tick.js:104:9>

Change app CSS file to be plain css rather than stylus

Given this is the first interaction a new user will have with Dojo 2, I don't think we should presume that they know and/or are comfortable writing stylus.
I think we should create app.css and include some basic styles in plain old CSS.

Update tests in template project

tests/unit/App.ts creates a spy for the setProperties function of the HelloWorld class. This method has been renamed __setProperties__ and, as a result, the created test suite fails to create the spy.

Error occurs creating a new application

Bug

An error occurs when running dojo create -n my-app.

⠋ npm install(node:41307) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: ENOENT: no such file or directory, open '....../.nvm/versions/node/v6.9.1/lib/node_modules/@dojo/cli/node_modules/@dojo/cli-create-app/templates/.gitignore'

It does not prevent the command from completing.

Page layout not correct when I update to dojo 5.0.0

I update my cli and cli-create-app to 5.0.0, then I use dojo create app --name myApp create a dojo app, then run in dev mode. But the “Home”,"About" and "PROFILE" displayed at the left, not displayed at right.

I can not upload image to “github.com”.

Missing text direction and charset to the HTML templates

Bug

Package Version: 5.0.1

Expected behavior:

The src/index.html files in projects generated with cli-create-app is missing a <meta charset> tag as well as a dir attribute on the <html> tag.

Actual behavior:

The html[dir] attribute should be present and default to "ltr" and the charset meta should be present with a utf-8 value.

Use dojo init over manual .dojorc creation

Enhancement

We should run dojo init after npm install to create a .dojorc rather than manually creating the file/copying in create-app. This will future proof us for any other things that @dojo/cli needs to generate in the .dojorc by default.

Template should use "strict"

Enhancement

The template of the tsconfig.json should use "strict": true and eliminate the redundant compiler options.

Provide self contained npm scripts

Enhancement

Dojo CLI applications should be easy to run. npm scripts are easy for people to use who may not be familiar with the Dojo CLI and can run dev dependencies that don't need to be installed separately (i.e. globally)

Expected behavior:

An application generated using cli-create-app should be able to be installed an run easily when git cloned. Ideally, some npm scripts should be runnable immediately after install.

Actual behavior:

A cloned repo generated from the cil-create-app requires the domo cli to be installed to run.

Code

Current template

{
"name": "<%- appName %>",
"version": "1.0.0",
"dependencies": {
"@dojo/framework": "~3.0.0",
"tslib": "~1.8.1"
},
"devDependencies": {
"@dojo/cli-build-app": "~3.0.0",
"@dojo/cli-test-intern": "~3.0.0",
"@types/node": "~9.6.5",
"typescript": "~2.6.1"
}
}

Suggested Template

{
  "name": "<%- appName %>",
  "version": "1.0.0",
  "scripts": {
    "dev": "dojo build --mode dev --watch memory --serve",
    "build": "dojo build",
    "test": "dojo build -m test && dojo test -a"
  },
  "dependencies": {
    "@dojo/framework": "~3.0.0",
    "tslib": "~1.8.1"
  },
  "devDependencies": {
    "@dojo/cli": "^3.0.0",
    "@dojo/cli-build-app": "~3.0.0",
    "@dojo/cli-test-intern": "~3.0.0",
    "@types/node": "~9.6.5",
    "typescript": "~2.6.1"
  }
}

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.