zile 0.0.0 → 0.0.2
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/LICENSE +21 -0
- package/README.md +358 -0
- package/dist/Cli.d.ts +15 -0
- package/dist/Cli.d.ts.map +1 -0
- package/dist/Cli.js +30 -0
- package/dist/Cli.js.map +1 -0
- package/dist/Package.d.ts +156 -0
- package/dist/Package.d.ts.map +1 -0
- package/dist/Package.js +422 -0
- package/dist/Package.js.map +1 -0
- package/dist/Packages.d.ts +27 -0
- package/dist/Packages.d.ts.map +1 -0
- package/dist/Packages.js +48 -0
- package/dist/Packages.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cli/commands.d.ts +17 -0
- package/dist/internal/cli/commands.d.ts.map +1 -0
- package/dist/internal/cli/commands.js +16 -0
- package/dist/internal/cli/commands.js.map +1 -0
- package/dist/internal/package.json +60 -0
- package/package.json +58 -2
- package/src/Cli.test.ts +81 -0
- package/src/Cli.ts +41 -0
- package/src/Package.test.ts +102 -0
- package/src/Package.ts +609 -0
- package/src/Packages.test.ts +222 -0
- package/src/Packages.ts +65 -0
- package/src/__snapshots__/Cli.test.ts.snap +471 -0
- package/src/__snapshots__/Package.test.ts.snap +972 -0
- package/src/__snapshots__/Packages.test.ts.snap +195 -0
- package/src/index.ts +3 -0
- package/src/internal/cli/commands.ts +37 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Packages.build > builds all packages 1`] = `
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
|
+
"packageJson": {
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"default": "./dist/index.js",
|
|
10
|
+
"src": "./index.ts",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"name": "single-entrypoint",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"type": "module",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"version": "0.0.0",
|
|
21
|
+
},
|
|
22
|
+
"tsConfig": {
|
|
23
|
+
"compilerOptions": {
|
|
24
|
+
"composite": false,
|
|
25
|
+
"declaration": true,
|
|
26
|
+
"declarationDir": undefined,
|
|
27
|
+
"declarationMap": true,
|
|
28
|
+
"emitDeclarationOnly": false,
|
|
29
|
+
"esModuleInterop": true,
|
|
30
|
+
"isolatedModules": true,
|
|
31
|
+
"module": "nodenext",
|
|
32
|
+
"moduleDetection": "force",
|
|
33
|
+
"moduleResolution": "nodenext",
|
|
34
|
+
"noEmit": false,
|
|
35
|
+
"outDir": "/repos/single-entrypoint/dist",
|
|
36
|
+
"skipLibCheck": true,
|
|
37
|
+
"sourceMap": true,
|
|
38
|
+
"strict": true,
|
|
39
|
+
"target": "es2021",
|
|
40
|
+
"verbatimModuleSyntax": true,
|
|
41
|
+
},
|
|
42
|
+
"exclude": [],
|
|
43
|
+
"include": [
|
|
44
|
+
"/repos/single-entrypoint/index.ts",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"packageJson": {
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"default": "./dist/index.js",
|
|
53
|
+
"src": "./src/index.ts",
|
|
54
|
+
"types": "./dist/index.d.ts",
|
|
55
|
+
},
|
|
56
|
+
"./foo": {
|
|
57
|
+
"default": "./dist/foo.js",
|
|
58
|
+
"src": "./src/foo.ts",
|
|
59
|
+
"types": "./dist/foo.d.ts",
|
|
60
|
+
},
|
|
61
|
+
"./nested/dir": {
|
|
62
|
+
"default": "./dist/nested/dir/bar.js",
|
|
63
|
+
"src": "./src/nested/dir/bar.ts",
|
|
64
|
+
"types": "./dist/nested/dir/bar.d.ts",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
"main": "./dist/index.js",
|
|
68
|
+
"module": "./dist/index.js",
|
|
69
|
+
"name": "multiple-entrypoint",
|
|
70
|
+
"sideEffects": false,
|
|
71
|
+
"type": "module",
|
|
72
|
+
"types": "./dist/index.d.ts",
|
|
73
|
+
"version": "0.0.0",
|
|
74
|
+
},
|
|
75
|
+
"tsConfig": {
|
|
76
|
+
"compilerOptions": {
|
|
77
|
+
"composite": false,
|
|
78
|
+
"declaration": true,
|
|
79
|
+
"declarationDir": undefined,
|
|
80
|
+
"declarationMap": true,
|
|
81
|
+
"emitDeclarationOnly": false,
|
|
82
|
+
"esModuleInterop": true,
|
|
83
|
+
"isolatedModules": true,
|
|
84
|
+
"module": "nodenext",
|
|
85
|
+
"moduleDetection": "force",
|
|
86
|
+
"moduleResolution": "nodenext",
|
|
87
|
+
"noEmit": false,
|
|
88
|
+
"outDir": "/repos/multiple-entrypoint/dist",
|
|
89
|
+
"skipLibCheck": true,
|
|
90
|
+
"sourceMap": true,
|
|
91
|
+
"strict": true,
|
|
92
|
+
"target": "es2021",
|
|
93
|
+
"verbatimModuleSyntax": true,
|
|
94
|
+
},
|
|
95
|
+
"exclude": [],
|
|
96
|
+
"include": [
|
|
97
|
+
"/repos/multiple-entrypoint/src/index.ts",
|
|
98
|
+
"/repos/multiple-entrypoint/src/foo.ts",
|
|
99
|
+
"/repos/multiple-entrypoint/src/nested/dir/bar.ts",
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"packageJson": {
|
|
105
|
+
"exports": {
|
|
106
|
+
".": {
|
|
107
|
+
"default": "./dist/index.js",
|
|
108
|
+
"src": "./index.ts",
|
|
109
|
+
"types": "./dist/index.d.ts",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
"main": "./dist/index.js",
|
|
113
|
+
"module": "./dist/index.js",
|
|
114
|
+
"name": "basic",
|
|
115
|
+
"sideEffects": false,
|
|
116
|
+
"type": "module",
|
|
117
|
+
"types": "./dist/index.d.ts",
|
|
118
|
+
"version": "0.0.0",
|
|
119
|
+
},
|
|
120
|
+
"tsConfig": {
|
|
121
|
+
"compilerOptions": {
|
|
122
|
+
"composite": false,
|
|
123
|
+
"declaration": true,
|
|
124
|
+
"declarationDir": undefined,
|
|
125
|
+
"declarationMap": true,
|
|
126
|
+
"emitDeclarationOnly": false,
|
|
127
|
+
"esModuleInterop": true,
|
|
128
|
+
"isolatedModules": true,
|
|
129
|
+
"module": "nodenext",
|
|
130
|
+
"moduleDetection": "force",
|
|
131
|
+
"moduleResolution": "nodenext",
|
|
132
|
+
"noEmit": false,
|
|
133
|
+
"outDir": "/repos/basic-object-exports/dist",
|
|
134
|
+
"skipLibCheck": true,
|
|
135
|
+
"sourceMap": true,
|
|
136
|
+
"strict": true,
|
|
137
|
+
"target": "es2021",
|
|
138
|
+
"verbatimModuleSyntax": true,
|
|
139
|
+
},
|
|
140
|
+
"exclude": [],
|
|
141
|
+
"include": [
|
|
142
|
+
"/repos/basic-object-exports/index.ts",
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"packageJson": {
|
|
148
|
+
"bin": {
|
|
149
|
+
"basic": "./dist/cli.js",
|
|
150
|
+
"basic.src": "./cli.ts",
|
|
151
|
+
},
|
|
152
|
+
"exports": {
|
|
153
|
+
".": {
|
|
154
|
+
"default": "./dist/index.js",
|
|
155
|
+
"src": "./index.ts",
|
|
156
|
+
"types": "./dist/index.d.ts",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
"main": "./dist/index.js",
|
|
160
|
+
"module": "./dist/index.js",
|
|
161
|
+
"name": "basic",
|
|
162
|
+
"sideEffects": false,
|
|
163
|
+
"type": "module",
|
|
164
|
+
"types": "./dist/index.d.ts",
|
|
165
|
+
"version": "0.0.0",
|
|
166
|
+
},
|
|
167
|
+
"tsConfig": {
|
|
168
|
+
"compilerOptions": {
|
|
169
|
+
"composite": false,
|
|
170
|
+
"declaration": true,
|
|
171
|
+
"declarationDir": undefined,
|
|
172
|
+
"declarationMap": true,
|
|
173
|
+
"emitDeclarationOnly": false,
|
|
174
|
+
"esModuleInterop": true,
|
|
175
|
+
"isolatedModules": true,
|
|
176
|
+
"module": "nodenext",
|
|
177
|
+
"moduleDetection": "force",
|
|
178
|
+
"moduleResolution": "nodenext",
|
|
179
|
+
"noEmit": false,
|
|
180
|
+
"outDir": "/repos/basic/dist",
|
|
181
|
+
"skipLibCheck": true,
|
|
182
|
+
"sourceMap": true,
|
|
183
|
+
"strict": true,
|
|
184
|
+
"target": "es2021",
|
|
185
|
+
"verbatimModuleSyntax": true,
|
|
186
|
+
},
|
|
187
|
+
"exclude": [],
|
|
188
|
+
"include": [
|
|
189
|
+
"/repos/basic/cli.ts",
|
|
190
|
+
"/repos/basic/index.ts",
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
]
|
|
195
|
+
`;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Command } from 'cac'
|
|
2
|
+
import * as Package from '../../Package.js'
|
|
3
|
+
|
|
4
|
+
export async function build(command: Command, options: build.Options = {}) {
|
|
5
|
+
const { link = false } = options
|
|
6
|
+
return command
|
|
7
|
+
.option('--cwd <directory>', 'Working directory to build')
|
|
8
|
+
.option('--includes <patterns...>', 'Glob patterns to include')
|
|
9
|
+
.option('--project <path>', 'Path to tsconfig.json file, relative to the working directory.')
|
|
10
|
+
.option('--tsgo', 'Use tsgo for transpilation')
|
|
11
|
+
.action(async (options1: build.CommandOptions, options2: build.CommandOptions) => {
|
|
12
|
+
const {
|
|
13
|
+
cwd = process.cwd(),
|
|
14
|
+
project = './tsconfig.json',
|
|
15
|
+
tsgo = false,
|
|
16
|
+
} = typeof options1 === 'object' ? options1 : options2
|
|
17
|
+
console.log(`→ ${link ? 'Linking' : 'Building'} package at ${cwd}`)
|
|
18
|
+
await Package.build({ cwd, link, project, tsgo })
|
|
19
|
+
console.log(`✔︎ ${link ? 'Linking' : 'Building'} completed successfully`)
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare namespace build {
|
|
24
|
+
type Options = {
|
|
25
|
+
/** Whether to link output files to source files for development */
|
|
26
|
+
link?: boolean | undefined
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type CommandOptions = {
|
|
30
|
+
/** Working directory to build */
|
|
31
|
+
cwd?: string | undefined
|
|
32
|
+
/** Path to tsconfig.json file, relative to the working directory. @default './tsconfig.json' */
|
|
33
|
+
project?: string | undefined
|
|
34
|
+
/** Use tsgo for transpilation */
|
|
35
|
+
tsgo?: boolean | undefined
|
|
36
|
+
}
|
|
37
|
+
}
|