Skip to content

Commit d7a638d

Browse files
committed
Added sample with webpack version 1 support
1 parent 6f792fe commit d7a638d

File tree

12 files changed

+293
-2
lines changed

12 files changed

+293
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/**/*.js
2+
node_modules/

README.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,75 @@
1-
# ej2-typescript-seed-webpackv1
2-
Essential JS 2 tyescript seed application with webpack v1
1+
# Essential JS 2 Typescript Seed webpack v1
2+
3+
This seed project is a skeleton application used to create [Essential JS 2](https://www.syncfusion.com/products/essential-js2) web application.
4+
5+
The seed contains Essential JS 2 button component for preview and all common settings are preconfigured.
6+
7+
## Getting Started
8+
9+
To get started you need to clone the `ej2-typescript-seed` repository and navigate to `ej2-typescript-seed` location.
10+
11+
```
12+
git clone https://github.com/syncfusion/ej2-typescript-seed.git
13+
cd ej2-typescript-seed
14+
```
15+
16+
## Installing
17+
18+
We can get all the Essential JS 2 components in a single npm package [`ej2`](https://www.npmjs.com/package/@syncfusion/ej2).
19+
20+
We already configure the required packages in the `package.json` file.
21+
22+
You can run the below command to install all dependent packages related to this seed project.
23+
24+
```
25+
npm install
26+
```
27+
28+
## Testing
29+
30+
This application is preconfigured with End-to-End testing and the test case is written in Jasmine.
31+
32+
We run the test scripts with [Protractor](http://www.protractortest.org/#/) end-to-end test runner. The test case file can be found in the `e2e` folder.
33+
34+
Protractor can interact with our web application and verify the test scripts.
35+
36+
We have to install WebDriver and also need to ensure it is updated. Open a separate terminal and run the below npm script.
37+
38+
```
39+
npm run update-webdriver
40+
```
41+
42+
Open another terminal and run the below npm script. It will start web server to serve our application.
43+
44+
```
45+
npm run serve
46+
```
47+
48+
Once the web server is up and running, we can run the end-to-end tests using the below npm script
49+
50+
```
51+
npm run test
52+
```
53+
54+
> **Note:** Since Protractor is using the Selenium Standalone Server, the Java Development Kit (JDK) need to be installed in your local machine.
55+
56+
If JDK is not installed in your local machine, you can download it from [here](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
57+
58+
## Running
59+
60+
The application is configured with `browser-sync`, so it will serve the web application in your default browser.
61+
62+
We used `webpack` to bundle the source file, before running the application in browser.
63+
64+
You can use the below npm script to run the web application.
65+
66+
```
67+
npm run start
68+
```
69+
70+
## Resources
71+
72+
You can also refer the below resources to know more details about Essential JS 2 components.
73+
74+
* [Pure JS Demos](http://ej2.syncfusion.com/demos/)
75+
* [Pure JS Documentation](http://ej2.syncfusion.com/documentation/)

e2e/index.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
browser.waitForAngularEnabled(false);
2+
3+
describe('Essential JS 2 seed test', function() {
4+
it('Test the Essential JS 2 typescript sample', function() {
5+
browser.get('http://localhost:3000/index.html');
6+
var button = element(by.css('.e-btn'));
7+
expect(button).not.toBe(undefined);
8+
});
9+
});

e2e/protractor.conf.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
exports.config = {
2+
3+
allScriptsTimeout: 11000,
4+
5+
capabilities: {
6+
'browserName': 'chrome'
7+
},
8+
9+
framework: 'jasmine',
10+
11+
jasmineNodeOpts: {
12+
defaultTimeoutInterval: 10000
13+
},
14+
15+
specs: ['./*.spec.js']
16+
};

gulpfile.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
/**
6+
* Load the sample in src/app/index
7+
*/
8+
gulp.task('start', ['compile'], function(done) {
9+
var browserSync = require('browser-sync');
10+
var bs = browserSync.create('Essential JS 2');
11+
var options = {
12+
server: {
13+
baseDir: [
14+
'./src/app/',
15+
'./src/resource/',
16+
'./node_modules/@syncfusion/ej2/'
17+
]
18+
},
19+
ui: false
20+
};
21+
bs.init(options, done);
22+
});
23+
24+
/**
25+
* Compile TypeScript to JS
26+
*/
27+
gulp.task('compile', function(done) {
28+
var webpack = require('webpack');
29+
var webpackStream = require('webpack-stream');
30+
gulp.src(['./src/app/index.ts']).pipe(webpackStream({
31+
config: require('./webpack.config.js')
32+
}, webpack))
33+
.pipe(gulp.dest('./'))
34+
.on('end', function() {
35+
done();
36+
});
37+
});
38+
39+
40+
/**
41+
* Testing spec files
42+
*/
43+
var protractor = require('gulp-protractor').protractor;
44+
var webdriver_standalone = require('gulp-protractor').webdriver_standalone;
45+
var webdriver_update = require('gulp-protractor').webdriver_update_specific;
46+
47+
gulp.task('e2e-serve', webdriver_standalone);
48+
49+
gulp.task('e2e-webdriver-update', webdriver_update({
50+
webdriverManagerArgs: ['--ie', '--edge']
51+
}));
52+
53+
gulp.task('e2e-test', ['compile'], function(done) {
54+
var browserSync = require('browser-sync');
55+
var bs = browserSync.create('Essential JS 2');
56+
var options = {
57+
server: {
58+
baseDir: [
59+
'./src/app/',
60+
'./src/resource/',
61+
'./node_modules/@syncfusion/ej2/'
62+
],
63+
directory: true
64+
},
65+
ui: false,
66+
open: false,
67+
notify: false
68+
};
69+
bs.init(options, function() {
70+
gulp.src(['./spec/**/*.spec.js'])
71+
.pipe(protractor({
72+
configFile: 'e2e/protractor.conf.js'
73+
}))
74+
.on('error', function(e) {
75+
console.error('Error: ' + e.message);
76+
done();
77+
process.exit(1);
78+
})
79+
.on('end', function() {
80+
done();
81+
process.exit(0);
82+
});
83+
});
84+
});

license

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Essential JS 2 library is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
2+
3+
To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
4+
5+
Customers who do not qualify for the community license can contact [email protected] for commercial licensing options.
6+
7+
Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
8+
9+
The Syncfusion license that contains the terms and conditions can be found at
10+
https://www.syncfusion.com/content/downloads/syncfusion_license.pdf

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "ej2-typescript-seed",
3+
"version": "0.0.1",
4+
"description": "ej2 typescript seed project",
5+
"author": "Syncfusion Inc.",
6+
"license": "SEE LICENSE IN license",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/syncfusion/ej2-typescript-seed.git"
10+
},
11+
"dependencies": {
12+
"@syncfusion/ej2": "*"
13+
},
14+
"devDependencies": {
15+
"browser-sync": "^2.18.12",
16+
"gulp": "^3.9.1",
17+
"gulp-protractor": "^4.1.0",
18+
"jasmine": "^2.6.0",
19+
"ts-loader": "^2.1.0",
20+
"typescript": "2.3.4",
21+
"webpack": "1.12.12",
22+
"webpack-stream": "^3.2.0"
23+
},
24+
"scripts": {
25+
"start": "gulp start",
26+
"serve": "gulp e2e-serve",
27+
"test": "gulp e2e-test",
28+
"update-webdriver": "gulp e2e-webdriver-update"
29+
}
30+
}

src/app/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Essential JS 2</title>
6+
<meta charset="utf-8" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
8+
<meta name="description" content="Essential JS 2" />
9+
<meta name="author" content="Syncfusion" />
10+
<link rel="shortcut icon" href="resources/favicon.ico" />
11+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
12+
<!--style reference from node_modules/@syncfusion/ej2/-->
13+
<link href="button/material.css" rel="stylesheet" />
14+
</head>
15+
16+
<body>
17+
<div style="margin: 50px;">
18+
<button id="normalbtn">Normal</button>
19+
</div>
20+
21+
<script src="index.js" type="text/javascript"></script>
22+
</body>
23+
24+
</html>

src/app/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { Button } from '@syncfusion/ej2-buttons';
2+
3+
let button: Button = new Button();
4+
button.appendTo('#normalbtn');

src/resources/favicon.ico

6.42 KB
Binary file not shown.

0 commit comments

Comments
 (0)