Skip to content

Commit dd532fe

Browse files
committed
feat(build): add package.json and README.md for publishing to npm
1 parent 69bba9b commit dd532fe

7 files changed

Lines changed: 166 additions & 91 deletions

File tree

gulpfile.js

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ var CONFIG = {
157157
cjs: CJS_COMPILER_OPTIONS
158158
}
159159
},
160+
copy: {
161+
js: ['modules/**/README.md', 'modules/**/package.json'],
162+
dart: []
163+
},
164+
multicopy: {
165+
src: {
166+
dart: ['LICENSE'],
167+
js: ['LICENSE', 'tools/build/es5build.js']
168+
}
169+
},
160170
html: {
161171
src: {
162172
js: ['modules/*/src/**/*.html'],
@@ -187,9 +197,6 @@ var CONFIG = {
187197
pubspec: {
188198
src: 'modules/*/pubspec.yaml'
189199
},
190-
license: {
191-
src: 'LICENSE'
192-
},
193200
formatDart: {
194201
packageName: 'dart_style',
195202
args: ['dart_style:format', '-w', 'dist/dart']
@@ -333,20 +340,33 @@ gulp.task('build/html.dart', html(gulp, gulpPlugins, {
333340
}));
334341

335342
// ------------
336-
// license
343+
// copy
344+
345+
gulp.task('build/copy.js.dev', function() {
346+
return gulp.src(CONFIG.copy.js)
347+
.pipe(gulp.dest(CONFIG.dest.js.dev.es6));
348+
});
349+
350+
gulp.task('build/copy.js.prod', function() {
351+
return gulp.src(CONFIG.copy.js)
352+
.pipe(gulp.dest(CONFIG.dest.js.prod.es6));
353+
});
354+
355+
// ------------
356+
// multicopy
337357

338-
gulp.task('build/license.js.dev', multicopy(gulp, gulpPlugins, {
339-
src: CONFIG.license.src,
340-
dest: CONFIG.dest.js.dev
358+
gulp.task('build/multicopy.js.dev', multicopy(gulp, gulpPlugins, {
359+
src: CONFIG.multicopy.src.js,
360+
dest: CONFIG.dest.js.dev.es6
341361
}));
342362

343-
gulp.task('build/license.js.prod', multicopy(gulp, gulpPlugins, {
344-
src: CONFIG.license.src,
345-
dest: CONFIG.dest.js.prod
363+
gulp.task('build/multicopy.js.prod', multicopy(gulp, gulpPlugins, {
364+
src: CONFIG.multicopy.src.js,
365+
dest: CONFIG.dest.js.prod.es6
346366
}));
347367

348-
gulp.task('build/license.dart', multicopy(gulp, gulpPlugins, {
349-
src: CONFIG.license.src,
368+
gulp.task('build/multicopy.dart', multicopy(gulp, gulpPlugins, {
369+
src: CONFIG.multicopy.src.dart,
350370
dest: CONFIG.dest.dart
351371
}));
352372

@@ -512,7 +532,7 @@ gulp.task('build.dart', function() {
512532
return runSequence(
513533
['build/deps.js.dart2js', 'build/transpile.dart', 'build/html.dart'],
514534
'build/pubspec.dart',
515-
'build/license.dart',
535+
'build/multicopy.dart',
516536
'build/pubbuild.dart',
517537
'build/analyze.dart',
518538
'build/format.dart'
@@ -521,15 +541,15 @@ gulp.task('build.dart', function() {
521541

522542
gulp.task('build.js.dev', function() {
523543
return runSequence(
524-
['build/deps.js.dev', 'build/transpile.js.dev', 'build/html.js.dev'],
525-
'build/license.js.dev'
544+
['build/deps.js.dev', 'build/transpile.js.dev', 'build/html.js.dev', 'build/copy.js.dev'],
545+
'build/multicopy.js.dev'
526546
);
527547
});
528548

529549
gulp.task('build.js.prod', function() {
530550
return runSequence(
531-
['build/deps.js.prod', 'build/transpile.js.prod', 'build/html.js.prod'],
532-
'build/license.js.prod'
551+
['build/deps.js.prod', 'build/transpile.js.prod', 'build/html.js.prod', 'build/copy.js.prod'],
552+
'build/multicopy.js.prod'
533553
);
534554
});
535555

modules/angular2/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Angular2
2+
=========
3+
4+
The sources for this package are in the main [Angular2](https://github.com/angular/angular) repo. Please file issues and pull requests against that repo. This is the repository for the upcoming 2.0 version. If you're looking for the current official version of Angular you should go to [angular/angular.js](https://github.com/angular/angular.js)
5+
6+
All sources are in ES6 format and have the suffix `.es6`. They don't depend on any runtime
7+
and can be used by any modern ES6 -> ES5 transpiler.
8+
9+
As a convenience, we provide you with `es5build.js`, a script to transpile the sources into es5
10+
using [Google Traceur](https://github.com/google/traceur-compiler/).
11+
12+
License: Apache MIT 2.0

modules/angular2/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "angular2",
3+
"version": "2.0.0-alpha.1",
4+
"description": "Angular 2 - a web framework for modern web apps",
5+
"homepage": "https://github.com/angular/angular",
6+
"bugs": "https://github.com/angular/angular/issues",
7+
"contributors": {
8+
"Alex Eagle": "alexeagle@google.com",
9+
"Chirayu Krishnappa": "chirayu@google.com",
10+
"Jeff Cross": "crossj@google.com",
11+
"Misko Hevery": "misko@google.com",
12+
"Rado Kirov": "radokirov@google.com",
13+
"Tobias Bosch": "tbosch@google.com",
14+
"Victor Savkin": "vsavkin@google.com",
15+
"Yegor Jbanov": "yjbanov@google.com"
16+
},
17+
"license": "Apache-2.0",
18+
"dependencies": {
19+
"zone": "0.4.*",
20+
"rtts-assert": "2.0.0-alpha.1"
21+
},
22+
"devDependencies": {
23+
"yargs": "2.3.*",
24+
"gulp-sourcemaps": "1.3.*",
25+
"gulp-traceur": "0.16.*",
26+
"gulp": "^3.8.8",
27+
"gulp-rename": "^1.2.0",
28+
"through2": "^0.6.1"
29+
}
30+
}

modules/rtts_assert/API.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

modules/rtts_assert/README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
1-
http://angular.github.io/assert/
1+
# Rtts-Assert
2+
3+
A run-time type assertion library for JavaScript.
4+
Designed to be used with [Traceur](https://github.com/google/traceur-compiler).
5+
6+
All sources are in ES6 format and have the suffix `.es6`. They don't depend on any runtime
7+
and can be used by any modern ES6 -> ES5 transpiler.
8+
9+
As a convenience, we provide you with `es5build.js`, a script to transpile the sources into es5
10+
using [Google Traceur](https://github.com/google/traceur-compiler/).
11+
12+
License: Apache MIT 2.0
13+
14+
## API
15+
16+
```
17+
// Asserting APIs:
18+
// - generated by Traceur (based on type annotations)
19+
// - can be also used in tests for instance
20+
assert.type(something, Type);
21+
assert.returnType(returnValue, Type);
22+
assert.argumentTypes(firstArg, Type, secondArg, Type);
23+
24+
// this can be used anywhere in the code
25+
// (useful inside test, when we don't wanna define an interface)
26+
assert(value).is(...)
27+
28+
29+
// Custom type assert:
30+
// - i have a custom type
31+
// - adding an assert methos
32+
assert.define(MyUser, function(value) {
33+
assert(value).is(Type, Type2); // or
34+
assert(value, 'name').is(assert.string);
35+
assert(value, 'contact').is(assert.structure({
36+
email: assert.string,
37+
cell: assert.string
38+
}));
39+
assert(value, 'contacts').is(assert.arrayOf(assert.structure({email: assert.string})));
40+
});
41+
42+
43+
// Define interface (an empty type with assert method)
44+
// - returns an empty class with assert method
45+
var Email = assert.define('IEmail', function(value) {
46+
assert(value).is(String);
47+
48+
if (value.indexOf('@') !== -1) {
49+
assert.fail('has to contain "@"');
50+
}
51+
});
52+
53+
54+
// Predefined types
55+
assert.string
56+
assert.number
57+
assert.boolean
58+
assert.arrayOf(...types)
59+
assert.structure(object)
60+
```

modules/rtts_assert/package.json

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
11
{
22
"name": "rtts-assert",
3-
"version": "0.0.1",
3+
"version": "2.0.0-alpha.1",
44
"description": "A type assertion library for Traceur.",
5-
"main": "./dist/cjs/assert.js",
6-
"homepage": "https://github.com/angular/assert",
7-
"repository": {
8-
"type": "git",
9-
"url": "git://github.com/angular/assert.git"
5+
"homepage": "https://github.com/angular/angular",
6+
"bugs": "https://github.com/angular/angular/issues",
7+
"contributors": {
8+
"Alex Eagle": "alexeagle@google.com",
9+
"Chirayu Krishnappa": "chirayu@google.com",
10+
"Jeff Cross": "crossj@google.com",
11+
"Misko Hevery": "misko@google.com",
12+
"Rado Kirov": "radokirov@google.com",
13+
"Tobias Bosch": "tbosch@google.com",
14+
"Victor Savkin": "vsavkin@google.com",
15+
"Yegor Jbanov": "yjbanov@google.com"
1016
},
11-
"bugs": {
12-
"url": "https://github.com/angular/assert/issues"
13-
},
14-
"dependencies": {},
17+
"license": "Apache-2.0",
1518
"devDependencies": {
16-
"gulp": "^3.5.6",
17-
"gulp-connect": "~1.0.5",
18-
"gulp-traceur": "~0.4.0",
19-
"karma": "^0.12.1",
20-
"karma-chrome-launcher": "^0.1.2",
21-
"karma-jasmine": "^0.2.2",
22-
"karma-requirejs": "^0.2.1",
23-
"karma-traceur-preprocessor": "^0.2.2",
24-
"pipe": "git://github.com/angular/pipe#remove-transitive-deps"
25-
},
26-
"scripts": {
27-
"test": "karma start --single-run"
28-
},
29-
"author": "Vojta Jína <vojta.jina@gmail.com>",
30-
"license": "Apache-2.0"
19+
"yargs": "2.3.*",
20+
"gulp-sourcemaps": "1.3.*",
21+
"gulp-traceur": "0.16.*",
22+
"gulp": "^3.8.8",
23+
"gulp-rename": "^1.2.0",
24+
"through2": "^0.6.1"
25+
}
3126
}

tools/build/multicopy.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ var fs = require('fs');
77

88
module.exports = function(gulp, plugins, config) {
99
return function() {
10-
var content = fs.readFileSync(config.src);
11-
getSubdirs(config.dest).forEach(function(subDir) {
12-
var destFile = path.join(config.dest, subDir, path.basename(config.src));
13-
fs.writeFileSync(destFile, content);
10+
var subDirs = getSubdirs(config.dest);
11+
config.src.forEach(function(srcFile) {
12+
var content = fs.readFileSync(srcFile);
13+
subDirs.forEach(function(subDir) {
14+
var destFile = path.join(config.dest, subDir, path.basename(srcFile));
15+
fs.writeFileSync(destFile, content);
16+
});
1417
});
1518
};
1619
};

0 commit comments

Comments
 (0)