jiek 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -0
  3. package/bin/jiek.js +13 -0
  4. package/dist/cli.cjs +5041 -0
  5. package/dist/cli.d.cts +112 -0
  6. package/dist/cli.d.ts +112 -0
  7. package/dist/cli.js +5010 -0
  8. package/dist/cli.min.cjs +19 -0
  9. package/dist/cli.min.js +19 -0
  10. package/dist/index.cjs +5 -0
  11. package/dist/index.d.cts +73 -0
  12. package/dist/index.d.ts +73 -0
  13. package/dist/index.js +3 -0
  14. package/dist/index.min.cjs +1 -0
  15. package/dist/index.min.js +1 -0
  16. package/dist/rollup/index.cjs +4688 -0
  17. package/dist/rollup/index.d.cts +53 -0
  18. package/dist/rollup/index.d.ts +53 -0
  19. package/dist/rollup/index.js +4673 -0
  20. package/dist/rollup/index.min.cjs +19 -0
  21. package/dist/rollup/index.min.js +19 -0
  22. package/package.json +89 -4
  23. package/src/cli.ts +9 -0
  24. package/src/commands/base.ts +8 -0
  25. package/src/commands/build.ts +158 -0
  26. package/src/commands/init.ts +373 -0
  27. package/src/commands/publish.ts +171 -0
  28. package/src/index.ts +8 -0
  29. package/src/inner.ts +11 -0
  30. package/src/merge-package-json.ts +75 -0
  31. package/src/rollup/base.ts +72 -0
  32. package/src/rollup/index.ts +422 -0
  33. package/src/rollup/plugins/globals.ts +34 -0
  34. package/src/rollup/plugins/progress.ts +26 -0
  35. package/src/rollup/plugins/skip.ts +23 -0
  36. package/src/rollup/utils/commonOptions.ts +9 -0
  37. package/src/rollup/utils/externalResolver.ts +21 -0
  38. package/src/rollup/utils/globalResolver.ts +13 -0
  39. package/src/rollup/utils/withMinify.ts +18 -0
  40. package/src/utils/filterSupport.ts +84 -0
  41. package/src/utils/getExports.ts +104 -0
  42. package/src/utils/getRoot.ts +16 -0
  43. package/src/utils/getWD.ts +31 -0
  44. package/src/utils/loadConfig.ts +93 -0
  45. package/src/utils/tsRegister.ts +26 -0
  46. package/index.js +0 -1
package/dist/cli.d.cts ADDED
@@ -0,0 +1,112 @@
1
+ import { OutputOptions } from 'rollup';
2
+
3
+ type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
4
+ js?: OutputOptions[K];
5
+ dts?: OutputOptions[K];
6
+ };
7
+ interface TemplateOptions {
8
+ /**
9
+ * When the user configures type: module, the generated output from entry points that don't
10
+ * have cts as a suffix will automatically include the CJS version.
11
+ * if it is not configured, and the generated output from entry points that do not have mts
12
+ * as a suffix will automatically include the ESM version.
13
+ *
14
+ * @default true
15
+ */
16
+ crossModuleConvertor?: boolean;
17
+ output?: {
18
+ /**
19
+ * @default true
20
+ *
21
+ * When minify is set to true, the output will with minified files.
22
+ * When minify is set to 'only-minify', the output will direct output minified files.
23
+ */
24
+ minify?: boolean | 'only-minify';
25
+ /**
26
+ * @default 'dist'
27
+ */
28
+ dir?: Mapping2ROO<'dir'>;
29
+ sourcemap?: Mapping2ROO<'sourcemap'>;
30
+ strict?: Mapping2ROO<'strict'>;
31
+ };
32
+ }
33
+ declare module 'jiek' {
34
+ interface Config {
35
+ build?: TemplateOptions & {
36
+ /**
37
+ * Whether to run in silent mode, only active when configured in the workspace root or cwd.
38
+ *
39
+ * @default false
40
+ */
41
+ silent?: boolean;
42
+ };
43
+ }
44
+ }
45
+
46
+ declare module 'jiek' {
47
+ type InitNamedFunction = (argument: string, paths: {
48
+ full: string;
49
+ relative: string;
50
+ basename?: string;
51
+ }) => [name?: string, path?: string];
52
+ type InitNamed = InitNamedFunction | {
53
+ [key: string]: string | InitNamedFunction;
54
+ };
55
+ interface Config {
56
+ init?: {
57
+ /**
58
+ * the package.json template file path or file content
59
+ *
60
+ * if it can be parsed as json, it will be parsed
61
+ * if it is a relative file path, it will be resolved to an absolute path based on the current working directory
62
+ * if it is an absolute file path, it will be used directly
63
+ * @default '.jiek.template.package.json'
64
+ */
65
+ template?: string;
66
+ /**
67
+ * the readme content
68
+ *
69
+ * $name will be replaced with the package name
70
+ * $license will be replaced with the license
71
+ */
72
+ readme?: string | ((ctx: {
73
+ dir: string;
74
+ packageJson: Record<string, any>;
75
+ }) => string);
76
+ /**
77
+ * the readme template file path
78
+ * @default '.jiek.template.readme.md'
79
+ */
80
+ readmeTemplate?: string;
81
+ bug?: {
82
+ /**
83
+ * @default 'bug_report.yml'
84
+ */
85
+ template?: string;
86
+ /**
87
+ * @default ['bug']
88
+ */
89
+ labels?: string[] | ((ctx: {
90
+ name: string;
91
+ dir: string;
92
+ }) => string[]);
93
+ };
94
+ named?: InitNamed;
95
+ };
96
+ }
97
+ }
98
+
99
+ declare module 'jiek' {
100
+ interface Config {
101
+ publish?: {
102
+ /**
103
+ * @default false
104
+ */
105
+ withSuffix?: boolean;
106
+ /**
107
+ * @default true
108
+ */
109
+ withSource?: boolean;
110
+ };
111
+ }
112
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,112 @@
1
+ import { OutputOptions } from 'rollup';
2
+
3
+ type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
4
+ js?: OutputOptions[K];
5
+ dts?: OutputOptions[K];
6
+ };
7
+ interface TemplateOptions {
8
+ /**
9
+ * When the user configures type: module, the generated output from entry points that don't
10
+ * have cts as a suffix will automatically include the CJS version.
11
+ * if it is not configured, and the generated output from entry points that do not have mts
12
+ * as a suffix will automatically include the ESM version.
13
+ *
14
+ * @default true
15
+ */
16
+ crossModuleConvertor?: boolean;
17
+ output?: {
18
+ /**
19
+ * @default true
20
+ *
21
+ * When minify is set to true, the output will with minified files.
22
+ * When minify is set to 'only-minify', the output will direct output minified files.
23
+ */
24
+ minify?: boolean | 'only-minify';
25
+ /**
26
+ * @default 'dist'
27
+ */
28
+ dir?: Mapping2ROO<'dir'>;
29
+ sourcemap?: Mapping2ROO<'sourcemap'>;
30
+ strict?: Mapping2ROO<'strict'>;
31
+ };
32
+ }
33
+ declare module 'jiek' {
34
+ interface Config {
35
+ build?: TemplateOptions & {
36
+ /**
37
+ * Whether to run in silent mode, only active when configured in the workspace root or cwd.
38
+ *
39
+ * @default false
40
+ */
41
+ silent?: boolean;
42
+ };
43
+ }
44
+ }
45
+
46
+ declare module 'jiek' {
47
+ type InitNamedFunction = (argument: string, paths: {
48
+ full: string;
49
+ relative: string;
50
+ basename?: string;
51
+ }) => [name?: string, path?: string];
52
+ type InitNamed = InitNamedFunction | {
53
+ [key: string]: string | InitNamedFunction;
54
+ };
55
+ interface Config {
56
+ init?: {
57
+ /**
58
+ * the package.json template file path or file content
59
+ *
60
+ * if it can be parsed as json, it will be parsed
61
+ * if it is a relative file path, it will be resolved to an absolute path based on the current working directory
62
+ * if it is an absolute file path, it will be used directly
63
+ * @default '.jiek.template.package.json'
64
+ */
65
+ template?: string;
66
+ /**
67
+ * the readme content
68
+ *
69
+ * $name will be replaced with the package name
70
+ * $license will be replaced with the license
71
+ */
72
+ readme?: string | ((ctx: {
73
+ dir: string;
74
+ packageJson: Record<string, any>;
75
+ }) => string);
76
+ /**
77
+ * the readme template file path
78
+ * @default '.jiek.template.readme.md'
79
+ */
80
+ readmeTemplate?: string;
81
+ bug?: {
82
+ /**
83
+ * @default 'bug_report.yml'
84
+ */
85
+ template?: string;
86
+ /**
87
+ * @default ['bug']
88
+ */
89
+ labels?: string[] | ((ctx: {
90
+ name: string;
91
+ dir: string;
92
+ }) => string[]);
93
+ };
94
+ named?: InitNamed;
95
+ };
96
+ }
97
+ }
98
+
99
+ declare module 'jiek' {
100
+ interface Config {
101
+ publish?: {
102
+ /**
103
+ * @default false
104
+ */
105
+ withSuffix?: boolean;
106
+ /**
107
+ * @default true
108
+ */
109
+ withSource?: boolean;
110
+ };
111
+ }
112
+ }