MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / run

Method run

lib/tasks/serve.js:34–100  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

32 }
33
34 async run(options) {
35 let hasBuild = !!options.path;
36
37 if (hasBuild) {
38 if (!fs.existsSync(options.path)) {
39 throw new SilentError(
40 `The path ${options.path} does not exist. Please specify a valid build directory to serve.`
41 );
42 }
43 options._builder = mockBuilder();
44 options._watcher = mockWatcher(options.path);
45 }
46
47 let builder = (this._builder =
48 options._builder ||
49 new Builder({
50 ui: this.ui,
51 outputPath: options.outputPath,
52 project: this.project,
53 environment: options.environment,
54 }));
55
56 let watcher =
57 options._watcher ||
58 (
59 await Watcher.build({
60 ui: this.ui,
61 builder,
62 options,
63 serving: true,
64 ignored: [path.resolve(this.project.root, options.outputPath)],
65 })
66 ).watcher;
67
68 let serverRoot = './server';
69 let serverWatcher = null;
70 if (fs.existsSync(serverRoot)) {
71 serverWatcher = (
72 await ServerWatcher.build({
73 ui: this.ui,
74 watchedDir: path.resolve(serverRoot),
75 options,
76 })
77 ).watcher;
78 }
79
80 let expressServer =
81 options._expressServer ||
82 new ExpressServer({
83 ui: this.ui,
84 project: this.project,
85 watcher,
86 serverRoot,
87 serverWatcher,
88 });
89
90 /* hang until the user exits */
91 this._runDeferred = pDefer();

Callers

nothing calls this directly

Calls 4

mockBuilderFunction · 0.85
mockWatcherFunction · 0.85
buildMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected