Skip to content

Commit

Permalink
feat: reimplement presets to work with the new package layout
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Apr 29, 2019
1 parent fb152e6 commit 31a2d64
Show file tree
Hide file tree
Showing 10 changed files with 441 additions and 340 deletions.
7 changes: 7 additions & 0 deletions packages/workspace/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
"hidden": true
},

"preset": {
"factory": "./src/schematics/preset/preset",
"schema": "./src/schematics/preset/schema.json",
"description": "Create application in an empty workspace",
"hidden": true
},

"ng-new": {
"factory": "./src/schematics/ng-new/ng-new",
"schema": "./src/schematics/ng-new/schema.json",
Expand Down
102 changes: 1 addition & 101 deletions packages/workspace/src/schematics/ng-new/ng-new.spec.ts
Original file line number Diff line number Diff line change
@@ -1,103 +1,3 @@
describe('ng-new', () => {
it('should work', () => {});
// const schematicRunner = new SchematicTestRunner(
// '@nrwl/workspace',
// path.join(__dirname, '../../collection.json')
// );
//
// let projectTree: Tree;
//
// beforeEach(() => {
// projectTree = Tree.empty();
// });
//
// it('should create files (preset = angular)', async () => {
// const tree = await schematicRunner
// .runSchematicAsync(
// 'ng-new',
// { name: 'proj', preset: 'angular' },
// projectTree
// )
// .toPromise();
// expect(tree.exists('/proj/apps/proj/src/app/app.component.ts')).toBe(true);
//
// expect(
// JSON.parse(tree.readContent('/proj/angular.json')).schematics[
// '@nrwl/workspace:application'
// ].framework
// ).toBe(Framework.Angular);
// });
//
// it('should create files (preset = react)', async () => {
// const tree = await schematicRunner
// .runSchematicAsync(
// 'ng-new',
// { name: 'proj', preset: 'react' },
// projectTree
// )
// .toPromise();
// expect(tree.exists('/proj/apps/proj/src/main.tsx')).toBe(true);
// expect(
// JSON.parse(tree.readContent('/proj/angular.json')).schematics[
// '@nrwl/workspace:application'
// ].framework
// ).toBe(Framework.React);
// });
//
// it('should create files (preset = web-components)', async () => {
// const tree = await schematicRunner
// .runSchematicAsync(
// 'ng-new',
// { name: 'proj', preset: 'web-components' },
// projectTree
// )
// .toPromise();
// expect(tree.exists('/proj/apps/proj/src/main.ts')).toBe(true);
// expect(
// JSON.parse(tree.readContent('/proj/angular.json')).schematics[
// '@nrwl/workspace:application'
// ].framework
// ).toBe(Framework.WebComponents);
// });
//
// describe('--preset full-stack', () => {
// it('should create files', async () => {
// const tree = await schematicRunner
// .runSchematicAsync(
// 'ng-new',
// { name: 'proj', preset: 'full-stack' },
// projectTree
// )
// .toPromise();
// expect(tree.exists('/proj/apps/proj/src/app/app.component.ts')).toBe(
// true
// );
// expect(tree.exists('/proj/apps/api/src/app/app.controller.ts')).toBe(
// true
// );
// expect(
// tree.exists('/proj/libs/api-interface/src/lib/interfaces.ts')
// ).toBe(true);
// });
//
// it('should work with unnormalized names', async () => {
// const tree = await schematicRunner
// .runSchematicAsync(
// 'ng-new',
// { name: 'myProj', preset: 'full-stack' },
// projectTree
// )
// .toPromise();
//
// expect(
// tree.exists('/my-proj/apps/my-proj/src/app/app.component.ts')
// ).toBe(true);
// expect(tree.exists('/my-proj/apps/api/src/app/app.controller.ts')).toBe(
// true
// );
// expect(
// tree.exists('/my-proj/libs/api-interface/src/lib/interfaces.ts')
// ).toBe(true);
// });
// });
it('one day we will have a test here', () => {});
});
Loading

0 comments on commit 31a2d64

Please sign in to comment.