Skip to content

Commit

Permalink
chore: update lerna (#1687)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Anderson <[email protected]>
  • Loading branch information
IT-MikeS and markemer authored Jul 19, 2023
1 parent 5dacddd commit f0f357d
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 49 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI

on:
push:
branches:
Expand All @@ -10,7 +9,10 @@ on:

jobs:
setup:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12]
timeout-minutes: 30
outputs:
plugins: ${{ steps.packages.outputs.paths }}
Expand All @@ -33,16 +35,21 @@ jobs:
path: |
node_modules
*/node_modules
key: dependency-cache-${{ hashFiles('package.json', '*/package.json') }}
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }}
- run: npm install
- id: files
uses: imhoffd/get-changed-files@v2
uses: tj-actions/changed-files@v37
with:
format: 'json'
json: true
write_output_files: true
- id: catjson
run: |
echo "FILES_JSON=$(cat .github/outputs/all_changed_files.json)" >> $GITHUB_OUTPUT
- id: packages
uses: ./.github/actions/changed-packages
with:
files: ${{ steps.files.outputs.all }}
files: ${{ steps.catjson.outputs.FILES_JSON }}

lint:
runs-on: macos-12
timeout-minutes: 30
Expand All @@ -62,9 +69,10 @@ jobs:
path: |
node_modules
*/node_modules
key: dependency-cache-${{ hashFiles('package.json', '*/package.json') }}
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }}
- run: npm install
- run: npm run lint

verify-ios:
runs-on: macos-12
if: needs.setup.outputs.plugins != '[]'
Expand All @@ -75,7 +83,7 @@ jobs:
strategy:
matrix:
xcode:
- /Applications/Xcode_14.2.app
- /Applications/Xcode_14.2.app
plugin: ${{ fromJson(needs.setup.outputs.plugins) }}
steps:
- run: sudo xcode-select --switch ${{ matrix.xcode }}
Expand All @@ -92,10 +100,12 @@ jobs:
path: |
node_modules
*/node_modules
key: dependency-cache-${{ hashFiles('package.json', '*/package.json') }}
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }}
- run: npm install
- run: npm run set-podfiles-for-monorepo
- run: npm run verify:ios
working-directory: ${{ matrix.plugin }}

verify-android:
runs-on: ubuntu-latest
if: needs.setup.outputs.plugins != '[]'
Expand Down Expand Up @@ -125,10 +135,12 @@ jobs:
path: |
node_modules
*/node_modules
key: dependency-cache-${{ hashFiles('package.json', '*/package.json') }}
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }}
- run: npm install
- run: npm run set-settings-gradle-for-monorepo
- run: npm run verify:android
working-directory: ${{ matrix.plugin }}

verify-web:
runs-on: ubuntu-latest
if: needs.setup.outputs.plugins != '[]'
Expand All @@ -153,10 +165,11 @@ jobs:
path: |
node_modules
*/node_modules
key: dependency-cache-${{ hashFiles('package.json', '*/package.json') }}
key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }}
- run: npm install
- run: npm run verify:web
working-directory: ${{ matrix.plugin }}

# deploy:
# runs-on: macos-latest
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down
1 change: 0 additions & 1 deletion google-maps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"@capacitor/ios": "^5.0.0",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
"@ionic/swiftlint-config": "^1.1.2",
"@types/supercluster": "^7.1.0",
"downlevel-dts": "^0.7.0",
"eslint": "^7.11.0",
Expand Down
26 changes: 24 additions & 2 deletions google-maps/swiftlint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
/* eslint-disable no-undef */
module.exports = {
...require('@ionic/swiftlint-config'),
// eslint-disable-next-line no-template-curly-in-string
included: ['${PWD}/ios/Plugin'],
identifier_name: {
min_length: 1,
min_length: {
warning: 3,
error: 1,
},
},
excluded: ['node_modules', 'ios/Pods'],
opt_in_rules: [
'implicitly_unwrapped_optional',
'file_name_no_space',
'force_unwrapping',
'function_default_parameter_at_end',
'lower_acl_than_parent',
'modifier_order',
'overridden_super_call',
'unowned_variable_capture',
'unused_import',
],
line_length: {
warning: 150,
error: 300,
ignores_function_declarations: true,
ignores_comments: true,
ignores_interpolated_strings: true,
ignores_urls: true,
},
};
34 changes: 3 additions & 31 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,8 @@
{
"packages": [
"action-sheet",
"app",
"app-launcher",
"browser",
"camera",
"clipboard",
"device",
"dialog",
"filesystem",
"geolocation",
"google-maps",
"haptics",
"keyboard",
"local-notifications",
"motion",
"network",
"preferences",
"push-notifications",
"screen-orientation",
"screen-reader",
"share",
"splash-screen",
"status-bar",
"text-zoom",
"toast"
],
"command": {
"bootstrap": {
"ci": false,
"npmClientArgs": [
"--no-package-lock"
]
"npmClientArgs": ["--no-package-lock"]
},
"version": {
"allowBranch": "main",
Expand All @@ -41,5 +12,6 @@
"tagVersionPrefix": ""
}
},
"version": "independent"
"version": "independent",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
49 changes: 49 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build"],
"parallel": 1
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"outputs": [
"{projectRoot}/action-sheet/dist",
"{projectRoot}/app/dist",
"{projectRoot}/app-launcher/dist",
"{projectRoot}/browser/dist",
"{projectRoot}/camera/dist",
"{projectRoot}/clipboard/dist",
"{projectRoot}/device/dist",
"{projectRoot}/dialog/dist",
"{projectRoot}/filesystem/dist",
"{projectRoot}/geolocation/dist",
"{projectRoot}/google-maps/dist",
"{projectRoot}/haptics/dist",
"{projectRoot}/keyboard/dist",
"{projectRoot}/local-notifications/dist",
"{projectRoot}/motion/dist",
"{projectRoot}/network/dist",
"{projectRoot}/preferences/dist",
"{projectRoot}/push-notifications/dist",
"{projectRoot}/screen-orientation/dist",
"{projectRoot}/screen-reader/dist",
"{projectRoot}/share/dist",
"{projectRoot}/splash-screen/dist",
"{projectRoot}/status-bar/dist",
"{projectRoot}/text-zoom/dist",
"{projectRoot}/toast/dist"
]
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": [],
"production": ["default"]
}
}
39 changes: 35 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"toggle-local": "node ./scripts/toggle-local.mjs",
"update-all": "node ./scripts/update-all.mjs",
"set-capacitor-version": "node ./scripts/set-capacitor-version.mjs",
"postinstall": "lerna bootstrap",
"set-settings-gradle-for-monorepo": "node ./scripts/monorepo-tools/android-settings-gradle-fix.mjs",
"set-podfiles-for-monorepo": "node ./scripts/monorepo-tools/ios-podfile-fix.mjs",
"publish:cocoapod": "lerna run publish:cocoapod --concurrency 1",
"ci:publish:nightly": "lerna version prerelease --conventional-commits --conventional-prerelease --preid nightly-$(date +\"%Y%m%dT%H%M%S\") --force-publish --no-changelog --no-git-tag-version --no-push --yes && lerna exec -- npm publish --tag nightly --provenance",
"ci:publish:alpha": "lerna version prerelease --conventional-commits --conventional-prerelease --preid alpha --force-publish --yes && lerna exec -- npm publish --tag next --provenance",
Expand All @@ -22,19 +23,49 @@
"ci:publish:dev": "lerna version prerelease --conventional-commits --conventional-prerelease --preid dev-$(date +\"%Y%m%dT%H%M%S\") --force-publish --no-changelog --no-git-tag-version --no-push --yes && lerna exec -- npm publish --tag dev --provenance"
},
"devDependencies": {
"@types/node": "~18.11.19",
"@actions/core": "^1.9.1",
"@ionic/prettier-config": "^1.0.1",
"@types/prompts": "^2.0.8",
"cross-spawn": "^7.0.3",
"esm": "^3.2.25",
"lerna": "^3.22.1",
"lerna": "^7.1.3",
"nx": "^16.3.1",
"prettier": "~2.3.0",
"prompts": "^2.3.2"
"prompts": "^2.3.2",
"glob": "^10.3.3"
},
"prettier": "@ionic/prettier-config",
"swiftlint": {
"identifier_name": {
"min_length": 1
}
}
},
"workspaces": [
"action-sheet",
"app",
"app-launcher",
"browser",
"camera",
"clipboard",
"device",
"dialog",
"filesystem",
"geolocation",
"google-maps",
"haptics",
"keyboard",
"local-notifications",
"motion",
"network",
"preferences",
"push-notifications",
"screen-orientation",
"screen-reader",
"share",
"splash-screen",
"status-bar",
"text-zoom",
"toast"
]
}
33 changes: 33 additions & 0 deletions scripts/monorepo-tools/android-settings-gradle-fix.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { glob } from 'glob';
import { promises as fs } from 'fs';

// Define the search pattern
const searchPattern = '**/android/settings.gradle';

// Define the string to search for and the string to replace it with
const searchString = `new File('../node_modules/@capacitor/android/capacitor')`;
const replacementString = `new File('../../node_modules/@capacitor/android/capacitor')`;

(async () => {
try {
// Search for all files that match the pattern
const files = await glob(searchPattern);
// For each file that matches the pattern
for (const file of files) {
try {
// Read the file
let data = await fs.readFile(file, 'utf8');

// Replace all instances of the search string with the replacement string
let result = data.split(searchString).join(replacementString);

// Write the result back to the file
await fs.writeFile(file, result, 'utf8');
} catch (err) {
console.error('Error while processing file:', err);
}
}
} catch (e) {
console.error('Error while searching for files:', e);
}
})();
33 changes: 33 additions & 0 deletions scripts/monorepo-tools/ios-podfile-fix.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { glob } from 'glob';
import { promises as fs } from 'fs';

// Define the search pattern
const searchPattern = '**/ios/Podfile';

// Define the string to search for and the string to replace it with
const searchString = '../node_modules/@capacitor/ios';
const replacementString = '../../node_modules/@capacitor/ios';

(async () => {
try {
// Search for all files that match the pattern
const files = await glob(searchPattern);
// For each file that matches the pattern
for (const file of files) {
try {
// Read the file
let data = await fs.readFile(file, 'utf8');

// Replace all instances of the search string with the replacement string
let result = data.split(searchString).join(replacementString);

// Write the result back to the file
await fs.writeFile(file, result, 'utf8');
} catch (err) {
console.error('Error while processing file:', err);
}
}
} catch (e) {
console.error('Error while searching for files:', e);
}
})();

0 comments on commit f0f357d

Please sign in to comment.