Skip to content

Commit

Permalink
feat: add support for tmp path
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Aug 27, 2019
1 parent dca8b0f commit c5bdc4c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,13 @@ export class Application implements ApplicationContract {
public startPath (...paths: string[]): string {
return this.makePath(this.directoriesMap.get('start')!, ...paths)
}

/**
* Makes path to the tmp directory. Since the tmp path is used for
* writing at the runtime, we use `cwd` path to the write to the
* source and not the build directory.
*/
public tmpPath (...paths: string[]): string {
return this.makePathFromCwd(this.directoriesMap.get('tmp')!, ...paths)
}
}
1 change: 1 addition & 0 deletions src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ export interface ApplicationContract {
resourcesPath (...paths: string[]): string
viewsPath (...paths: string[]): string
startPath (...paths: string[]): string
tmpPath (...paths: string[]): string
}
1 change: 1 addition & 0 deletions src/rcParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const DEFAULT_DIRECTORIES = {
resources: 'resources',
views: 'resources/views',
start: 'start',
tmp: 'tmp',
}

/**
Expand Down
1 change: 1 addition & 0 deletions test/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test.group('Application', () => {
resources: 'resources',
views: 'resources/views',
start: 'start',
tmp: 'tmp',
})))

assert.deepEqual(app.autoloadsMap, new Map(Object.entries({})))
Expand Down
4 changes: 4 additions & 0 deletions test/rcfile-parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test.group('Rc Parser', () => {
seeds: 'database/seeds',
views: 'resources/views',
start: 'start',
tmp: 'tmp',
},
preloads: [],
autoloads: {},
Expand All @@ -44,6 +45,7 @@ test.group('Rc Parser', () => {
seeds: 'database/seeds',
views: 'resources/views',
start: 'start',
tmp: 'tmp',
},
preloads: [],
autoloads: {},
Expand All @@ -69,6 +71,7 @@ test.group('Rc Parser', () => {
seeds: 'database/seeds',
views: 'resources/views',
start: 'start',
tmp: 'tmp',
},
preloads: [{
file: 'foo',
Expand Down Expand Up @@ -97,6 +100,7 @@ test.group('Rc Parser', () => {
seeds: 'database/seeds',
views: 'resources/views',
start: 'start',
tmp: 'tmp',
},
preloads: [],
autoloads: {},
Expand Down

0 comments on commit c5bdc4c

Please sign in to comment.