Monorepo CLI tooling: Set folder organisation (#37561)
This commit is contained in:
parent
450d9e9c8c
commit
c4a7e9a11b
|
@ -22,7 +22,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
npm install -g pnpm@7
|
npm install -g pnpm@7
|
||||||
npm -g i @wordpress/env@5.1.0
|
npm -g i @wordpress/env@5.1.0
|
||||||
pnpm install --filter code-analyzer --filter cli-core
|
pnpm install --filter monorepo-utils --filter code-analyzer --filter cli-core
|
||||||
- name: Run analyzer
|
- name: Run analyzer
|
||||||
id: run
|
id: run
|
||||||
working-directory: tools/code-analyzer
|
working-directory: tools/code-analyzer
|
||||||
|
|
|
@ -17,16 +17,20 @@
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||||
},
|
},
|
||||||
|
"bin": {
|
||||||
|
"utils": "./tools/monorepo-utils/dist/index.js"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm exec turbo run turbo:build",
|
"build": "pnpm exec turbo run turbo:build",
|
||||||
"test": "pnpm exec turbo run turbo:test",
|
"test": "pnpm exec turbo run turbo:test",
|
||||||
"clean": "pnpm store prune && git clean -fx **/node_modules && pnpm i",
|
"clean": "pnpm store prune && git clean -fx **/node_modules && pnpm i",
|
||||||
"preinstall": "npx only-allow pnpm",
|
"preinstall": "npx only-allow pnpm",
|
||||||
"postinstall": "pnpm git:update-hooks",
|
"postinstall": "pnpm git:update-hooks && pnpm run --filter='./tools/monorepo-utils' build",
|
||||||
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && husky install",
|
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && husky install",
|
||||||
"create-extension": "node ./tools/create-extension/index.js",
|
"create-extension": "node ./tools/create-extension/index.js",
|
||||||
"cherry-pick": "node ./tools/cherry-pick/bin/run",
|
"cherry-pick": "node ./tools/cherry-pick/bin/run",
|
||||||
"sync-dependencies": "pnpm exec syncpack -- fix-mismatches"
|
"sync-dependencies": "pnpm exec syncpack -- fix-mismatches",
|
||||||
|
"utils": "./tools/monorepo-utils/dist/index.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-env": "^7.20.2",
|
"@babel/preset-env": "^7.20.2",
|
||||||
|
|
2107
pnpm-lock.yaml
2107
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -11,3 +11,4 @@ packages:
|
||||||
- 'tools/cli-core'
|
- 'tools/cli-core'
|
||||||
- 'tools/version-bump'
|
- 'tools/version-bump'
|
||||||
- 'tools/storybook'
|
- 'tools/storybook'
|
||||||
|
- 'tools/monorepo-utils'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ['plugin:@woocommerce/eslint-plugin/recommended'],
|
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
|
||||||
root: true,
|
root: true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
|
||||||
|
root: true,
|
||||||
|
};
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Monorepo Utils
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Monorepo utilities and tooling.
|
|
@ -0,0 +1,6 @@
|
||||||
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||||
|
module.exports = {
|
||||||
|
preset: 'ts-jest',
|
||||||
|
testEnvironment: 'node',
|
||||||
|
testPathIgnorePatterns: [ '<rootDir>/dist/', '<rootDir>/node_modules/' ],
|
||||||
|
};
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "@woocommerce/monorepo-utils",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "WooCommerce Monorepo utility tooling.",
|
||||||
|
"author": "Automattic",
|
||||||
|
"homepage": "https://github.com/woocommerce/woocommerce",
|
||||||
|
"license": "GPLv2",
|
||||||
|
"repository": "woocommerce/woocommerce",
|
||||||
|
"dependencies": {
|
||||||
|
"chalk": "^4.1.2",
|
||||||
|
"commander": "^9.4.0",
|
||||||
|
"@commander-js/extra-typings": "^0.1.0",
|
||||||
|
"dotenv": "^10.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^27.4.1",
|
||||||
|
"@types/node": "^16.18.18",
|
||||||
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
|
"eslint": "^8.32.0",
|
||||||
|
"jest": "^29.5.0",
|
||||||
|
"ts-jest": "^29.1.0",
|
||||||
|
"typescript": "^4.9.5"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"start": "tsc --watch",
|
||||||
|
"lint": "eslint . --ext .ts",
|
||||||
|
"test": "jest"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^16.13.1",
|
||||||
|
"pnpm": "^7.13.3"
|
||||||
|
},
|
||||||
|
"types": "dist/index.d.ts"
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Code Freeze CLI Utility
|
||||||
|
|
||||||
|
CLI for performing Monorepo utilities relating to Code Freeze
|
|
@ -0,0 +1,15 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
import { Command } from '@commander-js/extra-typings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { verifyDayCommand } from './verify-day';
|
||||||
|
|
||||||
|
const program = new Command( 'code-freeze' )
|
||||||
|
.description( 'Code freeze utilities' )
|
||||||
|
.addCommand( verifyDayCommand );
|
||||||
|
|
||||||
|
export default program;
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
import { Command } from '@commander-js/extra-typings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { verifyDay } from '../utils/index';
|
||||||
|
|
||||||
|
export const verifyDayCommand = new Command( 'verify-day' )
|
||||||
|
.description( 'Verify if today is the code freeze day' )
|
||||||
|
.option(
|
||||||
|
'-o, --override <override>',
|
||||||
|
"Time Override: The time to use in checking whether the action should run (default: 'now')."
|
||||||
|
)
|
||||||
|
.action( () => {
|
||||||
|
console.log( verifyDay() );
|
||||||
|
|
||||||
|
process.exit( 0 );
|
||||||
|
} );
|
|
@ -0,0 +1,10 @@
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { verifyDay } from '../index';
|
||||||
|
|
||||||
|
describe( 'verifyDay', () => {
|
||||||
|
it( 'should return a string', () => {
|
||||||
|
expect( verifyDay() ).toBe( 'Today is a good day to code freeze!' );
|
||||||
|
} );
|
||||||
|
} );
|
|
@ -0,0 +1,3 @@
|
||||||
|
export const verifyDay = () => {
|
||||||
|
return 'Today is a good day to code freeze!';
|
||||||
|
};
|
|
@ -0,0 +1,17 @@
|
||||||
|
#! /usr/bin/env node
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
import { Command } from '@commander-js/extra-typings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import CodeFreeze from './code-freeze/commands';
|
||||||
|
|
||||||
|
const program = new Command()
|
||||||
|
.name( 'utils' )
|
||||||
|
.description( 'Monorepo utilities' )
|
||||||
|
.addCommand( CodeFreeze );
|
||||||
|
|
||||||
|
program.parse( process.argv );
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "src",
|
||||||
|
"outDir": "dist",
|
||||||
|
"target": "es6",
|
||||||
|
"module": "commonjs",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"typeRoots": [
|
||||||
|
"./typings",
|
||||||
|
"./node_modules/@types",
|
||||||
|
"./node_modules/@commander-js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue