@unisphere/nx 1.0.1
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.
- package/README.md +32 -0
- package/dist/generators/add-application/add-application.d.ts +5 -0
- package/dist/generators/add-application/add-application.d.ts.map +1 -0
- package/dist/generators/add-application/add-application.js +98 -0
- package/dist/generators/add-application/schema.d.ts +6 -0
- package/dist/generators/add-application/schema.json +92 -0
- package/dist/generators/add-application/templates/default/.babelrc +11 -0
- package/dist/generators/add-application/templates/default/.eslintrc.json +18 -0
- package/dist/generators/add-application/templates/default/jest.config.d.ts +14 -0
- package/dist/generators/add-application/templates/default/jest.config.d.ts.map +1 -0
- package/dist/generators/add-application/templates/default/jest.config.js +13 -0
- package/dist/generators/add-application/templates/default/package.json.template +7 -0
- package/dist/generators/add-application/templates/default/project.json.template +9 -0
- package/dist/generators/add-application/templates/default/src/app/app.tsx.template +76 -0
- package/dist/generators/add-application/templates/default/src/favicon.ico +0 -0
- package/dist/generators/add-application/templates/default/src/index.html.template +17 -0
- package/dist/generators/add-application/templates/default/src/main.tsx +13 -0
- package/dist/generators/add-application/templates/default/src/styles.css +0 -0
- package/dist/generators/add-application/templates/default/tsconfig.app.json +24 -0
- package/dist/generators/add-application/templates/default/tsconfig.json +20 -0
- package/dist/generators/add-application/templates/default/tsconfig.spec.json +25 -0
- package/dist/generators/add-application/templates/default/webpack.config.js.template +33 -0
- package/dist/generators/add-application/templates/interactive-playground/.babelrc +11 -0
- package/dist/generators/add-application/templates/interactive-playground/.eslintrc.json +18 -0
- package/dist/generators/add-application/templates/interactive-playground/jest.config.d.ts +14 -0
- package/dist/generators/add-application/templates/interactive-playground/jest.config.d.ts.map +1 -0
- package/dist/generators/add-application/templates/interactive-playground/jest.config.js +13 -0
- package/dist/generators/add-application/templates/interactive-playground/package.json +7 -0
- package/dist/generators/add-application/templates/interactive-playground/project.json +9 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/app.tsx.template +122 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/components/header.tsx.template +123 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/components/settings-buttons.tsx +59 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/components/settings-form.tsx +104 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/components/settings.tsx +74 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/configuration-provider.tsx +163 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.d.ts +11 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.d.ts.map +1 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/definitions.js +19 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.d.ts +13 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.d.ts.map +1 -0
- package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.js +35 -0
- package/dist/generators/add-application/templates/interactive-playground/src/favicon.ico +0 -0
- package/dist/generators/add-application/templates/interactive-playground/src/index.html +17 -0
- package/dist/generators/add-application/templates/interactive-playground/src/main.tsx +13 -0
- package/dist/generators/add-application/templates/interactive-playground/src/styles.css +0 -0
- package/dist/generators/add-application/templates/interactive-playground/tsconfig.app.json +24 -0
- package/dist/generators/add-application/templates/interactive-playground/tsconfig.json +20 -0
- package/dist/generators/add-application/templates/interactive-playground/tsconfig.spec.json +25 -0
- package/dist/generators/add-application/templates/interactive-playground/webpack.config.js +33 -0
- package/dist/generators/add-package/README.md +70 -0
- package/dist/generators/add-package/add-package.d.ts +5 -0
- package/dist/generators/add-package/add-package.d.ts.map +1 -0
- package/dist/generators/add-package/add-package.js +85 -0
- package/dist/generators/add-package/files/.babelrc +12 -0
- package/dist/generators/add-package/files/.eslintrc.json +18 -0
- package/dist/generators/add-package/files/README.md +1 -0
- package/dist/generators/add-package/files/package.json.template +22 -0
- package/dist/generators/add-package/files/project.json.template +22 -0
- package/dist/generators/add-package/files/rollup.config.js +6 -0
- package/dist/generators/add-package/files/src/index.ts +1 -0
- package/dist/generators/add-package/files/tsconfig.json +20 -0
- package/dist/generators/add-package/files/tsconfig.lib.json +23 -0
- package/dist/generators/add-package/files/tsconfig.spec.json +26 -0
- package/dist/generators/add-package/files/vite.config.ts +30 -0
- package/dist/generators/add-package/schema.d.ts +4 -0
- package/dist/generators/add-package/schema.json +46 -0
- package/dist/generators/add-runtime/add-runtime.d.ts +5 -0
- package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -0
- package/dist/generators/add-runtime/add-runtime.js +112 -0
- package/dist/generators/add-runtime/core-templates/__runtimeName__-runtime/runtime-types.ts.template +21 -0
- package/dist/generators/add-runtime/files/.babelrc +12 -0
- package/dist/generators/add-runtime/files/.eslintrc.json +18 -0
- package/dist/generators/add-runtime/files/README.md.template +1 -0
- package/dist/generators/add-runtime/files/package.json.template +12 -0
- package/dist/generators/add-runtime/files/project.json.template +22 -0
- package/dist/generators/add-runtime/files/rollup.config.js +6 -0
- package/dist/generators/add-runtime/files/src/index.ts +1 -0
- package/dist/generators/add-runtime/files/src/lib/create-factory.tsx.template +21 -0
- package/dist/generators/add-runtime/files/src/lib/runtime.tsx.template +66 -0
- package/dist/generators/add-runtime/files/tsconfig.json +20 -0
- package/dist/generators/add-runtime/files/tsconfig.lib.json +23 -0
- package/dist/generators/add-runtime/files/tsconfig.spec.json +26 -0
- package/dist/generators/add-runtime/files/vite.config.ts +30 -0
- package/dist/generators/add-runtime/schema.d.ts +4 -0
- package/dist/generators/add-runtime/schema.json +44 -0
- package/dist/generators/add-visual/add-visual.d.ts +8 -0
- package/dist/generators/add-visual/add-visual.d.ts.map +1 -0
- package/dist/generators/add-visual/add-visual.js +236 -0
- package/dist/generators/add-visual/files/render-method.template +31 -0
- package/dist/generators/add-visual/schema.d.ts +5 -0
- package/dist/generators/add-visual/schema.json +30 -0
- package/dist/generators/add-visual/visual-utils.d.ts +42 -0
- package/dist/generators/add-visual/visual-utils.d.ts.map +1 -0
- package/dist/generators/add-visual/visual-utils.js +99 -0
- package/dist/generators/utils.d.ts +18 -0
- package/dist/generators/utils.d.ts.map +1 -0
- package/dist/generators/utils.js +198 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/generators.json +24 -0
- package/package.json +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-deep.d.ts","sourceRoot":"","sources":["../../../../../../../../src/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,OAEjC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,CAgB7D"}
|
package/dist/generators/add-application/templates/interactive-playground/src/app/utils/merge-deep.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isObject = isObject;
|
|
4
|
+
exports.mergeDeep = mergeDeep;
|
|
5
|
+
/**
|
|
6
|
+
* Simple object check.
|
|
7
|
+
* @param item
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
function isObject(item) {
|
|
11
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Deep merge two objects.
|
|
15
|
+
* @param target
|
|
16
|
+
* @param ...sources
|
|
17
|
+
*/
|
|
18
|
+
function mergeDeep(target, ...sources) {
|
|
19
|
+
if (!sources.length)
|
|
20
|
+
return target;
|
|
21
|
+
const source = sources.shift();
|
|
22
|
+
if (isObject(target) && isObject(source)) {
|
|
23
|
+
for (const key in source) {
|
|
24
|
+
if (isObject(source[key])) {
|
|
25
|
+
if (!target[key])
|
|
26
|
+
Object.assign(target, { [key]: {} });
|
|
27
|
+
mergeDeep(target[key], source[key]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
Object.assign(target, { [key]: source[key] });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return mergeDeep(target, ...sources);
|
|
35
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
<%= htmlPageTitle %>
|
|
8
|
+
</title>
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
<div id="root"></div>
|
|
15
|
+
</body>
|
|
16
|
+
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import * as ReactDOM from 'react-dom/client';
|
|
3
|
+
|
|
4
|
+
import App from './app/app';
|
|
5
|
+
|
|
6
|
+
const root = ReactDOM.createRoot(
|
|
7
|
+
document.getElementById('root') as HTMLElement
|
|
8
|
+
);
|
|
9
|
+
root.render(
|
|
10
|
+
<StrictMode>
|
|
11
|
+
<App />
|
|
12
|
+
</StrictMode>
|
|
13
|
+
);
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"exclude": [
|
|
13
|
+
"jest.config.ts",
|
|
14
|
+
"src/**/*.spec.ts",
|
|
15
|
+
"src/**/*.test.ts",
|
|
16
|
+
"src/**/*.spec.tsx",
|
|
17
|
+
"src/**/*.test.tsx",
|
|
18
|
+
"src/**/*.spec.js",
|
|
19
|
+
"src/**/*.test.js",
|
|
20
|
+
"src/**/*.spec.jsx",
|
|
21
|
+
"src/**/*.test.jsx"
|
|
22
|
+
],
|
|
23
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"allowJs": false,
|
|
5
|
+
"esModuleInterop": false,
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"strict": true
|
|
8
|
+
},
|
|
9
|
+
"files": [],
|
|
10
|
+
"include": [],
|
|
11
|
+
"references": [
|
|
12
|
+
{
|
|
13
|
+
"path": "./tsconfig.app.json"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "./tsconfig.spec.json"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"extends": "../../../tsconfig.base.json"
|
|
20
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": [
|
|
7
|
+
"jest",
|
|
8
|
+
"node",
|
|
9
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
10
|
+
"@nx/react/typings/image.d.ts"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"jest.config.ts",
|
|
15
|
+
"src/**/*.test.ts",
|
|
16
|
+
"src/**/*.spec.ts",
|
|
17
|
+
"src/**/*.test.tsx",
|
|
18
|
+
"src/**/*.spec.tsx",
|
|
19
|
+
"src/**/*.test.js",
|
|
20
|
+
"src/**/*.spec.js",
|
|
21
|
+
"src/**/*.test.jsx",
|
|
22
|
+
"src/**/*.spec.jsx",
|
|
23
|
+
"src/**/*.d.ts"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
|
2
|
+
const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin');
|
|
3
|
+
const { join } = require('path');
|
|
4
|
+
|
|
5
|
+
const baseHref = process.env.UNISPHERE_BASE_HREF || '/';
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
output: {
|
|
9
|
+
path: join(__dirname, '../../../dist/unisphere/applications/<%= applicationName__lowerDashCase %>'),
|
|
10
|
+
publicPath: baseHref,
|
|
11
|
+
},
|
|
12
|
+
devServer: {
|
|
13
|
+
port: 4200,
|
|
14
|
+
},
|
|
15
|
+
plugins: [
|
|
16
|
+
new NxAppWebpackPlugin({
|
|
17
|
+
tsConfig: './tsconfig.app.json',
|
|
18
|
+
compiler: 'babel',
|
|
19
|
+
main: './src/main.tsx',
|
|
20
|
+
index: './src/index.html',
|
|
21
|
+
baseHref,
|
|
22
|
+
assets: ['./src/favicon.ico'],
|
|
23
|
+
styles: ['./src/styles.css'],
|
|
24
|
+
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
25
|
+
optimization: process.env['NODE_ENV'] === 'production',
|
|
26
|
+
}),
|
|
27
|
+
new NxReactWebpackPlugin({
|
|
28
|
+
// Uncomment this line if you don't want to use SVGR
|
|
29
|
+
// See: https://react-svgr.com/
|
|
30
|
+
// svgr: false
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Add Package Generator
|
|
2
|
+
|
|
3
|
+
This generator creates a new package in the Unisphere workspace with proper configuration based on the scope and naming conventions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Using the generator with the full path
|
|
9
|
+
npx nx generate @unisphere/nx:add-package
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## User Prompts
|
|
13
|
+
|
|
14
|
+
The generator will prompt you for the following information:
|
|
15
|
+
|
|
16
|
+
### Required Inputs
|
|
17
|
+
|
|
18
|
+
1. **packageName** (mandatory)
|
|
19
|
+
|
|
20
|
+
- Format: `a-zA-Z[-][ ]` (alphanumeric with dashes and spaces allowed)
|
|
21
|
+
- Example: `core`, `notification-service`, `user management`
|
|
22
|
+
|
|
23
|
+
2. **scope** (required, defaults to 'internal')
|
|
24
|
+
- **public**: Published to npm with `@unisphere/` prefix
|
|
25
|
+
- **internal**: Published to GitHub packages with `@kaltura/unisphere-` prefix
|
|
26
|
+
- **none**: Private repository only, no scope prefix
|
|
27
|
+
|
|
28
|
+
## Local Development & Distribution
|
|
29
|
+
|
|
30
|
+
### Packaging for Local Use
|
|
31
|
+
|
|
32
|
+
Use the built-in packaging tool to create distributable packages:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Interactive packager - guides you through the process
|
|
36
|
+
npm run pack-generator
|
|
37
|
+
|
|
38
|
+
# This will:
|
|
39
|
+
# 1. Build the generator automatically
|
|
40
|
+
# 2. Create an npm package (.tgz file)
|
|
41
|
+
# 3. Ask what you want to do with it:
|
|
42
|
+
# - Move to a specific directory
|
|
43
|
+
# - Install directly in a target repository
|
|
44
|
+
# - Keep in current directory
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Installing in Other Repositories
|
|
48
|
+
|
|
49
|
+
After packaging, install in your target repository:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install the generated package
|
|
53
|
+
npm install --save-dev path/to/unisphere-nx-workspace-plugin-unisphere-generator-0.0.1.tgz
|
|
54
|
+
|
|
55
|
+
# Use the generator
|
|
56
|
+
npx nx g @unisphere/nx:add-package
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Alternative Installation Methods
|
|
60
|
+
|
|
61
|
+
1. **Direct file path** (for development):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install --save-dev file:../path/to/unisphere-nx-workspace-plugin/unisphere-generator
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. **Using npx directly**:
|
|
68
|
+
```bash
|
|
69
|
+
npx --package file:../unisphere-nx-workspace-plugin/unisphere-generator nx g @unisphere/nx:add-package
|
|
70
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { AddPackageGeneratorSchema } from './schema';
|
|
3
|
+
export declare function addPackageGenerator(tree: Tree, options: AddPackageGeneratorSchema): Promise<() => void>;
|
|
4
|
+
export default addPackageGenerator;
|
|
5
|
+
//# sourceMappingURL=add-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-package.d.ts","sourceRoot":"","sources":["../../../src/generators/add-package/add-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAGL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAkBrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBAoGnC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPackageGenerator = addPackageGenerator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
async function addPackageGenerator(tree, options) {
|
|
9
|
+
// Validate and read .unisphere configuration
|
|
10
|
+
const unisphereConfig = (0, utils_1.validateUnisphereConfig)(tree);
|
|
11
|
+
// Extract environment variables
|
|
12
|
+
const companyName = unisphereConfig.company;
|
|
13
|
+
const experienceName = unisphereConfig.name;
|
|
14
|
+
// Calculate packageJsonName based on scope and names
|
|
15
|
+
let packageJsonName;
|
|
16
|
+
const userInputPackageName = (0, devkit_1.names)(options.packageName).fileName;
|
|
17
|
+
if (experienceName === userInputPackageName) {
|
|
18
|
+
packageJsonName = userInputPackageName;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
packageJsonName = experienceName + `-${userInputPackageName}`;
|
|
22
|
+
}
|
|
23
|
+
const prefix = options.scope === 'public' ? '@unisphere/' : '@kaltura/unisphere-';
|
|
24
|
+
packageJsonName = prefix + packageJsonName;
|
|
25
|
+
const repositoryPrivate = options.scope === 'none';
|
|
26
|
+
// Calculate distributionChannel
|
|
27
|
+
let distributionChannel;
|
|
28
|
+
switch (options.scope) {
|
|
29
|
+
case 'public':
|
|
30
|
+
distributionChannel = 'npm';
|
|
31
|
+
break;
|
|
32
|
+
case 'none':
|
|
33
|
+
distributionChannel = 'none';
|
|
34
|
+
break;
|
|
35
|
+
case 'internal':
|
|
36
|
+
default:
|
|
37
|
+
distributionChannel = 'github';
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
const transformedPackageName = (0, devkit_1.names)(userInputPackageName);
|
|
41
|
+
const githubUrl = `https://github.com/${companyName}/${experienceName}`;
|
|
42
|
+
// Prepare template variables
|
|
43
|
+
const templateVariables = {
|
|
44
|
+
scope: options.scope,
|
|
45
|
+
repositoryPrivate,
|
|
46
|
+
distributionChannel,
|
|
47
|
+
githubUrl,
|
|
48
|
+
companyName,
|
|
49
|
+
...(0, utils_1.createNameTransforms)(userInputPackageName, 'packageName'),
|
|
50
|
+
...(0, utils_1.createNameTransforms)(experienceName, 'experienceName'),
|
|
51
|
+
...(0, utils_1.createNameTransforms)(packageJsonName, 'packageJsonName'),
|
|
52
|
+
...transformedPackageName,
|
|
53
|
+
tmpl: '',
|
|
54
|
+
};
|
|
55
|
+
const projectRoot = `unisphere/packages/${userInputPackageName}`;
|
|
56
|
+
// Check if the project already exists
|
|
57
|
+
if (tree.exists(projectRoot)) {
|
|
58
|
+
throw new Error(`Package "${userInputPackageName}" already exists at ${projectRoot}.\n` +
|
|
59
|
+
'Please choose a different package name or remove the existing package first.');
|
|
60
|
+
}
|
|
61
|
+
// Generate files from templates (project.json.template will define the project)
|
|
62
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, templateVariables);
|
|
63
|
+
// Update .unisphere configuration
|
|
64
|
+
(0, utils_1.updateUnisphereConfig)(tree, 'packages', userInputPackageName, {
|
|
65
|
+
sourceRoot: `unisphere/packages/${userInputPackageName}`,
|
|
66
|
+
distributionChannel: distributionChannel,
|
|
67
|
+
scope: 'widget',
|
|
68
|
+
});
|
|
69
|
+
// Update tsconfig.base.json with path mapping
|
|
70
|
+
(0, utils_1.updateTsConfigPaths)(tree, packageJsonName, `unisphere/packages/${userInputPackageName}/src/index.ts`);
|
|
71
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
72
|
+
// Return a function that will be executed after all file operations are complete
|
|
73
|
+
return () => {
|
|
74
|
+
devkit_1.logger.info('');
|
|
75
|
+
devkit_1.logger.info('✅ Package generated successfully!');
|
|
76
|
+
devkit_1.logger.info('');
|
|
77
|
+
devkit_1.logger.info(`📦 Package Name: ${userInputPackageName}`);
|
|
78
|
+
devkit_1.logger.info(`🏷️ Full Package Name: ${packageJsonName}`);
|
|
79
|
+
devkit_1.logger.info(`📁 Location: ${projectRoot}`);
|
|
80
|
+
devkit_1.logger.info(`🔧 Scope: ${options.scope}`);
|
|
81
|
+
devkit_1.logger.info(`📤 Distribution Channel: ${distributionChannel}`);
|
|
82
|
+
devkit_1.logger.info('');
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.default = addPackageGenerator;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["plugin:@nx/react", "../../../.eslintrc.json"],
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
+
"rules": {}
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"files": ["*.ts", "*.tsx"],
|
|
11
|
+
"rules": {}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"files": ["*.js", "*.jsx"],
|
|
15
|
+
"rules": {}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Unisphere <%= experienceName__humanReadable %> - Package <%= packageName__humanReadable %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= packageJsonName %>",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "kaltura",
|
|
5
|
+
"private": <%= repositoryPrivate %>,
|
|
6
|
+
"license": "AGPL-3.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "<%= githubUrl %>"
|
|
10
|
+
},
|
|
11
|
+
"types": "./index.esm.d.ts",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@unisphere/runtime": "^1.54.1"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
<% if (distributionChannel === 'github') { %>
|
|
17
|
+
"registry": "https://npm.pkg.github.com"
|
|
18
|
+
<% } else if (distributionChannel === 'npm') { %>
|
|
19
|
+
"registry": "https://registry.npmjs.org"
|
|
20
|
+
<% } %>
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "unisphere-package-<%= packageName__lowerDashCase %>",
|
|
3
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "unisphere/packages/<%= packageName__lowerDashCase %>/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"// targets": "to see all targets run: nx show project unisphere-package-<%= packageName__lowerDashCase %> --web",
|
|
8
|
+
"targets": {
|
|
9
|
+
"lint": {
|
|
10
|
+
"executor": "@nx/eslint:lint",
|
|
11
|
+
"outputs": [
|
|
12
|
+
"{options.outputFile}"
|
|
13
|
+
],
|
|
14
|
+
"options": {
|
|
15
|
+
"lintFilePatterns": [
|
|
16
|
+
"unisphere/packages/<%= packageName__lowerDashCase %>/src/**/*.{ts,tsx,js,jsx}",
|
|
17
|
+
"unisphere/packages/<%= packageName__lowerDashCase %>/package.json"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"allowJs": false,
|
|
5
|
+
"esModuleInterop": false,
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"strict": true
|
|
8
|
+
},
|
|
9
|
+
"files": [],
|
|
10
|
+
"include": [],
|
|
11
|
+
"references": [
|
|
12
|
+
{
|
|
13
|
+
"path": "./tsconfig.lib.json"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "./tsconfig.spec.json"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"extends": "../../../tsconfig.base.json"
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
"@kaltura/ds-react-theme/src/lib/theme.d.ts",
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"exclude": [
|
|
13
|
+
"**/*.spec.ts",
|
|
14
|
+
"**/*.test.ts",
|
|
15
|
+
"**/*.spec.tsx",
|
|
16
|
+
"**/*.test.tsx",
|
|
17
|
+
"**/*.spec.js",
|
|
18
|
+
"**/*.test.js",
|
|
19
|
+
"**/*.spec.jsx",
|
|
20
|
+
"**/*.test.jsx"
|
|
21
|
+
],
|
|
22
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"vitest/globals",
|
|
7
|
+
"vitest/importMeta",
|
|
8
|
+
"vite/client",
|
|
9
|
+
"node",
|
|
10
|
+
"vitest"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"vite.config.ts",
|
|
15
|
+
"vitest.config.ts",
|
|
16
|
+
"src/**/*.test.ts",
|
|
17
|
+
"src/**/*.spec.ts",
|
|
18
|
+
"src/**/*.test.tsx",
|
|
19
|
+
"src/**/*.spec.tsx",
|
|
20
|
+
"src/**/*.test.js",
|
|
21
|
+
"src/**/*.spec.js",
|
|
22
|
+
"src/**/*.test.jsx",
|
|
23
|
+
"src/**/*.spec.jsx",
|
|
24
|
+
"src/**/*.d.ts"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
root: __dirname,
|
|
7
|
+
cacheDir: '../../../node_modules/.vite/unisphere/package-<%= packageName__lowerDashCase %>',
|
|
8
|
+
|
|
9
|
+
plugins: [react(), nxViteTsPaths()],
|
|
10
|
+
|
|
11
|
+
// Uncomment this if you are using workers.
|
|
12
|
+
// worker: {
|
|
13
|
+
// plugins: [ nxViteTsPaths() ],
|
|
14
|
+
// },
|
|
15
|
+
|
|
16
|
+
test: {
|
|
17
|
+
watch: false,
|
|
18
|
+
globals: true,
|
|
19
|
+
cache: {
|
|
20
|
+
dir: '../../../node_modules/.vitest/unisphere/package-<%= packageName__lowerDashCase %>',
|
|
21
|
+
},
|
|
22
|
+
environment: 'jsdom',
|
|
23
|
+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
24
|
+
reporters: ['default'],
|
|
25
|
+
coverage: {
|
|
26
|
+
reportsDirectory: '../../../coverage/unisphere/package-<%= packageName__lowerDashCase %>',
|
|
27
|
+
provider: 'v8',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "AddPackage",
|
|
4
|
+
"title": "Add Package Generator",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"packageName": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the package to create",
|
|
10
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9\\-\\s]*$",
|
|
11
|
+
"x-prompt": "What is the package name? (alphanumeric with dashes and spaces allowed)"
|
|
12
|
+
},
|
|
13
|
+
"scope": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The distribution scope of the package",
|
|
16
|
+
"enum": [
|
|
17
|
+
"public",
|
|
18
|
+
"internal",
|
|
19
|
+
"none"
|
|
20
|
+
],
|
|
21
|
+
"default": "internal",
|
|
22
|
+
"x-prompt": {
|
|
23
|
+
"message": "What scope should this package have?",
|
|
24
|
+
"type": "list",
|
|
25
|
+
"items": [
|
|
26
|
+
{
|
|
27
|
+
"value": "public",
|
|
28
|
+
"label": "Public (@unisphere/) - Published to npm"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"value": "internal",
|
|
32
|
+
"label": "Internal (@kaltura/unisphere-) - Published to GitHub packages"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"value": "none",
|
|
36
|
+
"label": "None (no scope) - Private repository only"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"required": [
|
|
43
|
+
"packageName",
|
|
44
|
+
"scope"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { AddRuntimeGeneratorSchema } from './schema';
|
|
3
|
+
export declare function addRuntimeGenerator(tree: Tree, options: AddRuntimeGeneratorSchema): Promise<() => void>;
|
|
4
|
+
export default addRuntimeGenerator;
|
|
5
|
+
//# sourceMappingURL=add-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-runtime.d.ts","sourceRoot":"","sources":["../../../src/generators/add-runtime/add-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAiB,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAyCrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,uBAsHnC;AAED,eAAe,mBAAmB,CAAC"}
|