@weapp-core/init 2.1.5 → 3.0.0

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.
Files changed (29) hide show
  1. package/dist/index.cjs +491 -304
  2. package/dist/index.d.cts +71 -41
  3. package/dist/index.d.ts +71 -41
  4. package/dist/index.js +488 -301
  5. package/package.json +1 -1
  6. package/templates/default/gitignore +34 -0
  7. package/templates/default/package.json +2 -2
  8. package/templates/{tdesign/src/components/Navbar/Navbar.json → default/src/components/HelloWorld/HelloWorld.json} +1 -2
  9. package/templates/default/src/components/HelloWorld/HelloWorld.ts +1 -0
  10. package/templates/default/src/components/HelloWorld/HelloWorld.wxml +4 -0
  11. package/templates/default/src/pages/index/index.json +7 -0
  12. package/templates/default/src/pages/index/index.wxml +1 -1
  13. package/templates/tailwindcss/gitignore +34 -0
  14. package/templates/tailwindcss/package.json +3 -3
  15. package/templates/tdesign/gitignore +34 -0
  16. package/templates/tdesign/package.json +3 -3
  17. package/templates/{default/src/components/Navbar/Navbar.json → tdesign/src/components/HelloWorld/HelloWorld.json} +0 -1
  18. package/templates/tdesign/src/components/HelloWorld/HelloWorld.ts +5 -0
  19. package/templates/tdesign/src/components/HelloWorld/HelloWorld.wxml +7 -0
  20. package/templates/tdesign/src/pages/index/index.json +1 -1
  21. package/templates/tdesign/src/pages/index/index.wxml +6 -10
  22. package/templates/vant/gitignore +34 -0
  23. package/templates/vant/package.json +3 -3
  24. package/templates/default/src/components/Navbar/Navbar.ts +0 -3
  25. package/templates/default/src/components/Navbar/Navbar.wxml +0 -1
  26. package/templates/tdesign/src/components/Navbar/Navbar.ts +0 -3
  27. package/templates/tdesign/src/components/Navbar/Navbar.wxml +0 -0
  28. /package/templates/default/src/components/{Navbar/Navbar.scss → HelloWorld/HelloWorld.scss} +0 -0
  29. /package/templates/tdesign/src/components/{Navbar/Navbar.scss → HelloWorld/HelloWorld.scss} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,5 +1,4 @@
1
- import * as pkg_types from 'pkg-types';
2
- import { PackageJson } from 'pkg-types';
1
+ import { PackageJson, TSConfig } from 'pkg-types';
3
2
  import { set } from '@weapp-core/shared';
4
3
 
5
4
  interface SetMethod {
@@ -30,53 +29,84 @@ interface ProjectConfig {
30
29
  };
31
30
  }
32
31
 
33
- declare enum TemplateName {
34
- default = "default",
35
- tailwindcss = "tailwindcss",
36
- vant = "vant",
37
- tdesign = "tdesign"
32
+ interface ContextDocument<T> {
33
+ name: string;
34
+ path: string;
35
+ value: T | null;
36
+ }
37
+ interface Context {
38
+ projectConfig: ContextDocument<ProjectConfig>;
39
+ packageJson: ContextDocument<PackageJson>;
40
+ viteConfig: ContextDocument<string>;
41
+ tsconfig: ContextDocument<TSConfig>;
42
+ tsconfigNode: ContextDocument<TSConfig>;
43
+ dts: ContextDocument<string>;
38
44
  }
39
45
 
40
- declare function createOrUpdateProjectConfig(options: UpdateProjectConfigOptions): Promise<ProjectConfig | undefined>;
41
- declare function createOrUpdatePackageJson(options: UpdatePackageJsonOptions): Promise<PackageJson | undefined>;
42
46
  declare function initViteConfigFile(options: SharedUpdateOptions): Promise<string>;
43
47
  declare function initTsDtsFile(options: SharedUpdateOptions): Promise<string>;
44
- declare function initTsJsonFiles(options: SharedUpdateOptions): Promise<void>;
45
- declare function initConfig(options: {
46
- root?: string;
47
- command?: 'weapp-vite';
48
- }): Promise<{
49
- projectConfig: {
50
- name: string;
51
- path: string;
52
- value: ProjectConfig;
53
- };
54
- packageJson: {
55
- name: string;
56
- path: string;
57
- value: PackageJson;
58
- };
59
- viteConfig: {
60
- name: string;
61
- path: string;
62
- value: string;
63
- };
48
+ declare function initTsJsonFiles(options: SharedUpdateOptions): Promise<{
64
49
  tsconfig: {
65
- name: string;
66
- path: string;
67
- value: pkg_types.TSConfig;
50
+ compilerOptions: {
51
+ target: string;
52
+ jsx: string;
53
+ lib: string[];
54
+ useDefineForClassFields: boolean;
55
+ baseUrl: string;
56
+ module: string;
57
+ moduleResolution: string;
58
+ paths: {
59
+ '@/*': string[];
60
+ };
61
+ resolveJsonModule: boolean;
62
+ types: string[];
63
+ allowImportingTsExtensions: boolean;
64
+ allowJs: boolean;
65
+ strict: boolean;
66
+ noFallthroughCasesInSwitch: boolean;
67
+ noUnusedLocals: boolean;
68
+ noUnusedParameters: boolean;
69
+ noEmit: boolean;
70
+ isolatedModules: boolean;
71
+ skipLibCheck: boolean;
72
+ };
73
+ references: {
74
+ path: string;
75
+ }[];
76
+ include: string[];
77
+ exclude: string[];
68
78
  };
69
79
  tsconfigNode: {
70
- name: string;
71
- path: string;
72
- value: pkg_types.TSConfig;
73
- };
74
- dts: {
75
- name: string;
76
- path: string;
77
- value: string;
80
+ compilerOptions: {
81
+ composite: boolean;
82
+ module: string;
83
+ moduleResolution: string;
84
+ strict: boolean;
85
+ allowSyntheticDefaultImports: boolean;
86
+ skipLibCheck: boolean;
87
+ };
88
+ include: string[];
78
89
  };
79
90
  }>;
91
+
92
+ declare enum TemplateName {
93
+ default = "default",
94
+ tailwindcss = "tailwindcss",
95
+ vant = "vant",
96
+ tdesign = "tdesign"
97
+ }
98
+
80
99
  declare function createProject(targetDir?: string, templateName?: TemplateName): Promise<void>;
81
100
 
82
- export { TemplateName, createOrUpdatePackageJson, createOrUpdateProjectConfig, createProject, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile };
101
+ declare function createOrUpdatePackageJson(options: UpdatePackageJsonOptions): Promise<PackageJson>;
102
+
103
+ declare function createOrUpdateProjectConfig(options: UpdateProjectConfigOptions): Promise<ProjectConfig>;
104
+
105
+ declare function resetContext(): void;
106
+
107
+ declare function initConfig(options: {
108
+ root?: string;
109
+ command?: 'weapp-vite';
110
+ }): Promise<Context>;
111
+
112
+ export { type Context, TemplateName, createOrUpdatePackageJson, createOrUpdateProjectConfig, createProject, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile, resetContext };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as pkg_types from 'pkg-types';
2
- import { PackageJson } from 'pkg-types';
1
+ import { PackageJson, TSConfig } from 'pkg-types';
3
2
  import { set } from '@weapp-core/shared';
4
3
 
5
4
  interface SetMethod {
@@ -30,53 +29,84 @@ interface ProjectConfig {
30
29
  };
31
30
  }
32
31
 
33
- declare enum TemplateName {
34
- default = "default",
35
- tailwindcss = "tailwindcss",
36
- vant = "vant",
37
- tdesign = "tdesign"
32
+ interface ContextDocument<T> {
33
+ name: string;
34
+ path: string;
35
+ value: T | null;
36
+ }
37
+ interface Context {
38
+ projectConfig: ContextDocument<ProjectConfig>;
39
+ packageJson: ContextDocument<PackageJson>;
40
+ viteConfig: ContextDocument<string>;
41
+ tsconfig: ContextDocument<TSConfig>;
42
+ tsconfigNode: ContextDocument<TSConfig>;
43
+ dts: ContextDocument<string>;
38
44
  }
39
45
 
40
- declare function createOrUpdateProjectConfig(options: UpdateProjectConfigOptions): Promise<ProjectConfig | undefined>;
41
- declare function createOrUpdatePackageJson(options: UpdatePackageJsonOptions): Promise<PackageJson | undefined>;
42
46
  declare function initViteConfigFile(options: SharedUpdateOptions): Promise<string>;
43
47
  declare function initTsDtsFile(options: SharedUpdateOptions): Promise<string>;
44
- declare function initTsJsonFiles(options: SharedUpdateOptions): Promise<void>;
45
- declare function initConfig(options: {
46
- root?: string;
47
- command?: 'weapp-vite';
48
- }): Promise<{
49
- projectConfig: {
50
- name: string;
51
- path: string;
52
- value: ProjectConfig;
53
- };
54
- packageJson: {
55
- name: string;
56
- path: string;
57
- value: PackageJson;
58
- };
59
- viteConfig: {
60
- name: string;
61
- path: string;
62
- value: string;
63
- };
48
+ declare function initTsJsonFiles(options: SharedUpdateOptions): Promise<{
64
49
  tsconfig: {
65
- name: string;
66
- path: string;
67
- value: pkg_types.TSConfig;
50
+ compilerOptions: {
51
+ target: string;
52
+ jsx: string;
53
+ lib: string[];
54
+ useDefineForClassFields: boolean;
55
+ baseUrl: string;
56
+ module: string;
57
+ moduleResolution: string;
58
+ paths: {
59
+ '@/*': string[];
60
+ };
61
+ resolveJsonModule: boolean;
62
+ types: string[];
63
+ allowImportingTsExtensions: boolean;
64
+ allowJs: boolean;
65
+ strict: boolean;
66
+ noFallthroughCasesInSwitch: boolean;
67
+ noUnusedLocals: boolean;
68
+ noUnusedParameters: boolean;
69
+ noEmit: boolean;
70
+ isolatedModules: boolean;
71
+ skipLibCheck: boolean;
72
+ };
73
+ references: {
74
+ path: string;
75
+ }[];
76
+ include: string[];
77
+ exclude: string[];
68
78
  };
69
79
  tsconfigNode: {
70
- name: string;
71
- path: string;
72
- value: pkg_types.TSConfig;
73
- };
74
- dts: {
75
- name: string;
76
- path: string;
77
- value: string;
80
+ compilerOptions: {
81
+ composite: boolean;
82
+ module: string;
83
+ moduleResolution: string;
84
+ strict: boolean;
85
+ allowSyntheticDefaultImports: boolean;
86
+ skipLibCheck: boolean;
87
+ };
88
+ include: string[];
78
89
  };
79
90
  }>;
91
+
92
+ declare enum TemplateName {
93
+ default = "default",
94
+ tailwindcss = "tailwindcss",
95
+ vant = "vant",
96
+ tdesign = "tdesign"
97
+ }
98
+
80
99
  declare function createProject(targetDir?: string, templateName?: TemplateName): Promise<void>;
81
100
 
82
- export { TemplateName, createOrUpdatePackageJson, createOrUpdateProjectConfig, createProject, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile };
101
+ declare function createOrUpdatePackageJson(options: UpdatePackageJsonOptions): Promise<PackageJson>;
102
+
103
+ declare function createOrUpdateProjectConfig(options: UpdateProjectConfigOptions): Promise<ProjectConfig>;
104
+
105
+ declare function resetContext(): void;
106
+
107
+ declare function initConfig(options: {
108
+ root?: string;
109
+ command?: 'weapp-vite';
110
+ }): Promise<Context>;
111
+
112
+ export { type Context, TemplateName, createOrUpdatePackageJson, createOrUpdateProjectConfig, createProject, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile, resetContext };