Skip to content

Commit

Permalink
feat(script): native clear command & use latest RN cli
Browse files Browse the repository at this point in the history
Somehow ended up using "next" CLI tag, which is now causing issues. release-npm
  • Loading branch information
tobua committed Jan 16, 2024
1 parent 59e651f commit 026d1e0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@
}
},
"dependencies": {
"@react-native-community/cli": "^13.0.0",
"@react-native-community/cli": "^12.3.2",
"@react-native/babel-preset": "^0.74.0",
"@react-native/eslint-config": "^0.74.0",
"@react-native/metro-config": "^0.73.2",
"@react-native/metro-config": "^0.73.3",
"@react-native/typescript-config": "^0.74.0",
"arg": "^5.0.2",
"command-exists": "^1.2.9",
"deepmerge": "^4.3.1",
"eslint": "^8.56.0",
"eslint-plugin-prettier": "^5.1.1",
"eslint-plugin-prettier": "^5.1.3",
"fast-glob": "^3.3.2",
"global-cache-dir": "^6.0.0",
"is-ci": "^3.0.1",
"json5": "^2.2.3",
"logua": "^3.0.3",
"pakag": "^3.1.1",
"parse-gitignore": "^2.0.0",
"prettier": "^3.1.1",
"prettier": "^3.2.2",
"prompts": "^2.4.2",
"semver": "^7.5.4",
"semver-sort": "^1.0.0",
Expand All @@ -55,9 +55,9 @@
"@types/prompts": "^2.4.9",
"@types/semver": "^7.5.6",
"jest-fixture": "^4.1.0",
"padua": "^2.0.7",
"react-native": "^0.73.1",
"vitest": "^1.1.0"
"padua": "^2.0.8",
"react-native": "^0.73.2",
"vitest": "^1.2.0"
},
"peerDependencies": {
"react-native": ">= 0.73"
Expand Down
9 changes: 8 additions & 1 deletion script/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { lint } from './lint'
import { ios } from './ios'
import { android } from './android'
import { RunLocation, RunMode } from '../types'
import { clearTemplateCache } from '../template-cache'

const scriptToMethod = {
plugin,
Expand Down Expand Up @@ -133,6 +134,7 @@ export const prompt = async () => {
{ title: 'Create or update patch', value: 'patch' },
{ title: 'Apply existing patch', value: 'apply' },
{ title: 'Lint project', value: 'lint' },
{ title: 'Clear native cache', value: 'clear' },
],
})

Expand All @@ -144,7 +146,7 @@ export const prompt = async () => {
return
}

if (script !== 'ios' && script !== 'android' && script !== 'distribute') {
if (script in scriptToMethod) {
await scriptToMethod[script]()
}

Expand Down Expand Up @@ -260,4 +262,9 @@ export const prompt = async () => {
android({ location, mode, deviceId, simulator })
}
}

if (script === 'clear') {
const directory = clearTemplateCache()
log(`Template cache in ${directory} successfully cleared`)
}
}
1 change: 1 addition & 0 deletions template-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ export const cacheTemplate = (nativeOptions: NativeOptions) => {
export const clearTemplateCache = () => {
const templates = readdirSync(cacheDirectory)
templates.forEach((template) => rmSync(join(cacheDirectory, template), { recursive: true }))
return cacheDirectory
}
8 changes: 4 additions & 4 deletions template/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
"mobx": "^6.12.0",
"mobx-react-lite": "^4.0.5",
"react": "^18.2.0",
"react-native": "^0.73.1",
"react-native": "^0.73.2",
"reactigation": "^4.0.2",
"responsive-react-native": "^1.0.2"
"responsive-react-native": "^1.0.3"
},
"devDependencies": {
"@testing-library/jest-native": "^5.4.3",
"@testing-library/react-native": "^12.4.2",
"@testing-library/react-native": "^12.4.3",
"@types/jest": "^29.5.11",
"@types/react-native": "^0.72.8",
"android-sdk-numic-plugin": "^1.0.3",
"babel-jest": "^29.7.0",
"icon-numic-plugin": "^1.4.3",
"jest": "^29.7.0",
"numic": "^2.0.5",
"numic": "^2.1.0",
"react-test-renderer": "^18.2.0",
"typescript": "^5.3.3"
},
Expand Down
4 changes: 2 additions & 2 deletions template/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"react": "^18.2.0",
"react-native": "^0.73.1"
"react-native": "^0.73.2"
},
"type": "module",
"devDependencies": {
Expand All @@ -26,7 +26,7 @@
"babel-jest": "^29.7.0",
"icon-numic-plugin": "^1.4.3",
"jest": "^29.7.0",
"numic": "^2.0.5",
"numic": "^2.1.0",
"react-test-renderer": "18.2.0",
"typescript": "^5.3.3"
},
Expand Down

1 comment on commit 026d1e0

@vercel
Copy link

@vercel vercel bot commented on 026d1e0 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

numic – ./

numic.vercel.app
numic-tobua.vercel.app
numic-git-main-tobua.vercel.app

Please sign in to comment.