@weapp-tailwindcss/cli 1.0.6 → 1.0.8

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.6";
91
+ const version = "1.0.8";
92
92
 
93
93
  const debug = createDebug__default("weapp-tw-cli");
94
94
 
@@ -657,7 +657,8 @@ async function getTasks(options) {
657
657
  return function JsTask() {
658
658
  const pipes = [];
659
659
  if (loadTs && gulpTs) {
660
- pipes.push(gulpTs());
660
+ pipes.push(gulpTs().on("error", () => {
661
+ }));
661
662
  }
662
663
  pipes.push(transformJs({
663
664
  babelParserOptions: !enableTs && isTs ? {
@@ -724,7 +725,7 @@ async function getTasks(options) {
724
725
  if (postcssOptions) {
725
726
  pipes.push(postcssrc__default(postcssOptions?.plugins, postcssOptions?.options));
726
727
  }
727
- if (x === "scss") {
728
+ if (x === "scss" && !enableSass) {
728
729
  pipes.push(transformWxss({
729
730
  postcssOptions: {
730
731
  options: {
@@ -828,23 +829,29 @@ async function createBuilder(options) {
828
829
  }
829
830
  debug("run tasks end");
830
831
  }
831
- const { clean, outDir, root: cwd, watchOptions } = opt;
832
+ const { clean: clean2, outDir, root: cwd, watchOptions } = opt;
833
+ async function doClean() {
834
+ debug("del start");
835
+ const { deleteAsync } = await import('del');
836
+ const patterns = [`${outDir}/**`];
837
+ await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
838
+ debug("del end");
839
+ }
832
840
  return {
833
841
  watcher: void 0,
834
842
  async build() {
835
- if (clean) {
836
- debug("del start");
837
- const { deleteAsync } = await import('del');
838
- const patterns = [`${outDir}/**`];
839
- await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
840
- debug("del end");
843
+ if (clean2) {
844
+ await doClean();
841
845
  }
842
- fs.ensureDirSync(path__default.resolve(cwd, outDir));
846
+ await fs.ensureDir(path__default.resolve(cwd, outDir));
843
847
  await runTasks();
844
848
  return this;
845
849
  },
846
- watch() {
847
- fs.ensureDirSync(path__default.resolve(cwd, outDir));
850
+ async watch() {
851
+ if (clean2) {
852
+ await doClean();
853
+ }
854
+ await fs.ensureDir(path__default.resolve(cwd, outDir));
848
855
  const dumps = globsSet.dump();
849
856
  const arr = (Array.isArray(watchOptions.ignored) ? watchOptions.ignored : [watchOptions.ignored]).filter(
850
857
  Boolean
@@ -880,7 +887,8 @@ async function createBuilder(options) {
880
887
  this.watcher = watcher;
881
888
  return this;
882
889
  },
883
- globsSet
890
+ globsSet,
891
+ clean: doClean
884
892
  };
885
893
  }
886
894
  async function build(options) {
@@ -891,6 +899,10 @@ async function watch(options) {
891
899
  const builder = await createBuilder(options);
892
900
  return await builder.watch();
893
901
  }
902
+ async function clean(options) {
903
+ const builder = await createBuilder(options);
904
+ return await builder.clean();
905
+ }
894
906
 
895
907
  function createConfigLoader(root) {
896
908
  const explorer = cosmiconfig.cosmiconfigSync("weapp-tw");
@@ -1038,6 +1050,13 @@ function createCli() {
1038
1050
  root: cwd
1039
1051
  });
1040
1052
  });
1053
+ program.command("clean").action(async () => {
1054
+ await clean(
1055
+ defu(userDefinedConfig?.config, {
1056
+ root: cwd
1057
+ })
1058
+ );
1059
+ });
1041
1060
  return program;
1042
1061
  }
1043
1062
 
package/dist/index.d.cts CHANGED
@@ -130,20 +130,23 @@ type UserConfig = Partial<BuildOptions>;
130
130
  declare function createBuilder(options?: Partial<BuildOptions>): Promise<{
131
131
  watcher: FSWatcher | undefined;
132
132
  build(): Promise<any>;
133
- watch(): any;
133
+ watch(): Promise<any>;
134
134
  globsSet: GlobsSet;
135
+ clean: () => Promise<void>;
135
136
  }>;
136
137
  declare function build(options?: Partial<BuildOptions>): Promise<{
137
138
  watcher: FSWatcher | undefined;
138
139
  build(): Promise<any>;
139
- watch(): any;
140
+ watch(): Promise<any>;
140
141
  globsSet: GlobsSet;
142
+ clean: () => Promise<void>;
141
143
  }>;
142
144
  declare function watch(options?: Partial<BuildOptions>): Promise<{
143
145
  watcher: FSWatcher | undefined;
144
146
  build(): Promise<any>;
145
- watch(): any;
147
+ watch(): Promise<any>;
146
148
  globsSet: GlobsSet;
149
+ clean: () => Promise<void>;
147
150
  }>;
148
151
 
149
152
  interface WeappTwCosmiconfigResult {
package/dist/index.d.mts CHANGED
@@ -130,20 +130,23 @@ type UserConfig = Partial<BuildOptions>;
130
130
  declare function createBuilder(options?: Partial<BuildOptions>): Promise<{
131
131
  watcher: FSWatcher | undefined;
132
132
  build(): Promise<any>;
133
- watch(): any;
133
+ watch(): Promise<any>;
134
134
  globsSet: GlobsSet;
135
+ clean: () => Promise<void>;
135
136
  }>;
136
137
  declare function build(options?: Partial<BuildOptions>): Promise<{
137
138
  watcher: FSWatcher | undefined;
138
139
  build(): Promise<any>;
139
- watch(): any;
140
+ watch(): Promise<any>;
140
141
  globsSet: GlobsSet;
142
+ clean: () => Promise<void>;
141
143
  }>;
142
144
  declare function watch(options?: Partial<BuildOptions>): Promise<{
143
145
  watcher: FSWatcher | undefined;
144
146
  build(): Promise<any>;
145
- watch(): any;
147
+ watch(): Promise<any>;
146
148
  globsSet: GlobsSet;
149
+ clean: () => Promise<void>;
147
150
  }>;
148
151
 
149
152
  interface WeappTwCosmiconfigResult {
package/dist/index.d.ts CHANGED
@@ -130,20 +130,23 @@ type UserConfig = Partial<BuildOptions>;
130
130
  declare function createBuilder(options?: Partial<BuildOptions>): Promise<{
131
131
  watcher: FSWatcher | undefined;
132
132
  build(): Promise<any>;
133
- watch(): any;
133
+ watch(): Promise<any>;
134
134
  globsSet: GlobsSet;
135
+ clean: () => Promise<void>;
135
136
  }>;
136
137
  declare function build(options?: Partial<BuildOptions>): Promise<{
137
138
  watcher: FSWatcher | undefined;
138
139
  build(): Promise<any>;
139
- watch(): any;
140
+ watch(): Promise<any>;
140
141
  globsSet: GlobsSet;
142
+ clean: () => Promise<void>;
141
143
  }>;
142
144
  declare function watch(options?: Partial<BuildOptions>): Promise<{
143
145
  watcher: FSWatcher | undefined;
144
146
  build(): Promise<any>;
145
- watch(): any;
147
+ watch(): Promise<any>;
146
148
  globsSet: GlobsSet;
149
+ clean: () => Promise<void>;
147
150
  }>;
148
151
 
149
152
  interface WeappTwCosmiconfigResult {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import process from 'node:process';
2
2
  import { Command } from 'commander';
3
3
  import path from 'node:path';
4
- import fs, { ensureDirSync } from 'fs-extra';
4
+ import fs, { ensureDir } from 'fs-extra';
5
5
  import gulp from 'gulp';
6
6
  import loadPostcssConfig from 'postcss-load-config';
7
7
  import pc from 'picocolors';
@@ -71,7 +71,7 @@ function createDefu(merger) {
71
71
  }
72
72
  const defu = createDefu();
73
73
 
74
- const version = "1.0.6";
74
+ const version = "1.0.8";
75
75
 
76
76
  const debug = createDebug("weapp-tw-cli");
77
77
 
@@ -640,7 +640,8 @@ async function getTasks(options) {
640
640
  return function JsTask() {
641
641
  const pipes = [];
642
642
  if (loadTs && gulpTs) {
643
- pipes.push(gulpTs());
643
+ pipes.push(gulpTs().on("error", () => {
644
+ }));
644
645
  }
645
646
  pipes.push(transformJs({
646
647
  babelParserOptions: !enableTs && isTs ? {
@@ -707,7 +708,7 @@ async function getTasks(options) {
707
708
  if (postcssOptions) {
708
709
  pipes.push(postcssrc(postcssOptions?.plugins, postcssOptions?.options));
709
710
  }
710
- if (x === "scss") {
711
+ if (x === "scss" && !enableSass) {
711
712
  pipes.push(transformWxss({
712
713
  postcssOptions: {
713
714
  options: {
@@ -811,23 +812,29 @@ async function createBuilder(options) {
811
812
  }
812
813
  debug("run tasks end");
813
814
  }
814
- const { clean, outDir, root: cwd, watchOptions } = opt;
815
+ const { clean: clean2, outDir, root: cwd, watchOptions } = opt;
816
+ async function doClean() {
817
+ debug("del start");
818
+ const { deleteAsync } = await import('del');
819
+ const patterns = [`${outDir}/**`];
820
+ await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
821
+ debug("del end");
822
+ }
815
823
  return {
816
824
  watcher: void 0,
817
825
  async build() {
818
- if (clean) {
819
- debug("del start");
820
- const { deleteAsync } = await import('del');
821
- const patterns = [`${outDir}/**`];
822
- await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
823
- debug("del end");
826
+ if (clean2) {
827
+ await doClean();
824
828
  }
825
- ensureDirSync(path.resolve(cwd, outDir));
829
+ await ensureDir(path.resolve(cwd, outDir));
826
830
  await runTasks();
827
831
  return this;
828
832
  },
829
- watch() {
830
- ensureDirSync(path.resolve(cwd, outDir));
833
+ async watch() {
834
+ if (clean2) {
835
+ await doClean();
836
+ }
837
+ await ensureDir(path.resolve(cwd, outDir));
831
838
  const dumps = globsSet.dump();
832
839
  const arr = (Array.isArray(watchOptions.ignored) ? watchOptions.ignored : [watchOptions.ignored]).filter(
833
840
  Boolean
@@ -863,7 +870,8 @@ async function createBuilder(options) {
863
870
  this.watcher = watcher;
864
871
  return this;
865
872
  },
866
- globsSet
873
+ globsSet,
874
+ clean: doClean
867
875
  };
868
876
  }
869
877
  async function build(options) {
@@ -874,6 +882,10 @@ async function watch(options) {
874
882
  const builder = await createBuilder(options);
875
883
  return await builder.watch();
876
884
  }
885
+ async function clean(options) {
886
+ const builder = await createBuilder(options);
887
+ return await builder.clean();
888
+ }
877
889
 
878
890
  function createConfigLoader(root) {
879
891
  const explorer = cosmiconfigSync("weapp-tw");
@@ -1021,6 +1033,13 @@ function createCli() {
1021
1033
  root: cwd
1022
1034
  });
1023
1035
  });
1036
+ program.command("clean").action(async () => {
1037
+ await clean(
1038
+ defu(userDefinedConfig?.config, {
1039
+ root: cwd
1040
+ })
1041
+ );
1042
+ });
1024
1043
  return program;
1025
1044
  }
1026
1045
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "The cli of weapp-tailwindcss",
5
5
  "author": "SonOfMagic <qq1324318532@gmail.com>",
6
6
  "license": "MIT",