@atomicsmash/cli 8.2.0-beta.3 → 9.0.0-beta.5

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.
@@ -195,8 +195,8 @@ async function runCommand({ srcFolder, distFolder, tsConfigLocation, postcssConf
195
195
  }
196
196
  else {
197
197
  const stopRunningMessage = startRunningMessage("Building blocks");
198
- compiler.run((error, stats) => {
199
- stopRunningMessage();
198
+ compiler.run(async (error, stats) => {
199
+ await stopRunningMessage();
200
200
  if (error) {
201
201
  console.error(error);
202
202
  process.exitCode = 1;
@@ -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,kBAgG5B"}
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,kBAqH5B"}
@@ -39,9 +39,11 @@ export async function handler() {
39
39
  const tmpFile = "/tmp/staging-database.sql";
40
40
  const tmpFileProcessed = "/tmp/staging-database.processed.sql";
41
41
  await execute(`ssh ${stagingSSHUsername}@${stagingSSHHost} -p ${stagingSSHPort} "cd public/current && wp db export - --add-drop-table" > ${tmpFile}`)
42
- .then(() => {
43
- console.log("Database downloaded. Updating URLs in database SQL...");
44
- return new Promise((resolve, reject) => {
42
+ .then(async () => {
43
+ await stopRunningMessage();
44
+ console.log("Database downloaded.");
45
+ const stopRunningMessage2 = startRunningMessage("Updating URLs in database SQL");
46
+ await new Promise((resolve, reject) => {
45
47
  const readStream = createReadStream(tmpFile, { encoding: "utf8" });
46
48
  const writeStream = createWriteStream(tmpFileProcessed, {
47
49
  encoding: "utf8",
@@ -56,19 +58,38 @@ export async function handler() {
56
58
  writeStream.on("finish", resolve);
57
59
  writeStream.on("error", reject);
58
60
  readStream.on("error", reject);
61
+ })
62
+ .then(async () => {
63
+ await stopRunningMessage2();
64
+ console.log("URLs updated.");
65
+ })
66
+ .catch(async (error) => {
67
+ await stopRunningMessage2();
68
+ throw error;
59
69
  });
60
70
  })
61
71
  .then(async () => {
62
- console.log("Importing database...");
63
- await execute(`wp db query < ${tmpFileProcessed}`);
64
- await deleteFile(tmpFile);
65
- await deleteFile(tmpFileProcessed);
66
- stopRunningMessage();
72
+ const stopRunningMessage3 = startRunningMessage("Importing database");
73
+ await execute(`wp db query < ${tmpFileProcessed}`)
74
+ .then(async () => {
75
+ await stopRunningMessage3();
76
+ })
77
+ .catch(async (error) => {
78
+ await stopRunningMessage3();
79
+ throw error;
80
+ });
81
+ const stopRunningMessage4 = startRunningMessage("Cleaning up");
82
+ await Promise.allSettled([
83
+ deleteFile(tmpFile),
84
+ deleteFile(tmpFileProcessed),
85
+ ]).then(async () => {
86
+ await stopRunningMessage4();
87
+ });
67
88
  console.log(`Database import complete! ${convertMeasureToPrettyString(performance.measure("everything", "Start"))}`);
68
89
  console.log("If you want to download recent media you can use `npm run pull:media`, you can also change the number of months to download in your `.env` file.");
69
90
  })
70
91
  .catch(async (error) => {
71
- stopRunningMessage();
92
+ await stopRunningMessage();
72
93
  console.error("Error during database pull:", error);
73
94
  const cleanupResults = await Promise.allSettled([
74
95
  deleteFile(tmpFile),
@@ -87,12 +87,12 @@ export async function handler() {
87
87
  console.log("Finished attempting to download all requested months");
88
88
  }
89
89
  })()
90
- .then(() => {
91
- stopRunningMessage();
90
+ .then(async () => {
91
+ await stopRunningMessage();
92
92
  console.log("Media download complete!");
93
93
  })
94
- .catch(() => {
95
- stopRunningMessage();
94
+ .catch(async () => {
95
+ await stopRunningMessage();
96
96
  console.log("There was an error downloading the media, see the message above.");
97
97
  });
98
98
  }
@@ -42,14 +42,14 @@ export async function handler() {
42
42
  console.log(`Plugins activated. (${convertMeasureToPrettyString(performance.measure("plugins", addCustomUser ? "add-custom-user" : "wordpress-tables"))})`);
43
43
  return execute(`wp theme activate ${themeName}`);
44
44
  })
45
- .then(() => {
45
+ .then(async () => {
46
46
  performance.mark("theme");
47
47
  console.log(`Theme activated. (${convertMeasureToPrettyString(performance.measure("theme", "plugins"))})`);
48
- stopRunningMessage();
48
+ await stopRunningMessage();
49
49
  console.log(`Database set up${addCustomUser ? ` and ${process.env.WORDPRESS_USER} user added` : !process.env.CI ? ". To set up a user, run the `wp user create` command." : ""}. (${convertMeasureToPrettyString(performance.measure("everything", "Start"))})`);
50
50
  })
51
- .catch((error) => {
52
- stopRunningMessage();
51
+ .catch(async (error) => {
52
+ await stopRunningMessage();
53
53
  if (error.stderr?.startsWith("ERROR 1007")) {
54
54
  console.error("Database already exists with the name in the wp-config. Please delete that database first with `wp db drop --yes`");
55
55
  }
@@ -123,8 +123,8 @@ export async function handler() {
123
123
  throw new Error(`Failed to run additional npm install ${index + 1}.`);
124
124
  });
125
125
  }) ?? []),
126
- ]).then((results) => {
127
- stopRunningMessage();
126
+ ]).then(async (results) => {
127
+ await stopRunningMessage();
128
128
  if (results.some((result) => result.status === "rejected")) {
129
129
  process.exitCode = 1;
130
130
  console.error("Setup failed with the following errors:\n");
@@ -216,6 +216,9 @@ const baseConfig = {
216
216
  loader: require.resolve("sass-loader"),
217
217
  options: {
218
218
  sourceMap: !isProduction,
219
+ warnRuleAsWarning: false,
220
+ implementation: require("sass"),
221
+ api: "legacy",
219
222
  },
220
223
  },
221
224
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"wordpress.webpack.config.d.cts","sourceRoot":"","sources":["../../src/external/wordpress.webpack.config.cjs"],"names":[],"mappings":";;AA+SA,oCAAoC;AACpC,4BADW,OAAO,CAAC,aAAa,CA2G9B"}
1
+ {"version":3,"file":"wordpress.webpack.config.d.cts","sourceRoot":"","sources":["../../src/external/wordpress.webpack.config.cjs"],"names":[],"mappings":";;AAkTA,oCAAoC;AACpC,4BADW,OAAO,CAAC,aAAa,CA2G9B"}
package/dist/utils.d.ts CHANGED
@@ -14,7 +14,7 @@ export declare function execute(command: string, options?: {
14
14
  }>;
15
15
  export declare function toCamelCase(text: string): string;
16
16
  export declare function convertMeasureToPrettyString(measure: PerformanceMeasure): string;
17
- export declare function startRunningMessage(message: string): () => void;
17
+ export declare function startRunningMessage(message: string): () => Promise<void>;
18
18
  export declare function getSmashConfig(): Promise<Required<SmashConfig> | {
19
19
  npmInstallPaths: string[];
20
20
  composerInstallPaths: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQ7C,eAAO,MAAM,WAAW,EAAiC,WAAW,CAAC;AAIrE,eAAO,MAAM,WAAW,QAA6D,CAAC;AAItF,eAAO,MAAM,cAAc,QAAsB,CAAC;AAElD,wBAAsB,OAAO,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAqB;WAGtC,aAAa,GAAG,IAAI;YACnB,MAAM;YACN,MAAM;GAaf;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAQvC;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,kBAAkB,UAevE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,cAyBlD;AAyBD,wBAAsB,cAAc;;;;;;;UAiEnC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQ7C,eAAO,MAAM,WAAW,EAAiC,WAAW,CAAC;AAIrE,eAAO,MAAM,WAAW,QAA6D,CAAC;AAItF,eAAO,MAAM,cAAc,QAAsB,CAAC;AAElD,wBAAsB,OAAO,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAqB;WAGtC,aAAa,GAAG,IAAI;YACnB,MAAM;YACN,MAAM;GAaf;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAQvC;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,kBAAkB,UAevE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,uBAiClD;AAyBD,wBAAsB,cAAc;;;;;;;UAiEnC"}
package/dist/utils.js CHANGED
@@ -64,15 +64,23 @@ export function startRunningMessage(message) {
64
64
  process.stdout.cursorTo(0);
65
65
  process.stdout.write(`${message}${".".repeat($i)}\r`);
66
66
  }, 200);
67
- return () => {
67
+ return async () => {
68
68
  if (interval) {
69
69
  clearInterval(interval);
70
- process.stdout.clearLine(0);
71
- process.stdout.cursorTo(0);
70
+ await new Promise((resolve) => {
71
+ process.stdout.clearLine(0, () => {
72
+ resolve();
73
+ });
74
+ });
75
+ await new Promise((resolve) => {
76
+ process.stdout.cursorTo(0, () => {
77
+ resolve();
78
+ });
79
+ });
72
80
  }
73
81
  };
74
82
  }
75
- return () => {
83
+ return async () => {
76
84
  /* do nothing */
77
85
  };
78
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomicsmash/cli",
3
- "version": "8.2.0-beta.3",
3
+ "version": "9.0.0-beta.5",
4
4
  "description": "A collection of CLI tools by Atomic Smash.",
5
5
  "keywords": [],
6
6
  "homepage": "https://www.atomicsmash.co.uk/",
@@ -64,7 +64,7 @@
64
64
  "read-pkg-up": "^7.0.1",
65
65
  "rtlcss-webpack-plugin": "^4.0.7",
66
66
  "sass": "^1.89.2",
67
- "sass-loader": "^12.6.0",
67
+ "sass-loader": "^16.0.5",
68
68
  "schema-utils": "^4.3.2",
69
69
  "source-map-loader": "^3.0.2",
70
70
  "svg-sprite": "^2.0.4",