cc1-ui 0.0.2 → 0.0.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.
@@ -1,41 +1,5 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.UIAuto = UIAuto;
37
- const path = __importStar(require("path"));
38
- const util_1 = require("./util");
1
+ import * as path from 'path';
2
+ import { readDir, readFile } from './util';
39
3
  let btime = new Date().getTime();
40
4
  const log = (str, time = false) => {
41
5
  console.log('');
@@ -95,9 +59,9 @@ const getName = () => {
95
59
  return names[Math.floor(Math.random() * names.length)];
96
60
  };
97
61
  const init = async () => {
98
- await (0, util_1.readDir)(conf.src, async (location) => {
62
+ await readDir(conf.src, async (location) => {
99
63
  if (location.substring(location.length - 3) === 'vue') {
100
- const ctx = await (0, util_1.readFile)(location);
64
+ const ctx = await readFile(location);
101
65
  if (ctx) {
102
66
  const tags = extractTags(ctx);
103
67
  tags.forEach((tag) => {
@@ -124,7 +88,7 @@ const init = async () => {
124
88
  conf.use = [...new Set(conf.use)];
125
89
  log(`🥰🥰【${getName()}】:使用组件列表 => ${conf.use.join(',')}`);
126
90
  };
127
- function UIAuto(config) {
91
+ export function UIAuto(config) {
128
92
  conf.config = config;
129
93
  const isBuild = config.isBuild;
130
94
  return {
package/dist/index.d.ts CHANGED
@@ -12,14 +12,14 @@ export {}
12
12
  /* prettier-ignore */
13
13
  declare module 'vue' {
14
14
  export interface GlobalComponents {
15
- VButton:typeof import('./components/Button/index.vue')['default']
16
15
  VCircle:typeof import('./components/Circle/index.vue')['default']
17
- VMask:typeof import('./components/Mask/index.vue')['default']
16
+ VButton:typeof import('./components/Button/index.vue')['default']
18
17
  VIcon:typeof import('./components/Icon/index.vue')['default']
18
+ VMask:typeof import('./components/Mask/index.vue')['default']
19
19
  VSIcon:typeof import('./components/SIcon/index.vue')['default']
20
+ VScale:typeof import('./components/Scale/index.vue')['default']
20
21
  VSelect:typeof import('./components/Select/index.vue')['default']
21
22
  VSwitch:typeof import('./components/Switch/index.vue')['default']
22
- VScale:typeof import('./components/Scale/index.vue')['default']
23
23
  }
24
24
  export interface ComponentCustomProperties {
25
25
  }
package/dist/util.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const readDir: (dirurl: string, filecallback: Function) => Promise<boolean>;
2
+ export declare const readFile: (filename: string) => Promise<string>;
3
+ export declare const writeFile: (filename: string, content: string) => Promise<boolean>;
4
+ export declare const copyDirOrFile: (sourcePath: string, destinationPath: string) => Promise<void>;
5
+ export declare const deleteDirOrFile: (dirOrFilePath: string) => Promise<void>;
package/dist/util.js ADDED
@@ -0,0 +1,72 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ export const readDir = async (dirurl, filecallback) => {
4
+ const dirInfo = fs.readdirSync(dirurl);
5
+ for (let i = 0; i < dirInfo.length; i++) {
6
+ const item = dirInfo[i];
7
+ const location = path.join(dirurl, item);
8
+ const info = fs.statSync(location);
9
+ if (info.isDirectory()) {
10
+ if ((await readDir(location, filecallback)) === true)
11
+ return true;
12
+ }
13
+ else {
14
+ if ((await filecallback(location)) === true)
15
+ return true;
16
+ }
17
+ }
18
+ };
19
+ export const readFile = async (filename) => {
20
+ try {
21
+ return fs.readFileSync(filename).toString();
22
+ }
23
+ catch {
24
+ return undefined;
25
+ }
26
+ };
27
+ export const writeFile = async (filename, content) => {
28
+ try {
29
+ fs.mkdirSync(path.dirname(filename), {
30
+ recursive: true
31
+ });
32
+ fs.writeFileSync(filename, content);
33
+ return true;
34
+ }
35
+ catch {
36
+ return undefined;
37
+ }
38
+ };
39
+ export const copyDirOrFile = async (sourcePath, destinationPath) => {
40
+ const stats = fs.statSync(sourcePath);
41
+ if (stats.isDirectory()) {
42
+ if (!fs.existsSync(destinationPath)) {
43
+ fs.mkdirSync(destinationPath, { recursive: true });
44
+ }
45
+ const files = fs.readdirSync(sourcePath);
46
+ for (const file of files) {
47
+ const sourceFile = path.join(sourcePath, file);
48
+ const destinationFile = path.join(destinationPath, file);
49
+ await copyDirOrFile(sourceFile, destinationFile);
50
+ }
51
+ }
52
+ else {
53
+ fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
54
+ fs.copyFileSync(sourcePath, destinationPath);
55
+ }
56
+ };
57
+ export const deleteDirOrFile = async (dirOrFilePath) => {
58
+ if (fs.existsSync(dirOrFilePath)) {
59
+ const stat = fs.lstatSync(dirOrFilePath);
60
+ if (stat.isDirectory()) {
61
+ const files = fs.readdirSync(dirOrFilePath);
62
+ for (const file of files) {
63
+ const curPath = path.join(dirOrFilePath, file);
64
+ await deleteDirOrFile(curPath);
65
+ }
66
+ fs.rmdirSync(dirOrFilePath);
67
+ }
68
+ else {
69
+ fs.unlinkSync(dirOrFilePath);
70
+ }
71
+ }
72
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-ui",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "我来助你-Vue3UI库",
5
5
  "repository": {
6
6
  "type": "git",