@shopify/cli-kit 3.32.0 → 3.33.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 (211) hide show
  1. package/dist/constants.d.ts +0 -1
  2. package/dist/constants.js +0 -1
  3. package/dist/constants.js.map +1 -1
  4. package/dist/environment/local.d.ts +0 -1
  5. package/dist/environment/local.js +0 -3
  6. package/dist/environment/local.js.map +1 -1
  7. package/dist/http/fetch.js +1 -1
  8. package/dist/http/fetch.js.map +1 -1
  9. package/dist/http.d.ts +0 -1
  10. package/dist/http.js +0 -1
  11. package/dist/http.js.map +1 -1
  12. package/dist/index.d.ts +0 -6
  13. package/dist/index.js +0 -6
  14. package/dist/index.js.map +1 -1
  15. package/dist/npm.js +1 -1
  16. package/dist/npm.js.map +1 -1
  17. package/dist/private/common/array.d.ts +1 -0
  18. package/dist/private/common/array.js +4 -0
  19. package/dist/private/common/array.js.map +1 -0
  20. package/dist/private/node/analytics.js +2 -2
  21. package/dist/private/node/analytics.js.map +1 -1
  22. package/dist/private/node/api/graphql.d.ts +5 -0
  23. package/dist/private/node/api/graphql.js +63 -0
  24. package/dist/private/node/api/graphql.js.map +1 -0
  25. package/dist/{api/common.d.ts → private/node/api/headers.d.ts} +3 -8
  26. package/dist/{api/common.js → private/node/api/headers.js} +20 -60
  27. package/dist/private/node/api/headers.js.map +1 -0
  28. package/dist/private/node/api/rest.d.ts +6 -0
  29. package/dist/private/node/api/rest.js +27 -0
  30. package/dist/private/node/api/rest.js.map +1 -0
  31. package/dist/private/node/ui/components/FullScreen.js +11 -9
  32. package/dist/private/node/ui/components/FullScreen.js.map +1 -1
  33. package/dist/private/node/ui/components/SelectPrompt.js +15 -3
  34. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  35. package/dist/private/node/ui/components/Subdued.d.ts +9 -0
  36. package/dist/private/node/ui/components/Subdued.js +10 -0
  37. package/dist/private/node/ui/components/Subdued.js.map +1 -0
  38. package/dist/private/node/ui/components/Subdued.test.d.ts +1 -0
  39. package/dist/private/node/ui/components/Subdued.test.js +11 -0
  40. package/dist/private/node/ui/components/Subdued.test.js.map +1 -0
  41. package/dist/private/node/ui/components/Table.js +1 -1
  42. package/dist/private/node/ui/components/Table.js.map +1 -1
  43. package/dist/private/node/ui/components/TokenizedText.d.ts +4 -1
  44. package/dist/private/node/ui/components/TokenizedText.js +4 -0
  45. package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
  46. package/dist/private/node/ui/components/TokenizedText.test.js +4 -1
  47. package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
  48. package/dist/public/common/array.d.ts +4 -0
  49. package/dist/public/common/array.js +4 -0
  50. package/dist/public/common/array.js.map +1 -1
  51. package/dist/public/common/collection.js.map +1 -1
  52. package/dist/public/common/object.d.ts +3 -3
  53. package/dist/public/common/object.js +5 -7
  54. package/dist/public/common/object.js.map +1 -1
  55. package/dist/public/common/string.d.ts +55 -1
  56. package/dist/public/common/string.js +93 -1
  57. package/dist/public/common/string.js.map +1 -1
  58. package/dist/public/common/url.d.ts +2 -1
  59. package/dist/public/common/url.js +3 -2
  60. package/dist/public/common/url.js.map +1 -1
  61. package/dist/public/node/api/admin.d.ts +41 -0
  62. package/dist/public/node/api/admin.js +98 -0
  63. package/dist/public/node/api/admin.js.map +1 -0
  64. package/dist/public/node/api/oxygen.d.ts +22 -0
  65. package/dist/public/node/api/oxygen.js +40 -0
  66. package/dist/public/node/api/oxygen.js.map +1 -0
  67. package/dist/{api → public/node/api}/partners.d.ts +11 -3
  68. package/dist/public/node/api/partners.js +45 -0
  69. package/dist/public/node/api/partners.js.map +1 -0
  70. package/dist/public/node/base-command.js +1 -1
  71. package/dist/public/node/base-command.js.map +1 -1
  72. package/dist/public/node/crypto.d.ts +42 -0
  73. package/dist/public/node/crypto.js +55 -0
  74. package/dist/public/node/crypto.js.map +1 -0
  75. package/dist/{template.d.ts → public/node/liquid.d.ts} +10 -2
  76. package/dist/{template.js → public/node/liquid.js} +18 -13
  77. package/dist/public/node/liquid.js.map +1 -0
  78. package/dist/public/node/os.d.ts +16 -0
  79. package/dist/{os.js → public/node/os.js} +33 -28
  80. package/dist/public/node/os.js.map +1 -0
  81. package/dist/public/node/presets.js +2 -2
  82. package/dist/public/node/presets.js.map +1 -1
  83. package/dist/public/node/ruby.d.ts +11 -7
  84. package/dist/public/node/ruby.js +90 -22
  85. package/dist/public/node/ruby.js.map +1 -1
  86. package/dist/public/node/tcp.d.ts +2 -0
  87. package/dist/public/node/tcp.js +9 -0
  88. package/dist/public/node/tcp.js.map +1 -1
  89. package/dist/public/node/toml.d.ts +15 -0
  90. package/dist/public/node/toml.js +20 -0
  91. package/dist/public/node/toml.js.map +1 -0
  92. package/dist/public/node/ui.d.ts +1 -1
  93. package/dist/public/node/ui.js.map +1 -1
  94. package/dist/public/node/vscode.d.ts +14 -0
  95. package/dist/{vscode.js → public/node/vscode.js} +13 -7
  96. package/dist/public/node/vscode.js.map +1 -0
  97. package/dist/session/authorize.d.ts +4 -0
  98. package/dist/session/authorize.js +7 -2
  99. package/dist/session/authorize.js.map +1 -1
  100. package/dist/{api/identity.d.ts → session/identity-token-validation.d.ts} +0 -0
  101. package/dist/{api/identity.js → session/identity-token-validation.js} +1 -1
  102. package/dist/session/identity-token-validation.js.map +1 -0
  103. package/dist/session/schema.d.ts +18 -18
  104. package/dist/session/store.js +1 -1
  105. package/dist/session/store.js.map +1 -1
  106. package/dist/session/validate.js +2 -2
  107. package/dist/session/validate.js.map +1 -1
  108. package/dist/session.js +3 -3
  109. package/dist/session.js.map +1 -1
  110. package/dist/system.js +1 -1
  111. package/dist/system.js.map +1 -1
  112. package/dist/tsconfig.tsbuildinfo +1 -1
  113. package/dist/ui/inquirer/autocomplete.js +1 -1
  114. package/dist/ui/inquirer/autocomplete.js.map +1 -1
  115. package/package.json +2 -2
  116. package/dist/api/admin.d.ts +0 -3
  117. package/dist/api/admin.js +0 -56
  118. package/dist/api/admin.js.map +0 -1
  119. package/dist/api/common.js.map +0 -1
  120. package/dist/api/graphql/all_app_extension_registrations.d.ts +0 -20
  121. package/dist/api/graphql/all_app_extension_registrations.js +0 -20
  122. package/dist/api/graphql/all_app_extension_registrations.js.map +0 -1
  123. package/dist/api/graphql/all_dev_stores_by_org.d.ts +0 -18
  124. package/dist/api/graphql/all_dev_stores_by_org.js +0 -21
  125. package/dist/api/graphql/all_dev_stores_by_org.js.map +0 -1
  126. package/dist/api/graphql/all_orgs.d.ts +0 -12
  127. package/dist/api/graphql/all_orgs.js +0 -14
  128. package/dist/api/graphql/all_orgs.js.map +0 -1
  129. package/dist/api/graphql/convert_dev_to_test_store.d.ts +0 -16
  130. package/dist/api/graphql/convert_dev_to_test_store.js +0 -13
  131. package/dist/api/graphql/convert_dev_to_test_store.js.map +0 -1
  132. package/dist/api/graphql/create_app.d.ts +0 -29
  133. package/dist/api/graphql/create_app.js +0 -33
  134. package/dist/api/graphql/create_app.js.map +0 -1
  135. package/dist/api/graphql/create_deployment.d.ts +0 -33
  136. package/dist/api/graphql/create_deployment.js +0 -25
  137. package/dist/api/graphql/create_deployment.js.map +0 -1
  138. package/dist/api/graphql/extension_create.d.ts +0 -30
  139. package/dist/api/graphql/extension_create.js +0 -26
  140. package/dist/api/graphql/extension_create.js.map +0 -1
  141. package/dist/api/graphql/extension_specifications.d.ts +0 -27
  142. package/dist/api/graphql/extension_specifications.js +0 -22
  143. package/dist/api/graphql/extension_specifications.js.map +0 -1
  144. package/dist/api/graphql/find_app.d.ts +0 -14
  145. package/dist/api/graphql/find_app.js +0 -17
  146. package/dist/api/graphql/find_app.js.map +0 -1
  147. package/dist/api/graphql/find_org.d.ts +0 -18
  148. package/dist/api/graphql/find_org.js +0 -21
  149. package/dist/api/graphql/find_org.js.map +0 -1
  150. package/dist/api/graphql/find_org_basic.d.ts +0 -11
  151. package/dist/api/graphql/find_org_basic.js +0 -14
  152. package/dist/api/graphql/find_org_basic.js.map +0 -1
  153. package/dist/api/graphql/find_store_by_domain.d.ts +0 -21
  154. package/dist/api/graphql/find_store_by_domain.js +0 -24
  155. package/dist/api/graphql/find_store_by_domain.js.map +0 -1
  156. package/dist/api/graphql/functions/api_schema_definition.d.ts +0 -9
  157. package/dist/api/graphql/functions/api_schema_definition.js +0 -7
  158. package/dist/api/graphql/functions/api_schema_definition.js.map +0 -1
  159. package/dist/api/graphql/functions/app_function_set.d.ts +0 -30
  160. package/dist/api/graphql/functions/app_function_set.js +0 -38
  161. package/dist/api/graphql/functions/app_function_set.js.map +0 -1
  162. package/dist/api/graphql/functions/function_service_proxy.d.ts +0 -4
  163. package/dist/api/graphql/functions/function_service_proxy.js +0 -7
  164. package/dist/api/graphql/functions/function_service_proxy.js.map +0 -1
  165. package/dist/api/graphql/functions/upload_url_generate.d.ts +0 -12
  166. package/dist/api/graphql/functions/upload_url_generate.js +0 -11
  167. package/dist/api/graphql/functions/upload_url_generate.js.map +0 -1
  168. package/dist/api/graphql/generate_signed_upload_url.d.ts +0 -15
  169. package/dist/api/graphql/generate_signed_upload_url.js +0 -15
  170. package/dist/api/graphql/generate_signed_upload_url.js.map +0 -1
  171. package/dist/api/graphql/get_urls.d.ts +0 -10
  172. package/dist/api/graphql/get_urls.js +0 -10
  173. package/dist/api/graphql/get_urls.js.map +0 -1
  174. package/dist/api/graphql/get_variant_id.d.ts +0 -17
  175. package/dist/api/graphql/get_variant_id.js +0 -20
  176. package/dist/api/graphql/get_variant_id.js.map +0 -1
  177. package/dist/api/graphql/index.d.ts +0 -21
  178. package/dist/api/graphql/index.js +0 -22
  179. package/dist/api/graphql/index.js.map +0 -1
  180. package/dist/api/graphql/update_draft.d.ts +0 -33
  181. package/dist/api/graphql/update_draft.js +0 -24
  182. package/dist/api/graphql/update_draft.js.map +0 -1
  183. package/dist/api/graphql/update_urls.d.ts +0 -14
  184. package/dist/api/graphql/update_urls.js +0 -12
  185. package/dist/api/graphql/update_urls.js.map +0 -1
  186. package/dist/api/identity.js.map +0 -1
  187. package/dist/api/oxygen.d.ts +0 -5
  188. package/dist/api/oxygen.js +0 -30
  189. package/dist/api/oxygen.js.map +0 -1
  190. package/dist/api/partners.js +0 -44
  191. package/dist/api/partners.js.map +0 -1
  192. package/dist/api.d.ts +0 -6
  193. package/dist/api.js +0 -7
  194. package/dist/api.js.map +0 -1
  195. package/dist/http/graphql.d.ts +0 -13
  196. package/dist/http/graphql.js +0 -12
  197. package/dist/http/graphql.js.map +0 -1
  198. package/dist/os.d.ts +0 -11
  199. package/dist/os.js.map +0 -1
  200. package/dist/public/node/checksum.d.ts +0 -20
  201. package/dist/public/node/checksum.js +0 -32
  202. package/dist/public/node/checksum.js.map +0 -1
  203. package/dist/string.d.ts +0 -28
  204. package/dist/string.js +0 -77
  205. package/dist/string.js.map +0 -1
  206. package/dist/template.js.map +0 -1
  207. package/dist/toml.d.ts +0 -3
  208. package/dist/toml.js +0 -8
  209. package/dist/toml.js.map +0 -1
  210. package/dist/vscode.d.ts +0 -8
  211. package/dist/vscode.js.map +0 -1
@@ -1,44 +0,0 @@
1
- import { buildHeaders, debugLogRequest, handlingErrors } from './common.js';
2
- import { ScriptServiceProxyQuery } from './graphql/index.js';
3
- import { partners as partnersFqdn } from '../environment/fqdn.js';
4
- import { graphqlClient } from '../http/graphql.js';
5
- import { debug } from '../output.js';
6
- import { performance } from 'perf_hooks';
7
- export async function request(query, token, variables) {
8
- const api = 'Partners';
9
- return handlingErrors(api, async () => {
10
- const fqdn = await partnersFqdn();
11
- const url = `https://${fqdn}/api/cli/graphql`;
12
- const headers = await buildHeaders(token);
13
- debugLogRequest(api, query, variables, headers);
14
- const client = await graphqlClient({ headers, url });
15
- const t0 = performance.now();
16
- const response = await client.request(query, variables);
17
- const t1 = performance.now();
18
- debug(`Request to ${url.toString()} completed in ${Math.round(t1 - t0)} ms`);
19
- return response;
20
- });
21
- }
22
- /**
23
- * Function queries are proxied through the script service proxy.
24
- * To execute a query, we encapsulate it inside another query (including the variables)
25
- * This is done automatically, you just need to provide the query and the variables.
26
- *
27
- * @param apiKey - APIKey of the app where the query will be executed.
28
- * @param query - GraphQL query to execute.
29
- * @param token - Partners token
30
- * @param variables - GraphQL variables to pass to the query.
31
- * @returns The response of the query.
32
- */
33
- export async function functionProxyRequest(apiKey, query, token, variables) {
34
- const proxyVariables = {
35
- api_key: apiKey,
36
- query,
37
- variables: JSON.stringify(variables) || '{}',
38
- };
39
- const proxyQuery = ScriptServiceProxyQuery;
40
- const res = await request(proxyQuery, token, proxyVariables);
41
- const json = JSON.parse(res.scriptServiceProxy);
42
- return json;
43
- }
44
- //# sourceMappingURL=partners.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"partners.js","sourceRoot":"","sources":["../../src/api/partners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AACzE,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAC,QAAQ,IAAI,YAAY,EAAC,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAA;AAElC,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAA;AAEtC,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,KAAsB,EAAE,KAAa,EAAE,SAAqB;IAC3F,MAAM,GAAG,GAAG,UAAU,CAAA;IACtB,OAAO,cAAc,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,YAAY,EAAE,CAAA;QACjC,MAAM,GAAG,GAAG,WAAW,IAAI,kBAAkB,CAAA;QAC7C,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,CAAA;QACzC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAC/C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC,CAAA;QAClD,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;QAC5B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAI,KAAK,EAAE,SAAS,CAAC,CAAA;QAC1D,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;QAC5B,KAAK,CAAC,cAAc,GAAG,CAAC,QAAQ,EAAE,iBAAiB,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;QAC5E,OAAO,QAAQ,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC;AAMD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,KAAc,EACd,KAAa,EACb,SAAmB;IAEnB,MAAM,cAAc,GAAG;QACrB,OAAO,EAAE,MAAM;QACf,KAAK;QACL,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI;KAC7C,CAAA;IACD,MAAM,UAAU,GAAG,uBAAuB,CAAA;IAC1C,MAAM,GAAG,GAAkB,MAAM,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;IAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IAC/C,OAAO,IAAS,CAAA;AAClB,CAAC","sourcesContent":["import {buildHeaders, debugLogRequest, handlingErrors} from './common.js'\nimport {ScriptServiceProxyQuery} from './graphql/index.js'\nimport {partners as partnersFqdn} from '../environment/fqdn.js'\nimport {graphqlClient} from '../http/graphql.js'\nimport {debug} from '../output.js'\nimport {Variables, RequestDocument} from 'graphql-request'\nimport {performance} from 'perf_hooks'\n\nexport async function request<T>(query: RequestDocument, token: string, variables?: Variables): Promise<T> {\n const api = 'Partners'\n return handlingErrors(api, async () => {\n const fqdn = await partnersFqdn()\n const url = `https://${fqdn}/api/cli/graphql`\n const headers = await buildHeaders(token)\n debugLogRequest(api, query, variables, headers)\n const client = await graphqlClient({headers, url})\n const t0 = performance.now()\n const response = await client.request<T>(query, variables)\n const t1 = performance.now()\n debug(`Request to ${url.toString()} completed in ${Math.round(t1 - t0)} ms`)\n return response\n })\n}\n\ninterface ProxyResponse {\n scriptServiceProxy: string\n}\n\n/**\n * Function queries are proxied through the script service proxy.\n * To execute a query, we encapsulate it inside another query (including the variables)\n * This is done automatically, you just need to provide the query and the variables.\n *\n * @param apiKey - APIKey of the app where the query will be executed.\n * @param query - GraphQL query to execute.\n * @param token - Partners token\n * @param variables - GraphQL variables to pass to the query.\n * @returns The response of the query.\n */\nexport async function functionProxyRequest<T>(\n apiKey: string,\n query: unknown,\n token: string,\n variables?: unknown,\n): Promise<T> {\n const proxyVariables = {\n api_key: apiKey,\n query,\n variables: JSON.stringify(variables) || '{}',\n }\n const proxyQuery = ScriptServiceProxyQuery\n const res: ProxyResponse = await request(proxyQuery, token, proxyVariables)\n const json = JSON.parse(res.scriptServiceProxy)\n return json as T\n}\n"]}
package/dist/api.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as admin from './api/admin.js';
2
- import * as partners from './api/partners.js';
3
- import * as graphql from './api/graphql/index.js';
4
- import * as identity from './api/identity.js';
5
- import * as oxygen from './api/oxygen.js';
6
- export { admin, partners, graphql, identity, oxygen };
package/dist/api.js DELETED
@@ -1,7 +0,0 @@
1
- import * as admin from './api/admin.js';
2
- import * as partners from './api/partners.js';
3
- import * as graphql from './api/graphql/index.js';
4
- import * as identity from './api/identity.js';
5
- import * as oxygen from './api/oxygen.js';
6
- export { admin, partners, graphql, identity, oxygen };
7
- //# sourceMappingURL=api.js.map
package/dist/api.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,CAAA","sourcesContent":["import * as admin from './api/admin.js'\nimport * as partners from './api/partners.js'\nimport * as graphql from './api/graphql/index.js'\nimport * as identity from './api/identity.js'\nimport * as oxygen from './api/oxygen.js'\n\nexport {admin, partners, graphql, identity, oxygen}\n"]}
@@ -1,13 +0,0 @@
1
- import { GraphQLClient } from 'graphql-request';
2
- interface GraphqlClientOptions {
3
- url: string;
4
- headers: {
5
- [key: string]: string;
6
- };
7
- }
8
- /**
9
- * Creates a GraphQLClient instance with the right HTTPs agent baed on the service
10
- * the client will interact with.
11
- */
12
- export declare function graphqlClient(options: GraphqlClientOptions): Promise<GraphQLClient>;
13
- export {};
@@ -1,12 +0,0 @@
1
- import { httpsAgent } from '../http.js';
2
- import { GraphQLClient } from 'graphql-request';
3
- /**
4
- * Creates a GraphQLClient instance with the right HTTPs agent baed on the service
5
- * the client will interact with.
6
- */
7
- export async function graphqlClient(options) {
8
- const clientOptions = { agent: await httpsAgent(), headers: options.headers };
9
- const client = new GraphQLClient(options.url, clientOptions);
10
- return client;
11
- }
12
- //# sourceMappingURL=graphql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/http/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAO7C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA6B;IAC/D,MAAM,aAAa,GAAG,EAAC,KAAK,EAAE,MAAM,UAAU,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAA;IAC3E,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,CAAA;IAC5D,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import {httpsAgent} from '../http.js'\nimport {GraphQLClient} from 'graphql-request'\n\ninterface GraphqlClientOptions {\n url: string\n headers: {[key: string]: string}\n}\n\n/**\n * Creates a GraphQLClient instance with the right HTTPs agent baed on the service\n * the client will interact with.\n */\nexport async function graphqlClient(options: GraphqlClientOptions) {\n const clientOptions = {agent: await httpsAgent(), headers: options.headers}\n const client = new GraphQLClient(options.url, clientOptions)\n return client\n}\n"]}
package/dist/os.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- export declare const username: (platform?: NodeJS.Platform) => Promise<string | null>;
4
- /**
5
- * Returns the platform and architecture.
6
- * @returns Returns the current platform and architecture.
7
- */
8
- export declare const platformAndArch: (platform?: NodeJS.Platform) => {
9
- platform: string;
10
- arch: string;
11
- };
package/dist/os.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"os.js","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAC,QAAQ,IAAI,UAAU,EAAE,IAAI,IAAI,MAAM,EAAC,MAAM,IAAI,CAAA;AAEzD,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,MAAM,EAAC,GAAG,EAAC,GAAG,OAAO,CAAA;IAErB,OAAO,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,QAAQ,CAAA;AAC7F,CAAC,CAAA;AAED,MAAM,yBAAy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AAkB,CAAC,MAAM,CAAC,CAAA;QACjC,qDAAqD;KACtD;IAAC,MAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,WAAoC,OAAO,CAAC,QAAQ,EAClB,EAAE;IACpC,IAAI,IAAI,GAAG,MAAM,EAAE,CAAA;IACnB,IAAI,IAAI,KAAK,KAAK,EAAE;QAClB,IAAI,GAAG,OAAO,CAAA;KACf;IACD,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,IAAI,GAAG,KAAK,CAAA;KACb;IACD,IAAI,cAAc,GAAG,QAAkB,CAAA;IACvC,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QAC5B,cAAc,GAAG,SAAS,CAAA;KAC3B;IACD,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,CAAA;AACzC,CAAC,CAAA","sourcesContent":["import {debug, content} from './output.js'\nimport {execa} from 'execa'\nimport {userInfo as osUserInfo, arch as osArch} from 'os'\n\nconst getEnvironmentVariable = () => {\n const {env} = process\n\n return env.SUDO_USER || env.C9_USER || env.LOGNAME || env.USER || env.LNAME || env.USERNAME\n}\n\nconst getUsernameFromOsUserInfo = (): string | null => {\n try {\n return osUserInfo().username\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return null\n }\n}\n\nconst cleanWindowsCommand = (value: string) => value.replace(/^.*\\\\/, '')\n\nconst makeUsernameFromId = (userId: string) => `no-username-${userId}`\n\n// This code has been vendored from https://github.com/sindresorhus/username\n// because adding it as a transtive dependency causes conflicts with other\n// packages that haven't been yet migrated to the latest version.\nexport const username = async (platform: typeof process.platform = process.platform): Promise<string | null> => {\n debug(content`Obtaining user name...`)\n const environmentVariable = getEnvironmentVariable()\n if (environmentVariable) {\n return environmentVariable\n }\n\n const userInfoUsername = getUsernameFromOsUserInfo()\n if (userInfoUsername) {\n return userInfoUsername\n }\n\n /**\n\tFirst we try to get the ID of the user and then the actual username. We do this because in `docker run --user <uid>:<gid>` context, we don't have \"username\" available. Therefore, we have a fallback to `makeUsernameFromId` for such scenario. Applies also to the `sync()` method below.\n\t*/\n try {\n if (platform === 'win32') {\n const {stdout} = await execa('whoami')\n return cleanWindowsCommand(stdout)\n }\n\n const {stdout: userId} = await execa('id', ['-u'])\n try {\n const {stdout} = await execa('id', ['-un', userId])\n return stdout\n\n // eslint-disable-next-line no-catch-all/no-catch-all,no-empty\n } catch {}\n return makeUsernameFromId(userId)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return null\n }\n}\n\n/**\n * Returns the platform and architecture.\n * @returns Returns the current platform and architecture.\n */\nexport const platformAndArch = (\n platform: typeof process.platform = process.platform,\n): {platform: string; arch: string} => {\n let arch = osArch()\n if (arch === 'x64') {\n arch = 'amd64'\n }\n if (arch === 'ia32') {\n arch = '386'\n }\n let platformString = platform as string\n if (platform.match(/^win.+/)) {\n platformString = 'windows'\n }\n return {platform: platformString, arch}\n}\n"]}
@@ -1,20 +0,0 @@
1
- import { AbortError } from './error.js';
2
- /**
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.
5
- * @returns An instance of Abort.
6
- */
7
- export declare const InvalidChecksumError: ({ file, expected, got, }: {
8
- file: string;
9
- expected: string;
10
- got: string;
11
- }) => AbortError;
12
- /**
13
- * Given a local file and a URL pointing to a remote file representing the MD5 of a local file,
14
- * it validates the authenticity of the binary using an MD5 checksum.
15
- * @param options - The file to validate and the URL that points to the file containing the MD5.
16
- */
17
- export declare function validateMD5({ file, md5FileURL }: {
18
- file: string;
19
- md5FileURL: string;
20
- }): Promise<void>;
@@ -1,32 +0,0 @@
1
- import { AbortError } from './error.js';
2
- import { fetch } from '../../http.js';
3
- import { debug, token } from '../../output.js';
4
- import md5File from 'md5-file';
5
- /**
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.
8
- * @returns An instance of Abort.
9
- */
10
- export const InvalidChecksumError = ({ file, expected, got, }) => {
11
- return new AbortError(`The validation of ${file} failed. We expected the checksum ${expected}, but got ${got})`);
12
- };
13
- /**
14
- * Given a local file and a URL pointing to a remote file representing the MD5 of a local file,
15
- * it validates the authenticity of the binary using an MD5 checksum.
16
- * @param options - The file to validate and the URL that points to the file containing the MD5.
17
- */
18
- export async function validateMD5({ file, md5FileURL }) {
19
- debug(`Checking MD5 of file ${token.path(file)} against the MD5 in ${token.link('URL', md5FileURL)}`);
20
- const md5Digest = await md5File(file);
21
- const md5Response = await fetch(md5FileURL);
22
- const md5Contents = await md5Response.text();
23
- const canonicalMD5 = md5Contents.split(' ')[0];
24
- if (!(canonicalMD5 === md5Digest)) {
25
- throw InvalidChecksumError({
26
- file,
27
- got: md5Digest,
28
- expected: canonicalMD5,
29
- });
30
- }
31
- }
32
- //# sourceMappingURL=checksum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checksum.js","sourceRoot":"","sources":["../../../src/public/node/checksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAA;AACnC,OAAO,EAAC,KAAK,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,OAAO,MAAM,UAAU,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,IAAI,EACJ,QAAQ,EACR,GAAG,GAKJ,EAAc,EAAE;IACf,OAAO,IAAI,UAAU,CAAC,qBAAqB,IAAI,qCAAqC,QAAQ,aAAa,GAAG,GAAG,CAAC,CAAA;AAClH,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 {AbortError} from './error.js'\nimport {fetch} from '../../http.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 = ({\n file,\n expected,\n got,\n}: {\n file: string\n expected: string\n got: string\n}): AbortError => {\n return new AbortError(`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}): Promise<void> {\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/string.d.ts DELETED
@@ -1,28 +0,0 @@
1
- export { camelCase as camelize } from 'change-case';
2
- export { paramCase as hyphenize } from 'change-case';
3
- export { snakeCase as underscore } from 'change-case';
4
- export { constantCase as constantize } from 'change-case';
5
- /** Returns a random string */
6
- export declare function randomHex(size: number): string;
7
- export declare function generateRandomChallengePair(): {
8
- codeVerifier: string;
9
- codeChallenge: string;
10
- };
11
- export declare function hashString(str: string): string;
12
- /**
13
- * Given a string, it returns it with the first letter capitalized.
14
- * @param string - String whose first letter will be caplitalized.
15
- * @returns The given string with its first letter capitalized.
16
- */
17
- export declare function capitalize(string: string): string;
18
- /**
19
- * Try to convert a string to an int, falling back to undefined if unable to
20
- */
21
- export declare function tryParseInt(maybeInt: string | undefined): number | undefined;
22
- /**
23
- * Given a series of rows inside an array, where each row is an array of strings (representing columns)
24
- * Parse it into a single string with the columns aligned
25
- */
26
- export declare function linesToColumns(lines: string[][]): string;
27
- export declare const slugify: (str: string) => string;
28
- export declare const escapeRegExp: (str: string) => string;
package/dist/string.js DELETED
@@ -1,77 +0,0 @@
1
- import { unstyled } from './output.js';
2
- import crypto from 'crypto';
3
- export { camelCase as camelize } from 'change-case';
4
- export { paramCase as hyphenize } from 'change-case';
5
- export { snakeCase as underscore } from 'change-case';
6
- export { constantCase as constantize } from 'change-case';
7
- /** Returns a random string */
8
- export function randomHex(size) {
9
- return crypto.randomBytes(size).toString('hex');
10
- }
11
- export function generateRandomChallengePair() {
12
- const codeVerifier = base64URLEncode(crypto.randomBytes(32));
13
- const codeChallenge = base64URLEncode(sha256(codeVerifier));
14
- return { codeVerifier, codeChallenge };
15
- }
16
- function base64URLEncode(str) {
17
- return str.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/[=]/g, '');
18
- }
19
- function sha256(str) {
20
- return crypto.createHash('sha256').update(str).digest();
21
- }
22
- export function hashString(str) {
23
- return crypto.createHash('sha1').update(str).digest('hex');
24
- }
25
- /**
26
- * Given a string, it returns it with the first letter capitalized.
27
- * @param string - String whose first letter will be caplitalized.
28
- * @returns The given string with its first letter capitalized.
29
- */
30
- export function capitalize(string) {
31
- return string.substring(0, 1).toUpperCase() + string.substring(1);
32
- }
33
- /**
34
- * Try to convert a string to an int, falling back to undefined if unable to
35
- */
36
- export function tryParseInt(maybeInt) {
37
- let asInt;
38
- if (maybeInt !== undefined) {
39
- asInt = parseInt(maybeInt, 10);
40
- if (isNaN(asInt)) {
41
- asInt = undefined;
42
- }
43
- }
44
- return asInt;
45
- }
46
- /**
47
- * Given a series of rows inside an array, where each row is an array of strings (representing columns)
48
- * Parse it into a single string with the columns aligned
49
- */
50
- export function linesToColumns(lines) {
51
- const widths = [];
52
- for (let i = 0; lines[0] && i < lines[0].length; i++) {
53
- const columnRows = lines.map((line) => line[i]);
54
- widths.push(Math.max(...columnRows.map((row) => unstyled(row).length)));
55
- }
56
- const paddedLines = lines
57
- .map((line) => {
58
- return line
59
- .map((col, index) => {
60
- return `${col}${' '.repeat(widths[index] - unstyled(col).length)}`;
61
- })
62
- .join(' ')
63
- .trimEnd();
64
- })
65
- .join('\n');
66
- return paddedLines;
67
- }
68
- export const slugify = (str) => str
69
- .toLowerCase()
70
- .trim()
71
- .replace(/[^\w\s-]/g, '')
72
- .replace(/[\s_-]+/g, '-')
73
- .replace(/^-+|-+$/g, '');
74
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
75
- // $& means the whole matched string
76
- export const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
77
- //# sourceMappingURL=string.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAC,SAAS,IAAI,QAAQ,EAAC,MAAM,aAAa,CAAA;AACjD,O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,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,CACrC,GAAG;KACA,WAAW,EAAE;KACb,IAAI,EAAE;KACN,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;KACxB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;KACxB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AAE5B,6FAA6F;AAC7F,oCAAoC;AACpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA","sourcesContent":["import {unstyled} from './output.js'\nimport crypto from 'crypto'\n\nexport {camelCase as camelize} from 'change-case'\nexport {paramCase as hyphenize} from 'change-case'\nexport {snakeCase as underscore} from 'change-case'\nexport {constantCase as constantize} from 'change-case'\n\n/** Returns a random string */\nexport function randomHex(size: number): string {\n return crypto.randomBytes(size).toString('hex')\n}\n\nexport function generateRandomChallengePair() {\n const codeVerifier = base64URLEncode(crypto.randomBytes(32))\n const codeChallenge = base64URLEncode(sha256(codeVerifier))\n return {codeVerifier, codeChallenge}\n}\n\nfunction base64URLEncode(str: Buffer) {\n return str.toString('base64').replace(/\\+/g, '-').replace(/\\//g, '_').replace(/[=]/g, '')\n}\n\nfunction sha256(str: string) {\n return crypto.createHash('sha256').update(str).digest()\n}\n\nexport function hashString(str: string): string {\n return crypto.createHash('sha1').update(str).digest('hex')\n}\n\n/**\n * Given a string, it returns it with the first letter capitalized.\n * @param string - String whose first letter will be caplitalized.\n * @returns The given string with its first letter capitalized.\n */\nexport function capitalize(string: string) {\n return string.substring(0, 1).toUpperCase() + string.substring(1)\n}\n\n/**\n * Try to convert a string to an int, falling back to undefined if unable to\n */\nexport function tryParseInt(maybeInt: string | undefined) {\n let asInt: number | undefined\n if (maybeInt !== undefined) {\n asInt = parseInt(maybeInt, 10)\n if (isNaN(asInt)) {\n asInt = undefined\n }\n }\n return asInt\n}\n\n/**\n * Given a series of rows inside an array, where each row is an array of strings (representing columns)\n * Parse it into a single string with the columns aligned\n */\nexport function linesToColumns(lines: string[][]): string {\n const widths: number[] = []\n for (let i = 0; lines[0] && i < lines[0].length; i++) {\n const columnRows = lines.map((line) => line[i]!)\n widths.push(Math.max(...columnRows.map((row) => unstyled(row).length)))\n }\n const paddedLines = lines\n .map((line) => {\n return line\n .map((col, index) => {\n return `${col}${' '.repeat(widths[index]! - unstyled(col).length)}`\n })\n .join(' ')\n .trimEnd()\n })\n .join('\\n')\n return paddedLines\n}\n\nexport const slugify = (str: string) =>\n str\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/[\\s_-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping\n// $& means the whole matched string\nexport const escapeRegExp = (str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAA;AACvD,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,wBAAwB,EAAC,MAAM,WAAW,CAAA;AAChG,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAE/B,yDAAyD;AACzD,MAAM,UAAU,MAAM,CAAC,eAAuB;IAC5C,OAAO,CAAC,IAAY,EAAmB,EAAE;QACvC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE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gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YAC/C,MAAM,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;YAChC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,CAAA;YAC5C,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;YACjD,MAAM,YAAY,GAAG,MAAM,wBAAwB,CAAC,gBAAgB,CAAC,CAAA;YACrE,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;YACjE,MAAM,IAAI,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAA;YACrD,MAAM,KAAK,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAA;YACnD,IAAI,YAAY,EAAE;gBAChB,MAAM,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAA;aAC5C;SACF;aAAM;YACL,MAAM,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;SACzC;IACH,CAAC,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import {glob, join, dirname, relative} from './path.js'\nimport {mkdir, read, copy, chmod, isDirectory, write, hasExecutablePermissions} from './file.js'\nimport {content, token, debug} from './output.js'\nimport {Liquid} from 'liquidjs'\n\n// This line is necessary to register additional helpers.\nexport function create(templateContent: string) {\n return (data: object): Promise<string> => {\n const engine = new Liquid()\n return engine.render(engine.parse(templateContent), data)\n }\n}\n\n/**\n * Given a directory, it traverses the files and directories recursively\n * and replaces variables in directory and file names, and files' content\n * using the Liquid template engine.\n * Files indicate that they are liquid template by using the .liquid extension.\n * @param from - Directory that contains the template.\n * @param to - Output directory.\n * @param data - Data to feed the template engine.\n */\nexport async function recursiveDirectoryCopy(from: string, to: string, data: object) {\n debug(content`Copying template from directory ${token.path(from)} to ${token.path(to)}`)\n const templateFiles: string[] = await glob(join(from, '**/*'), {dot: true})\n\n const sortedTemplateFiles = templateFiles\n .map((path) => path.split('/'))\n .sort((lhs, rhs) => (lhs.length < rhs.length ? 1 : -1))\n .map((components) => components.join('/'))\n await Promise.all(\n sortedTemplateFiles.map(async (templateItemPath) => {\n const outputPath = await create(join(to, relative(from, templateItemPath)))(data)\n if (await isDirectory(templateItemPath)) {\n await mkdir(outputPath)\n } else if (templateItemPath.endsWith('.liquid')) {\n await mkdir(dirname(outputPath))\n const content = await read(templateItemPath)\n const contentOutput = await create(content)(data)\n const isExecutable = await hasExecutablePermissions(templateItemPath)\n const outputPathWithoutLiquid = outputPath.replace('.liquid', '')\n await copy(templateItemPath, outputPathWithoutLiquid)\n await write(outputPathWithoutLiquid, contentOutput)\n if (isExecutable) {\n await chmod(outputPathWithoutLiquid, 0o755)\n }\n } else {\n await copy(templateItemPath, outputPath)\n }\n }),\n )\n}\n"]}
package/dist/toml.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import * as toml from '@iarna/toml';
2
- export declare function decode(input: string): object;
3
- export declare function encode(content: toml.JsonMap): string;
package/dist/toml.js DELETED
@@ -1,8 +0,0 @@
1
- import * as toml from '@iarna/toml';
2
- export function decode(input) {
3
- return toml.parse(input);
4
- }
5
- export function encode(content) {
6
- return toml.stringify(content);
7
- }
8
- //# sourceMappingURL=toml.js.map
package/dist/toml.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"toml.js","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAEnC,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAqB;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC","sourcesContent":["import * as toml from '@iarna/toml'\n\nexport function decode(input: string): object {\n return toml.parse(input)\n}\n\nexport function encode(content: toml.JsonMap): string {\n return toml.stringify(content)\n}\n"]}
package/dist/vscode.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Check if user editor is VS Code
3
- */
4
- export declare const isVSCode: (root?: string) => Promise<boolean>;
5
- /**
6
- * Add VSCode extension recommendations
7
- */
8
- export declare function addRecommendedExtensions(directory: string, recommendations: string[]): Promise<void>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"vscode.js","sourceRoot":"","sources":["../src/vscode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE;IACrD,KAAK,CAAC,OAAO,CAAA,6BAA6B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAA;IAC/G,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAA;IAEvE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,CAAA;KACb;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;AACvB,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,SAAiB,EAAE,eAAyB;IACzF,KAAK,CAAC,OAAO,CAAA,2CAA2C,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;EAC7E,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;GAC1B,CAAC,CAAA;IACF,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAA;IAEjE,IAAI,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE;QAC7B,IAAI,sBAAsB,GAAG,EAAC,eAAe,EAAE,EAAE,EAAC,CAAA;QAClD,IAAI,MAAM,MAAM,CAAC,cAAc,CAAC,EAAE;YAChC,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,CAAA;YACzD,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;SAC5D;QACD,MAAM,iBAAiB,GAAG;YACxB,GAAG,sBAAsB;YACzB,eAAe,EAAE,CAAC,GAAG,sBAAsB,CAAC,eAAe,EAAE,GAAG,eAAe,CAAC;SACjF,CAAA;QACD,MAAM,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;KACxE;AACH,CAAC","sourcesContent":["import {exists, write, read} from './file.js'\nimport {findUp, join} from './path.js'\nimport {content, token, debug} from './output.js'\n\n/**\n * Check if user editor is VS Code\n */\nexport const isVSCode = async (root = process.cwd()) => {\n debug(content`Checking if the directory ${token.path(root)} or any of its parents has a .vscode directory... `)\n const config = await findUp(join(root, '.vscode'), {type: 'directory'})\n\n if (!config) {\n return false\n }\n\n return exists(config)\n}\n\n/**\n * Add VSCode extension recommendations\n */\nexport async function addRecommendedExtensions(directory: string, recommendations: string[]) {\n debug(content`Adding VSCode recommended extensions at ${token.path(directory)}:\n${token.json(recommendations)}\n `)\n const extensionsPath = join(directory, '.vscode/extensions.json')\n\n if (await isVSCode(directory)) {\n let originalExtensionsJson = {recommendations: []}\n if (await exists(extensionsPath)) {\n const originalExtensionsFile = await read(extensionsPath)\n originalExtensionsJson = JSON.parse(originalExtensionsFile)\n }\n const newExtensionsJson = {\n ...originalExtensionsJson,\n recommendations: [...originalExtensionsJson.recommendations, ...recommendations],\n }\n await write(extensionsPath, JSON.stringify(newExtensionsJson, null, 2))\n }\n}\n"]}