-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
5013439
commit 4f6f73f
Showing
14 changed files
with
297 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"browsers": ["last 2 versions", "safari >= 7"] | ||
} | ||
}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules/ | ||
.vs/ | ||
.vscode/ | ||
dist/ | ||
src/.DS_Store | ||
.DS_Store | ||
releases/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## [0.0.1] - 2018-09-16 - First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Copyright 2018 Alphateam Hackers GmbH | ||
https://alphateamhackers.com | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ [email protected] | |
|
||
|
||
## Licence | ||
MIT# ath-component-boilerplate | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const gulp = require('gulp'); | ||
const clean = require('gulp-clean'); | ||
const runSequence = require('run-sequence'); | ||
|
||
gulp.task('default', [ "build" ]); | ||
|
||
gulp.task('build', [ "clean" ], (done) => { | ||
runSequence("copyResources", "copyLibs", 'buildTask1', 'buildTask2', () => { | ||
console.log('Success'); | ||
done(); | ||
}); | ||
}); | ||
|
||
gulp.task('copyResources', () => gulp | ||
.src([ | ||
'src/**/*.{html,xml}', | ||
]) | ||
.pipe(gulp.dest('dist'))); | ||
|
||
gulp.task('copyLibs', () => gulp | ||
.src([]) | ||
.pipe(gulp.dest('dist/libs'))); | ||
|
||
gulp.task('clean', function () { | ||
return gulp.src('dist', {read: false}) | ||
.pipe(clean()); | ||
}); | ||
|
||
/** | ||
* Example build tasks: | ||
*/ | ||
gulp.task('buildTask1', (done) => done()); | ||
|
||
gulp.task('buildTask2', (done) => done()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "ath-component-boilerplate", | ||
"version": "0.0.1", | ||
"description": "Boilerplate for standalone & lightweight web component", | ||
"author": "Alphateam Hackers GmbH", | ||
"homepage": "https://alphateamhackers.com", | ||
"scripts": { | ||
"start": "npm run build && live-server dist", | ||
"build": "node ./node_modules/gulp/bin/gulp.js && node ./node_modules/webpack/bin/webpack.js" | ||
}, | ||
"engines": { | ||
"npm": ">=3.0.0" | ||
}, | ||
"dependencies": { | ||
"fullcalendar": "^3.9.0", | ||
"jquery": "^3.3.1", | ||
"sweetalert2": "^7.28.4" | ||
}, | ||
"devDependencies": { | ||
"@types/bluebird": "^3.5.24", | ||
"@types/core-js": "^0.9.36", | ||
"@types/moment": "^2.13.0", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-loader": "^7.1.5", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"css-loader": "^1.0.0", | ||
"eslint": "^5.3.0", | ||
"express": "^4.16.3", | ||
"gulp": "^3.9.1", | ||
"gulp-babel": "^7.0.1", | ||
"gulp-clean": "^0.4.0", | ||
"gulp-clean-css": "^3.10.0", | ||
"gulp-concat-css": "^3.1.0", | ||
"gulp-copy": "^1.1.0", | ||
"gulp-less": "^4.0.1", | ||
"less-loader": "^4.1.0", | ||
"moment": "^2.22.2", | ||
"run-sequence": "^2.2.1", | ||
"style-loader": "^0.22.1", | ||
"ts-loader": "^4.4.2", | ||
"typescript": "^3.0.1", | ||
"typings": "^2.1.1", | ||
"uglifyjs-webpack-plugin": "^2.0.0", | ||
"webpack": "^4.16.5", | ||
"webpack-cli": "^3.1.0" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
] | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
import ExampleComponentSDK from "./ExampleComponentSDK"; | ||
import { ATH } from "./types"; | ||
|
||
export default class ExampleComponent { | ||
constructor(private _domID: string, private _apiUrl: string) { | ||
this._el = document.getElementById(_domID); | ||
this._sdk = new ExampleComponentSDK(_apiUrl); | ||
|
||
this.init(); | ||
} | ||
|
||
private _el: HTMLElement; | ||
private _sdk: ExampleComponentSDK; | ||
|
||
private init() { | ||
this.constructView(); | ||
} | ||
|
||
private constructView() { | ||
const viewWrapper = document.createElement("div"); | ||
|
||
const header = document.createElement("h1"); | ||
|
||
header.innerText = "Hello World!"; | ||
|
||
viewWrapper.appendChild(header); | ||
|
||
this._el.appendChild(viewWrapper); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ATH } from "./types"; | ||
|
||
export default class ExampleComponentSDK { | ||
constructor(private _API_URL: string) {} | ||
|
||
public exampleResource = { | ||
getOne: () => {}, | ||
create: () => {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>ATH Component Boilerplate</title> | ||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> | ||
<meta name="mobile-web-app-capable" content="yes"> | ||
<meta name="apple-mobile-web-app-capable" content="yes" /> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> | ||
<!--START OF External dependencies--> | ||
|
||
<!--END OF External dependencies--> | ||
</head> | ||
<body> | ||
<!-- The calendar will be placed in this container: --> | ||
<div id="ath-component"></div> | ||
|
||
<!--START OF External dependencies--> | ||
|
||
<!--END OF External dependencies--> | ||
|
||
<!-- Load the ATH component library --> | ||
<script type="text/javascript" src="/ath-component.js"></script> | ||
|
||
<!-- | ||
Bootstrap the component | ||
@param {string} domID The CSS selector of the component's div wrapper | ||
@param {string} apiUrl Api's URL (without any slash at the end) | ||
--> | ||
<script> | ||
window.addEventListener("load", () => { | ||
window.athComponent.bootstrap({ | ||
domID: "ath-component", | ||
apiUrl: "https://alphateamhackers.com" | ||
}); | ||
}) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
import ExampleComponent from "./ExampleComponent"; | ||
import { ATH } from "./types"; | ||
|
||
declare var window: any; | ||
|
||
const athComponentRegister: ExampleComponent[] = []; | ||
|
||
const bootstrap = (opts: ATH.BootstrapOpts) => { | ||
opts = opts || {}; | ||
|
||
|
||
if (!opts.domID) { | ||
throw new Error("ATH Component: Missing 'domId' in initialization options."); | ||
} | ||
|
||
if (!opts.apiUrl) { | ||
throw new Error("ATH Component: Missing 'apiUrl' in initialization options."); | ||
} | ||
|
||
athComponentRegister.push(new ExampleComponent(opts.domID, opts.apiUrl)); | ||
}; | ||
|
||
window.athComponent = { | ||
bootstrap | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
export namespace ATH { | ||
export interface BootstrapOpts { | ||
domID?: string; | ||
apiUrl?: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./dist/", | ||
"noImplicitAny": true, | ||
"module": "es6", | ||
"target": "es5", | ||
"allowJs": true, | ||
"types": [ | ||
"moment" | ||
], | ||
"typeRoots": [ | ||
"node_modules/@types/", | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const path = require('path'); | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
entry: './src/index.ts', | ||
output: { | ||
filename: 'ath-component.js', | ||
path: path.resolve(__dirname, 'dist') | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.less$/, | ||
use: [{ | ||
loader: 'less-loader' | ||
}] | ||
}, { | ||
test: /\.css$/, | ||
use: [ 'style-loader', 'css-loader' ] | ||
}, { | ||
test: /\.ts$/, | ||
exclude: /node_modules/, | ||
use: [{ | ||
loader: 'ts-loader', | ||
options: { | ||
transpileOnly: true | ||
} | ||
}], | ||
}, | ||
], | ||
}, | ||
externals: { | ||
// shows how we can rely on browser globals instead of bundling these dependencies, | ||
// in case we want to access jQuery from a CDN or if we want an easy way to | ||
// avoid loading all moment locales: https://github.com/moment/moment/issues/1435 | ||
jquery: '$', | ||
moment: 'moment' | ||
}, | ||
resolve: { | ||
extensions: [ '*', '.ts', 'js', 'css' ] | ||
}, | ||
optimization: { | ||
minimizer: [new UglifyJsPlugin({ | ||
extractComments:{ | ||
condition: 'all', | ||
banner: `Alphateam Hackers GmbH. Component bootstraped from the https://github.com/alphateamhackers/ath-component-boilerplate` | ||
}})] | ||
}, | ||
}; |