Skip to content

Commit

Permalink
chore: New folder architecture for v1
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Dec 14, 2018
1 parent c89bdc5 commit 7186dab
Show file tree
Hide file tree
Showing 860 changed files with 33,164 additions and 17 deletions.
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
.DS_Store
.Thumbs.db
node_modules/
dev-umd/dist
dist/
deploy/
npm-debug.log
test/unit/coverage/
test/e2e/dist/
cordova
*.sublime*
.idea/
debug.log
Expand Down
10 changes: 5 additions & 5 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Razvan Stoenescu
Copyright (c) 2015-present Razvan Stoenescu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
File renamed without changes.
6 changes: 6 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
.Thumbs.db
node_modules/
ssl-server.pem
npm-debug.log
*.sublime*
2 changes: 2 additions & 0 deletions app/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.editorconfig
.github
21 changes: 21 additions & 0 deletions app/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015-present Razvan Stoenescu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
6 changes: 6 additions & 0 deletions app/assets/logo.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
___
/ _ \ _ _ __ _ ___ __ _ _ __
| | | | | | |/ _` / __|/ _` | '__|
| |_| | |_| | (_| \__ \ (_| | |
\__\_\\__,_|\__,_|___/\__,_|_|

57 changes: 57 additions & 0 deletions app/bin/quasar
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env node

require('../lib/node-version-check')
require('../lib/helpers/cli-error-handling')

const commands = [
'dev',
'build',
'clean',
'mode',
'info',
'new',
'help'
]

let cmd = process.argv[2]

if (cmd) {
if (cmd.length === 1) {
const mapToCmd = {
d: 'dev',
b: 'build',
c: 'clean',
m: 'mode',
i: 'info',
n: 'new',
h: 'help'
}
cmd = mapToCmd[cmd]
}

if (commands.includes(cmd)) {
process.argv.splice(2, 1)
}
else {
if (cmd === '-v' || cmd === '--version') {
console.log(require('../package.json').version)
process.exit(0)
}

const warn = require('../lib/helpers/logger')('app', 'red')

warn()
warn(`Unknown command "${ cmd }"`)
if (cmd.indexOf('-') === 0) {
warn(`Command must come before the options`)
}

warn()
cmd = 'help'
}
}
else {
cmd = 'help'
}

require(`./quasar-${cmd}`)
175 changes: 175 additions & 0 deletions app/bin/quasar-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
#!/usr/bin/env node

const parseArgs = require('minimist')

const argv = parseArgs(process.argv.slice(2), {
alias: {
m: 'mode',
T: 'target',
A: 'arch',
b: 'bundler',
d: 'debug',
h: 'help'
},
boolean: ['h', 'd'],
string: ['m', 'T'],
default: {
t: 'mat',
m: 'spa'
}
})

if (argv.help) {
console.log(`
Description
Builds distributables of your app.
Usage
$ quasar build -p <port number>
Options
--mode, -m App mode [spa|ssr|pwa|cordova|electron] (default: spa)
--target, -T App target
- Cordova (default: all installed)
[android|ios|blackberry10|browser|osx|ubuntu|webos|windows]
- Electron with default "electron-packager" bundler (default: yours)
[darwin|win32|linux|mas|all]
- Electron with "electron-builder" bundler (default: yours)
[darwin|mac|win32|win|linux|all]
--debug, -d Build for debugging purposes
--help, -h Displays this message
ONLY for Electron mode:
--bundler, -b Bundler (electron-packager or electron-builder)
[packager|builder]
--arch, -A App architecture (default: yours)
- with default "electron-packager" bundler:
[ia32|x64|armv7l|arm64|mips64el|all]
- with "electron-builder" bundler:
[ia32|x64|armv7l|arm64|all]
`)
process.exit(0)
}

const chalk = require('chalk')

const
logger = require('../lib/helpers/logger'),
log = logger('app:build'),
warn = logger('app:build', 'red'),
banner = require('../lib/helpers/banner')

require('../lib/helpers/ensure-argv')(argv, 'build')
banner(argv, 'build')

if (argv.mode !== 'spa') {
require('../lib/mode/install-missing')(argv.mode, argv.target)
}

const
path = require('path'),
webpack = require('webpack')

const
QuasarConfig = require('../lib/quasar-config'),
Generator = require('../lib/generator'),
artifacts = require('../lib/artifacts'),
ensureDeps = require('../lib/helpers/ensure-deps')

function parseWebpackConfig (webpackConfig, mode) {
if (mode === 'ssr') {
return [ webpackConfig.server, webpackConfig.client ]
}
if (mode === 'electron') {
return [ webpackConfig.renderer, webpackConfig.main ]
}
return webpackConfig
}

function finalize (mode, quasarConfig) {
if (mode === 'cordova') {
return require('../lib/cordova').build(quasarConfig)
}
if (mode === 'electron') {
return require('../lib/electron').build(quasarConfig)
}

return Promise.resolve()
}

async function build () {
const quasarConfig = new QuasarConfig({
mode: argv.mode,
target: argv.target,
arch: argv.arch,
bundler: argv.bundler,
debug: argv.debug,
prod: true
})

try {
await quasarConfig.prepare()
}
catch (e) {
console.log(e)
warn(`⚠️ [FAIL] quasar.conf.js has JS errors`)
process.exit(1)
}

quasarConfig.compile()

const
generator = new Generator(quasarConfig),
webpackConfig = quasarConfig.getWebpackConfig(),
buildConfig = quasarConfig.getBuildConfig(),
mode = argv.mode.toUpperCase(),
outputFolder = buildConfig.build.packagedElectronDist || buildConfig.build.distDir

artifacts.clean(outputFolder)
generator.prepare()
generator.build()

log(chalk.bold(`Building...`))

webpack(parseWebpackConfig(webpackConfig, argv.mode), (err, stats) => {
if (err) { throw err }

artifacts.add(outputFolder)

statsArray = stats.stats || [ stats ]
statsArray.forEach(stat => {
process.stdout.write('\n\n' + stat.toString({
colors: true,
performance: false,
hash: false,
assets: true,
chunks: false,
chunkModules: false,
chunkOrigins: false,
modules: false,
nestedModules: false,
moduleAssets: false,
children: false
}) + '\n\n')
})

statsArray.forEach(stat => {
if (stat.hasErrors()) {
warn()
warn(chalk.red('[FAIL] Build failed with errors. Check log above.'))
warn()

process.exit(1)
}
})

finalize(argv.mode, quasarConfig).then(() => {
banner(argv, 'build', {
outputFolder: argv.mode === 'cordova'
? path.join(outputFolder, '..')
: outputFolder
})
})
})
}

ensureDeps()
build()
35 changes: 35 additions & 0 deletions app/bin/quasar-clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env node

const
parseArgs = require('minimist'),
path = require('path'),
chalk = require('chalk')

const
appPaths = require('../lib/app-paths'),
log = require('../lib/helpers/logger')('app:clean')

const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help'
},
boolean: ['h']
})

if (argv.help) {
console.log(`
Description
Cleans all build artifacts
Usage
$ quasar clean
Options
--help, -h Displays this message
`)
process.exit(0)
}

require('../lib/artifacts').cleanAll()

console.log()
log(`Done cleaning build artifacts`)
log()
Loading

0 comments on commit 7186dab

Please sign in to comment.