Skip to content

Commit

Permalink
Add AMD bundle.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrv committed Nov 29, 2017
1 parent f18ebd7 commit d0cf648
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions classy-mst.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/index';
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"typings": "dist/index.d.ts",
"scripts": {
"tsc": "tsc",
"prepublish": "tsc -p src",
"prepublish": "tsc -p src && tsc -p src/ts-amd.json && node src/fix-amd.js",
"test": "tsc -p test && node test/test.js"
},
"author": "Juha Järvi",
Expand Down
8 changes: 8 additions & 0 deletions src/fix-amd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var fs = require('fs');

var codePath = require('path').resolve(__dirname, '../dist/index-amd.js');
var code = fs.readFileSync(codePath, { encoding: 'utf-8' });

code = code.replace(/\"src\//g, '"classy-mst/');

fs.writeFileSync(codePath, code, { encoding: 'utf-8' });
20 changes: 20 additions & 0 deletions src/ts-amd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compileOnSave": true,
"compilerOptions": {
"declaration": false,
"lib": [ "es5", "es2015.iterable" ],
"module": "amd",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitThis": true,
"outFile": "../dist/index-amd.js",
"removeComments": false,
"sourceMap": false,
"strictNullChecks": true,
"target": "es5",
"types": []
},
"files": [
"../classy-mst.ts"
]
}
6 changes: 3 additions & 3 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"compileOnSave": true,
"compilerOptions": {
"declaration": true,
"experimentalDecorators": true,
"lib": [ "es5" ],
"lib": [ "es5", "es2015.iterable" ],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
Expand All @@ -12,7 +11,8 @@
"removeComments": false,
"sourceMap": false,
"strictNullChecks": true,
"target": "es5"
"target": "es5",
"types": []
},
"files": [
"index.ts"
Expand Down

0 comments on commit d0cf648

Please sign in to comment.