@atomicsmash/cli 10.0.0-beta.0 → 10.0.0-beta.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.
@@ -1 +1 @@
1
- {"version":3,"file":"setup-database.d.ts","sourceRoot":"","sources":["../../src/commands/setup-database.ts"],"names":[],"mappings":"AAQA,OAAO,eAAe,CAAC;AAiEvB,eAAO,MAAM,OAAO,mBAAmB,CAAC;AACxC,eAAO,MAAM,QAAQ,mEAC4C,CAAC;AAClE,wBAAsB,OAAO,kBAkG5B"}
1
+ {"version":3,"file":"setup-database.d.ts","sourceRoot":"","sources":["../../src/commands/setup-database.ts"],"names":[],"mappings":"AAQA,OAAO,eAAe,CAAC;AA+EvB,eAAO,MAAM,OAAO,mBAAmB,CAAC;AACxC,eAAO,MAAM,QAAQ,mEAC4C,CAAC;AAClE,wBAAsB,OAAO,kBAgH5B"}
@@ -9,7 +9,7 @@ function extractDependenciesFromError(errorMessage) {
9
9
  const regex = /requires \d+ plugin[s]? to be installed and activated: (.+)\./;
10
10
  const match = regex.exec(errorMessage);
11
11
  if (match?.[1]) {
12
- return match[1].split(',').map(dep => dep.trim());
12
+ return match[1].split(",").map((dep) => dep.trim());
13
13
  }
14
14
  return [];
15
15
  }
@@ -33,10 +33,11 @@ async function activatePluginsWithRetry(execute, pluginsToActivate, excludedPlug
33
33
  // Check if this is a dependency error
34
34
  const dependencies = extractDependenciesFromError(errorMessage);
35
35
  if (dependencies.length > 0) {
36
- console.log(`⚠ ${pluginName} requires dependencies: ${dependencies.join(', ')}`);
36
+ console.log(`⚠ ${pluginName} requires dependencies: ${dependencies.join(", ")}`);
37
37
  // Add dependencies to the remaining plugins list if they're not already there
38
38
  for (const dep of dependencies) {
39
- if (!pluginsToActivate.includes(dep) && !excludedPlugins.includes(dep)) {
39
+ if (!pluginsToActivate.includes(dep) &&
40
+ !excludedPlugins.includes(dep)) {
40
41
  pluginsToActivate.push(dep);
41
42
  }
42
43
  if (!remainingPlugins.includes(dep)) {
@@ -54,7 +55,7 @@ async function activatePluginsWithRetry(execute, pluginsToActivate, excludedPlug
54
55
  retryCount++;
55
56
  }
56
57
  if (remainingPlugins.length > 0) {
57
- console.warn(`⚠ Warning: Could not activate all plugins after ${maxRetries} attempts. Remaining: ${remainingPlugins.join(', ')}`);
58
+ console.warn(`⚠ Warning: Could not activate all plugins after ${maxRetries} attempts. Remaining: ${remainingPlugins.join(", ")}`);
58
59
  }
59
60
  }
60
61
  export const command = "setup-database";
@@ -89,14 +90,19 @@ export async function handler() {
89
90
  performance.mark("add-custom-user");
90
91
  console.log(`Custom user ${process.env.WORDPRESS_USER} added. (${convertMeasureToPrettyString(performance.measure("add-custom-user", "wordpress-tables"))})`);
91
92
  }
92
- const excludedPlugins = ['stream', 'shortpixel-image-optimiser', 'wordfence'];
93
- const { stdout: pluginList } = await execute('wp plugin list --format=json');
93
+ const excludedPlugins = [
94
+ "stream",
95
+ "shortpixel-image-optimiser",
96
+ "wordfence",
97
+ "wp-mail-smtp",
98
+ ];
99
+ const { stdout: pluginList } = await execute("wp plugin list --format=json");
94
100
  const allPlugins = JSON.parse(pluginList);
95
101
  // Filter out excluded plugins and already active plugins
96
102
  const pluginsToActivate = allPlugins
97
- .filter(plugin => !excludedPlugins.includes(plugin.name) &&
98
- plugin.status !== 'active')
99
- .map(plugin => plugin.name);
103
+ .filter((plugin) => !excludedPlugins.includes(plugin.name) &&
104
+ plugin.status !== "active")
105
+ .map((plugin) => plugin.name);
100
106
  await activatePluginsWithRetry(execute, pluginsToActivate, excludedPlugins);
101
107
  })
102
108
  .then(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,QAAQ,kDAAkD,CAAC;AACxE,wBAAsB,OAAO,kBA+P5B"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,QAAQ,kDAAkD,CAAC;AACxE,wBAAsB,OAAO,kBAsQ5B"}
@@ -17,6 +17,7 @@ export async function handler() {
17
17
  .catch(() => {
18
18
  return false;
19
19
  });
20
+ const isCI = process.env.CI ?? false;
20
21
  const smashConfig = await getSmashConfig();
21
22
  if (!smashConfig) {
22
23
  throw new Error("Unable to determine project setup information. Please add a smash.config.ts file with the required info.");
@@ -26,7 +27,7 @@ export async function handler() {
26
27
  const stopRunningMessage = startRunningMessage("Running setup");
27
28
  performance.mark("Start");
28
29
  await Promise.allSettled([
29
- ...(shouldInstallAndBuildOnly
30
+ ...(isCI || shouldInstallAndBuildOnly
30
31
  ? []
31
32
  : [
32
33
  (async () => {
@@ -110,7 +111,7 @@ export async function handler() {
110
111
  }
111
112
  })(),
112
113
  ]),
113
- execute("composer install")
114
+ execute(`composer install${isCI ? " --prefer-dist" : ""}`)
114
115
  .then(() => {
115
116
  console.log(`Root composer install done. (${convertMeasureToPrettyString(performance.measure("root composer install", "Start"))})`);
116
117
  })
@@ -119,7 +120,7 @@ export async function handler() {
119
120
  throw new Error("Failed to run composer install in the root directory.");
120
121
  }),
121
122
  ...(composerInstallPaths?.map((path, index) => {
122
- return execute(`cd "${resolve(process.cwd(), path)}"; composer install`)
123
+ return execute(`cd "${resolve(process.cwd(), path)}"; composer install${isCI ? " --no-dev --classmap-authoritative" : ""}`)
123
124
  .then(() => {
124
125
  console.log(`Additional composer install ${index + 1} done. (${convertMeasureToPrettyString(performance.measure(`additional composer install ${index + 1}`, "Start"))})`);
125
126
  })
@@ -129,7 +130,7 @@ export async function handler() {
129
130
  });
130
131
  }) ?? []),
131
132
  (async () => {
132
- await execute("npm install")
133
+ await execute(`npm ${isCI ? "ci" : "install"}`)
133
134
  .then(() => {
134
135
  performance.mark("root npm install done");
135
136
  console.log(`Root npm install done. (${convertMeasureToPrettyString(performance.measure("root npm install", "Start"))})`);
@@ -150,7 +151,7 @@ export async function handler() {
150
151
  throw new Error(reason);
151
152
  }),
152
153
  ...(npmInstallPaths?.map((path, index) => {
153
- return execute(`cd "${resolve(process.cwd(), path)}"; npm install`)
154
+ return execute(`cd "${resolve(process.cwd(), path)}"; npm ${isCI ? "ci --omit=dev" : "install"}`)
154
155
  .then(() => {
155
156
  console.log(`Additional npm install ${index + 1} done. (${convertMeasureToPrettyString(performance.measure(`additional npm install ${index + 1}`, "Start"))})`);
156
157
  })
@@ -159,7 +160,8 @@ export async function handler() {
159
160
  throw new Error(`Failed to run additional npm install ${index + 1}.`);
160
161
  });
161
162
  }) ?? []),
162
- ]).then(async (results) => {
163
+ ])
164
+ .then(async (results) => {
163
165
  await stopRunningMessage();
164
166
  if (results.some((result) => result.status === "rejected")) {
165
167
  process.exitCode = 1;
@@ -174,7 +176,8 @@ export async function handler() {
174
176
  else {
175
177
  console.log(`Setup is complete. ${convertMeasureToPrettyString(performance.measure("everything", "Start"))}`);
176
178
  }
177
- }).catch((error) => {
179
+ })
180
+ .catch((error) => {
178
181
  console.error(error);
179
182
  process.exitCode = 1;
180
183
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomicsmash/cli",
3
- "version": "10.0.0-beta.0",
3
+ "version": "10.0.0-beta.1",
4
4
  "description": "A collection of CLI tools by Atomic Smash.",
5
5
  "keywords": [],
6
6
  "homepage": "https://www.atomicsmash.co.uk/",