Skip to content

Commit

Permalink
初始提交
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Aug 16, 2019
1 parent 4dc34a4 commit 14f7bd1
Show file tree
Hide file tree
Showing 112 changed files with 24,294 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"presets": [
[
"@babel/preset-env",
{
"corejs": "3",
"useBuiltIns": "usage"
}
],
[
"minify",
{
"builtIns": false,
"evaluate": false,
"mangle": false
}
]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import"
]
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
24 changes: 24 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": "standard",
"plugins": [
"html"
],
"parser": "babel-eslint",
"rules": {
"no-new": "off",
"camelcase": "off",
"no-return-assign": "off",
"space-before-function-paren": ["error", "never"],
"no-var": "error",
"no-fallthrough": "off",
"prefer-promise-reject-errors": "off",
"eqeqeq": "off",
"no-multiple-empty-lines": [1, {"max": 2}],
"comma-dangle": [2, "always-multiline"],
"standard/no-callback-literal": "off",
"prefer-const": "off"
},
"settings": {
"html/html-extensions": [".html", ".vue"]
}
}
70 changes: 70 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next


build

dist

publish/assets

publish/utils/githubToken.js
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# lx-music-desktop change log

All notable changes to this project will be documented in this file.

Project versioning adheres to [Semantic Versioning](http://semver.org/).
Commit convention is based on [Conventional Commits](http://conventionalcommits.org).
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).

## [0.1.0] - 2019-8-16

* 0.1.0版本发布
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# lx-music-desktop
洛雪音乐助手桌面版
# 洛雪音乐助手桌面版

[![GitHub release][1]][2]
[![Build status][3]][4]
[![GitHub All Releases Download][5]][6]
[![dev branch][7]][8]

[1]: https://img.shields.io/github/release/lyswhut/lx-music-desktop
[2]: https://github.com/lyswhut/lx-music-desktop/releases
[3]: https://ci.appveyor.com/api/projects/status/flrsqd5ymp8fnte5?svg=true
[4]: https://ci.appveyor.com/project/lyswhut/lx-music-desktop
[5]: https://img.shields.io/github/downloads/lyswhut/lx-music-desktop/total
[6]: https://github.com/lyswhut/lx-music-desktop/releases
[7]: https://img.shields.io/github/package-json/v/lyswhut/lx-music-desktop/dev
[8]: https://github.com/lyswhut/lx-music-desktop/tree/dev

## 说明

一个基于 Electron + Vue 开发的 Windows 版音乐软件。

所用技术栈:

- Electron 7.x
- Vue 2.x

其他说明:TODO

感谢 <https://github.com/messoer> 提供的部分音乐API!

## 使用方法

```bash
# 开发模式
npm run dev

# 构建免安装版
npm run pack:dir

# 构建安装包
npm run pack

```
20 changes: 20 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
platform:
- x64

cache:
- node_modules
- '%APPDATA%\npm-cache'
# - '%USERPROFILE%\.electron'

install:
- ps: Install-Product node 12 x64
- npm install

build_script:
- npm run pub:gh

test: off

branches:
only:
- master
8 changes: 8 additions & 0 deletions build-config/css-loader.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const isDev = process.env.NODE_ENV === 'development'

module.exports = {
modules: {
localIdentName: isDev ? '[folder]-[name]--[local]--[hash:base64:5]' : '[hash:base64:5]',
},
localsConvention: 'camelCase',
}
44 changes: 44 additions & 0 deletions build-config/main/webpack.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const path = require('path')

module.exports = {
target: 'electron-main',
output: {
filename: '[name].js',
libraryTarget: 'commonjs2',
path: path.join(__dirname, '../../dist/electron'),
},
externals: [
// suppress electron-debug warning
// see https://github.com/SimulatedGREG/electron-vue/issues/498
{ 'electron-debug': 'electron-debug' },
],
resolve: {
alias: {
common: path.join(__dirname, '../../src/common'),
},
extensions: ['*', '.js', '.json', '.node'],
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'eslint-loader',
options: {
formatter: require('eslint-formatter-friendly'),
},
},
exclude: /node_modules/,
enforce: 'pre',
},
// {
// test: /\.js$/,
// loader: 'babel-loader',
// exclude: /node_modules/,
// },
],
},
performance: {
maxEntrypointSize: 300000,
},
}
22 changes: 22 additions & 0 deletions build-config/main/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const path = require('path')
const merge = require('webpack-merge')
const webpack = require('webpack')

const baseConfig = require('./webpack.config.base')


module.exports = merge(baseConfig, {
mode: 'development',
entry: {
main: path.join(__dirname, '../../src/main/index.dev.js'),
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"',
},
__static: `"${path.join(__dirname, '../../src/static').replace(/\\/g, '\\\\')}"`,
}),
new webpack.NoEmitOnErrorsPlugin(),
],
})
29 changes: 29 additions & 0 deletions build-config/main/webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const path = require('path')
const merge = require('webpack-merge')
const webpack = require('webpack')

const baseConfig = require('./webpack.config.base')

const { dependencies } = require('../../package.json')


module.exports = merge(baseConfig, {
mode: 'production',
entry: {
main: path.join(__dirname, '../../src/main/index.js'),
},
externals: [
...Object.keys(dependencies || {}),
],
node: {
__dirname: false,
__filename: false,
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
}),
],
})
84 changes: 84 additions & 0 deletions build-config/pack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
process.env.NODE_ENV = 'production'

const chalk = require('chalk')
const del = require('del')
const webpack = require('webpack')
const Multispinner = require('multispinner')

const mainConfig = require('./main/webpack.config.prod')
const rendererConfig = require('./renderer/webpack.config.prod')

const errorLog = chalk.bgRed.white(' ERROR ') + ' '
const okayLog = chalk.bgGreen.white(' OKAY ') + ' '


function build() {
del.sync(['dist/electron', 'build'])

const tasks = ['main', 'renderer']
const m = new Multispinner(tasks, {
preText: 'building',
postText: 'process',
})

let results = ''

m.on('success', () => {
process.stdout.write('\x1B[2J\x1B[0f')
console.log(`\n\n${results}`)
console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`)
process.exit()
})

pack(mainConfig).then(result => {
results += result + '\n\n'
m.success('main')
}).catch(err => {
m.error('main')
console.log(`\n ${errorLog}failed to build main process`)
console.error(`\n${err}\n`)
process.exit(1)
})

pack(rendererConfig).then(result => {
results += result + '\n\n'
m.success('renderer')
}).catch(err => {
m.error('renderer')
console.log(`\n ${errorLog}failed to build renderer process`)
console.error(`\n${err}\n`)
process.exit(1)
})
}

function pack(config) {
return new Promise((resolve, reject) => {
config.mode = 'production'
webpack(config, (err, stats) => {
if (err) reject(err.stack || err)
else if (stats.hasErrors()) {
let err = ''

stats.toString({
chunks: false,
modules: false,
colors: true,
})
.split(/\r?\n/)
.forEach(line => {
err += ` ${line}\n`
})

reject(err)
} else {
resolve(stats.toString({
chunks: false,
colors: true,
}))
}
})
})
}

build()

Loading

0 comments on commit 14f7bd1

Please sign in to comment.