pict-docuserve 0.0.1 → 0.0.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/build-site.js CHANGED
@@ -119,9 +119,15 @@ if (libFS.existsSync(tmpOutputPath))
119
119
  }
120
120
  ensureDir(tmpOutputPath);
121
121
 
122
- // 1. Copy the entire dist/ folder contents as the base
122
+ // 1. Copy only the required dist/ artifacts (minified bundles, css, index.html)
123
123
  console.log(' Copying dist/ build artifacts...');
124
- copyDir(tmpDistPath, tmpOutputPath);
124
+ copyFile(libPath.join(tmpDistPath, 'index.html'), libPath.join(tmpOutputPath, 'index.html'));
125
+ copyDir(libPath.join(tmpDistPath, 'css'), libPath.join(tmpOutputPath, 'css'));
126
+ ensureDir(libPath.join(tmpOutputPath, 'js'));
127
+ copyFile(libPath.join(tmpDistPath, 'js', 'pict.min.js'), libPath.join(tmpOutputPath, 'js', 'pict.min.js'));
128
+ copyFile(libPath.join(tmpDistPath, 'js', 'pict.min.js.map'), libPath.join(tmpOutputPath, 'js', 'pict.min.js.map'));
129
+ copyFile(libPath.join(tmpDistPath, 'pict-docuserve.min.js'), libPath.join(tmpOutputPath, 'pict-docuserve.min.js'));
130
+ copyFile(libPath.join(tmpDistPath, 'pict-docuserve.min.js.map'), libPath.join(tmpOutputPath, 'pict-docuserve.min.js.map'));
125
131
 
126
132
  // 2. Copy markdown content files from docs/
127
133
  console.log(' Copying documentation markdown files...');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-docuserve",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Pict Documentation Server - A single-page documentation viewer built on Pict",
5
5
  "main": "source/Pict-Application-Docuserve.js",
6
6
  "bin": {
@@ -45,7 +45,11 @@
45
45
  "to": "./dist/css/"
46
46
  },
47
47
  {
48
- "from": "./node_modules/pict/dist/*",
48
+ "from": "./node_modules/pict/dist/pict.min.js",
49
+ "to": "./dist/js/"
50
+ },
51
+ {
52
+ "from": "./node_modules/pict/dist/pict.min.js.map",
49
53
  "to": "./dist/js/"
50
54
  }
51
55
  ]
@@ -57,14 +57,14 @@ class DocuserveCommandInject extends libCommandLineCommand
57
57
  this.options.CommandKeyword = 'inject';
58
58
  this.options.Description = 'Copy docuserve app assets into a docs folder for static hosting.';
59
59
 
60
- this.options.CommandArguments.push({ Name: '<docs-path>', Description: 'Target documentation folder to inject assets into.' });
60
+ this.options.CommandArguments.push({ Name: '[docs-path]', Description: 'Target documentation folder to inject assets into (defaults to ./docs/).' });
61
61
 
62
62
  this.addCommand();
63
63
  }
64
64
 
65
65
  onRun()
66
66
  {
67
- let tmpDocsPath = libPath.resolve(this.ArgumentString || '.');
67
+ let tmpDocsPath = libPath.resolve(this.ArgumentString || './docs/');
68
68
  let tmpDistPath = libPath.resolve(__dirname, '..', '..', '..', 'dist');
69
69
 
70
70
  if (!libFS.existsSync(tmpDocsPath))
@@ -72,6 +72,11 @@ class DocuserveCommandInject extends libCommandLineCommand
72
72
  this.log.error(`Target folder not found at ${tmpDocsPath}`);
73
73
  process.exit(1);
74
74
  }
75
+
76
+ // Create .nojekyll for GitHub Pages compatibility (always, even if dist is missing)
77
+ libFS.writeFileSync(libPath.join(tmpDocsPath, '.nojekyll'), '');
78
+ this.log.info(`Created .nojekyll in ${tmpDocsPath}`);
79
+
75
80
  if (!libFS.existsSync(tmpDistPath))
76
81
  {
77
82
  this.log.error(`dist/ folder not found at ${tmpDistPath}. Run npm run build first.`);
@@ -94,28 +99,26 @@ class DocuserveCommandInject extends libCommandLineCommand
94
99
  libPath.join(tmpDocsPath, 'css')
95
100
  );
96
101
 
97
- // Copy js/ folder (pict library)
98
- copyDir(
99
- libPath.join(tmpDistPath, 'js'),
100
- libPath.join(tmpDocsPath, 'js')
102
+ // Copy minified pict library and source map
103
+ ensureDir(libPath.join(tmpDocsPath, 'js'));
104
+ copyFile(
105
+ libPath.join(tmpDistPath, 'js', 'pict.min.js'),
106
+ libPath.join(tmpDocsPath, 'js', 'pict.min.js')
107
+ );
108
+ copyFile(
109
+ libPath.join(tmpDistPath, 'js', 'pict.min.js.map'),
110
+ libPath.join(tmpDocsPath, 'js', 'pict.min.js.map')
101
111
  );
102
112
 
103
- // Copy all pict-docuserve bundle files (*.js and *.js.map)
104
- let tmpDistEntries = libFS.readdirSync(tmpDistPath, { withFileTypes: true });
105
- for (let i = 0; i < tmpDistEntries.length; i++)
106
- {
107
- let tmpEntry = tmpDistEntries[i];
108
- if (tmpEntry.isFile() && tmpEntry.name.match(/^pict-docuserve\./))
109
- {
110
- copyFile(
111
- libPath.join(tmpDistPath, tmpEntry.name),
112
- libPath.join(tmpDocsPath, tmpEntry.name)
113
- );
114
- }
115
- }
116
-
117
- // Create .nojekyll for GitHub Pages compatibility
118
- libFS.writeFileSync(libPath.join(tmpDocsPath, '.nojekyll'), '');
113
+ // Copy minified pict-docuserve bundle and source map
114
+ copyFile(
115
+ libPath.join(tmpDistPath, 'pict-docuserve.min.js'),
116
+ libPath.join(tmpDocsPath, 'pict-docuserve.min.js')
117
+ );
118
+ copyFile(
119
+ libPath.join(tmpDistPath, 'pict-docuserve.min.js.map'),
120
+ libPath.join(tmpDocsPath, 'pict-docuserve.min.js.map')
121
+ );
119
122
 
120
123
  this.log.info('');
121
124
  this.log.info('Injection complete! The docs folder is now self-contained.');
@@ -60,7 +60,7 @@ class DocuserveCommandServe extends libCommandLineCommand
60
60
  this.options.CommandKeyword = 'serve';
61
61
  this.options.Description = 'Start a local HTTP server for a documentation folder.';
62
62
 
63
- this.options.CommandArguments.push({ Name: '<docs-path>', Description: 'Path to the documentation folder containing markdown files.' });
63
+ this.options.CommandArguments.push({ Name: '[docs-path]', Description: 'Path to the documentation folder containing markdown files (defaults to ./docs/).' });
64
64
 
65
65
  this.options.CommandOptions.push({ Name: '-p, --port [port]', Description: 'Port to serve on.', Default: '3333' });
66
66
 
@@ -69,7 +69,7 @@ class DocuserveCommandServe extends libCommandLineCommand
69
69
 
70
70
  onRun()
71
71
  {
72
- let tmpDocsPath = libPath.resolve(this.ArgumentString || '.');
72
+ let tmpDocsPath = libPath.resolve(this.ArgumentString || './docs/');
73
73
  let tmpDistPath = libPath.resolve(__dirname, '..', '..', '..', 'dist');
74
74
  let tmpPort = parseInt(this.CommandOptions.port, 10) || 3333;
75
75