-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPonfile.dev.js
More file actions
85 lines (82 loc) · 2.21 KB
/
Ponfile.dev.js
File metadata and controls
85 lines (82 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* Pon dev tasks
* @file Ponfile
* @see https://gitlab.com/realglobe-Inc/pon
*/
'use strict'
const pon = require('pon')
const {
command: {
spawn: { npx },
},
} = require('pon-task-basic')
const { mocha } = require('pon-task-dev')
const theCode = require('@the-/code/pon')
const pkgInstall = require('./misc/tasks/pkgInstall')
const pkgPublish = require('./misc/tasks/pkgPublish')
const pkgRun = require('./misc/tasks/pkgRun')
const pkgSync = require('./misc/tasks/pkgSync')
const { cwd, tasks } = require('./Ponfile')
const eslint = (dirname, options = {}) => {
const { fix = false } = options
return npx(
'eslint',
__dirname,
'--cache',
'--ext',
'.jsx,.js',
...(fix ? ['--fix'] : []),
)
}
const SUB_PACKAGES = 'packages/*/package.json'
module.exports = pon({
$cwd: cwd,
$dev: true,
'eslint:check': eslint(__dirname),
'eslint:fix': eslint(__dirname, { fix: true }),
...tasks, // From Ponfile.js
'format:packages': theCode(
[
'packages/*/+(bin|example|doc|lib|misc|test|handy|presets)/**/+(*.js|*.jsx)',
'packages/*/+(bin|example|doc|lib|misc|test|handy|presets)/**/.*.bud',
'packages/*/.*.bud',
],
{
ignore: [
'**/node_modules/**/*.*',
'**/shim/**/*.*',
'**/tmp/**/*.*',
'**/demo/bundle.js',
'**/var/**/*.*',
'**/*.min.js',
],
},
),
'format:root': theCode([
'.*.bud',
'.travis.yml',
'+(misc)/**/*.*',
'*.js',
'package.json',
]),
'pkg:install': pkgInstall(SUB_PACKAGES),
'pkg:publish': pkgPublish(SUB_PACKAGES),
'pkg:run:build': pkgRun(SUB_PACKAGES, 'build'),
'pkg:run:doc': pkgRun(SUB_PACKAGES, 'doc'),
'pkg:run:test': pkgRun(SUB_PACKAGES, 'test'),
'pkg:sync': pkgSync('package.json', SUB_PACKAGES),
'test:root': mocha('test/**/*Test.js'),
build: [...tasks.build, 'pkg:run:build', 'format'],
doc: ['pkg:run:doc'],
f: 'format',
format: ['format:root', 'format:packages'],
install: ['pkg:install'],
/** Shortcut for 'lint` task */
l: 'lint',
lint: ['eslint:fix', 'eslint:check'],
prepare: [...tasks.prepare, 'pkg:sync', 'lint'],
publish: ['pkg:sync', 'pkg:publish'],
/** Shortcut for 'test` task */
t: 'test',
test: ['test:root', 'pkg:run:test'],
})