Skip to content

Commit

Permalink
Upgrade to 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
subnomo committed May 6, 2018
1 parent 4702e3e commit 94f73e0
Show file tree
Hide file tree
Showing 6 changed files with 720 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
*.log
.fusebox/
build/
dist/
coverage/
43 changes: 21 additions & 22 deletions fuse.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const {
FuseBox,
Sparky,
CSSPlugin,
CSSResourcePlugin,
CopyPlugin,
EnvPlugin,
QuantumPlugin,
Expand All @@ -15,18 +13,18 @@ const ASSETS = ['*.jpg', '*.png', '*.jpeg', '*.gif', '*.svg'];

let ip = process.env.NODE_ENV === 'production';

// Copy the renderer html file to dist
// Copy the renderer html file to build
Sparky.task('copy-html', () => {
return Sparky.src('src/renderer/index.html').dest('dist/$name');
return Sparky.src('src/renderer/index.html').dest('build/$name');
});

let fuse;
let fuseRenderer;

function initFuse() {
async function initFuse() {
const config = {
homeDir: 'src/',
output: 'dist/$name.js',
output: 'build/$name.js',
log: true,
cache: !ip,
sourceMaps: !ip,
Expand All @@ -35,12 +33,11 @@ function initFuse() {

fuse = FuseBox.init({
...config,
target: 'electron',
target: 'server',
plugins: [
EnvPlugin({ NODE_ENV: ip ? 'production' : 'development' }),
[CSSResourcePlugin(), CSSPlugin()],
ip && QuantumPlugin({
target: 'electron',
target: 'server',
bakeApiIntoBundle : 'app',
uglify: true,
treeshake: true,
Expand All @@ -53,7 +50,6 @@ function initFuse() {
target: 'electron',
plugins: [
EnvPlugin({ NODE_ENV: ip ? 'production' : 'development' }),
[CSSResourcePlugin(), CSSPlugin()],
ip && QuantumPlugin({
target: 'electron',
bakeApiIntoBundle : 'renderer',
Expand Down Expand Up @@ -94,17 +90,21 @@ function bundle() {
};
}

Sparky.task('bundle', ['copy-html'], () => {
bundle();
fuse.run();
Sparky.task('bundle', ['copy-html'], async () => {
await bundle();
await fuse.run();
});

Sparky.task('clean', () => {
return Sparky.src('./build').clean('build/');
});

Sparky.task('dist', ['copy-html'], () => {
Sparky.task('build', ['clean', 'copy-html'], async () => {
ip = true;
initFuse();
bundle();
fuse.run();
fuseRenderer.run();
await initFuse();
await bundle();
await fuse.run();
await fuseRenderer.run();
});

Sparky.task('default', ['copy-html'], () => {
Expand All @@ -128,12 +128,11 @@ Sparky.task('default', ['copy-html'], () => {
if (!ip) {
spawn('node', [`${__dirname}/node_modules/electron/cli.js`, __dirname], {
stdio: 'inherit',
}).on('exit', (code) => {
console.log(`electron process exited with code ${code}`);
process.exit(code);
});
}
});
});
});

Sparky.task('clean', () => {
return Sparky.src('dist/*').clean('dist/');
});
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"name": "tubetop",
"version": "0.1.0",
"version": "0.2.0",
"description": "A YouTube music player, for your desktop.",
"main": "dist/app.js",
"main": "build/app.js",
"repository": "https://github.com/subnomo/tubetop",
"author": "Alex Taylor <alex@alext.xyz>",
"license": "MIT",
"scripts": {
"start": "node fuse",
"build:dist": "node fuse dist",
"build": "node fuse build",
"dist": "node fuse build && electron-builder",
"dist:all": "node fuse build && electron-builder -wl --x64 --ia32",
"test": "jest --coverage",
"test:nocov": "jest",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"build": {
"artifactName": "${name}-${version}-${os}-${arch}-setup.${ext}",
"files": ["build/**/*"]
},
"jest": {
"collectCoverageFrom": [
"src/renderer/**/*.{ts,tsx}",
Expand Down Expand Up @@ -71,6 +77,7 @@
"@types/whatwg-fetch": "^0.0.33",
"coveralls": "^3.0.1",
"electron": "^2.0.0",
"electron-builder": "^20.11.1",
"electron-devtools-installer": "^2.2.3",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function createWindow() {

// Load index.html
const appPath = app.getAppPath();
win.loadURL(`file://${appPath}/dist/index.html`);
win.loadURL(`file://${appPath}/build/index.html`);

// Open dev tools
if (debug) win.webContents.openDevTools();
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"jsx": "react",
Expand Down
Loading

0 comments on commit 94f73e0

Please sign in to comment.