Skip to content

Commit 762aac4

Browse files
committed
Created basic package structure and added lang module
0 parents  commit 762aac4

28 files changed

Lines changed: 7574 additions & 0 deletions

meta/shim/.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = tab
6+
indent_size = 4
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

meta/shim/.gitattributes

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Set the default behavior, in case users don't have core.autocrlf set
2+
* text=auto
3+
4+
# Files that should always be normalized and converted to native line
5+
# endings on checkout.
6+
*.js text
7+
*.json text
8+
*.ts text
9+
*.md text
10+
*.yml text
11+
LICENSE text
12+
13+
# Files that are truly binary and should not be modified
14+
*.png binary
15+
*.jpg binary
16+
*.jpeg binary
17+
*.gif binary
18+
*.jar binary
19+
*.zip binary
20+
*.psd binary

meta/shim/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.sublimets
2+
.tscache
3+
*.js
4+
*.js.map
5+
!/*.js
6+
dist
7+
node_modules
8+
bower_components
9+
tests/typings/dist/
10+
.baseDir.ts
11+
html-report

meta/shim/.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.npmignore
2+
.sublimets
3+
.travis.yml
4+
tests/
5+
Gruntfile.js
6+
tslint.json
7+
*.ts

meta/shim/.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- "0.10"
5+
cache:
6+
directories:
7+
- node_modules
8+
script:
9+
- "grunt ci"

meta/shim/Gruntfile.js

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
/* jshint node:true */
2+
3+
var dtsGenerator = require('dts-generator');
4+
5+
module.exports = function (grunt) {
6+
grunt.loadNpmTasks('grunt-contrib-clean');
7+
grunt.loadNpmTasks('grunt-contrib-copy');
8+
grunt.loadNpmTasks('grunt-contrib-watch');
9+
grunt.loadNpmTasks('grunt-ts');
10+
grunt.loadNpmTasks('grunt-tslint');
11+
grunt.loadNpmTasks('intern');
12+
13+
grunt.initConfig({
14+
name: 'dojo-core',
15+
all: [ 'src/**/*.ts', 'typings/tsd.d.ts' ],
16+
tests: [ 'tests/**/*.ts', 'typings/tsd.d.ts' ],
17+
18+
clean: {
19+
dist: {
20+
src: [ 'dist/' ]
21+
},
22+
src: {
23+
src: [ '{src,tests}/**/*.js' ],
24+
filter: function (path) {
25+
// Only clean the .js file if a .js.map file also exists
26+
var mapPath = path + '.map';
27+
if (grunt.file.exists(mapPath)) {
28+
grunt.file.delete(mapPath);
29+
return true;
30+
}
31+
return false;
32+
}
33+
},
34+
typings: {
35+
src: [ 'tests/typings/dist/' ]
36+
},
37+
coverage: {
38+
src: [ 'html-report/' ]
39+
}
40+
},
41+
42+
copy: {
43+
sourceForDebugging: {
44+
expand: true,
45+
cwd: 'src/',
46+
src: [ '**/*.ts' ],
47+
dest: 'dist/_debug/'
48+
},
49+
staticFiles: {
50+
expand: true,
51+
cwd: '.',
52+
src: [ 'README.md', 'LICENSE', 'package.json', 'bower.json' ],
53+
dest: 'dist/'
54+
},
55+
typings: {
56+
expand: true,
57+
cwd: 'typings/',
58+
src: [ '**/*.d.ts', '!tsd.d.ts' ],
59+
dest: 'dist/typings/'
60+
}
61+
},
62+
63+
dts: {
64+
options: {
65+
baseDir: 'src',
66+
name: '<%= name %>'
67+
},
68+
dist: {
69+
options: {
70+
out: 'dist/typings/<%= name %>/<%= name %>-2.0.d.ts'
71+
},
72+
src: [ '<%= all %>' ]
73+
},
74+
tests: {
75+
options: {
76+
name: 'dist',
77+
out: 'tests/typings/dist/dist.d.ts'
78+
},
79+
src: [ '<%= all %>' ]
80+
}
81+
},
82+
83+
intern: {
84+
options: {
85+
grep: grunt.option('grep') || '.*',
86+
runType: 'runner',
87+
config: 'tests/intern'
88+
},
89+
runner: {
90+
options: {
91+
reporters: [ 'runner', 'lcovhtml' ]
92+
}
93+
},
94+
local: {
95+
options: {
96+
config: 'tests/intern-local',
97+
reporters: [ 'runner', 'lcovhtml' ]
98+
}
99+
},
100+
client: {
101+
options: {
102+
runType: 'client',
103+
reporters: [ 'console', 'lcovhtml' ]
104+
}
105+
},
106+
proxy: {
107+
options: {
108+
proxyOnly: true
109+
}
110+
}
111+
},
112+
113+
rename: {
114+
sourceMaps: {
115+
expand: true,
116+
cwd: 'dist/',
117+
src: [ '**/*.js.map', '!_debug/**/*.js.map' ],
118+
dest: 'dist/_debug/'
119+
}
120+
},
121+
122+
rewriteSourceMaps: {
123+
dist: {
124+
src: [ 'dist/_debug/**/*.js.map' ]
125+
}
126+
},
127+
128+
ts: {
129+
options: {
130+
failOnTypeErrors: true,
131+
fast: 'never',
132+
noImplicitAny: true,
133+
sourceMap: true,
134+
target: 'es5',
135+
module: 'camd'
136+
},
137+
dist: {
138+
options: {
139+
mapRoot: '../dist/_debug'
140+
},
141+
outDir: 'dist',
142+
src: [ '<%= all %>' ]
143+
},
144+
tests: {
145+
src: [ '<%= tests %>' ]
146+
}
147+
},
148+
149+
tslint: {
150+
options: {
151+
configuration: grunt.file.readJSON('tslint.json')
152+
},
153+
src: {
154+
src: [ '<%= all %>', '<%= tests %>', '!typings/**/*.ts', '!tests/typings/**/*.ts' ]
155+
}
156+
},
157+
158+
watch: {
159+
src: {
160+
options: {
161+
atBegin: true
162+
},
163+
files: [ '<%= all %>', '<%= tests %>' ],
164+
tasks: [
165+
'build-tests',
166+
'tslint'
167+
]
168+
}
169+
}
170+
});
171+
172+
grunt.registerMultiTask('dts', function () {
173+
var done = this.async();
174+
var onProgress = grunt.verbose.writeln.bind(grunt.verbose);
175+
176+
var kwArgs = this.options();
177+
var path = require('path');
178+
kwArgs.files = this.filesSrc.map(function (filename) {
179+
return path.relative(kwArgs.baseDir, filename);
180+
});
181+
182+
dtsGenerator.generate(kwArgs, onProgress).then(function () {
183+
grunt.log.writeln('Generated d.ts bundle at \x1b[36m' + kwArgs.out + '\x1b[39;49m');
184+
done();
185+
}, done);
186+
});
187+
188+
grunt.registerMultiTask('rewriteSourceMaps', function () {
189+
this.filesSrc.forEach(function (file) {
190+
var map = JSON.parse(grunt.file.read(file));
191+
var sourcesContent = map.sourcesContent = [];
192+
var path = require('path');
193+
map.sources = map.sources.map(function (source, index) {
194+
sourcesContent[index] = grunt.file.read(path.resolve(path.dirname(file), source));
195+
return source.replace(/^.*\/src\//, '');
196+
});
197+
grunt.file.write(file, JSON.stringify(map));
198+
});
199+
grunt.log.writeln('Rewrote ' + this.filesSrc.length + ' source maps');
200+
});
201+
202+
grunt.registerMultiTask('rename', function () {
203+
this.files.forEach(function (file) {
204+
if (grunt.file.isFile(file.src[0])) {
205+
grunt.file.mkdir(require('path').dirname(file.dest));
206+
}
207+
require('fs').renameSync(file.src[0], file.dest);
208+
grunt.verbose.writeln('Renamed ' + file.src[0] + ' to ' + file.dest);
209+
});
210+
grunt.log.writeln('Moved ' + this.files.length + ' files');
211+
});
212+
213+
grunt.registerTask('build', [
214+
'ts:dist',
215+
'rename:sourceMaps',
216+
'rewriteSourceMaps',
217+
'dts:tests'
218+
]);
219+
grunt.registerTask('build-tests', [
220+
'build',
221+
'ts:tests'
222+
]);
223+
grunt.registerTask('dist', [
224+
'build',
225+
'copy:typings',
226+
'copy:staticFiles',
227+
'dts:dist'
228+
]);
229+
grunt.registerTask('test', [ 'build-tests', 'intern:client' ]);
230+
grunt.registerTask('test-local', [ 'build-tests', 'intern:local' ]);
231+
grunt.registerTask('test-proxy', [ 'build-tests', 'intern:proxy' ]);
232+
grunt.registerTask('ci', [ 'tslint', 'test' ]);
233+
grunt.registerTask('default', [ 'clean', 'build' ]);
234+
};

meta/shim/LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
The "New" BSD License
2+
*********************
3+
4+
Copyright (c) 2004-2015, The Dojo Foundation
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
* Neither the name of the Dojo Foundation nor the names of its contributors
16+
may be used to endorse or promote products derived from this software
17+
without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

meta/shim/bower.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "dojo-core",
3+
"description": "Utilities to detect, provide, and install language runtime features.",
4+
"keywords": [
5+
"dojo",
6+
"core",
7+
"dojo2"
8+
],
9+
"authors": [
10+
"Kris Zyp"
11+
],
12+
"main": "main.js",
13+
"homepage": "http://dojotoolkit.org/",
14+
"repository": {
15+
"type": "git",
16+
"url": "git://github.com/dojo/core.git"
17+
},
18+
"dependencies": {
19+
},
20+
"ignore": [
21+
".*",
22+
"test"
23+
],
24+
"license": [ "BSD-3-Clause" ],
25+
"moduleType": [ "amd" ]
26+
}

meta/shim/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "dojo-core",
3+
"version": "2.0.0-pre",
4+
"description": "Basic utilites for common TypeScript development",
5+
"homepage": "http://dojotoolkit.org",
6+
"bugs": {
7+
"url": "https://github.com/dojo/core/issues"
8+
},
9+
"license": "BSD-3-Clause",
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/dojo/core.git"
13+
},
14+
"devDependencies": {
15+
"dts-generator": "1.3.1",
16+
"grunt": "0.4.5",
17+
"grunt-contrib-clean": "0.6.0",
18+
"grunt-contrib-copy": "0.8.0",
19+
"grunt-contrib-watch": "0.6.1",
20+
"grunt-ts": "3.0.0",
21+
"grunt-tslint": "2.0.0",
22+
"intern": "2.2.2",
23+
"typescript": "https://github.com/csnover/TypeScript/archive/0.20150416.0+1.5.0-alpha.plus.PR2605.tar.gz"
24+
}
25+
}

0 commit comments

Comments
 (0)