@atomicsmash/cli 8.2.0-beta.1 → 8.2.0-beta.3
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.
- package/dist/commands/blocks.d.ts.map +1 -1
- package/dist/commands/blocks.js +5 -3
- package/dist/commands/pull-database.d.ts.map +1 -1
- package/dist/commands/pull-database.js +3 -7
- package/dist/commands/pull-media.d.ts.map +1 -1
- package/dist/commands/pull-media.js +3 -7
- package/dist/commands/setup-database.d.ts +1 -1
- package/dist/commands/setup-database.d.ts.map +1 -1
- package/dist/commands/setup-database.js +4 -8
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +2 -4
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +12 -3
- package/package.json +1 -1
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[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ands/blocks.js
CHANGED
|
@@ -16,7 +16,7 @@ import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
|
16
16
|
import { tsImport } from "tsx/esm/api";
|
|
17
17
|
import webpack from "webpack";
|
|
18
18
|
import defaultConfig from "../external/wordpress.webpack.config.cjs";
|
|
19
|
-
import { getSmashConfig, toCamelCase } from "../utils.js";
|
|
19
|
+
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.";
|
|
@@ -78,12 +78,12 @@ export async function handler(args) {
|
|
|
78
78
|
const srcFolder = args.in
|
|
79
79
|
? resolvePath(args.in)
|
|
80
80
|
: smashConfig?.themePath
|
|
81
|
-
? join(smashConfig?.themePath, "src", "blocks")
|
|
81
|
+
? resolvePath(join(smashConfig?.themePath, "src", "blocks"))
|
|
82
82
|
: null;
|
|
83
83
|
const distFolder = args.out
|
|
84
84
|
? resolvePath(args.out)
|
|
85
85
|
: smashConfig?.themePath
|
|
86
|
-
? join(smashConfig?.themePath, smashConfig.assetsOutputFolder, "blocks")
|
|
86
|
+
? resolvePath(join(smashConfig?.themePath, smashConfig.assetsOutputFolder, "blocks"))
|
|
87
87
|
: null;
|
|
88
88
|
if (!srcFolder || !distFolder) {
|
|
89
89
|
throw new Error("Failed to get the in or out folders for the blocks. Please add a smash.config.ts file to your project with a themeName and a themePath.");
|
|
@@ -194,7 +194,9 @@ async function runCommand({ srcFolder, distFolder, tsConfigLocation, postcssConf
|
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
else {
|
|
197
|
+
const stopRunningMessage = startRunningMessage("Building blocks");
|
|
197
198
|
compiler.run((error, stats) => {
|
|
199
|
+
stopRunningMessage();
|
|
198
200
|
if (error) {
|
|
199
201
|
console.error(error);
|
|
200
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,
|
|
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"}
|
|
@@ -33,7 +33,7 @@ export async function handler() {
|
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
const { themeName } = smashConfig;
|
|
36
|
-
const
|
|
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";
|
|
@@ -63,16 +63,12 @@ export async function handler() {
|
|
|
63
63
|
await execute(`wp db query < ${tmpFileProcessed}`);
|
|
64
64
|
await deleteFile(tmpFile);
|
|
65
65
|
await deleteFile(tmpFileProcessed);
|
|
66
|
-
|
|
67
|
-
clearInterval(interval);
|
|
68
|
-
}
|
|
66
|
+
stopRunningMessage();
|
|
69
67
|
console.log(`Database import complete! ${convertMeasureToPrettyString(performance.measure("everything", "Start"))}`);
|
|
70
68
|
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.");
|
|
71
69
|
})
|
|
72
70
|
.catch(async (error) => {
|
|
73
|
-
|
|
74
|
-
clearInterval(interval);
|
|
75
|
-
}
|
|
71
|
+
stopRunningMessage();
|
|
76
72
|
console.error("Error during database pull:", error);
|
|
77
73
|
const cleanupResults = await Promise.allSettled([
|
|
78
74
|
deleteFile(tmpFile),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-media.d.ts","sourceRoot":"","sources":["../../src/commands/pull-media.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,OAAO,eAAe,CAAC;AACpC,eAAO,MAAM,QAAQ,gDAAgD,CAAC;AACtE,wBAAsB,OAAO,
|
|
1
|
+
{"version":3,"file":"pull-media.d.ts","sourceRoot":"","sources":["../../src/commands/pull-media.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,OAAO,eAAe,CAAC;AACpC,eAAO,MAAM,QAAQ,gDAAgD,CAAC;AACtE,wBAAsB,OAAO,kBA4E5B"}
|
|
@@ -56,7 +56,7 @@ export async function handler() {
|
|
|
56
56
|
host: stagingSSHHost,
|
|
57
57
|
username: stagingSSHUsername,
|
|
58
58
|
};
|
|
59
|
-
const
|
|
59
|
+
const stopRunningMessage = startRunningMessage("Pulling media from staging");
|
|
60
60
|
performance.mark("Start");
|
|
61
61
|
await (async () => {
|
|
62
62
|
if (mediaMonths === -1) {
|
|
@@ -88,15 +88,11 @@ export async function handler() {
|
|
|
88
88
|
}
|
|
89
89
|
})()
|
|
90
90
|
.then(() => {
|
|
91
|
-
|
|
92
|
-
clearInterval(interval);
|
|
93
|
-
}
|
|
91
|
+
stopRunningMessage();
|
|
94
92
|
console.log("Media download complete!");
|
|
95
93
|
})
|
|
96
94
|
.catch(() => {
|
|
97
|
-
|
|
98
|
-
clearInterval(interval);
|
|
99
|
-
}
|
|
95
|
+
stopRunningMessage();
|
|
100
96
|
console.log("There was an error downloading the media, see the message above.");
|
|
101
97
|
});
|
|
102
98
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
2
|
export declare const command = "setup-database";
|
|
3
3
|
export declare const describe = "Create a new database and initialise the site with no content.";
|
|
4
|
-
export
|
|
4
|
+
export declare function handler(): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=setup-database.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-database.d.ts","sourceRoot":"","sources":["../../src/commands/setup-database.ts"],"names":[],"mappings":"AAQA,OAAO,eAAe,CAAC;AAEvB,eAAO,MAAM,OAAO,mBAAmB,CAAC;AACxC,eAAO,MAAM,QAAQ,mEAC4C,CAAC;AAClE,
|
|
1
|
+
{"version":3,"file":"setup-database.d.ts","sourceRoot":"","sources":["../../src/commands/setup-database.ts"],"names":[],"mappings":"AAQA,OAAO,eAAe,CAAC;AAEvB,eAAO,MAAM,OAAO,mBAAmB,CAAC;AACxC,eAAO,MAAM,QAAQ,mEAC4C,CAAC;AAClE,wBAAsB,OAAO,kBAsF5B"}
|
|
@@ -5,7 +5,7 @@ import { convertMeasureToPrettyString, getSmashConfig, startRunningMessage, } fr
|
|
|
5
5
|
import "dotenv/config";
|
|
6
6
|
export const command = "setup-database";
|
|
7
7
|
export const describe = "Create a new database and initialise the site with no content.";
|
|
8
|
-
export
|
|
8
|
+
export async function handler() {
|
|
9
9
|
const execute = promisify(exec);
|
|
10
10
|
const smashConfig = await getSmashConfig();
|
|
11
11
|
// These must remain env vars because they differ for each dev.
|
|
@@ -17,7 +17,7 @@ export default async function setupDatabase() {
|
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
const { themeName } = smashConfig;
|
|
20
|
-
const
|
|
20
|
+
const stopRunningMessage = startRunningMessage("Initialising database");
|
|
21
21
|
performance.mark("Start");
|
|
22
22
|
await execute("wp db create")
|
|
23
23
|
.then(() => {
|
|
@@ -45,15 +45,11 @@ export default async function setupDatabase() {
|
|
|
45
45
|
.then(() => {
|
|
46
46
|
performance.mark("theme");
|
|
47
47
|
console.log(`Theme activated. (${convertMeasureToPrettyString(performance.measure("theme", "plugins"))})`);
|
|
48
|
-
|
|
49
|
-
clearInterval(interval);
|
|
50
|
-
}
|
|
48
|
+
stopRunningMessage();
|
|
51
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"))})`);
|
|
52
50
|
})
|
|
53
51
|
.catch((error) => {
|
|
54
|
-
|
|
55
|
-
clearInterval(interval);
|
|
56
|
-
}
|
|
52
|
+
stopRunningMessage();
|
|
57
53
|
if (error.stderr?.startsWith("ERROR 1007")) {
|
|
58
54
|
console.error("Database already exists with the name in the wp-config. Please delete that database first with `wp db drop --yes`");
|
|
59
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,
|
|
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"}
|
package/dist/commands/setup.js
CHANGED
|
@@ -23,7 +23,7 @@ export async function handler() {
|
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
const { themeName, composerInstallPaths, npmInstallPaths } = smashConfig;
|
|
26
|
-
const
|
|
26
|
+
const stopRunningMessage = startRunningMessage("Running setup");
|
|
27
27
|
performance.mark("Start");
|
|
28
28
|
await Promise.allSettled([
|
|
29
29
|
...(shouldInstallAndBuildOnly
|
|
@@ -124,9 +124,7 @@ export async function handler() {
|
|
|
124
124
|
});
|
|
125
125
|
}) ?? []),
|
|
126
126
|
]).then((results) => {
|
|
127
|
-
|
|
128
|
-
clearInterval(interval);
|
|
129
|
-
}
|
|
127
|
+
stopRunningMessage();
|
|
130
128
|
if (results.some((result) => result.status === "rejected")) {
|
|
131
129
|
process.exitCode = 1;
|
|
132
130
|
console.error("Setup failed with the following errors:\n");
|
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):
|
|
17
|
+
export declare function startRunningMessage(message: string): () => void;
|
|
18
18
|
export declare function getSmashConfig(): Promise<Required<SmashConfig> | {
|
|
19
19
|
npmInstallPaths: string[];
|
|
20
20
|
composerInstallPaths: string[];
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/utils.js
CHANGED
|
@@ -55,7 +55,7 @@ export function startRunningMessage(message) {
|
|
|
55
55
|
process.stdout.write(`${message}${".".repeat($i)}\r`);
|
|
56
56
|
$i++;
|
|
57
57
|
if (typeof process.stdout.clearLine !== "undefined") {
|
|
58
|
-
|
|
58
|
+
const interval = setInterval(() => {
|
|
59
59
|
if ($i > 2) {
|
|
60
60
|
$i = 0;
|
|
61
61
|
}
|
|
@@ -64,8 +64,17 @@ export function startRunningMessage(message) {
|
|
|
64
64
|
process.stdout.cursorTo(0);
|
|
65
65
|
process.stdout.write(`${message}${".".repeat($i)}\r`);
|
|
66
66
|
}, 200);
|
|
67
|
+
return () => {
|
|
68
|
+
if (interval) {
|
|
69
|
+
clearInterval(interval);
|
|
70
|
+
process.stdout.clearLine(0);
|
|
71
|
+
process.stdout.cursorTo(0);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
67
74
|
}
|
|
68
|
-
return
|
|
75
|
+
return () => {
|
|
76
|
+
/* do nothing */
|
|
77
|
+
};
|
|
69
78
|
}
|
|
70
79
|
const getDefaultSCSSAliases = (themePath) => ({
|
|
71
80
|
importers: [
|
|
@@ -74,7 +83,7 @@ const getDefaultSCSSAliases = (themePath) => ({
|
|
|
74
83
|
if (!url.startsWith("sitecss:"))
|
|
75
84
|
return null;
|
|
76
85
|
const pathname = url.substring(8);
|
|
77
|
-
return pathToFileURL(`${resolve(process.cwd(), themePath, "
|
|
86
|
+
return pathToFileURL(`${resolve(process.cwd(), themePath, "src/styles")}${pathname.startsWith("/") ? pathname : `/${pathname}`}`);
|
|
78
87
|
},
|
|
79
88
|
},
|
|
80
89
|
{
|