ultimate-jekyll-manager 0.0.184 → 0.0.185
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/dist/commands/clean.js +7 -3
- package/dist/commands/setup.js +60 -0
- package/dist/defaults/dist/_layouts/themes/classy/frontend/pages/extension/installed.html +1 -1
- package/dist/gulp/tasks/jekyll.js +4 -2
- package/dist/gulp/tasks/sass.js +16 -3
- package/dist/gulp/tasks/serve.js +1 -1
- package/dist/gulp/tasks/webpack.js +7 -2
- package/package.json +1 -1
- /package/dist/defaults/hooks/{build:post.js → build/post.js} +0 -0
- /package/dist/defaults/hooks/{build:pre.js → build/pre.js} +0 -0
- /package/dist/defaults/hooks/{middleware:request.js → middleware/request.js} +0 -0
package/dist/commands/clean.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
const Manager = new (require('../build.js'));
|
|
3
3
|
const logger = Manager.logger('clean');
|
|
4
|
-
const
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
5
|
const jetpack = require('fs-jetpack');
|
|
6
6
|
|
|
7
7
|
// Load package
|
|
@@ -32,8 +32,12 @@ module.exports = async function (options) {
|
|
|
32
32
|
try {
|
|
33
33
|
// Loop through dirs
|
|
34
34
|
dirsToClean.forEach((dir) => {
|
|
35
|
-
// Remove
|
|
36
|
-
|
|
35
|
+
// Remove (use rm -rf on Unix for speed, fallback to jetpack on Windows)
|
|
36
|
+
if (process.platform !== 'win32') {
|
|
37
|
+
execSync(`rm -rf ${dir}`, { stdio: 'ignore' });
|
|
38
|
+
} else {
|
|
39
|
+
jetpack.remove(dir);
|
|
40
|
+
}
|
|
37
41
|
|
|
38
42
|
// Create empty dir
|
|
39
43
|
jetpack.dir(dir);
|
package/dist/commands/setup.js
CHANGED
|
@@ -43,6 +43,7 @@ module.exports = async function (options) {
|
|
|
43
43
|
options.publishGitHubToken = options.publishGitHubToken !== 'false';
|
|
44
44
|
options.updateGitHubPages = options.updateGitHubPages !== 'false';
|
|
45
45
|
options.deduplicatePosts = options.deduplicatePosts !== 'false';
|
|
46
|
+
options.migrate = options.migrate !== 'false';
|
|
46
47
|
|
|
47
48
|
// Log
|
|
48
49
|
logger.log(`Welcome to ${package.name} v${package.version}!`);
|
|
@@ -56,6 +57,11 @@ module.exports = async function (options) {
|
|
|
56
57
|
// Log current working directory
|
|
57
58
|
await logCWD();
|
|
58
59
|
|
|
60
|
+
// Run migrations
|
|
61
|
+
if (options.migrate) {
|
|
62
|
+
await migrate();
|
|
63
|
+
}
|
|
64
|
+
|
|
59
65
|
// Detect GitHub repository early so it's available to all tasks/functions
|
|
60
66
|
await detectGitHubRepository(logger);
|
|
61
67
|
|
|
@@ -780,3 +786,57 @@ async function deduplicatePosts() {
|
|
|
780
786
|
logger.log('✅ No duplicate posts found');
|
|
781
787
|
}
|
|
782
788
|
}
|
|
789
|
+
|
|
790
|
+
// Run migrations based on installed version
|
|
791
|
+
async function migrate() {
|
|
792
|
+
const installedVersion = project.devDependencies[package.name] || '0.0.0';
|
|
793
|
+
|
|
794
|
+
// Skip if using local version
|
|
795
|
+
if (installedVersion.startsWith('file:')) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// Migrate hooks to nested structure (for versions <= 0.0.184)
|
|
800
|
+
if (version.is(installedVersion, '<=', '0.0.184')) {
|
|
801
|
+
await migrateHooksToNestedStructure();
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// Migrate old hook files to new nested structure
|
|
806
|
+
async function migrateHooksToNestedStructure() {
|
|
807
|
+
const hooksDir = path.join(rootPathProject, 'hooks');
|
|
808
|
+
|
|
809
|
+
// Map of old file names to new paths
|
|
810
|
+
const migrations = [
|
|
811
|
+
{ old: 'build:post.js', new: 'build/post.js' },
|
|
812
|
+
{ old: 'build:pre.js', new: 'build/pre.js' },
|
|
813
|
+
{ old: 'middleware:request.js', new: 'middleware/request.js' },
|
|
814
|
+
];
|
|
815
|
+
|
|
816
|
+
let migratedCount = 0;
|
|
817
|
+
|
|
818
|
+
for (const migration of migrations) {
|
|
819
|
+
const oldPath = path.join(hooksDir, migration.old);
|
|
820
|
+
const newPath = path.join(hooksDir, migration.new);
|
|
821
|
+
|
|
822
|
+
// Check if old file exists
|
|
823
|
+
if (!jetpack.exists(oldPath)) {
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// Check if new file already exists
|
|
828
|
+
if (jetpack.exists(newPath)) {
|
|
829
|
+
logger.warn(`⚠️ Cannot migrate ${migration.old}: ${migration.new} already exists`);
|
|
830
|
+
continue;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// Move the file
|
|
834
|
+
jetpack.move(oldPath, newPath);
|
|
835
|
+
logger.log(`✅ Migrated hook: ${migration.old} → ${migration.new}`);
|
|
836
|
+
migratedCount++;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
if (migratedCount > 0) {
|
|
840
|
+
logger.log(`✅ Migrated ${migratedCount} hook file(s) to new nested structure`);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
@@ -77,7 +77,7 @@ async function jekyll(complete) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// Run buildpre hook
|
|
80
|
-
await hook('build
|
|
80
|
+
await hook('build/pre', index);
|
|
81
81
|
|
|
82
82
|
// Build Jekyll
|
|
83
83
|
const command = [
|
|
@@ -97,6 +97,8 @@ async function jekyll(complete) {
|
|
|
97
97
|
Manager.isBuildMode() ? '' : '.temp/_config_browsersync.yml',
|
|
98
98
|
// Add development config IF BUILD_MODE is not true
|
|
99
99
|
Manager.isBuildMode() ? '' : `./node_modules/${package.name}/dist/config/_config_development.yml`,
|
|
100
|
+
// Add project-level dev config IF it exists and BUILD_MODE is not true
|
|
101
|
+
(!Manager.isBuildMode() && jetpack.exists('dist/_config.dev.yml')) ? 'dist/_config.dev.yml' : '',
|
|
100
102
|
].join(','),
|
|
101
103
|
'--incremental',
|
|
102
104
|
(Manager.isBuildMode() || argv.profile) ? ' --profile' : '',
|
|
@@ -120,7 +122,7 @@ async function jekyll(complete) {
|
|
|
120
122
|
await fixBlogIndex();
|
|
121
123
|
|
|
122
124
|
// Run buildpost hook
|
|
123
|
-
await hook('build
|
|
125
|
+
await hook('build/post', index);
|
|
124
126
|
|
|
125
127
|
// Create build JSON with runtime config
|
|
126
128
|
await createBuildJSON();
|
package/dist/gulp/tasks/sass.js
CHANGED
|
@@ -100,9 +100,15 @@ function sass(complete) {
|
|
|
100
100
|
// So we can use "@use 'ultimate-jekyll-manager' as *;"
|
|
101
101
|
path.resolve(rootPathPackage, 'dist/assets/css'),
|
|
102
102
|
|
|
103
|
-
//
|
|
103
|
+
// Project theme FIRST (higher priority) - allows consuming projects to define custom themes
|
|
104
|
+
path.resolve(rootPathProject, 'src/assets/themes', config.theme.id),
|
|
105
|
+
|
|
106
|
+
// UJM theme as fallback - for built-in themes like "classy", "bootstrap"
|
|
104
107
|
path.resolve(rootPathPackage, 'dist/assets/themes', config.theme.id),
|
|
105
108
|
|
|
109
|
+
// UJM themes root - allows themes to reference sibling themes (e.g., ../bootstrap)
|
|
110
|
+
path.resolve(rootPathPackage, 'dist/assets/themes'),
|
|
111
|
+
|
|
106
112
|
// So we can load _pages.scss from the project's dist
|
|
107
113
|
path.resolve(rootPathProject, 'dist/assets/css'),
|
|
108
114
|
|
|
@@ -132,10 +138,14 @@ function sass(complete) {
|
|
|
132
138
|
// Exclude test pages that include components we don't normally use (would prevent PurgeCSS from working)
|
|
133
139
|
`!${rootPathPackage}/dist/defaults/**/pages/test/**/*.{html,liquid,md}`,
|
|
134
140
|
|
|
135
|
-
// Include ONLY the active theme's files
|
|
141
|
+
// Include ONLY the active theme's files from UJM
|
|
136
142
|
`${rootPathPackage}/dist/defaults/**/_includes/themes/${config.theme.id}/**/*.{html,liquid,md}`,
|
|
137
143
|
`${rootPathPackage}/dist/defaults/**/_layouts/themes/${config.theme.id}/**/*.{html,liquid,md}`,
|
|
138
144
|
|
|
145
|
+
// Project theme layouts/includes (for project-defined themes)
|
|
146
|
+
`src/_layouts/themes/${config.theme.id}/**/*.{html,liquid,md}`,
|
|
147
|
+
`src/_includes/themes/${config.theme.id}/**/*.{html,liquid,md}`,
|
|
148
|
+
|
|
139
149
|
// Project HTML
|
|
140
150
|
'src/**/*.{html,liquid,md}',
|
|
141
151
|
'dist/**/*.{html,liquid,md}',
|
|
@@ -144,7 +154,10 @@ function sass(complete) {
|
|
|
144
154
|
`${rootPathPackage}/dist/assets/js/**/*.js`,
|
|
145
155
|
`${rootPathPackage}/node_modules/web-manager/**/*.js`,
|
|
146
156
|
|
|
147
|
-
//
|
|
157
|
+
// Project theme JS (for project-defined themes)
|
|
158
|
+
`src/assets/themes/${config.theme.id}/**/*.js`,
|
|
159
|
+
|
|
160
|
+
// UJM theme JS
|
|
148
161
|
`${rootPathPackage}/dist/assets/themes/${config.theme.id}/**/*.js`,
|
|
149
162
|
|
|
150
163
|
// Project JS
|
package/dist/gulp/tasks/serve.js
CHANGED
|
@@ -277,7 +277,7 @@ async function processRequestMiddleware(req, res, next) {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// Run middleware:request hook to allow custom URL rewriting
|
|
280
|
-
await hook('middleware
|
|
280
|
+
await hook('middleware/request', { req, res, pathname });
|
|
281
281
|
|
|
282
282
|
// Process the post request
|
|
283
283
|
if (pathname.match(/\/_process/)) {
|
|
@@ -140,8 +140,13 @@ function getSettings() {
|
|
|
140
140
|
'__main_assets__': path.resolve(rootPathPackage, 'dist/assets'),
|
|
141
141
|
'__project_assets__': path.resolve(process.cwd(), 'src/assets'),
|
|
142
142
|
|
|
143
|
-
// For importing the theme
|
|
144
|
-
'__theme__':
|
|
143
|
+
// For importing the theme - project theme takes priority over UJM theme
|
|
144
|
+
'__theme__': (() => {
|
|
145
|
+
const projectThemePath = path.resolve(rootPathProject, 'src/assets/themes', config.theme.id);
|
|
146
|
+
const ujmThemePath = path.resolve(rootPathPackage, 'dist/assets/themes', config.theme.id);
|
|
147
|
+
// Use project theme if it exists, otherwise fall back to UJM theme
|
|
148
|
+
return jetpack.exists(projectThemePath) ? projectThemePath : ujmThemePath;
|
|
149
|
+
})(),
|
|
145
150
|
},
|
|
146
151
|
// Add module resolution paths for local web-manager
|
|
147
152
|
modules: [
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|