forked from OpenTechStrategies/SimpleBook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade Compiling/Packaging to Typescript/Webpack
1. Slowly begin migrating code to Typescript from raw Javascript 2. Instead of relying on built-in node module bundling, use webpack These are prerequisites (in a very yak-shaving way) for adding unit testing to the code via Jest. See OpenTechStrategies#20.
- Loading branch information
Showing
11 changed files
with
96 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
# Installing | ||
|
||
This script requires node.js to be installed. | ||
In order to run the script, you will first need to build the dependencies using `npm install` | ||
In order to run the script, you will first need to build the dependencies using `yarn install` | ||
|
||
## Running the script | ||
# Building | ||
|
||
You can run the script using `node index.js` | ||
`yarn build` | ||
|
||
# Running | ||
|
||
You can run the script using `node built/main.js` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
...es/api/mw2pdf/classes/MediaWikiSession.js → ...pi/mw2pdf/src/classes/MediaWikiSession.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
services/api/mw2pdf/index.js → services/api/mw2pdf/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"outDir": "compiled/", | ||
"strict": false, | ||
"baseUrl": "./", | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"lib": ["dom", "es2016"], | ||
"sourceMap": true, | ||
"moduleResolution": "node" | ||
}, | ||
"include": [ | ||
"src", | ||
"src/classes", | ||
"src/utils" | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
"built", | ||
".git" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const path = require('path'); | ||
const nodeExternals = require('webpack-node-externals'); | ||
|
||
module.exports = [{ | ||
output: { | ||
filename: '[name].js', | ||
path: path.resolve(__dirname, 'built'), | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.ts'], | ||
}, | ||
target: 'node', | ||
entry: { main: path.resolve(__dirname, 'src/index.ts') }, | ||
module: { | ||
rules: [{ | ||
test: /\.ts$/, | ||
loader: 'awesome-typescript-loader', | ||
options: { | ||
configFile: 'tsconfig.json', | ||
}, | ||
exclude: [/node_modules/], | ||
}] | ||
}, | ||
externals: [nodeExternals()], | ||
mode: 'none', | ||
}]; |