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

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.
@@ -4,6 +4,7 @@ import type { ArgumentsCamelCase } from "yargs";
4
4
  import webpack from "webpack";
5
5
  export declare const command = "blocks";
6
6
  export declare const describe = "A command to generate WordPress blocks from a src folder.";
7
+ export declare const deprecated = "Please migrate to using the @atomicsmash/compiler package. This command will be removed in the next major version.";
7
8
  export declare const builder: (yargs: YargsInstance) => import("yargs").Argv<import("yargs").Omit<{}, "in" | "out" | "tsConfigPath" | "postcssConfigPath" | "watch" | "excludeBlocks" | "excludeRootFiles" | "alwaysCompileRootFiles" | "ignoreWarnings"> & import("yargs").InferredOptionTypes<{
8
9
  in: {
9
10
  string: true;
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAIjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAwBhD,OAAO,OAAO,MAAM,SAAS,CAAC;AAM9B,eAAO,MAAM,OAAO,WAAW,CAAC;AAChC,eAAO,MAAM,QAAQ,8DACuC,CAAC;AAC7D,eAAO,MAAM,OAAO,GAAa,OAAO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0ClC,MAAM,EAAE;;;;;;;;;;;;;GAqB1B,CAAC;AAEF,wBAAsB,OAAO,CAC5B,IAAI,EAAE,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,iBA4CrE;AAkJD,wBAAsB,wBAAwB,CAAC,EAC9C,SAAS,EACT,gBAAgB,GAChB,EAAE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC3B,gCAmCA;AAED,wBAAgB,yBAAyB,CAAC,EACzC,SAAS,EACT,MAAM,GACN,EAAE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CACb,MAAM,EACN;QACC,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,SAAS,CAAC;KACrB,CACD,CAAC;CACF,uBAkCA;AAED,KAAK,SAAS,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE7C,wBAAsB,iBAAiB,CACtC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EAAE;iBAUqB,MAAM;eAAa,SAAS;IAuBxE;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,6EAW5D;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,0EAW3D"}
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAIjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAwBhD,OAAO,OAAO,MAAM,SAAS,CAAC;AAM9B,eAAO,MAAM,OAAO,WAAW,CAAC;AAChC,eAAO,MAAM,QAAQ,8DACuC,CAAC;AAC7D,eAAO,MAAM,UAAU,uHAC8F,CAAC;AACtH,eAAO,MAAM,OAAO,GAAa,OAAO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0ClC,MAAM,EAAE;;;;;;;;;;;;;GAqB1B,CAAC;AAEF,wBAAsB,OAAO,CAC5B,IAAI,EAAE,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,iBA4CrE;AAqJD,wBAAsB,wBAAwB,CAAC,EAC9C,SAAS,EACT,gBAAgB,GAChB,EAAE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC3B,gCAmCA;AAED,wBAAgB,yBAAyB,CAAC,EACzC,SAAS,EACT,MAAM,GACN,EAAE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CACb,MAAM,EACN;QACC,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,SAAS,CAAC;KACrB,CACD,CAAC;CACF,uBAkCA;AAED,KAAK,SAAS,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE7C,wBAAsB,iBAAiB,CACtC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EAAE;iBAUqB,MAAM;eAAa,SAAS;IAuBxE;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,6EAW5D;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,0EAW3D"}
@@ -20,6 +20,7 @@ import { getSmashConfig, startRunningMessage, toCamelCase } from "../utils.js";
20
20
  const isProduction = process.env.NODE_ENV === "production";
21
21
  export const command = "blocks";
22
22
  export const describe = "A command to generate WordPress blocks from a src folder.";
23
+ export const deprecated = "Please migrate to using the @atomicsmash/compiler package. This command will be removed in the next major version.";
23
24
  export const builder = function (yargs) {
24
25
  return yargs
25
26
  .options({
@@ -165,6 +166,7 @@ async function runCommand({ srcFolder, distFolder, tsConfigLocation, postcssConf
165
166
  node: { global: false },
166
167
  });
167
168
  if (isWatch) {
169
+ console.log("The blocks command is now deprecated. " + deprecated);
168
170
  const watching = compiler.watch({
169
171
  // Example
170
172
  aggregateTimeout: 300,
@@ -189,14 +191,15 @@ async function runCommand({ srcFolder, distFolder, tsConfigLocation, postcssConf
189
191
  });
190
192
  process.on("SIGINT", function () {
191
193
  watching.close((closeError) => {
194
+ console.log("The blocks command is now deprecated. " + deprecated);
192
195
  console.error(closeError);
193
196
  });
194
197
  });
195
198
  }
196
199
  else {
197
200
  const stopRunningMessage = startRunningMessage("Building blocks");
198
- compiler.run((error, stats) => {
199
- stopRunningMessage();
201
+ compiler.run(async (error, stats) => {
202
+ await stopRunningMessage();
200
203
  if (error) {
201
204
  console.error(error);
202
205
  process.exitCode = 1;
@@ -216,6 +219,7 @@ async function runCommand({ srcFolder, distFolder, tsConfigLocation, postcssConf
216
219
  }
217
220
  }
218
221
  compiler.close((closeError) => {
222
+ console.log("The blocks command is now deprecated. " + deprecated);
219
223
  if (closeError) {
220
224
  process.exitCode = 1;
221
225
  }
@@ -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"}
@@ -32,23 +32,25 @@ export async function handler() {
32
32
  throw new Error("STAGING_URL is missing from .env file.");
33
33
  }
34
34
  else {
35
- const { themeName } = smashConfig;
35
+ const { projectName } = smashConfig;
36
36
  const stopRunningMessage = startRunningMessage("Pulling database from staging");
37
37
  performance.mark("Start");
38
38
  await (async () => {
39
39
  const tmpFile = "/tmp/staging-database.sql";
40
40
  const tmpFileProcessed = "/tmp/staging-database.processed.sql";
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) => {
41
+ await execute(`ssh -o "StrictHostKeyChecking no" ${stagingSSHUsername}@${stagingSSHHost} -p ${stagingSSHPort} "cd public/current && wp db export - --add-drop-table" > ${tmpFile}`)
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",
48
50
  });
49
51
  const rl = readline.createInterface({ input: readStream });
50
52
  rl.on("line", (line) => {
51
- writeStream.write(line.replaceAll(stagingUrl, `//${themeName}.test`) + "\n");
53
+ writeStream.write(line.replaceAll(stagingUrl, `//${projectName}.test`) + "\n");
52
54
  });
53
55
  rl.on("close", () => {
54
56
  writeStream.end();
@@ -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),
@@ -10,7 +10,7 @@ async function downloadFiles(remotePath, localPath, ssh) {
10
10
  // Create local directory if it doesn't exist
11
11
  await mkdir(localPath, { recursive: true });
12
12
  // Download files using scp
13
- await execute(`scp -r -p -O -P ${ssh.port} "${ssh.username}@${ssh.host}:${remotePath}" "${localPath}"`);
13
+ await execute(`scp -r -p -O -P -o "StrictHostKeyChecking no" ${ssh.port} "${ssh.username}@${ssh.host}:${remotePath}" "${localPath}"`);
14
14
  }
15
15
  catch (error) {
16
16
  console.log(`Failed to download ${remotePath}`);
@@ -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
  }
@@ -16,12 +16,12 @@ export async function handler() {
16
16
  throw new Error("Unable to determine project setup information. Please add a smash.config.ts file with the required info.");
17
17
  }
18
18
  else {
19
- const { themeName } = smashConfig;
19
+ const { projectName, themeFolderName } = smashConfig;
20
20
  const stopRunningMessage = startRunningMessage("Initialising database");
21
21
  performance.mark("Start");
22
22
  await execute("wp db create")
23
23
  .then(() => {
24
- return execute(`wp core install --url=http://${process.env.CI ? "127.0.0.1" : `${themeName}.test`}/ --title=Temp --admin_user=Bot --admin_email=fake@fake.com --admin_password=password`);
24
+ return execute(`wp core install --url=http://${process.env.CI ? "127.0.0.1" : `${projectName}.test`}/ --title=Temp --admin_user=Bot --admin_email=fake@fake.com --admin_password=password`);
25
25
  })
26
26
  .then(() => {
27
27
  performance.mark("wordpress-tables");
@@ -40,16 +40,16 @@ export async function handler() {
40
40
  .then(() => {
41
41
  performance.mark("plugins");
42
42
  console.log(`Plugins activated. (${convertMeasureToPrettyString(performance.measure("plugins", addCustomUser ? "add-custom-user" : "wordpress-tables"))})`);
43
- return execute(`wp theme activate ${themeName}`);
43
+ return execute(`wp theme activate ${themeFolderName}`);
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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,QAAQ,kDAAkD,CAAC;AACxE,wBAAsB,OAAO,kBAiM5B"}
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,kBAkO5B"}
@@ -1,6 +1,6 @@
1
1
  import { exec } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
- import { constants, copyFile } from "node:fs/promises";
3
+ import { constants, copyFile, unlink as deleteFile, mkdir, } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
5
  import { performance } from "node:perf_hooks";
6
6
  import { promisify } from "node:util";
@@ -22,32 +22,50 @@ export async function handler() {
22
22
  throw new Error("Unable to determine project setup information. Please add a smash.config.ts file with the required info.");
23
23
  }
24
24
  else {
25
- const { themeName, composerInstallPaths, npmInstallPaths } = smashConfig;
25
+ const { projectName, composerInstallPaths, npmInstallPaths } = smashConfig;
26
26
  const stopRunningMessage = startRunningMessage("Running setup");
27
27
  performance.mark("Start");
28
28
  await Promise.allSettled([
29
29
  ...(shouldInstallAndBuildOnly
30
30
  ? []
31
31
  : [
32
- copyFile(".env.example", ".env", constants.COPYFILE_EXCL)
33
- .then(() => {
34
- console.log(`.env.example file copied to .env. (${convertMeasureToPrettyString(performance.measure("Copy env file", "Start"))})`);
35
- })
36
- .catch((error) => {
37
- if (error instanceof Error &&
38
- "code" in error &&
39
- error.code === "EEXIST") {
40
- console.log(`Didn't copy .env file because one already exists. (${convertMeasureToPrettyString(performance.measure("Copy env file", "Start"))})`);
41
- return;
32
+ (async () => {
33
+ if (existsSync(".env.example")) {
34
+ if (existsSync(".config/environments/.env.dev")) {
35
+ throw new Error("Both .env.example and .config/environments/.env.dev files found. Please copy values from the .env.example to the .config/environments/.env.dev file and then delete the .env.example file.");
36
+ }
37
+ else {
38
+ console.log("Moving .env.example to .config/environments/.env.dev");
39
+ if (!existsSync(".config/environments")) {
40
+ await mkdir(".config/environments", { recursive: true });
41
+ }
42
+ await copyFile(".env.example", ".config/environments/.env.dev", constants.COPYFILE_EXCL);
43
+ await deleteFile(".env.example");
44
+ }
42
45
  }
43
- console.error(error);
44
- throw new Error("Failed to copy .env file.");
45
- }),
46
+ await copyFile(".config/environments/.env.dev", ".env", constants.COPYFILE_EXCL)
47
+ .then(() => {
48
+ console.log(`.config/environments/.env.dev file copied to .env. (${convertMeasureToPrettyString(performance.measure("Copy env file", "Start"))})`);
49
+ })
50
+ .catch((error) => {
51
+ if (error instanceof Error &&
52
+ "code" in error &&
53
+ error.code === "EEXIST") {
54
+ console.log(`Didn't copy .env file because one already exists. (${convertMeasureToPrettyString(performance.measure("Copy env file", "Start"))})`);
55
+ return;
56
+ }
57
+ console.error(error);
58
+ throw new Error("Failed to copy .env file.");
59
+ });
60
+ })(),
46
61
  (async () => {
47
- if (existsSync(resolve(process.cwd(), "herd.yml")) &&
48
- (await execute(`herd --version`)
49
- .then(() => true)
50
- .catch(() => false))) {
62
+ if (await execute(`herd --version`)
63
+ .then(() => true)
64
+ .catch(() => false)) {
65
+ if (!existsSync(resolve(process.cwd(), "herd.yaml")) &&
66
+ !existsSync(resolve(process.cwd(), "herd.yml"))) {
67
+ throw new Error("Herd is present on your machine, but the project is missing a herd.yaml file. Please do the initial setup by running herd init.");
68
+ }
51
69
  await execute(`herd init`)
52
70
  .then(() => {
53
71
  console.log(`Herd is linked, secured and isolated. (${convertMeasureToPrettyString(performance.measure("herd-or-valet", "Start"))})`);
@@ -60,7 +78,7 @@ export async function handler() {
60
78
  else if (await execute(`valet --version`)
61
79
  .then(() => true)
62
80
  .catch(() => false)) {
63
- await execute(`valet link ${themeName} --secure --isolate`)
81
+ await execute(`valet link ${projectName} --secure --isolate`)
64
82
  .then(() => {
65
83
  console.log(`Valet is linked, secured and isolated. (${convertMeasureToPrettyString(performance.measure("herd-or-valet", "Start"))})`);
66
84
  })
@@ -70,7 +88,7 @@ export async function handler() {
70
88
  });
71
89
  }
72
90
  else {
73
- console.log(`Neither Herd nor Valet is available. Site has not been linked.`);
91
+ throw new Error(`Neither Herd nor Valet is present on your machine, check everything is installed correctly.`);
74
92
  }
75
93
  })(),
76
94
  ]),
@@ -123,8 +141,8 @@ export async function handler() {
123
141
  throw new Error(`Failed to run additional npm install ${index + 1}.`);
124
142
  });
125
143
  }) ?? []),
126
- ]).then((results) => {
127
- stopRunningMessage();
144
+ ]).then(async (results) => {
145
+ await stopRunningMessage();
128
146
  if (results.some((result) => result.status === "rejected")) {
129
147
  process.exitCode = 1;
130
148
  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/index.d.ts CHANGED
@@ -4,8 +4,9 @@ export type SCSSAliases = {
4
4
  importers?: Options<"async">["importers"];
5
5
  };
6
6
  export type SmashConfig = {
7
- themeName: string;
7
+ projectName: string;
8
8
  themePath: string;
9
+ themeFolderName?: string;
9
10
  assetsOutputFolder?: string;
10
11
  npmInstallPaths?: string[];
11
12
  composerInstallPaths?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,MAAM,WAAW,GAAG;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,MAAM,WAAW,GAAG;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -14,13 +14,14 @@ 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[];
21
21
  assetsOutputFolder: string;
22
- themeName: string;
22
+ projectName: string;
23
23
  themePath: string;
24
+ themeFolderName: string;
24
25
  scssAliases: SCSSAliases;
25
26
  } | null>;
26
27
  //# sourceMappingURL=utils.d.ts.map
@@ -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;;;;;;;;UAmEnC"}
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
  }
@@ -108,6 +116,7 @@ export async function getSmashConfig() {
108
116
  if (isValidSmashConfig(config)) {
109
117
  return {
110
118
  scssAliases: getDefaultSCSSAliases(config.themePath),
119
+ themeFolderName: config.projectName,
111
120
  ...config,
112
121
  // Normalize and resolve paths to cwd.
113
122
  npmInstallPaths: config.npmInstallPaths?.map((path) => {
@@ -145,8 +154,9 @@ export async function getSmashConfig() {
145
154
  }
146
155
  console.warn("Using env vars for theme name and path is deprecated and will be removed in a future version. Create a smash.config.ts file with the relevant properties in it instead.");
147
156
  const defaultConfig = {
148
- themeName,
157
+ projectName: themeName,
149
158
  themePath,
159
+ themeFolderName: themeName,
150
160
  assetsOutputFolder: "dist",
151
161
  npmInstallPaths: [],
152
162
  composerInstallPaths: [],
@@ -159,8 +169,8 @@ export async function getSmashConfig() {
159
169
  function isValidSmashConfig(config) {
160
170
  return (typeof config === "object" &&
161
171
  config !== null &&
162
- "themeName" in config &&
163
- typeof config.themeName === "string" &&
172
+ "projectName" in config &&
173
+ typeof config.projectName === "string" &&
164
174
  "themePath" in config &&
165
175
  typeof config.themePath === "string");
166
176
  }
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.10",
4
4
  "description": "A collection of CLI tools by Atomic Smash.",
5
5
  "keywords": [],
6
6
  "homepage": "https://www.atomicsmash.co.uk/",
@@ -51,6 +51,7 @@
51
51
  "chalk": "^4.1.2",
52
52
  "clean-webpack-plugin": "^4.0.0",
53
53
  "copy-webpack-plugin": "^12.0.2",
54
+ "cosmiconfig": "^9.0.0",
54
55
  "css-loader": "^7.1.2",
55
56
  "cssnano": "^7.1.0",
56
57
  "fast-glob": "^3.3.3",
@@ -64,7 +65,7 @@
64
65
  "read-pkg-up": "^7.0.1",
65
66
  "rtlcss-webpack-plugin": "^4.0.7",
66
67
  "sass": "^1.89.2",
67
- "sass-loader": "^12.6.0",
68
+ "sass-loader": "^16.0.5",
68
69
  "schema-utils": "^4.3.2",
69
70
  "source-map-loader": "^3.0.2",
70
71
  "svg-sprite": "^2.0.4",
@@ -86,6 +87,7 @@
86
87
  "type-fest": "^4.41.0"
87
88
  },
88
89
  "peerDependencies": {
89
- "dotenv": "^16.6.1"
90
+ "dotenv": "^16.6.1",
91
+ "typescript": ">=4.9.5"
90
92
  }
91
93
  }