Added monorepo-merge Tool Scaffolding
This contains the basic framework for our new `monorepo-merge` command. The goal will be for this command to handle the heavy lifting for merging repositories with full history. It will (ideally) bring any plugin or package into the repository in a ready-to-use state.
This commit is contained in:
parent
5af5be5100
commit
ed77233fb4
12745
pnpm-lock.yaml
12745
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,4 @@
|
||||||
packages:
|
packages:
|
||||||
- 'packages/js/**'
|
- 'packages/js/**'
|
||||||
- 'plugins/**'
|
- 'plugins/**'
|
||||||
|
- 'tools/monorepo-merge'
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/dist
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"ignorePatterns": [ "dist/", "node_modules/" ],
|
||||||
|
"plugins": [ "@typescript-eslint/eslint-plugin" ],
|
||||||
|
"extends": [ "plugin:@wordpress/eslint-plugin/recommended-with-formatting" ],
|
||||||
|
"rules": {
|
||||||
|
"no-unused-vars": "off"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
/oclif.manifest.json
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const oclif = require('@oclif/core')
|
||||||
|
|
||||||
|
const path = require('path')
|
||||||
|
const project = path.join(__dirname, '..', 'tsconfig.json')
|
||||||
|
|
||||||
|
// In dev mode -> use ts-node and dev plugins
|
||||||
|
process.env.NODE_ENV = 'development'
|
||||||
|
|
||||||
|
require('ts-node').register({project})
|
||||||
|
|
||||||
|
// In dev mode, always show stack traces
|
||||||
|
oclif.settings.debug = true;
|
||||||
|
|
||||||
|
// Start the CLI
|
||||||
|
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
|
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
node "%~dp0\dev" %*
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const oclif = require('@oclif/core')
|
||||||
|
|
||||||
|
oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))
|
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
node "%~dp0\run" %*
|
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"name": "monorepo-merge",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "A tool for merging repositories into the WooCommerce Monorepo.",
|
||||||
|
"author": "Automattic",
|
||||||
|
"bin": {
|
||||||
|
"monorepo-merge": "./bin/run"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/woocommerce/woocommerce",
|
||||||
|
"license": "GPLv2",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"repository": "woocommerce/woocommerce",
|
||||||
|
"files": [
|
||||||
|
"/bin",
|
||||||
|
"/dist",
|
||||||
|
"/npm-shrinkwrap.json",
|
||||||
|
"/oclif.manifest.json"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@oclif/core": "^1",
|
||||||
|
"@oclif/plugin-help": "^5",
|
||||||
|
"@oclif/plugin-plugins": "^2.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^16.9.4",
|
||||||
|
"eslint": "^7.32.0",
|
||||||
|
"globby": "^11",
|
||||||
|
"oclif": "^2",
|
||||||
|
"shx": "^0.3.3",
|
||||||
|
"ts-node": "^10.2.1",
|
||||||
|
"tslib": "^2.3.1",
|
||||||
|
"typescript": "^4.4.3"
|
||||||
|
},
|
||||||
|
"oclif": {
|
||||||
|
"bin": "monorepo-merge",
|
||||||
|
"dirname": "monorepo-merge",
|
||||||
|
"commands": "./dist/commands",
|
||||||
|
"plugins": [
|
||||||
|
"@oclif/plugin-help",
|
||||||
|
"@oclif/plugin-plugins"
|
||||||
|
],
|
||||||
|
"topicSeparator": " ",
|
||||||
|
"topics": {
|
||||||
|
"merge": {
|
||||||
|
"description": "Merges other repositories into the monorepo."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "shx rm -rf dist && tsc -b",
|
||||||
|
"lint": "eslint . --ext .ts --config .eslintrc",
|
||||||
|
"postpack": "shx rm -f oclif.manifest.json",
|
||||||
|
"posttest": "pnpm lint",
|
||||||
|
"prepack": "pnpm build && oclif manifest"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
},
|
||||||
|
"types": "dist/index.d.ts"
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
import { Command } from '@oclif/core';
|
||||||
|
|
||||||
|
export default class Merge extends Command {
|
||||||
|
static description =
|
||||||
|
'Merges another repository into this one with history.';
|
||||||
|
|
||||||
|
static args = [
|
||||||
|
{
|
||||||
|
name: 'source',
|
||||||
|
description: 'The GitHub repository we are merging from.',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'destination',
|
||||||
|
description:
|
||||||
|
'The local destination for the repository to be merged at.',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
async run(): Promise< void > {
|
||||||
|
const { args } = await this.parse( Merge );
|
||||||
|
|
||||||
|
this.log( 'It has begun' );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
export { run } from '@oclif/core';
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
|
"importHelpers": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"outDir": "dist",
|
||||||
|
"rootDir": "src",
|
||||||
|
"strict": true,
|
||||||
|
"target": "es2019"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue