Skip to content

Commit f857a18

Browse files
committed
Update default base paths
1 parent d01bca0 commit f857a18

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

bin/lint.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ const es = async (file = GLOBS.find(g => g.includes(EXT_ES))) => {
4444
try {
4545
let eslinter = new eslint(config.eslint).executeOnFiles([file]);
4646

47-
if (eslinter.errorCount) {
47+
if (eslinter.errorCount || eslinter.warningCount) {
4848
eslinter.results.forEach((item) => {
4949
if (item.messages.length) {
5050
if (args.nondescript || args.silent) {
5151
cnsl.lint(`${alerts.str.path(item.filePath)}`);
5252
} else {
53-
cnsl.lint(`${alerts.info} Suggestions for ${alerts.str.path(item.filePath)}`);
53+
cnsl.lint(`${alerts.info} ESLint suggestions for ${alerts.str.path(item.filePath)}`);
5454
}
5555

5656
item.messages.forEach((message) => {
@@ -85,15 +85,15 @@ const style = async (file = GLOBS.find(g => g.includes(EXT_STYLE))) => {
8585
})
8686

8787
if (data.errored) {
88-
JSON.parse(data.output).forEach((item) => {
88+
data.results.forEach((item) => {
8989
if (item.errored) {
9090
if (args.nondescript || args.silent) {
9191
cnsl.lint(`${alerts.str.path(item.source)}`);
9292
} else {
93-
cnsl.lint(`${alerts.info} Lint suggestions for ${alerts.str.path(item.source)}`);
93+
cnsl.lint(`${alerts.info} stylelint suggestions for ${alerts.str.path(item.source)}`);
9494
}
9595

96-
item.warnings.forEach((warning) => {
96+
item.warnings.forEach(warning => {
9797
let capture = /\(([^)]+)\)/;
9898
let ruleId = capture.exec(warning.text)[1];
9999

@@ -103,6 +103,18 @@ const style = async (file = GLOBS.find(g => g.includes(EXT_STYLE))) => {
103103
`${warning.text.split(' (')[0]}. ${alerts.str.comment(ruleId)}`
104104
].join('\t'));
105105
});
106+
107+
item.invalidOptionWarnings.forEach(warning => {
108+
cnsl.lint(`${alerts.str.comment('lint.js')}\t${alerts.str.warning('warn')}\t${warning.text}`);
109+
});
110+
111+
item.deprecations.forEach(warning => {
112+
cnsl.lint(`${alerts.str.comment('n/a')}\t${alerts.str.warning('warn')}\t${JSON.stringify(warning)}`);
113+
});
114+
115+
item.parseErrors.forEach(warning => {
116+
cnsl.lint(`${alerts.str.comment('n/a')}\t${alerts.str.error('error')}\t${JSON.stringify(warning)}`);
117+
});
106118
}
107119
});
108120
}

bin/serve.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ const alerts = resolve('config/alerts');
2525
const PORT = process.env.PORT || '7000';
2626
const DIST = path.join(process.env.PWD, 'dist');
2727
const GLOBS = [
28-
'./dist/**/*.html',
29-
'./dist/**/*.css',
30-
'./dist/**/*.js'
28+
`${DIST}/**/*.html`,
29+
`${DIST}/**/*.css`,
30+
`${DIST}/**/*.js`
3131
];
3232

3333
/**
@@ -82,7 +82,7 @@ const main = async (app = APP) => {
8282
server.listen(app.get('port'), () => {
8383
let port = app.get('port');
8484

85-
cnsl.notify(`${alerts.info} Serving ${alerts.str.path('./dist/')} to ${alerts.str.url('http://localhost:' + port)}`);
85+
cnsl.notify(`${alerts.info} Serving ${alerts.str.path(DIST)} to ${alerts.str.url('http://localhost:' + port)}`);
8686
});
8787
};
8888

bin/util/console.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const PKG = '@pttrn';
1818

1919
const replace = (str) => {
2020
let pwd = new RegExp(process.env.PWD, 'g');
21-
let file = new RegExp(`file://`, 'g');
21+
let file = new RegExp('file://', 'g');
2222
let pkg = new RegExp(`./node_modules/${package.name}`, 'g');
2323

2424
return str
25-
.replace(pwd, PWD)
2625
.replace(file, '')
26+
.replace(pwd, PWD)
2727
.replace(pkg, PKG);
2828
};
2929

config/rollup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let plugins = [
2020
replace({
2121
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
2222
}),
23-
nodeResolve({
23+
nodeResolve.nodeResolve({
2424
browser: true,
2525
customResolveOptions: {
2626
moduleDirectory: 'node_modules'
@@ -35,9 +35,9 @@ let plugins = [
3535
*/
3636
module.exports = [
3737
{
38-
input: path.join(global.src, global.entry.scripts),
38+
input: path.join(global.base, global.src, global.entry.scripts),
3939
output: [{
40-
file: path.join(global.dist, global.entry.scripts),
40+
file: path.join(global.base, global.dist, global.entry.scripts),
4141
name: global.entry.name,
4242
sourcemap: (process.env.NODE_ENV === 'production') ? false : 'inline',
4343
format: 'iife',

config/sass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const global = resolve('config/global');
1414
module.exports = [
1515
{
1616
file: path.join(global.base, global.src, global.entry.styles),
17-
outDir: path.join(global.dist, 'css') + '/',
17+
outDir: path.join(global.base, global.dist, 'css') + '/',
1818
outFile: path.basename(global.entry.styles.replace('.scss', '.css')),
1919
sourceMapEmbed: true,
2020
includePaths: [

0 commit comments

Comments
 (0)