feat(build): add package.json and README.md for publishing to npm

This commit is contained in:
Tobias Bosch 2015-02-10 11:06:59 -08:00
parent 69bba9b5df
commit dd532fee72
7 changed files with 166 additions and 91 deletions

View File

@ -157,6 +157,16 @@ var CONFIG = {
cjs: CJS_COMPILER_OPTIONS
}
},
copy: {
js: ['modules/**/README.md', 'modules/**/package.json'],
dart: []
},
multicopy: {
src: {
dart: ['LICENSE'],
js: ['LICENSE', 'tools/build/es5build.js']
}
},
html: {
src: {
js: ['modules/*/src/**/*.html'],
@ -187,9 +197,6 @@ var CONFIG = {
pubspec: {
src: 'modules/*/pubspec.yaml'
},
license: {
src: 'LICENSE'
},
formatDart: {
packageName: 'dart_style',
args: ['dart_style:format', '-w', 'dist/dart']
@ -333,20 +340,33 @@ gulp.task('build/html.dart', html(gulp, gulpPlugins, {
}));
// ------------
// license
// copy
gulp.task('build/license.js.dev', multicopy(gulp, gulpPlugins, {
src: CONFIG.license.src,
dest: CONFIG.dest.js.dev
gulp.task('build/copy.js.dev', function() {
return gulp.src(CONFIG.copy.js)
.pipe(gulp.dest(CONFIG.dest.js.dev.es6));
});
gulp.task('build/copy.js.prod', function() {
return gulp.src(CONFIG.copy.js)
.pipe(gulp.dest(CONFIG.dest.js.prod.es6));
});
// ------------
// multicopy
gulp.task('build/multicopy.js.dev', multicopy(gulp, gulpPlugins, {
src: CONFIG.multicopy.src.js,
dest: CONFIG.dest.js.dev.es6
}));
gulp.task('build/license.js.prod', multicopy(gulp, gulpPlugins, {
src: CONFIG.license.src,
dest: CONFIG.dest.js.prod
gulp.task('build/multicopy.js.prod', multicopy(gulp, gulpPlugins, {
src: CONFIG.multicopy.src.js,
dest: CONFIG.dest.js.prod.es6
}));
gulp.task('build/license.dart', multicopy(gulp, gulpPlugins, {
src: CONFIG.license.src,
gulp.task('build/multicopy.dart', multicopy(gulp, gulpPlugins, {
src: CONFIG.multicopy.src.dart,
dest: CONFIG.dest.dart
}));
@ -512,7 +532,7 @@ gulp.task('build.dart', function() {
return runSequence(
['build/deps.js.dart2js', 'build/transpile.dart', 'build/html.dart'],
'build/pubspec.dart',
'build/license.dart',
'build/multicopy.dart',
'build/pubbuild.dart',
'build/analyze.dart',
'build/format.dart'
@ -521,15 +541,15 @@ gulp.task('build.dart', function() {
gulp.task('build.js.dev', function() {
return runSequence(
['build/deps.js.dev', 'build/transpile.js.dev', 'build/html.js.dev'],
'build/license.js.dev'
['build/deps.js.dev', 'build/transpile.js.dev', 'build/html.js.dev', 'build/copy.js.dev'],
'build/multicopy.js.dev'
);
});
gulp.task('build.js.prod', function() {
return runSequence(
['build/deps.js.prod', 'build/transpile.js.prod', 'build/html.js.prod'],
'build/license.js.prod'
['build/deps.js.prod', 'build/transpile.js.prod', 'build/html.js.prod', 'build/copy.js.prod'],
'build/multicopy.js.prod'
);
});

View File

@ -0,0 +1,12 @@
Angular2
=========
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)
All sources are in ES6 format and have the suffix `.es6`. They don't depend on any runtime
and can be used by any modern ES6 -> ES5 transpiler.
As a convenience, we provide you with `es5build.js`, a script to transpile the sources into es5
using [Google Traceur](https://github.com/google/traceur-compiler/).
License: Apache MIT 2.0

View File

@ -0,0 +1,30 @@
{
"name": "angular2",
"version": "2.0.0-alpha.1",
"description": "Angular 2 - a web framework for modern web apps",
"homepage": "https://github.com/angular/angular",
"bugs": "https://github.com/angular/angular/issues",
"contributors": {
"Alex Eagle": "alexeagle@google.com",
"Chirayu Krishnappa": "chirayu@google.com",
"Jeff Cross": "crossj@google.com",
"Misko Hevery": "misko@google.com",
"Rado Kirov": "radokirov@google.com",
"Tobias Bosch": "tbosch@google.com",
"Victor Savkin": "vsavkin@google.com",
"Yegor Jbanov": "yjbanov@google.com"
},
"license": "Apache-2.0",
"dependencies": {
"zone": "0.4.*",
"rtts-assert": "2.0.0-alpha.1"
},
"devDependencies": {
"yargs": "2.3.*",
"gulp-sourcemaps": "1.3.*",
"gulp-traceur": "0.16.*",
"gulp": "^3.8.8",
"gulp-rename": "^1.2.0",
"through2": "^0.6.1"
}
}

View File

@ -1,44 +0,0 @@
// Asserting APIs:
// - generated by Traceur (based on type annotations)
// - can be also used in tests for instance
assert.type(something, Type);
assert.returnType(returnValue, Type);
assert.argumentTypes(firstArg, Type, secondArg, Type);
// this can be used anywhere in the code
// (useful inside test, when we don't wanna define an interface)
assert(value).is(...)
// Custom type assert:
// - i have a custom type
// - adding an assert methos
assert.define(MyUser, function(value) {
assert(value).is(Type, Type2); // or
assert(value, 'name').is(assert.string);
assert(value, 'contact').is(assert.structure({
email: assert.string,
cell: assert.string
}));
assert(value, 'contacts').is(assert.arrayOf(assert.structure({email: assert.string})));
});
// Define interface (an empty type with assert method)
// - returns an empty class with assert method
var Email = assert.define('IEmail', function(value) {
assert(value).is(String);
if (value.indexOf('@') !== -1) {
assert.fail('has to contain "@"');
}
});
// Predefined types
assert.string
assert.number
assert.boolean
assert.arrayOf(...types)
assert.structure(object)

View File

@ -1 +1,60 @@
http://angular.github.io/assert/
# Rtts-Assert
A run-time type assertion library for JavaScript.
Designed to be used with [Traceur](https://github.com/google/traceur-compiler).
All sources are in ES6 format and have the suffix `.es6`. They don't depend on any runtime
and can be used by any modern ES6 -> ES5 transpiler.
As a convenience, we provide you with `es5build.js`, a script to transpile the sources into es5
using [Google Traceur](https://github.com/google/traceur-compiler/).
License: Apache MIT 2.0
## API
```
// Asserting APIs:
// - generated by Traceur (based on type annotations)
// - can be also used in tests for instance
assert.type(something, Type);
assert.returnType(returnValue, Type);
assert.argumentTypes(firstArg, Type, secondArg, Type);
// this can be used anywhere in the code
// (useful inside test, when we don't wanna define an interface)
assert(value).is(...)
// Custom type assert:
// - i have a custom type
// - adding an assert methos
assert.define(MyUser, function(value) {
assert(value).is(Type, Type2); // or
assert(value, 'name').is(assert.string);
assert(value, 'contact').is(assert.structure({
email: assert.string,
cell: assert.string
}));
assert(value, 'contacts').is(assert.arrayOf(assert.structure({email: assert.string})));
});
// Define interface (an empty type with assert method)
// - returns an empty class with assert method
var Email = assert.define('IEmail', function(value) {
assert(value).is(String);
if (value.indexOf('@') !== -1) {
assert.fail('has to contain "@"');
}
});
// Predefined types
assert.string
assert.number
assert.boolean
assert.arrayOf(...types)
assert.structure(object)
```

View File

@ -1,31 +1,26 @@
{
"name": "rtts-assert",
"version": "0.0.1",
"version": "2.0.0-alpha.1",
"description": "A type assertion library for Traceur.",
"main": "./dist/cjs/assert.js",
"homepage": "https://github.com/angular/assert",
"repository": {
"type": "git",
"url": "git://github.com/angular/assert.git"
"homepage": "https://github.com/angular/angular",
"bugs": "https://github.com/angular/angular/issues",
"contributors": {
"Alex Eagle": "alexeagle@google.com",
"Chirayu Krishnappa": "chirayu@google.com",
"Jeff Cross": "crossj@google.com",
"Misko Hevery": "misko@google.com",
"Rado Kirov": "radokirov@google.com",
"Tobias Bosch": "tbosch@google.com",
"Victor Savkin": "vsavkin@google.com",
"Yegor Jbanov": "yjbanov@google.com"
},
"bugs": {
"url": "https://github.com/angular/assert/issues"
},
"dependencies": {},
"license": "Apache-2.0",
"devDependencies": {
"gulp": "^3.5.6",
"gulp-connect": "~1.0.5",
"gulp-traceur": "~0.4.0",
"karma": "^0.12.1",
"karma-chrome-launcher": "^0.1.2",
"karma-jasmine": "^0.2.2",
"karma-requirejs": "^0.2.1",
"karma-traceur-preprocessor": "^0.2.2",
"pipe": "git://github.com/angular/pipe#remove-transitive-deps"
},
"scripts": {
"test": "karma start --single-run"
},
"author": "Vojta Jína <vojta.jina@gmail.com>",
"license": "Apache-2.0"
"yargs": "2.3.*",
"gulp-sourcemaps": "1.3.*",
"gulp-traceur": "0.16.*",
"gulp": "^3.8.8",
"gulp-rename": "^1.2.0",
"through2": "^0.6.1"
}
}

View File

@ -7,10 +7,13 @@ var fs = require('fs');
module.exports = function(gulp, plugins, config) {
return function() {
var content = fs.readFileSync(config.src);
getSubdirs(config.dest).forEach(function(subDir) {
var destFile = path.join(config.dest, subDir, path.basename(config.src));
fs.writeFileSync(destFile, content);
var subDirs = getSubdirs(config.dest);
config.src.forEach(function(srcFile) {
var content = fs.readFileSync(srcFile);
subDirs.forEach(function(subDir) {
var destFile = path.join(config.dest, subDir, path.basename(srcFile));
fs.writeFileSync(destFile, content);
});
});
};
};