Skip to content

Commit

Permalink
refactor: Gutenberg project practices alignment (#37)
Browse files Browse the repository at this point in the history
* refactor: Consolidate `.gitignore` configuration

Align with Gutenberg practices of consolidating Git configuration.

* refactor: Lowercase filenames

Align with Gutenberg project practices.

* refactor: Hoist `hook` to `src` directory

Align with Gutenberg project practices.

* refactor: Rename `misc` to `utils`

Align with Gutenberg project practices.

* refactor: Reorganize "helpers" to be less generic

Align with Gutenberg project practices. Avoid generic filenames that
fail to describe intent or focus.

* refactor: Remove file ending in import paths

Align with Gutenberg project practices.

* refactor: Hoist `lock-unlock` to root `src` directory

Align with Gutenberg project practices.

* refactor: Hoist JavaScript source to root directory

Align with Gutenberg project practices.

* refactor: Separate iOS files from JavaScript and Android files

Align with Gutenberg project practices.

* refactor: Separate Android files from JavaScript and iOS files

Align with Gutenberg project practices.

* refactor: Improve Makefile casing consistency

* refactor: Relocate `app` to `components` directory

Align with Gutenberg project practices.

* refactor: Rename `main` to `index`

Align with Gutenberg project practices.

* refactor: Place entry files within `src` directory

Align with Gutenberg project practices.

* docs: Update README

* fix: Reinstate top-level Package.swift file

This must be in the root directory for Xcode to correctly source the
files. Additional configuration is also required to provide the new path
for the `ios` subdirectory.

* fix: Remove now unnecessary directory changes in iOS build command

The package configuration file was relocated to the root directory.

* fix: Repair GutenbergKit path for demo app

Path changed after relocating package configuration to root directory.
  • Loading branch information
dcalhoun authored Nov 19, 2024
1 parent c62f3f0 commit 05dcc9f
Show file tree
Hide file tree
Showing 107 changed files with 243 additions and 314 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ steps:
command: |
make build
echo "--- :android: Publishing Android Library"
./Demo-Android/gradlew -p Demo-Android :gutenberg:prepareToPublishToS3 $(prepare_to_publish_to_s3_params) :gutenberg:publish
./android/gradlew -p ./android :gutenberg:prepareToPublishToS3 $(prepare_to_publish_to_s3_params) :gutenberg:publish
agents:
queue: android
plugins: *plugins

- label: ":swift: Test Swift Package"
command: make test_swift_package
command: make test-swift-package
plugins: *plugins
File renamed without changes.
29 changes: 19 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,17 @@ dist
# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.vscode-test
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# yarn v2
.yarn/cache
Expand All @@ -171,16 +180,16 @@ dist

# Android App
local.properties
/Demo-Android/build
/Demo-Android/.gradle
/Demo-Android/.idea
/android/build
/android/.gradle
/android/.idea

## Production Build Products
/Demo-Android/Gutenberg/src/main/assets/assets
/Demo-Android/Gutenberg/src/main/assets/index.html
/Demo-Android/Gutenberg/src/main/assets/remote.html
/android/Gutenberg/src/main/assets/assets
/android/Gutenberg/src/main/assets/index.html
/android/Gutenberg/src/main/assets/remote.html

# Disabled removing these files until this is published like Android in CI.
# /Sources/GutenbergKit/Gutenberg/assets
# /Sources/GutenbergKit/Gutenberg/index.html
# /Sources/GutenbergKit/Gutenberg/remote.html
# /ios/Sources/GutenbergKit/Gutenberg/assets
# /ios/Sources/GutenbergKit/Gutenberg/index.html
# /ios/Sources/GutenbergKit/Gutenberg/remote.html
File renamed without changes.
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ endef

npm-dependencies:
echo "--- :npm: Installing NPM Dependencies"
npm --prefix ReactApp/ ci
npm ci

build: npm-dependencies
echo "--- :node: Building Gutenberg"

npm --prefix ReactApp/ run build
npm run build

# Copy build products into place
echo "--- :open_file_folder: Copying Build Products into place"
rm -rf ./Sources/GutenbergKit/Gutenberg/ ./Demo-Android/Gutenberg/src/main/assets/
cp -r ./ReactApp/dist/. ./Sources/GutenbergKit/Gutenberg/
cp -r ./ReactApp/dist/. ./Demo-Android/Gutenberg/src/main/assets
rm -rf ./ios/Sources/GutenbergKit/Gutenberg/ ./android/Gutenberg/src/main/assets/
cp -r ./dist/. ./ios/Sources/GutenbergKit/Gutenberg/
cp -r ./dist/. ./android/Gutenberg/src/main/assets

dev-server: npm-dependencies
npm --prefix ReactApp/ run dev
npm run dev

dev-server-remote: npm-dependencies
npm --prefix ReactApp/ run dev:remote
npm run dev:remote

fmt-js: npm-dependencies
npm --prefix ReactApp/ run format
npm run format

lint-js: npm-dependencies
npm --prefix ReactApp/ run lint
npm run lint

local-android-library: build
echo "--- :android: Building Library"
./Demo-Android/gradlew -p Demo-Android :gutenberg:publishToMavenLocal -exclude-task prepareToPublishToS3
./android/gradlew -p ./android :gutenberg:publishToMavenLocal -exclude-task prepareToPublishToS3

build_swift_package: build
build-swift-package: build
$(call XCODEBUILD_CMD, build)

test_swift_package: build
test-swift-package: build
$(call XCODEBUILD_CMD, test)
8 changes: 7 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ let package = Package(
targets: [
.target(
name: "GutenbergKit",
dependencies: [],
path: "ios/Sources/GutenbergKit",
exclude: [],
resources: [.copy("Gutenberg")]
),
.testTarget(
name: "GutenbergKitTests",
dependencies: ["GutenbergKit"]),
dependencies: ["GutenbergKit"],
path: "ios/Tests",
exclude: []
)
]
)
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# GutenbergKit

A proof of concept Gutenberg editor for native iOS apps built using web technologies.
A proof of concept Gutenberg editor for native iOS and Android apps built using web technologies.

<img width="320" alt="Screenshot 2024-07-01 at 10 30 11 AM" src="https://github.com/kean/GutenbergKit/assets/1567433/4d9b2fcd-30fa-46ca-895d-07e0848143b1">

## Development

Before getting started, you'll need the Node dependencies to be checked out locally, which you can get by running `make build`.
Before starting, you'll need the Node.js dependencies to be installed locally, which you can install by running `make build`.

### React App

The ReactJS app is embedded in the native GutenbergKit module.
The React app is embedded in the native GutenbergKit module.

To launch the app in the browser, run:

Expand All @@ -20,15 +20,15 @@ make dev-server

### GutenbergKit

A Swift package with native wrappers for the Gutenberg editor.
Swift and Kotlin packages with native wrappers for the Gutenberg editor.

### Demo

A host app that can be used to test the changes made to the editor quickly.

By default, the demo app uses a production build of the React app included in the `GutenbergKit` package. During development, make sure to run the React app and pass the localhost URL as an environment variable of the demo app.

<img width="725" alt="Screenshot 2024-07-01 at 10 46 19 PM" src="https://github.com/kean/GutenbergKit/assets/1567433/cdc8a28a-c621-4b8e-bc7a-31361694434c">
<img width="725" alt="Xcode environment variables" src="https://github.com/kean/GutenbergKit/assets/1567433/cdc8a28a-c621-4b8e-bc7a-31361694434c">

If you are using SwiftUI previews, make sure to point them to the localhost programatically:

Expand All @@ -43,10 +43,10 @@ If you are using SwiftUI previews, make sure to point them to the localhost prog

## Production

To build the React app for production and incorporate the changes in the `GutenbergKit` Swift module, run:
To build the React app for production and incorporate the changes in the `GutenbergKit` Swift and Kotlin packages, run:

```
make build
```

Once it's done, the Swift package is ready to be published.
Once it's done, the Swift and Kotlin packages are ready to publish.
24 changes: 0 additions & 24 deletions ReactApp/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions ReactApp/Package.swift

This file was deleted.

31 changes: 0 additions & 31 deletions ReactApp/README.md

This file was deleted.

49 changes: 0 additions & 49 deletions ReactApp/src/misc/store.js

This file was deleted.

1 change: 0 additions & 1 deletion Sources/GutenbergKit/Gutenberg/assets/App-K8KBYPOT.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 05dcc9f

Please sign in to comment.