-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bumped deps and deno * Updated changelog * Bumped nessie version and fixed issues
- Loading branch information
1 parent
b3fa017
commit 7e30b12
Showing
8 changed files
with
65 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,18 @@ export { | |
relative, | ||
resolve, | ||
toFileUrl, | ||
} from "https://deno.land/std@0.161.0/path/mod.ts"; | ||
} from "https://deno.land/std@0.202.0/path/mod.ts"; | ||
export { | ||
assert, | ||
assertEquals, | ||
} from "https://deno.land/std@0.161.0/testing/asserts.ts"; | ||
export { exists } from "https://deno.land/std@0.161.0/fs/mod.ts"; | ||
export { format } from "https://deno.land/std@0.161.0/datetime/mod.ts"; | ||
} from "https://deno.land/std@0.202.0/testing/asserts.ts"; | ||
export { exists } from "https://deno.land/std@0.202.0/fs/mod.ts"; | ||
export { format } from "https://deno.land/std@0.202.0/datetime/mod.ts"; | ||
export { | ||
bold, | ||
green, | ||
yellow, | ||
} from "https://deno.land/std@0.161.0/fmt/colors.ts"; | ||
} from "https://deno.land/std@0.202.0/fmt/colors.ts"; | ||
|
||
/** Cliffy */ | ||
export { | ||
|
@@ -26,16 +26,16 @@ export { | |
HelpCommand as CliffyHelpCommand, | ||
Select as CliffySelect, | ||
Toggle as CliffyToggle, | ||
} from "https://deno.land/x/[email protected].2/mod.ts"; | ||
export type { IAction as CliffyIAction } from "https://deno.land/x/[email protected].2/mod.ts"; | ||
} from "https://deno.land/x/[email protected].7/mod.ts"; | ||
export type { IAction as CliffyIAction } from "https://deno.land/x/[email protected].7/mod.ts"; | ||
|
||
/** MySQL */ | ||
export { Client as MySQLClient } from "https://deno.land/x/mysql@v2.10.3/mod.ts"; | ||
export { Client as MySQLClient } from "https://deno.land/x/mysql@v2.12.1/mod.ts"; | ||
|
||
/** PostgreSQL */ | ||
export { | ||
Client as PostgreSQLClient, | ||
} from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
/** SQLite */ | ||
export { DB as SQLiteClient } from "https://deno.land/x/sqlite@v3.5.0/mod.ts"; | ||
export { DB as SQLiteClient } from "https://deno.land/x/sqlite@v3.8/mod.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"$schema": "https://x.nest.land/[email protected]/src/schema.json", | ||
"name": "Nessie", | ||
"description": "A modular database migration module for Deno.", | ||
"version": "2.0.10", | ||
"version": "2.0.11", | ||
"stable": true, | ||
"repository": "https://github.com/halvardssm/deno-nessie", | ||
"files": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import * as semver from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { REG_EXP_VERSION_NEXT, REG_EXP_VERSION_STABLE } from "./commons.ts"; | ||
import { | ||
format, | ||
gte, | ||
parse, | ||
SemVer, | ||
} from "https://deno.land/[email protected]/semver/mod.ts"; | ||
import { tryParse } from "https://deno.land/[email protected]/semver/try_parse.ts"; | ||
|
||
async function getTags() { | ||
const decoder = new TextDecoder(); | ||
|
@@ -21,7 +26,9 @@ async function getTags() { | |
Deno.exit(code); | ||
} | ||
|
||
return result.split("\n").filter((tag) => !tag.startsWith("v")); | ||
return result.split("\n").map((tag) => tryParse(tag)).filter((tag) => | ||
!!tag | ||
) as SemVer[]; | ||
} | ||
|
||
async function getCurrentTag() { | ||
|
@@ -44,7 +51,7 @@ async function getCurrentTag() { | |
Deno.exit(code); | ||
} | ||
|
||
return result.trim(); | ||
return parse(result.trim()); | ||
} | ||
|
||
async function generateTagsArray() { | ||
|
@@ -53,20 +60,19 @@ async function generateTagsArray() { | |
const tags = await getTags(); | ||
const current = await getCurrentTag(); | ||
|
||
const latestStable = | ||
tags.filter((tag) => REG_EXP_VERSION_STABLE.test(tag))[0]; | ||
const latestNext = tags.filter((tag) => REG_EXP_VERSION_NEXT.test(tag))[0]; | ||
const latestStable = tags.find((tag) => !tag.prerelease); | ||
const latestNext = tags.find((tag) => !!tag.prerelease); | ||
|
||
const outputArray = [`${IMAGE}:${current}`]; | ||
const outputArray = [`${IMAGE}:${format(current)}`]; | ||
|
||
try { | ||
if ( | ||
REG_EXP_VERSION_STABLE.test(current) && semver.gte(current, latestStable) | ||
!current.prerelease.length && latestStable && gte(current, latestStable) | ||
) { | ||
outputArray.push(`${IMAGE}:latest`); | ||
} | ||
|
||
if (semver.gte(current, latestNext)) { | ||
if (latestNext && gte(current, latestNext)) { | ||
outputArray.push(`${IMAGE}:next`); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { REG_EXP_VERSION, REG_EXP_VERSION_STABLE } from "./commons.ts"; | ||
import { format, SemVer } from "https://deno.land/[email protected]/semver/mod.ts"; | ||
import { tryParse } from "https://deno.land/[email protected]/semver/try_parse.ts"; | ||
|
||
const REG_EXP_README_DENO_VERSION = /shields\.io\/badge\/deno-v\d+\.\d+\.\d+/; | ||
const REG_EXP_MAKEFILE_DENO_VERSION = /DENO_VERSION=\d+\.\d+\.\d+/; | ||
|
@@ -16,101 +17,103 @@ const FILES_CI = [ | |
".github/workflows/publish_docker.yml", | ||
]; | ||
|
||
type VERSIONS = { | ||
nessie: string | undefined; | ||
deno: string | undefined; | ||
type Versions = { | ||
nessie: SemVer | undefined; | ||
deno: SemVer | undefined; | ||
}; | ||
|
||
const setEggConfig = async (versions: VERSIONS) => { | ||
const setEggConfig = async (versions: Versions) => { | ||
if (versions.nessie) { | ||
// deno-lint-ignore no-explicit-any | ||
const eggFile = JSON.parse(await Deno.readTextFile(FILE_JSON_EGG)) as any; | ||
|
||
eggFile.version = versions.nessie; | ||
eggFile.stable = REG_EXP_VERSION_STABLE.test(versions.nessie); | ||
eggFile.version = format(versions.nessie); | ||
eggFile.stable = !versions.nessie.prerelease.length; | ||
|
||
await Deno.writeTextFile( | ||
FILE_JSON_EGG, | ||
JSON.stringify(eggFile, undefined, 2), | ||
); | ||
|
||
console.info(`egg.json updated to ${versions.nessie}`); | ||
console.info(`egg.json updated to ${eggFile.version}`); | ||
} | ||
}; | ||
|
||
const setReadMe = async (versions: VERSIONS) => { | ||
const setReadMe = async (versions: Versions) => { | ||
if (versions.deno) { | ||
const readme = await Deno.readTextFile(FILE_README); | ||
|
||
const res = readme.replace( | ||
REG_EXP_README_DENO_VERSION, | ||
`shields.io/badge/deno-v${versions.deno}`, | ||
`shields.io/badge/deno-v${format(versions.deno)}`, | ||
); | ||
|
||
await Deno.writeTextFile(FILE_README, res); | ||
|
||
console.info(`README.md updated to ${versions.deno}`); | ||
console.info(`README.md updated to ${format(versions.deno)}`); | ||
} | ||
}; | ||
|
||
const setProgram = async (versions: VERSIONS) => { | ||
const setProgram = async (versions: Versions) => { | ||
if (versions.nessie) { | ||
const cli = await Deno.readTextFile(FILE_PROGRAM); | ||
|
||
const res = cli.replace( | ||
REG_EXP_PROGRAM_NESSIE_VERSION, | ||
`export const VERSION = "${versions.nessie}";`, | ||
`export const VERSION = "${format(versions.nessie)}";`, | ||
); | ||
|
||
await Deno.writeTextFile(FILE_PROGRAM, res); | ||
|
||
console.info(`consts.ts updated to ${versions.nessie}`); | ||
console.info(`consts.ts updated to ${format(versions.nessie)}`); | ||
} | ||
}; | ||
|
||
const setCI = async (versions: VERSIONS) => { | ||
const setCI = async (versions: Versions) => { | ||
if (versions.deno || versions.nessie) { | ||
for (const file of FILES_CI) { | ||
let res = await Deno.readTextFile(file); | ||
|
||
if (versions.deno) { | ||
res = res.replace( | ||
REG_EXP_CI_DENO_VERSION, | ||
`DENO_VERSION: ${versions.deno}`, | ||
`DENO_VERSION: ${format(versions.deno)}`, | ||
); | ||
|
||
console.info( | ||
`${file} updated to Deno: ${format(versions.deno)}`, | ||
); | ||
} | ||
|
||
await Deno.writeTextFile(file, res); | ||
|
||
console.info( | ||
`${file} updated to Deno: ${versions.deno}`, | ||
); | ||
} | ||
} | ||
}; | ||
|
||
const setMakefile = async (versions: VERSIONS) => { | ||
const setMakefile = async (versions: Versions) => { | ||
if (versions.deno || versions.nessie) { | ||
let res = await Deno.readTextFile(FILE_MAKEFILE); | ||
|
||
if (versions.nessie) { | ||
res = res.replace( | ||
REG_EXP_MAKEFILE_NESSIE_VERSION, | ||
`NESSIE_VERSION=${versions.nessie}`, | ||
`NESSIE_VERSION=${format(versions.nessie)}`, | ||
); | ||
} | ||
|
||
if (versions.deno) { | ||
res = res.replace( | ||
REG_EXP_MAKEFILE_DENO_VERSION, | ||
`DENO_VERSION=${versions.deno}`, | ||
`DENO_VERSION=${format(versions.deno)}`, | ||
); | ||
} | ||
|
||
await Deno.writeTextFile(FILE_MAKEFILE, res); | ||
|
||
console.info( | ||
`${FILE_MAKEFILE} updated to Nessie: ${versions.nessie} and Deno: ${versions.deno}`, | ||
`${FILE_MAKEFILE} updated to Nessie: ${ | ||
versions.nessie && format(versions.nessie) | ||
} and Deno: ${versions.deno && format(versions.deno)}`, | ||
); | ||
} | ||
}; | ||
|
@@ -130,12 +133,8 @@ async function runProgram() { | |
} | ||
|
||
const versions = { | ||
nessie: REG_EXP_VERSION.test(versionsRaw.split(":")[0]) | ||
? versionsRaw.split(":")[0] | ||
: undefined, | ||
deno: REG_EXP_VERSION_STABLE.test(versionsRaw.split(":")[1]) | ||
? versionsRaw.split(":")[1] | ||
: undefined, | ||
nessie: tryParse(versionsRaw.split(":")[0]), | ||
deno: tryParse(versionsRaw.split(":")[1]), | ||
}; | ||
|
||
await setEggConfig(versions); | ||
|