Skip to content

Commit

Permalink
Basic setup TypeScript linkeddata#355
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Oct 2, 2019
1 parent 5c018ac commit 81f559f
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
presets: [
["@babel/env"],
"presets": [
"@babel/preset-env",
"@babel/preset-typescript",
],
"plugins": [
"@babel/plugin-transform-runtime"
Expand Down
145 changes: 145 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
"@babel/core": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-typescript": "^7.6.0",
"@babel/register": "^7.5.5",
"@types/chai": "^4.2.3",
"@types/express": "^4.17.1",
"@types/mocha": "^5.2.7",
"babel-loader": "^8.0.6",
"chai": "^4.2.0",
"diff": "^4.0.1",
Expand All @@ -59,14 +63,17 @@
"rimraf": "^3.0.0",
"sinon": "^7.4.1",
"sinon-chai": "^3.3.0",
"source-map-loader": "^0.2.4",
"typescript": "^3.6.3",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.8.0",
"wrapper-webpack-plugin": "^2.1.0"
},
"scripts": {
"build": "babel src -d lib",
"build": "babel src --extensions \".ts,.js\" -d lib",
"build:browser": "webpack --progress",
"build:types": "tsc --emitDeclarationOnly -d --declarationDir lib --allowJs false",
"doc": "rm -r doc ; jsdoc -d doc README.md src/*.js",
"prepare": "npm run build && npm run build:browser",
"start": "webpack-dev-server --https --port 4800",
Expand All @@ -87,9 +94,9 @@
"test:serialize:11": "cd ./tests/serialize && node ./data.js -in=structures.n3 -format=application/rdf+xml -out=,structures.xml && node diff ,structures.xml t11-ref.xml",
"test:serialize:12": "cd ./tests/serialize && node ./data.js -in=structures.n3 -format=text/turtle -out=,structures.ttl && node diff ,structures.ttl t12-ref.ttl",
"test:serialize:13": "cd ./tests/serialize && node ./data.js -in=structures.n3 -format=application/n-triples -out=,structures.nt && node ./data.js -format=application/n-triples -in=,structures.nt -format=text/turtle -out=,structures.nt.ttl && node diff ,structures.nt.ttl t13-ref.ttl",
"test:unit": "mocha --growl --require @babel/register tests/unit/**-test.js",
"test:unit:egp": "mocha --require @babel/register tests/unit/fetcher-egp-test.js",
"test:unit:dev": "mocha --watch --growl --require @babel/register tests/unit/**-test.js"
"test:unit": "mocha --growl --require ./tests/babel-register.js tests/unit/**-test.js",
"test:unit:egp": "mocha --require ./tests/babel-register.js tests/unit/fetcher-egp-test.js",
"test:unit:dev": "mocha --watch --growl --require ./tests/babel-register.js tests/unit/**-test.js"
},
"files": [
".babelrc",
Expand All @@ -98,6 +105,7 @@
"dist"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "src/index.js",
"sideEffects": false,
"keywords": [
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions tests/babel-register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const register = require('@babel/register').default;

register({ extensions: ['.ts','.tsx', '.js', '.jsx'] });
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"checkJs": false,
"allowJs": true,
"target": "es6",
"module": "es6",
"strict": true,
"noImplicitAny": false,
"lib": [
"es2019"
]
},
"include": [
"src/**/*"
]
}
10 changes: 7 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = (env, args) => {
return {
mode: 'production',
entry: [
'./src/index.js'
'./src/index.ts'
],
output: {
path: path.join(__dirname, '/dist/'),
Expand All @@ -16,9 +16,13 @@ module.exports = (env, args) => {
module: {
rules: [
{
test: /\.js$/,
test: /\.(js|ts)$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(js|ts)$/,
loader: "source-map-loader"
}
]
},
Expand All @@ -32,7 +36,7 @@ module.exports = (env, args) => {
if (!window.solid.auth)
window.solid.auth = { fetch: (a, b) => window.fetch(a, b) }
}`
})
}),
],
externals: {
'@trust/webcrypto': 'crypto',
Expand Down

0 comments on commit 81f559f

Please sign in to comment.