mirror of
https://github.com/developit/microbundle.git
synced 2026-01-18 13:56:35 +00:00
Move safeVariableName near getName
It is only called in getName
This commit is contained in:
parent
b696954a15
commit
3fc623a6b6
14
src/index.js
14
src/index.js
@ -24,12 +24,7 @@ import { readFile, isDir, isFile, stdout, stderr } from './utils';
|
||||
import camelCase from 'camelcase';
|
||||
|
||||
const removeScope = name => name.replace(/^@.*\//, '');
|
||||
const safeVariableName = name =>
|
||||
camelCase(
|
||||
removeScope(name)
|
||||
.toLowerCase()
|
||||
.replace(/((^[^a-zA-Z]+)|[^\w.-])|([^a-zA-Z0-9]+$)/g, ''),
|
||||
);
|
||||
|
||||
const parseGlobals = globalStrings => {
|
||||
const globals = {};
|
||||
globalStrings.split(',').forEach(globalString => {
|
||||
@ -228,6 +223,13 @@ async function getConfigFromPkgJson(cwd) {
|
||||
}
|
||||
}
|
||||
|
||||
const safeVariableName = name =>
|
||||
camelCase(
|
||||
removeScope(name)
|
||||
.toLowerCase()
|
||||
.replace(/((^[^a-zA-Z]+)|[^\w.-])|([^a-zA-Z0-9]+$)/g, ''),
|
||||
);
|
||||
|
||||
function getName({ name, pkgName, amdName, cwd, hasPackageJson }) {
|
||||
if (!pkgName) {
|
||||
pkgName = basename(cwd);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user