Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Commit 76fe157

Browse files
committed
Fixed installation issues with npm
1 parent 911e963 commit 76fe157

10 files changed

Lines changed: 76 additions & 25 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules/
22
.idea/
33
**/npm-debug.log
44
**/node_modules/**
5-
/build
5+
/build
6+
**.*~

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ When you first run the dashboard, you should go to the "Settings" tab to configu
5252
# Using the"dxwcmdesigns" command line utility
5353
Note that all the functionality for push/pull of WCM design files is available from the Dashboard user interface. For the command line support, use:
5454
```
55-
$ dxdxwcmdesigns <command> [options]
55+
$ dxwcmdesigns <command> [options]
5656
```
5757

5858
The commands are described below.
5959

6060
## init
6161
Usage:
6262
```
63-
$ dxdxwcmdesigns init [options]
63+
$ dxwcmdesigns init [options]
6464
```
6565
Running this command will display a prompt to select a WCM library. A subdirectory
6666
will be created (in the current working directory) and the selected library will be
@@ -75,7 +75,7 @@ The available options are:
7575
Usage:
7676
```
7777
$ cd <path to the wcm library>
78-
$ dxdxwcmdesigns push [options]
78+
$ dxwcmdesigns push [options]
7979
```
8080
Running this command will push the source files to WCM and update the library on the server.
8181

@@ -91,7 +91,7 @@ The available options are:
9191
Usage:
9292
```
9393
$ cd <path to the wcm library>
94-
$ dxdxwcmdesigns pull [options]
94+
$ dxwcmdesigns pull [options]
9595
```
9696
This command will download any remote changes to the WCM library. First run `wcm init`
9797
to initialize the WCM library before using `wcm pull`.

dashboard.tar.gz

247 Bytes
Binary file not shown.

digexp-dashboard/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"async": "^1.3.0",
2626
"chokidar": "^1.0.3",
2727
"diff": "^1.4.0",
28+
"dxsync": "https://github.com/digexp/dxsync/archive/1.0.2.tar.gz",
2829
"digexp-wcm-design": "file:../wcm-design.tar.gz",
2930
"findit": "",
3031
"map-stream": "0.0.6",
@@ -37,6 +38,10 @@
3738
"vinyl": "^0.5.0",
3839
"vinyl-fs": "^1.0.0"
3940
},
41+
"config": {
42+
"unsafe-perm": true,
43+
"no-optional": true
44+
},
4045
"scripts": {
4146
"preinstall": "node preinstall.js",
4247
"postinstall": "node postinstall.js"

digexp-dashboard/postinstall.js

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,72 @@ var rm_rf = function(path, cb) {
4444

4545
console.log("Installing dxsync:");
4646

47-
ch.exec("npm install https://github.com/digexp/dxsync/archive/1.0.2.tar.gz --no-optional",
48-
function(err) {
47+
var cwd = process.cwd();
48+
49+
var command = "npm install --no-optional --no-bin-links --prefix " + cwd + " https://github.com/digexp/dxsync/archive/1.0.2.tar.gz";
50+
51+
if (process.platform == "win32") {
52+
command = "npm install --no-optional https://github.com/digexp/dxsync/archive/1.0.2.tar.gz"
53+
}
54+
55+
var cleanup = function() {
56+
rm_rf("node_modules/dxsync/precompiled_modules/");
57+
rm_rf("node_modules/dxsync/precompiled_modules.zip");
58+
}
59+
60+
var cleanupWindows = function(cb) {
61+
ch.exec("npm root -g", { }, function(err, root) {
62+
root = root || process.env._;
63+
if (root && fs.existsSync(root + "\\dxsync\\package.json")) {
64+
ch.exec('xcopy "' + root + '\\dxsync" "' + process.cwd() + '\\node_modules\\dxsync" /e /y', function() {
65+
cb && cb();
66+
});
67+
} else {
68+
cb && cb();
69+
}
70+
});
71+
}
72+
73+
var cleanupUnix = function(cb) {
74+
if (fs.existsSync("lib/node_modules/dxsync/package.json")) {
75+
ch.exec("cp -r lib/node_modules/dxsync/ node_modules/dxsync/", function() {
76+
rm_rf("lib/node_modules/dxsync"); // ./lib/ shouldn't exist in this version of npm
77+
cb && cb();
78+
});
79+
}
80+
}
81+
82+
cleanup();
83+
/*ch.exec(command, { cwd: cwd },
84+
function(err, stdout, stderr) {
85+
if (stdout) {
86+
console.log(stdout);
87+
}
88+
if (stderr) {
89+
console.error(stderr);
90+
}
4991
if (err) {
5092
console.error("Error installing dxsync: " + err.message);
93+
} else if (process.platform == "win32") {
94+
cleanupWindows(cleanup);
5195
} else {
52-
rm_rf("node_modules/dxsync/precompiled_modules/");
53-
rm_rf("node_modules/dxsync/precompiled_modules.zip");
54-
55-
setTimeout(function() {
56-
console.log("Done!")
57-
}, 300);
96+
cleanupUnix(cleanup);
5897
}
59-
});
98+
setTimeout(function() {
99+
console.log("Done!")
100+
}, 500);
101+
});*/
60102

61103
// check if user-settings has been saved temporarily
62104
// (for saving settings when re-installing the dashboard globally)
63-
ch.exec("npm root -g", function(err, root) {
105+
ch.exec("npm root -g", { }, function(err, root) {
106+
root = root || process.env._;
64107
if (root) {
65108
root = root.replace(/\n|\r/g, "");
66109
fs.readFile(path.resolve(root, ".digexp-dashboard-user-settings.json"),
67110
function(err, contents) {
68111
if (!err) {
69-
fs.writeFile(path.resolve(root, "digexp-dashboard/user-settings.json"),
112+
fs.writeFile(path.resolve(root,"digexp-dashboard/user-settings.json"),
70113
contents);
71114
fs.unlink(path.resolve(root, ".digexp-dashboard-user-settings.json"))
72115
}

digexp-dashboard/preinstall.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var fs = require("fs");
1212
var ch = require("child_process");
1313

1414
ch.exec("npm root -g", function(err, root) {
15+
root = root || process.env._;
16+
console.log(root);
1517
if (root) {
1618
root = root.replace(/\n|\r/g, "");
1719
fs.readFile(path.resolve(root, "digexp-dashboard/user-settings.json"),

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const SP_SERVER = "./digexp-sp-server";
2121
var getFileList = function(folder) {
2222
// todo read gitignore, npmignore
2323
return [folder + "/**", "!" + folder + "/.git/**", "!" + folder + "/node_modules/**",
24-
"!" + folder + "/node_modules/", "!" + folder + "/.idea/**", "!" + folder + "/user-settings.json"];
24+
"!" + folder + "/node_modules/", "!" + folder + "/.idea/**", "!" + folder + "/user-settings.json", + "!" + folder + "/**.*~"];
2525
};
2626

2727
var npm_pack = function(folder, dest) {
@@ -66,4 +66,4 @@ gulp.task("watch_sp-server", function() {
6666

6767
gulp.task("watch", ['watch_wcm', 'watch_sp-server', 'watch_dashboard'])
6868

69-
gulp.task('default', ['pack', 'watch']);
69+
gulp.task('default', ['pack', 'watch']);

install.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
call npm install -g wcm-design.tar.gz
2-
call npm install -g dashboard.tar.gz
2+
call npm install -g --unsafe-perm --no-optional dashboard.tar.gz
33
call npm install -g nw

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
npm install -g wcm-design.tar.gz
2-
npm install -g dashboard.tar.gz
2+
npm install -g --unsafe-perm --no-optional dashboard.tar.gz
33
npm install -g nw

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "diggexp-toolkit",
2+
"name": "digexp-toolkit",
33
"version": "0.1.0",
44
"devDependencies": {
55
"grunt": "latest",
66
"grunt-contrib-compress": "latest",
7-
"gulp": "latest",
8-
"gulp-tar": "latest",
9-
"gulp-gzip": "latest",
10-
"map-stream": "latest"
7+
"gulp": "^3.9.0",
8+
"gulp-gzip": "^1.2.0",
9+
"gulp-tar": "^1.4.0",
10+
"map-stream": "0.0.6"
1111
}
1212
}

0 commit comments

Comments
 (0)