Skip to content

Commit

Permalink
Feature/npm packages (#46)
Browse files Browse the repository at this point in the history
* feat: npm packages

* feat: restructure

* feat: npm publish script
  • Loading branch information
amihajlovski authored Nov 27, 2023
1 parent e00f96b commit 22d9a3c
Show file tree
Hide file tree
Showing 94 changed files with 102,582 additions and 8 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will run tests using node and then publish a package when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish Package

on:
workflow_dispatch:

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: 18.15
registry-url: https://registry.npmjs.org/
- run: npm ci
# Copy LICENSE to adyen-web package
- run: cp LICENSE packages/adyen-salesforce-pwa/
# Build and publish to npm
- run: cd packages/adyen-salesforce-pwa/ && npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
CI: true
2 changes: 1 addition & 1 deletion overrides/app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
DEFAULT_LIMIT_VALUES,
DEFAULT_SEARCH_PARAMS
} from '@salesforce/retail-react-app/app/constants'
import countryList from '../../adyen/utils/countryList.mjs'
import countryList from '../../packages/adyen-salesforce-pwa/lib/utils/countryList.mjs'

// original value is 25
DEFAULT_LIMIT_VALUES[0] = 3
Expand Down
2 changes: 1 addition & 1 deletion overrides/app/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {getConfig} from '@salesforce/pwa-kit-runtime/utils/ssr-config'
// Components
import {configureRoutes} from '@salesforce/retail-react-app/app/utils/routes-utils'
import {routes as _routes} from '@salesforce/retail-react-app/app/routes'
import _adyenRoutes from '../../adyen/pages/routes'
import _adyenRoutes from '../../packages/adyen-salesforce-pwa/lib/pages/routes'

const routes = [..._adyenRoutes, ..._routes]

Expand Down
2 changes: 1 addition & 1 deletion overrides/app/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {isRemote} from '@salesforce/pwa-kit-runtime/utils/ssr-server'
import {getConfig} from '@salesforce/pwa-kit-runtime/utils/ssr-config'
import helmet from 'helmet'
import bodyParser from 'body-parser'
import {registerAdyenEndpoints} from '../../adyen/api/routes/router'
import {registerAdyenEndpoints} from '../../packages/adyen-salesforce-pwa/lib/api/routes/router'

const options = {
// The build directory (an absolute path)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
"test:max-file-size": "npm run build && bundlesize",
"check-branch-name": "chmod 755 ./branching.sh && sh ./branching.sh",
"prepare": "husky install",
"upload-env": "node ./adyen/scripts/push-env.js",
"get-env": "node ./adyen/scripts/get-env.js",
"dot-env": "node ./adyen/scripts/dot-env.js",
"upload-env": "node packages/adyen-salesforce-pwa/lib/scripts/push-env.js",
"get-env": "node packages/adyen-salesforce-pwa/lib/scripts/get-env.js",
"dot-env": "node packages/adyen-salesforce-pwa/lib/scripts/dot-env.js",
"start:env": "npm run dot-env -- -p=npm run start",
"push:env": "npm run dot-env -- -p=npm run push"
},
Expand Down
21 changes: 21 additions & 0 deletions packages/adyen-retail-react-app/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NODE_ENV=""
ADYEN_API_KEY=""
ADYEN_MERCHANT_ACCOUNT=""
ADYEN_CLIENT_KEY=""
ADYEN_ENVIRONMENT=""
SYSTEM_INTEGRATOR_NAME=""
HOST_URL=""
COMMERCE_API_CLIENT_ID=""
COMMERCE_API_ORG_ID=""
COMMERCE_API_SHORT_CODE=""
COMMERCE_API_SITE_ID=""
COMMERCE_API_DEFAULT_SITE=""
SCAPI_URL=""
OCAPI_URL=""
ADYEN_WEBHOOK_USER=""
ADYEN_WEBHOOK_PASSWORD=""
ADYEN_HMAC_KEY=""
ENVIRONMENT_ID=""
PROJECT_ID=""
COMMERCE_API_CLIENT_ID_PRIVATE=""
COMMERCE_API_CLIENT_SECRET=""
7 changes: 7 additions & 0 deletions packages/adyen-retail-react-app/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2023, Salesforce, Inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = require('@salesforce/pwa-kit-dev/configs/babel/babel-config')
Loading

0 comments on commit 22d9a3c

Please sign in to comment.