Skip to content

Commit

Permalink
feat: finalize pack command
Browse files Browse the repository at this point in the history
Make cpy respect the file directory and zip properly.
  • Loading branch information
swashata committed Nov 12, 2018
1 parent 80d0376 commit 2e329dc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist
vendor
package

# Logs
logs
Expand Down
3 changes: 2 additions & 1 deletion examples/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"scripts": {
"bootstrap": "wpackio-scripts bootstrap",
"start": "wpackio-scripts start",
"build": "wpackio-scripts build"
"build": "wpackio-scripts build",
"archive": "wpackio-scripts pack"
},
"dependencies": {
"@types/webpack-env": "^1.13.6",
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/src/bin/pack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export function pack(options: ProgramOptions | undefined): void {
},
cwd
);
packer.pack();
} catch (e) {
spinner.stop();
prettyPrintError(e, 'could not start webpack compiler.');
Expand Down
9 changes: 5 additions & 4 deletions packages/scripts/src/scripts/Pack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ export class Pack {
}

private async copy(): Promise<void> {
return cpy(this.projectConfig.packageFiles, this.packageSlugPath).on(
'progress',
this.callbacks.onCopyProgress
);
return cpy(this.projectConfig.packageFiles, this.packageSlugPath, {
parents: true,
cwd: this.cwd,
root: this.packageSlugPath,
}).on('progress', this.callbacks.onCopyProgress);
}

private async zip(): Promise<ArchiveResolve> {
Expand Down

0 comments on commit 2e329dc

Please sign in to comment.