-
-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for none config in dotfolder (#1637)
* feat: add support for none config in dotfolder * feat: add support for picking config as per mode * feat: add support for picking config as per mode * tests: add config test for dev config in diff folders * tests: prefer .webpack over root config * tests: prefer .webpack over root config
- Loading branch information
Showing
21 changed files
with
184 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, '../binary'), | ||
filename: 'none.bundle.js', | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.
10 changes: 8 additions & 2 deletions
10
test/config/multiple/multiple-config.test.js → ...nfig/multiple/all/multiple-config.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
test/config/multiple/multiple-location/.webpack/webpack.config.development.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, '../binary'), | ||
filename: 'dev.folder.js', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Tanjiro") |
23 changes: 23 additions & 0 deletions
23
test/config/multiple/multiple-location/multiple-location-config.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const { stat } = require('fs'); | ||
const { resolve, join } = require('path'); | ||
const { run } = require('../../../utils/test-utils'); | ||
const rimraf = require('rimraf'); | ||
|
||
const outputPath = join(__dirname, 'binary'); | ||
|
||
describe('multiple dev config files with webpack.config.js', () => { | ||
afterEach(() => rimraf.sync(outputPath)); | ||
beforeAll(() => rimraf.sync(outputPath)); | ||
|
||
it('Uses webpack.config.development.js', (done) => { | ||
const { stdout, stderr } = run(__dirname, [], false); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).not.toBe(undefined); | ||
stat(resolve(__dirname, './binary/dev.folder.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/config/multiple/multiple-location/webpack.config.development.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, './binary'), | ||
filename: 'development.bundle.js', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, './binary'), | ||
filename: 'root.bundle.js', | ||
}, | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/config/multiple/none and dev/.webpack/webpack.config.dev.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, '../binary'), | ||
filename: 'dev.bundle.js', | ||
}, | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/config/multiple/none and dev/.webpack/webpack.config.none.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, '../binary'), | ||
filename: 'none.bundle.js', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const { stat } = require('fs'); | ||
const { resolve, join } = require('path'); | ||
const { run } = require('../../../utils/test-utils'); | ||
const rimraf = require('rimraf'); | ||
|
||
const outputPath = join(__dirname, 'binary'); | ||
|
||
describe('multiple config files', () => { | ||
afterEach(() => rimraf.sync(outputPath)); | ||
beforeAll(() => rimraf.sync(outputPath)); | ||
|
||
it('Uses dev config when both dev and none are present', (done) => { | ||
const { stdout, stderr } = run(__dirname, [], false); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).not.toBe(undefined); | ||
stat(resolve(__dirname, './binary/dev.bundle.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Kageyama") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Iwaizumi") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const { stat } = require('fs'); | ||
const { resolve, join } = require('path'); | ||
const { run } = require('../../../utils/test-utils'); | ||
const rimraf = require('rimraf'); | ||
|
||
const outputPath = join(__dirname, 'binary'); | ||
|
||
describe('multiple config files', () => { | ||
afterEach(() => rimraf.sync(outputPath)); | ||
beforeAll(() => rimraf.sync(outputPath)); | ||
|
||
it('Uses dev config when development mode is supplied', (done) => { | ||
const { stdout, stderr } = run(__dirname, ['--mode', 'development'], false); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).not.toBe(undefined); | ||
stat(resolve(__dirname, './binary/dev.bundle.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, './binary'), | ||
filename: 'dev.bundle.js', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, './binary'), | ||
filename: 'none.bundle.js', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
output: { | ||
path: resolve(__dirname, './binary'), | ||
filename: 'prod.bundle.js', | ||
}, | ||
}; |