@jamesblanksby/toolkit 1.5.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,11 +4,11 @@ import url from 'url';
4
4
  import { ESLint } from 'eslint';
5
5
  import uglifyjs from 'uglify-js';
6
6
 
7
- import { MemoryFile } from './../src/file.js';
7
+ import { MemoryFile } from '../src/file.js';
8
8
 
9
9
  const { PWD, } = process.env;
10
10
 
11
- async function scriptLint(files) {
11
+ async function jsLint(files) {
12
12
  const configDir = path.dirname(url.fileURLToPath(import.meta.url));
13
13
 
14
14
  const eslint = new ESLint({
@@ -35,7 +35,7 @@ async function scriptLint(files) {
35
35
  console.log(result);
36
36
  }
37
37
 
38
- async function* scriptMinify(files) {
38
+ async function* jsMinify(files) {
39
39
  for await (let file of files) {
40
40
  file = await file.read();
41
41
 
@@ -52,6 +52,6 @@ async function* scriptMinify(files) {
52
52
  }
53
53
 
54
54
  export {
55
- scriptLint,
56
- scriptMinify,
55
+ jsLint,
56
+ jsMinify,
57
57
  };
package/build/shopify.js CHANGED
@@ -56,7 +56,7 @@ export default async function* shopifyFlatten(files) {
56
56
  file = flattenAsset(file, 'font');
57
57
  } else if (file.path.includes('/gfx/')) {
58
58
  file = flattenAsset(file, 'gfx');
59
- } else if (file.path.includes('/script/')) {
59
+ } else if (file.path.match(/\/(js|script)\//)) {
60
60
  file = flattenScript(file);
61
61
  } else {
62
62
  file = new MemoryFile(path.basename(file.path), file.contents);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamesblanksby/toolkit",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
package/toolkit.config.js CHANGED
@@ -3,7 +3,7 @@ import browsersync from 'browser-sync';
3
3
  import browserReload from './build/browser.js';
4
4
  import cssTransform from './build/css.js';
5
5
  import sassCompile from './build/sass.js';
6
- import { scriptLint, scriptMinify } from './build/script.js';
6
+ import { jsLint, jsMinify } from './build/js.js';
7
7
  import shopifyFlatten from './build/shopify.js';
8
8
 
9
9
  import { parallel, series, src, watch } from './index.js';
@@ -14,7 +14,7 @@ const pattern = {
14
14
  html: `${PWD}/**/*.{html,php}`,
15
15
  sass: `${PWD}/**/{sass,scss}/**/*.{sass,scss}`,
16
16
  css: `${PWD}/**/css/**/*.css`,
17
- script: `${PWD}/**/script/**/*.js`,
17
+ js: `${PWD}/**/{js,script}/**/*.js`,
18
18
  };
19
19
 
20
20
  function sync() {
@@ -47,17 +47,17 @@ function observe() {
47
47
  watch(pattern.html, reload);
48
48
  watch(pattern.sass, series(sass, css));
49
49
  watch(pattern.css, reload);
50
- watch(pattern.script, reload);
50
+ watch(pattern.js, reload);
51
51
  }
52
52
 
53
53
  function lint() {
54
- return src(pattern.script, { ignore: ['**.min.js',], })
55
- .pipe(scriptLint);
54
+ return src(pattern.js, { ignore: ['**.min.js',], })
55
+ .pipe(jsLint);
56
56
  }
57
57
 
58
58
  function minify() {
59
- return src(pattern.script, { ignore: ['**.min.js',], })
60
- .pipe(scriptMinify)
59
+ return src(pattern.js, { ignore: ['**.min.js',], })
60
+ .pipe(jsMinify)
61
61
  .dest();
62
62
  }
63
63
 
@@ -67,7 +67,7 @@ async function shopify() {
67
67
 
68
68
  await src(`${shopifyDir}/**`).rm().toArray();
69
69
 
70
- return src(`${assetDir}/**/(css|font|gfx|plugin|script)/**`, { ignore: '**/node_modules/**', })
70
+ return src(`${assetDir}/**/(css|font|gfx|js|plugin|script)/**`, { ignore: '**/node_modules/**', })
71
71
  .pipe(shopifyFlatten)
72
72
  .dest(shopifyDir);
73
73
  }