Skip to content

Commit 471170a

Browse files
committed
fix(cli): compile
1 parent 37c25e4 commit 471170a

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

cli/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.0.4",
44
"private": false,
55
"description": "Find out the smells in your tests, suggestions for correction and the theory behind them",
6-
"main": "build/index.js",
6+
"main": "dist/cli.js",
77
"types": "./types/src/index.d.ts",
8-
"bin": "dist/cli.js",
8+
"bin": "build/index.js",
99
"dependencies": {
1010
"commander": "^12.1.0",
1111
"esprima": "^4.0.1",
@@ -34,6 +34,7 @@
3434
"ts-node": "^10.9.2"
3535
},
3636
"scripts": {
37+
"compile": "webpack",
3738
"build": "rm -rf build/ && tsc && cp index.js build/",
3839
"watch": "webpack --watch",
3940
"clean": "rm -rf out/ dist/ types/",

cli/webpack.config.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//@ts-check
2+
3+
'use strict';
4+
5+
const path = require('path');
6+
7+
//@ts-check
8+
/** @typedef {import('webpack').Configuration} WebpackConfig **/
9+
10+
/** @type WebpackConfig */
11+
const extensionConfig = {
12+
target: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
13+
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
14+
15+
entry: './src/index.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
16+
output: {
17+
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
18+
path: path.resolve(__dirname, 'dist'),
19+
filename: 'cli.js',
20+
libraryTarget: 'commonjs2'
21+
},
22+
externals: {
23+
vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
24+
// modules added here also need to be added in the .vscodeignore file
25+
},
26+
resolve: {
27+
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
28+
extensions: ['.ts', '.js']
29+
},
30+
module: {
31+
rules: [
32+
{
33+
test: /\.ts$/,
34+
exclude: /node_modules/,
35+
use: [
36+
{
37+
loader: 'ts-loader'
38+
}
39+
]
40+
}
41+
]
42+
},
43+
devtool: 'nosources-source-map',
44+
infrastructureLogging: {
45+
level: "log", // enables logging required for problem matchers
46+
},
47+
};
48+
module.exports = [ extensionConfig ];

package-lock.json

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)