Skip to content

Commit b8a8f03

Browse files
committed
Working implementation
1 parent 01e7f51 commit b8a8f03

17 files changed

+76
-27
lines changed

dist/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<!-- Add your site or application content here -->
2828
<p>Hello world! This is HTML5 Boilerplate.</p>
29-
<script src="js/app.js"></script>
29+
<script src="scripts/app.js"></script>
3030

3131
</body>
3232

dist/package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
"build": "webpack --config webpack.config.prod.js"
1515
},
1616
"devDependencies": {
17-
"copy-webpack-plugin": "^11.0.0",
18-
"html-webpack-plugin": "^5.6.0",
19-
"webpack": "^5.91.0",
20-
"webpack-cli": "^5.1.4",
21-
"webpack-dev-server": "^5.0.4",
22-
"webpack-merge": "^5.10.0"
17+
"copy-webpack-plugin": "^13.0.0",
18+
"html-webpack-plugin": "^5.6.3",
19+
"ts-loader": "^9.5.2",
20+
"typescript": "^5.8.3",
21+
"webpack": "^5.99.5",
22+
"webpack-cli": "^6.0.1",
23+
"webpack-dev-server": "^5.2.1",
24+
"webpack-merge": "^6.0.1"
2325
}
2426
}
File renamed without changes.

dist/scripts/app.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function foo(){
2+
console.log("typescript");
3+
}
4+
foo();
5+
6+
function yes(){}

dist/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "./dist/",
4+
"noImplicitAny": true,
5+
"sourceMap": true,
6+
"module": "es6",
7+
"target": "es6",
8+
"allowJs": true,
9+
"moduleResolution": "node"
10+
}
11+
}

dist/webpack.common.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
const path = require('path');
2-
31
module.exports = {
2+
module: {
3+
rules: [
4+
{
5+
test: /\.tsx?$/,
6+
use: 'ts-loader',
7+
exclude: /node_modules/,
8+
},
9+
],
10+
},
11+
devtool: 'inline-source-map',
12+
resolve: {
13+
extensions: ['.tsx', '.ts', '.js'],
14+
},
415
entry: {
5-
app: './js/app.js',
16+
app: './scripts/app.ts',
617
},
718
output: {
8-
path: path.resolve(__dirname, 'dist'),
9-
clean: true,
10-
filename: './js/app.js',
19+
filename: './scripts/app.js',
1120
},
1221
};

dist/webpack.config.prod.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module.exports = merge(common, {
1313
patterns: [
1414
{ from: 'img', to: 'img' },
1515
{ from: 'css', to: 'css' },
16-
{ from: 'js/vendor', to: 'js/vendor' },
1716
{ from: 'icon.svg', to: 'icon.svg' },
1817
{ from: 'favicon.ico', to: 'favicon.ico' },
1918
{ from: 'robots.txt', to: 'robots.txt' },

gulpfile.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ gulp.task('copy:misc', () =>
120120

121121
gulp.task('lint:js', () =>
122122
gulp
123-
.src([`${dirs.src}/js/*.js`, `${dirs.src}/*.js`, `${dirs.test}/*.mjs`])
123+
.src([`${dirs.src}/scripts/*.ts`,`${dirs.src}/scripts/*.js`, `${dirs.src}/*.js`, `${dirs.test}/*.mjs`])
124124
.pipe(gulpEslint())
125125
.pipe(gulpEslint.failOnError()),
126126
);

package-lock.json

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<!-- Add your site or application content here -->
2828
<p>Hello world! This is HTML5 Boilerplate.</p>
29-
<script src="js/app.js"></script>
29+
<script src="scripts/app.js"></script>
3030

3131
</body>
3232

src/js/vendor/.gitkeep

Whitespace-only changes.

src/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"devDependencies": {
1717
"copy-webpack-plugin": "^13.0.0",
1818
"html-webpack-plugin": "^5.6.3",
19+
"ts-loader": "^9.5.2",
20+
"typescript": "^5.8.3",
1921
"webpack": "^5.99.5",
2022
"webpack-cli": "^6.0.1",
2123
"webpack-dev-server": "^5.2.1",
File renamed without changes.
File renamed without changes.

src/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "./dist/",
4+
"noImplicitAny": true,
5+
"sourceMap": true,
6+
"module": "es6",
7+
"target": "es6",
8+
"allowJs": true,
9+
"moduleResolution": "node"
10+
}
11+
}

src/webpack.common.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
const path = require('path');
2-
31
module.exports = {
2+
module: {
3+
rules: [
4+
{
5+
test: /\.tsx?$/,
6+
use: 'ts-loader',
7+
exclude: /node_modules/,
8+
},
9+
],
10+
},
11+
devtool: 'inline-source-map',
12+
resolve: {
13+
extensions: ['.tsx', '.ts', '.js'],
14+
},
415
entry: {
5-
app: './js/app.js',
16+
app: './scripts/app.ts',
617
},
718
output: {
8-
path: path.resolve(__dirname, 'dist'),
9-
clean: true,
10-
filename: './js/app.js',
19+
filename: './scripts/app.js',
1120
},
1221
};

src/webpack.config.prod.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module.exports = merge(common, {
1313
patterns: [
1414
{ from: 'img', to: 'img' },
1515
{ from: 'css', to: 'css' },
16-
{ from: 'js/vendor', to: 'js/vendor' },
1716
{ from: 'icon.svg', to: 'icon.svg' },
1817
{ from: 'favicon.ico', to: 'favicon.ico' },
1918
{ from: 'robots.txt', to: 'robots.txt' },

0 commit comments

Comments
 (0)