Skip to content

Commit e102ab5

Browse files
committedMar 7, 2018
Fix #4 with babel, add npm script build
Also needed to modify index.ts with an import babel-polyfill. `npm run build` now compiles from toolchain/, and then runs the babel build process.
1 parent 47222ae commit e102ab5

File tree

4 files changed

+2341
-2
lines changed

4 files changed

+2341
-2
lines changed
 

‎.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "stage-2"]
3+
}

‎package-lock.json

+2,325
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"@types/common-tags": "^1.4.0",
88
"@types/estree": "0.0.37",
99
"@types/invariant": "^2.2.29",
10-
"astring": "^1.2.0",
1110
"acorn": "^5.1.2",
11+
"astring": "^1.2.0",
12+
"babel-cli": "^6.26.0",
1213
"commander": "^2.14.1",
1314
"common-tags": "^1.4.0",
1415
"invariant": "^2.2.2"
@@ -17,12 +18,21 @@
1718
"bin": {
1819
"slang": "./slang.js"
1920
},
21+
"scripts": {
22+
"build": "tsc; babel toolchain -d lib"
23+
},
2024
"repository": {
2125
"type": "git",
2226
"url": "git+https://github.com/ningyuansg/slang.git"
2327
},
2428
"bugs": {
2529
"url": "https://github.com/ningyuansg/slang/issues"
2630
},
27-
"homepage": "https://github.com/ningyuansg/slang#readme"
31+
"homepage": "https://github.com/ningyuansg/slang#readme",
32+
"devDependencies": {
33+
"babel-core": "^6.26.0",
34+
"babel-polyfill": "^6.26.0",
35+
"babel-preset-es2015": "^6.24.1",
36+
"babel-preset-stage-2": "^6.24.1"
37+
}
2838
}

‎toolchain/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'babel-polyfill'
12
import { Context, Scheduler, SourceError, Result } from './types'
23
import { evaluate } from './interpreter'
34
import { InterruptedError } from './interpreter-errors'

0 commit comments

Comments
 (0)
Please sign in to comment.