Skip to content

Commit

Permalink
fix(schemtics): restruct the folder structure to avoid releasing the …
Browse files Browse the repository at this point in the history
…shared package
  • Loading branch information
vsavkin committed Mar 13, 2018
1 parent 2842cb9 commit cc49f36
Show file tree
Hide file tree
Showing 46 changed files with 74 additions and 84 deletions.
15 changes: 2 additions & 13 deletions e2e/schematics/workspace.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import {
checkFilesExist,
cleanup,
runNgNew,
readFile,
runCLI,
runSchematic,
updateFile,
runCommand,
copyMissingPackages,
fileExists
} from '../utils';
import { angularCliSchema } from '../../packages/shared/lib-versions';
import {checkFilesExist, cleanup, copyMissingPackages, readFile, runCLI, runNgNew, updateFile} from '../utils';
import {angularCliSchema} from '../../packages/schematics/src/lib-versions';

describe('Nrwl Convert to Nx Workspace', () => {
beforeEach(cleanup);
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/src/collection/app/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '../../../../shared/testing-utils';
import { createEmptyWorkspace } from '../../../../schematics/src/utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import * as stripJsonComments from 'strip-json-comments';

Expand Down
10 changes: 5 additions & 5 deletions packages/bazel/src/collection/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import {
} from '@angular-devkit/schematics';
import { Schema } from './schema';
import {strings} from '@angular-devkit/core';
import { addImportToModule, insert, toFileName } from '@nrwl/schematics';
import { addImportToModule, insert, addImportToTestBed } from '@nrwl/schematics/src/utils/ast-utils';
import { toFileName } from '@nrwl/schematics/src/utils/name-utils';
import * as ts from 'typescript';
import { addBootstrapToModule } from '@schematics/angular/utility/ast-utils';
import { insertImport } from '@schematics/angular/utility/route-utils';
import { addApp, serializeJson, cliConfig, readCliConfigFile } from '../../../../shared/fileutils';
import { addImportToTestBed } from '../../../../shared/ast-utils';
import { offsetFromRoot } from '../../../../shared/common';
import {FormatFiles, wrapIntoFormat} from '../../../../shared/tasks';
import { addApp, serializeJson, cliConfig, readCliConfigFile } from '@nrwl/schematics/src/utils/fileutils';
import { offsetFromRoot } from '@nrwl/schematics/src/utils/common';
import {FormatFiles, wrapIntoFormat} from '@nrwl/schematics/src/utils/tasks';

interface NormalizedSchema extends Schema {
fullName: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/src/collection/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import {Schema} from './schema';
import {strings} from '@angular-devkit/core';
import {NodePackageInstallTask, RepositoryInitializerTask} from '@angular-devkit/schematics/tasks';
import {libVersions} from '../../../../shared/lib-versions';
import {libVersions} from '@nrwl/schematics/src/lib-versions';

export default function(options: Schema): Rule {
return (host: Tree, context: SchematicContext) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/schematics/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
export { addImportToModule, addProviderToModule, insert } from '../shared/ast-utils';
export { names, toClassName, toFileName, toPropertyName } from '../shared/name-utils';
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20171129-change-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Update the schema file to point to the nrwl schema.',
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20171202-change-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Update the schema file to reflect the `allow` option for `nx-enforce-module-boundaries`.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Remove npmScope from tslint.json',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cliConfig, readCliConfigFile, updateJsonFile } from '../../shared/fileutils';
import { cliConfig, readCliConfigFile, updateJsonFile } from '../src/utils/fileutils';
import { writeFileSync, unlinkSync } from 'fs';
import { offsetFromRoot } from '../../shared/common';
import { offsetFromRoot } from '../src/utils/common';
import * as path from 'path';

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Update tsconfig.spec.json to exclude e2e specs',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Update package.json to include apps:affected, build:affected, e2e:affected',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Add format:write and format:check to npm scripts',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Update npm scripts to use the nx command',
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20180120-update-prettier.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Update the version of prettier',
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20180121-update-angular.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { copyFile, updateJsonFile } from '../../shared/fileutils';
import { copyFile, updateJsonFile } from '../src/utils/fileutils';
import * as path from 'path';

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { updateJsonFile } from '../../shared/fileutils';
import { devKitCoreVersion } from '../../shared/lib-versions';
import { updateJsonFile } from '../src/utils/fileutils';
import { devKitCoreVersion } from '../src/lib-versions';

export default {
description: 'Add @angular-devkit/core as a dev dependency',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Add nx-migrate:check and nx-migrate:skip to npm scripts',
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20180130-add-postinstall.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';

export default {
description: 'Add postinstall script to run nx-migrate:check',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';
import {
devKitCoreVersion,
devKitSchematicsVersion,
schematicsAngularVersion
} from '../../shared/lib-versions';
} from '../src/lib-versions';

export default {
description: 'Add @angular-devkit/schematics as a dev dependency',
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20180225-switch-to-cli17.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateJsonFile } from '../../shared/fileutils';
import { updateJsonFile } from '../src/utils/fileutils';
import { unlinkSync } from 'fs';

export default {
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20180227-cleanup-scripts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {updateJsonFile} from '../../shared/fileutils';
import {updateJsonFile} from '../src/utils/fileutils';

export default {
description: 'Add update, update:skip, update:check scripts',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { writeFileSync, readFileSync, readdirSync, unlinkSync } from 'fs';
import { join } from 'path';

import { updateJsonFile } from '../../shared/fileutils';
import { ExistingPrettierConfig, resolveUserExistingPrettierConfig } from '../../shared/common';
import { updateJsonFile } from '../src/utils/fileutils';
import { ExistingPrettierConfig, resolveUserExistingPrettierConfig } from '../src/utils/common';

export default {
description: 'Create or update prettier configuration',
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/migrations/20180313-add-tags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {updateJsonFile} from '../../shared/fileutils';
import {updateJsonFile} from '../src/utils/fileutils';

export default {
description: 'Add tags to all app and libs',
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/src/collection/app/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '../../../../shared/testing-utils';
import { createEmptyWorkspace } from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import * as stripJsonComments from 'strip-json-comments';

Expand Down
10 changes: 5 additions & 5 deletions packages/schematics/src/collection/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import {
} from '@angular-devkit/schematics';
import { Schema } from './schema';
import {strings} from '@angular-devkit/core';
import { addImportToModule, insert, toFileName } from '@nrwl/schematics';
import * as ts from 'typescript';
import { addBootstrapToModule } from '@schematics/angular/utility/ast-utils';
import { insertImport } from '@schematics/angular/utility/route-utils';
import { addApp, serializeJson, cliConfig, readCliConfigFile } from '../../../../shared/fileutils';
import { addImportToTestBed } from '../../../../shared/ast-utils';
import { offsetFromRoot } from '../../../../shared/common';
import {FormatFiles, wrapIntoFormat} from '../../../../shared/tasks';
import { addApp, serializeJson, cliConfig, readCliConfigFile } from '../../utils/fileutils';
import {addImportToModule, addImportToTestBed, insert} from '../../utils/ast-utils';
import { offsetFromRoot } from '../../utils/common';
import { wrapIntoFormat} from '../../utils/tasks';
import {toFileName} from '../../utils/name-utils';

interface NormalizedSchema extends Schema {
fullName: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createEmptyWorkspace } from '../../../../shared/testing-utils';
import { createEmptyWorkspace } from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';

describe('application', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/schematics/src/collection/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
import {Schema} from './schema';
import {strings} from '@angular-devkit/core';
import {NodePackageInstallTask, RepositoryInitializerTask} from '@angular-devkit/schematics/tasks';
import {libVersions} from '../../../../shared/lib-versions';
import { DEFAULT_NRWL_PRETTIER_CONFIG } from '../../../../shared/common';
import {libVersions} from '../../lib-versions';
import { DEFAULT_NRWL_PRETTIER_CONFIG } from '../../utils/common';

export default function(options: Schema): Rule {
return (host: Tree, context: SchematicContext) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createApp, createEmptyWorkspace } from '../../../../shared/testing-utils';
import { createApp, createEmptyWorkspace } from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';

describe('downgrade-module', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/schematics/src/collection/downgrade-module/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {chain, noop, Rule, Tree} from '@angular-devkit/schematics';
import {addEntryComponents, addMethod, insert, readBootstrapInfo, removeFromNgModule} from '../../../../shared/ast-utils';
import {addEntryComponents, addMethod, insert, readBootstrapInfo, removeFromNgModule} from '../../utils/ast-utils';
import {Schema} from './schema';
import {addUpgradeToPackageJson} from '../../../../shared/common';
import {wrapIntoFormat} from '../../../../shared/tasks';
import {addUpgradeToPackageJson} from '../../utils/common';
import {wrapIntoFormat} from '../../utils/tasks';

function updateMain(angularJsImport: string, options: Schema): Rule {
return (host: Tree) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/schematics/src/collection/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {apply, branchAndMerge, chain, mergeWith, noop, Rule, template, Tree, url} from '@angular-devkit/schematics';
import {Schema} from './schema';
import {addImportToModule, insert, names, toClassName, toFileName, toPropertyName} from '@nrwl/schematics';
import * as path from 'path';
import {addApp, cliConfig, serializeJson} from '../../../../shared/fileutils';
import {addApp, cliConfig, serializeJson} from '../../utils/fileutils';
import {insertImport} from '@schematics/angular/utility/route-utils';
import * as ts from 'typescript';
import {addGlobal, addIncludeToTsConfig, addReexport, addRoute} from '../../../../shared/ast-utils';
import {offsetFromRoot} from '../../../../shared/common';
import {wrapIntoFormat} from '../../../../shared/tasks';
import {addGlobal, addImportToModule, addIncludeToTsConfig, addReexport, addRoute, insert} from '../../utils/ast-utils';
import {offsetFromRoot} from '../../utils/common';
import {wrapIntoFormat} from '../../utils/tasks';
import {names, toClassName, toFileName, toPropertyName} from '../../utils/name-utils';

interface NormalizedSchema extends Schema {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/src/collection/lib/lib.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createApp, createEmptyWorkspace } from '../../../../shared/testing-utils';
import { createApp, createEmptyWorkspace } from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';
import * as stripJsonComments from 'strip-json-comments';

Expand Down
10 changes: 5 additions & 5 deletions packages/schematics/src/collection/ngrx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import {
url
} from '@angular-devkit/schematics';

import {names, toClassName, toFileName, toPropertyName} from '../../../../shared/name-utils';
import {names, toClassName, toFileName, toPropertyName} from '../../utils/name-utils';
import * as path from 'path';
import * as ts from 'typescript';
import {addImportToModule, addProviderToModule, insert} from '../../../../shared/ast-utils';
import {addImportToModule, addProviderToModule, insert} from '../../utils/ast-utils';
import {insertImport} from '@schematics/angular/utility/route-utils';
import {Schema} from './schema';
import {ngrxVersion, routerStoreVersion, ngrxStoreFreezeVersion} from '../../../../shared/lib-versions';
import {serializeJson} from '../../../../shared/fileutils';
import {wrapIntoFormat} from '../../../../shared/tasks';
import {ngrxVersion, routerStoreVersion, ngrxStoreFreezeVersion} from '../../lib-versions';
import {serializeJson} from '../../utils/fileutils';
import {wrapIntoFormat} from '../../utils/tasks';

function addImportsToModule(name: string, options: Schema): Rule {
return (host: Tree) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/src/collection/ngrx/ngrx.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createApp, createEmptyWorkspace } from '../../../../shared/testing-utils';
import { createApp, createEmptyWorkspace } from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';

describe('ngrx', () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/schematics/src/collection/upgrade-module/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
url
} from '@angular-devkit/schematics';

import { names, toClassName, toFileName, toPropertyName } from '../../../../shared/name-utils';
import { names, toClassName, toFileName, toPropertyName } from '../../utils/name-utils';
import * as path from 'path';
import * as ts from 'typescript';
import {
Expand All @@ -26,12 +26,12 @@ import {
insert,
readBootstrapInfo,
removeFromNgModule
} from '../../../../shared/ast-utils';
} from '../../utils/ast-utils';
import { insertImport } from '@schematics/angular/utility/route-utils';
import { Schema } from './schema';
import { angularJsVersion } from '../../../../shared/lib-versions';
import { addUpgradeToPackageJson } from '../../../../shared/common';
import {wrapIntoFormat} from '../../../../shared/tasks';
import { angularJsVersion } from '../../lib-versions';
import { addUpgradeToPackageJson } from '../../utils/common';
import {wrapIntoFormat} from '../../utils/tasks';

function addImportsToModule(options: Schema): Rule {
return (host: Tree) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree, VirtualTree } from '@angular-devkit/schematics';
import { createApp, createEmptyWorkspace } from '../../../../shared/testing-utils';
import { createApp, createEmptyWorkspace } from '../../utils/testing-utils';
import { getFileContent } from '@schematics/angular/utility/test';

describe('upgrade-module', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/schematics/src/collection/workspace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
ngrxStoreFreezeVersion,
nxVersion,
prettierVersion, routerStoreVersion, schematicsVersion,
} from '../../../../shared/lib-versions';
} from '../../lib-versions';
import * as fs from 'fs';
import { copyFile, serializeJson, updateJsonFile } from '../../../../shared/fileutils';
import { toFileName } from '@nrwl/schematics';
import { resolveUserExistingPrettierConfig, DEFAULT_NRWL_PRETTIER_CONFIG } from '../../../../shared/common';
import { copyFile, serializeJson, updateJsonFile } from '../../utils/fileutils';
import { resolveUserExistingPrettierConfig, DEFAULT_NRWL_PRETTIER_CONFIG } from '../../utils/common';
import { Observable } from 'rxjs/Observable';
import { fromPromise } from 'rxjs/observable/fromPromise'
import { tap, map } from 'rxjs/operators';
import {toFileName} from '../../utils/name-utils';

function updatePackageJson() {
return (host: Tree) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const routerStoreVersion = '5.0.1';
export const nxVersion = '*';
export const schematicsVersion = '*';
export const angularCliSchema = './node_modules/@nrwl/schematics/src/schema.json';
export const latestMigration = '20180227-cleanup-scripts';
export const latestMigration = '20180313-add-tags';
export const prettierVersion = '1.10.2';
export const typescriptVersion = '2.6.2';
export const rxjsVersion = '^5.5.6';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { readdirSync, readFileSync } from 'fs';
import { Options } from 'prettier';
import * as cosmiconfig from 'cosmiconfig';

import { angularJsVersion } from './lib-versions';
import { angularJsVersion } from '../lib-versions';
import { serializeJson } from './fileutils';
import { Schema } from '../schematics/src/collection/app/schema';
import { Schema } from '../collection/app/schema';

export function addUpgradeToPackageJson(): Rule {
return (host: Tree) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ NX_VERSION=$2
./scripts/build.sh

cd build/packages
sed -i "" "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" schematics/src/collection/utility/lib-versions.js
sed -i "" "s|exports.schematicsVersion = '\*';|exports.schematicsVersion = '$SCHEMATICS_VERSION';|g" schematics/src/collection/utility/lib-versions.js
sed -i "" "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" schematics/src/lib-versions.js
sed -i "" "s|exports.schematicsVersion = '\*';|exports.schematicsVersion = '$SCHEMATICS_VERSION';|g" schematics/src/lib-versions.js


tar -czf nx.tgz nx
Expand Down
Loading

0 comments on commit cc49f36

Please sign in to comment.