ultimate-jekyll-manager 0.0.12 → 0.0.14

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/README.md CHANGED
@@ -1,5 +1,48 @@
1
- # ultimate-jekyll-manager
2
- All-in-one package for ultimate-jekyll
1
+ <p align="center">
2
+ <a href="https://itwcreativeworks.com">
3
+ <img src="https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/logo/itw-creative-works-brandmark-black-x.svg" width="100px">
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <img src="https://img.shields.io/github/package-json/v/itw-creative-works/ultimate-jekyll-manager.svg">
9
+ <br>
10
+ <img src="https://img.shields.io/librariesio/release/npm/ultimate-jekyll-manager.svg">
11
+ <img src="https://img.shields.io/bundlephobia/min/ultimate-jekyll-manager.svg">
12
+ <img src="https://img.shields.io/codeclimate/maintainability-percentage/itw-creative-works/ultimate-jekyll-manager.svg">
13
+ <img src="https://img.shields.io/npm/dm/ultimate-jekyll-manager.svg">
14
+ <img src="https://img.shields.io/node/v/ultimate-jekyll-manager.svg">
15
+ <img src="https://img.shields.io/website/https/itwcreativeworks.com.svg">
16
+ <img src="https://img.shields.io/github/license/itw-creative-works/ultimate-jekyll-manager.svg">
17
+ <img src="https://img.shields.io/github/contributors/itw-creative-works/ultimate-jekyll-manager.svg">
18
+ <img src="https://img.shields.io/github/last-commit/itw-creative-works/ultimate-jekyll-manager.svg">
19
+ <br>
20
+ <br>
21
+ <a href="https://itwcreativeworks.com">Site</a> | <a href="https://www.npmjs.com/package/ultimate-jekyll-manager">NPM Module</a> | <a href="https://github.com/itw-creative-works/ultimate-jekyll-manager">GitHub Repo</a>
22
+ <br>
23
+ <br>
24
+ <strong>Ultimate Jekyll</strong> is a template that helps you jumpstart your Jekyll sites and is fueled by an intuitive incorporation of npm, gulp, and is fully SEO optimized and blazingly fast.
25
+ </p>
26
+
27
+ ## 🦄 Features
28
+ * **SEO Optimized**: Ultimate Jekyll is fully SEO optimized.
29
+ * **Blazingly Fast**: Ultimate Jekyll is blazingly fast.
30
+ * **NPM & Gulp**: Ultimate Jekyll is fueled by an intuitive incorporation of npm and gulp.
31
+
32
+ ## 🚀 Getting started
33
+ 1. [Create a repo](https://github.com/itw-creative-works/ultimate-jekyll/generate) from the **Ultimate Jekyll** template.
34
+ 2. Clone the repo to your local machine.
35
+ 3. Run these command to get everything setup and sync'd!
36
+ ```bash
37
+ npm install
38
+ npx uj setup
39
+ npm start
40
+ ```
41
+
42
+ ## 📦 How to sync with the template
43
+ 1. Simply run `npx uj setup` in Terminal to get all the latest updates from the **Ultimate Jekyll template**.
44
+
45
+ ## 🌎 Publishing your website
46
+ 1. Change the `url` in `_config.yml` to your domain.
47
+ 2. Push your changes to GitHub using `npm run dist` in Terminal.
3
48
 
4
- # Commands
5
- * `npx uj setup && npm start` - Setup and start the project
package/TODO.md CHANGED
@@ -14,3 +14,58 @@ MIGRATIONS
14
14
  'npm-build': new Date().toISOString(),
15
15
  brand: config.brand,
16
16
  'admin-dashboard': JSON5.parse(config['admin-dashboard']),
17
+
18
+
19
+
20
+ MAYBE
21
+ # - name: Log all files in node_modules/ultimate-jekyll-manager
22
+ # run: |
23
+ # echo "All files in node_modules/ultimate-jekyll-manager: "
24
+ # ls -R node_modules/ultimate-jekyll-manager
25
+ # - name: Fetch ensure-production-build.js
26
+ # run: |
27
+ # [ -d node_modules/ultimate-jekyll-manager ] || mkdir -p node_modules/ultimate-jekyll-manager
28
+ # curl -L https://raw.githubusercontent.com/itw-creative-works/ultimate-jekyll-manager/refs/heads/master/src/ensure-production-build.js > node_modules/ultimate-jekyll-manager/ensure-production-build.js
29
+ # - name: Log all files in repo
30
+ # run: |
31
+ # echo "All files in the repo: "
32
+ # ls -R *
33
+ # - name: Run node build
34
+ # # run: npm run build -- --buildLocation='server'
35
+ # run: |
36
+ # UJ_BUILD_MODE=true UJ_IS_SERVER=true node node_modules/ultimate-jekyll-manager/ensure-production-build.js && npx uj setup && npm run build
37
+ # - name: Create build.json
38
+ # run: |
39
+ # export TZ=UTC date
40
+ # timestamp=$(date +%FT%TZ)
41
+ # temp_build_json=$(cat @output/build/build.json)
42
+
43
+ # echo account: $GITHUB_ACTOR
44
+ # echo repo: $GITHUB_REPOSITORY
45
+ # echo timestamp: $timestamp
46
+ # echo build.json: $temp_build_json
47
+
48
+ # build_log_path="@output/build/build.json"
49
+ # sed "s/%GHP_TIMESTAMP%/$timestamp/g" $build_log_path > "$build_log_path"-temp && mv "$build_log_path"-temp $build_log_path
50
+
51
+ # sed -n '1h;1!H;${;g;s/GEN>>>.*<<<GEN/<REDACTED FOR LIVE PUBLISH>/g;p;}' .gitignore > .gitignore
52
+ # - name: Delete gh-pages branch
53
+ # uses: dawidd6/action-delete-branch@v3
54
+ # with:
55
+ # github_token: ${{ secrets.GH_TOKEN }}
56
+ # branches: gh-pages
57
+ # soft_fail: true
58
+
59
+ # - name: Purge artifacts
60
+ # uses: c-hive/gha-remove-artifacts@v1
61
+ # with:
62
+ # ages: '5 minutes' # '<number> <unit>', e.g. 5 days, 2 years, 90 seconds, parsed by Moment.js
63
+ # # Optional inputs
64
+ # # skip-tags: true
65
+ # # skip-recent: 5
66
+ # - name: Purge artifacts
67
+ # uses: geekyeggo/delete-artifact@v5
68
+ # with:
69
+ # name: github-pages
70
+
71
+ "deploy": "UJ_BUILD_MODE=true UJ_IS_SERVER=true npx uj setup && npm run build"
@@ -0,0 +1,46 @@
1
+ // Libraries
2
+ const Manager = new (require('../build.js'));
3
+ const logger = Manager.logger('cloudflare-purge');
4
+ const path = require('path');
5
+ const jetpack = require('fs-jetpack');
6
+ const { execute } = require('node-powertools');
7
+ const fetch = require('wonderful-fetch');
8
+
9
+ // Load package
10
+ const package = jetpack.read(path.join(__dirname, '../../', 'package.json'), 'json');
11
+ const project = jetpack.read(path.join(process.cwd(), 'package.json'), 'json');
12
+
13
+ // Get config
14
+ const config = Manager.getConfig();
15
+
16
+ module.exports = async function (options) {
17
+ // Log
18
+ logger.log(`Running Cloudflare purge...`);
19
+
20
+ // Get delay
21
+ const delay = options.delay
22
+ || (Manager.isServer() ? 60000 : 0);
23
+
24
+ // Make request to Cloudflare
25
+ try {
26
+ await fetch('https://api.itwcreativeworks.com/wrapper', {
27
+ method: 'post',
28
+ response: 'json',
29
+ log: true,
30
+ body: {
31
+ service: 'cloudflare',
32
+ command: `client/v4/zones/${config.cloudflare.zone}/purge_cache`,
33
+ method: 'post',
34
+ body: {
35
+ purge_everything: true
36
+ },
37
+ delay: delay,
38
+ },
39
+ })
40
+ .then((r) => {
41
+ logger.log('Cloudflare purge complete.', r);
42
+ })
43
+ } catch (e) {
44
+ logger.error(`Error during install:`, e);
45
+ }
46
+ };
@@ -250,9 +250,7 @@ function buildSiteFiles() {
250
250
  });
251
251
 
252
252
  // Log
253
- // FLAG
254
- console.log('🚩🚩🚩🚩🚩', 1, ); // FLAG
255
- logger.log('Files:', files)
253
+ // logger.log('Files:', files);
256
254
 
257
255
  // Loop
258
256
  for (const file of files) {
@@ -280,9 +278,9 @@ function buildSiteFiles() {
280
278
  const exists = jetpack.exists(destination);
281
279
 
282
280
  // Log
283
- logger.log('File:', file);
284
- logger.log('filename:', filename);
285
- logger.log('options:', options);
281
+ // logger.log('File:', file);
282
+ // logger.log('filename:', filename);
283
+ // logger.log('options:', options);
286
284
  // logger.log('contents:', jetpack.read(source));
287
285
  // logger.log('source:', source);
288
286
  // logger.log('Destination:', destination);
@@ -81,46 +81,9 @@ jobs:
81
81
  run: |
82
82
  echo "All files in the repo: "
83
83
  ls -R *
84
- # - name: Log all files in node_modules/ultimate-jekyll-manager
85
- # run: |
86
- # echo "All files in node_modules/ultimate-jekyll-manager: "
87
- # ls -R node_modules/ultimate-jekyll-manager
88
- # - name: Fetch ensure-production-build.js
89
- # run: |
90
- # [ -d node_modules/ultimate-jekyll-manager ] || mkdir -p node_modules/ultimate-jekyll-manager
91
- # curl -L https://raw.githubusercontent.com/itw-creative-works/ultimate-jekyll-manager/refs/heads/master/src/ensure-production-build.js > node_modules/ultimate-jekyll-manager/ensure-production-build.js
92
- # - name: Log all files in repo
93
- # run: |
94
- # echo "All files in the repo: "
95
- # ls -R *
96
- # - name: Run node build
97
- # # run: npm run build -- --buildLocation='server'
98
- # run: |
99
- # UJ_BUILD_MODE=true UJ_IS_SERVER=true node node_modules/ultimate-jekyll-manager/ensure-production-build.js && npx uj setup && npm run build
100
84
  - name: Run node build
101
85
  run: |
102
86
  UJ_BUILD_MODE=true UJ_IS_SERVER=true npx uj setup && npm run build
103
- # - name: Create build.json
104
- # run: |
105
- # export TZ=UTC date
106
- # timestamp=$(date +%FT%TZ)
107
- # temp_build_json=$(cat @output/build/build.json)
108
-
109
- # echo account: $GITHUB_ACTOR
110
- # echo repo: $GITHUB_REPOSITORY
111
- # echo timestamp: $timestamp
112
- # echo build.json: $temp_build_json
113
-
114
- # build_log_path="@output/build/build.json"
115
- # sed "s/%GHP_TIMESTAMP%/$timestamp/g" $build_log_path > "$build_log_path"-temp && mv "$build_log_path"-temp $build_log_path
116
-
117
- # sed -n '1h;1!H;${;g;s/GEN>>>.*<<<GEN/<REDACTED FOR LIVE PUBLISH>/g;p;}' .gitignore > .gitignore
118
- # - name: Delete gh-pages branch
119
- # uses: dawidd6/action-delete-branch@v3
120
- # with:
121
- # github_token: ${{ secrets.GH_TOKEN }}
122
- # branches: gh-pages
123
- # soft_fail: true
124
87
  - name: Delete gh-pages branch
125
88
  continue-on-error: true
126
89
  run: |
@@ -133,21 +96,11 @@ jobs:
133
96
  with:
134
97
  github_token: ${{ secrets.GH_TOKEN }}
135
98
  publish_dir: ./_site
99
+ # enable_jekyll: true
136
100
  - name: Purge CloudFlare cache
137
- run: npm run cloudflare:purge
101
+ run: npx uj cloudflare-purge
138
102
  - name: Purge artifacts
139
103
  uses: kolpav/purge-artifacts-action@v1
140
104
  with:
141
105
  token: ${{ secrets.GH_TOKEN }}
142
106
  expire-in: 30 minutes # Set this to 0 to delete instantly
143
- # - name: Purge artifacts
144
- # uses: c-hive/gha-remove-artifacts@v1
145
- # with:
146
- # ages: '5 minutes' # '<number> <unit>', e.g. 5 days, 2 years, 90 seconds, parsed by Moment.js
147
- # # Optional inputs
148
- # # skip-tags: true
149
- # # skip-recent: 5
150
- # - name: Purge artifacts
151
- # uses: geekyeggo/delete-artifact@v5
152
- # with:
153
- # name: github-pages
@@ -66,8 +66,8 @@ node_modules/
66
66
  .env
67
67
 
68
68
  # Jekyll
69
- _site/
69
+ /_site
70
70
 
71
71
  # Custom
72
- dist/
73
- .temp/
72
+ /dist
73
+ /.temp
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head>
3
+ <title>Home</title>
4
+ </head>
5
+ <body>
6
+ <h1>Home</h1>
7
+ <p>Welcome to the home page.</p>
8
+ </body>
9
+ </html>
@@ -2,6 +2,7 @@
2
2
  const Manager = new (require('../../build.js'));
3
3
  const logger = Manager.logger('distribute');
4
4
  const { src, dest, watch, series } = require('gulp');
5
+ const through2 = require('through2');
5
6
  const jetpack = require('fs-jetpack');
6
7
  const path = require('path');
7
8
  const JSON5 = require('json5');
@@ -32,26 +33,24 @@ async function distribute(complete) {
32
33
  // Log
33
34
  logger.log('Starting...');
34
35
 
35
- // Copy all files from src/defaults/dist on first run
36
+ // First-run tasks
36
37
  if (index === 0) {
37
- // Get the directory
38
- const dir = path.join(__dirname, '..', '..', 'defaults', 'dist');
38
+ // Copy all files from src/defaults/dist on first run
39
+ await copyDefaultDistFiles();
39
40
 
40
- // Log
41
- logger.log(`Copying default dist files from ${dir}`);
41
+ // Create CNAME
42
+ await createCNAME();
42
43
 
43
- // Copy the files
44
- jetpack.copy(dir, 'dist', { overwrite: true });
44
+ // Fetch firebase-auth files
45
+ await fetchFirebaseAuth();
45
46
  }
46
47
 
47
48
  // Create build JSON
48
49
  await createBuildJSON();
49
50
 
50
- // Fetch firebase-auth files
51
- await fetchFirebaseAuth();
52
-
53
51
  // Complete
54
- return src(input)
52
+ return src(input, { base: 'src' })
53
+ .pipe(customPathTransform())
55
54
  .pipe(dest(output))
56
55
  .on('end', () => {
57
56
  // Log
@@ -62,6 +61,24 @@ async function distribute(complete) {
62
61
  });
63
62
  }
64
63
 
64
+ function customPathTransform() {
65
+ return through2.obj(function(file, _, cb) {
66
+ if (file.isDirectory()) {
67
+ return cb(null, file);
68
+ }
69
+
70
+ const relativePath = path.relative(file.base, file.path);
71
+
72
+ if (relativePath.startsWith('pages/')) {
73
+ const newRelativePath = relativePath.replace(/^pages\//, '');
74
+ file.path = path.join(file.base, newRelativePath);
75
+ }
76
+
77
+ this.push(file);
78
+ cb();
79
+ });
80
+ }
81
+
65
82
  // Watcher task
66
83
  function distributeWatcher(complete) {
67
84
  // Quit if in build mode
@@ -87,6 +104,7 @@ function distributeWatcher(complete) {
87
104
  module.exports = series(distribute, distributeWatcher);
88
105
 
89
106
 
107
+ // Get git info
90
108
  async function getGitInfo() {
91
109
  return await execute('git remote -v')
92
110
  .then((r) => {
@@ -103,6 +121,7 @@ async function getGitInfo() {
103
121
  })
104
122
  }
105
123
 
124
+ // Create build.json
106
125
  async function createBuildJSON() {
107
126
  // Create build log JSON
108
127
  try {
@@ -141,6 +160,32 @@ async function createBuildJSON() {
141
160
  }
142
161
  }
143
162
 
163
+ // Copy default dist files
164
+ async function copyDefaultDistFiles() {
165
+ // Get the directory
166
+ const dir = path.join(__dirname, '..', '..', 'defaults', 'dist');
167
+
168
+ // Log
169
+ logger.log(`Copying default dist files from ${dir}`);
170
+
171
+ // Copy the files
172
+ jetpack.copy(dir, 'dist', { overwrite: true });
173
+ }
174
+
175
+ // Create CNAME
176
+ async function createCNAME() {
177
+ // Get the CNAME
178
+ const url = Manager.getConfig().url;
179
+ const host = new URL(url).host
180
+
181
+ // Write to file
182
+ jetpack.write('dist/CNAME', host);
183
+
184
+ // Log
185
+ logger.log('Created CNAME');
186
+ }
187
+
188
+ // Fetch firebase-auth files
144
189
  async function fetchFirebaseAuth() {
145
190
  const firebase = eval(`(${config.settings['manager-configuration']})`)?.libraries?.firebase_app?.config;
146
191
  const projectId = firebase.projectId || 'ultimate-jekyll';
@@ -206,3 +251,4 @@ async function fetchFirebaseAuth() {
206
251
  // Log
207
252
  logger.log('Fetched firebase-auth files');
208
253
  }
254
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "projectScripts": {
25
25
  "preinstall": "bundle install && bundle update",
26
+ "start": "npx uj setup && bundle exec npm run gulp",
26
27
  "gulp": "gulp --cwd ./ --gulpfile ./node_modules/ultimate-jekyll-manager/dist/gulp/main.js",
27
- "start": "bundle exec npm run gulp",
28
28
  "build": "UJ_BUILD_MODE=true bundle exec npm run gulp -- build"
29
29
  },
30
30
  "engines": {
@@ -75,6 +75,7 @@
75
75
  "node-powertools": "^2.1.4",
76
76
  "npm-api": "^1.0.1",
77
77
  "sass": "^1.84.0",
78
+ "through2": "^4.0.2",
78
79
  "web-manager": "^3.2.73",
79
80
  "webpack": "^5.97.1",
80
81
  "wonderful-fetch": "^1.3.2",
File without changes