@staffbase/create-staffbase-plugin 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  # Shared
2
- .github/CODEOWNERS @Staffbase/cc-tech
2
+ .github/CODEOWNERS @Staffbase/cs-tech
3
3
 
4
4
  # Global
5
5
  * @maximizeIT
6
6
 
7
7
  # Misc
8
- package.json @maximizeIT @Staffbot
9
- yarn.lock @maximizeIT @Staffbot
8
+ package.json @maximizeIT
9
+ yarn.lock @maximizeIT
@@ -4,7 +4,7 @@ on: pull_request
4
4
 
5
5
  jobs:
6
6
  dependabot:
7
- uses: Staffbase/gha-workflows/.github/workflows/template_automerge_dependabot.yml@v4.0.2
7
+ uses: Staffbase/gha-workflows/.github/workflows/template_automerge_dependabot.yml@v7.2.0
8
8
  secrets:
9
9
  app_id: ${{ vars.STAFFBASE_ACTIONS_APP_ID }}
10
10
  private_key: ${{ secrets.STAFFBASE_ACTIONS_PRIVATE_KEY }}
@@ -0,0 +1,23 @@
1
+ name: Publish to NPM Registry
2
+ on:
3
+ release:
4
+ types: [created]
5
+
6
+ permissions:
7
+ contents: read # we need to read secrets
8
+ id-token: write
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+ - name: Setup Node
17
+ uses: actions/setup-node@v4
18
+ with:
19
+ registry-url: 'https://registry.npmjs.org'
20
+ - name: Publish package on NPM 📦
21
+ run: npm publish --access public
22
+ env:
23
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,5 +1,6 @@
1
1
  # Create-Staffbase-SSO-CLI Documentation
2
2
  ![Staffbase Logo](https://staffbase.com/wp-content/themes/staffbase-theme/img/logo-blau.svg)
3
+
3
4
  ## Getting started
4
5
  Install the package in your global namespace and then run the command.
5
6
 
@@ -15,6 +16,7 @@ Example:
15
16
  ```bash
16
17
  $ yarn create @staffbase/staffbase-plugin /home/user1/work/staffbase-server/ --name staffbase-sso-server
17
18
  ```
19
+
18
20
  ## Interactive Mode
19
21
  You can also run the command without passing any arguments to get into interactive
20
22
  mode which would ask you the name of your app and the path where it need to be installed.
@@ -74,7 +76,7 @@ $ npm start
74
76
 
75
77
  ## License
76
78
 
77
- Copyright 2017-2024 Staffbase GmbH.
79
+ Copyright 2017-2025 Staffbase SE.
78
80
 
79
81
  Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
80
82
 
@@ -84,9 +86,9 @@ Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/
84
86
  <img src="docs/assets/images/staffbase.png" alt="Staffbase GmbH" width="96" />
85
87
  </td>
86
88
  <td>
87
- <b>Staffbase GmbH</b>
88
- <br />Staffbase is an internal communications platform built to revolutionize the way you work and unite your company. Staffbase is hiring: <a href="https://jobs.staffbase.com" target="_blank" rel="noreferrer">jobs.staffbase.com</a>
89
- <br /><a href="https://github.com/Staffbase" target="_blank" rel="noreferrer">GitHub</a> | <a href="https://staffbase.com/" target="_blank" rel="noreferrer">Website</a> | <a href="https://jobs.staffbase.com" target="_blank" rel="noreferrer">Jobs</a>
89
+ <b>Staffbase SE</b>
90
+ <br />Staffbase is an internal communications platform built to revolutionize the way you work and unite your company. Staffbase is hiring: <a href="https://staffbase.com/jobs/" target="_blank" rel="noreferrer">https://staffbase.com/jobs</a>
91
+ <br /><a href="https://github.com/Staffbase" target="_blank" rel="noreferrer">GitHub</a> | <a href="https://staffbase.com/" target="_blank" rel="noreferrer">Website</a> | <a href="https://staffbase.com/jobs/" target="_blank" rel="noreferrer">Jobs</a>
90
92
  </td>
91
93
  </tr>
92
94
  </table>
@@ -0,0 +1,14 @@
1
+ apiVersion: backstage.io/v1alpha1
2
+ kind: Component
3
+ metadata:
4
+ name: create-staffbase-plugin-nodejs
5
+ description: Node.js plugin skeleton generator provided by Staffbase
6
+ annotations:
7
+ github.com/project-slug: Staffbase/create-staffbase-plugin-nodejs
8
+ jfrog-artifactory/image-name: create-staffbase-plugin-nodejs
9
+ tags:
10
+ - js
11
+ - nodejs
12
+ spec:
13
+ type: service
14
+ lifecycle: production
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staffbase/create-staffbase-plugin",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "bin": {
5
5
  "create-staffbase-plugin": "csss.js"
6
6
  },
@@ -35,15 +35,15 @@
35
35
  "@typescript-eslint/eslint-plugin": "^5.50.0",
36
36
  "@typescript-eslint/parser": "^5.50.0",
37
37
  "eslint": "^8.33.0",
38
+ "eslint-config-google": "^0.14.0",
38
39
  "eslint-config-prettier": "^8.6.0",
39
- "eslint-plugin-react": "^7.32.2",
40
40
  "eslint-plugin-import-helpers": "^1.1.0",
41
+ "eslint-plugin-react": "^7.32.2",
41
42
  "eslint-plugin-react-hooks": "^4.6.0",
42
43
  "eslint-plugin-simple-import-sort": "^10.0.0",
43
- "eslint-config-google": "^0.14.0",
44
44
  "highlight.js": "^10.0.3",
45
45
  "husky": "^4.2.5",
46
- "jest": "^26.0.1",
46
+ "jest": "^29.7.0",
47
47
  "markdown-it": "^12.3.2",
48
48
  "marked": "^4.0.10",
49
49
  "typescript": "^4.9.5"
@@ -1,77 +1,79 @@
1
- let express = require('express');
2
- let path = require('path');
3
- let favicon = require('serve-favicon');
4
- let logger = require('morgan');
5
- let cookieParser = require('cookie-parser');
6
- let bodyParser = require('body-parser');
1
+ let express = require("express");
2
+ let path = require("path");
3
+ let favicon = require("serve-favicon");
4
+ let logger = require("morgan");
5
+ let cookieParser = require("cookie-parser");
6
+ let bodyParser = require("body-parser");
7
7
 
8
- let index = require('./routes/index');
9
- let users = require('./routes/users');
8
+ let index = require("./routes/index");
9
+ let users = require("./routes/users");
10
10
 
11
11
  let app = express();
12
12
 
13
13
  const staffbaseKey = null;
14
14
  const pluginID = null;
15
15
  let ssoMiddleWare;
16
- ssoMiddleWare = require('@staffbase/staffbase-plugin-sdk').middleware(staffbaseKey, pluginID);
17
-
16
+ ssoMiddleWare = require("@staffbase/staffbase-plugin-sdk").middleware(
17
+ staffbaseKey,
18
+ pluginID
19
+ );
18
20
 
19
21
  // view engine setup
20
- app.set('views', path.join(__dirname, 'views'));
21
- app.set('view engine', 'pug');
22
+ app.set("views", path.join(__dirname, "views"));
23
+ app.set("view engine", "pug");
22
24
 
23
25
  // uncomment after placing your favicon in /public
24
26
  // app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
25
- app.use(logger('dev'));
27
+ app.use(logger("dev"));
26
28
  app.use(bodyParser.json());
27
- app.use(bodyParser.urlencoded({extended: false}));
29
+ app.use(bodyParser.urlencoded({ extended: false }));
28
30
  app.use(cookieParser());
29
- app.use(express.static(path.join(__dirname, 'public')));
31
+ app.use(express.static(path.join(__dirname, "public")));
30
32
 
31
- app.use('/', index);
32
- app.use('/users', users);
33
+ app.use("/", index);
34
+ app.use("/users", users);
33
35
 
34
36
  // Frontend Handler
35
- app.use('/frontEnd', ssoMiddleWare);
36
- app.get('/frontEnd', function(req, res) {
37
- res.render('plugin', req.sbSSO);
37
+ app.use("/frontEnd", ssoMiddleWare);
38
+ app.get("/frontEnd", function (req, res) {
39
+ res.render("plugin", req.sbSSO);
38
40
  });
39
41
 
40
42
  // Setup SSO Milleware on the endpoint server
41
- app.use('/staffbase/sso/backoffice', ssoMiddleWare);
43
+ app.use("/staffbase/sso/backoffice", ssoMiddleWare);
42
44
 
43
45
  // Handle SSO response from server with decoded data
44
- app.get('/staffbase/sso/backoffice', function(req, res) {
46
+ app.get("/staffbase/sso/backoffice", function (req, res) {
45
47
  // Middleware was able to decode the token
46
48
  if (req.sbSSO) {
47
- console.log('Decoded data on backend(admin):', req.sbSSO);
48
- res.render('plugin', req.sbSSO);
49
+ console.log("Decoded data on backend(admin):", req.sbSSO);
50
+ res.render("plugin", req.sbSSO);
49
51
  return res.end();
50
52
  }
51
53
  res.json({
52
54
  error: {
53
- msg: 'Unable to get token information.',
55
+ msg: "Unable to get token information.",
54
56
  },
55
57
  });
56
58
  return res.end();
57
59
  });
58
60
 
59
61
  // catch 404 and forward to error handler
60
- app.use(function(req, res, next) {
61
- let err = new Error('Not Found');
62
+ app.use(function (req, res, next) {
63
+ let err = new Error("Not Found");
62
64
  err.status = 404;
63
65
  next(err);
64
66
  });
65
67
 
66
68
  // error handler
67
- app.use(function(err, req, res, next) {
69
+ app.use(function (err, req, res, next) {
68
70
  // set locals, only providing error in development
69
71
  res.locals.message = err.message;
70
- res.locals.error = req.app.get('env') === 'development' ? err : {};
72
+ res.locals.error = req.app.get("env") === "development" ? err : {};
71
73
 
72
74
  // render the error page
73
75
  res.status(err.status || 500);
74
- res.render('error');
76
+ res.render("error");
75
77
  });
76
78
 
77
79
  module.exports = app;
@@ -7,10 +7,10 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@staffbase/staffbase-plugin-sdk": "^1.3.1",
10
- "body-parser": "~1.19.2",
10
+ "body-parser": "~1.20.3",
11
11
  "cookie-parser": "~1.4.5",
12
- "debug": "~4.3.1",
13
- "express": "~4.17.3",
12
+ "debug": "~4.4.0",
13
+ "express": "~4.21.2",
14
14
  "morgan": "~1.10.0",
15
15
  "pug": ">=3.0.1",
16
16
  "serve-favicon": "~2.5.0"
@@ -1,19 +1,40 @@
1
- <p><img src="https://staffbase.com/wp-content/themes/staffbase-theme/img/logo-blau.svg" alt="Staffbase Logo"></p>
2
- <p>Welcome to your Staffbase SSO plugin server. Please follow the following instructions
3
- to get started with your Plugin Application.</p>
1
+ <p>
2
+ <img
3
+ src="https://staffbase.com/wp-content/themes/staffbase-theme/img/logo-blau.svg"
4
+ alt="Staffbase Logo"
5
+ />
6
+ </p>
7
+ <p>
8
+ Welcome to your Staffbase SSO plugin server. Please follow the following
9
+ instructions to get started with your Plugin Application.
10
+ </p>
4
11
  <h2>Prerequisites</h2>
5
- <p>In order to get connected with the Staffbase SSO interface, you need a Valid Secret and an Audience ID.</p>
6
- <p>If you are here, you probably have a secret and audience ID registered with Staffbase. If you are not sure about it or you need more information about Staffbase SSO, feel free to contact the Customer Success team at Staffbase.</p>
12
+ <p>
13
+ In order to get connected with the Staffbase SSO interface, you need a Valid
14
+ Secret and an Audience ID.
15
+ </p>
16
+ <p>
17
+ If you are here, you probably have a secret and audience ID registered with
18
+ Staffbase. If you are not sure about it or you need more information about
19
+ Staffbase SSO, feel free to contact the Customer Success team at Staffbase.
20
+ </p>
7
21
  <h2>Configuration</h2>
8
- <p>After the scaffolding is complete, you need to provide some values for configuring your
9
- plugin server. The following values need to be configured.</p>
22
+ <p>
23
+ After the scaffolding is complete, you need to provide some values for
24
+ configuring your plugin server. The following values need to be configured.
25
+ </p>
10
26
  <ul>
11
- <li>Plugin Secret</li>
12
- <li>Plugin Audience</li>
27
+ <li>Plugin Secret</li>
28
+ <li>Plugin Audience</li>
13
29
  </ul>
14
- <p>You can either specify these values in environment variables or directly passing
15
- the values in the <code>app.js</code> file where the middleware is initialized.</p>
16
- <p>To configure values in <code>app.js</code> file, change the following lines:</p>
30
+ <p>
31
+ You can either specify these values in environment variables or directly
32
+ passing the values in the <code>app.js</code> file where the middleware is
33
+ initialized.
34
+ </p>
35
+ <p>
36
+ To configure values in <code>app.js</code> file, change the following lines:
37
+ </p>
17
38
  <p>app.js</p>
18
39
  <pre><code class="language-javascript">12 ...
19
40
  13 ...
@@ -21,40 +42,56 @@ the values in the <code>app.js</code> file where the middleware is initialized.<
21
42
  15 const pluginID = null;
22
43
  16 ...
23
44
  </code></pre>
24
- <p>You can also specify these values using environment variables.
25
- Refer to the table to see which environment variables can be used.</p>
45
+ <p>
46
+ You can also specify these values using environment variables. Refer to the
47
+ table to see which environment variables can be used.
48
+ </p>
26
49
  <table>
27
- <thead>
28
- <tr>
29
- <th style="text-align:left"><em>Value</em></th>
30
- <th style="text-align:center"><em>Environment Variable</em></th>
31
- </tr>
32
- </thead>
33
- <tbody>
34
- <tr>
35
- <td style="text-align:left">Secret</td>
36
- <td style="text-align:center">STAFFBASE_SSO_SECRET</td>
37
- </tr>
38
- <tr>
39
- <td style="text-align:left">Audience</td>
40
- <td style="text-align:center">STAFFBASE_SSO_AUDIENCE</td>
41
- </tr>
42
- <tr>
43
- <td style="text-align:left">Server Port</td>
44
- <td style="text-align:center">PORT</td>
45
- </tr>
46
- </tbody>
50
+ <thead>
51
+ <tr>
52
+ <th style="text-align: left"><em>Value</em></th>
53
+ <th style="text-align: center"><em>Environment Variable</em></th>
54
+ </tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr>
58
+ <td style="text-align: left">Secret</td>
59
+ <td style="text-align: center">STAFFBASE_SSO_SECRET</td>
60
+ </tr>
61
+ <tr>
62
+ <td style="text-align: left">Audience</td>
63
+ <td style="text-align: center">STAFFBASE_SSO_AUDIENCE</td>
64
+ </tr>
65
+ <tr>
66
+ <td style="text-align: left">Server Port</td>
67
+ <td style="text-align: center">PORT</td>
68
+ </tr>
69
+ </tbody>
47
70
  </table>
48
71
  <h2>Running the server</h2>
49
- <p><em>create-staffbase-plugin</em> installs the project dependencies for you.
50
- After configurations is done, the only thing you need to do is navigate to the
51
- folder where your app was generated and start the express server.</p>
72
+ <p>
73
+ <em>create-staffbase-plugin</em> installs the project dependencies for you.
74
+ After configurations is done, the only thing you need to do is navigate to the
75
+ folder where your app was generated and start the express server.
76
+ </p>
52
77
  <pre><code class="language-bash">$ cd [path of generated app]
53
78
  $ npm start
54
79
  </code></pre>
55
80
  <h2>Further Reading</h2>
56
- <p>For getting more information about Staffbase SSO, please check out the following links:</p>
81
+ <p>
82
+ For getting more information about Staffbase SSO, please check out the
83
+ following links:
84
+ </p>
57
85
  <ul>
58
- <li><a href="https://developers.staffbase.com/concepts/customplugin-overview/">Developer Portal: Custom Plugins</a></li>
59
- <li><a href="https://github.com/Staffbase/plugins-sdk-nodejs/blob/master/README.MD">Staffbase Plugins SDK for Node.js</a></li>
86
+ <li>
87
+ <a href="https://developers.staffbase.com/concepts/customplugin-overview/"
88
+ >Developer Portal: Custom Plugins</a
89
+ >
90
+ </li>
91
+ <li>
92
+ <a
93
+ href="https://github.com/Staffbase/plugins-sdk-nodejs/blob/master/README.md"
94
+ >Staffbase Plugins SDK for Node.js</a
95
+ >
96
+ </li>
60
97
  </ul>