Skip to content

Commit 1b6dccb

Browse files
committed
fix: update package.json
1 parent 20cdde6 commit 1b6dccb

File tree

6 files changed

+145
-27
lines changed

6 files changed

+145
-27
lines changed

.woodpecker/buildRelease.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
#!/bin/bash
3+
4+
# write npm run output both to console and to build.log
5+
npm run build 2>&1 | tee build.log
6+
build_status=${PIPESTATUS[0]}
7+
8+
# if exist status from the npm run build is not 0
9+
# then exit with the status code from the npm run build
10+
if [ $build_status -ne 0 ]; then
11+
echo "Build failed. Exiting with status code $build_status"
12+
exit $build_status
13+
fi

.woodpecker/buildSlackNotify.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
set -x
4+
5+
COMMIT_SHORT_SHA=$(echo $CI_COMMIT_SHA | cut -c1-8)
6+
7+
8+
if [ "$CI_STEP_STATUS" = "success" ]; then
9+
MESSAGE="Did a build without issues on \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\`. Commit: _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
10+
11+
curl -s -X POST -H "Content-Type: application/json" -d '{
12+
"username": "'"$CI_COMMIT_AUTHOR"'",
13+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
14+
"attachments": [
15+
{
16+
"mrkdwn_in": ["text", "pretext"],
17+
"color": "#36a64f",
18+
"text": "'"$MESSAGE"'"
19+
}
20+
]
21+
}' "$DEVELOPERS_SLACK_WEBHOOK"
22+
exit 0
23+
fi
24+
export BUILD_LOG=$(cat ./build.log)
25+
26+
BUILD_LOG=$(echo $BUILD_LOG | sed 's/"/\\"/g')
27+
28+
MESSAGE="Broke \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\` with commit _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
29+
CODE_BLOCK="\`\`\`$BUILD_LOG\n\`\`\`"
30+
31+
echo "Sending slack message to developers $MESSAGE"
32+
# Send the message
33+
curl -sS -X POST -H "Content-Type: application/json" -d '{
34+
"username": "'"$CI_COMMIT_AUTHOR"'",
35+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
36+
"attachments": [
37+
{
38+
"mrkdwn_in": ["text", "pretext"],
39+
"color": "#8A1C12",
40+
"text": "'"$CODE_BLOCK"'",
41+
"pretext": "'"$MESSAGE"'"
42+
}
43+
]
44+
}' "$DEVELOPERS_SLACK_WEBHOOK" 2>&1

.woodpecker/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
clone:
2+
git:
3+
image: woodpeckerci/plugin-git
4+
settings:
5+
partial: false
6+
depth: 5
7+
8+
steps:
9+
init-secrets:
10+
when:
11+
- event: push
12+
image: infisical/cli
13+
environment:
14+
INFISICAL_TOKEN:
15+
from_secret: VAULT_TOKEN
16+
commands:
17+
- infisical export --domain https://vault.devforth.io/api --format=dotenv-export --env="prod" > /woodpecker/deploy.vault.env
18+
secrets:
19+
- VAULT_TOKEN
20+
21+
release:
22+
image: node:20
23+
when:
24+
- event: push
25+
commands:
26+
- apt update && apt install -y rsync
27+
- export $(cat /woodpecker/deploy.vault.env | xargs)
28+
- npm clean-install
29+
- /bin/bash ./.woodpecker/buildRelease.sh
30+
- npm audit signatures
31+
- npx semantic-release
32+
33+
slack-on-failure:
34+
when:
35+
- event: push
36+
status: [failure, success]
37+
- event: push
38+
image: curlimages/curl
39+
commands:
40+
- export $(cat /woodpecker/deploy.vault.env | xargs)
41+
- /bin/sh ./.woodpecker/buildSlackNotify.sh
42+

custom/InlineCreateForm.vue

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,21 @@
7272
const invalidFields = ref({});
7373
const emptyFields = ref({});
7474
75-
console.log("visibleColumns", coreStore.resource.columns);
76-
77-
78-
// Determine which columns should be editable
7975
const visibleColumns = computed(() =>
8076
coreStore.resource.columns.filter(c => !c.backendOnly && c.showIn?.create !== false && !c.primaryKey)
8177
);
8278
83-
console.log("visibleColumns", visibleColumns.value);
84-
8579
const allVisibleColumns = computed(() => {
86-
// Create a Map using column name as key to remove duplicates
8780
const columnsMap = new Map();
8881
89-
// Add all visible columns
9082
coreStore.resource.columns.filter(c => c.showIn?.list).forEach(column => {
9183
columnsMap.set(column.label, column);
9284
});
9385
94-
// Add all editable columns
9586
visibleColumns.value.forEach(column => {
9687
columnsMap.set(column.label, column);
9788
});
9889
99-
// Convert Map values back to array
10090
return Array.from(columnsMap.values());
10191
});
10292

index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,13 @@ export default class InlineCreatePlugin extends AdminForthPlugin {
7373

7474
const resource = this.adminforth.config.resources.find(r => r.resourceId === resourceId);
7575

76-
// Create a new record object with only valid database columns
77-
const cleanRecord = {};
78-
79-
for (const field of resource.columns) {
80-
76+
const cleanRecord = resource.columns.reduce((acc, field) => {
8177
if (record[field.name] !== undefined && record[field.name] !== null) {
82-
cleanRecord[field.name] = record[field.name];
78+
acc[field.name] = record[field.name];
8379
}
84-
}
80+
return acc;
81+
}, {});
82+
8583
const result = await this.adminforth.createResourceRecord({
8684
resource,
8785
record: cleanRecord,

package.json

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,52 @@
11
{
2-
"name": "adminforth-inline-create",
3-
"version": "1.0.2",
2+
"name": "@adminforth/inline-create",
3+
"version": "1.0.0",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"type": "module",
77
"scripts": {
8-
"build": "tsc && rsync -av --exclude 'node_modules' custom dist/ && npm version patch"
8+
"prepare": "npm link adminforth",
9+
"build": "tsc && rsync -av --exclude 'node_modules' custom dist/"
910
},
10-
"keywords": [],
11-
"author": "",
12-
"license": "ISC",
13-
"description": "",
14-
"devDependencies": {
15-
"@types/node": "latest",
16-
"typescript": "^5.7.3"
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/devforth/adminforth-inline-create.git"
1714
},
15+
"keywords": ["adminforth", "inline create"],
16+
"author": "devforth",
17+
"license": "MIT",
18+
"description": "Inline create plugin for adminforth",
1819
"dependencies": {
1920
"adminforth": "latest"
21+
},
22+
"devDependencies": {
23+
"@types/node": "^22.10.7",
24+
"semantic-release": "^24.2.1",
25+
"semantic-release-slack-bot": "^4.0.2",
26+
"typescript": "^5.7.3"
27+
},
28+
"release": {
29+
"plugins": [
30+
"@semantic-release/commit-analyzer",
31+
"@semantic-release/release-notes-generator",
32+
"@semantic-release/npm",
33+
"@semantic-release/github",
34+
[
35+
"semantic-release-slack-bot",
36+
{
37+
"notifyOnSuccess": true,
38+
"notifyOnFail": true,
39+
"slackIcon": ":package:",
40+
"markdownReleaseNotes": true
41+
}
42+
]
43+
],
44+
"branches": [
45+
"main",
46+
{
47+
"name": "next",
48+
"prerelease": true
49+
}
50+
]
2051
}
2152
}

0 commit comments

Comments
 (0)