@atomicsmash/cli 9.0.1-beta.2 → 9.0.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":"pull-database.d.ts","sourceRoot":"","sources":["../../src/commands/pull-database.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO,kBAAkB,CAAC;AACvC,eAAO,MAAM,QAAQ,oEAC6C,CAAC;AACnE,wBAAsB,OAAO,kBA+J5B"}
1
+ {"version":3,"file":"pull-database.d.ts","sourceRoot":"","sources":["../../src/commands/pull-database.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,OAAO,kBAAkB,CAAC;AACvC,eAAO,MAAM,QAAQ,oEAC6C,CAAC;AACnE,wBAAsB,OAAO,kBA4I5B"}
@@ -1,8 +1,6 @@
1
1
  import { exec } from "node:child_process";
2
- import { createReadStream, createWriteStream } from "node:fs";
3
2
  import { unlink as deleteFile } from "node:fs/promises";
4
3
  import { performance } from "node:perf_hooks";
5
- import readline from "node:readline";
6
4
  import { promisify } from "node:util";
7
5
  import { convertMeasureToPrettyString, getSmashConfig, startRunningMessage, } from "../utils.js";
8
6
  export const command = "pull-database";
@@ -40,7 +38,6 @@ export async function handler() {
40
38
  await (async () => {
41
39
  const tmpFile = "/tmp/staging-database.sql";
42
40
  const dbPrefixFile = "/tmp/db-prefix.txt";
43
- const tmpFileProcessed = "/tmp/staging-database.processed.sql";
44
41
  const tablesToExclude = [
45
42
  // WordFence
46
43
  "wfauditevents",
@@ -81,26 +78,11 @@ export async function handler() {
81
78
  .then(async () => {
82
79
  await stopRunningMessage();
83
80
  console.log("Database downloaded.");
84
- const stopRunningMessage2 = startRunningMessage("Updating URLs in database SQL");
85
- await new Promise((resolve, reject) => {
86
- const readStream = createReadStream(tmpFile, { encoding: "utf8" });
87
- const writeStream = createWriteStream(tmpFileProcessed, {
88
- encoding: "utf8",
89
- });
90
- const rl = readline.createInterface({ input: readStream });
91
- rl.on("line", (line) => {
92
- writeStream.write(line.replaceAll(stagingUrl, `//${projectName}.test`) + "\n");
93
- });
94
- rl.on("close", () => {
95
- writeStream.end();
96
- });
97
- writeStream.on("finish", resolve);
98
- writeStream.on("error", reject);
99
- readStream.on("error", reject);
100
- })
81
+ const stopRunningMessage2 = startRunningMessage("Importing database");
82
+ await execute(`wp db query < ${tmpFile}`)
101
83
  .then(async () => {
102
84
  await stopRunningMessage2();
103
- console.log("URLs updated.");
85
+ console.log("Database imported.");
104
86
  })
105
87
  .catch(async (error) => {
106
88
  await stopRunningMessage2();
@@ -108,20 +90,22 @@ export async function handler() {
108
90
  });
109
91
  })
110
92
  .then(async () => {
111
- const stopRunningMessage3 = startRunningMessage("Importing database");
112
- await execute(`wp db query < ${tmpFileProcessed}`)
93
+ const stopRunningMessage3 = startRunningMessage("Running search and replace");
94
+ await execute(`wp search-replace --url=${projectName}.test ${stagingUrl} '//${projectName}.test' --skip-columns=guid`)
113
95
  .then(async () => {
114
96
  await stopRunningMessage3();
97
+ console.log("Search and replace completed.");
115
98
  })
116
99
  .catch(async (error) => {
117
100
  await stopRunningMessage3();
118
101
  throw error;
119
102
  });
103
+ })
104
+ .then(async () => {
120
105
  const stopRunningMessage4 = startRunningMessage("Cleaning up");
121
106
  await Promise.allSettled([
122
107
  deleteFile(tmpFile),
123
108
  deleteFile(dbPrefixFile),
124
- deleteFile(tmpFileProcessed),
125
109
  ]).then(async () => {
126
110
  await stopRunningMessage4();
127
111
  });
@@ -134,7 +118,6 @@ export async function handler() {
134
118
  const cleanupResults = await Promise.allSettled([
135
119
  deleteFile(tmpFile),
136
120
  deleteFile(dbPrefixFile),
137
- deleteFile(tmpFileProcessed),
138
121
  ]);
139
122
  const failedCleanups = cleanupResults.filter((result) => result.status === "rejected");
140
123
  if (failedCleanups.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomicsmash/cli",
3
- "version": "9.0.1-beta.2",
3
+ "version": "9.0.1",
4
4
  "description": "A collection of CLI tools by Atomic Smash.",
5
5
  "keywords": [],
6
6
  "homepage": "https://www.atomicsmash.co.uk/",
@@ -42,18 +42,18 @@
42
42
  "dependencies": {
43
43
  "@atomicsmash/date-php": "^2.1.0",
44
44
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.17",
45
- "@wordpress/babel-preset-default": "^8.32.0",
46
- "@wordpress/dependency-extraction-webpack-plugin": "^6.32.0",
47
- "@wordpress/postcss-plugins-preset": "^5.32.0",
48
- "autoprefixer": "^10.4.21",
45
+ "@wordpress/babel-preset-default": "^8.35.0",
46
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.35.0",
47
+ "@wordpress/postcss-plugins-preset": "^5.35.0",
48
+ "autoprefixer": "^10.4.22",
49
49
  "babel-loader": "^9.2.1",
50
- "browserslist": "^4.26.3",
50
+ "browserslist": "^4.28.0",
51
51
  "chalk": "^4.1.2",
52
52
  "clean-webpack-plugin": "^4.0.0",
53
53
  "copy-webpack-plugin": "^12.0.2",
54
54
  "cosmiconfig": "^9.0.0",
55
55
  "css-loader": "^7.1.2",
56
- "cssnano": "^7.1.1",
56
+ "cssnano": "^7.1.2",
57
57
  "fast-glob": "^3.3.3",
58
58
  "glob-promise": "^6.0.7",
59
59
  "mini-css-extract-plugin": "^2.9.4",
@@ -64,8 +64,8 @@
64
64
  "react-refresh": "^0.14.2",
65
65
  "read-pkg-up": "^7.0.1",
66
66
  "rtlcss-webpack-plugin": "^4.0.7",
67
- "sass": "^1.93.2",
68
- "sass-loader": "^16.0.5",
67
+ "sass": "^1.94.1",
68
+ "sass-loader": "^16.0.6",
69
69
  "schema-utils": "^4.3.3",
70
70
  "source-map-loader": "^3.0.2",
71
71
  "svg-sprite": "^2.0.4",
@@ -74,7 +74,7 @@
74
74
  "tsconfig-paths-webpack-plugin": "^4.2.0",
75
75
  "tsx": "^4.20.6",
76
76
  "vinyl": "^3.0.1",
77
- "webpack": "^5.102.1",
77
+ "webpack": "^5.103.0",
78
78
  "webpack-bundle-analyzer": "^4.10.2",
79
79
  "yargs": "^18.0.0"
80
80
  },