@gx-design-vue/create-gx-cli 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/create-gx-cli",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "license": "MIT",
5
5
  "description": "a cli to bootstrap gx project",
6
6
  "main": "src/index.js",
package/src/cli.js CHANGED
@@ -48,7 +48,7 @@ async function promptForMissingOptions(options) {
48
48
  type: options.projectName ? null : 'text',
49
49
  name: 'projectName',
50
50
  message: reset('Project name:'),
51
- initial: defaultTargetDir,
51
+ initial: defaultTargetDir
52
52
  },
53
53
  {
54
54
  type: options.template && TEMPLATES.includes(options.template) ? null : 'select',
@@ -56,7 +56,7 @@ async function promptForMissingOptions(options) {
56
56
  message:
57
57
  typeof options.template === 'string' && !TEMPLATES.includes(options.template)
58
58
  ? reset(
59
- `"${options.template}" isn't a valid template. Please choose from below: `,
59
+ `"${options.template}" isn't a valid template. Please choose from below: `
60
60
  )
61
61
  : reset('Select a Template:'),
62
62
  choices: FRAMEWORKS.map((framework) => {
package/src/main.js CHANGED
@@ -96,13 +96,13 @@ export async function createProject(options) {
96
96
  // 下载git代码
97
97
  download(`direct:${downloadGit.git}`, root, { clone: true }, async function(err) {
98
98
  if (err) {
99
- console.log(err)
100
99
  spinner.error({ text: '下载失败' })
101
100
  } else {
102
101
  await editPackageJson(root, options.projectName || getProjectName())
103
102
  spinner.success({
104
103
  text: '项目创建成功,请依次执行以下命令'
105
104
  })
105
+ fs.
106
106
  doneLog(cwd, root)
107
107
  }
108
108
  })
@@ -129,6 +129,7 @@ export async function createProject(options) {
129
129
  )
130
130
 
131
131
  await tasks.run()
132
+
132
133
  await editPackageJson(root)
133
134
  doneLog(cwd, root)
134
135
  }
@@ -0,0 +1,7 @@
1
+ import { resolve } from 'path'
2
+
3
+ export function generateModifyVars() {
4
+ return {
5
+ hack: `true; @import (reference) "${resolve('src/design/config.less')}";`
6
+ }
7
+ }
@@ -1,6 +1,5 @@
1
1
  // #!/usr/bin/env node
2
2
  import chalk from 'chalk'
3
- import { wrapperEnv, getEnvConfig } from '../utils'
4
3
 
5
4
  import pkg from '../../package.json'
6
5
 
@@ -11,7 +11,5 @@ declare module '@vue/runtime-core' {
11
11
  RouterView: typeof import('vue-router')['RouterView']
12
12
  VanButton: typeof import('vant/es')['Button']
13
13
  VanCell: typeof import('vant/es')['Cell']
14
- VanSwipe: typeof import('vant/es')['Swipe']
15
- VanSwipeItem: typeof import('vant/es')['SwipeItem']
16
14
  }
17
15
  }
@@ -5,8 +5,8 @@ declare global {
5
5
  pkg: {
6
6
  name: string;
7
7
  version: string;
8
- dependencies: Recordable<string>;
9
- devDependencies: Recordable<string>;
8
+ dependencies: RecordType;
9
+ devDependencies: RecordType;
10
10
  };
11
11
  lastBuildTime: string;
12
12
  }
@@ -19,7 +19,7 @@ declare global {
19
19
 
20
20
  declare type PropType<T> = VuePropType<T>;
21
21
 
22
- declare type RecordType<T = string, K = any> = Record<string, any>;
22
+ declare type RecordType<T = string, K = any> = Record<T, K>;
23
23
 
24
24
  declare interface ViteEnv {
25
25
  VITE_USE_MODE: string;
@@ -1,7 +1,5 @@
1
1
  /// <reference types="vite/client" />
2
2
 
3
- import { DefineComponent } from 'vue'
4
-
5
3
  declare module '*.vue' {
6
4
  import type { DefineComponent } from 'vue'
7
5
  const component: DefineComponent<{}, {}, any>
@@ -5,6 +5,7 @@ import dayjs from 'dayjs'
5
5
 
6
6
  import { configManualChunk } from './build/optimizer'
7
7
  import { createVitePlugins } from './build/plugin'
8
+ import { generateModifyVars } from './build/generateModifyVars'
8
9
 
9
10
  import pkg from './package.json'
10
11
 
@@ -52,7 +53,7 @@ export default ({ mode, command }: ConfigEnv): UserConfig => {
52
53
  // The boolean type read by loadEnv is a string. This function can be converted to boolean type
53
54
  const viteEnv = wrapperEnv(env)
54
55
 
55
- const { VITE_BASE_URL } = viteEnv
56
+ const { VITE_BASE_URL, VITE_DROP_CONSOLE } = viteEnv
56
57
 
57
58
  const isBuild = command === 'build'
58
59
 
@@ -85,15 +86,12 @@ export default ({ mode, command }: ConfigEnv): UserConfig => {
85
86
  __INTLIFY_PROD_DEVTOOLS__: false,
86
87
  __APP_INFO__: JSON.stringify(__APP_INFO__)
87
88
  },
89
+ esbuild: {
90
+ drop: VITE_DROP_CONSOLE ? [ 'console', 'debugger' ] : []
91
+ },
88
92
  build: {
89
93
  assetsDir: 'assets',
90
- target: 'es2015',
91
- cssTarget: 'chrome80',
92
- reportCompressedSize: false,
93
94
  chunkSizeWarningLimit: 2500,
94
- commonjsOptions: {
95
- ignoreTryCatch: false
96
- },
97
95
  rollupOptions: {
98
96
  output: {
99
97
  manualChunks: configManualChunk
@@ -106,6 +104,7 @@ export default ({ mode, command }: ConfigEnv): UserConfig => {
106
104
  },
107
105
  preprocessorOptions: {
108
106
  less: {
107
+ modifyVars: generateModifyVars(),
109
108
  javascriptEnabled: true
110
109
  }
111
110
  }