Skip to content

Commit

Permalink
fix(bazel): Extend ngrx and angular schematics (#401)
Browse files Browse the repository at this point in the history
Workspace names can now be anything where before it was hardcoded
to be "proj"
  • Loading branch information
mrmeku authored Apr 5, 2018
1 parent bc55957 commit 0c2b01b
Show file tree
Hide file tree
Showing 4 changed files with 722 additions and 7 deletions.
7 changes: 3 additions & 4 deletions packages/bazel/src/collection.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "nx-bazel",
"version": "0.1",
"extends": "@ngrx/schematics",
"schematics": {
"application": {
"factory": "./collection/application",
Expand All @@ -18,12 +19,10 @@
"description": "Create a library"
},
"module": {
"aliases": [
"m"
],
"aliases": ["m"],
"factory": "./collection/module",
"schema": "./collection/module/schema.json",
"description": "Create a Module"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ STATIC_FILES = [
ts_devserver(
name = "devserver",
data = ["//apps/<%= fullName %>/src/assets"],
entry_module = "proj/apps/<%= fullName %>/src/main",
entry_module = "<%= workspaceName %>/apps/<%= fullName %>/src/main",
scripts = ["//:angular_bundles"],
serving_path = "/bundle.min.js",
static_files = STATIC_FILES,
Expand All @@ -42,7 +42,7 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "nodejs_binary")

rollup_bundle(
name = "bundle",
entry_point = "proj/apps/<%= fullName %>/src/main",
entry_point = "<%= workspaceName %>/apps/<%= fullName %>/src/main",
deps = [":<%= sourceDir %>"],
)

Expand Down
11 changes: 10 additions & 1 deletion packages/bazel/src/collection/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { wrapIntoFormat } from '../../utils/tasks';
interface NormalizedSchema extends Schema {
fullName: string;
fullPath: string;
workspaceName: string;
}

function addBootstrap(path: string): Rule {
Expand Down Expand Up @@ -294,5 +295,13 @@ function normalizeOptions(options: Schema): NormalizedSchema {
? `${toFileName(options.directory)}/${name}`
: name;
const fullPath = `apps/${fullName}/src`;
return { ...options, sourceDir: 'src', name, fullName, fullPath };
const workspaceName = readCliConfigFile().project.name;
return {
...options,
sourceDir: 'src',
name,
fullName,
fullPath,
workspaceName
};
}
Loading

0 comments on commit 0c2b01b

Please sign in to comment.