@data-fair/lib-node 2.3.1 → 2.3.2
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/package.json +1 -1
- package/upgrade-scripts.js +6 -4
package/package.json
CHANGED
package/upgrade-scripts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import semver from 'semver'
|
|
2
2
|
import path from 'path'
|
|
3
|
-
import { readdirSync, readFileSync } from 'fs'
|
|
3
|
+
import { readdirSync, readFileSync, statSync } from 'fs'
|
|
4
4
|
import Debug from 'debug'
|
|
5
5
|
const debug = Debug('upgrade')
|
|
6
6
|
// chose the proper scripts to execute, then run them
|
|
@@ -40,9 +40,9 @@ async function runScripts (db, basePath, isFresh) {
|
|
|
40
40
|
scripts = scripts.filter(scriptDef => scriptDef.version === 'init')
|
|
41
41
|
if (isFresh) {
|
|
42
42
|
if (await isFresh()) {
|
|
43
|
-
debug('isFresh function returned true, this is fresh install, do not run any script')
|
|
43
|
+
debug('isFresh function returned true, this is a fresh install, do not run any script')
|
|
44
44
|
} else {
|
|
45
|
-
debug('isFresh function returned false, this is not fresh install, run all init scripts')
|
|
45
|
+
debug('isFresh function returned false, this is not a fresh install, run all init scripts')
|
|
46
46
|
previousPersion = '0.0.0'
|
|
47
47
|
}
|
|
48
48
|
} else {
|
|
@@ -68,7 +68,9 @@ async function runScripts (db, basePath, isFresh) {
|
|
|
68
68
|
}
|
|
69
69
|
// Walk the scripts directories
|
|
70
70
|
async function listScripts (scriptsRoot) {
|
|
71
|
-
const dirs = readdirSync(scriptsRoot)
|
|
71
|
+
const dirs = readdirSync(scriptsRoot)
|
|
72
|
+
.filter(dir => statSync(path.join(scriptsRoot, dir)).isDirectory())
|
|
73
|
+
.sort()
|
|
72
74
|
return dirs.map(dir => {
|
|
73
75
|
return {
|
|
74
76
|
version: dir,
|