generated from spautz/package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul demo app and improve scaffolding
- Loading branch information
Showing
20 changed files
with
2,396 additions
and
2,108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,51 @@ | ||
const path = require('path'); | ||
const resolveFrom = require('resolve-from'); | ||
|
||
const packageJson = require('./package.json'); | ||
|
||
console.log('packageJson = ', packageJson); | ||
|
||
function addAliasForLocalPackage(packageName) { | ||
try { | ||
const aliasName = `${packageName}\$`; | ||
if (!aliases[aliasName]) { | ||
aliases[aliasName] = resolveFrom(path.resolve('node_modules'), packageName); | ||
} | ||
} catch (e) { | ||
// It's ok if we can't resolve: @types and bin packages (like react-scripts) don't have a main import | ||
} | ||
} | ||
|
||
// ================================================================================================ | ||
|
||
const aliases = { | ||
'reactquery-to-redux$': resolveFrom(path.resolve('../..'), '.'), | ||
}; | ||
|
||
console.log('aliases = ', aliases); | ||
|
||
Object.keys(packageJson.dependencies).map(addAliasForLocalPackage); | ||
Object.keys(packageJson.devDependencies).map(addAliasForLocalPackage); | ||
|
||
console.log('aliases = ', aliases); | ||
|
||
// Based on https://gist.github.com/tannerlinsley/4778cf30d66530ea9802899168119ec0 | ||
const fixLinkedDependencies = (config) => { | ||
config.resolve = { | ||
...config.resolve, | ||
alias: { | ||
...config.resolve.alias, | ||
...aliases, | ||
}, | ||
}; | ||
return config; | ||
}; | ||
|
||
const allowOutsideSrc = (config) => { | ||
config.resolve.plugins = config.resolve.plugins.filter( | ||
(p) => p.constructor.name !== 'ModuleScopePlugin', | ||
); | ||
return config; | ||
}; | ||
|
||
module.exports = [fixLinkedDependencies, allowOutsideSrc]; |
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
25 changes: 15 additions & 10 deletions
25
demos/from-reactquery-to-redux/package.json → demos/todo-list/package.json
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
Oops, something went wrong.