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

Bundle Vue apps with Vite instead of Webpack #313

Merged
merged 20 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c9f49bc
e2t: Bundle datasets_app with Vite
mayakokits Nov 29, 2022
25e4466
e2t: Bundle messages_app with Vite
mayakokits Nov 29, 2022
f60c666
e2t datasets_app: Fix el-button not rendering
mayakokits Dec 6, 2022
9a07148
campaignion_vue: Don't add dependencies for apps that are bundled wit…
mayakokits Dec 7, 2022
279af9a
campaignion_vue, campaignion_wizard redirects_app: Bump axios to 0.21.1
mayakokits Dec 7, 2022
758e88b
[github] Run Vue app unit tests in workflow again
mayakokits Dec 12, 2022
8ac9e6c
Comply with brace-style "stroustrup"
mayakokits Mar 15, 2023
5047d08
wizard: Bundle redirects_app with Vite
mayakokits Nov 14, 2023
9b65c1e
wizard: lint redirects_app
mayakokits Nov 14, 2023
f8ba9a8
campaignion_vue: clean up after switching Vue apps to Vite
mayakokits Nov 16, 2023
5e2291c
campaignion_vue: update element-ui to match version used by the Vue apps
mayakokits Nov 16, 2023
976ea9a
e2t datasets_app: update Drupal.settings in dev mode
mayakokits Jan 31, 2024
12c7c5e
e2t datasets_app: fix linter errors
mayakokits Jan 31, 2024
97edf76
e2t datasets_app: build JS
mayakokits Jan 31, 2024
dd76c32
Vue apps: inline element-icons font
mayakokits Feb 1, 2024
b316683
Vue apps: fix el-button not rendering
mayakokits Feb 5, 2024
c3b6d4b
e2t datasets_app: fix vue-tables-2 column headers
mayakokits Feb 5, 2024
f3001a3
e2t datasets_app: fix help icon next to contacts table filter field
mayakokits Feb 5, 2024
97178cf
e2t messages_app: fix b3166838, re-add bundle
mayakokits Feb 12, 2024
c50970e
Vue apps: delete obsolete webpack map files
mayakokits Feb 12, 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
14 changes: 8 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,26 @@ jobs:
- name: Run phpunit tests
run: UPAL_ROOT=$ROOT UPAL_WEB_URL=http://127.0.0.1 XDEBUG_MODE=coverage phpunit --bootstrap=$COMPOSER_HOME/vendor/torotil/upal/bootstrap.php --coverage-clover=coverage.xml .
- uses: codecov/codecov-action@v1

yarn:
env:
APP_DIRS: campaignion_email_to_target/datasets_app campaignion_email_to_target/messages_app campaignion_wizard/redirects_app
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Setup node"
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 10
node-version: '18.12.1'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Set env
run: |
echo "REPO=`pwd`" >> $GITHUB_ENV
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -86,7 +88,7 @@ jobs:
for d in ${{ env.APP_DIRS }}
do
cd $REPO/$d
yarn install
yarn install --frozen-lockfile
done
- name: yarn unit
run: |
Expand Down

Large diffs are not rendered by default.

137 changes: 1 addition & 136 deletions campaignion_email_to_target/css/messages_app/e2t_messages_app.css

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions campaignion_email_to_target/datasets_app/.babelrc

This file was deleted.

7 changes: 5 additions & 2 deletions campaignion_email_to_target/datasets_app/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build/*.js
config/*.js
node_modules/
dist/
api-server.js
drupal-fixture.js
vite.config.js
4 changes: 3 additions & 1 deletion campaignion_email_to_target/datasets_app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
.DS_Store
node_modules/
dist/
test/e2e/screenshots
npm-debug.log*
yarn-debug.log*
yarn-error.log*
test/unit/coverage
test/e2e/reports
selenium-debug.log
build/api-db.json
selenium-server.log
api-db.json
8 changes: 0 additions & 8 deletions campaignion_email_to_target/datasets_app/.postcssrc.js

This file was deleted.

14 changes: 9 additions & 5 deletions campaignion_email_to_target/datasets_app/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# dataset_app

Select and edit datasets via the e2t_api.
The app can be loaded in two environments: The wizard’s target step and as a standalone dataset manager (the latter is yet to be implemented).

## Dev mode

Expand All @@ -13,22 +12,24 @@ E2T_API_TOKEN="<here goes the token>" yarn dev

## Production mode

In production mode, Webpack is configured to leave certain vendor libraries out of the bundle and take them from the `campaignion_vue` global provided by the `campaignion_vue` module.
The app uses the API url and token passed via `Drupal.settings.campaignion_email_to_target.endpoints['e2t-api']`.

## Usage

``` bash
# install dependencies
yarn install
yarn

# serve with hot reload at localhost:8080
yarn dev

# build for production with minification
yarn build

# run e2e tests in Chrome
# run unit tests
yarn unit

# run e2e tests in Chrome (after running yarn build)
yarn e2e
```

Expand All @@ -41,4 +42,7 @@ The app needs the following settings in the `Drupal.settings.campaignion_email_t
| `contactPrefix` | string | A prefix used to identify a contact attribute in a dataset’s attributes list. | `'contact.'` | `''` |
| `standardColumns` | Object[] | Array of objects describing the columns that have to be present in every dataset. | `[{key: 'email', description: '', title: 'Email address'}, ...]` | `[]` |
| `validations` | Object | Validations for each column. Dictionary of regex strings, keyed by column name. Backslashes have to be escaped! | `{'first_name': '\\S+'}` | `{}` |
| `endpoints` | Object | For now, this is only the `e2t-api` endpoint. | `{'e2t-api': {url: 'http://example.com', token: 'Bearer token'}}` | |
| `maxFieldLengths` | Object | Maximum characters for each column. Dictionary of integers, keyed by column name. | see `drupal-fixture.js` | |
| `endpoints` | Object | For now, this is only the `e2t-api` endpoint. | `{'e2t-api': {url: 'http://example.com', token: 'Bearer token'}}`| |
| `datasetQuery` | string | query string for filtering when GETting datasets from the API | | `''` |
| `organization` | string | `campaignion_organization`, will be saved with the dataset as `dataset.organization` | | `''` |
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const _ = require('lodash')
const server = jsonServer.create()
const router = jsonServer.router(path.join(__dirname, '/api-db.json'))
router.db._.id = 'key'
// router.db._.foreignKeySuffix = 'Key'
const middlewares = jsonServer.defaults()

// Set default middlewares (logger, static, cors and no-cache)
Expand Down Expand Up @@ -90,7 +89,7 @@ server.use((req, res, next) => {

// Finetune output
router.render = (req, res) => {
if (req.method === 'GET' && req.url.match("/contacts")) {
if (req.method === 'GET' && req.url.match('/contacts')) {
// Only return the actual contacts
res.jsonp(res.locals.data[0].contacts)
} else {
Expand Down
35 changes: 0 additions & 35 deletions campaignion_email_to_target/datasets_app/build/build.js

This file was deleted.

48 changes: 0 additions & 48 deletions campaignion_email_to_target/datasets_app/build/check-versions.js

This file was deleted.

9 changes: 0 additions & 9 deletions campaignion_email_to_target/datasets_app/build/dev-client.js

This file was deleted.

91 changes: 0 additions & 91 deletions campaignion_email_to_target/datasets_app/build/dev-server.js

This file was deleted.

Loading
Loading