Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: components-first-release #7

Merged
merged 37 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
af8e810
feat: building .jar
Felipe-gsilva Sep 9, 2024
7781d6f
doc: enhance installation process
Felipe-gsilva Sep 9, 2024
657cd4b
feat: creating node library (unfinished)
Felipe-gsilva Sep 11, 2024
15826a9
fix: node-lib building config
Felipe-gsilva Sep 12, 2024
84ff0fa
doc: code rabbit snippets
Felipe-gsilva Sep 12, 2024
aefd082
fix: glob, rimraf and cliui deps
Felipe-gsilva Sep 12, 2024
207a668
fix: adds prop test unit (back)
Felipe-gsilva Sep 12, 2024
73ab5c5
feat: mockingbird as npm-module
Felipe-gsilva Sep 12, 2024
5c550a6
fix: comma on package.json
Felipe-gsilva Sep 12, 2024
9b58fd2
feat: adds webpack config
Felipe-gsilva Sep 17, 2024
cccbe1a
chore: webpack and npm module config
Felipe-gsilva Sep 18, 2024
7cd6fed
feat: build jar back and gh releases
Felipe-gsilva Sep 18, 2024
f8100cc
fix: minor issues
Felipe-gsilva Sep 18, 2024
33477ad
fix: testing compiling options
Felipe-gsilva Sep 20, 2024
8edc81c
test: exporting fn button
Felipe-gsilva Sep 23, 2024
ee3a393
feat: diff prod and dev on webpack bundle
J0sueTM Sep 23, 2024
e48e40a
Update webpack.config.js
avelino Sep 23, 2024
99e1d8c
feat: submit button
Felipe-gsilva Sep 24, 2024
8baba22
feat: loading prop and fixes on example page
Felipe-gsilva Sep 24, 2024
cbd05c4
doc: updates README.md for clojar and new usage
Felipe-gsilva Sep 25, 2024
eb13794
docs: improves text cohesion
Felipe-gsilva Sep 25, 2024
c72bf5a
feat: enhance on navbar
Felipe-gsilva Sep 25, 2024
f5ff6b6
feat: better compiling on css and component enhancement
Felipe-gsilva Sep 25, 2024
f541320
feat: copy the css file from .jar (on build hook)
Felipe-gsilva Sep 27, 2024
c6d97bf
fix: css build hook
Felipe-gsilva Sep 28, 2024
dfc1798
fix: unit test for props
Felipe-gsilva Sep 28, 2024
935f48b
feat: copy target.css on any project to a specified path
Felipe-gsilva Sep 30, 2024
7dc6e58
fix: formatting
Felipe-gsilva Sep 30, 2024
2f3e319
fix: gray-50 color error
Felipe-gsilva Oct 1, 2024
ca98734
fix: button, input and props fix
Felipe-gsilva Oct 1, 2024
0c84712
fix: props test
Felipe-gsilva Oct 1, 2024
1987956
fix: component style enhance
Felipe-gsilva Oct 2, 2024
efd5257
fix: ci workflow
Felipe-gsilva Oct 3, 2024
46df98a
fix: npm install
Felipe-gsilva Oct 3, 2024
4dc125b
docs: improve reading flow
Felipe-gsilva Oct 4, 2024
bf83370
doc: adds more context on README.md
Felipe-gsilva Oct 4, 2024
ff9a234
feat: export tag for shadow npm compiling
Felipe-gsilva Oct 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
java-version: '11'

- name: Install clojure cli
uses: DeLaGuardo/setup-clojure@master
uses: DeLaGuardo/setup-clojure@12.5
with:
cli: 1.11.1.1113

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Npm-Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
Felipe-gsilva marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/checkout@v4
- uses: "DeLaGuardo/[email protected]"
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistent usage of quotes in 'uses' statements

In your workflow, some uses statements include quotes while others do not. For consistency and clarity, it's recommended to either include or omit quotes uniformly across all uses statements.

Apply this diff to remove unnecessary quotes:

             - uses: actions/checkout@v4
-            - uses: "DeLaGuardo/[email protected]"
+            - uses: DeLaGuardo/[email protected]
             - uses: actions/setup-node@v3
              with:
                node-version: "20"
             - name: Build and package the library
               run: |
                 npm ci &&
                 npm run lib
-            - uses: "JS-DevTools/[email protected]"
+            - uses: JS-DevTools/[email protected]
               with:
                 token: ${{ secrets.NPM_TOKEN }}

Also applies to: 22-22

- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Build and package the library
run: |
npm ci && \
npm run lib
Felipe-gsilva marked this conversation as resolved.
Show resolved Hide resolved
- uses: "JS-DevTools/[email protected]"
with:
token: ${{ secrets.NPM_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
Comment on lines +1 to +7
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

LGTM! The workflow name and triggers are well-defined.

The workflow name "Release" is clear and descriptive. The triggers are appropriate for a release workflow, allowing for both automated releases on version tags and manual triggering.

Consider adding a brief description comment at the beginning of the file to provide more context:

# Workflow for releasing the project to Clojars
# Triggered on pushing tags starting with 'v' or manually
name: Release
🧰 Tools
🪛 yamllint

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 5-5: wrong indentation: expected 8 but found 6

(indentation)


[error] 6-6: wrong indentation: expected 10 but found 8

(indentation)


jobs:
clojars:
runs-on: ubuntu-latest
environment: env
defaults:
run:
shell: bash
Comment on lines +9 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Job setup looks good, but there are some indentation issues.

The job setup is appropriate for a Clojure release workflow. Using a specific environment is good for managing secrets.

There are some indentation inconsistencies. Please adjust the indentation as follows:

jobs:
  clojars:
    runs-on: ubuntu-latest
    environment: env
    defaults:
      run:
        shell: bash

This will resolve the yamllint warnings and improve readability.

steps:
- uses: actions/checkout@v4
- uses: "DeLaGuardo/[email protected]"
with:
cli: "1.11.1.1139"
- name: release
env:
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
run: |
clojure -T:dev:build clean && \
clojure -T:dev:build jar && \
clojure -X:deploy-clojars

Felipe-gsilva marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ pom.xml.asc
/.shadow-cljs/
/resources/public/index.html
/resources/public/assets
/resources/public/css/site.css
/resources/public/css/
/resources/test/

/dist/
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,41 @@ Prerequisites

Before you begin, ensure you have the following installed:
- Clojure: Follow the [Clojure Installation guide](https://clojure.org/guides/install_clojure) to set up your environment.
- Node.js: Required for managing dependencies and building your project. Download it from [here](https://www.npmjs.com/package/downloads).
- [Node.js](https://nodejs.org/en/download/prebuilt-installer/current).
- [npm](https://www.npmjs.com/package/downloads).

# Installation

- Set up your project: Start by creating a new ClojureScript project, or use an existing one.
We distribute our software via Clojars, so you are can just plug and play!

- Install node dependencies with a simple command:
``` clj

``` sh
npm i
```
;; TODO

- configure your shadow cljs:
```

> for better understanding, follow the offcial [guide](https://github.com/thheller/shadow-cljs)


# Usage

;; TODO

# Testing

And you are now done, you can clone and build this repo in order to see some examples of good usage of our dear Mockingbird. You can read more [here](docs/test.md).
# Testing Locally

You can clone and build this repo, to see some examples of good usage of our dear Mockingbird. You can read more [here](docs/test.md).

- Set up your project: Start by creating a new ClojureScript project, or use an existing one.

- Install node dependencies with a simple command:

``` sh
npm i
```
Felipe-gsilva marked this conversation as resolved.
Show resolved Hide resolved

- configure your shadow cljs

> for better understanding, follow the offcial [guide](https://github.com/thheller/shadow-cljs)

# Contributing

Expand Down
30 changes: 30 additions & 0 deletions build.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(ns build
(:require [clojure.tools.build.api :as b]))

(def lib 'com.github.moclojer/mockingbird)
(def version "0.0.1")
Felipe-gsilva marked this conversation as resolved.
Show resolved Hide resolved
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file (format "target/%s-%s.jar" (name lib) version))
Comment on lines +5 to +9
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Consider Centralizing the Version Number

The version number "0.0.1" is hardcoded in multiple files (build.clj, package.json, and package-lock.json). To enhance maintainability and ensure consistency across the project, consider implementing a centralized version management system for future releases.

🔗 Analysis chain

LGTM: Project metadata definitions are correct

The project metadata definitions look good for a first release. However, for future releases, consider implementing a more flexible version management system.

To ensure consistency across the project, let's verify if the version is used elsewhere:


To accurately verify if the version number "0.0.1" is used elsewhere in the codebase, please run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of the version number
rg --type-add 'json:*.json' --type-add 'edn:*.edn' --type json,edn,clojure '"0.0.1"'

Length of output: 127


Script:

# 
#!/bin/bash
# Description: Check for other occurrences of the version number
rg -tjson -tedn -tclojure '"0.0.1"'

Length of output: 470



(defn clean [_]
(b/delete {:path "target"}))

(defn jar [_]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
Felipe-gsilva marked this conversation as resolved.
Show resolved Hide resolved

(defn install [_]
(b/install {:basis basis
:lib lib
:version version
:jar-file jar-file
:class-dir class-dir}))
10 changes: 9 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/clojurescript {:mvn/version "1.11.60"}
com.google.javascript/closure-compiler-unshaded {:mvn/version "v20220803"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using a more recent version of the Closure Compiler.

Adding the Closure Compiler dependency is a great choice for optimizing the JavaScript output. However, the specified version v20220803 is quite dated. Consider using a more recent version to ensure you have access to the latest optimizations and bug fixes.

com.fbeyer/refx {:mvn/version "0.0.49"}
lilactown/helix {:mvn/version "0.1.9"}
funcool/promesa {:mvn/version "9.0.494"}
Expand All @@ -15,4 +17,10 @@
:clojure-lsp {:replace-deps {com.github.clojure-lsp/clojure-lsp-standalone {:mvn/version "2024.08.05_18.16.00-1"}}
:main-opts ["-m" "clojure-lsp.main"]}
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.4"}}
:ns-default build}}}
:ns-default build}
:deploy-clojars {:extra-deps {slipset/deps-deploy {:mvn/version "RELEASE"}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Specify an explicit version instead of "RELEASE" for 'slipset/deps-deploy'

Using {:mvn/version "RELEASE"} can lead to non-reproducible builds because it may resolve to different versions over time. Please specify an explicit version number to ensure build consistency and reliability.

Apply this diff to set a specific version (replace x.y.z with the desired version):

    :deploy-clojars {:extra-deps {slipset/deps-deploy {:mvn/version "RELEASE"}}
+                                {:mvn/version "x.y.z"}}
                     :exec-fn deps-deploy.deps-deploy/deploy
                     :exec-args {:installer :remote
                                 :sign-releases? false
                                 :pom-file "target/classes/META-INF/maven/com.github.moclojer/mockingbird/pom.xml"
                                 :artifact "target/mockingbird-0.0.1.jar"}}}}

Committable suggestion was skipped due to low confidence.

:exec-fn deps-deploy.deps-deploy/deploy
:exec-args {:installer :remote
:sign-releases? false
:pom-file "target/classes/META-INF/maven/com.github.moclojer/mockingbird/pom.xml"
:artifact "target/mockingbird-0.0.1.jar"}}}}
Loading