X Tutup
Skip to content

Commit 73638e3

Browse files
committed
Seed project for consolidating a standard build setup for web libraries.
0 parents  commit 73638e3

File tree

9 files changed

+217
-0
lines changed

9 files changed

+217
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.DS_Store
3+
npm*.log
4+
lib

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
src
2+
node_modules
3+
.gitignore
4+
.gitattributes
5+
.editorconfig
6+
gulpfile.js

.vscode/launch.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "node_modules/gulp/bin/gulp.js",
9+
"stopOnEntry": false,
10+
"args": [],
11+
"cwd": ".",
12+
"runtimeExecutable": null,
13+
"runtimeArgs": [
14+
"--nolazy"
15+
],
16+
"env": {
17+
"NODE_ENV": "development"
18+
},
19+
"externalConsole": false,
20+
"sourceMaps": false,
21+
"outDir": null
22+
},
23+
{
24+
"name": "Attach",
25+
"type": "node",
26+
"request": "attach",
27+
"port": 5858
28+
}
29+
]
30+
}

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Controls the rendering size of tabs in characters. Accepted values: "auto", 2, 4, 6, etc. If set to "auto", the value will be guessed when a file is opened.
3+
"editor.tabSize": 2,
4+
// When enabled, will trim trailing whitespace when you save a file.
5+
"files.trimTrailingWhitespace": true,
6+
// Controls whether the editor should render whitespace characters
7+
"editor.renderWhitespace": true,
8+
"editor.insertSpaces": true,
9+
// Configure glob patterns for excluding files and folders in searches. Inherits all glob patterns from the file.exclude setting.
10+
"files.exclude": {
11+
"**/.git": true,
12+
"**/.DS_Store": true,
13+
"**/node_modules": true,
14+
"**/lib": true
15+
},
16+
// Configure glob patterns for excluding files and folders in searches. Inherits all glob patterns from the file.exclude setting.
17+
"search.exclude": {
18+
}
19+
}

README.md

Whitespace-only changes.

index.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
3+
let build = require('gulp-core-build');
4+
let tslint = require('gulp-core-build-typescript').tslint;
5+
let typescript = require('gulp-core-build-typescript').typescript;
6+
let sass = require('gulp-core-build-sass').default;
7+
let karma = require('gulp-core-build-karma').default;
8+
let webpack = require('gulp-core-build-webpack').default;
9+
let serve = require('gulp-core-build-serve').serve;
10+
let reload = require('gulp-core-build-serve').reload;
11+
12+
// Define task groups.
13+
let buildTasks = task('build', parallel(tslint, typescript, sass));
14+
let testTasks = task('test', serial(buildTasks, karma));
15+
let bundleTasks = task('build', serial(buildTasks, webpack));
16+
let defaultTasks = task('default', bundleTasks);
17+
let serveTasks = task('serve',
18+
serial(
19+
bundleTasks,
20+
serve,
21+
watch('src/**/*.{ts,tsx}', serial(parallel(lint, typescript), webpack, reload)),
22+
watch('src/**/*.scss', serial(serial(sass, webpack, reload)))
23+
)
24+
);
25+
26+
// Export tasks, groups, and initialize.
27+
module.exports = {
28+
tasks: {
29+
tslint,
30+
typescript,
31+
sass,
32+
karma,
33+
webpack,
34+
serve,
35+
reload
36+
},
37+
38+
taskGroups: {
39+
build: buildTasks,
40+
test: testTasks,
41+
bundle: bundleTasks,
42+
serve: serveTasks
43+
},
44+
45+
initialize: (gulp) => build.initialize(gulp)
46+
};

package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "web-library-build",
3+
"version": "0.0.1",
4+
"description": "",
5+
"main": "index.js",
6+
"dependencies": {
7+
"chai": "^3.5.0",
8+
"gulp": "^3.9.1",
9+
"gulp-core-build": "^0.3.3",
10+
"gulp-core-build-karma": "0.0.2",
11+
"gulp-core-build-sass": "0.0.2",
12+
"gulp-core-build-serve": "0.0.1",
13+
"gulp-core-build-typescript": "0.0.2",
14+
"gulp-core-build-webpack": "0.0.3",
15+
"karma": "^0.13.22",
16+
"karma-coverage": "^0.5.5",
17+
"karma-mocha": "^0.2.2",
18+
"karma-mocha-clean-reporter": "https://registry.npmjs.org/karma-mocha-clean-reporter/-/karma-mocha-clean-reporter-0.0.1.tgz",
19+
"karma-phantomjs-launcher": "^1.0.0",
20+
"karma-sinon-chai": "^1.2.0",
21+
"karma-webpack": "^1.7.0",
22+
"load-themed-styles": "^1.0.4",
23+
"lolex": "^1.4.0",
24+
"mocha": "^2.4.5",
25+
"phantomjs-polyfill": "0.0.2",
26+
"phantomjs-prebuilt": "^2.1.5",
27+
"sinon": "^1.17.3",
28+
"sinon-chai": "^2.8.0",
29+
"webpack": "^1.12.14"
30+
}
31+
}

tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"declaration": true,
6+
"sourceMap": true
7+
}
8+
}

tslint.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"rules": {
3+
"class-name": true,
4+
"comment-format": [true, "check-space"],
5+
"curly": true,
6+
"eofline": true,
7+
"forin": true,
8+
"indent": [true, "spaces", 2],
9+
"interface-name": true,
10+
"label-position": true,
11+
"label-undefined": true,
12+
"max-line-length": [true, 140],
13+
"member-access": true,
14+
"member-ordering": [
15+
true,
16+
"public-before-private",
17+
"static-before-instance",
18+
"variables-before-functions"
19+
],
20+
"no-arg": true,
21+
"no-any": false,
22+
"no-bitwise": true,
23+
"no-consecutive-blank-lines": true,
24+
"no-console": [
25+
true,
26+
"debug",
27+
"info",
28+
"time",
29+
"timeEnd",
30+
"trace"
31+
],
32+
"no-construct": true,
33+
"no-debugger": true,
34+
"no-duplicate-key": true,
35+
"no-duplicate-variable": true,
36+
"no-empty": true,
37+
"no-eval": true,
38+
"no-inferrable-types": true,
39+
"no-shadowed-variable": true,
40+
"no-string-literal": true,
41+
"no-switch-case-fall-through": true,
42+
"no-trailing-whitespace": true,
43+
"no-unused-expression": true,
44+
"no-unused-variable": true,
45+
"no-unreachable": true,
46+
"no-use-before-declare": true,
47+
"no-var-keyword": true,
48+
"object-literal-sort-keys": true,
49+
"one-line": [
50+
true,
51+
"check-open-brace",
52+
"check-catch",
53+
"check-else",
54+
"check-whitespace"
55+
],
56+
"quotemark": [true, "single", "avoid-escape"],
57+
"radix": true,
58+
"semicolon": true,
59+
"trailing-comma": {
60+
"singleline": "never",
61+
"multiline": "never"
62+
},
63+
"triple-equals": [true, "allow-null-check"],
64+
"variable-name": ["check-format", "allow-leading-underscore", "ban-keywords"],
65+
"whitespace": [true,
66+
"check-branch",
67+
"check-decl",
68+
"check-operator",
69+
"check-separator",
70+
"check-type"
71+
]
72+
}
73+
}

0 commit comments

Comments
 (0)
X Tutup