Skip to content

Commit

Permalink
migreate angular application items into core/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmarlow authored and mgmarlow committed Jan 9, 2018
1 parent c5ce2d7 commit 2ed49be
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# compiled output
/dist/
/build/
/packages/core/build/
/src/**/*.ngfactory.ts
*.ngsummary.json

Expand Down
2 changes: 2 additions & 0 deletions KUDOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@

* Thanks goes out for the awesome fuzzy search code by [Nicolás Bevacqua](https://twitter.com/nzgb)
<https://github.com/bevacqua/fuzzysearch>

* Thanks goes out for Windows/Unix path normalization from <https://github.com/sindresorhus/slash>
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[![npm version](https://badge.fury.io/js/angular-playground.svg)](https://badge.fury.io/js/angular-playground)

# Playground for Angular

A drop in entry module for your app to develop Angular components, directives and pipes
in isolation (aka Scenario Driven Development).

> For Angular version 2.x and up
> For Angular 5.x and up
Playground is designed to run within your existing application, and takes advantage of
your build system to build your components, directives and pipes.
Expand Down
1 change: 0 additions & 1 deletion examples/cli-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"check-sandboxes-plugin": "^1.1.0",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
Expand Down
30 changes: 1 addition & 29 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
const gulp = require('gulp');
const inlineNg2Template = require('gulp-inline-ng2-template');
const path = require('path');
const fs = require('fs-extra');
const glob = require('glob');
const exec = require('child_process').exec;

gulp.task('clean', () => {
return Promise.all([
fs.remove(path.join(__dirname, './dist/')),
fs.remove(path.join(__dirname, './build/')),
]);
});

gulp.task('inline', ['clean'], () => {
return gulp.src('./packages/core/**/*.ts')
.pipe(inlineNg2Template({ base: '/packages/core/src' }))
.pipe(gulp.dest('./build'));
});

gulp.task('aot', ['inline'], (cb) => {
exec('ngc -p ./tsconfig.json', (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});

gulp.task('build', ['aot']);
require('./packages/core/gulp.build')();
5 changes: 0 additions & 5 deletions index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cli/src/build-sandboxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function buildSandboxes(srcPath: string, noChunk: boolean): Promise<strin
const chunkMode = noChunk ? 'eager' : 'lazy';
const home = resolvePath(srcPath);
const sandboxes = findSandboxes(home);
const filePath = resolvePath(__dirname, '../../build/src/shared/sandboxes.js');
const filePath = resolvePath(__dirname, '../../build/shared/sandboxes.js');
const fileContent = buildSandboxFileContents(sandboxes, home, chunkMode);

// TODO: Remove next release post 3.1.0
Expand Down
37 changes: 37 additions & 0 deletions packages/core/gulp.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const gulp = require('gulp');
const inlineNg2Template = require('gulp-inline-ng2-template');
const path = require('path');
const fs = require('fs-extra');
const glob = require('glob');
const exec = require('child_process').exec;

module.exports = () => {
gulp.task('clean', () => {
return Promise.all([
fs.remove(path.join(__dirname, './dist/')),
fs.remove(path.join(__dirname, './packages/core/build/')),
]);
});

gulp.task('inline', ['clean'], () => {
return gulp.src('./packages/core/src/**/*.ts')
.pipe(inlineNg2Template({ base: '/packages/core/src' }))
.pipe(gulp.dest('./packages/core/build'));
});

gulp.task('aot', ['inline'], (cb) => {
exec('ngc -p ./packages/core/tsconfig.json', (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});

gulp.task('move', ['aot'], (cb) => {
fs.moveSync('./dist/packages/core/', './dist/');
fs.removeSync('./dist/packages/');
cb();
});

gulp.task('build', ['move']);
};
5 changes: 5 additions & 0 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './build/lib/api';
export * from './build/lib/playground';
export * from './build/playground.module';
export * from './build/playground-common.module';
export * from './build/app.component';
4 changes: 2 additions & 2 deletions packages/core/src/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ChangeDetectionStrategy, Component, ElementRef, Inject, QueryList, ViewChildren } from '@angular/core';
import { FormControl } from '@angular/forms';
import { SandboxMenuItem, SelectedSandboxAndScenarioKeys } from '../lib/app-state';
import { EventManager } from '@angular/platform-browser';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import { SandboxMenuItem, SelectedSandboxAndScenarioKeys } from './lib/app-state';
import { StateService } from './shared/state.service';
import { EventManager } from '@angular/platform-browser';
import { UrlService } from './shared/url.service';
import { fuzzySearch } from './shared/fuzzy-search.function';
import { LevenshteinDistance } from './shared/levenshtein-distance';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/core/src/scenario/scenario.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Inject
} from '@angular/core';
import { CommonModule } from '@angular/common';
import { Sandbox, Scenario, SelectedSandboxAndScenarioKeys } from '../../lib/app-state';
import { Sandbox, Scenario, SelectedSandboxAndScenarioKeys } from '../lib/app-state';
import { LoaderService } from '../shared/loader.service';

@Component({
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/loader.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { SandboxMenuItem } from '../../lib/app-state';
import { SandboxMenuItem } from '../lib/app-state';
import { getSandbox, getSandboxMenuItems } from './sandboxes';

@Injectable()
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/url.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Inject, Injectable } from '@angular/core';
import { Location } from '@angular/common';
import { SandboxMenuItem } from '../../lib/app-state';
import { SandboxMenuItem } from '../lib/app-state';
import { LoaderService } from './loader.service';

@Injectable()
Expand Down
8 changes: 1 addition & 7 deletions tsconfig.json → packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"baseUrl": "",
"sourceMap": true,
"declaration": true,
"outDir": "dist",
"outDir": "../../dist",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
Expand All @@ -18,11 +18,5 @@
},
"include": [
"index.ts"
],
"exclude": [
"node_modules",
"example-app-angular-cli",
"example-app-webpack",
"example-app-embed-mode"
]
}

0 comments on commit 2ed49be

Please sign in to comment.