Working implementation

This commit is contained in:
Rob Larsen
2025-04-16 15:20:29 +00:00
parent 01e7f51b1d
commit b8a8f03502
17 changed files with 76 additions and 27 deletions

2
dist/index.html vendored
View File

@@ -26,7 +26,7 @@
<!-- Add your site or application content here -->
<p>Hello world! This is HTML5 Boilerplate.</p>
<script src="js/app.js"></script>
<script src="scripts/app.js"></script>
</body>

14
dist/package.json vendored
View File

@@ -14,11 +14,13 @@
"build": "webpack --config webpack.config.prod.js"
},
"devDependencies": {
"copy-webpack-plugin": "^11.0.0",
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack-merge": "^5.10.0"
"copy-webpack-plugin": "^13.0.0",
"html-webpack-plugin": "^5.6.3",
"ts-loader": "^9.5.2",
"typescript": "^5.8.3",
"webpack": "^5.99.5",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.1",
"webpack-merge": "^6.0.1"
}
}

6
dist/scripts/app.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
function foo(){
console.log("typescript");
}
foo();
function yes(){}

11
dist/tsconfig.json vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"sourceMap": true,
"module": "es6",
"target": "es6",
"allowJs": true,
"moduleResolution": "node"
}
}

View File

@@ -1,12 +1,21 @@
const path = require('path');
module.exports = {
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
devtool: 'inline-source-map',
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
entry: {
app: './js/app.js',
app: './scripts/app.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
clean: true,
filename: './js/app.js',
filename: './scripts/app.js',
},
};

View File

@@ -13,7 +13,6 @@ module.exports = merge(common, {
patterns: [
{ from: 'img', to: 'img' },
{ from: 'css', to: 'css' },
{ from: 'js/vendor', to: 'js/vendor' },
{ from: 'icon.svg', to: 'icon.svg' },
{ from: 'favicon.ico', to: 'favicon.ico' },
{ from: 'robots.txt', to: 'robots.txt' },

View File

@@ -120,7 +120,7 @@ gulp.task('copy:misc', () =>
gulp.task('lint:js', () =>
gulp
.src([`${dirs.src}/js/*.js`, `${dirs.src}/*.js`, `${dirs.test}/*.mjs`])
.src([`${dirs.src}/scripts/*.ts`,`${dirs.src}/scripts/*.js`, `${dirs.src}/*.js`, `${dirs.test}/*.mjs`])
.pipe(gulpEslint())
.pipe(gulpEslint.failOnError()),
);

9
package-lock.json generated
View File

@@ -1171,9 +1171,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001566",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001566.tgz",
"integrity": "sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA==",
"version": "1.0.30001714",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001714.tgz",
"integrity": "sha512-mtgapdwDLSSBnCI3JokHM7oEQBLxiJKVRtg10AxM1AyeiKcM96f0Mkbqeq+1AbiCtvMcHRulAAEMu693JrSWqg==",
"dev": true,
"funding": [
{
@@ -1188,7 +1188,8 @@
"type": "github",
"url": "https://github.com/sponsors/ai"
}
]
],
"license": "CC-BY-4.0"
},
"node_modules/chalk": {
"version": "2.4.2",

View File

@@ -26,7 +26,7 @@
<!-- Add your site or application content here -->
<p>Hello world! This is HTML5 Boilerplate.</p>
<script src="js/app.js"></script>
<script src="scripts/app.js"></script>
</body>

View File

View File

@@ -16,6 +16,8 @@
"devDependencies": {
"copy-webpack-plugin": "^13.0.0",
"html-webpack-plugin": "^5.6.3",
"ts-loader": "^9.5.2",
"typescript": "^5.8.3",
"webpack": "^5.99.5",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.1",

11
src/tsconfig.json Normal file
View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"sourceMap": true,
"module": "es6",
"target": "es6",
"allowJs": true,
"moduleResolution": "node"
}
}

View File

@@ -1,12 +1,21 @@
const path = require('path');
module.exports = {
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
devtool: 'inline-source-map',
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
entry: {
app: './js/app.js',
app: './scripts/app.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
clean: true,
filename: './js/app.js',
filename: './scripts/app.js',
},
};

View File

@@ -13,7 +13,6 @@ module.exports = merge(common, {
patterns: [
{ from: 'img', to: 'img' },
{ from: 'css', to: 'css' },
{ from: 'js/vendor', to: 'js/vendor' },
{ from: 'icon.svg', to: 'icon.svg' },
{ from: 'favicon.ico', to: 'favicon.ico' },
{ from: 'robots.txt', to: 'robots.txt' },