@caweb/cli 1.3.16 → 1.4.0

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
@@ -195,5 +195,6 @@ Arguments:
195
195
 
196
196
  Options:
197
197
  -h, --help display help for command
198
- -t,--tax [tax...] Taxonomy that should be synced. Omitting this option will sync the full site. (choices: "pages", "posts", "media", "menus")
198
+ -i, --include [include...] IDs to of taxonomies to include. Omitting this option will sync all items for given taxonomy.
199
+ -t, --tax [tax...] Taxonomy that should be synced. Omitting this option will sync the full site. (choices: "pages", "posts", "media", "menus")
199
200
  </pre>
Binary file
package/commands/serve.js CHANGED
@@ -39,6 +39,8 @@ export default async function serve({
39
39
  // Otherwise we load a blank html page
40
40
  process.env.CDT_TEMPLATE = template;
41
41
 
42
+ // Let our webpack config know it's serving not building
43
+ process.env.CAWEB_SERVE = true;
42
44
 
43
45
  // Our default Webpack Configuration
44
46
  const defaultConfig = path.join( projectPath, 'configs', 'webpack.config.js' );
@@ -46,7 +48,7 @@ export default async function serve({
46
48
  let webPackArgs = [
47
49
  'serve',
48
50
  '--open',
49
- '--mode=development',
51
+ '--mode=none',
50
52
  '--config',
51
53
  defaultConfig
52
54
  ];
@@ -72,7 +74,14 @@ export default async function serve({
72
74
  await runCmd(
73
75
  'webpack',
74
76
  webPackArgs
75
- )
77
+ ).then(({stdout, stderr}) => {
78
+ // if an error was thrown, and no output
79
+ if( stderr && ! stdout.toString() ){
80
+ console.log( stderr.toString() )
81
+ }else{
82
+ spinner.text = 'Done'
83
+ }
84
+ });
76
85
 
77
86
 
78
87
  };
@@ -10,10 +10,7 @@
10
10
  * External dependencies
11
11
  */
12
12
  import baseConfig from '@wordpress/scripts/config/webpack.config.js';
13
- import path from 'path';
14
- import fs from 'fs';
15
13
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
16
- import CopyWebpackPlugin from 'copy-webpack-plugin';
17
14
 
18
15
  /**
19
16
  * Internal dependencies
@@ -85,11 +82,11 @@ baseConfig.module.rules.forEach((rule, i) => {
85
82
  // Our Webpack Configuration.
86
83
  let webpackConfig = {
87
84
  ...baseConfig,
88
- //target: 'browserslist',
85
+ target: 'web',
89
86
  devtool: false,
90
87
  output: {
91
88
  ...baseConfig.output,
92
- publicPath: `./`,
89
+ publicPath: `/`,
93
90
  clean: true
94
91
  },
95
92
  plugins: [
@@ -104,10 +101,10 @@ let webpackConfig = {
104
101
  module: {
105
102
  rules: [
106
103
  ...baseConfig.module.rules,
107
- {
104
+ /*{
108
105
  test: /\.html$/,
109
- loader: 'handlebars-loader'
110
- }
106
+ loader:'handlebars-loader'
107
+ }*/
111
108
  ]
112
109
  },
113
110
  performance: {
@@ -116,7 +113,9 @@ let webpackConfig = {
116
113
  }
117
114
  };
118
115
 
119
- if( ! isProduction ){
116
+ if( process.env.CAWEB_SERVE ){
117
+ delete webpackConfig.devServer;
118
+
120
119
  SiteGenerator( webpackConfig );
121
120
  }
122
121
 
@@ -0,0 +1,27 @@
1
+ # Sources
2
+ ### <ins>Design System Components</ins>
3
+ [Github](https://github.com/cagov/design-system/tree/main/components)
4
+ [NPM Packages](https://www.npmjs.com/search?q=%40cagov)
5
+
6
+ ### <ins>docker-compose</ins>
7
+ [Documentation](https://pdmlab.github.io/docker-compose/)
8
+ [Github](https://github.com/PDMLab/docker-compose)
9
+ [NPM Package](https://www.npmjs.com/package/docker-compose)
10
+
11
+ ### <ins>wp-env</ins>
12
+ [Documentation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/)
13
+ [Github](https://github.com/WordPress/gutenberg/tree/HEAD/packages/env)
14
+ [NPM Package](https://www.npmjs.com/package/@wordpress/env)
15
+
16
+ ### <ins>create-block</ins>
17
+ [Block API](https://developer.wordpress.org/block-editor/reference-guides/block-api/)
18
+ [Documentation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/)
19
+ [External Project Templates](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/packages-create-block-external-template/)
20
+ [NPM Package](https://www.npmjs.com/package/@wordpress/create-block)
21
+
22
+
23
+ ### <ins>wp cli</ins>
24
+ [Documentation](https://developer.wordpress.org/cli/commands/)
25
+
26
+ ### <ins>phpMyAdmin</ins>
27
+ [Docker](https://hub.docker.com/_/phpmyadmin)
package/docs/ISSUES.MD ADDED
@@ -0,0 +1,7 @@
1
+ # Known Issues
2
+ [[Bug](https://github.com/npm/cli/issues/3136)] Arguments are not correctly passed from CLI to npm script (npm 7, Windows, Powershell)
3
+ - Workaround - If using < Node 20, add an additional `--` when passing arguments
4
+ -- Example run
5
+ `npm run caweb start -- -- --multisite`
6
+ instead of
7
+ `npm run caweb start -- --multisite`
@@ -0,0 +1,53 @@
1
+ ## [.wp-env.override.json](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/#wp-env-override-json)
2
+ Any fields here will take precedence over .wp-env.json.
3
+ ## <ins>Special Config Values</ins>
4
+ ### <ins>CAWeb Options</ins>
5
+ `CAWEB_TEMPLATE_VER` - Updates CAWeb State Template Version
6
+ `CAWEB_NAV_MENU_STYLE` - Updates CAWeb Header Menu Type
7
+ `CAWEB_COLORSCHEME` - Updates CAWeb Color Scheme
8
+ `CAWEB_TITLE_DISPLAY` - Updates CAWeb Title Display Default
9
+ `CAWEB_STICKY_NAV` - Updates CAWeb Sticky Navigation
10
+ `CAWEB_MENU_HOME_LINK` - Updates CAWeb Menu Home Link
11
+ `CAWEB_DISPLAY_POSTS_DATE` - Updates CAWeb Display Date for Non-Divi Posts
12
+ `CAWEB_X_UA_COMPATIBILITY` - Updates CAWeb Legacy Browser Support
13
+ `CAWEB_FRONTPAGE_SEARCH` - Updates CAWeb Show Search on Front Page
14
+ `CAWEB_CONTACT_US_PAGE` - Updates CAWeb Contact Us Page
15
+ `CAWEB_GEO_LOCATOR` - Updates CAWeb Enable Geo Locator
16
+ `CAWEB_UTILITY_HOME_LINK` - Updates CAWeb Home Link
17
+ `CAWEB_UTILITY_LINK1_ENABLED` - Updates CAWeb Custom Link 1
18
+ `CAWEB_UTILITY_LINK1_LABEL` - Updates CAWeb Custom Link 1 Label
19
+ `CAWEB_UTILITY_LINK1_URL` - Updates CAWeb Custom Link 1 URL
20
+ `CAWEB_UTILITY_LINK1_NEW_WINDOW` - Updates CAWeb Custom Link 1 Open in New Tab
21
+ `CAWEB_UTILITY_LINK2_ENABLED` - Updates CAWeb Custom Link 2
22
+ `CAWEB_UTILITY_LINK2_LABEL` - Updates CAWeb Custom Link 2 Label
23
+ `CAWEB_UTILITY_LINK2_URL` - Updates CAWeb Custom Link 2 URL
24
+ `CAWEB_UTILITY_LINK2_NEW_WINDOW` - Updates CAWeb Custom Link 2 Open in New Tab
25
+ `CAWEB_UTILITY_LINK3_ENABLED` - Updates CAWeb Custom Link 3
26
+ `CAWEB_UTILITY_LINK3_LABEL` - Updates CAWeb Custom Link 3 Label
27
+ `CAWEB_UTILITY_LINK3_URL` - Updates CAWeb Custom Link 3 URL
28
+ `CAWEB_UTILITY_LINK3_NEW_WINDOW` - Updates CAWeb Custom Link 3 Open in New Tab
29
+ `CAWEB_CAWEB_ORG_LOGO_ALT_TEXT` - Updates CAWeb Organization Logo-Alt Text
30
+ `CAWEB_GOOGLE_SEARCH_ENGINE_ID` - Updates CAWeb Search Engine ID
31
+ `CAWEB_GOOGLE_ANALYTICS_ID` - Updates CAWeb Analytics ID
32
+ `CAWEB_GOOGLE_ANALYTICS4_ID` - Updates CAWeb Analytics 4 ID
33
+ `CAWEB_GOOGLE_TAG_MANAGER_ID` - Updates CAWeb Tag Manager ID
34
+ `CAWEB_GOOGLE_META_ID` - Updates CAWeb Site Verification Meta ID
35
+ `CAWEB_GOOGLE_TRANSLATE_MODE` - Updates CAWeb Enable Google Translate
36
+ `CAWEB_GOOGLE_TRANSLATE_PAGE` - Updates CAWeb Translate Page
37
+ `CAWEB_GOOGLE_TRANSLATE_PAGE_NEW_WINDOW` - Updates CAWeb Open in New Tab
38
+ `CAWEB_GOOGLE_TRANSLATE_ICON` - Updates CAWeb Icon
39
+ `CAWEB_PRIVATE_REPO` - Updates CAWeb Is Private?
40
+ `CAWEB_GIT_USER` - Updates CAWeb Username
41
+ `CAWEB_ACCESS_TOKEN` - Updates CAWeb Token
42
+ ### <ins>Divi Options</ins>
43
+ `ET_DYNAMIC_MODULE` - Updates CAWeb Dynamic Module Framework
44
+ `ET_DYNAMIC_CSS` - Updates CAWeb Dynamic CSS
45
+ `ET_CRITICAL_CSS` - Updates CAWeb Critical CSS
46
+ `ET_DYNAMIC_JS` - Updates CAWeb Dynamic JavaScript Libraries
47
+ `ET_CLASSIC_EDITOR` - Updates CAWeb Enable Classic Editor
48
+ `ET_STATIC_CSS_GENERATION` - Updates CAWeb Static CSS File Generation
49
+ `ET_PRODUCT_TOUR` - Updates CAWeb Product Tour
50
+ `ET_NEW_BUILDER_EXPERIENCE` - Updates CAWeb Enable The Latest Divi Builder Experience
51
+ `ET_OUTPUT_STYLES_INLINE` - Updates CAWeb Output Styles Inline
52
+ `ET_USERNAME` - Updates CAWeb Username
53
+ `ET_API_KEY` - Updates CAWeb API Key
@@ -0,0 +1,19 @@
1
+ # Roadmap Features:
2
+
3
+ ## Testaro
4
+ https://www.npmjs.com/package/testaro
5
+
6
+ ## Sonarqube Scanner
7
+ https://www.npmjs.com/package/sonarqube-scanner
8
+
9
+ ## BrowserStack
10
+ https://www.npmjs.com/package/browserstack
11
+
12
+ ## Accessibility Checker
13
+ https://www.npmjs.com/package/accessibility-checker
14
+
15
+ ## Control Panel
16
+ https://aapanel.com/new/download.html
17
+
18
+ ## SNYK
19
+ https://www.npmjs.com/package/snyk
package/docs/SYNC.MD ADDED
@@ -0,0 +1,29 @@
1
+ # caweb.json Configuration
2
+ Under the `sync` property you can list the various WordPress Instances. Each Instance, requires a WordPress Username, Application Password and the Site URL.
3
+
4
+ Sync Example Command:
5
+ Using the example, if you wanted to sync all the changes from the dev instance to your local instance.
6
+ `caweb sync dev local`
7
+
8
+ Sync Configuration Example:
9
+ <pre>
10
+ {
11
+ "sync": {
12
+ "local": {
13
+ "user": "&lt;Username&gt;",
14
+ "pwd": "<a href="https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#basic-authentication-with-application-passwords">Application Password</a>",
15
+ "url": "http://example1.com"
16
+ },
17
+ "dev": {
18
+ "user": "&lt;Username&gt;",
19
+ "pwd": "<a href="https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#basic-authentication-with-application-passwords">Application Password</a>",
20
+ "url": "http://example2.com"
21
+ },
22
+ "test": {
23
+ "user": "&lt;Username&gt;",
24
+ "pwd": "<a href="https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#basic-authentication-with-application-passwords">Application Password</a>",
25
+ "url": "http://example3.com"
26
+ }
27
+ }
28
+ }
29
+ </pre>
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+
4
+ /**
5
+ * External dependencies
6
+ */
7
+ import path from 'node:path';
8
+ import fs from 'fs-extra';
9
+
10
+ import { CAWEB_OPTIONS, DIVI_OPTIONS } from '../../lib/options.js';
11
+
12
+ generateOverridesMD()
13
+
14
+ /**
15
+ * Generates the OVERRIDES.MD
16
+ *
17
+ */
18
+ export default async function generateOverridesMD() {
19
+
20
+ let output = [
21
+ '## [.wp-env.override.json](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/#wp-env-override-json)',
22
+ 'Any fields here will take precedence over .wp-env.json.',
23
+ '## <ins>Special Config Values</ins>',
24
+ ];
25
+
26
+ // Generate CAWeb Options overrides.
27
+ output.push('### <ins>CAWeb Options</ins>');
28
+ for (const [key, option] of Object.entries(CAWEB_OPTIONS)) {
29
+ output.push(`\`${key}\` - Updates CAWeb ${option.label} `);
30
+ }
31
+
32
+ // Generate Divi Options overrides.
33
+ output.push('### <ins>Divi Options</ins>');
34
+ for (const [group, options] of Object.entries(DIVI_OPTIONS)) {
35
+ for (const [key, option] of Object.entries(options)) {
36
+ output.push(`\`${key}\` - Updates CAWeb ${option.label} `);
37
+ }
38
+ }
39
+
40
+ fs.writeFileSync(
41
+ path.join(process.cwd(), 'docs', 'OVERRIDES.MD'),
42
+ output.join('\n')
43
+ );
44
+
45
+ };
@@ -14,14 +14,18 @@ import {
14
14
  generatePages
15
15
  } from './parser.js';
16
16
 
17
- import {
17
+ /*import {
18
18
  projectPath,
19
19
  appPath
20
- } from '../lib/helpers.js';
21
-
20
+ } from '../lib/index.js';
21
+ */
22
+ const currentPath = path.dirname(fileURLToPath(import.meta.url));
23
+ const projectPath = path.resolve( currentPath, '..' );
24
+ const appPath = path.resolve( process.cwd() );
25
+ const samplePath = path.join( appPath, 'sample');
22
26
  const srcPath = path.join( appPath, 'src');
23
27
  const dataPath = path.join( srcPath, 'data');
24
- const assetsPath = path.join( srcPath, 'assets');
28
+ //const assetsPath = path.join( srcPath, 'assets');
25
29
 
26
30
  // default meta used for site generation when no meta is passed
27
31
  const meta = {
@@ -56,7 +60,7 @@ function getSiteData(){
56
60
 
57
61
  export default (webpackConfig) => {
58
62
  // we only proceed if and index.html exists
59
- if( ! fs.existsSync( path.join( srcPath, 'index.html' )) ){
63
+ if( ! fs.existsSync( path.join( samplePath, 'index.html' )) ){
60
64
  return;
61
65
  }
62
66
 
@@ -66,10 +70,21 @@ export default (webpackConfig) => {
66
70
  // get site data
67
71
  let siteData = getSiteData();
68
72
 
69
- // if favicon doesn't exist use fallback asset.
70
- let favicon = fs.existsSync(path.join(assetsPath, 'images', 'favicon.ico')) ?
71
- path.join(assetsPath, 'images', 'favicon.ico') :
72
- path.join(projectPath, 'assets', 'favicon.ico') ;
73
+ /**
74
+ * Favicon
75
+ *
76
+ * Locations:
77
+ * - ./favicon.ico - root of the project
78
+ * - ./src/favicon.ico - src directory
79
+ * - favicon.ico - default icon
80
+ */
81
+ let favicon = fs.existsSync(path.join(appPath, 'favicon.ico')) ?
82
+ path.join(appPath, 'favicon.ico') :
83
+ (
84
+ fs.existsSync(path.join(srcPath, 'favicon.ico')) ?
85
+ path.join(srcPath, 'favicon.ico') :
86
+ path.join(projectPath, 'assets', 'logo.ico')
87
+ );
73
88
 
74
89
  let defaultPage = {
75
90
  minify: false,
@@ -81,8 +96,8 @@ export default (webpackConfig) => {
81
96
  webpackConfig.plugins = [
82
97
  ...webpackConfig.plugins,
83
98
  new HtmlWebpackPlugin({
84
- filename: path.join( process.cwd(), 'public', 'index.html'),
85
- template: path.join(srcPath, 'index.html'),
99
+ filename: path.join( appPath, 'public', 'index.html'),
100
+ template: path.join(samplePath, 'index.html'),
86
101
  //templateContent: generatePages(siteData),
87
102
  title: 'Test Site',
88
103
  ...defaultPage
@@ -99,13 +114,31 @@ export default (webpackConfig) => {
99
114
  host: 'localhost',
100
115
  port: 9000,
101
116
  compress: true,
102
- proxy: {
103
- '/public': {
104
- pathRewrite: {
105
- '^/build': '',
106
- },
117
+ static: [
118
+ {
119
+ directory: path.join( appPath, 'build'),
107
120
  },
108
- },
121
+ {
122
+ directory: path.join(appPath, 'node_modules'),
123
+ },
124
+ {
125
+ directory: path.join(appPath, 'public'),
126
+ },
127
+ {
128
+ directory: path.join(appPath, 'src'),
129
+ }
130
+ ],
131
+ proxy: [
132
+ {
133
+ context: ['/node_modules'],
134
+ target: 'http://localhost:9000',
135
+ pathRewrite: { '^/node_modules': '' },
136
+ },
137
+ {
138
+ context: ['/src'],
139
+ target: 'http://localhost:9000',
140
+ pathRewrite: { '^/src': '' },
141
+ }
142
+ ],
109
143
  }
110
-
111
144
  };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@caweb/cli",
3
- "version": "1.3.16",
3
+ "version": "1.4.0",
4
4
  "description": "CAWebPublishing Command Line Interface.",
5
5
  "exports": "./lib/env.js",
6
6
  "type": "module",
7
7
  "node": ">=20",
8
+ "main": "./lib/env.js",
8
9
  "author": "CAWebPublishing",
9
10
  "license": "ISC",
10
11
  "bin": {
@@ -15,6 +16,7 @@
15
16
  "bin",
16
17
  "commands",
17
18
  "configs",
19
+ "docs",
18
20
  "gen",
19
21
  "lib",
20
22
  "template"
@@ -22,13 +24,13 @@
22
24
  "scripts": {
23
25
  "test": "echo \"Error: run tests from root\" && exit 0"
24
26
  },
25
- "homepage": "https://github.com/CAWebPublishing/caweb-cli#readme",
27
+ "homepage": "https://github.com/CAWebPublishing/cli#readme",
26
28
  "repository": {
27
29
  "type": "git",
28
- "url": "git+https://github.com/CAWebPublishing/caweb-cli.git"
30
+ "url": "git+https://github.com/CAWebPublishing/cli.git"
29
31
  },
30
32
  "bugs": {
31
- "url": "https://github.com/CAWebPublishing/caweb-cli/issues"
33
+ "url": "https://github.com/CAWebPublishing/cli/issues"
32
34
  },
33
35
  "keywords": [
34
36
  "caweb",
@@ -38,7 +40,7 @@
38
40
  "access": "public"
39
41
  },
40
42
  "config": {
41
- "WP_VER": "6.4.3",
43
+ "WP_VER": "6.5.4",
42
44
  "PHP_VER": "8.1",
43
45
  "DEFAULTS": {
44
46
  "FS_METHOD": "direct",
@@ -56,29 +58,30 @@
56
58
  }
57
59
  },
58
60
  "dependencies": {
59
- "@wordpress/create-block": "^4.32.0",
60
- "@wordpress/env": "^9.6.0",
61
- "@wordpress/scripts": "^27.5.0",
62
- "accessibility-checker": "^3.1.68",
61
+ "@wordpress/create-block": "^4.43.0",
62
+ "@wordpress/env": "^10.0.0",
63
+ "@wordpress/scripts": "^28.0.0",
64
+ "accessibility-checker": "^3.1.72",
63
65
  "autoprefixer": "^10.4.19",
64
- "axios": "^1.6.8",
65
- "axios-retry": "^4.1.0",
66
+ "axios": "^1.7.2",
67
+ "axios-retry": "^4.4.0",
66
68
  "chalk": "^5.3.0",
67
- "commander": "^12.0.0",
69
+ "commander": "^12.1.0",
68
70
  "cross-spawn": "^7.0.3",
69
- "css-loader": "^6.10.0",
70
- "docker-compose": "^0.24.7",
71
+ "css-loader": "^7.1.2",
72
+ "docker-compose": "^0.24.8",
71
73
  "fs-extra": "^11.2.0",
74
+ "got": "^14.4.1",
72
75
  "handlebars-loader": "^1.7.3",
73
76
  "html-to-json-parser": "^2.0.1",
74
77
  "html-webpack-plugin": "^5.6.0",
75
- "mini-css-extract-plugin": "^2.8.1",
78
+ "mini-css-extract-plugin": "^2.9.0",
76
79
  "ora": "^8.0.1",
77
80
  "postcss-loader": "^8.1.1",
78
81
  "resolve-bin": "^1.0.1",
79
- "sass-loader": "^14.1.1",
82
+ "sass-loader": "^14.2.1",
80
83
  "terminal-link": "^3.0.0",
81
84
  "url": "^0.11.3",
82
- "webpack": "^5.91.0"
85
+ "webpack": "^5.92.0"
83
86
  }
84
87
  }