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 7670165
Show file tree
Hide file tree
Showing 7 changed files with 6,255 additions and 10 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
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"homepage": "http://github.com/linkeddata/rdflib.js",
"bugs": "http://github.com/linkeddata/rdflib.js/issues",
"dependencies": {
"@babel/preset-typescript": "^7.6.0",
"@babel/runtime": "^7.5.5",
"async": "^3.1.x",
"fork-ts-checker-webpack-plugin": "^1.5.0",
"jsonld": "^1.6.2",
"n3": "^1.2.0",
"solid-auth-cli": "^1.0.8",
Expand All @@ -46,6 +48,8 @@
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"babel-loader": "^8.0.6",
"chai": "^4.2.0",
"diff": "^4.0.1",
Expand All @@ -59,6 +63,8 @@
"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",
Expand Down Expand Up @@ -87,18 +93,18 @@
"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",
"src",
"lib",
"dist"
],
"main": "lib/index.js",
"module": "src/index.js",
"main": "lib/index",
"module": "src/index",
"sideEffects": false,
"keywords": [
"linkeddata",
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'] });
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"outDir": "./dist",
"allowJs": true,
"target": "es5",
"module": "commonjs",
"types": [
"node",
"mocha",
"express"
],
"strict": true,
"noImplicitAny": false
},
"include": [
"./src/**/*"
]
}
12 changes: 9 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const path = require('path')
const WrapperPlugin = require('wrapper-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = (env, args) => {
return {
mode: 'production',
entry: [
'./src/index.js'
'./src/index.ts'
],
output: {
path: path.join(__dirname, '/dist/'),
Expand All @@ -16,9 +17,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 +37,8 @@ module.exports = (env, args) => {
if (!window.solid.auth)
window.solid.auth = { fetch: (a, b) => window.fetch(a, b) }
}`
})
}),
new ForkTsCheckerWebpackPlugin(),
],
externals: {
'@trust/webcrypto': 'crypto',
Expand Down
Loading

0 comments on commit 7670165

Please sign in to comment.