added ts folders, fiddling with vue

This commit is contained in:
andy 2021-07-16 12:46:24 +01:00
commit b7c33c51d6
17 changed files with 6763 additions and 0 deletions

105
.gitignore vendored Normal file
View File

@ -0,0 +1,105 @@
#---------------------------------------#
# Project Ignores #
#---------------------------------------#
# output
.temp
.tmp
build
dist
# dependencies
node_modules
.package.swp
# linters
.eslintcache/
.eslintrc
.eslintrc.yaml
.eslintrc.json
.eslintrc.js
.stylelintcache/
.stylelintrc
.stylelintrc.yaml
.stylelintrc.json
.stylelintrc.js
# misc
connect.lock
coverage/*
report_*
reports/
.sass-cache/
*.log
#---------------------------------------#
# IDEs & Editors Ignores #
#---------------------------------------#
# Sublime Text
/*.sublime*
.sublime-gulp.cache
# JetBrains IDEs
/.idea
#---------------------------------------#
# General Ignores #
#---------------------------------------#
*~
*.orig
.vagrant
#---------------------------------------#
# Linux Ignores #
#---------------------------------------#
# KDE directory preferences
.directory
#---------------------------------------#
# OSX Ignores #
#---------------------------------------#
.DS_Store
.AppleDouble
.LSOverride
.localized
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
#---------------------------------------#
# Windows Ignores #
#---------------------------------------#
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/

10
ts-webpack/greeter.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>TypeScript Greeter</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>

24
ts-webpack/index.ts Normal file
View File

@ -0,0 +1,24 @@
class Student {
fullName: string;
constructor(
public firstName: string,
public middleInitial: string,
public lastName: string
) {
this.fullName = firstName + " " + middleInitial + " " + lastName;
}
}
interface Person {
firstName: string;
lastName: string;
}
function greeter(person: Person) {
return "Hello, " + person.firstName + " " + person.lastName;
}
// let user = new Student("Jane", "M.", "User");
let user = new Student("Jane", "M.", "User");
document.body.textContent = greeter(user);

2798
ts-webpack/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

17
ts-webpack/package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "ts-webpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.config.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"ts-loader": "^9.2.3",
"typescript": "^4.3.5",
"webpack-cli": "^4.7.2"
}
}

13
ts-webpack/tsconfig.json Normal file
View File

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

View File

@ -0,0 +1,23 @@
const path = require('path');
module.exports = {
entry: './index.ts',
devtool: 'inline-source-map',
mode: 'development',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
}
]
},
resolve: {
extensions: [".js", '.tsx', '.ts']
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
}
};

10
typescript/greeter.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>TypeScript Greeter</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>

24
typescript/index.ts Normal file
View File

@ -0,0 +1,24 @@
class Student {
fullName: string;
constructor(
public firstName: string,
public middleInitial: string,
public lastName: string
) {
this.fullName = firstName + " " + middleInitial + " " + lastName;
}
}
interface Person {
firstName: string;
lastName: string;
}
function greeter(person: Person) {
return "Hello, " + person.firstName + " " + person.lastName;
}
// let user = new Student("Jane", "M.", "User");
let user = new Student("Jane", "M.", "User");
document.body.textContent = greeter(user);

36
typescript/package-lock.json generated Normal file
View File

@ -0,0 +1,36 @@
{
"name": "typescript",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "1.0.0",
"license": "ISC",
"devDependencies": {
"typescript": "^4.3.5"
}
},
"node_modules/typescript": {
"version": "4.3.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
"integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
}
},
"dependencies": {
"typescript": {
"version": "4.3.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
"integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
"dev": true
}
}
}

14
typescript/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "typescript",
"version": "1.0.0",
"description": "Practising typescript",
"main": "index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"typescript": "^4.3.5"
}
}

17
vue/index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Vue Test</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
</head>
<body>
<div id="counter">
<!-- <p>Counter: {{ count }}></p> -->
<!-- <button v-on:click="showMessage">Show!</button> -->
</div>
<script src='bundle.js'></script>
</body>
</html>

24
vue/index.js Normal file
View File

@ -0,0 +1,24 @@
import Vue from "vue";
// const Counter = {
// data() {
// return {
// count: 0
// }
// },
// methods: {
// showMessage() {
// console.log("Hello World!");
// }
// }
// }
// Vue.createApp(Counter).mount('#counter');
var app = new Vue({
el: '#counter',
// data: {
// count: 'Hello World!'
// }
});

3601
vue/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
vue/package.json Normal file
View File

@ -0,0 +1,21 @@
{
"name": "vue",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.config.js && cp index.html dist/"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-loader": "^8.2.2",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.44.0",
"webpack-cli": "^4.7.2"
},
"dependencies": {
"vue": "^2.6.14"
}
}

3
vue/vue.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
runtimeCompiler: true
}

23
vue/webpack.config.js Normal file
View File

@ -0,0 +1,23 @@
const path = require('path');
module.exports = {
entry: './index.js',
devtool: 'inline-source-map',
mode: 'development',
module: {
rules: [
{
test: /\.jsx?$/,
use: 'babel-loader',
exclude: /node_modules/,
}
]
},
resolve: {
extensions: [".js"]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
}
};