@weapp-tailwindcss/cli 1.0.5 → 1.0.6

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.
package/dist/index.cjs CHANGED
@@ -88,7 +88,7 @@ function createDefu(merger) {
88
88
  }
89
89
  const defu = createDefu();
90
90
 
91
- const version = "1.0.5";
91
+ const version = "1.0.6";
92
92
 
93
93
  const debug = createDebug__default("weapp-tw-cli");
94
94
 
@@ -610,12 +610,25 @@ async function getTasks(options) {
610
610
  const enableTs = Boolean(typescriptOptions);
611
611
  let sass;
612
612
  if (enableSass) {
613
+ if (!localPkg.isPackageExists("sass")) {
614
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `sass` \u540E\u91CD\u8BD5!");
615
+ }
613
616
  const sassLib = await import('sass');
614
617
  sass = createSass__default(sassLib);
615
618
  }
616
619
  let ts;
620
+ let gulpTs;
617
621
  if (enableTs) {
622
+ if (!localPkg.isPackageExists("typescript")) {
623
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `typescript` \u540E\u91CD\u8BD5!");
624
+ }
618
625
  ts = (await import('gulp-typescript')).default;
626
+ if (typeof typescriptOptions !== "boolean") {
627
+ gulpTs = ts.createProject(
628
+ typescriptOptions.tsConfigFileName ?? "tsconfig.json",
629
+ typescriptOptions.settings
630
+ );
631
+ }
619
632
  }
620
633
  const { transformJs, transformWxml, transformWxss } = gulp.createPlugins(weappTailwindcssOptions);
621
634
  const outDirGlobs = [`!${outDir}/**/*`, `!./${outDir}/**/*`];
@@ -641,16 +654,9 @@ async function getTasks(options) {
641
654
  globsSet.add(src);
642
655
  const isTs = isTsLang(x);
643
656
  const loadTs = enableTs && isTs;
644
- let gulpTs;
645
- if (enableTs && typeof typescriptOptions !== "boolean") {
646
- gulpTs = ts.createProject(
647
- typescriptOptions.tsConfigFileName ?? "tsconfig.json",
648
- typeof typescriptOptions === "boolean" ? {} : typescriptOptions
649
- );
650
- }
651
657
  return function JsTask() {
652
658
  const pipes = [];
653
- if (loadTs) {
659
+ if (loadTs && gulpTs) {
654
660
  pipes.push(gulpTs());
655
661
  }
656
662
  pipes.push(transformJs({
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import fs, { ensureDirSync } from 'fs-extra';
5
5
  import gulp from 'gulp';
6
6
  import loadPostcssConfig from 'postcss-load-config';
7
7
  import pc from 'picocolors';
8
- import { getPackageInfo } from 'local-pkg';
8
+ import { isPackageExists, getPackageInfo } from 'local-pkg';
9
9
  import createDebug from 'debug';
10
10
  import { createPlugins } from 'weapp-tailwindcss/gulp';
11
11
  import postcssrc from 'gulp-postcss';
@@ -71,7 +71,7 @@ function createDefu(merger) {
71
71
  }
72
72
  const defu = createDefu();
73
73
 
74
- const version = "1.0.5";
74
+ const version = "1.0.6";
75
75
 
76
76
  const debug = createDebug("weapp-tw-cli");
77
77
 
@@ -593,12 +593,25 @@ async function getTasks(options) {
593
593
  const enableTs = Boolean(typescriptOptions);
594
594
  let sass;
595
595
  if (enableSass) {
596
+ if (!isPackageExists("sass")) {
597
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `sass` \u540E\u91CD\u8BD5!");
598
+ }
596
599
  const sassLib = await import('sass');
597
600
  sass = createSass(sassLib);
598
601
  }
599
602
  let ts;
603
+ let gulpTs;
600
604
  if (enableTs) {
605
+ if (!isPackageExists("typescript")) {
606
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `typescript` \u540E\u91CD\u8BD5!");
607
+ }
601
608
  ts = (await import('gulp-typescript')).default;
609
+ if (typeof typescriptOptions !== "boolean") {
610
+ gulpTs = ts.createProject(
611
+ typescriptOptions.tsConfigFileName ?? "tsconfig.json",
612
+ typescriptOptions.settings
613
+ );
614
+ }
602
615
  }
603
616
  const { transformJs, transformWxml, transformWxss } = createPlugins(weappTailwindcssOptions);
604
617
  const outDirGlobs = [`!${outDir}/**/*`, `!./${outDir}/**/*`];
@@ -624,16 +637,9 @@ async function getTasks(options) {
624
637
  globsSet.add(src);
625
638
  const isTs = isTsLang(x);
626
639
  const loadTs = enableTs && isTs;
627
- let gulpTs;
628
- if (enableTs && typeof typescriptOptions !== "boolean") {
629
- gulpTs = ts.createProject(
630
- typescriptOptions.tsConfigFileName ?? "tsconfig.json",
631
- typeof typescriptOptions === "boolean" ? {} : typescriptOptions
632
- );
633
- }
634
640
  return function JsTask() {
635
641
  const pipes = [];
636
- if (loadTs) {
642
+ if (loadTs && gulpTs) {
637
643
  pipes.push(gulpTs());
638
644
  }
639
645
  pipes.push(transformJs({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "The cli of weapp-tailwindcss",
5
5
  "author": "SonOfMagic <qq1324318532@gmail.com>",
6
6
  "license": "MIT",