@arco-cli/migration-helper
Advanced tools
@@ -159,3 +159,4 @@ "use strict"; | ||
envConfig: 'arco.env.config.js', | ||
jestConfig: 'jest.config.js' | ||
jestConfig: 'jest.config.js', | ||
workspaceHook: '.scripts/workspaceHooks/afterComponentCreated.js' | ||
}; | ||
@@ -162,0 +163,0 @@ Object.entries(tplFilePathMap).forEach(([, filePath]) => { |
@@ -18,2 +18,3 @@ "use strict"; | ||
_yargs.default.scriptName('arco-migrate').command('migrate', 'migrate project to arco cli v2', yargs => { | ||
const includeExample = '"packages/*/src" "components/*"'; | ||
return yargs.option('noEmit', { | ||
@@ -24,5 +25,6 @@ type: 'boolean', | ||
type: 'string', | ||
describe: 'glob patterns to the component directories' | ||
demandOption: `option [include] is required, pass the glob pattern of component directories that need to be migrated. e.g. ${includeExample}`, | ||
describe: `glob patterns to the component directories, e.g. ${includeExample}` | ||
}); | ||
}, options => migrate(options)).help().argv; | ||
//# sourceMappingURL=app.js.map |
@@ -12,2 +12,3 @@ "use strict"; | ||
var _path = _interopRequireDefault(require("path")); | ||
var _ora = _interopRequireDefault(require("ora")); | ||
var _lodash = require("lodash"); | ||
@@ -31,3 +32,3 @@ var _utils = require("./utils"); | ||
const { | ||
componentDirPatterns | ||
componentDirPatterns = [] | ||
} = this.options; | ||
@@ -79,2 +80,5 @@ const componentDirs = (0, _glob.sync)((Array.isArray(componentDirPatterns) ? componentDirPatterns : [componentDirPatterns]).map(pattern => _path.default.resolve(pattern))).filter(dirPath => _fsExtra.default.lstatSync(dirPath).isDirectory()); | ||
run() { | ||
const spinner = (0, _ora.default)(); | ||
const tipAdaptWorkspaceConfig = 'adapt workspace config'; | ||
spinner.start(tipAdaptWorkspaceConfig); | ||
// adapt project | ||
@@ -88,5 +92,8 @@ const workspaceAdapter = new _workspaceAdapter.WorkspaceAdapter({ | ||
workspaceAdapter.run(); | ||
spinner.succeed(tipAdaptWorkspaceConfig); | ||
// adapt components | ||
this.componentDirs.forEach(componentDir => { | ||
const tip = `adapt workspace component in [${_path.default.relative(this.options.root, componentDir)}]`; | ||
spinner.start(tip); | ||
const adapter = new _componentAdapter.ComponentAdapter({ | ||
@@ -101,2 +108,3 @@ workspaceRoot: this.options.root, | ||
adapter.run(); | ||
spinner.succeed(tip); | ||
}); | ||
@@ -106,2 +114,4 @@ | ||
[...new Set(this.componentInfoList.map(info => info.package.path))].forEach(packageDir => { | ||
const tip = `adapt component package in [${_path.default.relative(this.options.root, packageDir)}]`; | ||
spinner.start(tip); | ||
const adapter = new _packageAdapter.PackageAdapter({ | ||
@@ -114,6 +124,14 @@ workspaceRoot: this.options.root, | ||
adapter.run(); | ||
spinner.succeed(tip); | ||
}); | ||
const tipRegisterComponents = 'register components to workspace config'; | ||
spinner.start(tipRegisterComponents); | ||
// register components to workspace config | ||
this.registerWorkspaceComponents(); | ||
try { | ||
this.registerWorkspaceComponents(); | ||
spinner.succeed(tipRegisterComponents); | ||
} catch (err) { | ||
spinner.fail(tipRegisterComponents); | ||
console.error(err); | ||
} | ||
} | ||
@@ -120,0 +138,0 @@ } |
{ | ||
"name": "@arco-cli/migration-helper", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"main": "./dist/index.js", | ||
"bin": { | ||
"arco-migirate": "./bin/arco-migerate" | ||
"arco-migrate": "./bin/arco-migrate" | ||
}, | ||
@@ -35,3 +35,3 @@ "scripts": { | ||
"license": "MIT", | ||
"gitHead": "c516a1b36b9b77b102fb4501d68c3b8b79a5383f" | ||
"gitHead": "78719e9d8efa295826bbdb33abb388f316fb4041" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
82494
4.25%664
3.43%0
-100%