Comparing version 0.0.10 to 0.0.11
@@ -10,3 +10,3 @@ # Changelog | ||
## [v0.0.10](https://github.com/sw-yx/ssg/compare/v0.0.3...v0.0.10) - 2019-09-14 | ||
## [v0.0.11](https://github.com/sw-yx/ssg/compare/v0.0.3...v0.0.11) - 2019-09-14 | ||
@@ -13,0 +13,0 @@ ### Commits |
@@ -20,2 +20,20 @@ "use strict"; | ||
* | ||
* run getInitialData only once | ||
* | ||
*/ | ||
function getSSGDataOnce(ssgConfig) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (ssgConfig.getInitialData) { | ||
const data = yield ssgConfig.getInitialData(); | ||
const dotFolderPath = path_1.default.join(path_1.default.resolve(ssgConfig.ssgDotFolder), '.ssg'); | ||
const dotFolderDataPath = path_1.default.join(dotFolderPath, 'data.json'); | ||
if (!fs_1.default.existsSync(dotFolderPath)) | ||
fs_1.default.mkdirSync(dotFolderPath); | ||
fs_1.default.writeFileSync(dotFolderDataPath, data); | ||
} | ||
}); | ||
} | ||
exports.getSSGDataOnce = getSSGDataOnce; | ||
/** | ||
* | ||
* read ssg config and ensure defaults exist | ||
@@ -29,2 +47,3 @@ * | ||
ssgConfig.configPath = ssgConfigPath; | ||
ssgConfig.ssgDotFolder = ssgConfig.ssgDotFolder || '.ssg'; | ||
ssgConfig.contentFolder = ssgConfig.contentFolder || 'content'; | ||
@@ -31,0 +50,0 @@ return ssgConfig; |
@@ -56,3 +56,3 @@ "use strict"; | ||
const { dev } = yield Promise.resolve().then(() => __importStar(require('sapper/api'))); | ||
const { watchSSGFiles, readSSGConfig } = yield Promise.resolve().then(() => __importStar(require('./cli-ssg'))); | ||
const { getSSGDataOnce, watchSSGFiles, readSSGConfig } = yield Promise.resolve().then(() => __importStar(require('./cli-ssg'))); | ||
try { | ||
@@ -85,2 +85,3 @@ const watcher = dev({ | ||
// actually do stuff with it | ||
yield getSSGDataOnce(ssgConfig); | ||
watchSSGFiles(watcher, ssgConfig); | ||
@@ -87,0 +88,0 @@ /** |
{ | ||
"name": "ssg", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26402
551