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] feat: expressjs framework #784

Draft
wants to merge 51 commits into
base: main
Choose a base branch
from

Conversation

yanksyoon
Copy link
Contributor

@yanksyoon yanksyoon commented Jan 2, 2025

  • Have you signed the CLA?

Adds support for ExpressJS framework.

Key Decisions

  • Support for bare and 24.04 only. Drop support for 22.04 (jammy)
    • Jammy comes with an old version of Node which does not support ?? operator commonly used in JS projects. This means that the projects initialized with express-generator tooling (assumed to be the case) would not work.
  • Include runtime slices in the expressjs-framework/install-app > stage-packages part.
  • Do not include user customizable part for runtime slices/packages in the template
  • Provide Ubuntu packaged Node/NPM by default, allow user to specify Node version if desired.
    • To follow the principles of Ubuntu LTS, by default use the NodeJS and NPM provided by apt/slices but allow users to customize the behavior through overriding the NPM plugin's npm-include-node and npm-node-version fields.
  • Include all paths under the app/ directory.
    • Users should not include/add paths which are not desired in the app path (e.g. .env files)

@yanksyoon yanksyoon mentioned this pull request Jan 2, 2025
1 task
@yanksyoon yanksyoon changed the title feat: expressjs framework [WIP] feat: expressjs framework Jan 2, 2025
@yanksyoon yanksyoon force-pushed the feat/expressjs-framework branch from 056fbc1 to 8afa87e Compare January 2, 2025 03:55
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 10, 2025
Copy link
Contributor Author

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

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

Initial self review

docs/reference/extensions/expressjs-framework.rst Outdated Show resolved Hide resolved
Comment on lines 28 to 38
You can use this key to specify any dependencies required for your ExpressJS
application. In the following example we use it to specify ``libpq-dev``:

.. code-block:: yaml
parts:
expressjs-framework/dependencies:
stage-packages:
# list required packages or slices for your ExpressJS application below.
- libpq-dev
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a bug with installing any runtime dependencies (conflicting lib directory). See Matrix thread: https://matrix.to/#/!NPPCseDHKRvSBMUEXN:ubuntu.com/$upouJFvo8bjWS08ZNTe9yDtELNuVPh4qbs-ue3vEbbM?via=ubuntu.com&via=matrix.org

docs/reference/extensions/expressjs-framework.rst Outdated Show resolved Hide resolved
- app/static
Some files/directories, if they exist, are included by default. These include:
``<rock name>``, ``app.js``, ``migrate``, ``migrate.sh``, ``migrate.py``,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

check migrate related files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is autogenerated by express-generator with the addition of the timeRouter for tutorial's sake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generated by express-generator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generated by express-generator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generated by express-generator

tests/unit/extensions/test_expressjs.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add link to documentation on libs that are required on charm integrations (e.g. pg)

Copy link
Contributor

@jdkandersson jdkandersson left a comment

Choose a reason for hiding this comment

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

Let's review this extension against fastAPI and go and make sure they are aligned in approach please :)

rockcraft/extensions/expressjs.py Outdated Show resolved Hide resolved
rockcraft/extensions/expressjs.py Outdated Show resolved Hide resolved
rockcraft/extensions/expressjs.py Outdated Show resolved Hide resolved
rockcraft/extensions/expressjs.py Outdated Show resolved Hide resolved
rockcraft/extensions/expressjs.py Outdated Show resolved Hide resolved
rockcraft/extensions/expressjs.py Outdated Show resolved Hide resolved
rockcraft/extensions/expressjs.py Outdated Show resolved Hide resolved
Copy link
Contributor

@erinecon erinecon left a comment

Choose a reason for hiding this comment

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

Hi, I took a brief look at what's in the tutorial so far, and I left two comments.

I have some other comments that I excluded because they will affect all of the tutorials. I'd rather keep the set of tutorials consistent for now and update them all in one go.

docs/tutorial/expressjs.rst Outdated Show resolved Hide resolved
docs/tutorial/expressjs.rst Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants