@shopify/cli-kit 3.38.0 → 3.40.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/assets/cli-ruby/.devcontainer.json +5 -0
- package/assets/cli-ruby/.rubocop.yml +102 -0
- package/assets/cli-ruby/.rubocop_todo.yml +24 -0
- package/assets/cli-ruby/.ruby-version +1 -0
- package/assets/cli-ruby/CHANGELOG.md +634 -0
- package/assets/cli-ruby/CONTRIBUTING.md +3 -0
- package/assets/cli-ruby/Codespace.dockerfile +35 -0
- package/assets/cli-ruby/Gemfile +31 -0
- package/assets/cli-ruby/Gemfile.lock +190 -0
- package/{LICENSE → assets/cli-ruby/LICENSE} +2 -0
- package/assets/cli-ruby/README.md +30 -0
- package/assets/cli-ruby/RELEASING.md +72 -0
- package/assets/cli-ruby/Rakefile +243 -0
- package/assets/cli-ruby/SECURITY.md +59 -0
- package/assets/cli-ruby/Tests.dockerfile +35 -0
- package/assets/cli-ruby/assets/logo.png +0 -0
- package/assets/cli-ruby/bin/console +11 -0
- package/assets/cli-ruby/bin/load_shopify.rb +22 -0
- package/assets/cli-ruby/bin/shopify +60 -0
- package/assets/cli-ruby/bin/shopify.bat +3 -0
- package/assets/cli-ruby/dev.yml +29 -0
- package/assets/cli-ruby/docs/README.md +13 -0
- package/assets/cli-ruby/docs/contributors/testing.md +27 -0
- package/assets/cli-ruby/docs/users/installation.md +3 -0
- package/assets/cli-ruby/docs/users/migrate-from-themekit.md +18 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256 +1 -0
- package/assets/cli-ruby/ext/javy/javy.rb +204 -0
- package/assets/cli-ruby/ext/javy/version +1 -0
- package/assets/cli-ruby/ext/shopify-extensions/extconf.rb +21 -0
- package/assets/cli-ruby/ext/shopify-extensions/shopify_extensions.rb +152 -0
- package/assets/cli-ruby/ext/shopify-extensions/version +1 -0
- package/assets/cli-ruby/features/support/assertions.rb +17 -0
- package/assets/cli-ruby/features/support/cli.rb +7 -0
- package/assets/cli-ruby/features/support/process.rb +27 -0
- package/assets/cli-ruby/features/support/requires.rb +3 -0
- package/assets/cli-ruby/lib/docgen/class_template.md.erb +81 -0
- package/assets/cli-ruby/lib/docgen/index_template.md.erb +5 -0
- package/assets/cli-ruby/lib/docgen/markdown.rb +101 -0
- package/assets/cli-ruby/lib/graphql/admin_introspection.graphql +87 -0
- package/assets/cli-ruby/lib/graphql/all_organizations.graphql +19 -0
- package/assets/cli-ruby/lib/graphql/all_orgs_with_apps.graphql +30 -0
- package/assets/cli-ruby/lib/graphql/api_versions.graphql +6 -0
- package/assets/cli-ruby/lib/graphql/convert_dev_to_test_store.graphql +10 -0
- package/assets/cli-ruby/lib/graphql/create_app.graphql +20 -0
- package/assets/cli-ruby/lib/graphql/create_customer.graphql +9 -0
- package/assets/cli-ruby/lib/graphql/create_draft_order.graphql +8 -0
- package/assets/cli-ruby/lib/graphql/create_product.graphql +9 -0
- package/assets/cli-ruby/lib/graphql/extension_create.graphql +36 -0
- package/assets/cli-ruby/lib/graphql/extension_update_draft.graphql +18 -0
- package/assets/cli-ruby/lib/graphql/fetch_specifications.graphql +14 -0
- package/assets/cli-ruby/lib/graphql/find_organization.graphql +18 -0
- package/assets/cli-ruby/lib/graphql/find_organization_with_apps.graphql +20 -0
- package/assets/cli-ruby/lib/graphql/get_app_by_api_key.graphql +9 -0
- package/assets/cli-ruby/lib/graphql/get_app_urls.graphql +6 -0
- package/assets/cli-ruby/lib/graphql/get_extension_registrations.graphql +27 -0
- package/assets/cli-ruby/lib/graphql/get_variant_id.graphql +16 -0
- package/assets/cli-ruby/lib/graphql/update_dashboard_urls.graphql +8 -0
- package/assets/cli-ruby/lib/project_types/extension/cli.rb +156 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/build.rb +51 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/check.rb +51 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/connect.rb +35 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/create.rb +100 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/extension_command.rb +29 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/info.rb +86 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/push.rb +112 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/register.rb +67 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/serve.rb +150 -0
- package/assets/cli-ruby/lib/project_types/extension/commands/tunnel.rb +73 -0
- package/assets/cli-ruby/lib/project_types/extension/errors.rb +9 -0
- package/assets/cli-ruby/lib/project_types/extension/extension_project.rb +151 -0
- package/assets/cli-ruby/lib/project_types/extension/extension_project_keys.rb +12 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo.rb +50 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo_config.rb +59 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo_dependencies.rb +28 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo_runtime.rb +15 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo_serve.rb +115 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo_setup.rb +54 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo_setup_step.rb +31 -0
- package/assets/cli-ruby/lib/project_types/extension/features/argo_setup_steps.rb +51 -0
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/admin.rb +29 -0
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/base.rb +19 -0
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_post_purchase.rb +23 -0
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_ui_extension.rb +29 -0
- package/assets/cli-ruby/lib/project_types/extension/forms/connect.rb +42 -0
- package/assets/cli-ruby/lib/project_types/extension/forms/create.rb +49 -0
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_app.rb +53 -0
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_name.rb +48 -0
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_registration.rb +55 -0
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_template.rb +37 -0
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_type.rb +47 -0
- package/assets/cli-ruby/lib/project_types/extension/loaders/project.rb +50 -0
- package/assets/cli-ruby/lib/project_types/extension/loaders/specification_handler.rb +22 -0
- package/assets/cli-ruby/lib/project_types/extension/messages/message_loading.rb +34 -0
- package/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +292 -0
- package/assets/cli-ruby/lib/project_types/extension/models/app.rb +14 -0
- package/assets/cli-ruby/lib/project_types/extension/models/development_server.rb +77 -0
- package/assets/cli-ruby/lib/project_types/extension/models/development_server_requirements.rb +56 -0
- package/assets/cli-ruby/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
- package/assets/cli-ruby/lib/project_types/extension/models/npm_package.rb +44 -0
- package/assets/cli-ruby/lib/project_types/extension/models/product.rb +12 -0
- package/assets/cli-ruby/lib/project_types/extension/models/registration.rb +20 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/app.rb +13 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/base.rb +31 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/capabilities.rb +11 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development.rb +33 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_entries.rb +38 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_renderer.rb +38 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/extension.rb +46 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/root.rb +21 -0
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/user.rb +10 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification.rb +41 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +29 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +170 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/default.rb +145 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +122 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb +58 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config.rb +33 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb +75 -0
- package/assets/cli-ruby/lib/project_types/extension/models/specifications.rb +89 -0
- package/assets/cli-ruby/lib/project_types/extension/models/validation_error.rb +17 -0
- package/assets/cli-ruby/lib/project_types/extension/models/version.rb +15 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/choose_next_available_port.rb +36 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/configure_features.rb +73 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/configure_options.rb +21 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/convert_server_config.rb +85 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/app_converter.rb +27 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/product_converter.rb +21 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/registration_converter.rb +28 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/validation_error_converter.rb +25 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/version_converter.rb +28 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/create_extension.rb +31 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/base.rb +15 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/build.rb +30 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/create.rb +30 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb +57 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/serve.rb +36 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/fetch_specifications.rb +21 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/find_npm_packages.rb +106 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/find_package_from_json.rb +37 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_app.rb +22 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_apps.rb +26 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_extensions.rb +33 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_product.rb +22 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/merge_server_config.rb +47 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/update_draft.rb +29 -0
- package/assets/cli-ruby/lib/project_types/extension/tasks/user_errors.rb +45 -0
- package/assets/cli-ruby/lib/project_types/node/cli.rb +12 -0
- package/assets/cli-ruby/lib/project_types/node/forms/create.rb +45 -0
- package/assets/cli-ruby/lib/project_types/node/messages/messages.rb +33 -0
- package/assets/cli-ruby/lib/project_types/php/cli.rb +16 -0
- package/assets/cli-ruby/lib/project_types/php/forms/create.rb +44 -0
- package/assets/cli-ruby/lib/project_types/php/messages/messages.rb +29 -0
- package/assets/cli-ruby/lib/project_types/rails/cli.rb +15 -0
- package/assets/cli-ruby/lib/project_types/rails/forms/create.rb +75 -0
- package/assets/cli-ruby/lib/project_types/rails/gem.rb +110 -0
- package/assets/cli-ruby/lib/project_types/rails/messages/messages.rb +101 -0
- package/assets/cli-ruby/lib/project_types/script/cli.rb +27 -0
- package/assets/cli-ruby/lib/project_types/script/commands/connect.rb +16 -0
- package/assets/cli-ruby/lib/project_types/script/commands/create.rb +24 -0
- package/assets/cli-ruby/lib/project_types/script/commands/javy.rb +24 -0
- package/assets/cli-ruby/lib/project_types/script/commands/push.rb +26 -0
- package/assets/cli-ruby/lib/project_types/script/loaders/project.rb +46 -0
- package/assets/cli-ruby/lib/project_types/script/loaders/specification_handler.rb +22 -0
- package/assets/cli-ruby/lib/project_types/script/messages/messages.rb +11 -0
- package/assets/cli-ruby/lib/project_types/theme/cli.rb +33 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/check.rb +38 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/common/root_helper.rb +93 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/common/shop_helper.rb +13 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/delete.rb +70 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/init.rb +46 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/language_server.rb +18 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/list.rb +33 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/open.rb +73 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/package.rb +73 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/publish.rb +49 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/pull.rb +112 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/push.rb +153 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/serve.rb +88 -0
- package/assets/cli-ruby/lib/project_types/theme/commands/share.rb +62 -0
- package/assets/cli-ruby/lib/project_types/theme/conversions/base_glob.rb +65 -0
- package/assets/cli-ruby/lib/project_types/theme/conversions/ignore_glob.rb +15 -0
- package/assets/cli-ruby/lib/project_types/theme/conversions/include_glob.rb +15 -0
- package/assets/cli-ruby/lib/project_types/theme/forms/confirm_store.rb +15 -0
- package/assets/cli-ruby/lib/project_types/theme/forms/select.rb +34 -0
- package/assets/cli-ruby/lib/project_types/theme/messages/messages.rb +424 -0
- package/assets/cli-ruby/lib/project_types/theme/models/specification_handlers/theme.rb +19 -0
- package/assets/cli-ruby/lib/project_types/theme/presenters/theme_presenter.rb +48 -0
- package/assets/cli-ruby/lib/project_types/theme/presenters/themes_presenter.rb +29 -0
- package/assets/cli-ruby/lib/project_types/theme/ui/sync_progress_bar.rb +20 -0
- package/assets/cli-ruby/lib/rubygems_plugin.rb +26 -0
- package/assets/cli-ruby/lib/shopify_cli/admin_api/populate_resource_command.rb +166 -0
- package/assets/cli-ruby/lib/shopify_cli/admin_api/schema.rb +35 -0
- package/assets/cli-ruby/lib/shopify_cli/admin_api.rb +163 -0
- package/assets/cli-ruby/lib/shopify_cli/api.rb +131 -0
- package/assets/cli-ruby/lib/shopify_cli/app_type_detector.rb +36 -0
- package/assets/cli-ruby/lib/shopify_cli/assets/post_auth_page/index.html.erb +34 -0
- package/assets/cli-ruby/lib/shopify_cli/assets/post_auth_page/style.css +58 -0
- package/assets/cli-ruby/lib/shopify_cli/changelog.rb +148 -0
- package/assets/cli-ruby/lib/shopify_cli/command/app_sub_command.rb +26 -0
- package/assets/cli-ruby/lib/shopify_cli/command/project_command.rb +31 -0
- package/assets/cli-ruby/lib/shopify_cli/command/sub_command.rb +21 -0
- package/assets/cli-ruby/lib/shopify_cli/command.rb +173 -0
- package/assets/cli-ruby/lib/shopify_cli/command_options/command_serve_options.rb +53 -0
- package/assets/cli-ruby/lib/shopify_cli/command_options.rb +7 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/connect.rb +22 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/node.rb +40 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/php.rb +37 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/rails.rb +42 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create.rb +28 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/deploy.rb +51 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/open.rb +19 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/serve.rb +51 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app/tunnel.rb +43 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/app.rb +29 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/config.rb +76 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/help.rb +52 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/login.rb +98 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/logout.rb +50 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/customer.rb +25 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/draft_order.rb +28 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/product.rb +24 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/populate.rb +23 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/reporting.rb +38 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/store.rb +15 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/switch.rb +39 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/system.rb +165 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/version.rb +15 -0
- package/assets/cli-ruby/lib/shopify_cli/commands/whoami.rb +28 -0
- package/assets/cli-ruby/lib/shopify_cli/commands.rb +36 -0
- package/assets/cli-ruby/lib/shopify_cli/connect.rb +32 -0
- package/assets/cli-ruby/lib/shopify_cli/constants.rb +91 -0
- package/assets/cli-ruby/lib/shopify_cli/context.rb +691 -0
- package/assets/cli-ruby/lib/shopify_cli/core/cli_version.rb +20 -0
- package/assets/cli-ruby/lib/shopify_cli/core/entry_point.rb +64 -0
- package/assets/cli-ruby/lib/shopify_cli/core/executor.rb +23 -0
- package/assets/cli-ruby/lib/shopify_cli/core/finalize.rb +13 -0
- package/assets/cli-ruby/lib/shopify_cli/core/help_resolver.rb +20 -0
- package/assets/cli-ruby/lib/shopify_cli/core/monorail.rb +122 -0
- package/assets/cli-ruby/lib/shopify_cli/core.rb +9 -0
- package/assets/cli-ruby/lib/shopify_cli/db.rb +114 -0
- package/assets/cli-ruby/lib/shopify_cli/environment.rb +198 -0
- package/assets/cli-ruby/lib/shopify_cli/exception_reporter.rb +79 -0
- package/assets/cli-ruby/lib/shopify_cli/feature.rb +95 -0
- package/assets/cli-ruby/lib/shopify_cli/file_system_listener.rb +30 -0
- package/assets/cli-ruby/lib/shopify_cli/form.rb +42 -0
- package/assets/cli-ruby/lib/shopify_cli/git.rb +320 -0
- package/assets/cli-ruby/lib/shopify_cli/github/issue_url_generator.rb +30 -0
- package/assets/cli-ruby/lib/shopify_cli/github.rb +5 -0
- package/assets/cli-ruby/lib/shopify_cli/helpers/haikunator.rb +92 -0
- package/assets/cli-ruby/lib/shopify_cli/helpers.rb +5 -0
- package/assets/cli-ruby/lib/shopify_cli/heroku.rb +140 -0
- package/assets/cli-ruby/lib/shopify_cli/http_request.rb +43 -0
- package/assets/cli-ruby/lib/shopify_cli/identity_auth/env_auth_token.rb +34 -0
- package/assets/cli-ruby/lib/shopify_cli/identity_auth/servlet.rb +44 -0
- package/assets/cli-ruby/lib/shopify_cli/identity_auth.rb +333 -0
- package/assets/cli-ruby/lib/shopify_cli/js_deps.rb +110 -0
- package/assets/cli-ruby/lib/shopify_cli/js_system.rb +115 -0
- package/assets/cli-ruby/lib/shopify_cli/lazy_delegator.rb +55 -0
- package/assets/cli-ruby/lib/shopify_cli/messages/messages.rb +863 -0
- package/assets/cli-ruby/lib/shopify_cli/method_object.rb +123 -0
- package/assets/cli-ruby/lib/shopify_cli/migrator/migration.rb +27 -0
- package/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +13 -0
- package/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +41 -0
- package/assets/cli-ruby/lib/shopify_cli/migrator.rb +46 -0
- package/assets/cli-ruby/lib/shopify_cli/options.rb +40 -0
- package/assets/cli-ruby/lib/shopify_cli/packager.rb +108 -0
- package/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions/job.rb +36 -0
- package/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions.rb +46 -0
- package/assets/cli-ruby/lib/shopify_cli/partners_api/organizations.rb +45 -0
- package/assets/cli-ruby/lib/shopify_cli/partners_api.rb +91 -0
- package/assets/cli-ruby/lib/shopify_cli/php_deps.rb +102 -0
- package/assets/cli-ruby/lib/shopify_cli/process_supervision.rb +228 -0
- package/assets/cli-ruby/lib/shopify_cli/project.rb +199 -0
- package/assets/cli-ruby/lib/shopify_cli/project_commands.rb +16 -0
- package/assets/cli-ruby/lib/shopify_cli/project_type.rb +66 -0
- package/assets/cli-ruby/lib/shopify_cli/release.rb +197 -0
- package/assets/cli-ruby/lib/shopify_cli/reporting_configuration_controller.rb +64 -0
- package/assets/cli-ruby/lib/shopify_cli/resolve_constant.rb +25 -0
- package/assets/cli-ruby/lib/shopify_cli/resources/env_file.rb +108 -0
- package/assets/cli-ruby/lib/shopify_cli/resources.rb +5 -0
- package/assets/cli-ruby/lib/shopify_cli/result.rb +448 -0
- package/assets/cli-ruby/lib/shopify_cli/sed.rb +19 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/connect_service.rb +25 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/node_service.rb +143 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/php_service.rb +147 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/rails_service.rb +239 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/open_service.rb +19 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/node_service.rb +19 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/php_service.rb +23 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/rails_service.rb +28 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/serve_service.rb +57 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
- package/assets/cli-ruby/lib/shopify_cli/services/base_service.rb +13 -0
- package/assets/cli-ruby/lib/shopify_cli/services/reporting_service.rb +16 -0
- package/assets/cli-ruby/lib/shopify_cli/services.rb +38 -0
- package/assets/cli-ruby/lib/shopify_cli/shopifolk.rb +81 -0
- package/assets/cli-ruby/lib/shopify_cli/task.rb +20 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/confirm_store.rb +18 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/create_api_client.rb +40 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_authenticated.rb +19 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_dev_store.rb +41 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_env.rb +90 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_git_dependency.rb +14 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_loopback_url.rb +20 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_project_type.rb +14 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/select_org_and_shop.rb +81 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks/update_dashboard_urls.rb +57 -0
- package/assets/cli-ruby/lib/shopify_cli/tasks.rb +44 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/backoff_helper.rb +47 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/certificate_manager.rb +79 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/errors.rb +9 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/header_hash.rb +98 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hooks/file_change_hook.rb +77 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb +62 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +63 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot-reload-no-script.html +27 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot_reload.js +48 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/sse_client.js +43 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme.js +114 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme_extension.js +121 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/script_injector.rb +57 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +50 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload.rb +68 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/local_assets.rb +87 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +246 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy_param_builder.rb +82 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/reload_mode.rb +34 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +35 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher.rb +44 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/sse.rb +75 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/watcher.rb +61 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/web_server.rb +140 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server.rb +320 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/development_theme.rb +101 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/app_extension.rb +40 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hooks/file_change_hook.rb +68 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload/script_injector.rb +30 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload.rb +13 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/local_assets.rb +30 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/proxy_param_builder.rb +94 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/watcher.rb +47 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server.rb +150 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/host_theme.rb +104 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/extension_serve_job.rb +133 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/operation.rb +21 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer.rb +81 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_progress_bar.rb +35 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/file.rb +149 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/filter/path_matcher.rb +38 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/ignore_filter.rb +112 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/ignore_helper.rb +37 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/include_filter.rb +67 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/mime_type.rb +34 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/root.rb +62 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/checksums.rb +66 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/downloader.rb +63 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/error_reporter.rb +45 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/merger.rb +53 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/operation.rb +57 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/standard_reporter.rb +32 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/unsupported_script_warning.rb +90 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk.rb +133 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_item.rb +64 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_job.rb +139 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_request.rb +30 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all.rb +41 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all_form.rb +37 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb +64 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_delete_strategy.rb +29 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_update_strategy.rb +30 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_delete_handler.rb +49 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_update_handler.rb +71 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader.rb +231 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb +386 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/theme.rb +212 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/theme_access_api.rb +89 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/theme_admin_api.rb +101 -0
- package/assets/cli-ruby/lib/shopify_cli/thread_pool/job.rb +35 -0
- package/assets/cli-ruby/lib/shopify_cli/thread_pool.rb +49 -0
- package/assets/cli-ruby/lib/shopify_cli/transform_data_structure.rb +87 -0
- package/assets/cli-ruby/lib/shopify_cli/tunnel.rb +255 -0
- package/assets/cli-ruby/lib/shopify_cli/utilities.rb +21 -0
- package/assets/cli-ruby/lib/shopify_cli/version.rb +3 -0
- package/assets/cli-ruby/lib/shopify_cli.rb +191 -0
- package/assets/cli-ruby/shipit.rubygems.yml +3 -0
- package/assets/cli-ruby/shopify-cli.gemspec +54 -0
- package/assets/cli-ruby/shopify-dev +16 -0
- package/assets/cli-ruby/test/minitest_ext.rb +115 -0
- package/assets/cli-ruby/test/project_types/extension/extension_test_helpers.rb +70 -0
- package/assets/cli-ruby/test/shopify-cli/migrator/migrations/migration_helper.rb +20 -0
- package/assets/cli-ruby/test/test_helpers.rb +18 -0
- package/assets/cli-ruby/utilities/constants.rb +7 -0
- package/assets/cli-ruby/utilities/docker/container.rb +104 -0
- package/assets/cli-ruby/utilities/docker.rb +89 -0
- package/assets/cli-ruby/utilities/utilities.rb +6 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/REVISION +1 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +21 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +49 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +94 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/config.rb +133 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +123 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/executor.rb +79 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ini.rb +102 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +82 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/logger.rb +82 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +60 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ruby_backports/enumerable.rb +6 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +244 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support.rb +9 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/system.rb +243 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/util.rb +193 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/version.rb +5 -0
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit.rb +60 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/REVISION +1 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +157 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/color.rb +84 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +192 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +98 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +166 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +139 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +120 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame.rb +269 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +84 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/os.rb +73 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/printer.rb +59 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress.rb +90 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +484 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +29 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +282 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +40 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +263 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +66 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +232 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +46 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +102 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/version.rb +5 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +27 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +61 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +77 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui.rb +233 -0
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/LICENSE +22 -0
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/README.md +67 -0
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/Rakefile +54 -0
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +57 -0
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +18 -0
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/test/test_keyword.rb +41 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/REVISION +1 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/errors.rb +114 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property.rb +168 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property_collection.rb +83 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations/ancestor.rb +27 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations.rb +8 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/version.rb +3 -0
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties.rb +174 -0
- package/assets/cli-ruby/vendor/deps/webrick/Gemfile +3 -0
- package/assets/cli-ruby/vendor/deps/webrick/LICENSE.txt +22 -0
- package/assets/cli-ruby/vendor/deps/webrick/README.md +61 -0
- package/assets/cli-ruby/vendor/deps/webrick/Rakefile +10 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/config.rb +158 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/https.rb +152 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/log.rb +156 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/server.rb +381 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/version.rb +18 -0
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick.rb +232 -0
- package/assets/cli-ruby/vendor/deps/webrick/webrick.gemspec +74 -0
- package/assets/cli-ruby/vendor/gen/lib/gen/commands/help.rb +20 -0
- package/assets/cli-ruby/vendor/gen/lib/gen/commands/new.rb +21 -0
- package/assets/cli-ruby/vendor/gen/lib/gen/commands.rb +18 -0
- package/assets/cli-ruby/vendor/gen/lib/gen/entry_point.rb +10 -0
- package/assets/cli-ruby/vendor/gen/lib/gen/generator.rb +165 -0
- package/assets/cli-ruby/vendor/gen/lib/gen.rb +39 -0
- package/assets/cli-ruby/vendor/gen/template/Gemfile +10 -0
- package/assets/cli-ruby/vendor/gen/template/README.md +1 -0
- package/assets/cli-ruby/vendor/gen/template/bin/testunit +23 -0
- package/assets/cli-ruby/vendor/gen/template/bin/update-deps +97 -0
- package/assets/cli-ruby/vendor/gen/template/dev-gems.yml +3 -0
- package/assets/cli-ruby/vendor/gen/template/dev-vendor.yml +4 -0
- package/assets/cli-ruby/vendor/gen/template/exe/__app__-gems +17 -0
- package/assets/cli-ruby/vendor/gen/template/exe/__app__-vendor +18 -0
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/example.rb +19 -0
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/help.rb +21 -0
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands.rb +18 -0
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/entry_point.rb +10 -0
- package/assets/cli-ruby/vendor/gen/template/lib/__app__.rb +33 -0
- package/assets/cli-ruby/vendor/gen/template/test/example_test.rb +17 -0
- package/assets/cli-ruby/vendor/gen/template/test/test_helper.rb +22 -0
- package/assets/cli-ruby/vendor/lib/semantic/LICENSE +20 -0
- package/assets/cli-ruby/vendor/lib/semantic/semantic.rb +4 -0
- package/assets/cli-ruby/vendor/lib/semantic/version.rb +179 -0
- package/dist/private/common/json.d.ts +2 -2
- package/dist/private/common/lodash.d.ts +4 -4
- package/dist/private/common/ts/overloaded-parameters.d.ts +5 -5
- package/dist/private/node/analytics.js +1 -1
- package/dist/private/node/analytics.js.map +1 -1
- package/dist/private/node/api/headers.d.ts +1 -1
- package/dist/private/node/api/headers.js +2 -2
- package/dist/private/node/api/headers.js.map +1 -1
- package/dist/private/node/api.d.ts +1 -1
- package/dist/private/node/constants.d.ts +3 -3
- package/dist/private/node/constants.js +1 -1
- package/dist/private/node/constants.js.map +1 -1
- package/dist/private/node/{environment → context}/service.d.ts +1 -1
- package/dist/private/node/{environment → context}/service.js +1 -1
- package/dist/private/node/context/service.js.map +1 -0
- package/dist/private/node/{environment → context}/spin-cache.d.ts +0 -0
- package/dist/private/node/{environment → context}/spin-cache.js +0 -0
- package/dist/private/node/context/spin-cache.js.map +1 -0
- package/dist/private/node/{environment → context}/utilities.d.ts +0 -0
- package/dist/private/node/{environment → context}/utilities.js +0 -0
- package/dist/private/node/context/utilities.js.map +1 -0
- package/dist/private/node/error-handler.d.ts +2 -0
- package/dist/private/node/error-handler.js +5 -0
- package/dist/private/node/error-handler.js.map +1 -0
- package/dist/private/node/session/authorize.js +13 -3
- package/dist/private/node/session/authorize.js.map +1 -1
- package/dist/private/node/session/device-authorization.js +1 -1
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/exchange.d.ts +1 -1
- package/dist/private/node/session/exchange.js +1 -1
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session/identity-token-validation.js +1 -1
- package/dist/private/node/session/identity-token-validation.js.map +1 -1
- package/dist/private/node/session/identity.js +1 -1
- package/dist/private/node/session/identity.js.map +1 -1
- package/dist/private/node/session/redirect-listener.d.ts +1 -1
- package/dist/private/node/session/redirect-listener.js +5 -5
- package/dist/private/node/session/redirect-listener.js.map +1 -1
- package/dist/private/node/session/schema.d.ts +3 -3
- package/dist/private/node/session/validate.d.ts +1 -1
- package/dist/private/node/session/validate.js +1 -1
- package/dist/private/node/session/validate.js.map +1 -1
- package/dist/private/node/session.d.ts +4 -4
- package/dist/private/node/session.js +3 -3
- package/dist/private/node/session.js.map +1 -1
- package/dist/private/node/testing/ui.d.ts +31 -0
- package/dist/private/node/testing/ui.js +32 -1
- package/dist/private/node/testing/ui.js.map +1 -1
- package/dist/private/node/ui/components/Alert.d.ts +7 -7
- package/dist/private/node/ui/components/Alert.js +14 -13
- package/dist/private/node/ui/components/Alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.test.js +18 -4
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.d.ts +13 -6
- package/dist/private/node/ui/components/AutocompletePrompt.js +18 -12
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +62 -8
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Banner.d.ts +4 -4
- package/dist/private/node/ui/components/Banner.js.map +1 -1
- package/dist/private/node/ui/components/Command.d.ts +3 -3
- package/dist/private/node/ui/components/Command.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +11 -5
- package/dist/private/node/ui/components/ConcurrentOutput.js +31 -16
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +36 -12
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.d.ts +2 -2
- package/dist/private/node/ui/components/FatalError.js +10 -10
- package/dist/private/node/ui/components/FatalError.js.map +1 -1
- package/dist/private/node/ui/components/FilePath.d.ts +3 -3
- package/dist/private/node/ui/components/FilePath.js +1 -4
- package/dist/private/node/ui/components/FilePath.js.map +1 -1
- package/dist/private/node/ui/components/FilePath.test.js +1 -1
- package/dist/private/node/ui/components/FilePath.test.js.map +1 -1
- package/dist/private/node/ui/components/FullScreen.d.ts +3 -3
- package/dist/private/node/ui/components/FullScreen.js +1 -1
- package/dist/private/node/ui/components/FullScreen.js.map +1 -1
- package/dist/private/node/ui/components/Link.d.ts +3 -3
- package/dist/private/node/ui/components/Link.js.map +1 -1
- package/dist/private/node/ui/components/List.d.ts +6 -5
- package/dist/private/node/ui/components/List.js +4 -3
- package/dist/private/node/ui/components/List.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/InfoTable.d.ts +6 -5
- package/dist/private/node/ui/components/Prompts/InfoTable.js +5 -5
- package/dist/private/node/ui/components/Prompts/InfoTable.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/InfoTable.test.d.ts +1 -0
- package/dist/private/node/ui/components/Prompts/InfoTable.test.js +29 -0
- package/dist/private/node/ui/components/Prompts/InfoTable.test.js.map +1 -0
- package/dist/private/node/ui/components/SelectInput.d.ts +11 -3
- package/dist/private/node/ui/components/SelectInput.js +29 -16
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.test.js +62 -8
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.d.ts +8 -7
- package/dist/private/node/ui/components/SelectPrompt.js +22 -13
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +27 -2
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Subdued.d.ts +3 -3
- package/dist/private/node/ui/components/Subdued.js.map +1 -1
- package/dist/private/node/ui/components/Table/Row.d.ts +3 -3
- package/dist/private/node/ui/components/Table/Row.js +3 -2
- package/dist/private/node/ui/components/Table/Row.js.map +1 -1
- package/dist/private/node/ui/components/Table/ScalarDict.d.ts +1 -1
- package/dist/private/node/ui/components/Table/Table.d.ts +11 -8
- package/dist/private/node/ui/components/Table/Table.js +3 -1
- package/dist/private/node/ui/components/Table/Table.js.map +1 -1
- package/dist/private/node/ui/components/Table/Table.test.js +1 -1
- package/dist/private/node/ui/components/Table/Table.test.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +7 -3
- package/dist/private/node/ui/components/Tasks.js +32 -6
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +258 -18
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/components/TextAnimation.d.ts +3 -3
- package/dist/private/node/ui/components/TextAnimation.js.map +1 -1
- package/dist/private/node/ui/components/TextInput.d.ts +3 -3
- package/dist/private/node/ui/components/TextInput.js +1 -2
- package/dist/private/node/ui/components/TextInput.js.map +1 -1
- package/dist/private/node/ui/components/TextInput.test.js +1 -1
- package/dist/private/node/ui/components/TextInput.test.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.d.ts +3 -3
- package/dist/private/node/ui/components/TextPrompt.js +5 -4
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +2 -2
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/TextWithBackground.d.ts +12 -0
- package/dist/private/node/ui/components/TextWithBackground.js +39 -0
- package/dist/private/node/ui/components/TextWithBackground.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.d.ts +17 -13
- package/dist/private/node/ui/components/TokenizedText.js +24 -6
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js +7 -2
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
- package/dist/private/node/ui/components/UserInput.d.ts +3 -3
- package/dist/private/node/ui/components/UserInput.js.map +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -1
- package/dist/private/node/ui/hooks/use-layout.d.ts +1 -0
- package/dist/private/node/ui/hooks/use-layout.js +1 -0
- package/dist/private/node/ui/hooks/use-layout.js.map +1 -1
- package/dist/private/node/ui/utilities.d.ts +1 -1
- package/dist/private/node/ui.d.ts +1 -1
- package/dist/private/node/ui.js +3 -2
- package/dist/private/node/ui.js.map +1 -1
- package/dist/public/common/string.d.ts +3 -3
- package/dist/public/common/string.js.map +1 -1
- package/dist/{private → public}/common/ts/deep-required.d.ts +2 -1
- package/dist/{private → public}/common/ts/deep-required.js +0 -0
- package/dist/public/common/ts/deep-required.js.map +1 -0
- package/dist/public/common/ts/pick-by-prefix.d.ts +2 -1
- package/dist/public/common/ts/pick-by-prefix.js.map +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/analytics.js +1 -1
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/http.d.ts +1 -0
- package/dist/public/node/api/http.js +1 -1
- package/dist/public/node/api/partners.js +1 -1
- package/dist/public/node/api/partners.js.map +1 -1
- package/dist/public/node/archiver.d.ts +20 -6
- package/dist/public/node/archiver.js +14 -13
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/base-command.d.ts +3 -3
- package/dist/public/node/base-command.js +33 -31
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/cli.d.ts +1 -1
- package/dist/public/node/cli.js +6 -5
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/{environment → context}/fqdn.d.ts +0 -0
- package/dist/public/node/{environment → context}/fqdn.js +1 -1
- package/dist/public/node/context/fqdn.js.map +1 -0
- package/dist/public/node/{environment → context}/local.d.ts +4 -4
- package/dist/public/node/{environment → context}/local.js +6 -6
- package/dist/public/node/context/local.js.map +1 -0
- package/dist/public/node/{environment → context}/spin.d.ts +1 -1
- package/dist/public/node/{environment → context}/spin.js +3 -3
- package/dist/public/node/context/spin.js.map +1 -0
- package/dist/public/node/crypto.d.ts +1 -1
- package/dist/public/node/dot-env.js +2 -0
- package/dist/public/node/dot-env.js.map +1 -1
- package/dist/public/node/environments.d.ts +15 -0
- package/dist/public/node/environments.js +33 -0
- package/dist/public/node/environments.js.map +1 -0
- package/dist/public/node/error-handler.d.ts +1 -2
- package/dist/public/node/error-handler.js +12 -2
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.d.ts +5 -5
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/fs.d.ts +24 -4
- package/dist/public/node/fs.js +31 -2
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/git.d.ts +9 -1
- package/dist/public/node/git.js +32 -2
- package/dist/public/node/git.js.map +1 -1
- package/dist/public/node/hooks/postrun.d.ts +1 -1
- package/dist/public/node/hooks/postrun.js +1 -1
- package/dist/public/node/hooks/postrun.js.map +1 -1
- package/dist/public/node/http.d.ts +10 -1
- package/dist/public/node/http.js +35 -0
- package/dist/public/node/http.js.map +1 -1
- package/dist/public/node/metadata.d.ts +7 -7
- package/dist/public/node/metadata.js +1 -1
- package/dist/public/node/metadata.js.map +1 -1
- package/dist/public/node/monorail.d.ts +6 -6
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +5 -5
- package/dist/public/node/os.d.ts +2 -2
- package/dist/public/node/output.d.ts +4 -4
- package/dist/public/node/output.js +1 -1
- package/dist/public/node/output.js.map +1 -1
- package/dist/public/node/path.d.ts +1 -1
- package/dist/public/node/plugins/tunnel.d.ts +5 -5
- package/dist/public/node/plugins.d.ts +4 -4
- package/dist/public/node/result.d.ts +1 -1
- package/dist/public/node/ruby.d.ts +2 -1
- package/dist/public/node/ruby.js +43 -20
- package/dist/public/node/ruby.js.map +1 -1
- package/dist/public/node/session.d.ts +1 -1
- package/dist/public/node/session.js +1 -1
- package/dist/public/node/session.js.map +1 -1
- package/dist/public/node/system.d.ts +1 -1
- package/dist/public/node/themes/generate-theme-name.d.ts +1 -0
- package/dist/public/node/themes/generate-theme-name.js +13 -0
- package/dist/public/node/themes/generate-theme-name.js.map +1 -0
- package/dist/public/node/themes/models/theme.d.ts +11 -0
- package/dist/public/node/themes/models/theme.js +29 -0
- package/dist/public/node/themes/models/theme.js.map +1 -0
- package/dist/public/node/themes/replace-invalid-characters.d.ts +1 -0
- package/dist/public/node/themes/replace-invalid-characters.js +6 -0
- package/dist/public/node/themes/replace-invalid-characters.js.map +1 -0
- package/dist/public/node/themes/theme-manager.d.ts +13 -0
- package/dist/public/node/themes/theme-manager.js +40 -0
- package/dist/public/node/themes/theme-manager.js.map +1 -0
- package/dist/public/node/themes/theme-urls.d.ts +5 -0
- package/dist/public/node/themes/theme-urls.js +16 -0
- package/dist/public/node/themes/theme-urls.js.map +1 -0
- package/dist/public/node/themes/themes-api/headers.d.ts +3 -0
- package/dist/public/node/themes/themes-api/headers.js +29 -0
- package/dist/public/node/themes/themes-api/headers.js.map +1 -0
- package/dist/public/node/themes/themes-api/retry.d.ts +1 -0
- package/dist/public/node/themes/themes-api/retry.js +6 -0
- package/dist/public/node/themes/themes-api/retry.js.map +1 -0
- package/dist/public/node/themes/themes-api/throttler.d.ts +2 -0
- package/dist/public/node/themes/themes-api/throttler.js +82 -0
- package/dist/public/node/themes/themes-api/throttler.js.map +1 -0
- package/dist/public/node/themes/themes-api.d.ts +9 -0
- package/dist/public/node/themes/themes-api.js +85 -0
- package/dist/public/node/themes/themes-api.js.map +1 -0
- package/dist/public/node/ui.d.ts +28 -24
- package/dist/public/node/ui.js +51 -8
- package/dist/public/node/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -11
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/private/common/ts/deep-required.js.map +0 -1
- package/dist/private/node/environment/service.js.map +0 -1
- package/dist/private/node/environment/spin-cache.js.map +0 -1
- package/dist/private/node/environment/utilities.js.map +0 -1
- package/dist/private/node/simple-definitions.d.ts +0 -4
- package/dist/private/node/simple-definitions.js +0 -2
- package/dist/private/node/simple-definitions.js.map +0 -1
- package/dist/public/node/environment/fqdn.js.map +0 -1
- package/dist/public/node/environment/local.js.map +0 -1
- package/dist/public/node/environment/spin.js.map +0 -1
- package/dist/public/node/presets.d.ts +0 -8
- package/dist/public/node/presets.js +0 -26
- package/dist/public/node/presets.js.map +0 -1
- package/dist/ui/executor.d.ts +0 -2
- package/dist/ui/executor.js +0 -56
- package/dist/ui/executor.js.map +0 -1
- package/dist/ui.d.ts +0 -54
- package/dist/ui.js +0 -111
- package/dist/ui.js.map +0 -1
package/dist/public/node/fs.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import { RandomNameFamily } from '../common/string.js';
|
|
4
4
|
import { OverloadParameters } from '../../private/common/ts/overloaded-parameters.js';
|
|
5
5
|
import { findUp as internalFindUp } from 'find-up';
|
|
6
|
-
import { ReadStream } from 'fs';
|
|
6
|
+
import { ReadStream, WriteStream } from 'fs';
|
|
7
7
|
import type { Pattern, Options as GlobOptions } from 'fast-glob';
|
|
8
8
|
/**
|
|
9
9
|
* Strip the first `strip` parts of the path.
|
|
@@ -26,7 +26,7 @@ export declare function inTemporaryDirectory<T>(callback: (tmpDir: string) => T
|
|
|
26
26
|
* @param path - Path to the file to read.
|
|
27
27
|
* @returns A promise that resolves with the content of the file.
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export type ReadOptions = undefined | {
|
|
30
30
|
flag?: string | undefined;
|
|
31
31
|
} | {
|
|
32
32
|
encoding: BufferEncoding | string;
|
|
@@ -113,6 +113,12 @@ export declare function mkdirSync(path: string): void;
|
|
|
113
113
|
* @param path - Path to the file to be removed.
|
|
114
114
|
*/
|
|
115
115
|
export declare function removeFile(path: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Renames a file.
|
|
118
|
+
* @param from - Path to the file to be renamed.
|
|
119
|
+
* @param to - New path for the file.
|
|
120
|
+
*/
|
|
121
|
+
export declare function renameFile(from: string, to: string): Promise<void>;
|
|
116
122
|
/**
|
|
117
123
|
* Synchronously removes a file at the given path.
|
|
118
124
|
*
|
|
@@ -156,6 +162,12 @@ export declare function fileSize(path: string): Promise<number>;
|
|
|
156
162
|
* @returns The size of the file in bytes.
|
|
157
163
|
*/
|
|
158
164
|
export declare function fileSizeSync(path: string): number;
|
|
165
|
+
/**
|
|
166
|
+
* Unlink a file at the given path.
|
|
167
|
+
* @param path - Path to the file.
|
|
168
|
+
* @returns A promise that resolves when the file is unlinked.
|
|
169
|
+
*/
|
|
170
|
+
export declare function unlinkFileSync(path: string): void;
|
|
159
171
|
/**
|
|
160
172
|
* Create a read stream for a file.
|
|
161
173
|
*
|
|
@@ -163,6 +175,13 @@ export declare function fileSizeSync(path: string): number;
|
|
|
163
175
|
* @returns A read stream for the file.
|
|
164
176
|
*/
|
|
165
177
|
export declare function createFileReadStream(path: string): ReadStream;
|
|
178
|
+
/**
|
|
179
|
+
* Create a write stream for a file.
|
|
180
|
+
*
|
|
181
|
+
* @param path - Path to the file.
|
|
182
|
+
* @returns A write stream for the file.
|
|
183
|
+
*/
|
|
184
|
+
export declare function createFileWriteStream(path: string): WriteStream;
|
|
166
185
|
/**
|
|
167
186
|
* Returns the Date object for the last modification of a file.
|
|
168
187
|
*
|
|
@@ -208,6 +227,7 @@ export declare function fileHasExecutablePermissions(path: string): Promise<bool
|
|
|
208
227
|
* @returns True if it exists.
|
|
209
228
|
*/
|
|
210
229
|
export declare function fileExists(path: string): Promise<boolean>;
|
|
230
|
+
export declare function fileExistsSync(path: string): boolean;
|
|
211
231
|
interface FileOptions {
|
|
212
232
|
path: string;
|
|
213
233
|
}
|
package/dist/public/node/fs.js
CHANGED
|
@@ -8,8 +8,8 @@ import { copy as fsCopy, ensureFile as fsEnsureFile, ensureFileSync as fsEnsureF
|
|
|
8
8
|
import { temporaryDirectoryTask } from 'tempy';
|
|
9
9
|
import { sep, join, extname } from 'pathe';
|
|
10
10
|
import { findUp as internalFindUp } from 'find-up';
|
|
11
|
-
import { mkdirSync as fsMkdirSync, readFileSync as fsReadFileSync, writeFileSync as fsWriteFileSync, appendFileSync as fsAppendFileSync, statSync as fsStatSync, createReadStream as fsCreateReadStream, constants as fsConstants, } from 'fs';
|
|
12
|
-
import { mkdir as fsMkdir, writeFile as fsWriteFile, readFile as fsReadFile, realpath as fsRealPath, appendFile as fsAppendFile, mkdtemp as fsMkdtemp, stat as fsStat, lstat as fsLstat, chmod as fsChmod, access as fsAccess, } from 'fs/promises';
|
|
11
|
+
import { mkdirSync as fsMkdirSync, readFileSync as fsReadFileSync, writeFileSync as fsWriteFileSync, appendFileSync as fsAppendFileSync, statSync as fsStatSync, createReadStream as fsCreateReadStream, createWriteStream as fsCreateWriteStream, constants as fsConstants, existsSync as fsFileExistsSync, unlinkSync as fsUnlinkSync, } from 'fs';
|
|
12
|
+
import { mkdir as fsMkdir, writeFile as fsWriteFile, readFile as fsReadFile, realpath as fsRealPath, appendFile as fsAppendFile, mkdtemp as fsMkdtemp, stat as fsStat, lstat as fsLstat, chmod as fsChmod, access as fsAccess, rename as fsRename, } from 'fs/promises';
|
|
13
13
|
const DEFAULT_PRETTIER_CONFIG = {
|
|
14
14
|
arrowParens: 'always',
|
|
15
15
|
singleQuote: true,
|
|
@@ -167,6 +167,15 @@ export async function removeFile(path) {
|
|
|
167
167
|
outputDebug(outputContent `Removing file at ${outputToken.path(path)}...`);
|
|
168
168
|
await fsRemove(path);
|
|
169
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Renames a file.
|
|
172
|
+
* @param from - Path to the file to be renamed.
|
|
173
|
+
* @param to - New path for the file.
|
|
174
|
+
*/
|
|
175
|
+
export async function renameFile(from, to) {
|
|
176
|
+
outputDebug(outputContent `Renaming file from ${outputToken.path(from)} to ${outputToken.path(to)}...`);
|
|
177
|
+
await fsRename(from, to);
|
|
178
|
+
}
|
|
170
179
|
/**
|
|
171
180
|
* Synchronously removes a file at the given path.
|
|
172
181
|
*
|
|
@@ -227,6 +236,14 @@ export function fileSizeSync(path) {
|
|
|
227
236
|
outputDebug(outputContent `Sync-getting the size of file file at ${outputToken.path(path)}...`);
|
|
228
237
|
return fsStatSync(path).size;
|
|
229
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Unlink a file at the given path.
|
|
241
|
+
* @param path - Path to the file.
|
|
242
|
+
* @returns A promise that resolves when the file is unlinked.
|
|
243
|
+
*/
|
|
244
|
+
export function unlinkFileSync(path) {
|
|
245
|
+
return fsUnlinkSync(path);
|
|
246
|
+
}
|
|
230
247
|
/**
|
|
231
248
|
* Create a read stream for a file.
|
|
232
249
|
*
|
|
@@ -236,6 +253,15 @@ export function fileSizeSync(path) {
|
|
|
236
253
|
export function createFileReadStream(path) {
|
|
237
254
|
return fsCreateReadStream(path);
|
|
238
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Create a write stream for a file.
|
|
258
|
+
*
|
|
259
|
+
* @param path - Path to the file.
|
|
260
|
+
* @returns A write stream for the file.
|
|
261
|
+
*/
|
|
262
|
+
export function createFileWriteStream(path) {
|
|
263
|
+
return fsCreateWriteStream(path);
|
|
264
|
+
}
|
|
239
265
|
/**
|
|
240
266
|
* Returns the Date object for the last modification of a file.
|
|
241
267
|
*
|
|
@@ -312,6 +338,9 @@ export async function fileExists(path) {
|
|
|
312
338
|
return false;
|
|
313
339
|
}
|
|
314
340
|
}
|
|
341
|
+
export function fileExistsSync(path) {
|
|
342
|
+
return fsFileExistsSync(path);
|
|
343
|
+
}
|
|
315
344
|
/**
|
|
316
345
|
* Format a string using prettier. Return the formatted content.
|
|
317
346
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/public/node/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,WAAW,CAAA;AACjD,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAC,aAAa,EAAmB,MAAM,qBAAqB,CAAA;AAEnE,OAAO,EACL,IAAI,IAAI,MAAM,EACd,UAAU,IAAI,YAAY,EAC1B,cAAc,IAAI,gBAAgB,EAClC,MAAM,IAAI,QAAQ,EAClB,UAAU,IAAI,YAAY,EAC1B,IAAI,IAAI,MAAM;AACd,6DAA6D;AAC7D,aAAa;EACd,MAAM,cAAc,CAAA;AAErB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AACxC,OAAO,EAAC,MAAM,IAAI,cAAc,EAAC,MAAM,SAAS,CAAA;AAChD,OAAO,EACL,SAAS,IAAI,WAAW,EACxB,YAAY,IAAI,cAAc,EAC9B,aAAa,IAAI,eAAe,EAChC,cAAc,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AAC,KAAK,UAAU,iCAAiC,CAAC,OAAuC;IAC7F,MAAM,SAAS,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAA;IACpF,MAAM,mBAAmB,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IAClE,MAAM,mBAAmB,GAAG,MAAM,UAAU,CAAC,mBAAmB,CAAC,CAAA;IAEjE,IAAI,mBAAmB,EAAE;QACvB,OAAO,iCAAiC,CAAC,OAAO,CAAC,CAAA;KAClD;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAA4B,EAAE,OAAqB;IAC5E,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAC,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAA;IACrD,IAAI,gBAAgB,GAAG,OAAO,CAAA;IAC9B,IAAI,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE;QACxB,gBAAgB,GAAG,EAAC,GAAG,OAAO,EAAE,GAAG,EAAE,IAAI,EAAC,CAAA;KAC3C;IACD,OAAO,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;AAC5C,CAAC;AACD,OAAO,EAAC,aAAa,EAAC,MAAM,KAAK,CAAA;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAqD,EACrD,OAAqD;IAErD,wBAAwB;IACxB,8DAA8D;IAC9D,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,OAAc,EAAE,OAAO,CAAC,CAAA;IACzD,OAAO,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7C,CAAC","sourcesContent":["import {joinPath, normalizePath} from './path.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {getRandomName, RandomNameFamily} from '../common/string.js'\nimport {OverloadParameters} from '../../private/common/ts/overloaded-parameters.js'\nimport {\n copy as fsCopy,\n ensureFile as fsEnsureFile,\n ensureFileSync as fsEnsureFileSync,\n remove as fsRemove,\n removeSync as fsRemoveSync,\n move as fsMove,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n} from 'fs-extra/esm'\n\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join, extname} from 'pathe'\nimport {findUp as internalFindUp} from 'find-up'\nimport {\n mkdirSync as fsMkdirSync,\n readFileSync as fsReadFileSync,\n writeFileSync as fsWriteFileSync,\n appendFileSync as fsAppendFileSync,\n statSync as fsStatSync,\n createReadStream as fsCreateReadStream,\n constants as fsConstants,\n ReadStream,\n} from 'fs'\nimport {\n mkdir as fsMkdir,\n writeFile as fsWriteFile,\n readFile as fsReadFile,\n realpath as fsRealPath,\n appendFile as fsAppendFile,\n mkdtemp as fsMkdtemp,\n stat as fsStat,\n lstat as fsLstat,\n chmod as fsChmod,\n access as fsAccess,\n} from 'fs/promises'\nimport type {Options} from 'prettier'\nimport type {Pattern, Options as GlobOptions} from 'fast-glob'\n\nconst DEFAULT_PRETTIER_CONFIG: Options = {\n arrowParens: 'always',\n singleQuote: true,\n bracketSpacing: false,\n trailingComma: 'all',\n}\n\n/**\n * Strip the first `strip` parts of the path.\n *\n * @param path - Path to strip.\n * @param strip - Number of parts to strip.\n * @returns The stripped path.\n */\nexport function stripUpPath(path: string, strip: number): string {\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 *\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 *\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\n\nexport type ReadOptions =\n | undefined\n | {flag?: string | undefined}\n | {\n encoding: BufferEncoding | string\n flag?: string | undefined\n }\nexport async function readFile(path: string, options?: ReadOptions): Promise<string>\nexport async function readFile(path: string, options?: ReadOptions): Promise<Buffer>\n\n/**\n * It reads a file and returns its content as a string.\n * Uses utf-8 encoding by default.\n *\n * @param path - Path to the file to read.\n * @param options - Options to read the file with (defaults to utf-8 encoding).\n * @returns A promise that resolves with the content of the file.\n */\nexport async function readFile(path: string, options: ReadOptions = {encoding: 'utf8'}): Promise<string | Buffer> {\n outputDebug(outputContent`Reading the content of file at ${outputToken.path(path)}...`)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return fsReadFile(path, options)\n}\n\n/**\n * Synchronously reads a file and returns its content as a buffer.\n *\n * @param path - Path to the file to read.\n * @returns The content of the file.\n */\nexport function readFileSync(path: string): Buffer {\n outputDebug(outputContent`Sync-reading the content of file at ${outputToken.path(path)}...`)\n return fsReadFileSync(path)\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n *\n * @param path - Path whose real path will be returned.\n */\nexport async function fileRealPath(path: string): Promise<string> {\n return fsRealPath(path)\n}\n\n/**\n * Copies a file.\n *\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copyFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Copying file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsCopy(from, to)\n}\n\n/**\n * Creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport async function touchFile(path: string): Promise<void> {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n await fsEnsureFile(path)\n}\n\n/**\n * Synchronously creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport function touchFileSync(path: string): void {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n fsEnsureFileSync(path)\n}\n\n/**\n * Appnds content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param content - Content to be appended.\n */\nexport async function appendFile(path: string, content: string): Promise<void> {\n outputDebug(outputContent`Appending the following content to ${outputToken.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fsAppendFile(path, content)\n}\n\n/**\n * Synchronously appends content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param data - Content to be appended.\n */\nexport function appendFileSync(path: string, data: string): void {\n fsAppendFileSync(path, data)\n}\n\n/**\n * Writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport async function writeFile(path: string, data: string): Promise<void> {\n outputDebug(outputContent`Writing some content to file at ${outputToken.path(path)}...`)\n await fsWriteFile(path, data, {encoding: 'utf8'})\n}\n\n/**\n * Synchronously writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport function writeFileSync(path: string, data: string): void {\n outputDebug(outputContent`File-writing some content to file at ${outputToken.path(path)}...`)\n fsWriteFileSync(path, data)\n}\n\n/**\n * Creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport async function mkdir(path: string): Promise<void> {\n outputDebug(outputContent`Creating directory at ${outputToken.path(path)}...`)\n await fsMkdir(path, {recursive: true})\n}\n\n/**\n * Synchronously creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport function mkdirSync(path: string): void {\n outputDebug(outputContent`Sync-creating directory at ${outputToken.path(path)}...`)\n fsMkdirSync(path, {recursive: true})\n}\n\n/**\n * Removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport async function removeFile(path: string): Promise<void> {\n outputDebug(outputContent`Removing file at ${outputToken.path(path)}...`)\n await fsRemove(path)\n}\n\n/**\n * Synchronously removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport function removeFileSync(path: string): void {\n outputDebug(outputContent`Sync-removing file at ${outputToken.path(path)}...`)\n fsRemoveSync(path)\n}\n\ninterface RmDirOptions {\n force?: boolean\n}\n/**\n * Removes a directory at the given path.\n *\n * @param path - Path to the directory to be removed.\n * @param options - Options to remove the directory with.\n */\nexport async function rmdir(path: string, options: RmDirOptions = {}): Promise<void> {\n const {default: del} = await import('del')\n outputDebug(outputContent`Removing directory at ${outputToken.path(path)}...`)\n await del(path, {force: options.force})\n}\n\n/**\n * Create a temporary directory.\n *\n * @returns Path to the temporary directory.\n */\nexport async function mkTmpDir(): Promise<string> {\n outputDebug(outputContent`Creating a temporary directory...`)\n const directory = await fsMkdtemp('tmp-')\n return directory\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport async function isDirectory(path: string): Promise<boolean> {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return (await fsLstat(path)).isDirectory()\n}\n\n/**\n * Get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport async function fileSize(path: string): Promise<number> {\n outputDebug(outputContent`Getting the size of file file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).size\n}\n\n/**\n * Synchronously get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport function fileSizeSync(path: string): number {\n outputDebug(outputContent`Sync-getting the size of file file at ${outputToken.path(path)}...`)\n return fsStatSync(path).size\n}\n\n/**\n * Create a read stream for a file.\n *\n * @param path - Path to the file.\n * @returns A read stream for the file.\n */\nexport function createFileReadStream(path: string): ReadStream {\n return fsCreateReadStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdated(path: string): Promise<Date> {\n outputDebug(outputContent`Getting last updated timestamp for file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await fileLastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\ninterface MoveFileOptions {\n overwrite?: boolean\n}\n\n/**\n * Moves a file.\n *\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function moveFile(src: string, dest: string, options: MoveFileOptions = {}): Promise<void> {\n await fsMove(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n *\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 fsChmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n *\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function fileHasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fsAccess(path, fsConstants.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 *\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await fsAccess(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\ninterface FileOptions {\n path: string\n}\n\n/**\n * Format a string using prettier. Return the formatted content.\n *\n * @param content - Content to be formatted.\n * @param options - Options to format the content with.\n * @returns The formatted content.\n */\nexport async function fileContentPrettyFormat(content: string, options: FileOptions): Promise<string> {\n const {default: prettier} = await import('prettier')\n\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 case '.ts':\n case '.tsx':\n prettierConfig.parser = 'typescript'\n break\n }\n\n const formattedContent = await prettier.format(content, prettierConfig)\n\n return formattedContent\n}\n\ninterface GenerateRandomDirectoryOptions {\n /** Suffix to include in the randomly generated directory name. */\n suffix: string\n\n /** Absolute path to the directory where the random directory will be created. */\n directory: string\n\n /** Type of word to use for random name. */\n family?: RandomNameFamily\n}\n\n/**\n * It generates a random directory directory name for a sub-directory.\n * It ensures that the returned directory name doesn't exist.\n *\n * @param options - Options to generate the random directory name.\n * @returns It returns the name of the directory.\n */\nexport async function generateRandomNameForSubdirectory(options: GenerateRandomDirectoryOptions): Promise<string> {\n const generated = `${getRandomName(options.family ?? 'business')}-${options.suffix}`\n const randomDirectoryPath = joinPath(options.directory, generated)\n const isAppDirectoryTaken = await fileExists(randomDirectoryPath)\n\n if (isAppDirectoryTaken) {\n return generateRandomNameForSubdirectory(options)\n } else {\n return generated\n }\n}\n\n/**\n * Traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns A promise that resolves to an array of pathnames that match the given pattern.\n */\nexport async function glob(pattern: Pattern | Pattern[], options?: GlobOptions): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, overridenOptions)\n}\nexport {pathToFileURL} from 'url'\n\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport async function findPathUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/public/node/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,WAAW,CAAA;AACjD,OA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cesContent":["import {joinPath, normalizePath} from './path.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {getRandomName, RandomNameFamily} from '../common/string.js'\nimport {OverloadParameters} from '../../private/common/ts/overloaded-parameters.js'\nimport {\n copy as fsCopy,\n ensureFile as fsEnsureFile,\n ensureFileSync as fsEnsureFileSync,\n remove as fsRemove,\n removeSync as fsRemoveSync,\n move as fsMove,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n} from 'fs-extra/esm'\n\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join, extname} from 'pathe'\nimport {findUp as internalFindUp} from 'find-up'\nimport {\n mkdirSync as fsMkdirSync,\n readFileSync as fsReadFileSync,\n writeFileSync as fsWriteFileSync,\n appendFileSync as fsAppendFileSync,\n statSync as fsStatSync,\n createReadStream as fsCreateReadStream,\n createWriteStream as fsCreateWriteStream,\n constants as fsConstants,\n existsSync as fsFileExistsSync,\n unlinkSync as fsUnlinkSync,\n ReadStream,\n WriteStream,\n} from 'fs'\nimport {\n mkdir as fsMkdir,\n writeFile as fsWriteFile,\n readFile as fsReadFile,\n realpath as fsRealPath,\n appendFile as fsAppendFile,\n mkdtemp as fsMkdtemp,\n stat as fsStat,\n lstat as fsLstat,\n chmod as fsChmod,\n access as fsAccess,\n rename as fsRename,\n} from 'fs/promises'\nimport type {Options} from 'prettier'\nimport type {Pattern, Options as GlobOptions} from 'fast-glob'\n\nconst DEFAULT_PRETTIER_CONFIG: Options = {\n arrowParens: 'always',\n singleQuote: true,\n bracketSpacing: false,\n trailingComma: 'all',\n}\n\n/**\n * Strip the first `strip` parts of the path.\n *\n * @param path - Path to strip.\n * @param strip - Number of parts to strip.\n * @returns The stripped path.\n */\nexport function stripUpPath(path: string, strip: number): string {\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 *\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 *\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\n\nexport type ReadOptions =\n | undefined\n | {flag?: string | undefined}\n | {\n encoding: BufferEncoding | string\n flag?: string | undefined\n }\nexport async function readFile(path: string, options?: ReadOptions): Promise<string>\nexport async function readFile(path: string, options?: ReadOptions): Promise<Buffer>\n\n/**\n * It reads a file and returns its content as a string.\n * Uses utf-8 encoding by default.\n *\n * @param path - Path to the file to read.\n * @param options - Options to read the file with (defaults to utf-8 encoding).\n * @returns A promise that resolves with the content of the file.\n */\nexport async function readFile(path: string, options: ReadOptions = {encoding: 'utf8'}): Promise<string | Buffer> {\n outputDebug(outputContent`Reading the content of file at ${outputToken.path(path)}...`)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return fsReadFile(path, options)\n}\n\n/**\n * Synchronously reads a file and returns its content as a buffer.\n *\n * @param path - Path to the file to read.\n * @returns The content of the file.\n */\nexport function readFileSync(path: string): Buffer {\n outputDebug(outputContent`Sync-reading the content of file at ${outputToken.path(path)}...`)\n return fsReadFileSync(path)\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n *\n * @param path - Path whose real path will be returned.\n */\nexport async function fileRealPath(path: string): Promise<string> {\n return fsRealPath(path)\n}\n\n/**\n * Copies a file.\n *\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copyFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Copying file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsCopy(from, to)\n}\n\n/**\n * Creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport async function touchFile(path: string): Promise<void> {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n await fsEnsureFile(path)\n}\n\n/**\n * Synchronously creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport function touchFileSync(path: string): void {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n fsEnsureFileSync(path)\n}\n\n/**\n * Appnds content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param content - Content to be appended.\n */\nexport async function appendFile(path: string, content: string): Promise<void> {\n outputDebug(outputContent`Appending the following content to ${outputToken.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fsAppendFile(path, content)\n}\n\n/**\n * Synchronously appends content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param data - Content to be appended.\n */\nexport function appendFileSync(path: string, data: string): void {\n fsAppendFileSync(path, data)\n}\n\n/**\n * Writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport async function writeFile(path: string, data: string): Promise<void> {\n outputDebug(outputContent`Writing some content to file at ${outputToken.path(path)}...`)\n await fsWriteFile(path, data, {encoding: 'utf8'})\n}\n\n/**\n * Synchronously writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport function writeFileSync(path: string, data: string): void {\n outputDebug(outputContent`File-writing some content to file at ${outputToken.path(path)}...`)\n fsWriteFileSync(path, data)\n}\n\n/**\n * Creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport async function mkdir(path: string): Promise<void> {\n outputDebug(outputContent`Creating directory at ${outputToken.path(path)}...`)\n await fsMkdir(path, {recursive: true})\n}\n\n/**\n * Synchronously creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport function mkdirSync(path: string): void {\n outputDebug(outputContent`Sync-creating directory at ${outputToken.path(path)}...`)\n fsMkdirSync(path, {recursive: true})\n}\n\n/**\n * Removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport async function removeFile(path: string): Promise<void> {\n outputDebug(outputContent`Removing file at ${outputToken.path(path)}...`)\n await fsRemove(path)\n}\n\n/**\n * Renames a file.\n * @param from - Path to the file to be renamed.\n * @param to - New path for the file.\n */\nexport async function renameFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Renaming file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsRename(from, to)\n}\n\n/**\n * Synchronously removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport function removeFileSync(path: string): void {\n outputDebug(outputContent`Sync-removing file at ${outputToken.path(path)}...`)\n fsRemoveSync(path)\n}\n\ninterface RmDirOptions {\n force?: boolean\n}\n/**\n * Removes a directory at the given path.\n *\n * @param path - Path to the directory to be removed.\n * @param options - Options to remove the directory with.\n */\nexport async function rmdir(path: string, options: RmDirOptions = {}): Promise<void> {\n const {default: del} = await import('del')\n outputDebug(outputContent`Removing directory at ${outputToken.path(path)}...`)\n await del(path, {force: options.force})\n}\n\n/**\n * Create a temporary directory.\n *\n * @returns Path to the temporary directory.\n */\nexport async function mkTmpDir(): Promise<string> {\n outputDebug(outputContent`Creating a temporary directory...`)\n const directory = await fsMkdtemp('tmp-')\n return directory\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport async function isDirectory(path: string): Promise<boolean> {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return (await fsLstat(path)).isDirectory()\n}\n\n/**\n * Get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport async function fileSize(path: string): Promise<number> {\n outputDebug(outputContent`Getting the size of file file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).size\n}\n\n/**\n * Synchronously get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport function fileSizeSync(path: string): number {\n outputDebug(outputContent`Sync-getting the size of file file at ${outputToken.path(path)}...`)\n return fsStatSync(path).size\n}\n\n/**\n * Unlink a file at the given path.\n * @param path - Path to the file.\n * @returns A promise that resolves when the file is unlinked.\n */\nexport function unlinkFileSync(path: string): void {\n return fsUnlinkSync(path)\n}\n\n/**\n * Create a read stream for a file.\n *\n * @param path - Path to the file.\n * @returns A read stream for the file.\n */\nexport function createFileReadStream(path: string): ReadStream {\n return fsCreateReadStream(path)\n}\n\n/**\n * Create a write stream for a file.\n *\n * @param path - Path to the file.\n * @returns A write stream for the file.\n */\nexport function createFileWriteStream(path: string): WriteStream {\n return fsCreateWriteStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdated(path: string): Promise<Date> {\n outputDebug(outputContent`Getting last updated timestamp for file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await fileLastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\ninterface MoveFileOptions {\n overwrite?: boolean\n}\n\n/**\n * Moves a file.\n *\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function moveFile(src: string, dest: string, options: MoveFileOptions = {}): Promise<void> {\n await fsMove(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n *\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 fsChmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n *\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function fileHasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fsAccess(path, fsConstants.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 *\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await fsAccess(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function fileExistsSync(path: string): boolean {\n return fsFileExistsSync(path)\n}\n\ninterface FileOptions {\n path: string\n}\n\n/**\n * Format a string using prettier. Return the formatted content.\n *\n * @param content - Content to be formatted.\n * @param options - Options to format the content with.\n * @returns The formatted content.\n */\nexport async function fileContentPrettyFormat(content: string, options: FileOptions): Promise<string> {\n const {default: prettier} = await import('prettier')\n\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 case '.ts':\n case '.tsx':\n prettierConfig.parser = 'typescript'\n break\n }\n\n const formattedContent = await prettier.format(content, prettierConfig)\n\n return formattedContent\n}\n\ninterface GenerateRandomDirectoryOptions {\n /** Suffix to include in the randomly generated directory name. */\n suffix: string\n\n /** Absolute path to the directory where the random directory will be created. */\n directory: string\n\n /** Type of word to use for random name. */\n family?: RandomNameFamily\n}\n\n/**\n * It generates a random directory directory name for a sub-directory.\n * It ensures that the returned directory name doesn't exist.\n *\n * @param options - Options to generate the random directory name.\n * @returns It returns the name of the directory.\n */\nexport async function generateRandomNameForSubdirectory(options: GenerateRandomDirectoryOptions): Promise<string> {\n const generated = `${getRandomName(options.family ?? 'business')}-${options.suffix}`\n const randomDirectoryPath = joinPath(options.directory, generated)\n const isAppDirectoryTaken = await fileExists(randomDirectoryPath)\n\n if (isAppDirectoryTaken) {\n return generateRandomNameForSubdirectory(options)\n } else {\n return generated\n }\n}\n\n/**\n * Traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns A promise that resolves to an array of pathnames that match the given pattern.\n */\nexport async function glob(pattern: Pattern | Pattern[], options?: GlobOptions): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, overridenOptions)\n}\nexport {pathToFileURL} from 'url'\n\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport async function findPathUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AbortError } from './error.js';
|
|
2
2
|
import { DefaultLogFields, ListLogLine } from 'simple-git';
|
|
3
|
-
export declare const gitFactory: import("simple-git").SimpleGitFactory;
|
|
4
3
|
/**
|
|
5
4
|
* Initialize a git repository at the given directory.
|
|
6
5
|
*
|
|
@@ -8,6 +7,15 @@ export declare const gitFactory: import("simple-git").SimpleGitFactory;
|
|
|
8
7
|
* @param initialBranch - The name of the initial branch.
|
|
9
8
|
*/
|
|
10
9
|
export declare function initializeGitRepository(directory: string, initialBranch?: string): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Given a Git repository and a list of absolute paths to files contained
|
|
12
|
+
* in the repository, it filters and returns the files that are ignored
|
|
13
|
+
* by the .gitignore.
|
|
14
|
+
*
|
|
15
|
+
* @param directory - The absolute path to the directory containing the files.
|
|
16
|
+
* @param files - The list of files to check against.
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkIfIgnoredInGitRepository(directory: string, files: string[]): Promise<string[]>;
|
|
11
19
|
export interface GitIgnoreTemplate {
|
|
12
20
|
[section: string]: string[];
|
|
13
21
|
}
|
package/dist/public/node/git.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { hasGit, isTerminalInteractive } from './
|
|
1
|
+
import { hasGit, isTerminalInteractive } from './context/local.js';
|
|
2
2
|
import { appendFileSync } from './fs.js';
|
|
3
3
|
import { AbortError } from './error.js';
|
|
4
4
|
import { cwd } from './path.js';
|
|
5
5
|
import { outputContent, outputToken, outputDebug } from '../../public/node/output.js';
|
|
6
6
|
import git from 'simple-git';
|
|
7
|
-
export const gitFactory = git;
|
|
8
7
|
/**
|
|
9
8
|
* Initialize a git repository at the given directory.
|
|
10
9
|
*
|
|
@@ -15,10 +14,27 @@ export async function initializeGitRepository(directory, initialBranch = 'main')
|
|
|
15
14
|
outputDebug(outputContent `Initializing git repository at ${outputToken.path(directory)}...`);
|
|
16
15
|
await ensureGitIsPresentOrAbort();
|
|
17
16
|
// We use init and checkout instead of `init --initial-branch` because the latter is only supported in git 2.28+
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18
|
+
// @ts-ignore
|
|
18
19
|
const repo = git(directory);
|
|
19
20
|
await repo.init();
|
|
20
21
|
await repo.checkoutLocalBranch(initialBranch);
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Given a Git repository and a list of absolute paths to files contained
|
|
25
|
+
* in the repository, it filters and returns the files that are ignored
|
|
26
|
+
* by the .gitignore.
|
|
27
|
+
*
|
|
28
|
+
* @param directory - The absolute path to the directory containing the files.
|
|
29
|
+
* @param files - The list of files to check against.
|
|
30
|
+
*/
|
|
31
|
+
export async function checkIfIgnoredInGitRepository(directory, files) {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const repo = git(directory);
|
|
35
|
+
const ignoredLockfile = await repo.checkIgnore(files);
|
|
36
|
+
return ignoredLockfile;
|
|
37
|
+
}
|
|
22
38
|
/**
|
|
23
39
|
* Create a .gitignore file in the given directory.
|
|
24
40
|
*
|
|
@@ -69,8 +85,12 @@ export async function downloadGitRepository(cloneOptions) {
|
|
|
69
85
|
...(!isTerminalInteractive() && { config: ['core.askpass=true'] }),
|
|
70
86
|
};
|
|
71
87
|
try {
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
89
|
+
// @ts-ignore
|
|
72
90
|
await git(simpleGitOptions).clone(repository, destination, options);
|
|
73
91
|
if (latestTag) {
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
93
|
+
// @ts-ignore
|
|
74
94
|
const localGitRepository = git(destination);
|
|
75
95
|
const latestTag = await getLocalLatestTag(localGitRepository, repoUrl);
|
|
76
96
|
await localGitRepository.checkout(latestTag);
|
|
@@ -106,6 +126,8 @@ async function getLocalLatestTag(repository, repoUrl) {
|
|
|
106
126
|
* @returns The latest commit of the repository.
|
|
107
127
|
*/
|
|
108
128
|
export async function getLatestGitCommit(directory) {
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
130
|
+
// @ts-ignore
|
|
109
131
|
const logs = await git({ baseDir: directory }).log({
|
|
110
132
|
maxCount: 1,
|
|
111
133
|
});
|
|
@@ -121,6 +143,8 @@ export async function getLatestGitCommit(directory) {
|
|
|
121
143
|
* @returns A promise that resolves when the files are added to the index.
|
|
122
144
|
*/
|
|
123
145
|
export async function addAllToGitFromDirectory(directory) {
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
147
|
+
// @ts-ignore
|
|
124
148
|
const simpleGit = git({ baseDir: directory });
|
|
125
149
|
await simpleGit.raw('add', '--all');
|
|
126
150
|
}
|
|
@@ -132,6 +156,8 @@ export async function addAllToGitFromDirectory(directory) {
|
|
|
132
156
|
* @returns The hash of the created commit.
|
|
133
157
|
*/
|
|
134
158
|
export async function createGitCommit(message, options) {
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
160
|
+
// @ts-ignore
|
|
135
161
|
const simpleGit = git({ baseDir: options?.directory });
|
|
136
162
|
const commitOptions = options?.author ? { '--author': options.author } : undefined;
|
|
137
163
|
const result = await simpleGit.commit(message, commitOptions);
|
|
@@ -144,6 +170,8 @@ export async function createGitCommit(message, options) {
|
|
|
144
170
|
* @returns The HEAD symbolic reference of the repository.
|
|
145
171
|
*/
|
|
146
172
|
export async function getHeadSymbolicRef(directory) {
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
174
|
+
// @ts-ignore
|
|
147
175
|
const ref = await git({ baseDir: directory }).raw('symbolic-ref', '-q', 'HEAD');
|
|
148
176
|
if (!ref) {
|
|
149
177
|
throw new AbortError("Git HEAD can't be detached to run command", outputContent `Run ${outputToken.genericShellCommand('git checkout [branchName]')} to reattach HEAD or see git ${outputToken.link('documentation', 'https://git-scm.com/book/en/v2/Git-Internals-Git-References')} for more details`);
|
|
@@ -168,6 +196,8 @@ export class OutsideGitDirectoryError extends AbortError {
|
|
|
168
196
|
* @param directory - The directory to check.
|
|
169
197
|
*/
|
|
170
198
|
export async function ensureInsideGitDirectory(directory) {
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
200
|
+
// @ts-ignore
|
|
171
201
|
if (!(await git({ baseDir: directory }).checkIsRepo())) {
|
|
172
202
|
throw new OutsideGitDirectoryError(`${outputToken.path(directory || cwd())} is not a Git directory`);
|
|
173
203
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../../src/public/node/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,qBAAqB,EAAC,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AACtC,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,GAAoF,MAAM,YAAY,CAAA;AAE7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,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,IAAI,wBAAwB,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,EAAE,CAAC,yBAAyB,CAAC,CAAA;KACrG;AACH,CAAC","sourcesContent":["import {hasGit, isTerminalInteractive} from './environment/local.js'\nimport {appendFileSync} from './fs.js'\nimport {AbortError} from './error.js'\nimport {cwd} from './path.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport git, {TaskOptions, SimpleGitProgressEvent, DefaultLogFields, ListLogLine, SimpleGit} from 'simple-git'\n\nexport const gitFactory = git\n\n/**\n * Initialize a git repository at the given directory.\n *\n * @param directory - The directory where the git repository will be initialized.\n * @param initialBranch - The name of the initial branch.\n */\nexport async function initializeGitRepository(directory: string, initialBranch = 'main'): Promise<void> {\n outputDebug(outputContent`Initializing git repository at ${outputToken.path(directory)}...`)\n await ensureGitIsPresentOrAbort()\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}\n/**\n * Create a .gitignore file in the given directory.\n *\n * @param directory - The directory where the .gitignore file will be created.\n * @param template - The template to use to create the .gitignore file.\n */\nexport function createGitIgnore(directory: string, template: GitIgnoreTemplate): void {\n outputDebug(outputContent`Creating .gitignore at ${outputToken.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 appendFileSync(filePath, fileContent)\n}\n\n/**\n * Options to use when cloning a git repository.\n *\n * @param repoUrl - The URL of the repository to clone.\n * @param destination - The directory where the repository will be cloned.\n * @param progressUpdater - A function that will be called with the progress of the clone.\n * @param shallow - Whether to clone the repository shallowly.\n * @param latestTag - Whether to clone the latest tag instead of the default branch.\n */\nexport interface GitCloneOptions {\n repoUrl: string\n destination: string\n progressUpdater?: (statusString: string) => void\n shallow?: boolean\n latestTag?: boolean\n}\n/**\n * Clone a git repository.\n *\n * @param cloneOptions - The options to use to clone the repository.\n * @returns A promise that resolves when the clone is complete.\n */\nexport async function downloadGitRepository(cloneOptions: GitCloneOptions): Promise<void> {\n const {repoUrl, destination, progressUpdater, shallow, latestTag} = cloneOptions\n outputDebug(outputContent`Git-cloning repository ${repoUrl} into ${outputToken.path(destination)}...`)\n await ensureGitIsPresentOrAbort()\n const [repository, branch] = repoUrl.split('#')\n const options: TaskOptions = {'--recurse-submodules': null}\n\n if (branch && latestTag) {\n throw new AbortError(\"Error cloning the repository. Git can't clone the latest release with a 'branch'.\")\n }\n if (branch) {\n options['--branch'] = branch\n }\n\n if (shallow && latestTag) {\n throw new AbortError(\n \"Error cloning the repository. Git can't clone the latest release with the 'shallow' property.\",\n )\n }\n if (shallow) {\n options['--depth'] = 1\n }\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\n if (latestTag) {\n const localGitRepository = git(destination)\n const latestTag = await getLocalLatestTag(localGitRepository, repoUrl)\n await localGitRepository.checkout(latestTag)\n }\n } catch (err) {\n if (err instanceof Error) {\n const abortError = new AbortError(err.message)\n abortError.stack = err.stack\n throw abortError\n }\n throw err\n }\n}\n\n/**\n * Get the most recent tag of a local git repository.\n *\n * @param repository - The local git repository.\n * @param repoUrl - The URL of the repository.\n * @returns The most recent tag of the repository.\n */\nasync function getLocalLatestTag(repository: SimpleGit, repoUrl: string): Promise<string> {\n const latest = (await repository.tags()).latest\n\n if (!latest) {\n throw new AbortError(`Couldn't obtain the most recent tag of the repository ${repoUrl}`)\n }\n\n return latest\n}\n\n/**\n * Get the latest commit of a git repository.\n *\n * @param directory - The directory of the git repository.\n * @returns The latest commit of the repository.\n */\nexport async function getLatestGitCommit(directory?: string): Promise<DefaultLogFields & ListLogLine> {\n const logs = await git({baseDir: directory}).log({\n maxCount: 1,\n })\n if (!logs.latest) {\n throw new AbortError(\n 'Must have at least one commit to run command',\n outputContent`Run ${outputToken.genericShellCommand(\n \"git commit -m 'Initial commit'\",\n )} to create your first commit.`,\n )\n }\n return logs.latest\n}\n\n/**\n * Add all files to the git index from the given directory.\n *\n * @param directory - The directory where the git repository is located.\n * @returns A promise that resolves when the files are added to the index.\n */\nexport async function addAllToGitFromDirectory(directory?: string): Promise<void> {\n const simpleGit = git({baseDir: directory})\n await simpleGit.raw('add', '--all')\n}\n\nexport interface CreateGitCommitOptions {\n directory?: string\n author?: string\n}\n\n/**\n * Create a git commit.\n *\n * @param message - The message of the commit.\n * @param options - The options to use to create the commit.\n * @returns The hash of the created commit.\n */\nexport async function createGitCommit(message: string, options?: CreateGitCommitOptions): 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\n/**\n * Get the HEAD symbolic reference of a git repository.\n *\n * @param directory - The directory of the git repository.\n * @returns The HEAD symbolic reference of the repository.\n */\nexport async function getHeadSymbolicRef(directory?: string): Promise<string> {\n const ref = await git({baseDir: directory}).raw('symbolic-ref', '-q', 'HEAD')\n if (!ref) {\n throw new AbortError(\n \"Git HEAD can't be detached to run command\",\n outputContent`Run ${outputToken.genericShellCommand(\n 'git checkout [branchName]',\n )} to reattach HEAD or see git ${outputToken.link(\n 'documentation',\n 'https://git-scm.com/book/en/v2/Git-Internals-Git-References',\n )} for more details`,\n )\n }\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 ensureGitIsPresentOrAbort(): Promise<void> {\n if (!(await hasGit())) {\n throw new AbortError(\n `Git is necessary in the environment to continue`,\n outputContent`Install ${outputToken.link(\n 'git',\n 'https://git-scm.com/book/en/v2/Getting-Started-Installing-Git',\n )}`,\n )\n }\n}\n\nexport class OutsideGitDirectoryError extends AbortError {}\n/**\n * If command run from outside a .git directory tree\n * it throws an abort error.\n *\n * @param directory - The directory to check.\n */\nexport async function ensureInsideGitDirectory(directory?: string): Promise<void> {\n if (!(await git({baseDir: directory}).checkIsRepo())) {\n throw new OutsideGitDirectoryError(`${outputToken.path(directory || cwd())} is not a Git directory`)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../../src/public/node/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AACtC,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,GAAoF,MAAM,YAAY,CAAA;AAE7G;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,SAAiB,EAAE,aAAa,GAAG,MAAM;IACrF,WAAW,CAAC,aAAa,CAAA,kCAAkC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAC5F,MAAM,yBAAyB,EAAE,CAAA;IACjC,gHAAgH;IAChH,6DAA6D;IAC7D,aAAa;IACb,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IAC3B,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;IACjB,M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AAyB,SAAQ,UAAU;CAAG;AAC3D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,SAAkB;IAC/D,6DAA6D;IAC7D,aAAa;IACb,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAC,OAAO,EAAE,SAAS,EAAC,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE;QACpD,MAAM,IAAI,wBAAwB,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,EAAE,CAAC,yBAAyB,CAAC,CAAA;KACrG;AACH,CAAC","sourcesContent":["import {hasGit, isTerminalInteractive} from './context/local.js'\nimport {appendFileSync} from './fs.js'\nimport {AbortError} from './error.js'\nimport {cwd} from './path.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport git, {TaskOptions, SimpleGitProgressEvent, DefaultLogFields, ListLogLine, SimpleGit} from 'simple-git'\n\n/**\n * Initialize a git repository at the given directory.\n *\n * @param directory - The directory where the git repository will be initialized.\n * @param initialBranch - The name of the initial branch.\n */\nexport async function initializeGitRepository(directory: string, initialBranch = 'main'): Promise<void> {\n outputDebug(outputContent`Initializing git repository at ${outputToken.path(directory)}...`)\n await ensureGitIsPresentOrAbort()\n // We use init and checkout instead of `init --initial-branch` because the latter is only supported in git 2.28+\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const repo = git(directory)\n await repo.init()\n await repo.checkoutLocalBranch(initialBranch)\n}\n\n/**\n * Given a Git repository and a list of absolute paths to files contained\n * in the repository, it filters and returns the files that are ignored\n * by the .gitignore.\n *\n * @param directory - The absolute path to the directory containing the files.\n * @param files - The list of files to check against.\n */\nexport async function checkIfIgnoredInGitRepository(directory: string, files: string[]): Promise<string[]> {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const repo = git(directory)\n const ignoredLockfile = await repo.checkIgnore(files)\n return ignoredLockfile\n}\n\nexport interface GitIgnoreTemplate {\n [section: string]: string[]\n}\n/**\n * Create a .gitignore file in the given directory.\n *\n * @param directory - The directory where the .gitignore file will be created.\n * @param template - The template to use to create the .gitignore file.\n */\nexport function createGitIgnore(directory: string, template: GitIgnoreTemplate): void {\n outputDebug(outputContent`Creating .gitignore at ${outputToken.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 appendFileSync(filePath, fileContent)\n}\n\n/**\n * Options to use when cloning a git repository.\n *\n * @param repoUrl - The URL of the repository to clone.\n * @param destination - The directory where the repository will be cloned.\n * @param progressUpdater - A function that will be called with the progress of the clone.\n * @param shallow - Whether to clone the repository shallowly.\n * @param latestTag - Whether to clone the latest tag instead of the default branch.\n */\nexport interface GitCloneOptions {\n repoUrl: string\n destination: string\n progressUpdater?: (statusString: string) => void\n shallow?: boolean\n latestTag?: boolean\n}\n/**\n * Clone a git repository.\n *\n * @param cloneOptions - The options to use to clone the repository.\n * @returns A promise that resolves when the clone is complete.\n */\nexport async function downloadGitRepository(cloneOptions: GitCloneOptions): Promise<void> {\n const {repoUrl, destination, progressUpdater, shallow, latestTag} = cloneOptions\n outputDebug(outputContent`Git-cloning repository ${repoUrl} into ${outputToken.path(destination)}...`)\n await ensureGitIsPresentOrAbort()\n const [repository, branch] = repoUrl.split('#')\n const options: TaskOptions = {'--recurse-submodules': null}\n\n if (branch && latestTag) {\n throw new AbortError(\"Error cloning the repository. Git can't clone the latest release with a 'branch'.\")\n }\n if (branch) {\n options['--branch'] = branch\n }\n\n if (shallow && latestTag) {\n throw new AbortError(\n \"Error cloning the repository. Git can't clone the latest release with the 'shallow' property.\",\n )\n }\n if (shallow) {\n options['--depth'] = 1\n }\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n await git(simpleGitOptions).clone(repository!, destination, options)\n\n if (latestTag) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const localGitRepository = git(destination)\n const latestTag = await getLocalLatestTag(localGitRepository, repoUrl)\n await localGitRepository.checkout(latestTag)\n }\n } catch (err) {\n if (err instanceof Error) {\n const abortError = new AbortError(err.message)\n abortError.stack = err.stack\n throw abortError\n }\n throw err\n }\n}\n\n/**\n * Get the most recent tag of a local git repository.\n *\n * @param repository - The local git repository.\n * @param repoUrl - The URL of the repository.\n * @returns The most recent tag of the repository.\n */\nasync function getLocalLatestTag(repository: SimpleGit, repoUrl: string): Promise<string> {\n const latest = (await repository.tags()).latest\n\n if (!latest) {\n throw new AbortError(`Couldn't obtain the most recent tag of the repository ${repoUrl}`)\n }\n\n return latest\n}\n\n/**\n * Get the latest commit of a git repository.\n *\n * @param directory - The directory of the git repository.\n * @returns The latest commit of the repository.\n */\nexport async function getLatestGitCommit(directory?: string): Promise<DefaultLogFields & ListLogLine> {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const logs = await git({baseDir: directory}).log({\n maxCount: 1,\n })\n if (!logs.latest) {\n throw new AbortError(\n 'Must have at least one commit to run command',\n outputContent`Run ${outputToken.genericShellCommand(\n \"git commit -m 'Initial commit'\",\n )} to create your first commit.`,\n )\n }\n return logs.latest\n}\n\n/**\n * Add all files to the git index from the given directory.\n *\n * @param directory - The directory where the git repository is located.\n * @returns A promise that resolves when the files are added to the index.\n */\nexport async function addAllToGitFromDirectory(directory?: string): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const simpleGit = git({baseDir: directory})\n await simpleGit.raw('add', '--all')\n}\n\nexport interface CreateGitCommitOptions {\n directory?: string\n author?: string\n}\n\n/**\n * Create a git commit.\n *\n * @param message - The message of the commit.\n * @param options - The options to use to create the commit.\n * @returns The hash of the created commit.\n */\nexport async function createGitCommit(message: string, options?: CreateGitCommitOptions): Promise<string> {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\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\n/**\n * Get the HEAD symbolic reference of a git repository.\n *\n * @param directory - The directory of the git repository.\n * @returns The HEAD symbolic reference of the repository.\n */\nexport async function getHeadSymbolicRef(directory?: string): Promise<string> {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const ref = await git({baseDir: directory}).raw('symbolic-ref', '-q', 'HEAD')\n if (!ref) {\n throw new AbortError(\n \"Git HEAD can't be detached to run command\",\n outputContent`Run ${outputToken.genericShellCommand(\n 'git checkout [branchName]',\n )} to reattach HEAD or see git ${outputToken.link(\n 'documentation',\n 'https://git-scm.com/book/en/v2/Git-Internals-Git-References',\n )} for more details`,\n )\n }\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 ensureGitIsPresentOrAbort(): Promise<void> {\n if (!(await hasGit())) {\n throw new AbortError(\n `Git is necessary in the environment to continue`,\n outputContent`Install ${outputToken.link(\n 'git',\n 'https://git-scm.com/book/en/v2/Getting-Started-Installing-Git',\n )}`,\n )\n }\n}\n\nexport class OutsideGitDirectoryError extends AbortError {}\n/**\n * If command run from outside a .git directory tree\n * it throws an abort error.\n *\n * @param directory - The directory to check.\n */\nexport async function ensureInsideGitDirectory(directory?: string): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (!(await git({baseDir: directory}).checkIsRepo())) {\n throw new OutsideGitDirectoryError(`${outputToken.path(directory || cwd())} is not a Git directory`)\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Hook } from '@oclif/core';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const hook: Hook.Postrun;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { reportAnalyticsEvent } from '../analytics.js';
|
|
2
2
|
import { outputDebug } from '../../../public/node/output.js';
|
|
3
3
|
// This hook is called after each successful command run. More info: https://oclif.io/docs/hooks
|
|
4
|
-
export const
|
|
4
|
+
export const hook = async ({ config, Command }) => {
|
|
5
5
|
await reportAnalyticsEvent({ config });
|
|
6
6
|
const command = Command?.id?.replace(/:/g, ' ');
|
|
7
7
|
outputDebug(`Completed command ${command}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../../../src/public/node/hooks/postrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAA;AAG1D,gGAAgG;AAChG,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../../../src/public/node/hooks/postrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAA;AAG1D,gGAAgG;AAChG,MAAM,CAAC,MAAM,IAAI,GAAiB,KAAK,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,EAAE,EAAE;IAC5D,MAAM,oBAAoB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAA;IACpC,MAAM,OAAO,GAAG,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,WAAW,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAA;AAC7C,CAAC,CAAA","sourcesContent":["import {reportAnalyticsEvent} from '../analytics.js'\nimport {outputDebug} from '../../../public/node/output.js'\nimport {Hook} from '@oclif/core'\n\n// This hook is called after each successful command run. More info: https://oclif.io/docs/hooks\nexport const hook: Hook.Postrun = async ({config, Command}) => {\n await reportAnalyticsEvent({config})\n const command = Command?.id?.replace(/:/g, ' ')\n outputDebug(`Completed command ${command}`)\n}\n"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import FormData from 'form-data';
|
|
2
2
|
import nodeFetch, { RequestInfo, RequestInit } from 'node-fetch';
|
|
3
3
|
export { createApp, createRouter, IncomingMessage, ServerResponse, CompatibilityEvent, createError, send, sendError, sendRedirect, H3Error, } from 'h3';
|
|
4
|
+
export { FetchError } from 'node-fetch';
|
|
4
5
|
/**
|
|
5
6
|
* Create a new FormData object.
|
|
6
7
|
*
|
|
7
8
|
* @returns A FormData object.
|
|
8
9
|
*/
|
|
9
10
|
export declare function formData(): FormData;
|
|
10
|
-
export
|
|
11
|
+
export type Response = ReturnType<typeof nodeFetch>;
|
|
11
12
|
/**
|
|
12
13
|
* An interface that abstracts way node-fetch. When Node has built-in
|
|
13
14
|
* support for "fetch" in the standard library, we can drop the node-fetch
|
|
@@ -31,3 +32,11 @@ export declare function fetch(url: RequestInfo, init?: RequestInit): Response;
|
|
|
31
32
|
* @returns A promise that resolves with the response.
|
|
32
33
|
*/
|
|
33
34
|
export declare function shopifyFetch(url: RequestInfo, init?: RequestInit): Response;
|
|
35
|
+
/**
|
|
36
|
+
* Download a file from a URL to a local path.
|
|
37
|
+
*
|
|
38
|
+
* @param url - The URL to download from.
|
|
39
|
+
* @param to - The local path to download to.
|
|
40
|
+
* @returns - A promise that resolves with the local path.
|
|
41
|
+
*/
|
|
42
|
+
export declare function downloadFile(url: string, to: string): Promise<string>;
|
package/dist/public/node/http.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { dirname } from './path.js';
|
|
2
|
+
import { createFileWriteStream, fileExistsSync, mkdirSync, unlinkFileSync } from './fs.js';
|
|
1
3
|
import { buildHeaders, httpsAgent, sanitizedHeadersOutput } from '../../private/node/api/headers.js';
|
|
2
4
|
import { outputContent, outputDebug } from '../../public/node/output.js';
|
|
3
5
|
import FormData from 'form-data';
|
|
4
6
|
import nodeFetch from 'node-fetch';
|
|
5
7
|
import { performance } from 'perf_hooks';
|
|
6
8
|
export { createApp, createRouter, createError, send, sendError, sendRedirect, H3Error, } from 'h3';
|
|
9
|
+
export { FetchError } from 'node-fetch';
|
|
7
10
|
/**
|
|
8
11
|
* Create a new FormData object.
|
|
9
12
|
*
|
|
@@ -55,4 +58,36 @@ ${sanitizedHeadersOutput((options?.headers ?? {}))}
|
|
|
55
58
|
outputDebug(`Request to ${url.toString()} completed with status ${response.status} in ${Math.round(t1 - t0)} ms`);
|
|
56
59
|
return response;
|
|
57
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Download a file from a URL to a local path.
|
|
63
|
+
*
|
|
64
|
+
* @param url - The URL to download from.
|
|
65
|
+
* @param to - The local path to download to.
|
|
66
|
+
* @returns - A promise that resolves with the local path.
|
|
67
|
+
*/
|
|
68
|
+
export function downloadFile(url, to) {
|
|
69
|
+
outputDebug(`Downloading ${url} to ${to}`);
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
if (!fileExistsSync(dirname(to))) {
|
|
72
|
+
mkdirSync(dirname(to));
|
|
73
|
+
}
|
|
74
|
+
const file = createFileWriteStream(to);
|
|
75
|
+
file.on('finish', () => {
|
|
76
|
+
file.close();
|
|
77
|
+
resolve(to);
|
|
78
|
+
});
|
|
79
|
+
file.on('error', (err) => {
|
|
80
|
+
unlinkFileSync(to);
|
|
81
|
+
reject(err);
|
|
82
|
+
});
|
|
83
|
+
nodeFetch(url, { redirect: 'follow' })
|
|
84
|
+
.then((res) => {
|
|
85
|
+
res.body?.pipe(file);
|
|
86
|
+
})
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
unlinkFileSync(to);
|
|
89
|
+
reject(err);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
58
93
|
//# sourceMappingURL=http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AA;IACA,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;IAC5B,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAC,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,EAAE,EAAC,CAAC,CAAA;IAC3E,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;IAC5B,WAAW,CAAC,cAAc,GAAG,CAAC,QAAQ,EAAE,0BAA0B,QAAQ,CAAC,MAAM,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;IACjH,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {buildHeaders, httpsAgent, sanitizedHeadersOutput} from '../../private/node/api/headers.js'\nimport {outputContent, outputDebug} from '../../public/node/output.js'\nimport FormData from 'form-data'\nimport nodeFetch, {RequestInfo, RequestInit} from 'node-fetch'\nimport {performance} from 'perf_hooks'\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 * Create a new FormData object.\n *\n * @returns A FormData object.\n */\nexport function formData(): FormData {\n return new FormData()\n}\n\nexport type Response = ReturnType<typeof nodeFetch>\n\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 *\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 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 *\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 async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const options: RequestInit = {\n ...(init ?? {}),\n headers: {\n ...(await buildHeaders()),\n ...(init?.headers ?? {}),\n },\n }\n\n outputDebug(outputContent`\nSending ${options.method ?? 'GET'} request to URL ${url.toString()} and headers:\n${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}\n`)\n const t0 = performance.now()\n const response = await nodeFetch(url, {...init, agent: await httpsAgent()})\n const t1 = performance.now()\n outputDebug(`Request to ${url.toString()} completed with status ${response.status} in ${Math.round(t1 - t0)} ms`)\n return response\n}\n"]}
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/public/node/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AACxF,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,sBAAsB,EAAC,MAAM,mCAAmC,CAAA;AAClG,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACtE,OAAO,QAAQ,MAAM,WAAW,CAAA;AAChC,OAAO,SAAqC,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAA;AAEtC,OAAO,EACL,SAAS,EACT,YAAY,EAIZ,WAAW,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,OAAO,GACR,MAAM,IAAI,CAAA;AAEX,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AAErC;;;;GAIG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,IAAI,QAAQ,EAAE,CAAA;AACvB,CAAC;AAID;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,GAA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AAc,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE;YAChC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAA;SACvB;QAED,MAAM,IAAI,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAA;QAEtC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACrB,IAAI,CAAC,KAAK,EAAE,CAAA;YACZ,OAAO,CAAC,EAAE,CAAC,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACvB,cAAc,CAAC,EAAE,CAAC,CAAA;YAClB,MAAM,CAAC,GAAG,CAAC,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,SAAS,CAAC,GAAG,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC;aACjC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACtB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,cAAc,CAAC,EAAE,CAAC,CAAA;YAClB,MAAM,CAAC,GAAG,CAAC,CAAA;QACb,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {dirname} from './path.js'\nimport {createFileWriteStream, fileExistsSync, mkdirSync, unlinkFileSync} from './fs.js'\nimport {buildHeaders, httpsAgent, sanitizedHeadersOutput} from '../../private/node/api/headers.js'\nimport {outputContent, outputDebug} from '../../public/node/output.js'\nimport FormData from 'form-data'\nimport nodeFetch, {RequestInfo, RequestInit} from 'node-fetch'\nimport {performance} from 'perf_hooks'\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\nexport {FetchError} from 'node-fetch'\n\n/**\n * Create a new FormData object.\n *\n * @returns A FormData object.\n */\nexport function formData(): FormData {\n return new FormData()\n}\n\nexport type Response = ReturnType<typeof nodeFetch>\n\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 *\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 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 *\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 async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const options: RequestInit = {\n ...(init ?? {}),\n headers: {\n ...(await buildHeaders()),\n ...(init?.headers ?? {}),\n },\n }\n\n outputDebug(outputContent`\nSending ${options.method ?? 'GET'} request to URL ${url.toString()} and headers:\n${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}\n`)\n const t0 = performance.now()\n const response = await nodeFetch(url, {...init, agent: await httpsAgent()})\n const t1 = performance.now()\n outputDebug(`Request to ${url.toString()} completed with status ${response.status} in ${Math.round(t1 - t0)} ms`)\n return response\n}\n\n/**\n * Download a file from a URL to a local path.\n *\n * @param url - The URL to download from.\n * @param to - The local path to download to.\n * @returns - A promise that resolves with the local path.\n */\nexport function downloadFile(url: string, to: string): Promise<string> {\n outputDebug(`Downloading ${url} to ${to}`)\n\n return new Promise<string>((resolve, reject) => {\n if (!fileExistsSync(dirname(to))) {\n mkdirSync(dirname(to))\n }\n\n const file = createFileWriteStream(to)\n\n file.on('finish', () => {\n file.close()\n resolve(to)\n })\n\n file.on('error', (err) => {\n unlinkFileSync(to)\n reject(err)\n })\n\n nodeFetch(url, {redirect: 'follow'})\n .then((res) => {\n res.body?.pipe(file)\n })\n .catch((err) => {\n unlinkFileSync(to)\n reject(err)\n })\n })\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MonorailEventPublic } from './monorail.js';
|
|
2
2
|
import { PickByPrefix } from '../common/ts/pick-by-prefix.js';
|
|
3
3
|
import { AnyJson } from '../../private/common/json.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type ProvideMetadata<T> = () => Partial<T> | Promise<Partial<T>>;
|
|
5
|
+
type MetadataErrorHandling = 'auto' | 'mute-and-report' | 'bubble';
|
|
6
6
|
export interface RuntimeMetadataManager<TPublic extends AnyJson, TSensitive extends AnyJson> {
|
|
7
7
|
/** Add some public metadata -- this should not contain any PII. */
|
|
8
8
|
addPublicMetadata: (getData: ProvideMetadata<TPublic>, onError?: MetadataErrorHandling) => Promise<void>;
|
|
@@ -13,8 +13,8 @@ export interface RuntimeMetadataManager<TPublic extends AnyJson, TSensitive exte
|
|
|
13
13
|
/** Get a snapshot of the tracked sensitive data. */
|
|
14
14
|
getAllSensitiveMetadata: () => Partial<TSensitive>;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
export
|
|
16
|
+
export type PublicSchema<T> = T extends RuntimeMetadataManager<infer TPublic, infer _TSensitive> ? TPublic : never;
|
|
17
|
+
export type SensitiveSchema<T> = T extends RuntimeMetadataManager<infer _TPublic, infer TSensitive> ? TSensitive : never;
|
|
18
18
|
/**
|
|
19
19
|
* Creates a container for metadata collected at runtime.
|
|
20
20
|
* The container provides async-safe functions for extracting the gathered metadata, and for setting it.
|
|
@@ -24,7 +24,7 @@ export declare type SensitiveSchema<T> = T extends RuntimeMetadataManager<infer
|
|
|
24
24
|
export declare function createRuntimeMetadataContainer<TPublic extends AnyJson, TSensitive extends AnyJson = {
|
|
25
25
|
[key: string]: never;
|
|
26
26
|
}>(): RuntimeMetadataManager<TPublic, TSensitive>;
|
|
27
|
-
|
|
27
|
+
type CmdFieldsFromMonorail = PickByPrefix<MonorailEventPublic, 'cmd_all_'> & PickByPrefix<MonorailEventPublic, 'cmd_app_'>;
|
|
28
28
|
declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
|
|
29
29
|
commandStartOptions: {
|
|
30
30
|
startTime: number;
|
|
@@ -48,6 +48,6 @@ export declare const getAllPublicMetadata: () => Partial<CmdFieldsFromMonorail>,
|
|
|
48
48
|
startArgs: string[];
|
|
49
49
|
};
|
|
50
50
|
}>, onError?: MetadataErrorHandling) => Promise<void>;
|
|
51
|
-
export
|
|
52
|
-
export
|
|
51
|
+
export type Public = PublicSchema<typeof coreData>;
|
|
52
|
+
export type Sensitive = SensitiveSchema<typeof coreData>;
|
|
53
53
|
export {};
|