@ant-design/pro-cli
Advanced tools
Comparing version 2.1.4 to 2.1.5
{ | ||
"name": "@ant-design/pro-cli", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "The command tool for ant design pro", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -7,3 +7,8 @@ const fs = require('fs') | ||
const absolutePath = process.cwd() | ||
const content = fs.readFileSync(path.join(absolutePath, '/config/routes.ts'), 'utf-8') | ||
let content | ||
if (fs.existsSync(path.join(absolutePath, '/config/routes.ts'))) { | ||
content = fs.readFileSync(path.join(absolutePath, '/config/routes.ts'), 'utf-8') | ||
} else if (fs.existsSync(path.join(absolutePath, '/config/routes.js'))) { | ||
content = fs.readFileSync(path.join(absolutePath, '/config/routes.js'), 'utf-8') | ||
} else return | ||
const formatContent = content.replace('export default', 'module.exports =') | ||
@@ -10,0 +15,0 @@ fs.writeFileSync('./routes.js', formatContent) |
@@ -39,14 +39,11 @@ /* eslint-disable no-param-reassign */ | ||
if (filePath === 'config/config.ts') { | ||
if ( | ||
path.isIdentifier({ name: 'locale' }) && | ||
path.container.value.type === 'ObjectExpression' | ||
) { | ||
if (path.isIdentifier({name: "locale"}) && path.container.value.type === 'ObjectExpression') { | ||
// path.replaceWith(t.Identifier('')) | ||
path.parentPath.remove(); | ||
path.parentPath.remove() | ||
} | ||
} | ||
if (path.isIdentifier({ name: 'useIntl' })) { | ||
if (path.isIdentifier({name: "useIntl"})) { | ||
if (path.parentPath.parentPath.type === 'VariableDeclarator') { | ||
path.parentPath.parentPath.remove(); | ||
path.parentPath.parentPath.remove() | ||
} | ||
@@ -70,6 +67,5 @@ } | ||
} | ||
if (path.node.source.value === 'umi-plugin-react/locale') { | ||
path.remove(); | ||
return; | ||
return | ||
} | ||
@@ -107,2 +103,3 @@ } | ||
const message = genMessage(params, localeMap); | ||
const container = path.parentPath.parentPath; | ||
@@ -114,3 +111,3 @@ | ||
} | ||
return; | ||
return | ||
} | ||
@@ -177,3 +174,3 @@ const params = {}; | ||
// path.parentPath.parentPath.replaceWith(t.JSXOpeningElement(t.JSXIdentifier('span'), [t.JSXAttribute(t.JSXIdentifier('data-lang-tag'))], true)); | ||
path.parentPath.parentPath.parentPath.remove(); | ||
path.parentPath.parentPath.parentPath.remove() | ||
} | ||
@@ -183,7 +180,8 @@ | ||
// path.parentPath.replaceWith(t.JSXOpeningElement(t.JSXIdentifier('span'), [t.JSXAttribute(t.JSXIdentifier('data-lang-tag'))], true)); | ||
path.parentPath.parentPath.remove(); | ||
path.parentPath.parentPath.remove() | ||
} | ||
if (path.node.source && path.node.source.value === 'umi' && !path.node.specifiers.length) { | ||
path.remove(); | ||
path.remove() | ||
return | ||
} | ||
@@ -193,2 +191,3 @@ }, | ||
if (p.container && p.container.property && p.container.property.name === 'formatMessage') { | ||
const parent = p.parentPath; | ||
@@ -208,3 +207,4 @@ const { arguments: formatMessageArguments } = parent.container; | ||
} | ||
}, | ||
} | ||
}); | ||
@@ -211,0 +211,0 @@ }; |
54101
1642