Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const MIGRATIONS = [
require('./migrations/mapping_api_version_0_0_5'),
require('./migrations/mapping_api_version_0_0_6'),
require('./migrations/spec_version_0_0_2'),
require('./migrations/spec_version_0_0_3'),
require('./migrations/spec_version_0_0_4'),
]

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/spec_version_0_0_2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { loadManifest } = require('./util/load-manifest')
// Spec version to 0.0.2 uses top level templates. graph-cli no longer supports
// 0.0.1 which used nested templates.
module.exports = {
name: 'Bump mapping specVersion from 0.0.1 to 0.0.2',
name: 'Bump manifest specVersion from 0.0.1 to 0.0.2',
predicate: async ({ sourceDir, manifestFile }) => {
let manifest = await loadManifest(manifestFile)
return (
Expand Down
29 changes: 29 additions & 0 deletions src/migrations/spec_version_0_0_3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const fs = require('fs-extra')
const toolbox = require('gluegun/toolbox')
const yaml = require('js-yaml')
const { loadManifest } = require('./util/load-manifest')

// Spec version 0.0.4 uses feature management, but features are
// detected and validated by the graph-node instance during subgraph
// deployment.
//
// Also, we skip spec version 0.0.3, which is considered invalid and
// non-canonical.
module.exports = {
name: 'Bump manifest specVersion from 0.0.2 to 0.0.4',
predicate: async ({ sourceDir, manifestFile }) => {
let manifest = await loadManifest(manifestFile)
return (
manifest &&
typeof manifest === 'object' &&
manifest.specVersion &&
(manifest.specVersion === '0.0.2' || manifest.specVersion === '0.0.3')
)
},
apply: async ({ manifestFile }) => {
await toolbox.patching.patch(manifestFile, {
insert: 'specVersion: 0.0.4',
replace: new RegExp(`specVersion: ['"]?0.0.[23]['"]?`),
})
},
}