Skip to content

Commit e41d61a

Browse files
committed
No longer need to bundle separate socketcluster.js client file in sample app - It will be added into sample app by cli.
1 parent 78f4723 commit e41d61a

File tree

2 files changed

+9
-4442
lines changed

2 files changed

+9
-4442
lines changed

bin/cli.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ var wd = process.cwd();
107107

108108
var sampleDir = __dirname + '/../sample';
109109
var destDir = path.normalize(wd + '/' + arg1);
110+
var clientFileSourcePath = path.normalize(destDir + '/node_modules/socketcluster-client/socketcluster.js');
111+
var clientFileDestPath = path.normalize(destDir + '/public/socketcluster.js');
110112

111113
var createFail = function () {
112114
errorMessage("Failed to create SocketCluster sample app.");
@@ -126,7 +128,13 @@ var createSuccess = function () {
126128
errorMessage("Failed to install dependencies for sample '" + arg1 + "' app. Navigate to " +
127129
destDir + " and then try to run 'npm install' from there.");
128130
} else {
129-
successMessage("SocketCluster sample '" + destDir + "' was setup successfully.");
131+
try {
132+
fs.writeFileSync(clientFileDestPath, fs.readFileSync(clientFileSourcePath));
133+
successMessage("SocketCluster sample '" + destDir + "' was setup successfully.");
134+
} catch (err) {
135+
warningMessage("Failed to copy file from '" + clientFileSourcePath + "' to '" +
136+
clientFileDestPath + "' - Try copying it manually.");
137+
}
130138
}
131139
process.exit();
132140
});

0 commit comments

Comments
 (0)