forked from NervJS/taro
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: getLocation's Authorization changeto @react-native-community/ge…
…olocation (#266)
- Loading branch information
1 parent
b1c5764
commit 65b479a
Showing
5 changed files
with
108 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const { parseDependencyTree } = require('dpdm') | ||
const { peerDependencies } = require('./package.json') | ||
|
||
const hiddenDependenciesMap = { | ||
'@ant-design/react-native/lib/picker': ['@react-native-picker/picker'] | ||
} | ||
|
||
const componentReg = /^src\/components\/(\w+)\/index.tsx$/ | ||
|
||
function parseDependencyCircular(dep = [], tree = {}) { | ||
dep.forEach(d => { | ||
const item = tree[d.id] | ||
if (item) { | ||
dep = dep.concat(parseDependencyCircular(item, tree)) | ||
} | ||
}) | ||
return dep | ||
} | ||
|
||
parseDependencyTree('./src/index.ts', {}).then((tree) => { | ||
const result = {} | ||
Object.keys(tree).map(key => { | ||
const match = key.match(componentReg) | ||
if (match) { | ||
const name = match[1] | ||
parseDependencyCircular(tree[key], tree).map(dependency => { | ||
const dep = dependency.id | ||
if (dep) { | ||
[...Object.keys(peerDependencies), ...Object.keys(hiddenDependenciesMap)].forEach(value => { | ||
if (dep.match(`node_modules/${value}`)) { | ||
result[name] = result[name] || new Set() | ||
if (hiddenDependenciesMap[value]) { | ||
hiddenDependenciesMap[value].forEach(value => { | ||
const showName = peerDependencies[value] ? `${value}@${peerDependencies[value]}` : value | ||
result[name].add(showName) | ||
}) | ||
} else { | ||
const showName = peerDependencies[value] ? `${value}@${peerDependencies[value]}` : value | ||
result[name].add(showName) | ||
} | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
console.log(result) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const { parseDependencyTree } = require('dpdm') | ||
const { peerDependencies } = require('./package.json') | ||
|
||
const hiddenDependenciesMap = { | ||
'@ant-design/react-native/lib/picker': ['@react-native-picker/picker'] | ||
} | ||
|
||
const componentReg = /^src\/lib\/(\w+)\/index.tsx?$/ | ||
|
||
function parseDependencyCircular(dep = [], tree = {}) { | ||
dep.forEach(d => { | ||
const item = tree[d.id] | ||
if (item) { | ||
dep = dep.concat(parseDependencyCircular(item, tree)) | ||
} | ||
}) | ||
return dep | ||
} | ||
|
||
parseDependencyTree('./src/lib/index.ts', {}).then((tree) => { | ||
const result = {} | ||
Object.keys(tree).map(key => { | ||
const match = key.match(componentReg) | ||
if (match) { | ||
const name = match[1] | ||
parseDependencyCircular(tree[key], tree).map(dependency => { | ||
const dep = dependency.id | ||
if (dep) { | ||
[...Object.keys(peerDependencies), ...Object.keys(hiddenDependenciesMap)].forEach(value => { | ||
if (dep.match(`node_modules/${value}`)) { | ||
result[name] = result[name] || new Set() | ||
if (hiddenDependenciesMap[value]) { | ||
hiddenDependenciesMap[value].forEach(value => { | ||
const showName = peerDependencies[value] ? `${value}@${peerDependencies[value]}` : value | ||
result[name].add(showName) | ||
}) | ||
} else { | ||
const showName = peerDependencies[value] ? `${value}@${peerDependencies[value]}` : value | ||
result[name].add(showName) | ||
} | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
console.log(result) | ||
}) |
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