@shopify/cli-kit 3.16.3 → 3.18.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.
- package/CHANGELOG.md +26 -0
- package/README.md +1 -1
- package/assets/success.html +1 -1
- package/dist/analytics.d.ts +5 -5
- package/dist/analytics.js +5 -5
- package/dist/analytics.js.map +1 -1
- package/dist/api/common.d.ts +2 -2
- package/dist/api/common.js +2 -2
- package/dist/api/common.js.map +1 -1
- package/dist/api/graphql/index.d.ts +0 -2
- package/dist/api/graphql/index.js +0 -2
- package/dist/api/graphql/index.js.map +1 -1
- package/dist/api/oxygen.d.ts +5 -0
- package/dist/api/oxygen.js +30 -0
- package/dist/api/oxygen.js.map +1 -0
- package/dist/api/partners.d.ts +7 -7
- package/dist/api/partners.js +7 -7
- package/dist/api/partners.js.map +1 -1
- package/dist/api.d.ts +2 -2
- package/dist/api.js +2 -2
- package/dist/api.js.map +1 -1
- package/dist/common/object.d.ts +3 -3
- package/dist/common/object.js +3 -3
- package/dist/common/object.js.map +1 -1
- package/dist/content-tokens.js.map +1 -1
- package/dist/environment/fqdn.d.ts +3 -3
- package/dist/environment/fqdn.js +3 -3
- package/dist/environment/fqdn.js.map +1 -1
- package/dist/environment/local.d.ts +13 -13
- package/dist/environment/local.js +16 -16
- package/dist/environment/local.js.map +1 -1
- package/dist/environment/service.d.ts +1 -0
- package/dist/environment/service.js +3 -0
- package/dist/environment/service.js.map +1 -1
- package/dist/environment/spin.d.ts +12 -12
- package/dist/environment/spin.js +12 -12
- package/dist/environment/spin.js.map +1 -1
- package/dist/environment/utilities.d.ts +0 -2
- package/dist/environment/utilities.js +0 -2
- package/dist/environment/utilities.js.map +1 -1
- package/dist/environment.d.ts +3 -1
- package/dist/environment.js +3 -1
- package/dist/environment.js.map +1 -1
- package/dist/error.d.ts +1 -1
- package/dist/error.js +4 -3
- package/dist/error.js.map +1 -1
- package/dist/file.d.ts +17 -18
- package/dist/file.js +17 -18
- package/dist/file.js.map +1 -1
- package/dist/git.d.ts +1 -1
- package/dist/git.js +5 -2
- package/dist/git.js.map +1 -1
- package/dist/http/fetch.d.ts +2 -2
- package/dist/http/fetch.js +2 -2
- package/dist/http/fetch.js.map +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/http.js +1 -1
- package/dist/http.js.map +1 -1
- package/dist/id.d.ts +1 -1
- package/dist/id.js +1 -1
- package/dist/id.js.map +1 -1
- package/dist/network/service.d.ts +0 -2
- package/dist/network/service.js +0 -1
- package/dist/network/service.js.map +1 -1
- package/dist/node/archiver.d.ts +2 -2
- package/dist/node/archiver.js +2 -2
- package/dist/node/archiver.js.map +1 -1
- package/dist/node/checksum.d.ts +2 -2
- package/dist/node/checksum.js +2 -2
- package/dist/node/checksum.js.map +1 -1
- package/dist/node/cli.d.ts +1 -2
- package/dist/node/cli.js +2 -8
- package/dist/node/cli.js.map +1 -1
- package/dist/node/colors.d.ts +2 -1
- package/dist/node/colors.js +2 -7
- package/dist/node/colors.js.map +1 -1
- package/dist/node/dot-env.d.ts +7 -7
- package/dist/node/dot-env.js +7 -7
- package/dist/node/dot-env.js.map +1 -1
- package/dist/node/framework.d.ts +2 -2
- package/dist/node/framework.js +2 -2
- package/dist/node/framework.js.map +1 -1
- package/dist/node/hooks/prerun.js +6 -6
- package/dist/node/hooks/prerun.js.map +1 -1
- package/dist/node/node-package-manager.d.ts +32 -28
- package/dist/node/node-package-manager.js +29 -29
- package/dist/node/node-package-manager.js.map +1 -1
- package/dist/node/ruby.d.ts +4 -4
- package/dist/node/ruby.js +5 -5
- package/dist/node/ruby.js.map +1 -1
- package/dist/os.d.ts +1 -1
- package/dist/os.js +1 -1
- package/dist/os.js.map +1 -1
- package/dist/output.d.ts +26 -34
- package/dist/output.js +23 -143
- package/dist/output.js.map +1 -1
- package/dist/path.d.ts +4 -4
- package/dist/path.js +4 -4
- package/dist/path.js.map +1 -1
- package/dist/plugins.d.ts +4 -4
- package/dist/plugins.js +4 -4
- package/dist/plugins.js.map +1 -1
- package/dist/port.d.ts +1 -1
- package/dist/port.js +1 -1
- package/dist/port.js.map +1 -1
- package/dist/private/node/ui/alert.d.ts +2 -0
- package/dist/private/node/ui/alert.js +18 -0
- package/dist/private/node/ui/alert.js.map +1 -0
- package/dist/private/node/ui/components/Alert.d.ts +17 -0
- package/dist/private/node/ui/components/Alert.js +21 -0
- package/dist/private/node/ui/components/Alert.js.map +1 -0
- package/dist/private/node/ui/components/Banner.d.ts +7 -0
- package/dist/private/node/ui/components/Banner.js +35 -0
- package/dist/private/node/ui/components/Banner.js.map +1 -0
- package/dist/private/node/ui/components/Command.d.ts +9 -0
- package/dist/private/node/ui/components/Command.js +10 -0
- package/dist/private/node/ui/components/Command.js.map +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +48 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js +98 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
- package/dist/private/node/ui/components/Error.d.ts +8 -0
- package/dist/private/node/ui/components/Error.js +13 -0
- package/dist/private/node/ui/components/Error.js.map +1 -0
- package/dist/private/node/ui/components/FatalError.d.ts +7 -0
- package/dist/private/node/ui/components/FatalError.js +42 -0
- package/dist/private/node/ui/components/FatalError.js.map +1 -0
- package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
- package/dist/private/node/ui/components/FullScreen.js +32 -0
- package/dist/private/node/ui/components/FullScreen.js.map +1 -0
- package/dist/private/node/ui/components/Link.d.ts +10 -0
- package/dist/private/node/ui/components/Link.js +14 -0
- package/dist/private/node/ui/components/Link.js.map +1 -0
- package/dist/private/node/ui/components/List.d.ts +13 -0
- package/dist/private/node/ui/components/List.js +19 -0
- package/dist/private/node/ui/components/List.js.map +1 -0
- package/dist/private/node/ui/components/TextAnimation.d.ts +11 -0
- package/dist/private/node/ui/components/TextAnimation.js +46 -0
- package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.d.ts +21 -0
- package/dist/private/node/ui/components/TokenizedText.js +26 -0
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
- package/dist/private/node/ui/error.d.ts +4 -0
- package/dist/private/node/ui/error.js +12 -0
- package/dist/private/node/ui/error.js.map +1 -0
- package/dist/private/node/ui.d.ts +10 -0
- package/dist/private/node/ui.js +47 -0
- package/dist/private/node/ui.js.map +1 -0
- package/dist/public/common/array.d.ts +4 -4
- package/dist/public/common/array.js +4 -4
- package/dist/public/common/array.js.map +1 -1
- package/dist/public/node/ui.d.ts +155 -0
- package/dist/public/node/ui.js +163 -0
- package/dist/public/node/ui.js.map +1 -0
- package/dist/secure-store.d.ts +4 -4
- package/dist/secure-store.js +4 -4
- package/dist/secure-store.js.map +1 -1
- package/dist/session/device-authorization.d.ts +5 -5
- package/dist/session/device-authorization.js +5 -5
- package/dist/session/device-authorization.js.map +1 -1
- package/dist/session/exchange.d.ts +10 -16
- package/dist/session/exchange.js +10 -16
- package/dist/session/exchange.js.map +1 -1
- package/dist/session/post-auth.js +2 -2
- package/dist/session/post-auth.js.map +1 -1
- package/dist/session/redirect-listener.js +1 -1
- package/dist/session/redirect-listener.js.map +1 -1
- package/dist/session/schema.d.ts +3 -2
- package/dist/session/schema.js +3 -2
- package/dist/session/schema.js.map +1 -1
- package/dist/session/scopes.d.ts +3 -3
- package/dist/session/scopes.js +3 -3
- package/dist/session/scopes.js.map +1 -1
- package/dist/session/store.d.ts +2 -2
- package/dist/session/store.js +2 -2
- package/dist/session/store.js.map +1 -1
- package/dist/session/token.d.ts +1 -1
- package/dist/session/token.js +1 -1
- package/dist/session/token.js.map +1 -1
- package/dist/session/validate.d.ts +4 -4
- package/dist/session/validate.js +4 -7
- package/dist/session/validate.js.map +1 -1
- package/dist/session.d.ts +10 -10
- package/dist/session.js +12 -12
- package/dist/session.js.map +1 -1
- package/dist/string.d.ts +2 -2
- package/dist/string.js +2 -2
- package/dist/string.js.map +1 -1
- package/dist/system.d.ts +6 -9
- package/dist/system.js +23 -23
- package/dist/system.js.map +1 -1
- package/dist/template.d.ts +3 -3
- package/dist/template.js +3 -3
- package/dist/template.js.map +1 -1
- package/dist/testing/fixtures/render-concurrent.d.ts +1 -0
- package/dist/testing/fixtures/render-concurrent.js +28 -0
- package/dist/testing/fixtures/render-concurrent.js.map +1 -0
- package/dist/testing/output.d.ts +1 -0
- package/dist/testing/output.js +1 -0
- package/dist/testing/output.js.map +1 -1
- package/dist/testing/store.d.ts +2 -2
- package/dist/testing/store.js +2 -2
- package/dist/testing/store.js.map +1 -1
- package/dist/testing/ui.d.ts +8 -0
- package/dist/testing/ui.js +17 -0
- package/dist/testing/ui.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/inquirer/input.d.ts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +17 -8
- package/dist/ui.js.map +1 -1
- package/dist/version.d.ts +3 -3
- package/dist/version.js +3 -3
- package/dist/version.js.map +1 -1
- package/package.json +9 -2
- package/dist/api/graphql/functions/compile_module.d.ts +0 -15
- package/dist/api/graphql/functions/compile_module.js +0 -13
- package/dist/api/graphql/functions/compile_module.js.map +0 -1
- package/dist/api/graphql/functions/module_compilation_status.d.ts +0 -15
- package/dist/api/graphql/functions/module_compilation_status.js +0 -13
- package/dist/api/graphql/functions/module_compilation_status.js.map +0 -1
package/dist/file.d.ts
CHANGED
|
@@ -9,22 +9,21 @@ export declare function inTemporaryDirectory<T>(callback: (tmpDir: string) => T
|
|
|
9
9
|
/**
|
|
10
10
|
* It reads a file and returns its content as a string using the
|
|
11
11
|
* utf-8 encoding
|
|
12
|
-
* @param path
|
|
13
|
-
* @returns
|
|
12
|
+
* @param path - Path to the file to read.
|
|
13
|
+
* @returns A promise that resolves with the content of the file.
|
|
14
14
|
*/
|
|
15
15
|
export declare function read(path: string, options?: object): Promise<string>;
|
|
16
16
|
/**
|
|
17
17
|
* Given a path, it determines the actual path. This is useful when working
|
|
18
18
|
* with paths that represent symlinks.
|
|
19
|
-
* @param path
|
|
20
|
-
* @returns
|
|
19
|
+
* @param path - Path whose real path will be returned.
|
|
21
20
|
*/
|
|
22
21
|
export declare function realpath(path: string): Promise<string>;
|
|
23
22
|
export declare function readSync(path: string, options?: object): string;
|
|
24
23
|
/**
|
|
25
24
|
* Copies a file
|
|
26
|
-
* @param from
|
|
27
|
-
* @param to
|
|
25
|
+
* @param from - Path to the directory or file to be copied.
|
|
26
|
+
* @param to - Destination path.
|
|
28
27
|
*/
|
|
29
28
|
export declare function copy(from: string, to: string): Promise<void>;
|
|
30
29
|
export declare function touch(path: string): Promise<void>;
|
|
@@ -48,40 +47,40 @@ export declare function sizeSync(path: string): number;
|
|
|
48
47
|
export declare function createReadStream(path: string): fs.ReadStream;
|
|
49
48
|
/**
|
|
50
49
|
* Returns the Date object for the last modification of a file.
|
|
51
|
-
* @param path
|
|
52
|
-
* @returns
|
|
50
|
+
* @param path - Path to the directory or file.
|
|
51
|
+
* @returns A unix timestamp.
|
|
53
52
|
*/
|
|
54
53
|
export declare function lastUpdated(path: string): Promise<Date>;
|
|
55
54
|
/**
|
|
56
55
|
* Returns the unix timestamp of the last modification of a file.
|
|
57
|
-
* @param path
|
|
58
|
-
* @returns
|
|
56
|
+
* @param path - Path to the directory or file.
|
|
57
|
+
* @returns A unix timestamp.
|
|
59
58
|
*/
|
|
60
59
|
export declare function lastUpdatedTimestamp(path: string): Promise<number | undefined>;
|
|
61
60
|
/**
|
|
62
61
|
* Moves a file.
|
|
63
|
-
* @param src
|
|
64
|
-
* @param dest
|
|
65
|
-
* @param options
|
|
62
|
+
* @param src - File to be moved.
|
|
63
|
+
* @param dest - Path to be moved to.
|
|
64
|
+
* @param options - Moving options.
|
|
66
65
|
*/
|
|
67
66
|
export declare function move(src: string, dest: string, options?: {
|
|
68
67
|
overwrite?: boolean;
|
|
69
68
|
}): Promise<void>;
|
|
70
69
|
/**
|
|
71
70
|
* Changes the permissions of a directory or file.
|
|
72
|
-
* @param path
|
|
73
|
-
* @param mode
|
|
71
|
+
* @param path - Path to the file or directory whose permissions will be modified.
|
|
72
|
+
* @param mode - Permissions to set to the file or directory.
|
|
74
73
|
*/
|
|
75
74
|
export declare function chmod(path: string, mode: number | string): Promise<void>;
|
|
76
75
|
/**
|
|
77
76
|
* Checks if a file has executable permissions.
|
|
78
|
-
* @param path
|
|
77
|
+
* @param path - Path to the file whose permissions will be checked.
|
|
79
78
|
*/
|
|
80
79
|
export declare function hasExecutablePermissions(path: string): Promise<boolean>;
|
|
81
80
|
/**
|
|
82
81
|
* Returns true if a file or directory exists
|
|
83
|
-
* @param path
|
|
84
|
-
* @returns
|
|
82
|
+
* @param path - Path to the directory or file.
|
|
83
|
+
* @returns True if it exists.
|
|
85
84
|
*/
|
|
86
85
|
export declare function exists(path: string): Promise<boolean>;
|
|
87
86
|
/**
|
package/dist/file.js
CHANGED
|
@@ -24,8 +24,8 @@ export async function inTemporaryDirectory(callback) {
|
|
|
24
24
|
/**
|
|
25
25
|
* It reads a file and returns its content as a string using the
|
|
26
26
|
* utf-8 encoding
|
|
27
|
-
* @param path
|
|
28
|
-
* @returns
|
|
27
|
+
* @param path - Path to the file to read.
|
|
28
|
+
* @returns A promise that resolves with the content of the file.
|
|
29
29
|
*/
|
|
30
30
|
export async function read(path, options = { encoding: 'utf-8' }) {
|
|
31
31
|
debug(outputContent `Reading the content of file at ${token.path(path)}...`);
|
|
@@ -35,8 +35,7 @@ export async function read(path, options = { encoding: 'utf-8' }) {
|
|
|
35
35
|
/**
|
|
36
36
|
* Given a path, it determines the actual path. This is useful when working
|
|
37
37
|
* with paths that represent symlinks.
|
|
38
|
-
* @param path
|
|
39
|
-
* @returns
|
|
38
|
+
* @param path - Path whose real path will be returned.
|
|
40
39
|
*/
|
|
41
40
|
export async function realpath(path) {
|
|
42
41
|
return fs.promises.realpath(path);
|
|
@@ -48,8 +47,8 @@ export function readSync(path, options = { encoding: 'utf-8' }) {
|
|
|
48
47
|
}
|
|
49
48
|
/**
|
|
50
49
|
* Copies a file
|
|
51
|
-
* @param from
|
|
52
|
-
* @param to
|
|
50
|
+
* @param from - Path to the directory or file to be copied.
|
|
51
|
+
* @param to - Destination path.
|
|
53
52
|
*/
|
|
54
53
|
export async function copy(from, to) {
|
|
55
54
|
debug(outputContent `Copying file from ${token.path(from)} to ${token.path(to)}...`);
|
|
@@ -128,8 +127,8 @@ export function createReadStream(path) {
|
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
129
|
* Returns the Date object for the last modification of a file.
|
|
131
|
-
* @param path
|
|
132
|
-
* @returns
|
|
130
|
+
* @param path - Path to the directory or file.
|
|
131
|
+
* @returns A unix timestamp.
|
|
133
132
|
*/
|
|
134
133
|
export async function lastUpdated(path) {
|
|
135
134
|
debug(outputContent `Getting last updated timestamp for file at ${token.path(path)}...`);
|
|
@@ -137,8 +136,8 @@ export async function lastUpdated(path) {
|
|
|
137
136
|
}
|
|
138
137
|
/**
|
|
139
138
|
* Returns the unix timestamp of the last modification of a file.
|
|
140
|
-
* @param path
|
|
141
|
-
* @returns
|
|
139
|
+
* @param path - Path to the directory or file.
|
|
140
|
+
* @returns A unix timestamp.
|
|
142
141
|
*/
|
|
143
142
|
export async function lastUpdatedTimestamp(path) {
|
|
144
143
|
try {
|
|
@@ -152,24 +151,24 @@ export async function lastUpdatedTimestamp(path) {
|
|
|
152
151
|
}
|
|
153
152
|
/**
|
|
154
153
|
* Moves a file.
|
|
155
|
-
* @param src
|
|
156
|
-
* @param dest
|
|
157
|
-
* @param options
|
|
154
|
+
* @param src - File to be moved.
|
|
155
|
+
* @param dest - Path to be moved to.
|
|
156
|
+
* @param options - Moving options.
|
|
158
157
|
*/
|
|
159
158
|
export async function move(src, dest, options = {}) {
|
|
160
159
|
await fs.move(src, dest, options);
|
|
161
160
|
}
|
|
162
161
|
/**
|
|
163
162
|
* Changes the permissions of a directory or file.
|
|
164
|
-
* @param path
|
|
165
|
-
* @param mode
|
|
163
|
+
* @param path - Path to the file or directory whose permissions will be modified.
|
|
164
|
+
* @param mode - Permissions to set to the file or directory.
|
|
166
165
|
*/
|
|
167
166
|
export async function chmod(path, mode) {
|
|
168
167
|
await fs.promises.chmod(path, mode);
|
|
169
168
|
}
|
|
170
169
|
/**
|
|
171
170
|
* Checks if a file has executable permissions.
|
|
172
|
-
* @param path
|
|
171
|
+
* @param path - Path to the file whose permissions will be checked.
|
|
173
172
|
*/
|
|
174
173
|
export async function hasExecutablePermissions(path) {
|
|
175
174
|
try {
|
|
@@ -183,8 +182,8 @@ export async function hasExecutablePermissions(path) {
|
|
|
183
182
|
}
|
|
184
183
|
/**
|
|
185
184
|
* Returns true if a file or directory exists
|
|
186
|
-
* @param path
|
|
187
|
-
* @returns
|
|
185
|
+
* @param path - Path to the directory or file.
|
|
186
|
+
* @returns True if it exists.
|
|
188
187
|
*/
|
|
189
188
|
export async function exists(path) {
|
|
190
189
|
try {
|
package/dist/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AACxC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAG/B,MAAM,uBAAuB,GAAY;IACvC,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,KAAK;CACrB,CAAA;AAED,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,KAAa;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7B,OAAO,IAAI,CAAC,GAAG,KAA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AAM,CAAC,OAAe,EAAE,OAAuB;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,cAAc,GAAY;QAC9B,GAAG,uBAAuB;QAC1B,MAAM,EAAE,OAAO;KAChB,CAAA;IAED,QAAQ,GAAG,EAAE;QACX,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,cAAc,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACpC,MAAK;KACR;IAED,MAAM,gBAAgB,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAEvE,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["import {content as outputContent, token, debug} from './output.js'\nimport fs from 'fs-extra'\nimport del from 'del'\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join, extname} from 'pathe'\nimport prettier from 'prettier'\nimport type {Options} from 'prettier'\n\nconst DEFAULT_PRETTIER_CONFIG: Options = {\n arrowParens: 'always',\n singleQuote: true,\n bracketSpacing: false,\n trailingComma: 'all',\n}\n\nexport function stripUp(path: string, strip: number) {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n return temporaryDirectoryTask(callback)\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding\n * @param path {string} Path to the file to read.\n * @returns {Promise<string>} A promise that resolves with the content of the file.\n */\nexport async function read(path: string, options: object = {encoding: 'utf-8'}): Promise<string> {\n debug(outputContent`Reading the content of file at ${token.path(path)}...`)\n const content = await fs.readFile(path, options)\n return content\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n * @param path {string} Path whose real path will be returned.\n * @returns\n */\nexport async function realpath(path: string): Promise<string> {\n return fs.promises.realpath(path)\n}\n\nexport function readSync(path: string, options: object = {encoding: 'utf-8'}): string {\n debug(outputContent`Sync-reading the content of file at ${token.path(path)}...`)\n const content = fs.readFileSync(path, options)\n return content.toString()\n}\n\n/**\n * Copies a file\n * @param from {string} Path to the directory or file to be copied.\n * @param to {string} Destination path.\n */\nexport async function copy(from: string, to: string): Promise<void> {\n debug(outputContent`Copying file from ${token.path(from)} to ${token.path(to)}...`)\n await fs.copy(from, to)\n}\n\nexport async function touch(path: string): Promise<void> {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n await fs.ensureFile(path)\n}\n\nexport async function appendFile(path: string, content: string): Promise<void> {\n debug(outputContent`Appending the following content to ${token.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fs.appendFile(path, content)\n}\n\nexport function touchSync(path: string) {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n fs.ensureFileSync(path)\n}\n\nexport async function write(path: string, data: string): Promise<void> {\n debug(outputContent`Writing some content to file at ${token.path(path)}...`)\n await fs.writeFile(path, data)\n}\n\nexport function writeSync(path: string, data: string): void {\n debug(outputContent`File-writing some content to file at ${token.path(path)}...`)\n fs.writeFileSync(path, data)\n}\n\nexport async function append(path: string, data: string): Promise<void> {\n await fs.appendFile(path, data)\n}\n\nexport function appendSync(path: string, data: string): void {\n fs.appendFileSync(path, data)\n}\n\nexport async function mkdir(path: string): Promise<void> {\n debug(outputContent`Creating directory at ${token.path(path)}...`)\n await fs.mkdirp(path)\n}\n\nexport function mkdirSync(path: string): void {\n debug(outputContent`Sync-creating directory at ${token.path(path)}...`)\n fs.mkdirpSync(path)\n}\n\nexport async function remove(path: string): Promise<void> {\n debug(outputContent`Removing file at ${token.path(path)}...`)\n await fs.remove(path)\n}\n\nexport function removeSync(path: string) {\n debug(outputContent`Sync-removing file at ${token.path(path)}...`)\n fs.removeSync(path)\n}\n\nexport async function rmdir(path: string, {force}: {force?: boolean} = {}): Promise<void> {\n debug(outputContent`Removing directory at ${token.path(path)}...`)\n await del(path, {force})\n}\n\nexport async function mkTmpDir(): Promise<string> {\n debug(outputContent`Creating a temporary directory...`)\n const directory = await fs.mkdtemp('tmp-')\n return directory\n}\n\nexport async function isDirectory(path: string): Promise<boolean> {\n debug(outputContent`Checking if ${token.path(path)} is a directory...`)\n return (await fs.promises.lstat(path)).isDirectory()\n}\n\nexport async function size(path: string): Promise<number> {\n debug(outputContent`Getting the size of file file at ${token.path(path)}...`)\n return (await fs.stat(path)).size\n}\n\nexport function sizeSync(path: string): number {\n debug(outputContent`Sync-getting the size of file file at ${token.path(path)}...`)\n return fs.statSync(path).size\n}\n\nexport function createReadStream(path: string) {\n return fs.createReadStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n * @param path {string} Path to the directory or file.\n * @returns {number} A unix timestamp.\n */\nexport async function lastUpdated(path: string): Promise<Date> {\n debug(outputContent`Getting last updated timestamp for file at ${token.path(path)}...`)\n return (await fs.stat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n * @param path {string} Path to the directory or file.\n * @returns {number} A unix timestamp.\n */\nexport async function lastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await lastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\n/**\n * Moves a file.\n * @param src {string} File to be moved.\n * @param dest {string} Path to be moved to.\n * @param options {object} Moving options.\n */\nexport async function move(src: string, dest: string, options: {overwrite?: boolean} = {}): Promise<void> {\n await fs.move(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n * @param path {string} Path to the file or directory whose permissions will be modified.\n * @param mode {string | numbers} Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fs.promises.chmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n * @param path {string} Path to the file whose permissions will be checked.\n */\nexport async function hasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path, fs.constants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists\n * @param path {string} Path to the directory or file.\n * @returns {boolean} True if it exists.\n */\nexport async function exists(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Format a string using prettier. Return the formatted content.\n */\nexport async function format(content: string, options: {path: string}) {\n const ext = extname(options.path)\n const prettierConfig: Options = {\n ...DEFAULT_PRETTIER_CONFIG,\n parser: 'babel',\n }\n\n switch (ext) {\n case '.html':\n case '.css':\n prettierConfig.parser = ext.slice(1)\n break\n }\n\n const formattedContent = await prettier.format(content, prettierConfig)\n\n return formattedContent\n}\n"]}
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AACxC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAG/B,MAAM,uBAAuB,GAAY;IACvC,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,KAAK;CACrB,CAAA;AAED,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,KAAa;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7B,OAAO,IAAI,CAAC,GAAG,KAAK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M,CAAC,OAAe,EAAE,OAAuB;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,cAAc,GAAY;QAC9B,GAAG,uBAAuB;QAC1B,MAAM,EAAE,OAAO;KAChB,CAAA;IAED,QAAQ,GAAG,EAAE;QACX,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,cAAc,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACpC,MAAK;KACR;IAED,MAAM,gBAAgB,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAEvE,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["import {content as outputContent, token, debug} from './output.js'\nimport fs from 'fs-extra'\nimport del from 'del'\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join, extname} from 'pathe'\nimport prettier from 'prettier'\nimport type {Options} from 'prettier'\n\nconst DEFAULT_PRETTIER_CONFIG: Options = {\n arrowParens: 'always',\n singleQuote: true,\n bracketSpacing: false,\n trailingComma: 'all',\n}\n\nexport function stripUp(path: string, strip: number) {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n return temporaryDirectoryTask(callback)\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\nexport async function read(path: string, options: object = {encoding: 'utf-8'}): Promise<string> {\n debug(outputContent`Reading the content of file at ${token.path(path)}...`)\n const content = await fs.readFile(path, options)\n return content\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n * @param path - Path whose real path will be returned.\n */\nexport async function realpath(path: string): Promise<string> {\n return fs.promises.realpath(path)\n}\n\nexport function readSync(path: string, options: object = {encoding: 'utf-8'}): string {\n debug(outputContent`Sync-reading the content of file at ${token.path(path)}...`)\n const content = fs.readFileSync(path, options)\n return content.toString()\n}\n\n/**\n * Copies a file\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copy(from: string, to: string): Promise<void> {\n debug(outputContent`Copying file from ${token.path(from)} to ${token.path(to)}...`)\n await fs.copy(from, to)\n}\n\nexport async function touch(path: string): Promise<void> {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n await fs.ensureFile(path)\n}\n\nexport async function appendFile(path: string, content: string): Promise<void> {\n debug(outputContent`Appending the following content to ${token.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fs.appendFile(path, content)\n}\n\nexport function touchSync(path: string) {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n fs.ensureFileSync(path)\n}\n\nexport async function write(path: string, data: string): Promise<void> {\n debug(outputContent`Writing some content to file at ${token.path(path)}...`)\n await fs.writeFile(path, data)\n}\n\nexport function writeSync(path: string, data: string): void {\n debug(outputContent`File-writing some content to file at ${token.path(path)}...`)\n fs.writeFileSync(path, data)\n}\n\nexport async function append(path: string, data: string): Promise<void> {\n await fs.appendFile(path, data)\n}\n\nexport function appendSync(path: string, data: string): void {\n fs.appendFileSync(path, data)\n}\n\nexport async function mkdir(path: string): Promise<void> {\n debug(outputContent`Creating directory at ${token.path(path)}...`)\n await fs.mkdirp(path)\n}\n\nexport function mkdirSync(path: string): void {\n debug(outputContent`Sync-creating directory at ${token.path(path)}...`)\n fs.mkdirpSync(path)\n}\n\nexport async function remove(path: string): Promise<void> {\n debug(outputContent`Removing file at ${token.path(path)}...`)\n await fs.remove(path)\n}\n\nexport function removeSync(path: string) {\n debug(outputContent`Sync-removing file at ${token.path(path)}...`)\n fs.removeSync(path)\n}\n\nexport async function rmdir(path: string, {force}: {force?: boolean} = {}): Promise<void> {\n debug(outputContent`Removing directory at ${token.path(path)}...`)\n await del(path, {force})\n}\n\nexport async function mkTmpDir(): Promise<string> {\n debug(outputContent`Creating a temporary directory...`)\n const directory = await fs.mkdtemp('tmp-')\n return directory\n}\n\nexport async function isDirectory(path: string): Promise<boolean> {\n debug(outputContent`Checking if ${token.path(path)} is a directory...`)\n return (await fs.promises.lstat(path)).isDirectory()\n}\n\nexport async function size(path: string): Promise<number> {\n debug(outputContent`Getting the size of file file at ${token.path(path)}...`)\n return (await fs.stat(path)).size\n}\n\nexport function sizeSync(path: string): number {\n debug(outputContent`Sync-getting the size of file file at ${token.path(path)}...`)\n return fs.statSync(path).size\n}\n\nexport function createReadStream(path: string) {\n return fs.createReadStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdated(path: string): Promise<Date> {\n debug(outputContent`Getting last updated timestamp for file at ${token.path(path)}...`)\n return (await fs.stat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await lastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\n/**\n * Moves a file.\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function move(src: string, dest: string, options: {overwrite?: boolean} = {}): Promise<void> {\n await fs.move(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fs.promises.chmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function hasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path, fs.constants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function exists(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Format a string using prettier. Return the formatted content.\n */\nexport async function format(content: string, options: {path: string}) {\n const ext = extname(options.path)\n const prettierConfig: Options = {\n ...DEFAULT_PRETTIER_CONFIG,\n parser: 'babel',\n }\n\n switch (ext) {\n case '.html':\n case '.css':\n prettierConfig.parser = ext.slice(1)\n break\n }\n\n const formattedContent = await prettier.format(content, prettierConfig)\n\n return formattedContent\n}\n"]}
|
package/dist/git.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const GitNotPresentError: () => Abort;
|
|
|
5
5
|
export declare const OutsideGitDirectoryError: (directory: string) => Abort;
|
|
6
6
|
export declare const NoCommitError: () => Abort;
|
|
7
7
|
export declare const DetachedHeadError: () => Abort;
|
|
8
|
-
export declare function initializeRepository(directory: string): Promise<void>;
|
|
8
|
+
export declare function initializeRepository(directory: string, initialBranch?: string): Promise<void>;
|
|
9
9
|
export interface GitIgnoreTemplate {
|
|
10
10
|
[section: string]: string[];
|
|
11
11
|
}
|
package/dist/git.js
CHANGED
|
@@ -16,10 +16,13 @@ export const NoCommitError = () => {
|
|
|
16
16
|
export const DetachedHeadError = () => {
|
|
17
17
|
return new Abort("Git HEAD can't be detached to run command", content `Run ${token.genericShellCommand('git checkout [branchName]')} to reattach HEAD or see git ${token.link('documentation', 'https://git-scm.com/book/en/v2/Git-Internals-Git-References')} for more details`);
|
|
18
18
|
};
|
|
19
|
-
export async function initializeRepository(directory) {
|
|
19
|
+
export async function initializeRepository(directory, initialBranch = 'main') {
|
|
20
20
|
debug(content `Initializing git repository at ${token.path(directory)}...`);
|
|
21
21
|
await ensurePresentOrAbort();
|
|
22
|
-
|
|
22
|
+
// We use init and checkout instead of `init --initial-branch` because the latter is only supported in git 2.28+
|
|
23
|
+
const repo = git(directory);
|
|
24
|
+
await repo.init();
|
|
25
|
+
await repo.checkoutLocalBranch(initialBranch);
|
|
23
26
|
}
|
|
24
27
|
export function createGitIgnore(directory, template) {
|
|
25
28
|
debug(content `Creating .gitignore at ${token.path(directory)}...`);
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,MAAM,EAAE,qBAAqB,EAAC,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAA;AACpC,OAAO,GAAyE,MAAM,YAAY,CAAA;AAElG,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAA;AAE1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,IAAI,KAAK,CACd,iDAAiD,EACjD,OAAO,CAAA,WAAW,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,+DAA+D,CAAC,EAAE,CACvG,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC5D,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAA;AACrE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,OAAO,IAAI,KAAK,CACd,8CAA8C,EAC9C,OAAO,CAAA,OAAO,KAAK,CAAC,mBAAmB,CAAC,gCAAgC,CAAC,+BAA+B,CACzG,CAAA;AACH,CAAC,CAAA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nB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,IAAI,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,EAAE;QACrB,MAAM,kBAAkB,EAAE,CAAA;KAC3B;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,SAAkB;IAC/D,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAC,OAAO,EAAE,SAAS,EAAC,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE;QACpD,MAAM,wBAAwB,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;KAC3D;AACH,CAAC","sourcesContent":["import {Abort} from './error.js'\nimport {hasGit, isTerminalInteractive} from './environment/local.js'\nimport {content, token, debug} from './output.js'\nimport {appendSync} from './file.js'\nimport git, {TaskOptions, SimpleGitProgressEvent, DefaultLogFields, ListLogLine} from 'simple-git'\n\nexport const factory = git\n\nexport const GitNotPresentError = () => {\n return new Abort(\n `Git is necessary in the environment to continue`,\n content`Install ${token.link('git', 'https://git-scm.com/book/en/v2/Getting-Started-Installing-Git')}`,\n )\n}\n\nexport const OutsideGitDirectoryError = (directory: string) => {\n return new Abort(`${token.path(directory)} is not a Git directory`)\n}\n\nexport const NoCommitError = () => {\n return new Abort(\n 'Must have at least one commit to run command',\n content`Run ${token.genericShellCommand(\"git commit -m 'Initial commit'\")} to create your first commit.`,\n )\n}\n\nexport const DetachedHeadError = () => {\n return new Abort(\n \"Git HEAD can't be detached to run command\",\n content`Run ${token.genericShellCommand('git checkout [branchName]')} to reattach HEAD or see git ${token.link(\n 'documentation',\n 'https://git-scm.com/book/en/v2/Git-Internals-Git-References',\n )} for more details`,\n )\n}\n\nexport async function initializeRepository(directory: string, initialBranch = 'main') {\n debug(content`Initializing git repository at ${token.path(directory)}...`)\n await ensurePresentOrAbort()\n // We use init and checkout instead of `init --initial-branch` because the latter is only supported in git 2.28+\n const repo = git(directory)\n await repo.init()\n await repo.checkoutLocalBranch(initialBranch)\n}\n\nexport interface GitIgnoreTemplate {\n [section: string]: string[]\n}\nexport function createGitIgnore(directory: string, template: GitIgnoreTemplate): void {\n debug(content`Creating .gitignore at ${token.path(directory)}...`)\n const filePath = `${directory}/.gitignore`\n\n let fileContent = ''\n for (const [section, lines] of Object.entries(template)) {\n fileContent += `# ${section}\\n`\n fileContent += `${lines.join('\\n')}\\n\\n`\n }\n\n appendSync(filePath, fileContent)\n}\n\nexport async function downloadRepository({\n repoUrl,\n destination,\n progressUpdater,\n shallow,\n}: {\n repoUrl: string\n destination: string\n progressUpdater?: (statusString: string) => void\n shallow?: boolean\n}) {\n debug(content`Git-cloning repository ${repoUrl} into ${token.path(destination)}...`)\n await ensurePresentOrAbort()\n const [repository, branch] = repoUrl.split('#')\n const options: TaskOptions = {'--recurse-submodules': null}\n if (branch) {\n options['--branch'] = branch\n }\n if (shallow) {\n options['--depth'] = 1\n }\n const progress = ({stage, progress, processed, total}: SimpleGitProgressEvent) => {\n const updateString = `${stage}, ${processed}/${total} objects (${progress}% complete)`\n if (progressUpdater) progressUpdater(updateString)\n }\n\n const simpleGitOptions = {\n progress,\n ...(!isTerminalInteractive() && {config: ['core.askpass=true']}),\n }\n try {\n await git(simpleGitOptions).clone(repository!, destination, options)\n } catch (err) {\n if (err instanceof Error) {\n const abortError = new Abort(err.message)\n abortError.stack = err.stack\n throw abortError\n }\n throw err\n }\n}\n\nexport async function getLatestCommit(directory?: string): Promise<DefaultLogFields & ListLogLine> {\n const logs = await git({baseDir: directory}).log({\n maxCount: 1,\n })\n if (!logs.latest) throw NoCommitError()\n return logs.latest\n}\n\nexport async function addAll(directory?: string): Promise<void> {\n const simpleGit = git({baseDir: directory})\n await simpleGit.raw('add', '--all')\n}\n\nexport async function commit(message: string, options?: {directory?: string; author?: string}): Promise<string> {\n const simpleGit = git({baseDir: options?.directory})\n\n const commitOptions = options?.author ? {'--author': options.author} : undefined\n const result = await simpleGit.commit(message, commitOptions)\n\n return result.commit\n}\n\nexport async function getHeadSymbolicRef(directory?: string): Promise<string> {\n const ref = await git({baseDir: directory}).raw('symbolic-ref', '-q', 'HEAD')\n if (!ref) throw DetachedHeadError()\n return ref.trim()\n}\n\n/**\n * If \"git\" is not present in the environment it throws\n * an abort error.\n */\nexport async function ensurePresentOrAbort() {\n if (!(await hasGit())) {\n throw GitNotPresentError()\n }\n}\n\n/**\n * If command run from outside a .git directory tree\n * it throws an abort error.\n */\nexport async function ensureInsideGitDirectory(directory?: string) {\n if (!(await git({baseDir: directory}).checkIsRepo())) {\n throw OutsideGitDirectoryError(directory || process.cwd())\n }\n}\n"]}
|
package/dist/http/fetch.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ declare type Response = ReturnType<typeof nodeFetch>;
|
|
|
8
8
|
* Note that we are exposing types from "node-fetch". The reason being is that
|
|
9
9
|
* they are consistent with the Web API so if we drop node-fetch in the future
|
|
10
10
|
* it won't require changes from the callers.
|
|
11
|
-
* @param url
|
|
12
|
-
* @param init
|
|
11
|
+
* @param url - This defines the resource that you wish to fetch.
|
|
12
|
+
* @param init - An object containing any custom settings that you want to apply to the request
|
|
13
13
|
* @returns A promise that resolves with the response.
|
|
14
14
|
*/
|
|
15
15
|
export default function fetch(url: RequestInfo, init?: RequestInit): Response;
|
package/dist/http/fetch.js
CHANGED
|
@@ -7,8 +7,8 @@ import nodeFetch from 'node-fetch';
|
|
|
7
7
|
* Note that we are exposing types from "node-fetch". The reason being is that
|
|
8
8
|
* they are consistent with the Web API so if we drop node-fetch in the future
|
|
9
9
|
* it won't require changes from the callers.
|
|
10
|
-
* @param url
|
|
11
|
-
* @param init
|
|
10
|
+
* @param url - This defines the resource that you wish to fetch.
|
|
11
|
+
* @param init - An object containing any custom settings that you want to apply to the request
|
|
12
12
|
* @returns A promise that resolves with the response.
|
|
13
13
|
*/
|
|
14
14
|
export default async function fetch(url, init) {
|
package/dist/http/fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/http/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,SAAS,MAAM,YAAY,CAAA;AAIlC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,KAAK,CAAC,GAAgB,EAAE,IAAkB;IACtE,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAgB,EAAE,IAAkB;IACrE,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAC,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,EAAE,EAAC,CAAC,CAAA;IAC3E,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {httpsAgent} from '../http.js'\nimport nodeFetch from 'node-fetch'\nimport type {RequestInfo, RequestInit} from 'node-fetch'\n\ntype Response = ReturnType<typeof nodeFetch>\n/**\n * An interface that abstracts way node-fetch. When Node has built-in\n * support for \"fetch\" in the standard library, we can drop the node-fetch\n * dependency from here.\n * Note that we are exposing types from \"node-fetch\". The reason being is that\n * they are consistent with the Web API so if we drop node-fetch in the future\n * it won't require changes from the callers.\n * @param url
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/http/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,SAAS,MAAM,YAAY,CAAA;AAIlC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,KAAK,CAAC,GAAgB,EAAE,IAAkB;IACtE,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAgB,EAAE,IAAkB;IACrE,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAC,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,EAAE,EAAC,CAAC,CAAA;IAC3E,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {httpsAgent} from '../http.js'\nimport nodeFetch from 'node-fetch'\nimport type {RequestInfo, RequestInit} from 'node-fetch'\n\ntype Response = ReturnType<typeof nodeFetch>\n/**\n * An interface that abstracts way node-fetch. When Node has built-in\n * support for \"fetch\" in the standard library, we can drop the node-fetch\n * dependency from here.\n * Note that we are exposing types from \"node-fetch\". The reason being is that\n * they are consistent with the Web API so if we drop node-fetch in the future\n * it won't require changes from the callers.\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request\n * @returns A promise that resolves with the response.\n */\nexport default async function fetch(url: RequestInfo, init?: RequestInit): Response {\n const response = await nodeFetch(url, init)\n return response\n}\n\n/**\n * A fetch function to use with Shopify services. The function ensures the right\n * TLS configuragion is used based on the environment in which the service is running\n * (e.g. spin)\n */\nexport async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const response = await nodeFetch(url, {...init, agent: await httpsAgent()})\n return response\n}\n"]}
|
package/dist/http.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function httpsAgent(): Promise<https.Agent>;
|
|
|
21
21
|
* This utility function allows controlling the behavior in a per-service level by returning
|
|
22
22
|
* the value of for the "rejectUnauthorized" attribute that's used in the https agent.
|
|
23
23
|
*
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns A promise that resolves with a boolean indicating whether
|
|
25
25
|
* unauthorized requests should be rejected or not.
|
|
26
26
|
*/
|
|
27
27
|
export declare function shouldRejectUnauthorizedRequests(): Promise<boolean>;
|
package/dist/http.js
CHANGED
|
@@ -23,7 +23,7 @@ export async function httpsAgent() {
|
|
|
23
23
|
* This utility function allows controlling the behavior in a per-service level by returning
|
|
24
24
|
* the value of for the "rejectUnauthorized" attribute that's used in the https agent.
|
|
25
25
|
*
|
|
26
|
-
* @returns
|
|
26
|
+
* @returns A promise that resolves with a boolean indicating whether
|
|
27
27
|
* unauthorized requests should be rejected or not.
|
|
28
28
|
*/
|
|
29
29
|
export async function shouldRejectUnauthorizedRequests() {
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,YAAY,EAIZ,WAAW,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,OAAO,GACR,MAAM,IAAI,CAAA;AAEX;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,EAAC,kBAAkB,EAAE,MAAM,gCAAgC,EAAE,EAAC,CAAC,CAAA;AACxF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,CAAC,MAAM,kBAAkB,EAAE,CAAC,KAAK,MAAM,CAAA;AAChD,CAAC","sourcesContent":["import {serviceEnvironment} from './environment/service.js'\nimport https from 'https'\n\nexport {default as fetch} from './http/fetch.js'\nexport {graphqlClient} from './http/graphql.js'\nexport {shopifyFetch} from './http/fetch.js'\nexport {default as formData} from './http/formdata.js'\n\nexport {\n createApp,\n createRouter,\n IncomingMessage,\n ServerResponse,\n CompatibilityEvent,\n createError,\n send,\n sendError,\n sendRedirect,\n H3Error,\n} from 'h3'\n\n/**\n * This utility function returns the https.Agent to use for a given service. The agent\n * includes the right configuration based on the service's environment. For example,\n * if the service is running in a Spin environment, the attribute \"rejectUnauthorized\" is\n * set to false\n */\nexport async function httpsAgent() {\n return new https.Agent({rejectUnauthorized: await shouldRejectUnauthorizedRequests()})\n}\n\n/**\n * Spin stores the CA certificate in the keychain and it should be used when sending HTTP\n * requests to Spin instances. However, Node doesn't read certificates from the Keychain\n * by default, which leads to Shopifolks running into issues that they workaround by setting the\n * NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable, which applies to all the HTTP\n * requests sent from the CLI (context: https://github.com/nodejs/node/issues/39657)\n * This utility function allows controlling the behavior in a per-service level by returning\n * the value of for the \"rejectUnauthorized\" attribute that's used in the https agent.\n *\n * @returns
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,YAAY,EAIZ,WAAW,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,OAAO,GACR,MAAM,IAAI,CAAA;AAEX;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,EAAC,kBAAkB,EAAE,MAAM,gCAAgC,EAAE,EAAC,CAAC,CAAA;AACxF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,CAAC,MAAM,kBAAkB,EAAE,CAAC,KAAK,MAAM,CAAA;AAChD,CAAC","sourcesContent":["import {serviceEnvironment} from './environment/service.js'\nimport https from 'https'\n\nexport {default as fetch} from './http/fetch.js'\nexport {graphqlClient} from './http/graphql.js'\nexport {shopifyFetch} from './http/fetch.js'\nexport {default as formData} from './http/formdata.js'\n\nexport {\n createApp,\n createRouter,\n IncomingMessage,\n ServerResponse,\n CompatibilityEvent,\n createError,\n send,\n sendError,\n sendRedirect,\n H3Error,\n} from 'h3'\n\n/**\n * This utility function returns the https.Agent to use for a given service. The agent\n * includes the right configuration based on the service's environment. For example,\n * if the service is running in a Spin environment, the attribute \"rejectUnauthorized\" is\n * set to false\n */\nexport async function httpsAgent() {\n return new https.Agent({rejectUnauthorized: await shouldRejectUnauthorizedRequests()})\n}\n\n/**\n * Spin stores the CA certificate in the keychain and it should be used when sending HTTP\n * requests to Spin instances. However, Node doesn't read certificates from the Keychain\n * by default, which leads to Shopifolks running into issues that they workaround by setting the\n * NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable, which applies to all the HTTP\n * requests sent from the CLI (context: https://github.com/nodejs/node/issues/39657)\n * This utility function allows controlling the behavior in a per-service level by returning\n * the value of for the \"rejectUnauthorized\" attribute that's used in the https agent.\n *\n * @returns A promise that resolves with a boolean indicating whether\n * unauthorized requests should be rejected or not.\n */\nexport async function shouldRejectUnauthorizedRequests(): Promise<boolean> {\n return (await serviceEnvironment()) !== 'spin'\n}\n"]}
|
package/dist/id.d.ts
CHANGED
package/dist/id.js
CHANGED
package/dist/id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAA;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAW,EAAE;IAC7C,OAAO,UAAU,EAAE,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAW,EAAE;IAC1C,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,MAAM,UAAU,GAAG,sCAAsC,CAAA;IACzD,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAA;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAA;KAC1E;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import {randomUUID} from 'crypto'\n\n/**\n * Generates and returns a random UUID.\n * @returns
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAA;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAW,EAAE;IAC7C,OAAO,UAAU,EAAE,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAW,EAAE;IAC1C,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,MAAM,UAAU,GAAG,sCAAsC,CAAA;IACzD,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAA;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAA;KAC1E;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import {randomUUID} from 'crypto'\n\n/**\n * Generates and returns a random UUID.\n * @returns The random UUID generated.\n */\nexport const generateRandomUUID = (): string => {\n return randomUUID()\n}\n\nexport const generateShortId = (): string => {\n let result = ''\n const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'\n const charactersLength = characters.length\n for (let i = 0; i < 7; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength))\n }\n return result\n}\n"]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Enum for the differnet APIs the CLI can interact with.
|
|
3
3
|
* @readonly
|
|
4
|
-
* @enum {number}
|
|
5
4
|
*/
|
|
6
5
|
export declare type Service = 'shopify' | 'partners' | 'identity';
|
|
7
6
|
/**
|
|
8
7
|
* Enum that represents the environment to use for a given service.
|
|
9
8
|
* @readonly
|
|
10
|
-
* @enum {number}
|
|
11
9
|
*/
|
|
12
10
|
export declare enum Environment {
|
|
13
11
|
Local = "local",
|
package/dist/network/service.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/network/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/network/service.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,wCAAyB,CAAA;IACzB,4BAAa,CAAA;AACf,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB","sourcesContent":["/**\n * Enum for the differnet APIs the CLI can interact with.\n * @readonly\n */\nexport type Service = 'shopify' | 'partners' | 'identity'\n\n/**\n * Enum that represents the environment to use for a given service.\n * @readonly\n */\nexport enum Environment {\n Local = 'local',\n Production = 'production',\n Spin = 'spin',\n}\n"]}
|
package/dist/node/archiver.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* the zip generated by this function from a Windows environment won't work because paths
|
|
4
4
|
* need to be made backward-slash.
|
|
5
5
|
*
|
|
6
|
-
* @param inputDirectory
|
|
7
|
-
* @param outputZipPath
|
|
6
|
+
* @param inputDirectory - The absolute path to the directory to be zipped.
|
|
7
|
+
* @param outputZipPath - The absolute path to the output zip file.
|
|
8
8
|
*/
|
|
9
9
|
export declare function zip(inputDirectory: string, outputZipPath: string): Promise<void>;
|
package/dist/node/archiver.js
CHANGED
|
@@ -7,8 +7,8 @@ import { createWriteStream } from 'node:fs';
|
|
|
7
7
|
* the zip generated by this function from a Windows environment won't work because paths
|
|
8
8
|
* need to be made backward-slash.
|
|
9
9
|
*
|
|
10
|
-
* @param inputDirectory
|
|
11
|
-
* @param outputZipPath
|
|
10
|
+
* @param inputDirectory - The absolute path to the directory to be zipped.
|
|
11
|
+
* @param outputZipPath - The absolute path to the output zip file.
|
|
12
12
|
*/
|
|
13
13
|
export async function zip(inputDirectory, outputZipPath) {
|
|
14
14
|
debug(content `Zipping ${token.path(inputDirectory)} into ${token.path(outputZipPath)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../src/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AAClD,OAAO,EAAC,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAC,MAAM,YAAY,CAAA;AACzD,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AACzC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,cAAsB,EAAE,aAAqB;IACrE,KAAK,CAAC,OAAO,CAAA,WAAW,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACvF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,EAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAC,CAAC,CAAA;IACnH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC/B,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAA;QAE/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;YACjB,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK;YACjC,MAAM,CAAC,KAAK,CAAC,CAAA;QACf,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;SACjD;QAED,mEAAmE;QACnE,OAAO,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {debug, content, token} from '../output.js'\nimport {glob, relative as relativePath} from '../path.js'\nimport archiver from 'archiver'\nimport {createWriteStream} from 'node:fs'\n/**\n * It zips a directory normalizing the paths to be forward-slash. Note that unzipping\n * the zip generated by this function from a Windows environment won't work because paths\n * need to be made backward-slash.\n *\n * @param inputDirectory
|
|
1
|
+
{"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../src/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,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O,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {debug, content, token} from '../output.js'\nimport {glob, relative as relativePath} from '../path.js'\nimport archiver from 'archiver'\nimport {createWriteStream} from 'node:fs'\n/**\n * It zips a directory normalizing the paths to be forward-slash. Note that unzipping\n * the zip generated by this function from a Windows environment won't work because paths\n * need to be made backward-slash.\n *\n * @param inputDirectory - The absolute path to the directory to be zipped.\n * @param outputZipPath - The absolute path to the output zip file.\n */\nexport async function zip(inputDirectory: string, outputZipPath: string): Promise<void> {\n debug(content`Zipping ${token.path(inputDirectory)} into ${token.path(outputZipPath)}`)\n const pathsToZip = await glob('**/*', {cwd: inputDirectory, absolute: true, dot: true, followSymbolicLinks: false})\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n const output = createWriteStream(outputZipPath)\n\n output.on('close', function () {\n resolve()\n })\n archive.on('error', function (error) {\n reject(error)\n })\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n}\n"]}
|
package/dist/node/checksum.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Abort } from '../error.js';
|
|
2
2
|
/**
|
|
3
3
|
* An error that's thrown when a file's MD5 doesn't match the expected value.
|
|
4
|
-
* @param options An options object that includes the file path, and the expected and actual MD5.
|
|
4
|
+
* @param options - An options object that includes the file path, and the expected and actual MD5.
|
|
5
5
|
* @returns An instance of Abort.
|
|
6
6
|
*/
|
|
7
7
|
export declare const InvalidChecksumError: ({ file, expected, got }: {
|
|
@@ -12,7 +12,7 @@ export declare const InvalidChecksumError: ({ file, expected, got }: {
|
|
|
12
12
|
/**
|
|
13
13
|
* Given a local file and a URL pointing to a remote file representing the MD5 of a local file,
|
|
14
14
|
* it validates the authenticity of the binary using an MD5 checksum.
|
|
15
|
-
* @param options
|
|
15
|
+
* @param options - The file to validate and the URL that points to the file containing the MD5.
|
|
16
16
|
*/
|
|
17
17
|
export declare function validateMD5({ file, md5FileURL }: {
|
|
18
18
|
file: string;
|
package/dist/node/checksum.js
CHANGED
|
@@ -4,7 +4,7 @@ import { debug, token } from '../output.js';
|
|
|
4
4
|
import md5File from 'md5-file';
|
|
5
5
|
/**
|
|
6
6
|
* An error that's thrown when a file's MD5 doesn't match the expected value.
|
|
7
|
-
* @param options An options object that includes the file path, and the expected and actual MD5.
|
|
7
|
+
* @param options - An options object that includes the file path, and the expected and actual MD5.
|
|
8
8
|
* @returns An instance of Abort.
|
|
9
9
|
*/
|
|
10
10
|
export const InvalidChecksumError = ({ file, expected, got }) => {
|
|
@@ -13,7 +13,7 @@ export const InvalidChecksumError = ({ file, expected, got }) => {
|
|
|
13
13
|
/**
|
|
14
14
|
* Given a local file and a URL pointing to a remote file representing the MD5 of a local file,
|
|
15
15
|
* it validates the authenticity of the binary using an MD5 checksum.
|
|
16
|
-
* @param options
|
|
16
|
+
* @param options - The file to validate and the URL that points to the file containing the MD5.
|
|
17
17
|
*/
|
|
18
18
|
export async function validateMD5({ file, md5FileURL }) {
|
|
19
19
|
debug(`Checking MD5 of file ${token.path(file)} against the MD5 in ${token.link('URL', md5FileURL)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checksum.js","sourceRoot":"","sources":["../../src/node/checksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,KAAK,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AACzC,OAAO,OAAO,MAAM,UAAU,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAgD,EAAE,EAAE;IAC3G,OAAO,IAAI,KAAK,CAAC,qBAAqB,IAAI,qCAAqC,QAAQ,aAAa,GAAG,GAAG,CAAC,CAAA;AAC7G,CAAC,CAAA;AACD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAC,IAAI,EAAE,UAAU,EAAqC;IACtF,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;IACrG,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3C,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAA;IAC5C,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAA;IAC/C,IAAI,CAAC,CAAC,YAAY,KAAK,SAAS,CAAC,EAAE;QACjC,MAAM,oBAAoB,CAAC;YACzB,IAAI;YACJ,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAA;KACH;AACH,CAAC","sourcesContent":["import {fetch} from '../http.js'\nimport {Abort} from '../error.js'\nimport {debug, token} from '../output.js'\nimport md5File from 'md5-file'\n\n/**\n * An error that's thrown when a file's MD5 doesn't match the expected value.\n * @param options An options object that includes the file path, and the expected and actual MD5.\n * @returns An instance of Abort.\n */\nexport const InvalidChecksumError = ({file, expected, got}: {file: string; expected: string; got: string}) => {\n return new Abort(`The validation of ${file} failed. We expected the checksum ${expected}, but got ${got})`)\n}\n/**\n * Given a local file and a URL pointing to a remote file representing the MD5 of a local file,\n * it validates the authenticity of the binary using an MD5 checksum.\n * @param options
|
|
1
|
+
{"version":3,"file":"checksum.js","sourceRoot":"","sources":["../../src/node/checksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,KAAK,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AACzC,OAAO,OAAO,MAAM,UAAU,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAgD,EAAE,EAAE;IAC3G,OAAO,IAAI,KAAK,CAAC,qBAAqB,IAAI,qCAAqC,QAAQ,aAAa,GAAG,GAAG,CAAC,CAAA;AAC7G,CAAC,CAAA;AACD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAC,IAAI,EAAE,UAAU,EAAqC;IACtF,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;IACrG,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3C,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAA;IAC5C,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAA;IAC/C,IAAI,CAAC,CAAC,YAAY,KAAK,SAAS,CAAC,EAAE;QACjC,MAAM,oBAAoB,CAAC;YACzB,IAAI;YACJ,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAA;KACH;AACH,CAAC","sourcesContent":["import {fetch} from '../http.js'\nimport {Abort} from '../error.js'\nimport {debug, token} from '../output.js'\nimport md5File from 'md5-file'\n\n/**\n * An error that's thrown when a file's MD5 doesn't match the expected value.\n * @param options - An options object that includes the file path, and the expected and actual MD5.\n * @returns An instance of Abort.\n */\nexport const InvalidChecksumError = ({file, expected, got}: {file: string; expected: string; got: string}) => {\n return new Abort(`The validation of ${file} failed. We expected the checksum ${expected}, but got ${got})`)\n}\n/**\n * Given a local file and a URL pointing to a remote file representing the MD5 of a local file,\n * it validates the authenticity of the binary using an MD5 checksum.\n * @param options - The file to validate and the URL that points to the file containing the MD5.\n */\nexport async function validateMD5({file, md5FileURL}: {file: string; md5FileURL: string}) {\n debug(`Checking MD5 of file ${token.path(file)} against the MD5 in ${token.link('URL', md5FileURL)}`)\n const md5Digest = await md5File(file)\n const md5Response = await fetch(md5FileURL)\n const md5Contents = await md5Response.text()\n const canonicalMD5 = md5Contents.split(' ')[0]!\n if (!(canonicalMD5 === md5Digest)) {\n throw InvalidChecksumError({\n file,\n got: md5Digest,\n expected: canonicalMD5,\n })\n }\n}\n"]}
|
package/dist/node/cli.d.ts
CHANGED
|
@@ -11,12 +11,11 @@ interface RunCLIOptions {
|
|
|
11
11
|
/**
|
|
12
12
|
* A function that abstracts away setting up the environment and running
|
|
13
13
|
* a CLI
|
|
14
|
-
* @param options
|
|
14
|
+
* @param options - Options.
|
|
15
15
|
*/
|
|
16
16
|
export declare function runCLI(options: RunCLIOptions): Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* A function for create-x CLIs that automatically runs the "init" command.
|
|
19
|
-
* @param options
|
|
20
19
|
*/
|
|
21
20
|
export declare function runCreateCLI(options: RunCLIOptions): Promise<void>;
|
|
22
21
|
export declare function useLocalCLIIfDetected(filepath: string): Promise<boolean>;
|
package/dist/node/cli.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTANT NOTE: Imports in this module are dynamic to ensure that "setupEnvironmentVariables" can dynamically
|
|
3
|
-
* set the DEBUG environment variable before the 'debug' package sets up its configuration when modules
|
|
4
|
-
* are loaded statically.
|
|
5
|
-
*/
|
|
6
1
|
function setupEnvironmentVariables(options) {
|
|
7
2
|
/**
|
|
8
3
|
* By setting DEBUG=* when --verbose is passed we are increasing the
|
|
@@ -19,13 +14,13 @@ function setupEnvironmentVariables(options) {
|
|
|
19
14
|
/**
|
|
20
15
|
* A function that abstracts away setting up the environment and running
|
|
21
16
|
* a CLI
|
|
22
|
-
* @param options
|
|
17
|
+
* @param options - Options.
|
|
23
18
|
*/
|
|
24
19
|
export async function runCLI(options) {
|
|
25
20
|
setupEnvironmentVariables(options);
|
|
26
21
|
/**
|
|
27
22
|
* These imports need to be dynamic because if they are static
|
|
28
|
-
* they are loaded before
|
|
23
|
+
* they are loaded before we set the DEBUG=* environment variable
|
|
29
24
|
* and therefore it has no effect.
|
|
30
25
|
*/
|
|
31
26
|
const { errorHandler } = await import('./error-handler.js');
|
|
@@ -38,7 +33,6 @@ export async function runCLI(options) {
|
|
|
38
33
|
}
|
|
39
34
|
/**
|
|
40
35
|
* A function for create-x CLIs that automatically runs the "init" command.
|
|
41
|
-
* @param options
|
|
42
36
|
*/
|
|
43
37
|
export async function runCreateCLI(options) {
|
|
44
38
|
setupEnvironmentVariables(options);
|