Combine link and link-spec scripts

This commit is contained in:
mrmeku 2018-03-17 16:23:17 -07:00 committed by Victor Savkin
parent 4184bb2d13
commit 6a21906fdd
11 changed files with 65 additions and 74 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ node_modules
.vscode
dist
build
test
.DS_Store
tmp
yarn-error

View File

@ -1,15 +1,15 @@
module.exports = function(config) {
const webpackConfig = {
"node": {
"fs": "empty",
"global": true,
"crypto": "empty",
"tls": "empty",
"net": "empty",
"process": true,
"module": false,
"clearImmediate": false,
"setImmediate": false
node: {
fs: 'empty',
global: true,
crypto: 'empty',
tls: 'empty',
net: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
};
config.set({
@ -20,9 +20,7 @@ module.exports = function(config) {
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
{ pattern: 'build/test.js', watched: false}
],
files: [{ pattern: 'test/test.js', watched: false }],
// list of files to exclude
exclude: [],
@ -30,7 +28,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'build/test.js': ['webpack']
'test/test.js': ['webpack']
},
reporters: ['dots'],
@ -54,7 +52,7 @@ module.exports = function(config) {
colors: true,
// level of logging
logLevel:config.LOG_INFO,
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
@ -66,7 +64,7 @@ module.exports = function(config) {
}
},
browsers: process.env.TRAVIS ? ['Chrome_travis_ci'] : ['Chrome'],
browsers: process.env.TRAVIS ? ['Chrome_travis_ci'] : ['Chrome'],
// Concurrency level
// how many browser should be started simultaneous

View File

@ -13,9 +13,9 @@
"release": "./scripts/release.sh",
"copy": "./scripts/copy.sh",
"test:schematics": "yarn linknpm && ./scripts/test_schematics.sh",
"test:nx": "./scripts/link-spec.sh && ./scripts/test_nx.sh",
"test:nx": "yarn linknpm && ./scripts/test_nx.sh",
"test":
"./scripts/link-spec.sh && ./scripts/test_nx.sh && ./scripts/test_schematics.sh",
"yarn linknpm && ./scripts/test_nx.sh && ./scripts/test_schematics.sh",
"checkformat": "echo 1",
"publish_npm": "./scripts/publish.sh",
"precommit": "yarn checkformat"

View File

@ -44,7 +44,6 @@ function addBootstrap(path: string): Rule {
const modulePath = `${path}/app/app.module.ts`;
const moduleSource = host.read(modulePath)!.toString('utf-8');
const sourceFile = ts.createSourceFile(
<<<<<<< HEAD
modulePath,
moduleSource,
ts.ScriptTarget.Latest,
@ -64,15 +63,6 @@ function addBootstrap(path: string): Rule {
'AppComponent',
'./app.component'
)
=======
modulePath, moduleSource, ts.ScriptTarget.Latest, true);
insert(host, modulePath, [
insertImport(
sourceFile, modulePath, 'BrowserModule', '@angular/platform-browser'),
...addImportToModule(sourceFile, modulePath, 'BrowserModule'),
...addBootstrapToModule(
sourceFile, modulePath, 'AppComponent', './app.component')
>>>>>>> Rebasing issues resolved
]);
return host;
};
@ -83,15 +73,11 @@ function addNxModule(path: string): Rule {
const modulePath = `${path}/app/app.module.ts`;
const moduleSource = host.read(modulePath)!.toString('utf-8');
const sourceFile = ts.createSourceFile(
<<<<<<< HEAD
modulePath,
moduleSource,
ts.ScriptTarget.Latest,
true
);
=======
modulePath, moduleSource, ts.ScriptTarget.Latest, true);
>>>>>>> Rebasing issues resolved
insert(host, modulePath, [
insertImport(sourceFile, modulePath, 'NxModule', '@nrwl/nx'),
...addImportToModule(sourceFile, modulePath, 'NxModule.forRoot()')
@ -151,7 +137,6 @@ function addRouterRootConfiguration(path: string): Rule {
const modulePath = `${path}/app/app.module.ts`;
const moduleSource = host.read(modulePath)!.toString('utf-8');
const sourceFile = ts.createSourceFile(
<<<<<<< HEAD
modulePath,
moduleSource,
ts.ScriptTarget.Latest,
@ -164,14 +149,6 @@ function addRouterRootConfiguration(path: string): Rule {
modulePath,
`RouterModule.forRoot([], {initialNavigation: 'enabled'})`
)
=======
modulePath, moduleSource, ts.ScriptTarget.Latest, true);
insert(host, modulePath, [
insertImport(sourceFile, modulePath, 'RouterModule', '@angular/router'),
...addImportToModule(
sourceFile, modulePath,
`RouterModule.forRoot([], {initialNavigation: 'enabled'})`)
>>>>>>> Rebasing issues resolved
]);
const componentSpecPath = `${path}/app/app.component.spec.ts`;
@ -180,7 +157,6 @@ function addRouterRootConfiguration(path: string): Rule {
componentSpecPath, componentSpecSource, ts.ScriptTarget.Latest, true);
insert(host, componentSpecPath, [
insertImport(
<<<<<<< HEAD
componentSpecSourceFile,
componentSpecPath,
'RouterTestingModule',
@ -191,12 +167,6 @@ function addRouterRootConfiguration(path: string): Rule {
componentSpecPath,
`RouterTestingModule`
)
=======
componentSpecSourceFile, componentSpecPath, 'RouterTestingModule',
'@angular/router/testing'),
...addImportToTestBed(
componentSpecSourceFile, componentSpecPath, `RouterTestingModule`)
>>>>>>> Rebasing issues resolved
]);
return host;
};
@ -280,14 +250,9 @@ export default function(schema: Schema): Rule {
function normalizeOptions(options: Schema): NormalizedSchema {
const name = toFileName(options.name);
<<<<<<< HEAD
const fullName = options.directory
? `${toFileName(options.directory)}/${name}`
: name;
=======
const fullName =
options.directory ? `${toFileName(options.directory)}/${name}` : name;
>>>>>>> Rebasing issues resolved
const fullPath = `apps/${fullName}/src`;
return {...options, sourceDir: 'src', name, fullName, fullPath};
}

View File

@ -7,7 +7,8 @@ import {
Rule,
template,
Tree,
url
url,
Source
} from '@angular-devkit/schematics';
import { Schema } from './schema';
import * as path from 'path';

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
./scripts/link.sh
rm -rf tmp
jest --maxWorkers=1 ./build/e2e/bazel

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
rm -rf build/
tsc
rsync -a --exclude=*.ts packages/ build/packages
rm -rf node_modules/@nrwl
cp -r build/packages node_modules/@nrwl

View File

@ -4,3 +4,12 @@
rm -rf node_modules/@nrwl
cp -r build/packages node_modules/@nrwl
rm -rf test/
tsc -p tsconfig.spec.json
rsync -a --exclude=*.ts packages/ test/packages
rm -rf node_modules/@nrwl
cp -r build/packages node_modules/@nrwl

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
if [ -n "$1" ]; then
jest --maxWorkers=1 ./build/packages/$1.spec.js
jest --maxWorkers=1 ./test/packages/$1.spec.js
else
jest --maxWorkers=1 ./build/packages/{schematics,bazel}
jest --maxWorkers=1 ./test/packages/{schematics,bazel}
fi

View File

@ -8,15 +8,25 @@
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"lib": ["es2017"],
"lib": [
"es2017"
],
"declaration": true,
"baseUrl": ".",
"paths": {
"@nrwl/schematics": ["./packages/schematics"],
"@nrwl/schematics/*": ["./packages/schematics/*"]
"@nrwl/schematics": [
"./packages/schematics"
],
"@nrwl/schematics/*": [
"./packages/schematics/*"
]
}
},
"exclude": ["tmp", "node_modules"],
"exclude": [
"tmp",
"node_modules",
"packages/schematics/src/*/files/**/*"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"skipTemplateCodegen": true,

21
tsconfig.spec.json Normal file
View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "test",
"typeRoots": ["node_modules/@types"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"lib": ["es2017"],
"declaration": true,
"baseUrl": "."
},
"exclude": ["tmp", "node_modules"],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"skipTemplateCodegen": true,
"annotationsAs": "decorators"
}
}