@elementor/wp-lite-env 0.0.15 → 0.0.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # wp-lite-env
2
2
 
3
+ ## 0.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 8d278b0: clean up only after stopping the server
8
+
3
9
  ## 0.0.15
4
10
 
5
11
  ### Patch Changes
package/__tests__/e2e.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {afterEach, beforeAll, describe, expect, test} from "@jest/globals";
2
- import {cleanup, generateFiles, getConfigFilePath, start, stop} from "../src/run";
2
+ import {generateFiles, getConfigFilePath, start, stop} from "../src/run";
3
3
 
4
4
  const port = '1234';
5
5
 
@@ -9,7 +9,6 @@ describe('end to end tests', () => {
9
9
  })
10
10
  afterEach(async () => {
11
11
  await stop(port);
12
- cleanup(port);
13
12
  }, 30000);
14
13
  test('WordPress is up and running', async () => {
15
14
  await start( port );
package/dist/bin.cjs CHANGED
@@ -211,6 +211,7 @@ var stop = async (port2) => {
211
211
  composeOptions: ["-p", `port${port2}`],
212
212
  log: true
213
213
  });
214
+ cleanup(port2);
214
215
  };
215
216
  var cli = async (port2, command2) => {
216
217
  const runPath = getRunPath(port2);
@@ -283,7 +284,5 @@ var port = getPort(process.argv);
283
284
  var configFilePath = getConfigFilePath(process.argv);
284
285
  var cliCommand = getCliCommand(process.argv);
285
286
  generateFiles(port, configFilePath);
286
- commandMap[command](port, cliCommand).finally(() => {
287
- cleanup(port);
288
- });
287
+ commandMap[command](port, cliCommand);
289
288
  //# sourceMappingURL=bin.cjs.map
package/dist/bin.js CHANGED
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- cleanup,
4
3
  commandMap,
5
4
  generateFiles,
6
5
  getCliCommand,
7
6
  getConfigFilePath,
8
7
  getPort
9
- } from "./chunk-BYFZ2VGL.js";
8
+ } from "./chunk-UBXF6D42.js";
10
9
 
11
10
  // src/bin.ts
12
11
  var command = process.argv[2];
@@ -17,7 +16,5 @@ var port = getPort(process.argv);
17
16
  var configFilePath = getConfigFilePath(process.argv);
18
17
  var cliCommand = getCliCommand(process.argv);
19
18
  generateFiles(port, configFilePath);
20
- commandMap[command](port, cliCommand).finally(() => {
21
- cleanup(port);
22
- });
19
+ commandMap[command](port, cliCommand);
23
20
  //# sourceMappingURL=bin.js.map
@@ -187,6 +187,7 @@ var stop = async (port) => {
187
187
  composeOptions: ["-p", `port${port}`],
188
188
  log: true
189
189
  });
190
+ cleanup(port);
190
191
  };
191
192
  var cli = async (port, command) => {
192
193
  const runPath = getRunPath(port);
@@ -258,7 +259,6 @@ export {
258
259
  generateFiles,
259
260
  getConfigFilePath,
260
261
  getCliCommand,
261
- getPort,
262
- cleanup
262
+ getPort
263
263
  };
264
- //# sourceMappingURL=chunk-BYFZ2VGL.js.map
264
+ //# sourceMappingURL=chunk-UBXF6D42.js.map
package/dist/index.cjs CHANGED
@@ -38,6 +38,7 @@ module.exports = __toCommonJS(src_exports);
38
38
  // src/run.ts
39
39
  var import_docker_compose = require("docker-compose");
40
40
  var import_path = __toESM(require("path"), 1);
41
+ var import_fs = __toESM(require("fs"), 1);
41
42
  var import_node_os = __toESM(require("os"), 1);
42
43
  var waitForServer = async (url, timeoutMs) => {
43
44
  const startTime = Date.now();
@@ -75,6 +76,7 @@ var stop = async (port) => {
75
76
  composeOptions: ["-p", `port${port}`],
76
77
  log: true
77
78
  });
79
+ cleanup(port);
78
80
  };
79
81
  var cli = async (port, command) => {
80
82
  const runPath = getRunPath(port);
@@ -85,6 +87,12 @@ var cli = async (port, command) => {
85
87
  log: true
86
88
  });
87
89
  };
90
+ var getWpConfigPath = (port) => import_path.default.resolve(process.cwd(), port);
91
+ var cleanup = (port) => {
92
+ const runPath = getRunPath(port);
93
+ import_fs.default.rmSync(getWpConfigPath(port), { recursive: true, force: true });
94
+ import_fs.default.rmSync(runPath, { recursive: true, force: true });
95
+ };
88
96
  // Annotate the CommonJS export names for ESM import in node:
89
97
  0 && (module.exports = {
90
98
  cli,
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  cli,
3
3
  start,
4
4
  stop
5
- } from "./chunk-BYFZ2VGL.js";
5
+ } from "./chunk-UBXF6D42.js";
6
6
  export {
7
7
  cli,
8
8
  start,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/wp-lite-env",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "private": false,
5
5
  "description": "A simple, lightweight, docker-based WordPress environment",
6
6
  "main": "dist/index.cjs",
package/src/bin.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import {cleanup, commandMap, generateFiles, getCliCommand, getConfigFilePath, getPort} from './run';
3
+ import {commandMap, generateFiles, getCliCommand, getConfigFilePath, getPort} from './run';
4
4
 
5
5
  const command = process.argv[ 2 ];
6
6
  if ( ! commandMap[ command ] ) {
@@ -12,6 +12,4 @@ const configFilePath = getConfigFilePath( process.argv )
12
12
  const cliCommand = getCliCommand( process.argv );
13
13
  generateFiles( port, configFilePath );
14
14
 
15
- commandMap[command](port, cliCommand).finally( () => {
16
- cleanup( port );
17
- } );
15
+ commandMap[command](port, cliCommand);
package/src/run.ts CHANGED
@@ -52,6 +52,7 @@ export const stop = async ( port: string ) => {
52
52
  composeOptions: [ '-p', `port${ port }` ],
53
53
  log: true,
54
54
  } );
55
+ cleanup( port );
55
56
  };
56
57
 
57
58
  export const cli = async ( port: string, command: string ) => {
@@ -124,7 +125,7 @@ export const getPort = ( processArgs: string[] ) => {
124
125
  return getArgument( 'port', processArgs ) || '8888';
125
126
  };
126
127
 
127
- export const cleanup = ( port: string ) => {
128
+ const cleanup = ( port: string ) => {
128
129
  const runPath = getRunPath( port );
129
130
  fs.rmSync( getWpConfigPath( port ), { recursive: true, force: true } );
130
131
  fs.rmSync( runPath, { recursive: true, force: true } );