mirror of
https://github.com/tomasvarg/systemjs-typescript-minimal.git
synced 2026-03-01 00:08:53 +00:00
Initial commit - the working setup
This commit is contained in:
commit
4d2922b5a3
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
||||
12
README.md
Normal file
12
README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# SystemJS minimal TypeScript setup
|
||||
|
||||
A minimal SystemJS module loader setup with TypeScript support.
|
||||
|
||||
## Usage
|
||||
|
||||
Just install dependencies & point a webserver to (or run it in) the project's root.
|
||||
|
||||
```
|
||||
npm install
|
||||
http-server
|
||||
```
|
||||
15
index.html
Normal file
15
index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>SystemJS Typescript Sample</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="whatever-app"></div>
|
||||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
<script src="system.config.js"></script>
|
||||
<script>
|
||||
System.import('src/main.ts');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
36
package-lock.json
generated
Normal file
36
package-lock.json
generated
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "systemjs-typescript-minimal",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/whatwg-fetch": {
|
||||
"version": "0.0.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/whatwg-fetch/-/whatwg-fetch-0.0.33.tgz",
|
||||
"integrity": "sha1-GcDShjyMsjgPIaHHNrecv3iVuxM=",
|
||||
"requires": {
|
||||
"@types/whatwg-streams": "0.0.4"
|
||||
}
|
||||
},
|
||||
"@types/whatwg-streams": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/whatwg-streams/-/whatwg-streams-0.0.4.tgz",
|
||||
"integrity": "sha512-dM5YQytWb1EunntizWnsAsADJxbXhHQyPoRxXlfEMPULcnbgzB02qZ8KI/K5yFItulzoidxWbX4OO/w4FN92Sg=="
|
||||
},
|
||||
"plugin-typescript": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/plugin-typescript/-/plugin-typescript-7.1.0.tgz",
|
||||
"integrity": "sha1-XZLTrmACFJaUja0fko1KOvCYxnU="
|
||||
},
|
||||
"systemjs": {
|
||||
"version": "0.20.19",
|
||||
"resolved": "https://registry.npmjs.org/systemjs/-/systemjs-0.20.19.tgz",
|
||||
"integrity": "sha512-H/rKwNEEyej/+IhkmFNmKFyJul8tbH/muiPq5TyNoVTwsGhUjRsN3NlFnFQUvFXA3+GQmsXkCNXU6QKPl779aw=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz",
|
||||
"integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w=="
|
||||
}
|
||||
}
|
||||
}
|
||||
23
package.json
Normal file
23
package.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "systemjs-typescript-minimal",
|
||||
"version": "0.0.1",
|
||||
"description": "A minimal SystemJS module loader setup with TypeScript support",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"systemjs",
|
||||
"typescript",
|
||||
"starter",
|
||||
"sample"
|
||||
],
|
||||
"author": "Tomas Varga <tomas.varga.cz@gmail.com>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@types/whatwg-fetch": "0.0.33",
|
||||
"plugin-typescript": "^7.1.0",
|
||||
"systemjs": "^0.20.19",
|
||||
"typescript": "^2.5.3"
|
||||
}
|
||||
}
|
||||
11
src/main.ts
Normal file
11
src/main.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { showMessage } from './utils';
|
||||
|
||||
console.log('Hello from es5!');
|
||||
setTimeout(() => {
|
||||
init('Hello from Typescript!');
|
||||
});
|
||||
|
||||
function init(note: string): void {
|
||||
console.log(note);
|
||||
showMessage(note, '#whatever-app');
|
||||
}
|
||||
4
src/utils.ts
Normal file
4
src/utils.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const showMessage = (message: string, elemSelector: string): void => {
|
||||
var elem = document.querySelector(elemSelector);
|
||||
if (elem) elem.innerHTML = message;
|
||||
};
|
||||
29
system.config.js
Normal file
29
system.config.js
Normal file
@ -0,0 +1,29 @@
|
||||
/* global SystemJS */
|
||||
|
||||
SystemJS.config({
|
||||
transpiler: 'ts',
|
||||
typescriptOptions: {
|
||||
tsconfig: true
|
||||
},
|
||||
packages: {
|
||||
ts: {
|
||||
main: 'lib/plugin.js'
|
||||
},
|
||||
typescript: {
|
||||
main: 'lib/typescript.js',
|
||||
meta: {
|
||||
'lib/typescript.js': {
|
||||
'exports': 'ts'
|
||||
}
|
||||
}
|
||||
},
|
||||
src: {
|
||||
defaultExtension: 'ts',
|
||||
format: 'esm'
|
||||
}
|
||||
},
|
||||
map: {
|
||||
ts: 'node_modules/plugin-typescript',
|
||||
typescript: 'node_modules/typescript'
|
||||
},
|
||||
});
|
||||
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "system",
|
||||
"noImplicitAny": false,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": false,
|
||||
"typeRoots": "typings",
|
||||
"types": [ "whatwg-fetch" ],
|
||||
"lib": ["dom", "es5", "es2015.promise"]
|
||||
}
|
||||
}
|
||||
148
tslint.json
Normal file
148
tslint.json
Normal file
@ -0,0 +1,148 @@
|
||||
{
|
||||
"rules": {
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"multiline": "always",
|
||||
"singleline": "never"
|
||||
}
|
||||
],
|
||||
"arrow-return-shorthand": true,
|
||||
"callable-types": true,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
false,
|
||||
"check-space"
|
||||
],
|
||||
"curly": [
|
||||
true,
|
||||
"ignore-same-line"
|
||||
],
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-over-type-literal": true,
|
||||
"label-position": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-super": true,
|
||||
"no-empty": false,
|
||||
"no-empty-interface": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-misused-new": true,
|
||||
"no-non-null-assertion": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unnecessary-initializer": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-whitespace"
|
||||
],
|
||||
"prefer-const": true,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"typeof-compare": true,
|
||||
"unified-signatures": true,
|
||||
"variable-name": false,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"app",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
["app", "mup"],
|
||||
"kebab-case"
|
||||
],
|
||||
"use-input-property-decorator": true,
|
||||
"use-output-property-decorator": true,
|
||||
"use-host-property-decorator": true,
|
||||
"no-input-rename": true,
|
||||
"no-output-rename": true,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"component-class-suffix": true,
|
||||
"directive-class-suffix": true,
|
||||
"no-access-missing-member": true,
|
||||
"templates-use-public": true,
|
||||
"invoke-injectable": true
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user