From d0e75940f0f4a7a621a4f2da9361fdf4cebac97a Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 2 Feb 2017 18:38:49 +0000 Subject: [PATCH 01/16] chore: add src folder (#362) * chore: add src folder * incorporate Jesus's feedback * move tsconfig.json into src/e2e * add base href * ignore debug.log * remove unused npm script * some protractor changes * remove appSrcBase * explicitely list config for npm run serve * add update instructions * Add third party deps note to update section --- .gitignore | 8 ++-- .travis.yml | 2 +- README.md | 38 +++++++++++++----- bs-config.e2e.json | 14 +++++++ bs-config.json | 8 ++++ tsconfig.json => e2e/tsconfig.json | 0 karma-test-shim.js | 7 ++-- karma.conf.js | 15 ++++--- package.json | 26 +++++++----- protractor.config.js | 2 +- {app => src/app}/app.component.spec.ts | 0 {app => src/app}/app.component.ts | 0 {app => src/app}/app.module.ts | 0 favicon.ico => src/favicon.ico | Bin index.html => src/index.html | 3 +- {app => src}/main.ts | 2 +- styles.css => src/styles.css | 10 ++--- .../systemjs.config.extras.js | 0 systemjs.config.js => src/systemjs.config.js | 1 - src/tsconfig.json | 13 ++++++ 20 files changed, 105 insertions(+), 44 deletions(-) create mode 100644 bs-config.e2e.json create mode 100644 bs-config.json rename tsconfig.json => e2e/tsconfig.json (100%) rename {app => src/app}/app.component.spec.ts (100%) rename {app => src/app}/app.component.ts (100%) rename {app => src/app}/app.module.ts (100%) rename favicon.ico => src/favicon.ico (100%) rename index.html => src/index.html (86%) rename {app => src}/main.ts (74%) rename styles.css => src/styles.css (94%) rename systemjs.config.extras.js => src/systemjs.config.extras.js (100%) rename systemjs.config.js => src/systemjs.config.js (98%) create mode 100644 src/tsconfig.json diff --git a/.gitignore b/.gitignore index 96d71f074..a60a4dbce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ .idea node_modules jspm_packages -npm-debug.* -link-checker-results.txt -app/**/*.js +npm-debug.log +debug.log +src/**/*.js +!src/systemjs.config.extras.js +!src/systemjs.config.js *.js.map e2e/**/*.js e2e/**/*.js.map diff --git a/.travis.yml b/.travis.yml index 20ff41e7d..808bc2c4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ install: - npm install script: - npm run lint - - npm run test-once + - npm run test:once - npm run e2e diff --git a/README.md b/README.md index d86af6701..a5e4eff0c 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,24 @@ It exists primarily to get you started quickly with learning and prototyping in We are unlikely to accept suggestions about how to grow this QuickStart into something it is not. Please keep that in mind before posting issues and PRs. +## Updating to a newer version of the Quickstart Repo + +From time to time the QuickStart will add be enhanced with support for new features or to reflect +changes to the [official Style Guide](https://angular.io/docs/ts/latest/guide/style-guide.html). + +You can update your existing project to an up-to-date QuickStart by following these instructions: +- Create a new project using the [instructions below](#create-a-new-project-based-on-the-quickstart) +- Copy the code you have in your project's `main.ts` file onto `src/app/main.ts` in the new project +- Copy your old `app` folder into `src/app` +- Delete `src/app/main.ts` if you have one (we now use `src/main.ts` instead) +- Copy your old `index.html`, `styles.css` and `tsconfig.json` into `src/` +- Install all your third party dependencies +- Copy your old `e2e/` folder into `e2e/` +- Copy over any other files you added to your project +- Copy your old `.git` folder into your new project's root + +Now you can continue working on the new project. + ## Prerequisites Node.js and npm are essential to Angular development. @@ -106,16 +124,16 @@ You're ready to write your application. We've captured many of the most useful commands in npm scripts defined in the `package.json`: * `npm start` - runs the compiler and a server at the same time, both in "watch mode". -* `npm run tsc` - runs the TypeScript compiler once. -* `npm run tsc:w` - runs the TypeScript compiler in watch mode; the process keeps running, awaiting changes to TypeScript files and re-compiling when it sees them. -* `npm run lite` - runs the [lite-server](https://www.npmjs.com/package/lite-server), a light-weight, static file server, written and maintained by +* `npm run build` - runs the TypeScript compiler once. +* `npm run build:w` - runs the TypeScript compiler in watch mode; the process keeps running, awaiting changes to TypeScript files and re-compiling when it sees them. +* `npm run serve` - runs the [lite-server](https://www.npmjs.com/package/lite-server), a light-weight, static file server, written and maintained by [John Papa](https://github.com/johnpapa) and [Christopher Martin](https://github.com/cgmartin) with excellent support for Angular apps that use routing. Here are the test related scripts: * `npm test` - compiles, runs and watches the karma unit tests -* `npm run e2e` - run protractor e2e tests, written in JavaScript (*e2e-spec.js) +* `npm run e2e` - compiles and run protractor e2e tests, written in Typescript (*e2e-spec.ts) ## Testing @@ -128,9 +146,9 @@ These tools are configured for specific conventions described below. We recommend that you shut down one before starting another.* ### Unit Tests -TypeScript unit-tests are usually in the `app` folder. Their filenames must end in `.spec`. +TypeScript unit-tests are usually in the `src/app` folder. Their filenames must end in `.spec.ts`. -Look for the example `app/app.component.spec.ts`. +Look for the example `src/app/app.component.spec.ts`. Add more `.spec.ts` files as you wish; we configured karma to find them. Run it with `npm test` @@ -147,17 +165,17 @@ restart it. No worries; it's pretty quick. ### End-to-end (E2E) Tests -E2E tests are in the `e2e` directory, side by side with the `app` folder. +E2E tests are in the `e2e` directory, side by side with the `src` folder. Their filenames must end in `.e2e-spec.ts`. Look for the example `e2e/app.e2e-spec.ts`. Add more `.e2e-spec.js` files as you wish (although one usually suffices for small projects); -we configured protractor to find them. +we configured Protractor to find them. Thereafter, run them with `npm run e2e`. -That command first compiles, then simultaneously starts the Http-Server at `localhost:8080` -and launches protractor. +That command first compiles, then simultaneously starts the `lite-server` at `localhost:8080` +and launches Protractor. The pass/fail test results appear at the bottom of the terminal window. A custom reporter (see `protractor.config.js`) generates a `./_test-output/protractor-results.txt` file diff --git a/bs-config.e2e.json b/bs-config.e2e.json new file mode 100644 index 000000000..24570dbcc --- /dev/null +++ b/bs-config.e2e.json @@ -0,0 +1,14 @@ +{ + "open": false, + "logLevel": "silent", + "port": 8080, + "server": { + "baseDir": "src", + "routes": { + "/node_modules": "node_modules" + }, + "middleware": { + "0": null + } + } +} diff --git a/bs-config.json b/bs-config.json new file mode 100644 index 000000000..4e5859526 --- /dev/null +++ b/bs-config.json @@ -0,0 +1,8 @@ +{ + "server": { + "baseDir": "src", + "routes": { + "/node_modules": "node_modules" + } + } +} diff --git a/tsconfig.json b/e2e/tsconfig.json similarity index 100% rename from tsconfig.json rename to e2e/tsconfig.json diff --git a/karma-test-shim.js b/karma-test-shim.js index de5b015fd..fe5aa7761 100644 --- a/karma-test-shim.js +++ b/karma-test-shim.js @@ -7,8 +7,8 @@ Error.stackTraceLimit = 0; // "No stacktrace"" is usually best for app testing. jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; // builtPaths: root paths for output ("built") files -// get from karma.config.js, then prefix with '/base/' (default is 'app/') -var builtPaths = (__karma__.config.builtPaths || ['app/']) +// get from karma.config.js, then prefix with '/base/' (default is 'src/') +var builtPaths = (__karma__.config.builtPaths || ['src/']) .map(function(p) { return '/base/'+p;}); __karma__.loaded = function () { }; @@ -34,7 +34,8 @@ var allSpecFiles = Object.keys(window.__karma__.files) .filter(isBuiltFile); System.config({ - baseURL: 'base', + // Base URL for System.js calls. 'base/' is where Karma serves files from. + baseURL: 'base/src', // Extend usual application package list with test folder packages: { 'testing': { main: 'index.js', defaultExtension: 'js' } }, diff --git a/karma.conf.js b/karma.conf.js index e765c4eb3..5a51e814f 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,8 +1,7 @@ module.exports = function(config) { - var appBase = 'app/'; // transpiled app JS and map files - var appSrcBase = 'app/'; // app source TS files - var appAssets = '/base/app/'; // component assets fetched by Angular's compiler + var appBase = 'src/'; // transpiled app JS and map files + var appSrcBase = appBase; // app source TS files // Testing helpers (optional) are conventionally in a folder called `testing` var testingBase = 'testing/'; // transpiled test JS and map files @@ -57,8 +56,8 @@ module.exports = function(config) { { pattern: 'node_modules/@angular/**/*.js', included: false, watched: false }, { pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false }, - { pattern: 'systemjs.config.js', included: false, watched: false }, - { pattern: 'systemjs.config.extras.js', included: false, watched: false }, + { pattern: appBase + '/systemjs.config.js', included: false, watched: false }, + { pattern: appBase + '/systemjs.config.extras.js', included: false, watched: false }, 'karma-test-shim.js', // optionally extend SystemJS mapping e.g., with barrels // transpiled application & spec code paths loaded via module imports @@ -72,7 +71,7 @@ module.exports = function(config) { { pattern: appBase + '**/*.css', included: false, watched: true }, // Paths for debugging with source maps in dev tools - { pattern: appSrcBase + '**/*.ts', included: false, watched: false }, + { pattern: appBase + '**/*.ts', included: false, watched: false }, { pattern: appBase + '**/*.js.map', included: false, watched: false }, { pattern: testingSrcBase + '**/*.ts', included: false, watched: false }, { pattern: testingBase + '**/*.js.map', included: false, watched: false} @@ -80,8 +79,8 @@ module.exports = function(config) { // Proxied base paths for loading assets proxies: { - // required for component assets fetched by Angular's compiler - "/app/": appAssets + // required for modules fetched by SystemJS + '/base/src/node_modules/': '/base/node_modules/' }, exclude: [], diff --git a/package.json b/package.json index b806db2c9..ca4da28fc 100644 --- a/package.json +++ b/package.json @@ -3,15 +3,22 @@ "version": "1.0.0", "description": "QuickStart package.json from the documentation, supplemented with testing support", "scripts": { - "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ", - "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first", - "lint": "tslint ./app/**/*.ts -t verbose", - "lite": "lite-server", - "pree2e": "webdriver-manager update", - "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"", - "test-once": "tsc && karma start karma.conf.js --single-run", - "tsc": "tsc", - "tsc:w": "tsc -w" + "build": "tsc -p src/", + "build:watch": "tsc -p src/ -w", + "build:e2e": "tsc -p e2e/", + "serve": "lite-server -c=bs-config.json", + "serve:e2e": "lite-server -c=bs-config.e2e.json", + "prestart": "npm run build", + "start": "concurrently \"npm run build:watch\" \"npm run serve\"", + "pree2e": "npm run build:e2e", + "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first", + "preprotractor": "webdriver-manager update", + "protractor": "protractor protractor.config.js", + "pretest": "npm run build", + "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"", + "pretest:once": "npm run build", + "test:once": "karma start karma.conf.js --single-run", + "lint": "tslint ./src/**/*.ts -t verbose" }, "keywords": [], "author": "", @@ -38,7 +45,6 @@ "typescript": "~2.0.10", "canonical-path": "0.0.2", - "http-server": "^0.9.0", "tslint": "^3.15.1", "lodash": "^4.16.4", "jasmine-core": "~2.4.1", diff --git a/protractor.config.js b/protractor.config.js index 8314510c5..8d4e0416a 100644 --- a/protractor.config.js +++ b/protractor.config.js @@ -5,7 +5,7 @@ // // AND THEN EVERYTIME ... // 1. Compile with `tsc` -// 2. Make sure the test server (e.g., http-server: localhost:8080) is running. +// 2. Make sure the test server (e.g., lite-server: localhost:8080) is running. // 3. ./node_modules/.bin/protractor protractor.config.js // // To do all steps, try: `npm run e2e` diff --git a/app/app.component.spec.ts b/src/app/app.component.spec.ts similarity index 100% rename from app/app.component.spec.ts rename to src/app/app.component.spec.ts diff --git a/app/app.component.ts b/src/app/app.component.ts similarity index 100% rename from app/app.component.ts rename to src/app/app.component.ts diff --git a/app/app.module.ts b/src/app/app.module.ts similarity index 100% rename from app/app.module.ts rename to src/app/app.module.ts diff --git a/favicon.ico b/src/favicon.ico similarity index 100% rename from favicon.ico rename to src/favicon.ico diff --git a/index.html b/src/index.html similarity index 86% rename from index.html rename to src/index.html index 17df408e4..6d6e22326 100644 --- a/index.html +++ b/src/index.html @@ -4,6 +4,7 @@ Angular QuickStart + @@ -14,7 +15,7 @@ diff --git a/app/main.ts b/src/main.ts similarity index 74% rename from app/main.ts rename to src/main.ts index 6af7a5b2a..311c44b76 100644 --- a/app/main.ts +++ b/src/main.ts @@ -1,5 +1,5 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app.module'; +import { AppModule } from './app/app.module'; platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/styles.css b/src/styles.css similarity index 94% rename from styles.css rename to src/styles.css index c30a0620d..58e1a7d9a 100644 --- a/styles.css +++ b/src/styles.css @@ -1,5 +1,5 @@ -h1 { - color: #369; - font-family: Arial, Helvetica, sans-serif; - font-size: 250%; -} +h1 { + color: #369; + font-family: Arial, Helvetica, sans-serif; + font-size: 250%; +} diff --git a/systemjs.config.extras.js b/src/systemjs.config.extras.js similarity index 100% rename from systemjs.config.extras.js rename to src/systemjs.config.extras.js diff --git a/systemjs.config.js b/src/systemjs.config.js similarity index 98% rename from systemjs.config.js rename to src/systemjs.config.js index 68caa9f4c..e91ba9b3c 100644 --- a/systemjs.config.js +++ b/src/systemjs.config.js @@ -30,7 +30,6 @@ // packages tells the System loader how to load when no filename and/or no extension packages: { app: { - main: './main.js', defaultExtension: 'js' }, rxjs: { diff --git a/src/tsconfig.json b/src/tsconfig.json new file mode 100644 index 000000000..2c7260d1b --- /dev/null +++ b/src/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "lib": [ "es2015", "dom" ], + "noImplicitAny": true, + "suppressImplicitAnyIndexErrors": true + } +} From 816b8bd87736de0b2874502dbd38f531a281d472 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Tue, 10 Jan 2017 23:39:26 -0800 Subject: [PATCH 02/16] chore: fix OSX instructions to remove non-essential files --- README.md | 6 +++--- non-essential-files.osx.txt | 1 + non-essential-files.txt | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 non-essential-files.osx.txt diff --git a/README.md b/README.md index a5e4eff0c..afbee0226 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,9 @@ by entering the following commands while in the project folder: ##### OS/X (bash) ```shell -xargs -a non-essential-files.txt rm -rf -rm app/*.spec*.ts -rm non-essential-files.txt +xargs rm -rf < non-essential-files.osx.txt +rm src/app/*.spec*.ts +rm non-essential-files.osx.txt ``` ##### Windows diff --git a/non-essential-files.osx.txt b/non-essential-files.osx.txt new file mode 100644 index 000000000..39cb90587 --- /dev/null +++ b/non-essential-files.osx.txt @@ -0,0 +1 @@ +.git .gitignore .travis.yml CHANGELOG.md e2e favicon.ico karma.conf.js karma-test-shim.js LICENSE non-essential-files.txt protractor.config.js README.md \ No newline at end of file diff --git a/non-essential-files.txt b/non-essential-files.txt index 3c9cdde9d..867257a9c 100644 --- a/non-essential-files.txt +++ b/non-essential-files.txt @@ -9,5 +9,6 @@ karma.conf.js karma-test-shim.js LICENSE non-essential-files.txt +non-essential-files.osx.txt protractor.config.js README.md From df33a5b061df4c29ff5a4391bf7a3a80315c66eb Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Mon, 6 Feb 2017 13:46:22 -0800 Subject: [PATCH 03/16] chore: add bs-config.e2e.json to non-essential files --- non-essential-files.osx.txt | 2 +- non-essential-files.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/non-essential-files.osx.txt b/non-essential-files.osx.txt index 39cb90587..653a8db9b 100644 --- a/non-essential-files.osx.txt +++ b/non-essential-files.osx.txt @@ -1 +1 @@ -.git .gitignore .travis.yml CHANGELOG.md e2e favicon.ico karma.conf.js karma-test-shim.js LICENSE non-essential-files.txt protractor.config.js README.md \ No newline at end of file +.git .gitignore .travis.yml bs-config.e2e.json CHANGELOG.md e2e favicon.ico karma.conf.js karma-test-shim.js LICENSE non-essential-files.txt protractor.config.js README.md \ No newline at end of file diff --git a/non-essential-files.txt b/non-essential-files.txt index 867257a9c..644808a66 100644 --- a/non-essential-files.txt +++ b/non-essential-files.txt @@ -2,6 +2,7 @@ .gitignore .travis.yml *.spec*.ts +bs-config.e2e.json CHANGELOG.md e2e favicon.ico From 5dda80101a079035fabde2dde432146707c31806 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 9 Feb 2017 11:32:33 +0000 Subject: [PATCH 04/16] build(deps): update concurrently (#379) This fixes processes being left alive in gitbash. /cc @foxandxss --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ca4da28fc..85039335f 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "zone.js": "^0.7.4" }, "devDependencies": { - "concurrently": "^3.1.0", + "concurrently": "^3.2.0", "lite-server": "^2.2.2", "typescript": "~2.0.10", From 36de7ef7585d9186ffa82a886fbccbfef9125cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Rodr=C3=ADguez?= Date: Sat, 11 Feb 2017 02:18:22 +0100 Subject: [PATCH 05/16] chore: lock @types jasmine (#381) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85039335f..7353243df 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "rimraf": "^2.5.4", "@types/node": "^6.0.46", - "@types/jasmine": "^2.5.36" + "@types/jasmine": "2.5.36" }, "repository": {} } From 90d242f97f9df2bf195a8413f4a7f8458f8af254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Rodr=C3=ADguez?= Date: Mon, 27 Feb 2017 10:53:59 +0100 Subject: [PATCH 06/16] chore: add base href (#368) --- src/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.html b/src/index.html index 6d6e22326..14650c53a 100644 --- a/src/index.html +++ b/src/index.html @@ -2,6 +2,7 @@ Angular QuickStart + From 6e39693658897baa56699314de6a15d4783f8e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Pa=C5=BEin?= Date: Tue, 28 Feb 2017 13:51:24 +0100 Subject: [PATCH 07/16] Removed secondary base href=/ element (#395) --- src/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.html b/src/index.html index 14650c53a..832743558 100644 --- a/src/index.html +++ b/src/index.html @@ -5,7 +5,6 @@ - From eaf53869d0c2f4011138fc4f311abe913006a99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Rodr=C3=ADguez?= Date: Wed, 22 Mar 2017 18:01:22 +0100 Subject: [PATCH 08/16] chore: add moduleId removal loader (#410) --- .gitignore | 1 + CHANGELOG.md | 4 ++++ src/systemjs-angular-loader.js | 43 ++++++++++++++++++++++++++++++++++ src/systemjs.config.js | 9 +++++-- 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 src/systemjs-angular-loader.js diff --git a/.gitignore b/.gitignore index a60a4dbce..9b3a09fc9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ debug.log src/**/*.js !src/systemjs.config.extras.js !src/systemjs.config.js +!src/systemjs-angular-loader.js *.js.map e2e/**/*.js e2e/**/*.js.map diff --git a/CHANGELOG.md b/CHANGELOG.md index 66044b5d2..45a6965a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Upgraders: for a fresh start, consider running these commands * `git clean -xdf` * `npm install` + +# 0.3.0 (2017-03-22) +* Remove moduleId with a systemjs loader. + # 0.2.22 (2017-01-05) * Add `non-essential-files.txt` and instructions to use it to README diff --git a/src/systemjs-angular-loader.js b/src/systemjs-angular-loader.js new file mode 100644 index 000000000..1d873b70c --- /dev/null +++ b/src/systemjs-angular-loader.js @@ -0,0 +1,43 @@ +var templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*)/gm; +var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g; +var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g; + +module.exports.translate = function(load){ + + var url = new URL(load.address); + + var basePathParts = url.pathname.split('/'); + + basePathParts.pop(); + var basePath = basePathParts.join('/'); + + var baseHref = new URL(this.baseURL).pathname; + + basePath = basePath.replace(baseHref, ''); + + load.source = load.source + .replace(templateUrlRegex, function(match, quote, url){ + let resolvedUrl = url; + + if (url.startsWith('.')) { + resolvedUrl = basePath + url.substr(1); + } + + return `templateUrl: '${resolvedUrl}'`; + }) + .replace(stylesRegex, function(match, relativeUrls) { + var urls = []; + + while ((match = stringRegex.exec(relativeUrls)) !== null) { + if (match[2].startsWith('.')) { + urls.push(`'${basePath}${match[2].substr(1)}'`); + } else { + urls.push(`'${match[2]}'`); + } + } + + return "styleUrls: [" + urls.join(', ') + "]"; + }); + + return load; +}; diff --git a/src/systemjs.config.js b/src/systemjs.config.js index e91ba9b3c..129704a37 100644 --- a/src/systemjs.config.js +++ b/src/systemjs.config.js @@ -11,7 +11,7 @@ // map tells the System loader where to look for things map: { // our app is within the app folder - app: 'app', + 'app': 'app', // angular bundles '@angular/core': 'npm:@angular/core/bundles/core.umd.js', @@ -30,7 +30,12 @@ // packages tells the System loader how to load when no filename and/or no extension packages: { app: { - defaultExtension: 'js' + defaultExtension: 'js', + meta: { + './*.js': { + loader: 'systemjs-angular-loader.js' + } + } }, rxjs: { defaultExtension: 'js' From e7fd753263b92c5a9948bdc336c99cb0ebe8b8a8 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 24 Mar 2017 01:04:11 +0000 Subject: [PATCH 09/16] build: update to Angular 4 (#413) --- CHANGELOG.md | 4 ++++ package.json | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45a6965a0..ea8aceeeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Upgraders: for a fresh start, consider running these commands * `git clean -xdf` * `npm install` + +# 0.4.0 (2017-03-24) +* Update to Angular 4.0.0 + # 0.3.0 (2017-03-22) * Remove moduleId with a systemjs loader. diff --git a/package.json b/package.json index 7353243df..df18ef0e2 100644 --- a/package.json +++ b/package.json @@ -24,25 +24,25 @@ "author": "", "license": "MIT", "dependencies": { - "@angular/common": "~2.4.0", - "@angular/compiler": "~2.4.0", - "@angular/core": "~2.4.0", - "@angular/forms": "~2.4.0", - "@angular/http": "~2.4.0", - "@angular/platform-browser": "~2.4.0", - "@angular/platform-browser-dynamic": "~2.4.0", - "@angular/router": "~3.4.0", + "@angular/common": "~4.0.0", + "@angular/compiler": "~4.0.0", + "@angular/core": "~4.0.0", + "@angular/forms": "~4.0.0", + "@angular/http": "~4.0.0", + "@angular/platform-browser": "~4.0.0", + "@angular/platform-browser-dynamic": "~4.0.0", + "@angular/router": "~4.0.0", - "angular-in-memory-web-api": "~0.2.4", + "angular-in-memory-web-api": "~0.3.0", "systemjs": "0.19.40", "core-js": "^2.4.1", "rxjs": "5.0.1", - "zone.js": "^0.7.4" + "zone.js": "^0.8.4" }, "devDependencies": { "concurrently": "^3.2.0", "lite-server": "^2.2.2", - "typescript": "~2.0.10", + "typescript": "~2.1.0", "canonical-path": "0.0.2", "tslint": "^3.15.1", From 456b849692ade45c4f58fc80c65ee23c99dc9190 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Fri, 24 Mar 2017 12:31:10 -0700 Subject: [PATCH 10/16] fix(systemjs-angular-loader): replace w/ version that works in IE --- CHANGELOG.md | 4 ++++ src/systemjs-angular-loader.js | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea8aceeeb..4c991b119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Upgraders: for a fresh start, consider running these commands * `git clean -xdf` * `npm install` + +# 0.4.1 (2017-03-24) +* Replace systemjs-angular-loader with version that works for IE + # 0.4.0 (2017-03-24) * Update to Angular 4.0.0 diff --git a/src/systemjs-angular-loader.js b/src/systemjs-angular-loader.js index 1d873b70c..a0f7c5453 100644 --- a/src/systemjs-angular-loader.js +++ b/src/systemjs-angular-loader.js @@ -3,15 +3,17 @@ var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g; var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g; module.exports.translate = function(load){ - - var url = new URL(load.address); + var url = document.createElement('a'); + url.href = load.address; var basePathParts = url.pathname.split('/'); basePathParts.pop(); var basePath = basePathParts.join('/'); - var baseHref = new URL(this.baseURL).pathname; + var baseHref = document.createElement('a'); + baseHref.href = this.baseURL; + baseHref = baseHref.pathname; basePath = basePath.replace(baseHref, ''); @@ -23,16 +25,16 @@ module.exports.translate = function(load){ resolvedUrl = basePath + url.substr(1); } - return `templateUrl: '${resolvedUrl}'`; + return 'templateUrl: "' + resolvedUrl + '"'; }) .replace(stylesRegex, function(match, relativeUrls) { var urls = []; while ((match = stringRegex.exec(relativeUrls)) !== null) { if (match[2].startsWith('.')) { - urls.push(`'${basePath}${match[2].substr(1)}'`); + urls.push('"' + basePath + match[2].substr(1) + '"'); } else { - urls.push(`'${match[2]}'`); + urls.push('"' + match[2] + '"'); } } From 16232d7d513e1796654e95a61147ac5a30085a0e Mon Sep 17 00:00:00 2001 From: Mike Reid Date: Sun, 23 Apr 2017 14:48:06 -0600 Subject: [PATCH 11/16] docs(readme): fix small typo in README.md (#441) Remove word 'add' from "Updating to a newer version of the Quickstart Repo" section of GitHub README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index afbee0226..2d001a663 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Please keep that in mind before posting issues and PRs. ## Updating to a newer version of the Quickstart Repo -From time to time the QuickStart will add be enhanced with support for new features or to reflect +From time to time the QuickStart will be enhanced with support for new features or to reflect changes to the [official Style Guide](https://angular.io/docs/ts/latest/guide/style-guide.html). You can update your existing project to an up-to-date QuickStart by following these instructions: From 418dc2e1d00bf8a5148e761b7c92d8bb4449046c Mon Sep 17 00:00:00 2001 From: Niels Heeren Date: Wed, 26 Apr 2017 17:49:53 +0200 Subject: [PATCH 12/16] Fix systemjs-angular-loader.js for <=IE10 (#443) "let" is ES2015 and therefore not supported by<=IE10 --- src/systemjs-angular-loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemjs-angular-loader.js b/src/systemjs-angular-loader.js index a0f7c5453..4d3e12736 100644 --- a/src/systemjs-angular-loader.js +++ b/src/systemjs-angular-loader.js @@ -19,7 +19,7 @@ module.exports.translate = function(load){ load.source = load.source .replace(templateUrlRegex, function(match, quote, url){ - let resolvedUrl = url; + var resolvedUrl = url; if (url.startsWith('.')) { resolvedUrl = basePath + url.substr(1); From 87ad8f5769c52a623b8e7df679b3960f2aa50e63 Mon Sep 17 00:00:00 2001 From: feelingsofwhite Date: Thu, 27 Apr 2017 04:16:14 -0600 Subject: [PATCH 13/16] chore: fix systemjs-angular-loader.js for external templates (#444) (#445) --- src/systemjs-angular-loader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systemjs-angular-loader.js b/src/systemjs-angular-loader.js index 4d3e12736..8b1005444 100644 --- a/src/systemjs-angular-loader.js +++ b/src/systemjs-angular-loader.js @@ -3,6 +3,8 @@ var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g; var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g; module.exports.translate = function(load){ + if (load.source.indexOf('moduleId') != -1) return load; + var url = document.createElement('a'); url.href = load.address; @@ -15,7 +17,9 @@ module.exports.translate = function(load){ baseHref.href = this.baseURL; baseHref = baseHref.pathname; - basePath = basePath.replace(baseHref, ''); + if (!baseHref.startsWith('/base/')) { // it is not karma + basePath = basePath.replace(baseHref, ''); + } load.source = load.source .replace(templateUrlRegex, function(match, quote, url){ From 47970f99f8ffa7a96c85fcb3a54d2f210e6e27b1 Mon Sep 17 00:00:00 2001 From: Alexander Kozlov Date: Mon, 14 Aug 2017 15:25:01 +0300 Subject: [PATCH 14/16] chore: update angular version from 4.0.0 to 4.3.4 (#488) --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index df18ef0e2..25513978a 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,14 @@ "author": "", "license": "MIT", "dependencies": { - "@angular/common": "~4.0.0", - "@angular/compiler": "~4.0.0", - "@angular/core": "~4.0.0", - "@angular/forms": "~4.0.0", - "@angular/http": "~4.0.0", - "@angular/platform-browser": "~4.0.0", - "@angular/platform-browser-dynamic": "~4.0.0", - "@angular/router": "~4.0.0", + "@angular/common": "~4.3.4", + "@angular/compiler": "~4.3.4", + "@angular/core": "~4.3.4", + "@angular/forms": "~4.3.4", + "@angular/http": "~4.3.4", + "@angular/platform-browser": "~4.3.4", + "@angular/platform-browser-dynamic": "~4.3.4", + "@angular/router": "~4.3.4", "angular-in-memory-web-api": "~0.3.0", "systemjs": "0.19.40", From 8af36ec82cf92f3876a943ed5ff9e21dd463b3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Rodr=C3=ADguez?= Date: Tue, 31 Oct 2017 16:09:04 +0100 Subject: [PATCH 15/16] chore: add deprecation note to the readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 2d001a663..5497342ff 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # Angular QuickStart Source [![Build Status][travis-badge]][travis-badge-url] +**This repository is now deprecated. The Angular Quickstart project was a nice starting point for creating Angular applications. Now we recommend using the [Angular CLI](https://github.com/angular/angular-cli) to create new Angular projects.** + +**Starting from 1 November 2017, all the Angular documentation, at [angular.io](https://angular.io), is based on the Angular CLI.** + +**Let's [get started](https://angular.io/guide/quickstart)** + This repository holds the TypeScript source code of the [angular.io quickstart](https://angular.io/docs/ts/latest/quickstart.html), the foundation for most of the documentation samples and potentially a good starting point for your application. From abf848628cf02fd1899ccd7b09eb7b3ffa78aa38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Rodr=C3=ADguez?= Date: Tue, 31 Oct 2017 16:09:38 +0100 Subject: [PATCH 16/16] chore: separate deprecation not from old content --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5497342ff..aeccb7d76 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ **Let's [get started](https://angular.io/guide/quickstart)** +--- + This repository holds the TypeScript source code of the [angular.io quickstart](https://angular.io/docs/ts/latest/quickstart.html), the foundation for most of the documentation samples and potentially a good starting point for your application.