Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbarwicki committed Nov 10, 2018
1 parent 7a7d3e8 commit dfe865c
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 213 deletions.
9 changes: 0 additions & 9 deletions .babelrc

This file was deleted.

28 changes: 3 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Boilerplate for standalone & lightweight web component
# Boilerplate for standalone & lightweight typescript component

## Intro
This repository contains a minimal set of code required to create your own web component. It does not depend on any frameworks.
One example can be found in /ExampleComponent.ts.
This repository contains a minimal set of code required to create your own typescript application. It does not depend on any frameworks. No global dependencies are required!

## Install
```
Expand All @@ -16,35 +15,14 @@ npm run build
```

## Running
This script will build and run the server.
This script will build and run the application.
```
npm run start
```

## Example Integration
```html
<html>
<head>
<title></title>
</head>
<body>
<div id="ath-component"></div>

<script type="text/javascript" src="./ath-component.js">
window.athComponent.bootstrap({
domID: "ath-component",
apiUrl: "https://alphateamhackers.com"
})
</script>
</body>
</html>
```

## Developers
* [Alphateam Hackers GmbH](https://alphateamhackers.com)

[email protected]

* [Adrian Barwicki](https://adrianbarwicki.com)


Expand Down
3 changes: 1 addition & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ 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}',
'src/**/*.{xml,json}',
])
.pipe(gulp.dest('dist')));

Expand Down
28 changes: 5 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "ath-component-boilerplate",
"name": "ath-typescript-boilerplate",
"version": "0.0.1",
"description": "Boilerplate for standalone & lightweight web component",
"description": "Boilerplate for standalone & lightweight typescript project",
"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"
"start": "npm run build && node ./dist/index.js",
"build": "node ./node_modules/gulp/bin/gulp.js && node ./node_modules/typescript/bin/tsc"
},
"engines": {
"npm": ">=3.0.0"
Expand All @@ -17,34 +17,16 @@
"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"
"typescript": "^3.0.1"
},
"babel": {
"presets": [
Expand Down
31 changes: 0 additions & 31 deletions src/ExampleComponent.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/ExampleComponentSDK.ts

This file was deleted.

39 changes: 0 additions & 39 deletions src/index.html

This file was deleted.

26 changes: 6 additions & 20 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@

import ExampleComponent from "./ExampleComponent";
import { ATH } from "./types";

declare var window: any;
declare var module: 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));
export const start = () => {
console.log("Hello world!");
};

window.athComponent = {
bootstrap
};
if (!module.parent) {
start();
}
4 changes: 0 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@

export namespace ATH {
export interface BootstrapOpts {
domID?: string;
apiUrl?: string;
}
}
11 changes: 6 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "es6",
"module": "commonjs",
"target": "es5",
"allowJs": true,
"types": [
"moment"
],
"types": [],
"lib": [ "es2015", "dom" ],
"typeRoots": [
"node_modules/@types/",
]
}
},
"include": [ "src/**/*" ],
"exclude": [ "node_modules", "test/**/*" ]
}
45 changes: 0 additions & 45 deletions webpack.config.js

This file was deleted.

0 comments on commit dfe865c

Please sign in to comment.