@akanjs/devkit 0.9.56 → 0.9.58-canary.0

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.
@@ -222,10 +222,10 @@ class Executor {
222
222
  this.logger.verbose(`Remove file ${readPath}`);
223
223
  return this;
224
224
  }
225
- removeDir(dirPath) {
225
+ async removeDir(dirPath) {
226
226
  const readPath = this.getPath(dirPath);
227
227
  if (import_fs.default.existsSync(readPath))
228
- import_fs.default.rmSync(readPath, { recursive: true });
228
+ await import_fs.default.promises.rm(readPath, { recursive: true });
229
229
  this.logger.verbose(`Remove directory ${readPath}`);
230
230
  return this;
231
231
  }
@@ -271,9 +271,9 @@ class Executor {
271
271
  async cp(srcPath, destPath) {
272
272
  const src = this.getPath(srcPath);
273
273
  const dest = this.getPath(destPath);
274
- const isDirectory = import_fs.default.statSync(src).isDirectory();
275
274
  if (!import_fs.default.existsSync(src))
276
275
  return;
276
+ const isDirectory = import_fs.default.statSync(src).isDirectory();
277
277
  if (!import_fs.default.existsSync(dest) && isDirectory)
278
278
  await import_promises.default.mkdir(dest, { recursive: true });
279
279
  await import_promises.default.cp(src, dest, { recursive: true });
@@ -829,32 +829,23 @@ class AppExecutor extends SysExecutor {
829
829
  return this.#akanConfig;
830
830
  }
831
831
  async syncAssets(libDeps) {
832
- const projectPublicLibPath = `${this.cwdPath}/public/libs`;
833
- const projectAssetsLibPath = `${this.cwdPath}/assets/libs`;
834
- await Promise.all([
835
- import_fs.default.existsSync(projectPublicLibPath) && import_promises.default.rm(projectPublicLibPath, { recursive: true }),
836
- import_fs.default.existsSync(projectAssetsLibPath) && import_promises.default.rm(projectAssetsLibPath, { recursive: true })
837
- ]);
838
- const targetPublicDeps = libDeps.filter(
839
- (dep) => import_fs.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`)
840
- );
841
- const targetAssetsDeps = libDeps.filter(
842
- (dep) => import_fs.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/assets`)
843
- );
832
+ const projectPublicPath = `${this.cwdPath}/public`;
833
+ const projectAssetsPath = `${this.cwdPath}/assets`;
834
+ const projectPublicLibPath = `${projectPublicPath}/libs`;
835
+ const projectAssetsLibPath = `${projectAssetsPath}/libs`;
836
+ await Promise.all([this.removeDir(projectPublicLibPath), this.removeDir(projectAssetsLibPath)]);
837
+ const targetPublicDeps = libDeps.filter((dep) => this.exists(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
838
+ const targetAssetsDeps = libDeps.filter((dep) => this.exists(`${this.workspace.workspaceRoot}/libs/${dep}/assets`));
844
839
  await Promise.all([
845
- ...targetPublicDeps.map((dep) => import_promises.default.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })),
846
- ...targetAssetsDeps.map((dep) => import_promises.default.mkdir(`${projectAssetsLibPath}/${dep}`, { recursive: true }))
840
+ ...targetPublicDeps.map((dep) => this.mkdir(`${projectPublicLibPath}/${dep}`)),
841
+ ...targetAssetsDeps.map((dep) => this.mkdir(`${projectAssetsLibPath}/${dep}`))
847
842
  ]);
848
843
  await Promise.all([
849
844
  ...targetPublicDeps.map(
850
- (dep) => import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
851
- recursive: true
852
- })
845
+ (dep) => this.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`)
853
846
  ),
854
847
  ...targetAssetsDeps.map(
855
- (dep) => import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`, {
856
- recursive: true
857
- })
848
+ (dep) => this.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`)
858
849
  )
859
850
  ]);
860
851
  }
@@ -182,10 +182,10 @@ class Executor {
182
182
  this.logger.verbose(`Remove file ${readPath}`);
183
183
  return this;
184
184
  }
185
- removeDir(dirPath) {
185
+ async removeDir(dirPath) {
186
186
  const readPath = this.getPath(dirPath);
187
187
  if (fs.existsSync(readPath))
188
- fs.rmSync(readPath, { recursive: true });
188
+ await fs.promises.rm(readPath, { recursive: true });
189
189
  this.logger.verbose(`Remove directory ${readPath}`);
190
190
  return this;
191
191
  }
@@ -231,9 +231,9 @@ class Executor {
231
231
  async cp(srcPath, destPath) {
232
232
  const src = this.getPath(srcPath);
233
233
  const dest = this.getPath(destPath);
234
- const isDirectory = fs.statSync(src).isDirectory();
235
234
  if (!fs.existsSync(src))
236
235
  return;
236
+ const isDirectory = fs.statSync(src).isDirectory();
237
237
  if (!fs.existsSync(dest) && isDirectory)
238
238
  await fsPromise.mkdir(dest, { recursive: true });
239
239
  await fsPromise.cp(src, dest, { recursive: true });
@@ -789,32 +789,23 @@ class AppExecutor extends SysExecutor {
789
789
  return this.#akanConfig;
790
790
  }
791
791
  async syncAssets(libDeps) {
792
- const projectPublicLibPath = `${this.cwdPath}/public/libs`;
793
- const projectAssetsLibPath = `${this.cwdPath}/assets/libs`;
794
- await Promise.all([
795
- fs.existsSync(projectPublicLibPath) && fsPromise.rm(projectPublicLibPath, { recursive: true }),
796
- fs.existsSync(projectAssetsLibPath) && fsPromise.rm(projectAssetsLibPath, { recursive: true })
797
- ]);
798
- const targetPublicDeps = libDeps.filter(
799
- (dep) => fs.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`)
800
- );
801
- const targetAssetsDeps = libDeps.filter(
802
- (dep) => fs.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/assets`)
803
- );
792
+ const projectPublicPath = `${this.cwdPath}/public`;
793
+ const projectAssetsPath = `${this.cwdPath}/assets`;
794
+ const projectPublicLibPath = `${projectPublicPath}/libs`;
795
+ const projectAssetsLibPath = `${projectAssetsPath}/libs`;
796
+ await Promise.all([this.removeDir(projectPublicLibPath), this.removeDir(projectAssetsLibPath)]);
797
+ const targetPublicDeps = libDeps.filter((dep) => this.exists(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
798
+ const targetAssetsDeps = libDeps.filter((dep) => this.exists(`${this.workspace.workspaceRoot}/libs/${dep}/assets`));
804
799
  await Promise.all([
805
- ...targetPublicDeps.map((dep) => fsPromise.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })),
806
- ...targetAssetsDeps.map((dep) => fsPromise.mkdir(`${projectAssetsLibPath}/${dep}`, { recursive: true }))
800
+ ...targetPublicDeps.map((dep) => this.mkdir(`${projectPublicLibPath}/${dep}`)),
801
+ ...targetAssetsDeps.map((dep) => this.mkdir(`${projectAssetsLibPath}/${dep}`))
807
802
  ]);
808
803
  await Promise.all([
809
804
  ...targetPublicDeps.map(
810
- (dep) => fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
811
- recursive: true
812
- })
805
+ (dep) => this.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`)
813
806
  ),
814
807
  ...targetAssetsDeps.map(
815
- (dep) => fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`, {
816
- recursive: true
817
- })
808
+ (dep) => this.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`)
818
809
  )
819
810
  ]);
820
811
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "0.9.56",
3
+ "version": "0.9.58-canary.0",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -40,7 +40,7 @@ export declare class Executor {
40
40
  }>;
41
41
  exists(filePath: string): boolean;
42
42
  remove(filePath: string): this;
43
- removeDir(dirPath: string): this;
43
+ removeDir(dirPath: string): Promise<this>;
44
44
  writeFile(filePath: string, content: string | object, { overwrite }?: {
45
45
  overwrite?: boolean;
46
46
  }): FileContent;