Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): expanded preview #267

Merged
merged 40 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
879f751
draft 01
louis-bompart Jun 17, 2021
e4023c3
better merging
louis-bompart Jun 17, 2021
36552f1
strong type
louis-bompart Jun 17, 2021
67da6e3
merge master
louis-bompart Jul 12, 2021
b29bd4c
refresh PR
louis-bompart Jul 12, 2021
ab06b57
Merge branch 'master' into CDX-347
louis-bompart Jul 20, 2021
03ff235
ironing merge
louis-bompart Jul 20, 2021
e59a412
Working (with #365)
louis-bompart Jul 21, 2021
835399d
Merge branch 'master' into CDX-347
louis-bompart Jul 22, 2021
d9767d1
smoothing up
louis-bompart Jul 22, 2021
ca1bf53
prettier
louis-bompart Jul 22, 2021
ba24983
lint
louis-bompart Jul 22, 2021
e1b9a3f
spec
louis-bompart Jul 22, 2021
e31ec7f
add epoch sort + ut on old preview deletion
louis-bompart Jul 23, 2021
5a7ecb6
Merge branch 'master' into CDX-347
louis-bompart Jul 26, 2021
e7d4f09
viewer->previewer
louis-bompart Jul 26, 2021
2fd57e9
jsdoc
louis-bompart Jul 26, 2021
598373a
UT progress
louis-bompart Jul 26, 2021
c1db556
refactor file diff processor
louis-bompart Jul 27, 2021
8e60f66
adapt test for refactor
louis-bompart Jul 27, 2021
75f5386
prepare UT for filesDiffProcessor
louis-bompart Jul 28, 2021
e0b7740
rework filesDiffProcessor
louis-bompart Jul 28, 2021
09eae21
UT complete
louis-bompart Jul 28, 2021
a8cf76c
Merge branch 'master' into CDX-347
louis-bompart Jul 28, 2021
6ed4033
merge master into CDX-347
louis-bompart Jul 29, 2021
505feb5
tweak code for project change
louis-bompart Jul 29, 2021
abb330a
Merge branch 'master' into CDX-347
louis-bompart Jul 29, 2021
b0aacd0
Update expandedPreviewer.spec.ts
louis-bompart Jul 29, 2021
3aff71f
Merge branch 'master' into CDX-347
louis-bompart Jul 29, 2021
4cc7203
Merge branch 'master' into CDX-347
louis-bompart Jul 30, 2021
050587a
Merge branch 'master' into CDX-347
louis-bompart Jul 30, 2021
859184a
Merge branch 'master' into CDX-347
y-lakhdar Aug 2, 2021
55cc774
Merge branch 'master' into CDX-347
louis-bompart Aug 2, 2021
babb3b4
handle project absolute path v. relative path in exp preview
louis-bompart Aug 3, 2021
491006f
skip delete if no preview dir
louis-bompart Aug 4, 2021
ef9126f
Merge branch 'master' into CDX-347
louis-bompart Aug 4, 2021
4685eed
Merge branch 'master' into CDX-347
louis-bompart Aug 4, 2021
5c26e46
Merge branch 'master' into CDX-347
y-lakhdar Aug 9, 2021
bf73fee
Merge branch 'master' into CDX-347
louis-bompart Aug 9, 2021
82277b9
Merge branch 'master' into CDX-347
louis-bompart Aug 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 23 additions & 127 deletions packages/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
"@oclif/plugin-help": "^3",
"@oclif/plugin-update": "^1.3.10",
"@openid/appauth": "^1.3.0",
"@types/decompress": "^4.2.3",
"@vue/cli": "^4.5.11",
"abortcontroller-polyfill": "^1.7.1",
"archiver": "^5.3.0",
"async-retry": "^1.3.1",
"chalk": "^4.1.1",
"cli-ux": "^5.5.1",
"coveo.analytics": "^2.18.4",
"create-react-app": "^4.0.3",
"decompress": "^4.2.1",
"exponential-backoff": "^3.1.0",
"fs-extra": "^9.1.0",
"isomorphic-fetch": "^3.0.0",
Expand All @@ -38,6 +41,7 @@
"@oclif/errors": "^1.3.4",
"@oclif/test": "^1",
"@types/archiver": "^5.1.0",
"@types/async-retry": "^1.4.2",
"@types/cli-progress": "^3.9.1",
"@types/fs-extra": "^9.0.6",
"@types/jest": "^26.0.22",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/org/config/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class Preview extends Command {

cli.action.stop(isValid ? green('✔') : red.bold('!'));

await snapshot.preview();
await snapshot.preview(project.resourcesPath);

if (isValid) {
await snapshot.delete();
Expand Down
15 changes: 7 additions & 8 deletions packages/cli/src/lib/project/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class Project {
}

public deleteTemporaryZipFile() {
unlinkSync(this.pathToTemporaryZip);
unlinkSync(this.temporaryZipPath);
}

public ensureProjectCompliance() {
Expand All @@ -19,36 +19,35 @@ export class Project {
* * Check if the root has a valid config file
*/

if (!existsSync(this.pathToResources)) {
if (!existsSync(this.resourcesPath)) {
throw new Error('Invalid Project. TODO: better error message');
}
}

public async compressResources() {
try {
await new Promise<void>((resolve, reject) => {
const pathToTemporaryZip = this.pathToTemporaryZip;
const outputStream = createWriteStream(pathToTemporaryZip);
const outputStream = createWriteStream(this.temporaryZipPath);
const archive = archiver('zip');

outputStream.on('close', () => resolve());
archive.on('error', (err) => reject(err));

archive.pipe(outputStream);
archive.directory(this.pathToResources, false);
archive.directory(this.resourcesPath, false);
archive.finalize();
});
return this.pathToTemporaryZip;
return this.temporaryZipPath;
} catch (error) {
cli.error(error);
}
}

private get pathToTemporaryZip() {
private get temporaryZipPath() {
return join(this.pathToProject, 'snapshot.zip');
}

private get pathToResources() {
public get resourcesPath() {
return join(this.pathToProject, 'resources');
}
}
Loading