doriansmiley / lotusJS-MWV

MVW framework for applications based on lotusJS web components
2 stars 0 forks source link

Create Lotus CLI for starting projects #5

Open doriansmiley opened 6 years ago

doriansmiley commented 6 years ago

Consider using yoemans: http://yeoman.io/

Refer to the following article for building a CLI in NodeJS:

https://developer.atlassian.com/blog/2015/11/scripting-with-node/ https://www.sitepoint.com/javascript-command-line-interface-cli-node-js/

An archive with the required template files is here: https://www.dropbox.com/s/dkld3z00fy1hpb0/lotusEmptyProjectFiles.zip?dl=0

The tool should take in a project name and a namespace. Once executed the tool will:

entry: {
        'myNamespace-UMD': './src/index.ts',
        'myNamespace-UMD.min': './src/index.ts'
    }
....
output: {
        ....
        library: 'myNamespace',
       ....
    }
externals: {
        "lavenderjs/lib": "Lavender",
        "lotusjs-components/lib": "Lotus"
    }

where myNamespace was is the one supplied by the user.

cd $HOME sh ./scripts/testSauce.sh

test local

export HOME=PATH

cd $HOME npm test

compile typescript and webpack

export HOME=PATH cd $HOME npm run build

Where `HOME` is the path to the current working directory
* Create a src directory with the following files: context/Context.ts and index.ts. Context.ts will be written as follows:

import as Lavender from 'lavenderjs/lib'; import as Lotus from 'lotusjs-components/lib';

export class Context extends Lotus.Context{

}

index.ts will be written as follows:

export * from './context/Context';

* Create a test directory with the following files: config/typescript-test-karma.conf.js, config/karma.conf-ci.js, and an empty unit directory. Both files need the following path adjusted:

'../lib/myNamespace-UMD.min.js',


Where `myNamespace` is the namepace supplied by the user.
* run npm install with --save-dev passed if the dev flag was entered by the user