Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
fix(various): numerous build, css, and cms fixes (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmichalina authored Nov 6, 2017
1 parent 6c761f7 commit 183272f
Show file tree
Hide file tree
Showing 37 changed files with 5,317 additions and 675 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "fuse-angular-universal-s-67402"
}
}
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
node:
version: 8.8.1
version: 8.9.0
npm:
version: 5.5.1

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"database": {
"rules": "data/security.rules.json"
}
}
76 changes: 30 additions & 46 deletions fuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ import {
UglifyESPlugin
} from 'fuse-box';
import './tools/tasks';
const isReachable = require('is-reachable');


const isAot = argv.aot;
const isBuildServer = argv.ci;
const isSpaOnly = argv.spa;
const baseEntry = isAot ? 'main.aot' : 'main';
const mainEntryFileName = isProdBuild ? `${baseEntry}-prod` : `${baseEntry}`;
const appBundleName = isProdBuild ? `js/app-${cachebuster}` : `js/app`;
Expand All @@ -28,6 +29,8 @@ const vendorBundleInstructions = ` ~ client/${mainEntryFileName}.ts`;
const serverBundleInstructions = ' > [server/server.ts]';
const appBundleInstructions = ` !> [client/${mainEntryFileName}.ts]`;

if (isProdBuild) typeHelper()

const baseOptions = {
homeDir: './src',
output: `${BUILD_CONFIG.outputDir}/$name.js`,
Expand Down Expand Up @@ -93,56 +96,37 @@ const serverOptions = {
]
}

Sparky.task('build.server', () => {
if (isSpaOnly) return Promise.resolve();

const fuse = FuseBox.init(serverOptions as any);
const serverBundle = fuse.bundle('server').instructions(serverBundleInstructions);

if (!isBuildServer && !argv['build-only']) {
const reloadDelay = 3000;
serverBundle.watch('src/**').completed(proc => {
proc.start();
setTimeout(() => {
if (!active) {
init({
reloadDelay,
port: BUILD_CONFIG.browserSyncPort,
proxy: `${BUILD_CONFIG.host}:${BUILD_CONFIG.port}`
});
}
}, reloadDelay)
});
}

return fuse.run();
});

Sparky.task('build.app', () => {
const fuse = FuseBox.init(appOptions as any);
Sparky.task('build.universal', () => {
const fuseApp = FuseBox.init(appOptions as any);
const fuseServer = FuseBox.init(serverOptions as any);
const serverBundle = fuseServer.bundle('server').instructions(serverBundleInstructions);
const path = isAot ? 'client/.aot/src/client/app' : 'client/app';
const vendorBundle = fuse.bundle(`${vendorBundleName}`).instructions(vendorBundleInstructions);
const appBundle = fuse.bundle(appBundleName)
const vendorBundle = fuseApp.bundle(`${vendorBundleName}`).instructions(vendorBundleInstructions);
const appBundle = fuseApp.bundle(appBundleName)
.instructions(`${appBundleInstructions} + [${path}/**/!(*.spec|*.e2e-spec|*.ngsummary|*.snap).*]`)
.plugin([EnvPlugin(ENV_CONFIG_INSTANCE)]);


if (isProdBuild) typeHelper()

if (!isBuildServer && !argv['build-only']) {
vendorBundle.watch();

if (argv.spa) {
fuse.dev({ port: BUILD_CONFIG.port, root: 'dist', open: true });
vendorBundle.hmr();
appBundle.watch().hmr();
} else {
appBundle.watch().completed(() => {
const proxy = `${BUILD_CONFIG.host}:${BUILD_CONFIG.port}`
vendorBundle.watch()
appBundle.watch()
return fuseApp.run().then(() => {
serverBundle.watch('src/**').completed(proc => {
typeHelper(false, false)
reload()
});
}
}
proc.start();
isReachable(proxy).then(() => {
active
? reload()
: init({
port: BUILD_CONFIG.browserSyncPort,
proxy
})
})
})

return fuse.run();
return fuseServer.run()
});
} else {
return fuseApp.run().then(() => fuseServer.run())
}
});
Loading

0 comments on commit 183272f

Please sign in to comment.