@weapp-tailwindcss/cli 0.0.0-alpha.2 → 0.0.0-alpha.4
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 +58 -34
- package/dist/index.mjs +58 -34
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -115,17 +115,19 @@ function getTasks(options) {
|
|
|
115
115
|
return extensions[assetType].map((x) => {
|
|
116
116
|
const src = `${base}**/*.${x}`;
|
|
117
117
|
globsSetAdd(src);
|
|
118
|
-
return ()
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
118
|
+
return function JsTask() {
|
|
119
|
+
return gulp__default.src([src, ...globs], { cwd, since: gulp__default.lastRun(JsTask) }).pipe(
|
|
120
|
+
transformJs({
|
|
121
|
+
babelParserOptions: x === "ts" ? {
|
|
122
|
+
plugins: ["typescript"]
|
|
123
|
+
} : void 0
|
|
124
|
+
})
|
|
125
|
+
).pipe(
|
|
126
|
+
gulp__default.dest(outDir, {
|
|
127
|
+
cwd
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
};
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
133
|
function getJsonTasks() {
|
|
@@ -135,11 +137,13 @@ function getTasks(options) {
|
|
|
135
137
|
return extensions[assetType].map((x) => {
|
|
136
138
|
const src = `${base}**/*.${x}`;
|
|
137
139
|
globsSetAdd(src);
|
|
138
|
-
return ()
|
|
139
|
-
gulp__default.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
return function JsonTask() {
|
|
141
|
+
return gulp__default.src([src, ...globs], { cwd, since: gulp__default.lastRun(JsonTask) }).pipe(
|
|
142
|
+
gulp__default.dest(outDir, {
|
|
143
|
+
cwd
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
};
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
149
|
function getCssTasks() {
|
|
@@ -149,11 +153,13 @@ function getTasks(options) {
|
|
|
149
153
|
return extensions[assetType].map((x) => {
|
|
150
154
|
const src = `${base}**/*.${x}`;
|
|
151
155
|
globsSetAdd(src);
|
|
152
|
-
return ()
|
|
153
|
-
gulp__default.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
return function CssTask() {
|
|
157
|
+
return gulp__default.src([src, ...globs], { cwd, since: gulp__default.lastRun(CssTask) }).pipe(transformWxss()).pipe(
|
|
158
|
+
gulp__default.dest(outDir, {
|
|
159
|
+
cwd
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
};
|
|
157
163
|
});
|
|
158
164
|
}
|
|
159
165
|
function getHtmlTasks() {
|
|
@@ -163,11 +169,13 @@ function getTasks(options) {
|
|
|
163
169
|
return extensions[assetType].map((x) => {
|
|
164
170
|
const src = `${base}**/*.${x}`;
|
|
165
171
|
globsSetAdd(src);
|
|
166
|
-
return ()
|
|
167
|
-
gulp__default.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
return function HtmlTask() {
|
|
173
|
+
return gulp__default.src([src, ...globs], { cwd, since: gulp__default.lastRun(HtmlTask) }).pipe(transformWxml()).pipe(
|
|
174
|
+
gulp__default.dest(outDir, {
|
|
175
|
+
cwd
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
};
|
|
171
179
|
});
|
|
172
180
|
}
|
|
173
181
|
function copyOthers() {
|
|
@@ -176,7 +184,7 @@ function getTasks(options) {
|
|
|
176
184
|
return `${base}${x}`;
|
|
177
185
|
});
|
|
178
186
|
globsSetAdd(globs);
|
|
179
|
-
return gulp__default.src(globs, { cwd }).pipe(
|
|
187
|
+
return gulp__default.src(globs, { cwd, since: gulp__default.lastRun(copyOthers) }).pipe(
|
|
180
188
|
gulp__default.dest(outDir, {
|
|
181
189
|
cwd
|
|
182
190
|
})
|
|
@@ -228,6 +236,9 @@ function createBuilder(options) {
|
|
|
228
236
|
html: ["wxml"],
|
|
229
237
|
css: ["wxss", "less", "sass", "scss"],
|
|
230
238
|
json: ["json"]
|
|
239
|
+
},
|
|
240
|
+
watchOptions: {
|
|
241
|
+
events: ["add", "change", "unlink", "ready"]
|
|
231
242
|
}
|
|
232
243
|
});
|
|
233
244
|
const { copyOthers, getCssTasks, getHtmlTasks, getJsTasks, getJsonTasks, globsSet } = getTasks({
|
|
@@ -242,6 +253,14 @@ function createBuilder(options) {
|
|
|
242
253
|
watchOptions
|
|
243
254
|
});
|
|
244
255
|
const tasks = [...getJsTasks(), ...getJsonTasks(), ...getCssTasks(), ...getHtmlTasks(), copyOthers];
|
|
256
|
+
async function runTasks() {
|
|
257
|
+
for (const task of tasks) {
|
|
258
|
+
const s = task();
|
|
259
|
+
if (s) {
|
|
260
|
+
await new Promise((resolve, reject) => s.on("finish", resolve).on("error", reject));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
245
264
|
return {
|
|
246
265
|
watcher: void 0,
|
|
247
266
|
async build() {
|
|
@@ -251,17 +270,19 @@ function createBuilder(options) {
|
|
|
251
270
|
await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
|
|
252
271
|
}
|
|
253
272
|
fs.ensureDirSync(path__default.resolve(cwd, outDir));
|
|
254
|
-
|
|
255
|
-
const s = task();
|
|
256
|
-
if (s) {
|
|
257
|
-
await new Promise((resolve, reject) => s.on("finish", resolve).on("error", reject));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
273
|
+
await runTasks();
|
|
260
274
|
return this;
|
|
261
275
|
},
|
|
262
276
|
watch() {
|
|
263
277
|
fs.ensureDirSync(path__default.resolve(cwd, outDir));
|
|
264
|
-
const watcher = gulp__default.watch([...globsSet], watchOptions,
|
|
278
|
+
const watcher = gulp__default.watch([...globsSet], watchOptions, async (cb) => {
|
|
279
|
+
try {
|
|
280
|
+
await runTasks();
|
|
281
|
+
cb();
|
|
282
|
+
} catch (error) {
|
|
283
|
+
cb(error);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
265
286
|
watcher.on("change", function(path2) {
|
|
266
287
|
console.log(`File ${path2} was changed`);
|
|
267
288
|
});
|
|
@@ -271,6 +292,9 @@ function createBuilder(options) {
|
|
|
271
292
|
watcher.on("unlink", function(path2) {
|
|
272
293
|
console.log(`File ${path2} was removed`);
|
|
273
294
|
});
|
|
295
|
+
watcher.on("ready", function() {
|
|
296
|
+
console.log(`Weapp-tailwindcss is Ready!`);
|
|
297
|
+
});
|
|
274
298
|
this.watcher = watcher;
|
|
275
299
|
return this;
|
|
276
300
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -106,17 +106,19 @@ function getTasks(options) {
|
|
|
106
106
|
return extensions[assetType].map((x) => {
|
|
107
107
|
const src = `${base}**/*.${x}`;
|
|
108
108
|
globsSetAdd(src);
|
|
109
|
-
return ()
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
return function JsTask() {
|
|
110
|
+
return gulp.src([src, ...globs], { cwd, since: gulp.lastRun(JsTask) }).pipe(
|
|
111
|
+
transformJs({
|
|
112
|
+
babelParserOptions: x === "ts" ? {
|
|
113
|
+
plugins: ["typescript"]
|
|
114
|
+
} : void 0
|
|
115
|
+
})
|
|
116
|
+
).pipe(
|
|
117
|
+
gulp.dest(outDir, {
|
|
118
|
+
cwd
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
};
|
|
120
122
|
});
|
|
121
123
|
}
|
|
122
124
|
function getJsonTasks() {
|
|
@@ -126,11 +128,13 @@ function getTasks(options) {
|
|
|
126
128
|
return extensions[assetType].map((x) => {
|
|
127
129
|
const src = `${base}**/*.${x}`;
|
|
128
130
|
globsSetAdd(src);
|
|
129
|
-
return ()
|
|
130
|
-
gulp.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
return function JsonTask() {
|
|
132
|
+
return gulp.src([src, ...globs], { cwd, since: gulp.lastRun(JsonTask) }).pipe(
|
|
133
|
+
gulp.dest(outDir, {
|
|
134
|
+
cwd
|
|
135
|
+
})
|
|
136
|
+
);
|
|
137
|
+
};
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
140
|
function getCssTasks() {
|
|
@@ -140,11 +144,13 @@ function getTasks(options) {
|
|
|
140
144
|
return extensions[assetType].map((x) => {
|
|
141
145
|
const src = `${base}**/*.${x}`;
|
|
142
146
|
globsSetAdd(src);
|
|
143
|
-
return ()
|
|
144
|
-
gulp.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
return function CssTask() {
|
|
148
|
+
return gulp.src([src, ...globs], { cwd, since: gulp.lastRun(CssTask) }).pipe(transformWxss()).pipe(
|
|
149
|
+
gulp.dest(outDir, {
|
|
150
|
+
cwd
|
|
151
|
+
})
|
|
152
|
+
);
|
|
153
|
+
};
|
|
148
154
|
});
|
|
149
155
|
}
|
|
150
156
|
function getHtmlTasks() {
|
|
@@ -154,11 +160,13 @@ function getTasks(options) {
|
|
|
154
160
|
return extensions[assetType].map((x) => {
|
|
155
161
|
const src = `${base}**/*.${x}`;
|
|
156
162
|
globsSetAdd(src);
|
|
157
|
-
return ()
|
|
158
|
-
gulp.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
return function HtmlTask() {
|
|
164
|
+
return gulp.src([src, ...globs], { cwd, since: gulp.lastRun(HtmlTask) }).pipe(transformWxml()).pipe(
|
|
165
|
+
gulp.dest(outDir, {
|
|
166
|
+
cwd
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
};
|
|
162
170
|
});
|
|
163
171
|
}
|
|
164
172
|
function copyOthers() {
|
|
@@ -167,7 +175,7 @@ function getTasks(options) {
|
|
|
167
175
|
return `${base}${x}`;
|
|
168
176
|
});
|
|
169
177
|
globsSetAdd(globs);
|
|
170
|
-
return gulp.src(globs, { cwd }).pipe(
|
|
178
|
+
return gulp.src(globs, { cwd, since: gulp.lastRun(copyOthers) }).pipe(
|
|
171
179
|
gulp.dest(outDir, {
|
|
172
180
|
cwd
|
|
173
181
|
})
|
|
@@ -219,6 +227,9 @@ function createBuilder(options) {
|
|
|
219
227
|
html: ["wxml"],
|
|
220
228
|
css: ["wxss", "less", "sass", "scss"],
|
|
221
229
|
json: ["json"]
|
|
230
|
+
},
|
|
231
|
+
watchOptions: {
|
|
232
|
+
events: ["add", "change", "unlink", "ready"]
|
|
222
233
|
}
|
|
223
234
|
});
|
|
224
235
|
const { copyOthers, getCssTasks, getHtmlTasks, getJsTasks, getJsonTasks, globsSet } = getTasks({
|
|
@@ -233,6 +244,14 @@ function createBuilder(options) {
|
|
|
233
244
|
watchOptions
|
|
234
245
|
});
|
|
235
246
|
const tasks = [...getJsTasks(), ...getJsonTasks(), ...getCssTasks(), ...getHtmlTasks(), copyOthers];
|
|
247
|
+
async function runTasks() {
|
|
248
|
+
for (const task of tasks) {
|
|
249
|
+
const s = task();
|
|
250
|
+
if (s) {
|
|
251
|
+
await new Promise((resolve, reject) => s.on("finish", resolve).on("error", reject));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
236
255
|
return {
|
|
237
256
|
watcher: void 0,
|
|
238
257
|
async build() {
|
|
@@ -242,17 +261,19 @@ function createBuilder(options) {
|
|
|
242
261
|
await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
|
|
243
262
|
}
|
|
244
263
|
ensureDirSync(path.resolve(cwd, outDir));
|
|
245
|
-
|
|
246
|
-
const s = task();
|
|
247
|
-
if (s) {
|
|
248
|
-
await new Promise((resolve, reject) => s.on("finish", resolve).on("error", reject));
|
|
249
|
-
}
|
|
250
|
-
}
|
|
264
|
+
await runTasks();
|
|
251
265
|
return this;
|
|
252
266
|
},
|
|
253
267
|
watch() {
|
|
254
268
|
ensureDirSync(path.resolve(cwd, outDir));
|
|
255
|
-
const watcher = gulp.watch([...globsSet], watchOptions,
|
|
269
|
+
const watcher = gulp.watch([...globsSet], watchOptions, async (cb) => {
|
|
270
|
+
try {
|
|
271
|
+
await runTasks();
|
|
272
|
+
cb();
|
|
273
|
+
} catch (error) {
|
|
274
|
+
cb(error);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
256
277
|
watcher.on("change", function(path2) {
|
|
257
278
|
console.log(`File ${path2} was changed`);
|
|
258
279
|
});
|
|
@@ -262,6 +283,9 @@ function createBuilder(options) {
|
|
|
262
283
|
watcher.on("unlink", function(path2) {
|
|
263
284
|
console.log(`File ${path2} was removed`);
|
|
264
285
|
});
|
|
286
|
+
watcher.on("ready", function() {
|
|
287
|
+
console.log(`Weapp-tailwindcss is Ready!`);
|
|
288
|
+
});
|
|
265
289
|
this.watcher = watcher;
|
|
266
290
|
return this;
|
|
267
291
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/cli",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.4",
|
|
4
4
|
"description": "The cli of weapp-tailwindcss",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"gulp-less": "^5.0.0",
|
|
30
30
|
"gulp-sass": "^5.1.0",
|
|
31
31
|
"postcss-load-config": "^5.0.3",
|
|
32
|
-
"weapp-tailwindcss": "3.2.0-alpha.
|
|
32
|
+
"weapp-tailwindcss": "3.2.0-alpha.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/fs-extra": "^11.0.4",
|