-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove nextcloud scope from app name #338
Conversation
Allow publishing an app and an npm package in the @nextcloud scope from the same source. Signed-off-by: Max <max@nextcloud.com>
6dc53d0
to
07462e0
Compare
For a bit of context: We are working on packaging some of the text app for reuse in other apps (collectives for now, deck later). In order to ease development we want to keep the We are considering to move to a monorepo with multiple For the package we want to use the |
Careful about this, in the past we looked at this multiple times, and there is always a need for third party tooling, which make the management rather complicated iirc |
Not sure that I fully understand the need and motivation here. Would having an additional repo for the package be that much of a burden? |
Yes - that's why were trying to avoid it. |
The short answer is 'Yes.' 😉 Let me try to also explain the long answer. MaintenanceFirst of all... it's not just another repo. It comes with a fresh git history, issue tracker, changelog, release cycle, test strategy and all that. We'd have the We currently use Our current approach just adds a new build target and leaves the rest of our workflows as is. Moving the package to a separate repo would imply that we rewrite each fix by hand for the existing stable branches. Package layoutWhat we want to achieve for now is to reuse code between Text and Collectives for rendering markdown. We mainly want to share css and tiptap nodes to make sure they look the same. We do so by exporting a single vue component called Text itself is not just a reader but an editor so it adds Minimal PackageBasically what we are packaging now - Package most of textWe could also package the text editor alongside Why have a separate repo?Even assuming we manage to sort out the issues with a separate repo... what would the benefit of it be? It would save us the single line change to this repo - but besides that? Creating packages from nextcloud appsI actually think that building a package from a nextcloud apps source is a viable approach. Besides the reuse of the name in the webpack config i don't see any conflicting settings in |
@max-nextcloud can you raise that issue at https://github.com/nextcloud/standards ? |
I opened nextcloud/standards#3 to start a discussion there. However for now i don't necessarily want to turn this into a standard just now. I'd be happy to try it out with text for a release cycle or two and see if it works for us. This might help inform the discussion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small idea to improve this implementation.
@@ -28,6 +28,7 @@ const NodePolyfillPlugin = require('node-polyfill-webpack-plugin') | |||
const TerserPlugin = require('terser-webpack-plugin') | |||
|
|||
const appName = process.env.npm_package_name | |||
.replace('@nextcloud/', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, it can create unpredictable behaviors across all our apps ecosystem.
Instead of change it directly, we can export this object as a function (in other file maybe) and using parameters change the appName
config.js
const buildConfig = ({ appName }) => {
return {
// ommited
output: {
publicPath: path.join('/apps/', appName, '/js/'),
filename: `${appName}-[name].js?v=[contenthash]`,
}
}
}
module.exports = { appName }
in
webpack.config.js
const { buildConfig } = require(./config.js)
const appName = process.env.npm_package_name
module.exports = buildConfig({ appName })
We will be able to import buildConfig
instead of webpack.config.js
into the applications and be able to do other changes like different output paths if we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to think the appname should be taken from appinfo/info.xml
.
The really crucial part in the webpack.config.js is
{ publicPath: path.join('/apps/', appName, '/js/'), }
My understanding is that this povides the path to fetch the js files from. I'm pretty sure which path is understood by the server does not depend on the package.json
but on the appinfo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that public path anyways overwritten by __webpack_public_path__
as the /apps/ will not work as a static location in case multiple app directories are used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that this povides the path to fetch the js files from. I'm pretty sure which path is understood by the server does not depend on the
package.json
but on the appinfo.
We expect developers to use the same name in npm pkg AND appinfo :)
Not all repo using webpack-vue-config
are apps btw, so no appinfo here 😉
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
The app name `text` in appinfo and the package name `@nextcloud/text in package.json differ. webpack-vue-config reads the app name from package.json. But for bundling we need the one from appinfo. Can be removed after merge of nextcloud-libraries/webpack-vue-config#338 or a successor. Signed-off-by: Max <max@nextcloud.com>
As said in nextcloud/standards#3 (comment) we prefer to have two |
Allow publishing an app and an npm package in the @nextcloud scope
from the same source.