Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/3.0' into 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJaredWilcurt committed Oct 28, 2017
2 parents 4e7e491 + 158f71d commit 711a424
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 28 deletions.
Binary file added _img/app.icns
Binary file not shown.
Binary file added _img/document.icns
Binary file not shown.
6 changes: 5 additions & 1 deletion _scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ var app = new Vue({
aboutModal: false,
contributors: [
{ name: 'The Jared Wilcurt', url: 'http://TheJaredWilcurt.com' },
{ name: 'Rob Gaston', url: 'https://github.com/robgaston1' }
{ name: 'Rob Gaston', url: 'https://github.com/robgaston1' },
{ name: 'Marissa Staller', url: 'https://github.com/mardisworld' },
{ name: 'James Boyer', url: 'https://github.com/jamesboyer92' }
],
technologies: [
{ name: 'Pa11y', url: 'http://pa11y.org' },
Expand Down Expand Up @@ -365,11 +367,13 @@ var app = new Vue({

app.prefillOutput();

/*
$('.navbar-brand img').on('contextmenu', function (evt) {
evt.preventDefault();
evt.stopPropagation();
nw.Window.get().showDevTools();
});
*/

if (process.platform === 'darwin') {
keyBindings();
Expand Down
66 changes: 41 additions & 25 deletions build-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ var junk = [
'package.nw/node_modules/hawk/images/',
'package.nw/node_modules/pa11y/example/',
'package.nw/node_modules/pa11y/test/',
'package.nw/node_modules/es6-promise/es6-promise.d.ts',
'_style'
'package.nw/node_modules/es6-promise/es6-promise.d.ts'
];


Expand Down Expand Up @@ -145,6 +144,10 @@ function updateExe (done) {

exec('chmod +x ' + filePath);
done();
} else if (process.platform === 'darwin') {
fs.copySync('./_img/app.icns', './build/' + nwBuildSettings.appName + '/osx64/' + nwBuildSettings.appName + '.app/Contents/Resources/app.icns');
fs.copySync('./_img/document.icns', './build/' + nwBuildSettings.appName + '/osx64/' + nwBuildSettings.appName + '.app/Contents/Resources/document.icns');
done();
} else {
done();
}
Expand All @@ -153,6 +156,7 @@ function updateExe (done) {
function copyManifest () {
var manifest = fs.readJsonSync('./package.json');
manifest.devDependencies = {};
manifest.name = nwBuildSettings.appName;
var output = JSON.stringify(manifest, null, 2);
var buildPackagePath = './build/' + nwBuildSettings.appName + '/' + platform + '/package.json';
if (process.platform === 'darwin') {
Expand All @@ -163,6 +167,9 @@ function copyManifest () {

function changeDirectoryToBuildFolder () {
var buildFolder = path.join(process.cwd(), 'build', nwBuildSettings.appName, platform);
if (process.platform === 'darwin') {
buildFolder = path.join(process.cwd(), 'build', nwBuildSettings.appName, platform, nwBuildSettings.appName + '.app', 'Contents', 'Resources', 'app.nw');
}
process.chdir(buildFolder);
}

Expand All @@ -171,20 +178,25 @@ function npmInstallBuildFolder () {
}

function moveFilesIntoPackageNW () {
console.log(' ∙ Started moving files into package.nw');
nwBuildSettings.files.forEach(function (file) {
var src = file.replace('/**/*', '');
var dest = path.join('package.nw', src);

fs.moveSync(src, dest);
console.log(' ∙ moved ' + src.replace('./', ''));
});
fs.moveSync('./node_modules', path.join('.', 'package.nw', 'node_modules'));
console.log(' ∙ moved node_modules');
if (process.platform !== 'darwin') {
console.log(' ∙ Started moving files into package.nw');
nwBuildSettings.files.forEach(function (file) {
var src = file.replace('/**/*', '');
var dest = path.join('package.nw', src);

fs.moveSync(src, dest);
console.log(' ∙ moved ' + src.replace('./', ''));
});
fs.moveSync('./node_modules', path.join('.', 'package.nw', 'node_modules'));
console.log(' ∙ moved node_modules');
}
}

function removeJunk () {
console.log(' ∙ Started removing junk files');
if (process.platform !== 'darwin') {
junk.push('_style');
}
junk.forEach(function (item) {
var file = path.join(process.cwd(), item);
fs.removeSync(file);
Expand All @@ -193,12 +205,10 @@ function removeJunk () {
}

function runApp () {
var extension = '';
if (platform === 'win32') {
extension = '.exe';
}
if (platform === 'win32') {
exec(nwBuildSettings.appName + extension);
exec(nwBuildSettings.appName + '.exe');
} else if (process.platform === 'darwin') {
exec('open ' + nwBuildSettings.appName + '.app');
} else {
console.log('WARNING: WE STILL DON\'T KNOW HOW TO AUTO RUN EXE ON LINUX');
}
Expand Down Expand Up @@ -284,10 +294,6 @@ nw.build().then(function () {
copyManifest();
console.log(' ∙ Copied package.json');

if (process.platform === 'darwin') {
return;
}

changeDirectoryToBuildFolder();
console.log(' ∙ cd to build folder');

Expand All @@ -300,14 +306,24 @@ nw.build().then(function () {
removeJunk();
console.log(' ∙ Finished removing junk files');

if (process.platform === 'darwin') {
// go up 4 folders to get to the folder that holds YourAppName.app
for (var i = 0; i < 4; i++) {
goUpOneDirectory();
}
console.log(' ∙ Went up four directories');
}

runApp();
console.log(' ∙ Ran app');

goUpOneDirectory();
console.log(' ∙ Went up one directory');
if (process.platform !== 'darwin') {
goUpOneDirectory();
console.log(' ∙ Went up one directory');

renameBuiltFolder();
console.log(' ∙ Renamed built folder');
renameBuiltFolder();
console.log(' ∙ Renamed built folder');
}

zipApp();
console.log(' ∙ Zipped app');
Expand Down
3 changes: 1 addition & 2 deletions index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<link rel="stylesheet" href="_style/style.css">
</head>

<!-- Change the class form dev to prod when you're ready to distribute your application. -->
<body><div id="app">

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
Expand Down Expand Up @@ -193,7 +192,7 @@ <h3 class="panel-title">About Koa11y</h3>
</span>.
</p>
<p class="text-center">
<a href="https://open-indy.github.io/Koa11y" class="external-link">Visit the Koa11y website.</a>
<a href="https://open-indy.github.io/Koa11y" @click="externalLink('https://open-indy.github.io/Koa11y')">Visit the Koa11y website.</a>
</p>
</div>
</div>
Expand Down

0 comments on commit 711a424

Please sign in to comment.