-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,053 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
addNgRx, checkFilesExists, cleanup, newApp, readFile, runCLI, runCommand, runSchematic, | ||
updateFile | ||
} from './utils'; | ||
|
||
describe('application', () => { | ||
beforeEach(cleanup); | ||
|
||
it('creates a new application in a workspace', () => { | ||
runSchematic('@nrwl/nx:application --name=proj'); | ||
runSchematic('@nrwl/nx:app --name=myapp', {projectName: 'proj'}); | ||
|
||
checkFilesExists( | ||
`proj/tsconfig.json`, | ||
`proj/WORKSPACE`, | ||
`proj/BUILD.bazel`, | ||
`proj/apps/myapp/BUILD.bazel`, | ||
`proj/apps/myapp/src/index.html`, | ||
`proj/apps/myapp/src/app/app.module.ts`, | ||
`proj/apps/myapp/src/app/app.component.ts` | ||
); | ||
|
||
expect(readFile('proj/apps/myapp/src/app/app.module.ts')).toContain('bootstrap: [AppComponent]'); | ||
|
||
const cliConfig = JSON.parse(readFile('proj/.angular-cli.json')); | ||
expect(cliConfig.apps.length).toEqual(1); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { | ||
addNgRx, checkFilesExists, cleanup, newApp, readFile, runCLI, runCommand, runSchematic, | ||
updateFile | ||
} from './utils'; | ||
|
||
describe('workspace', () => { | ||
beforeEach(cleanup); | ||
|
||
it('creates a new workspace for developing angular applications', () => { | ||
runSchematic('@nrwl/nx:application --name=proj --version=0.1'); | ||
|
||
checkFilesExists( | ||
`proj/tsconfig.json`, | ||
`proj/WORKSPACE`, | ||
`proj/BUILD.bazel` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
./scripts/build.sh | ||
cp package.json build/src/package.json | ||
cp README.md build/src/README.md | ||
cp LICENSE build/src/LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
load("@build_bazel_rules_typescript//:defs.bzl", "nodejs_binary") | ||
exports_files(["webpack.config.js", "test.js"]) | ||
|
||
nodejs_binary( | ||
name = "webpack", | ||
entry_point = "webpack/bin/webpack", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tree artifact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
def _collect_es5_sources_impl(target, ctx): | ||
result = set() | ||
if hasattr(ctx.rule.attr, "srcs"): | ||
for dep in ctx.rule.attr.srcs: | ||
if hasattr(dep, "es5_sources"): | ||
result += dep.es5_sources | ||
if hasattr(target, "typescript"): | ||
result += target.typescript.es5_sources | ||
return struct(es5_sources = result) | ||
|
||
_collect_es5_sources = aspect( | ||
_collect_es5_sources_impl, | ||
attr_aspects = ["deps", "srcs"], | ||
) | ||
|
||
def _webpack_bundle_impl(ctx): | ||
inputs = set() | ||
for s in ctx.attr.srcs: | ||
if hasattr(s, "es5_sources"): | ||
inputs += s.es5_sources | ||
|
||
config = ctx.attr.config.files.to_list()[0] | ||
|
||
if ctx.attr.mode == 'prod': | ||
main = ctx.new_file('bundles/main.bundle.prod.js') | ||
polyfills = ctx.new_file('bundles/polyfills.bundle.prod.js') | ||
vendor = ctx.new_file('bundles/vendor.bundle.prod.js') | ||
styles = ctx.new_file('bundles/styles.bundle.prod.js') | ||
else: | ||
main = ctx.new_file('bundles/main.bundle.js') | ||
polyfills = ctx.new_file('bundles/polyfills.bundle.js') | ||
vendor = ctx.new_file('bundles/vendor.bundle.js') | ||
styles = ctx.new_file('bundles/styles.bundle.js') | ||
|
||
inputs += [config] | ||
args = [] | ||
|
||
if ctx.attr.mode == 'prod': | ||
args += ['-p'] | ||
|
||
args += ['--config', config.path] | ||
args += ['--env.bin', ctx.configuration.bin_dir.path] | ||
args += ['--env.package', ctx.label.package] | ||
args += ['--env.mode', ctx.attr.mode] | ||
|
||
ctx.action( | ||
progress_message = "Webpack bundling %s" % ctx.label, | ||
inputs = inputs.to_list(), | ||
outputs = [main, polyfills, vendor, styles], | ||
executable = ctx.executable._webpack, | ||
arguments = args, | ||
) | ||
return DefaultInfo(files=depset([main, polyfills, vendor, styles])) | ||
|
||
webpack_bundle = rule(implementation = _webpack_bundle_impl, | ||
attrs = { | ||
"srcs": attr.label_list(allow_files=True, aspects=[_collect_es5_sources]), | ||
"config": attr.label(allow_single_file=True), | ||
"mode": attr.string(default="dev"), | ||
"_webpack": attr.label(default=Label("@build_bazel_rules_nrwl//:webpack"), executable=True, cfg="host") | ||
} | ||
) |
Oops, something went wrong.