where myNamespace was is the one supplied by the user.
Add tsconfig.json
Add package.json
Add .gitignore
Add .npmignore
Create globals/Globals.js setting up namespace with the one provided by the user
Create empty js directory
Create empty css directory
Create empty index.html file
Create empty lib directory
Create scripts directory with the following files: commands.txt, testSauce.sh, typescript.sh. Commands.txt will be writtes as follows:
#test on sauce labs
export HOME=PATH
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
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:
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
import as Lavender from 'lavenderjs/lib'; import as Lotus from 'lotusjs-components/lib';
export class Context extends Lotus.Context{
}
export * from './context/Context';
'../lib/myNamespace-UMD.min.js',