Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1678 from Shopify/pivot-dev-changes
Browse files Browse the repository at this point in the history
Changes required to be compatible with the pivot extensible discount scripts
  • Loading branch information
Pedro Piñera Buendía authored Oct 26, 2021
2 parents bfd116c + 16d74fb commit 14b276f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
From version 2.6.0, the sections in this file adhere to the [keep a changelog](https://keepachangelog.com/en/1.0.0/) specification.
## [Unreleased]

### Added
* [#1609](https://github.com/Shopify/shopify-cli/pull/1609): Add `--bind=HOST` option to `shopify theme serve`.

### Fixed
* [#1678](https://github.com/Shopify/shopify-cli/pull/1678): Fix migrator's incompatibility with Ruby 2.5.
### Changed
* [#1678](https://github.com/Shopify/shopify-cli/pull/1678): Change the `@shopify/scripts-checkout-apis-temp` package name to `@shopify/scripts-discount-apis`.
## Version 2.6.5
### Fixed
* [#1661](https://github.com/Shopify/shopify-cli/pull/1661): Handle npm list non-zero exit status when pushing scripts
Expand Down
2 changes: 1 addition & 1 deletion lib/project_types/script/config/extension_points.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ discount_types:
libraries:
typescript:
beta: true
package: "@shopify/scripts-checkout-apis-temp"
package: "@shopify/scripts-discount-apis"
repo: "https://github.com/Shopify/scripts-apis-examples"
20 changes: 9 additions & 11 deletions lib/shopify_cli/migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,21 @@ def self.migrate(
migrations_directory: File.expand_path("migrator/migrations", __dir__)
)
baseline_date = last_migration_date
unless baseline_date.nil?
migrations = migrations(migrations_directory: migrations_directory)
.select { |m|
m.date > baseline_date.to_i
}
.each { |m| m.run }
unless baseline_date.nil?
migrations(migrations_directory: migrations_directory)
.select do |m|
m.date > baseline_date.to_i
end
.each(&:run)
end

store_last_migration_date
end

private

def self.store_last_migration_date
ShopifyCLI::DB.set(ShopifyCLI::Constants::StoreKeys::LAST_MIGRATION_DATE => Time.now.to_i)
end

def self.last_migration_date
ShopifyCLI::DB.get(ShopifyCLI::Constants::StoreKeys::LAST_MIGRATION_DATE)
end
Expand All @@ -35,7 +33,7 @@ def self.migrations(migrations_directory:)
file_name = File.basename(file_path).gsub(".rb", "")
file_name_components = file_name.split("_")
date_timestamp = file_name_components[0].to_i
migration_name = file_name_components[1...].join("_")
migration_name = file_name_components.drop(1).join("_")

Migrator::Migration.new(
name: migration_name,
Expand All @@ -45,4 +43,4 @@ def self.migrations(migrations_directory:)
end
end
end
end
end

0 comments on commit 14b276f

Please sign in to comment.