Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
feat: angular template
Browse files Browse the repository at this point in the history
  • Loading branch information
JamilOmar committed Jul 16, 2019
1 parent 9fba310 commit 2414079
Show file tree
Hide file tree
Showing 55 changed files with 600 additions and 192 deletions.
21 changes: 18 additions & 3 deletions cli/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import * as gulp from 'gulp'
import * as template from 'gulp-template'
import * as rename from 'gulp-rename'
import {PackageUpdate} from '../lib/package/update'
import {startCase} from 'lodash'
import { PackageUpdate } from '../lib/package/update'
import { startCase } from 'lodash'

const _ = require('underscore.string');
const inquirer = require('inquirer');
Expand All @@ -28,7 +28,7 @@ module.exports = {
message: 'Which type of LabShare package do you want to create?',
type: 'list',
default: 'cli',
choices: ['cli', 'ui', 'api' , 'angular']
choices: ['cli', 'ui', 'api', 'angular']
},
{
name: 'appName',
Expand Down Expand Up @@ -77,6 +77,21 @@ module.exports = {
.on('end', () => {
this.log.info(`Successfully created LabShare ${answers.projectType} package...`);
});
if (answers.projectType === 'angular') {
gulp.src([
`${__dirname}/../templates/inmutable/ui/**`
])
.pipe(rename(file => {
if (file.basename[0] === '_') {
file.basename = '.' + file.basename.slice(1);
}
}))
.pipe(gulp.dest('./'))
.on('end', () => {
this.log.info(`Successfully moved inmutable LabShare ${answers.projectType} package's files...`);
});

}
});
},
update() {
Expand Down
6 changes: 3 additions & 3 deletions lib/cli/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export function init(): void {
global.LabShare = global.LabShare || labShare;
global.LabShare.Config = config;

let logDirectory: string = _.get(config, 'lsc.Log.Path');
let fluentD = _.get(config, 'lsc.Log.FluentD', {});
let format = _.get(config, 'lsc.Log.Format', {});
let logDirectory: string = _.get(config, 'lsc.Log.Path' ,_.get(config, 'lsc.log.path'));
let fluentD =_.get(config, 'lsc.Log.FluentD', _.get(config, 'lsc.log.fluentD', {}));
let format = _.get(config, 'lsc.Log.Format', _.get(config, 'lsc.log.format', {}));

// default logger
global.LabShare.Logger = Logger({
Expand Down
22 changes: 22 additions & 0 deletions templates/angular-package/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) <%= appYear %> LabShare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

114 changes: 114 additions & 0 deletions templates/angular-package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# <%= appTitle %>

## Overview

This is a template project with all the LabShare's features, such as Authentication, Usage, Configuration and more.

## Tutorial

- Install all the packages: `npm i`

- To run this project in development mode, you need to use the command line: `lsc start site`

* To run this project as a desktop app, you need to use the command line: `lsc start app`

* To build this project as a production bundle, you need to use the command line: `lsc build site`

* For more information, go to @labshare/shell-ui.

## Contents

- **UI** - Main UI folder.
- **App** - Main App Folder.
- **Core**: Main Functionality module, all the current's project logic should go here.
- **Shell**: Shell Module, all the default routes, and services initialization goes here.
- **Theme**: UI Module, all the settings for the main ui module goes here.
- **app-routing**: Main Routing module.
- **App Module**: Main module.

## Application Configuration

For adding configuration to the application, you have two options:

- Create a config.json file at the root folder (legacy version).
- Change the default values at default.json; With this approach, you can take advantage of
[configjs](https://www.npmjs.com/package/config) and have several features like: Support for multiple configurations:
Add a file with the name of the configuration you will like to use: `staging.json` For loading lsc with the new
configuration, type:

```sh
lsc start site --config=staging
```

Adding the `--config={name of the environment}`, allows you to have multiple configurations.

If you desire to use environment variables, you can create a .env file and change the configuration to either
`default.ts` or `default.js` and export the process.env.VARIABLE_NAME:

```js
//default.js
module.exports ={
"configuration_value" : process.env.VALUE;
}
```

## Environment Configuration

If you want to change your environment configuration, you will need to the .labsharerc file, there are the options:

```json
{
"tsConfig": "tsconfig.json", // path to you tsconfig file
"build": {
// build options
"main": "ui/main", // main entry point
"polyfills": "ui/polyfills", // polyfills path
"assets": "ui/assets", // assets folder
"app": "ui/app", // app path
"index": "ui/index.ejs" // index file
},
"serve": {
// development server
"open": true, // open a new browser window
"hot": true, // hot reload
"port": 8080, // development port
"historyApiFallback": true, // history api fallback
"stats": "minimal" // stats
// you can add more settings, check webpack dev server options for more // information
}
}
```

## NPM Scripts

- **start**: Starts the site in dev mode
- **test:watch**: Tests and development with watch
- **test**: Run tests
- **coverage**: Run coverage
- **prettier**: Run prettier for fixing the code structure
- **lint**: Run lint for checking the code
- **lint:fix**: Fixes all lint and prettier issues
- **tslint**: Run tslint for checking ts code
- **tslint:fix**: Fixes any tslint issues
- **prettier:check**: Check the code with Prettier
- **prettier:cli**: Run the prettier cli
- **prettier:fix**:Fixes any prettier issue
- **build**: Builds the site
- **commitmsg**: Checks the commit messages
- **semantic-release**: Runs the semantic release

## Docs

Section for the project's documentation.

## TravisCI

The [travisCI](https://travis-ci.com/) file configuration.

## Codecov

[Codecov](https://codecov.io) configuration File.

## License

MIT
1 change: 1 addition & 0 deletions templates/angular-package/_env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TEST="test value with Rafa"
11 changes: 9 additions & 2 deletions templates/angular-package/_labsharerc
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"tsConfig" : "tsconfig.json",
"build": {
"main": "ui/main",
"polyfills": "ui/polyfills",
"assets": "ui/assets",
"app": "ui/app",
"index": "ui/index.ejs"
},
"electron":{
"debug":false
"serve":{
"open": true,
"hot": true,
"port": 8080,
"historyApiFallback": true,
"stats": "minimal"
}
}
3 changes: 2 additions & 1 deletion templates/angular-package/_prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/images
*.json
CHANGELOG.md
*.yml
*.yml
index.js
4 changes: 2 additions & 2 deletions templates/angular-package/_prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all",
"printWidth": 120,
"trailingComma": "none",
"overrides": [
{
"files": "**/*.md",
Expand Down
1 change: 1 addition & 0 deletions templates/angular-package/config/default.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"test-config":"Hello from config"

}
1 change: 0 additions & 1 deletion templates/angular-package/index.d.ts

This file was deleted.

67 changes: 46 additions & 21 deletions templates/angular-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "<%= appNameSlug %>",
"namespace": "",
"main": "./ui/main.ts",
"version": "<%= appVersion %>",
"version": "0.0.0",
"description": "<%= appDescription %>",
"private": true,
"contributors": "https://github.com/LabShare/<%= appNameSlug %>/graphs/contributors",
Expand All @@ -15,43 +15,58 @@
},
"license": "MIT",
"scripts": {
"start": "lsc start site",
"test:watch": "karma start ./test/karma.conf.js --single-run false",
"test": "karma start ./test/karma.conf.js",
"lint": "tslint -p tsconfig.json -c tslint.json",
"lint:fix": "tslint --fix -p tsconfig.json -c tslint.json",
"build": "lsc build web",
"coverage": "karma start ./test/karma.conf.js --singleRun=true",
"prettier": "prettier \"**/*.ts\" \"**/*.js\" \"**/*.md\"",
"lint": "npm run prettier:check && npm run tslint",
"lint:fix": "npm run tslint:fix && npm run prettier:fix",
"tslint": "tslint -p tsconfig.json -c tslint.json",
"tslint:fix": "tslint -p tsconfig.json -c tslint.json --fix",
"prettier:check": "npm run prettier -- -l",
"prettier:cli": "npm run prettier -- -c",
"prettier:fix": "npm run prettier:cli -- --write",
"build": "lsc build site",
"commitmsg": "commitlint -e $GIT_PARAMS",
"semantic-release": "semantic-release"
},
"packageDependencies": {
"@labshare/shell-ui": "*"
},
"dependencies": {
"@angular/common": "^6.0.4",
"@angular/core": "^6.0.4",
"@angular/animations": "^6.1.10",
"@angular/common": "6.1.10",
"@angular/core": "^6.1.10",
"@angular/forms": "^6.1.10",
"@angular/http": "^6.0.4",
"@angular/router": "^6.0.4",
"@angular/http": "^6.1.10",
"@angular/router": "^6.1.10",
"@labshare/ngx-core-services": "^1.0.0",
"@uirouter/angular": "^3.0.0",
"config": "^3.1.0",
"@labshare/ngx-stateful": "^2.0.9",
"@labshare/stateful-components": "^2.0.1",
"acorn": "^6.2.0",
"core-js": "^3.0.1",
"hammerjs": "^2.0.8",
"lodash": "^4.6.1",
"rxjs": "^6.5.1",
"zone.js": "^0.9.0"
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular/compiler": "^6.0.4",
"@angular/compiler-cli": "^6.0.4",
"@angular/platform-browser": "^6.0.4",
"@angular/platform-browser-dynamic": "^6.0.4",
"@angular/compiler": "^6.1.10",
"@angular/compiler-cli": "^6.1.10",
"@angular/platform-browser": "^6.1.10",
"@angular/platform-browser-dynamic": "^6.1.10",
"@commitlint/cli": "^6.2.0",
"@commitlint/config-conventional": "^6.1.3",
"@labshare/semantic-release-config": "^1.0.0",
"@labshare/shell-ui": "^1.0.0",
"@ngtools/webpack": "^6.2.9",
"@types/jasmine": "^2.5.54",
"angular-router-loader": "~0.8",
"angular2-template-loader": "^0.6.2",
"hard-source-webpack-plugin": "^0.10.1",
"awesome-typescript-loader": "^5.2.1",
"css-loader": "^3.0.0",
"file-loader": "^4.0.0",
"fork-ts-checker-webpack-plugin": "^1.3.7",
"html-loader": "0.5.5",
"html-webpack-plugin": "3.2.0",
"husky": "^0.14.3",
Expand All @@ -62,16 +77,26 @@
"karma-coverage": "^1.1.1",
"karma-coverage-istanbul-reporter": "^2.0.0",
"karma-jasmine": "^1.1.0",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-typescript": "^3.0.8",
"karma-webpack": "^4.0.0-beta.0",
"ng-annotate-loader": "^0.6.1",
"ng-annotate-patched": "^1.10.0",
"null-loader": "^0.1.1",
"prettier": "^1.18.2",
"sass-loader": "^7.1.0",
"semantic-release": "^15.5.0",
"ts-loader": "^4.3.0",
"tslint-angular": "^1.1.0",
"typescript": "^2.7.2",
"webpack": "4.24.0"
"style-loader": "^0.23.1",
"to-string-loader": "^1.1.5",
"ts-loader": "^6.0.4",
"tslint-angular": "^1.1.2",
"typescript": "~2.9.0",
"url-loader": "^2.0.0",
"webpack": "^4.25.1",
"webpack-dev-server": "^3.7.2",
"webpack-hot-middleware": "^2.21.1",
"webpack-merge": "^4.2.1"
}
}
3 changes: 3 additions & 0 deletions templates/angular-package/test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tests

Your project's tests can go here.
Loading

0 comments on commit 2414079

Please sign in to comment.