Skip to content

Commit

Permalink
more build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TanninOne committed Jun 14, 2017
1 parent 739fb12 commit bf602c6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
42 changes: 20 additions & 22 deletions InstallAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,29 @@ for (let file of data.copy) {
continue;
}

fs.ensureDirAsync(path.join(tgt, file.outPath))
.then(() => {
glob(file.srcPath, globOptions, (globErr, files) => {
copies = copies === -1 ? files.length : copies += files.length;
if (globErr !== null) {
console.err('glob failed', globErr);
copies = copies === -1 ? files.length : copies += files.length;
if (globErr !== null) {
console.err('glob failed', globErr);
}
return Promise.map(files, (globResult) => {
let globTarget = path.join(...globResult.split(/[\/\\]/).slice(file.skipPaths));
if (file.rename) {
globTarget = path.join(path.dirname(globTarget), file.rename);
}
return Promise.map(files, (globResult) => {
let globTarget = path.join(...globResult.split(/[\/\\]/).slice(file.skipPaths));
if (file.rename) {
globTarget = path.join(path.dirname(globTarget), file.rename);
}
const targetFile = path.join(tgt, file.outPath, globTarget);
const targetFile = path.join(tgt, file.outPath, globTarget);

return fs.copyAsync(globResult, targetFile)
.then(() => {
console.log('copied', globResult, targetFile);
})
.catch((copyErr) => {
console.log('failed to copy', globResult, targetFile, copyErr);
})
.finally(() => {
--copies;
});
});
return fs.ensureDirAsync(path.dirname(targetFile))
.then(() => fs.copyAsync(globResult, targetFile))
.then(() => {
console.log('copied', globResult, targetFile);
})
.catch((copyErr) => {
console.log('failed to copy', globResult, targetFile, copyErr);
})
.finally(() => {
--copies;
});
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions InstallAssets.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
]
},
{
"srcPath": "extensions/*/index.js",
"srcPath": "extensions/game-*/*",
"outPath": "bundledPlugins",
"skipPaths": 1,
"target": [
Expand All @@ -114,7 +114,7 @@
]
},
{
"srcPath": "extensions/game-*/*",
"srcPath": "extensions/*/index.js",
"outPath": "bundledPlugins",
"skipPaths": 1,
"target": [
Expand Down
4 changes: 2 additions & 2 deletions extensions/theme-switcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"webpack": "node ./node_modules/webpack/bin/webpack --config webpack.config.js --display-error-details --progress --profile --color",
"postinstall": "electron-rebuild -w font-manager",
"prebuild": "typings prune && typings install",
"build": "npm run tsc && copyfiles -f ./node_modules/font-manager/build/Release/fontmanager.node ./dist && npm run webpack"
"build": "npm run tsc && copy \".\\node_modules\\font-manager\\build\\Release\\fontmanager.node\" \".\\dist\\font-manager.node\" && npm run webpack"
},
"author": "Black Tree Gaming Ltd.",
"license": "GPL-3.0",
Expand All @@ -20,7 +20,7 @@
"@types/react-redux": "4.4.35",
"@types/redux": "^3.6.0",
"@types/redux-thunk": "^2.1.0",
"copyfiles": "^1.2.0",
"copy": "^0.3.0",
"electron-rebuild": "^1.5.11",
"webpack": "^1.13.2"
},
Expand Down
6 changes: 5 additions & 1 deletion src/util/ExtensionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ if (remote !== undefined) {
process.env.NODE_PATH = path.resolve(__dirname, '..', '..', 'node_modules');
Module._initPaths();

function asarUnpacked(input: string): string {
return input.replace('app.asar' + path.sep, 'app.asar.unpacked' + path.sep);
}

interface IRegisteredExtension {
name: string;
path: string;
Expand Down Expand Up @@ -772,7 +776,7 @@ class ExtensionManager {
'test_runner',
];

const bundledPath = path.resolve(__dirname, '..', 'bundledPlugins');
const bundledPath = asarUnpacked(path.resolve(__dirname, '..', 'bundledPlugins'));
log('info', 'bundle at', bundledPath);
const extensionsPath = path.join(app.getPath('userData'), 'plugins');
return staticExtensions
Expand Down

0 comments on commit bf602c6

Please sign in to comment.