@caweb/cli 1.4.5 → 1.5.1

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.
Files changed (59) hide show
  1. package/commands/index.js +13 -19
  2. package/commands/webpack/webpack.js +19 -102
  3. package/lib/cli.js +136 -125
  4. package/lib/helpers.js +3 -5
  5. package/lib/index.js +12 -18
  6. package/package.json +7 -31
  7. package/bin/css-audit/.editorconfig +0 -12
  8. package/bin/css-audit/.github/workflows/build-report.yml +0 -46
  9. package/bin/css-audit/.github/workflows/merge-trunk-to-report.yml +0 -17
  10. package/bin/css-audit/.github/workflows/node.yaml +0 -32
  11. package/bin/css-audit/.nvmrc +0 -1
  12. package/bin/css-audit/README.md +0 -131
  13. package/bin/css-audit/css-audit.config.js +0 -13
  14. package/bin/css-audit/index.js +0 -38
  15. package/bin/css-audit/package-lock.json +0 -6689
  16. package/bin/css-audit/package.json +0 -56
  17. package/bin/css-audit/public/.gitkeep +0 -1
  18. package/bin/css-audit/src/__tests__/alphas.js +0 -128
  19. package/bin/css-audit/src/__tests__/colors.js +0 -115
  20. package/bin/css-audit/src/__tests__/display-none.js +0 -52
  21. package/bin/css-audit/src/__tests__/important.js +0 -88
  22. package/bin/css-audit/src/__tests__/media-queries.js +0 -84
  23. package/bin/css-audit/src/__tests__/property-values.js +0 -55
  24. package/bin/css-audit/src/__tests__/run.js +0 -25
  25. package/bin/css-audit/src/__tests__/selectors.js +0 -66
  26. package/bin/css-audit/src/audits/alphas.js +0 -70
  27. package/bin/css-audit/src/audits/colors.js +0 -83
  28. package/bin/css-audit/src/audits/display-none.js +0 -39
  29. package/bin/css-audit/src/audits/important.js +0 -60
  30. package/bin/css-audit/src/audits/media-queries.js +0 -96
  31. package/bin/css-audit/src/audits/property-values.js +0 -65
  32. package/bin/css-audit/src/audits/selectors.js +0 -67
  33. package/bin/css-audit/src/audits/typography.js +0 -41
  34. package/bin/css-audit/src/formats/cli-table.js +0 -81
  35. package/bin/css-audit/src/formats/html/_audit-alpha.twig +0 -23
  36. package/bin/css-audit/src/formats/html/_audit-colors.twig +0 -23
  37. package/bin/css-audit/src/formats/html/_audit-default.twig +0 -24
  38. package/bin/css-audit/src/formats/html/index.twig +0 -88
  39. package/bin/css-audit/src/formats/html/style.css +0 -341
  40. package/bin/css-audit/src/formats/html.js +0 -52
  41. package/bin/css-audit/src/formats/json.js +0 -9
  42. package/bin/css-audit/src/run.js +0 -76
  43. package/bin/css-audit/src/utils/__tests__/cli.js +0 -70
  44. package/bin/css-audit/src/utils/__tests__/example-config.config.js +0 -12
  45. package/bin/css-audit/src/utils/__tests__/get-specificity.js +0 -39
  46. package/bin/css-audit/src/utils/cli.js +0 -133
  47. package/bin/css-audit/src/utils/format-report.js +0 -37
  48. package/bin/css-audit/src/utils/get-specificity.js +0 -97
  49. package/bin/css-audit/src/utils/get-values-count.js +0 -17
  50. package/configs/webpack.config.js +0 -192
  51. package/lib/webpack/plugins/css-audit/css-audit.config.cjs +0 -5
  52. package/lib/webpack/plugins/css-audit/default.config.js +0 -19
  53. package/lib/webpack/plugins/css-audit/index.js +0 -297
  54. package/lib/webpack/plugins/css-audit/package.json +0 -12
  55. package/lib/webpack/plugins/jshint/.jshintrc +0 -31
  56. package/lib/webpack/plugins/jshint/index.js +0 -286
  57. package/lib/webpack/plugins/jshint/package-lock.json +0 -22
  58. package/lib/webpack/plugins/jshint/package.json +0 -15
  59. package/lib/webpack/plugins/jshint/reporter.cjs +0 -663
package/commands/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- /**
5
- * These are default wp-env commands. No need to overwrite these commands
6
- */
4
+ // These are default wp-env commands. No need to overwrite these commands
7
5
  import clean from '@wordpress/env/lib/commands/clean.js';
8
6
  import logs from '@wordpress/env/lib/commands/logs.js';
9
7
  import run from '@wordpress/env/lib/commands/run.js';
@@ -14,16 +12,15 @@ import installPath from '@wordpress/env/lib/commands/install-path.js';
14
12
  */
15
13
  import webpack from './webpack/webpack.js';
16
14
 
15
+ import CSSAuditPlugin from '@caweb/css-audit-webpack-plugin';
16
+ const audit = new CSSAuditPlugin().audit;
17
17
 
18
- import A11yPlugin from '../lib/webpack/plugins/a11y/index.js';
19
- const a11y = new A11yPlugin().a11yCheck;
20
-
21
- import CSSAuditPlugin from '../lib/webpack/plugins/css-audit/index.js';
22
- const audit = new CSSAuditPlugin({}).audit;
23
-
24
- import JSHintPlugin from '../lib/webpack/plugins/jshint/index.js';
18
+ import JSHintPlugin from '@caweb/jshint-webpack-plugin';
25
19
  const hint = new JSHintPlugin().hint;
26
20
 
21
+ import A11yPlugin from '@caweb/a11y-webpack-plugin';
22
+ const a11y = new A11yPlugin().a11yCheck;
23
+
27
24
  import shell from './tasks/shell.js';
28
25
 
29
26
  import sync from './sync.js';
@@ -34,14 +31,16 @@ import updateBlock from './blocks/update-block.js'
34
31
 
35
32
  import test from './test.js';
36
33
 
37
- /**
38
- * These are default wp-env commands, we overwrite these commands so we can run additional steps.
39
- */
34
+ // These are default wp-env commands, we overwrite these commands so we can run additional steps.
40
35
  import start from './env/start.js';
41
36
  import destroy from './env/destroy.js';
42
37
  import stop from './env/stop.js';
43
38
 
44
39
  export {
40
+ a11y,
41
+ audit,
42
+ hint,
43
+ webpack,
45
44
  clean,
46
45
  logs,
47
46
  run,
@@ -49,14 +48,9 @@ export {
49
48
  start,
50
49
  stop,
51
50
  destroy,
52
- webpack,
53
- a11y,
54
- audit,
55
- hint,
56
51
  sync,
57
52
  updatePlugins,
58
53
  shell,
59
54
  createBlock,
60
- updateBlock,
61
- test
55
+ updateBlock
62
56
  }
@@ -1,24 +1,16 @@
1
- #!/usr/bin/env node
2
-
3
1
  /**
4
2
  * External dependencies
5
3
  */
6
4
  import path from 'path';
7
- import fs, { watch } from 'fs';
8
- import deepmerge from 'deepmerge';
9
- import Webpack from 'webpack';
10
- import webpackServer from 'webpack-dev-server';
5
+ import fs from 'fs';
11
6
 
12
7
  /**
13
8
  * Internal dependencies
14
9
  */
15
10
  import {
16
- runCmd,
17
- projectPath,
18
11
  appPath,
19
- wpPrimary,
20
- wpGreen,
21
- wpRed
12
+ projectPath,
13
+ runCmd
22
14
  } from '../../lib/index.js';
23
15
 
24
16
 
@@ -32,13 +24,11 @@ import {
32
24
  export default async function webpack({
33
25
  spinner,
34
26
  debug,
35
- audit,
36
- a11y,
37
- selectors
38
27
  } ) {
39
28
  const webpackCommand = 'build' === process.argv[2] ? 'build' : 'serve' ;
40
29
 
41
- const defaultConfigPath = path.join( projectPath, 'configs', 'webpack.config.js' );
30
+ // we use our default config from the @caweb/html-webpack-plugin
31
+ const defaultConfigPath = path.resolve(projectPath, '..', 'webpack', 'webpack.config.js' );
42
32
  let webpackConfig = await import('file://' + defaultConfigPath);
43
33
  let customConfig = {};
44
34
 
@@ -46,16 +36,15 @@ export default async function webpack({
46
36
  // the environment variables as well.
47
37
  process.env.WP_COPY_PHP_FILES_TO_DIST = true;
48
38
 
49
- // pass any arguments from the cli
50
39
  // add our default config as an extension.
51
40
  // users can overwrite any values by creating a webconfig of their own.
52
41
  let webPackArgs = [
53
42
  '--config',
54
- defaultConfigPath,
55
- ];
56
-
43
+ defaultConfigPath
44
+ ].filter(e => e);
45
+
57
46
  // CommonJS
58
- if( fs.existsSync( path.join(appPath, 'webpack.config.cjs' ))){
47
+ if( fs.existsSync( path.join(appPath, 'webpack.config.cjs' ) ) ){
59
48
  webPackArgs.push(
60
49
  '--config',
61
50
  path.join(appPath, 'webpack.config.cjs' ),
@@ -78,89 +67,17 @@ export default async function webpack({
78
67
  if( customConfig.length ){
79
68
  webpackConfig = deepmerge(webpackConfig.default, customConfig.default);
80
69
  }
81
-
82
- // we always run the build command.
83
- let result = await runCmd(
84
- 'webpack',
85
- ['build', ...webPackArgs],
86
- {stdio:'pipe'}
87
- ).then(({stdout, stderr}) => {
88
- // we hide the punycode deprecation warning.
89
- // this is caused by the wp-scripts package
90
- // if an error was thrown
91
- if( stderr ){
92
- //console.log( stderr.toString().replace(/.*`punycode`.*\n.*/, '') )
93
- }
94
70
 
95
- if(stdout){
96
- return stdout.toString().replace(/.*`punycode`.*\n.*/, '');
97
- }
98
-
99
- });
100
-
101
- // if serving.
102
- if( 'serve' === webpackCommand ){
103
- let hostUrl = 'localhost' === webpackConfig.default.devServer.host ? `http://${webpackConfig.default.devServer.host}`: webpackConfig.default.devServer.host;
104
- let hostPort = webpackConfig.default.devServer.port;
105
-
106
- if( hostPort && 80 !== hostPort )
71
+ // run the webpackCommand command.
72
+ await runCmd(
73
+ 'webpack',
74
+ [
75
+ webpackCommand,
76
+ ...webPackArgs
77
+ ],
107
78
  {
108
- hostUrl = `${hostUrl}:${hostPort}`;
109
- }
110
-
111
- console.log( `Webpack Server is preparing to launch ${ wpGreen(hostUrl) }` );
112
- console.log( `Press ${ wpRed('Ctrl + C') } to shutdown the server.\n` );
113
-
114
- // add a11y plugin
115
- if( a11y ){
116
- /*webpackConfig.default.plugins.push(new A11yPlugin({
117
- outputFilename: 'a11y'
118
- }) )
119
-
120
- webpackConfig.default.devServer.static.push({
121
- directory: path.join(appPath, 'a11y')
122
- })*/
79
+ stdio: 'inherit',
80
+ argv0: process.argv.join(' ')
123
81
  }
124
-
125
- // add css-auditor plugin
126
- if( audit ){
127
- }
128
-
129
- const compiler = Webpack(webpackConfig.default);
130
- const server = new webpackServer({...webpackConfig.default.devServer}, compiler);
131
-
132
- await server.start();
133
-
134
- //process.stdin.resume();
135
-
136
- // run webpack serve command
137
- /*await runCmd(
138
- 'webpack',
139
- ['serve', ...webPackArgs],
140
- {
141
- stdio: 'inherit'
142
- }
143
- ).then(({stdout, stderr}) => {
144
- // if an error was thrown, and no output
145
- if( stderr && ! stdout){
146
- console.log( stderr.toString() )
147
- }
148
-
149
- if( stdout ){
150
- spinner.text = "Webpack Server was closed.";
151
- }
152
-
153
- });*/
154
-
155
- /*
156
- const compiler = Webpack(webpackConfig.default);
157
- const server = new webpackServer({...webpackConfig.default.devServer}, compiler);
158
- */
159
-
160
- // only build was ran.
161
- }else{
162
- //spinner.prefixText = result;
163
- //spinner.text = "Done!";
164
- }
165
-
82
+ );
166
83
  };
package/lib/cli.js CHANGED
@@ -2,7 +2,6 @@
2
2
  * External dependencies
3
3
  */
4
4
  //const wpenv_cli = require('@wordpress/env/lib/cli');
5
-
6
5
  import path from 'path';
7
6
  import fs from 'fs';
8
7
  import { Command, Argument, Option } from 'commander';
@@ -11,9 +10,10 @@ import { Command, Argument, Option } from 'commander';
11
10
  * Internal dependencies
12
11
  */
13
12
  import * as env from '../commands/index.js';
13
+
14
14
  import {
15
- withSpinner,
16
15
  projectPath,
16
+ withSpinner
17
17
  } from './index.js';
18
18
 
19
19
  const localFile = path.join(projectPath, 'package.json');
@@ -39,6 +39,89 @@ const envArg = new Argument('[environment]', 'Which environment to use.')
39
39
  ])
40
40
  .default('development');
41
41
 
42
+
43
+ /**
44
+ * Adds commands for webpack
45
+ */
46
+ function addWebpackCmds(){
47
+
48
+ // Build Command.
49
+ program.command('build')
50
+ .description('Builds the current project.')
51
+ .allowUnknownOption(true)
52
+ .action(env.webpack)
53
+
54
+
55
+ // Serve Command.
56
+ program.command('serve')
57
+ .description('Serve the current project')
58
+ .option( '--audit', 'Performs WordPress CSS-Audit.', true )
59
+ .option( '--no-audit', 'Skips WordPress CSS-Audit.', false )
60
+ .option( '--a11y', 'Performs IBM Accessibility Checker.', true )
61
+ .option( '--no-a11y', 'Skips IBM Accessibility Checker.', false )
62
+ .allowUnknownOption(true)
63
+ .action(env.webpack)
64
+
65
+ // a11y Command.
66
+ program.command('a11y')
67
+ .description('Runs accessibility checks.')
68
+ .addArgument(new Argument('<url>', 'URL to scan for accessibility checks.'))
69
+ .option( '--rule-archive <rule>', 'Specify the rule archive.', 'latest')
70
+ .option( '--policies <policy...>', 'Specify one or many policies to scan.', ['WCAG_2_1'])
71
+ .option( '--fail-levels <levels...>', 'Specify one or many violation levels on which to fail the test.', [
72
+ 'violation',
73
+ 'potentialviolation'
74
+ ])
75
+ .option( '--report-levels <levels...>', 'Specify one or many violation levels that should be reported.', [
76
+ 'violation',
77
+ 'potentialviolation',
78
+ 'recommendation',
79
+ 'potentialrecommendation',
80
+ 'manual',
81
+ 'pass'
82
+ ])
83
+ .option( '--labels <label...>', 'Specify labels that you would like associated to your scan.', [])
84
+ .option( '--output-format <format>', 'In which formats should the results be output.', ['html'])
85
+ .option( '--output-filename <name>', 'Filename for the scan results.', 'a11y')
86
+ .option( '--output-folder <folder>', 'Where the scan results should be saved.', 'a11y')
87
+ .option( '--output-filename-timestamp', 'Should the timestamp be included in the filename of the reports?', false)
88
+ .allowUnknownOption(true)
89
+ .action(env.a11y)
90
+
91
+
92
+ // audit Command.
93
+ program.command('audit')
94
+ .description('Runs WordPress CSS Audit tool against projects.')
95
+ .addArgument(new Argument('[files...]', 'Files or directory path to CSS files.').default(['./build']))
96
+ .option('--format [format]', 'Format to use for displaying report.', 'html' )
97
+ .option('--filename [name]', 'If using a format that outputs to a file, specify the file name.', 'css-audit' )
98
+ .option('--colors', 'Runs colors audit.', true )
99
+ .addOption(new Option('--no-colors', 'Skips colors audit.', false ).hideHelp())
100
+ .option('--important', 'Runs !important audit.', true )
101
+ .addOption(new Option('--no-important', 'Skips !important audit.', false ).hideHelp())
102
+ .option('--display-none', 'Runs display: none audit.', true )
103
+ .addOption(new Option('--no-display-none', 'Skips display: none audit.', false ).hideHelp())
104
+ .option('--selectors', 'Runs selectors audit.', true )
105
+ .addOption(new Option('--no-selectors', 'Skips selectors audit.', false ).hideHelp())
106
+ .option('--media-queries', 'Runs media queries audit.', true )
107
+ .addOption(new Option('--no-media-queries', 'Skips media queries audit.', false ).hideHelp())
108
+ .option('--typography', 'Runs typography audit.', true )
109
+ .addOption(new Option('--no-typography', 'Skips typography audit.', false ).hideHelp())
110
+ .option('--property-values <values...>', 'Runs property value audit.', ['font-size', 'padding,padding-top,padding-bottom,padding-right,padding-left', 'margin,margin-top,marin-bottom,marin-right,marin-left'] )
111
+ .addOption(new Option('--no-property-values', 'Skips property values audit.', false ).hideHelp())
112
+ .allowUnknownOption(true)
113
+ .action(env.audit)
114
+
115
+ // JSHint Command.
116
+ program.command('jshint')
117
+ .description('Runs JSHint tool against projects.')
118
+ .addArgument(new Argument('[files...]', 'Files or directory path to JS files.').default(['./src']))
119
+ .option( '--output-filename <name>', 'Filename for the scan results.', 'jshint')
120
+ .option( '--output-folder <folder>', 'Where the hint results should be saved.', 'jshint')
121
+ .allowUnknownOption(true)
122
+ .action(env.hint)
123
+ }
124
+
42
125
 
43
126
  /**
44
127
  * Adds commands for wp-env
@@ -48,6 +131,7 @@ function addWPEnvCommands(){
48
131
 
49
132
  // Start command.
50
133
  program.command('start')
134
+ .alias('launch')
51
135
  .description(
52
136
  `Starts two CAWebPublishing WordPress instances\ndevelopment on port http://localhost:8888 (override with WP_ENV_PORT)\ntests on port http://localhost:8889 (override with WP_ENV_TESTS_PORT).`
53
137
  )
@@ -95,6 +179,7 @@ function addWPEnvCommands(){
95
179
 
96
180
  // Destroy Command.
97
181
  program.command('destroy')
182
+ .alias('shutdown')
98
183
  .description(
99
184
  'Deletes docker containers, volumes, and networks associated with the CAWebPublishing instances and removes local files.'
100
185
  )
@@ -176,7 +261,6 @@ function addWPEnvCommands(){
176
261
 
177
262
  export default function cli() {
178
263
 
179
-
180
264
  program
181
265
  .name('caweb')
182
266
  .usage( '<command>' )
@@ -190,132 +274,59 @@ export default function cli() {
190
274
  })
191
275
  .helpCommand(false)
192
276
 
193
-
194
- // Build Command.
195
- program.command('build')
196
- .description('Builds the current project.')
197
- .allowUnknownOption(true)
198
- .action(env.webpack)
199
-
200
-
201
- // Serve Command.
202
- program.command('serve')
203
- .description('Serve the current project')
204
- .option( '--audit', 'Performs WordPress CSS-Audit.', true )
205
- .option( '--no-audit', 'Skips WordPress CSS-Audit.', false )
206
- .option( '--a11y', 'Performs IBM Accessibility Checker.', true )
207
- .option( '--no-a11y', 'Skips IBM Accessibility Checker.', false )
208
- .allowUnknownOption(true)
209
- //.action(withSpinner(env.webpack))
210
- .action(env.webpack)
211
-
212
- // a11y Command.
213
- program.command('a11y')
214
- .description('Runs accessibility checks.')
215
- .addArgument(new Argument('<url>', 'URL to scan for accessibility checks.'))
216
- .option( '--rule-archive <rule>', 'Specify the rule archive.', 'latest')
217
- .option( '--policies <policy...>', 'Specify one or many policies to scan.', ['WCAG_2_1'])
218
- .option( '--fail-levels <levels...>', 'Specify one or many violation levels on which to fail the test.', [
219
- 'violation',
220
- 'potentialviolation'
221
- ])
222
- .option( '--report-levels <levels...>', 'Specify one or many violation levels that should be reported.', [
223
- 'violation',
224
- 'potentialviolation',
225
- 'recommendation',
226
- 'potentialrecommendation',
227
- 'manual',
228
- 'pass'
229
- ])
230
- .option( '--labels <label...>', 'Specify labels that you would like associated to your scan.', [])
231
- .option( '--output-format <format>', 'In which formats should the results be output.', ['html'])
232
- .option( '--output-filename <name>', 'Filename for the scan results.')
233
- .option( '--output-folder <folder>', 'Where the scan results should be saved.', 'a11y')
234
- .option( '--output-filename-timestamp', 'Should the timestamp be included in the filename of the reports?', false)
235
- .allowUnknownOption(true)
236
- .action(env.a11y)
237
-
238
-
239
- // audit Command.
240
- program.command('audit')
241
- .description('Runs WordPress CSS Audit tool against projects.')
242
- .addArgument(new Argument('[files...]', 'Files or directory path to CSS files.').default(['./build']))
243
- .option('--format [format]', 'Format to use for displaying report.', 'html' )
244
- .option('--filename [name]', 'If using a format that outputs to a file, specify the file name.', 'css-audit' )
245
- .option('--colors', 'Runs colors audit.', true )
246
- .addOption(new Option('--no-colors', 'Skips colors audit.', false ).hideHelp())
247
- .option('--important', 'Runs !important audit.', true )
248
- .addOption(new Option('--no-important', 'Skips !important audit.', false ).hideHelp())
249
- .option('--display-none', 'Runs display: none audit.', true )
250
- .addOption(new Option('--no-display-none', 'Skips display: none audit.', false ).hideHelp())
251
- .option('--selectors', 'Runs selectors audit.', true )
252
- .addOption(new Option('--no-selectors', 'Skips selectors audit.', false ).hideHelp())
253
- .option('--media-queries', 'Runs media queries audit.', true )
254
- .addOption(new Option('--no-media-queries', 'Skips media queries audit.', false ).hideHelp())
255
- .option('--typography', 'Runs typography audit.', true )
256
- .addOption(new Option('--no-typography', 'Skips typography audit.', false ).hideHelp())
257
- .option('--property-values <values...>', 'Runs property value audit.', ['font-size', 'padding,padding-top,padding-bottom,padding-right,padding-left', 'margin,margin-top,marin-bottom,marin-right,marin-left'] )
258
- .addOption(new Option('--no-property-values', 'Skips property values audit.', false ).hideHelp())
259
- .allowUnknownOption(true)
260
- .action(env.audit)
277
+ // Add Webpack specific commands.
278
+ addWebpackCmds()
261
279
 
262
- // JSHint Command.
263
- program.command('jshint')
264
- .description('Runs JSHint tool against projects.')
265
- .addArgument(new Argument('[files...]', 'Files or directory path to JS files.').default(['./src']))
266
- .option( '--output-filename <name>', 'Filename for the scan results.')
267
- .option( '--output-folder <folder>', 'Where the hint results should be saved.')
268
- .allowUnknownOption(true)
269
- .action(env.hint)
280
+ // Add wp-env specific commands.
281
+ addWPEnvCommands();
270
282
 
271
- // Update Plugins Command.
272
- program.command('update-plugins')
273
- .description('Updates all plugins in the WordPress environment.')
274
- .argument('[slug]', 'Plugin slug to update.', 'all')
275
- .addOption(new Option('--environment <env>', 'Which environment to use.').choices(['development', 'tests']).default('development'))
276
- .allowUnknownOption(true)
277
- .action( withSpinner(env.updatePlugins) )
283
+ // Update Plugins Command.
284
+ program.command('update-plugins')
285
+ .description('Updates all plugins in the WordPress environment.')
286
+ .argument('[slug]', 'Plugin slug to update.', 'all')
287
+ .addOption(new Option('--environment <env>', 'Which environment to use.').choices(['development', 'tests']).default('development'))
288
+ .allowUnknownOption(true)
289
+ .action( withSpinner(env.updatePlugins) )
278
290
 
279
- // Create a Design System Block Command.
280
- program.command('create-block')
281
- .description('Scaffold for WordPress plugin to register CA.gov Design System Block.')
282
- .argument('<slug>', 'Plugin slug to use.')
283
- .allowUnknownOption(true)
284
- .action( withSpinner(env.createBlock) )
291
+ // Create a Design System Block Command.
292
+ program.command('create-block')
293
+ .description('Scaffold for WordPress plugin to register CA.gov Design System Block.')
294
+ .argument('<slug>', 'Plugin slug to use.')
295
+ .allowUnknownOption(true)
296
+ .action( withSpinner(env.createBlock) )
285
297
 
286
- // Update a Design System Block Command.
287
- program.command('update-block')
288
- .description('Updates a CA.gov Design System Block.')
289
- .argument('<slug>', 'Plugin slug to update.')
290
- .allowUnknownOption(true)
291
- .action( withSpinner(env.updateBlock) )
298
+ // Update a Design System Block Command.
299
+ program.command('update-block')
300
+ .description('Updates a CA.gov Design System Block.')
301
+ .argument('<slug>', 'Plugin slug to update.')
302
+ .allowUnknownOption(true)
303
+ .action( withSpinner(env.updateBlock) )
292
304
 
293
-
294
- // Update a Design System Block Command.
295
- program.command('sync')
296
- .description('Sync changes from one WordPress instance to another.')
297
- .argument('<from>', 'Target Site URL.')
298
- .argument('<to>', 'Destination Site URL.')
299
- .addOption(new Option(
300
- '-t,--tax [tax...]',
301
- 'Taxonomy that should be synced. Omitting this option will sync the full site.'
302
- ).choices(['pages', 'posts', 'media', 'menus', 'settings']))
303
- .addOption(new Option(
304
- '-i,--include [include...]',
305
- 'IDs to of taxonomies to include. Omitting this option will sync all items for given taxonomy.'
306
- ))
307
- .allowUnknownOption(true)
308
- .action( withSpinner(env.sync) )
309
-
310
- // Test Command.
311
- // Ensure this is commented out.
312
- /*program.command('test')
313
- .description('Test commands on a WordPress environment')
314
- //.addArgument(envArg)
315
- .allowUnknownOption(true)
316
- .action(withSpinner(env.test))
317
- */
318
- addWPEnvCommands();
305
+
306
+ // Update a Design System Block Command.
307
+ program.command('sync')
308
+ .description('Sync changes from one WordPress instance to another.')
309
+ .argument('<from>', 'Target Site URL.')
310
+ .argument('<to>', 'Destination Site URL.')
311
+ .addOption(new Option(
312
+ '-t,--tax [tax...]',
313
+ 'Taxonomy that should be synced. Omitting this option will sync the full site.'
314
+ ).choices(['pages', 'posts', 'media', 'menus', 'settings']))
315
+ .addOption(new Option(
316
+ '-i,--include [include...]',
317
+ 'IDs to of taxonomies to include. Omitting this option will sync all items for given taxonomy.'
318
+ ))
319
+ .allowUnknownOption(true)
320
+ .action( withSpinner(env.sync) )
321
+
322
+ // Test Command.
323
+ // Ensure this is commented out.
324
+ /*program.command('test')
325
+ .description('Test commands on a WordPress environment')
326
+ //.addArgument(envArg)
327
+ .allowUnknownOption(true)
328
+ .action(withSpinner(env.test))
329
+ */
319
330
 
320
331
  return program;
321
- };
332
+ };
package/lib/helpers.js CHANGED
@@ -30,7 +30,7 @@ const appPath = path.resolve( projectPath, '../../../' );
30
30
  *
31
31
  * @returns {Promise}
32
32
  */
33
- async function runCmd(cmd, args,opts = { stdio: ['inherit', 'pipe'] }){
33
+ async function runCmd(cmd, args,opts = { stdio: 'pipe' }){
34
34
  // fix various commands.
35
35
  switch (cmd) {
36
36
  case 'npm':
@@ -103,12 +103,10 @@ async function runCLICmds(
103
103
  );
104
104
  }
105
105
 
106
-
107
-
108
106
  export {
109
107
  currentPath,
110
108
  projectPath,
111
109
  appPath,
112
- runCLICmds,
113
- runCmd
110
+ runCmd,
111
+ runCLICmds
114
112
  };
package/lib/index.js CHANGED
@@ -1,19 +1,17 @@
1
1
  import {
2
- wpPrimary,
3
- wpGreen,
4
- wpRed,
5
- wpYellow,
6
- withSpinner,
7
- } from './spinner.js';
8
-
9
- import {
10
- runCmd,
11
- runCLICmds,
12
- currentPath,
2
+ appPath,
3
+ currentPath,
13
4
  projectPath,
14
- appPath
5
+ runCmd,
6
+ runCLICmds
15
7
  } from './helpers.js';
16
8
 
9
+ // Spinner
10
+ import {
11
+ withSpinner,
12
+ } from './spinner.js';
13
+
14
+ // WordPress
17
15
  import {
18
16
  activateCAWeb,
19
17
  configureCAWeb,
@@ -31,15 +29,11 @@ import {
31
29
  } from './wordpress/index.js';
32
30
 
33
31
  export {
32
+ appPath,
34
33
  currentPath,
35
34
  projectPath,
36
- appPath,
37
- wpPrimary,
38
- wpGreen,
39
- wpRed,
40
- wpYellow,
35
+ runCmd,
41
36
  withSpinner,
42
- runCmd,
43
37
  runCLICmds,
44
38
  activateCAWeb,
45
39
  configureCAWeb,