@signageos/cli 2.0.0 → 2.2.0
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 +1 -1
- package/dist/Applet/Generate/Templates/index.css.template +4 -0
- package/dist/Applet/Generate/Templates/index.html.template +12 -0
- package/dist/Applet/Generate/Templates/index.js.template +11 -0
- package/dist/Applet/Generate/Templates/rspack.config.mjs.template +48 -0
- package/dist/Applet/Generate/Templates/tsconfig.js.template +35 -0
- package/dist/Applet/Generate/Templates/webpack.config.js.template +47 -0
- package/dist/Applet/Generate/appletGenerateCommand.d.ts +29 -4
- package/dist/Applet/Generate/appletGenerateCommand.js +204 -142
- package/dist/Applet/Generate/appletGenerateCommand.js.map +1 -1
- package/dist/Applet/appletCommand.d.ts +4 -4
- package/dist/CustomScript/Generate/customScriptGenerateCommand.d.ts +7 -0
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +77 -0
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js.map +1 -0
- package/dist/CustomScript/Generate/customScriptGenerateFacade.d.ts +13 -0
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js +134 -0
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js.map +1 -0
- package/dist/CustomScript/customScriptCommand.d.ts +8 -2
- package/dist/CustomScript/customScriptCommand.js +2 -1
- package/dist/CustomScript/customScriptCommand.js.map +1 -1
- package/dist/Lib/childProcess.d.ts +7 -0
- package/dist/Lib/childProcess.js +28 -0
- package/dist/Lib/childProcess.js.map +1 -0
- package/dist/Lib/git.d.ts +4 -0
- package/dist/Lib/git.js +109 -0
- package/dist/Lib/git.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ npm run build
|
|
|
74
74
|
| --target-dir *(optional)* | Generate applet project to directory | ${PWD}/${name} |
|
|
75
75
|
| --npm-registry *(optional)* | NPM registry URL (for private npm) | |
|
|
76
76
|
| --language *(optional)* | Generate applet with "typescript" or "javascript" source code | STDIN |
|
|
77
|
-
| --bundler *(optional)* | Generate applet with "webpack" or "
|
|
77
|
+
| --bundler *(optional)* | Generate applet with "webpack" or "rspack" | webpack |
|
|
78
78
|
| --git *(optional)* | Initialize applet as git repository "yes" or "no" | no |
|
|
79
79
|
|
|
80
80
|
> ! Windows users note:
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<html lang="en">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="utf-8" />
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
5
|
+
<meta name="theme-color" content="#000000" />
|
|
6
|
+
<title>${title}</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Hello ${title}</h1>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import sos from '@signageos/front-applet';
|
|
3
|
+
|
|
4
|
+
// Wait on sos data are ready (https://docs.signageos.io/api/js/content/latest/js-applet-basics#onready)
|
|
5
|
+
sos.onReady().then(async function () {
|
|
6
|
+
const contentElement = document.getElementById('root');
|
|
7
|
+
if (contentElement) {
|
|
8
|
+
console.log('sOS is ready');
|
|
9
|
+
contentElement.innerHTML = 'sOS is ready';
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { rspack } from '@rspack/core';
|
|
2
|
+
import { defineConfig } from '@rspack/cli';
|
|
3
|
+
import SignageOSPlugin from '@signageos/webpack-plugin';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
entry: {
|
|
7
|
+
main: './src/index', // Universal configuration works for .js and .ts
|
|
8
|
+
},
|
|
9
|
+
resolve: {
|
|
10
|
+
extensionAlias: {
|
|
11
|
+
'.js': ['.ts', '.tsx', '.js'], // First search for .ts, than .js
|
|
12
|
+
},
|
|
13
|
+
extensions: ['.ts', '.tsx', '.js'],
|
|
14
|
+
},
|
|
15
|
+
target: ['web', 'es5'],
|
|
16
|
+
output: {
|
|
17
|
+
filename: 'index.js',
|
|
18
|
+
},
|
|
19
|
+
module: {
|
|
20
|
+
rules: [
|
|
21
|
+
{
|
|
22
|
+
test: /\.js$/,
|
|
23
|
+
exclude: /node_modules/,
|
|
24
|
+
use: {
|
|
25
|
+
loader: 'babel-loader',
|
|
26
|
+
options: {
|
|
27
|
+
presets: ['@babel/preset-env'], // Ensure ES5 transpilation
|
|
28
|
+
cacheDirectory: true, // Speed up subsequent builds
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
test: /^(.(?!.module.css))*.css$/,
|
|
34
|
+
use: ['style-loader', 'css-loader'],
|
|
35
|
+
},
|
|
36
|
+
{ test: /\.tsx?$/, loader: 'ts-loader' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
plugins: [
|
|
40
|
+
new rspack.HtmlRspackPlugin({
|
|
41
|
+
template: 'public/index.html',
|
|
42
|
+
}),
|
|
43
|
+
new SignageOSPlugin(),
|
|
44
|
+
],
|
|
45
|
+
infrastructureLogging: {
|
|
46
|
+
level: 'warn',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Sensible defaults for most projects */
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
6
|
+
"target": "es5",
|
|
7
|
+
"lib": ["es6", "dom"],
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"moduleDetection": "force",
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
|
|
16
|
+
/* Applet specific */
|
|
17
|
+
"downlevelIteration": true,
|
|
18
|
+
|
|
19
|
+
/* Type checking */
|
|
20
|
+
"strict": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"noUnusedLocals": true,
|
|
24
|
+
|
|
25
|
+
/* Features */
|
|
26
|
+
"experimentalDecorators": true,
|
|
27
|
+
"emitDecoratorMetadata": true,
|
|
28
|
+
"jsx": "react",
|
|
29
|
+
|
|
30
|
+
/* Typecheck javascript */
|
|
31
|
+
"allowJs": true,
|
|
32
|
+
"checkJs": true
|
|
33
|
+
},
|
|
34
|
+
"include": ["src/**/*.ts", "src/*.ts"]
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
2
|
+
const SignageOSPlugin = require('@signageos/webpack-plugin')
|
|
3
|
+
|
|
4
|
+
exports = module.exports = {
|
|
5
|
+
entry: {
|
|
6
|
+
main: './src/index', // Universal configuration works for .js and .ts
|
|
7
|
+
},
|
|
8
|
+
resolve: {
|
|
9
|
+
extensionAlias: {
|
|
10
|
+
'.js': ['.ts', '.tsx', '.js'], // First search for .ts, than .js
|
|
11
|
+
},
|
|
12
|
+
extensions: ['.ts', '.tsx', '.js'],
|
|
13
|
+
},
|
|
14
|
+
target: ['web', 'es5'],
|
|
15
|
+
output: {
|
|
16
|
+
filename: 'index.js',
|
|
17
|
+
},
|
|
18
|
+
module: {
|
|
19
|
+
rules: [
|
|
20
|
+
{
|
|
21
|
+
test: /\.js$/,
|
|
22
|
+
exclude: /node_modules/,
|
|
23
|
+
use: {
|
|
24
|
+
loader: 'babel-loader',
|
|
25
|
+
options: {
|
|
26
|
+
presets: ['@babel/preset-env'], // Ensure ES5 transpilation
|
|
27
|
+
cacheDirectory: true, // Speed up subsequent builds
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
test: /^(.(?!.module.css))*.css$/,
|
|
33
|
+
use: ['style-loader', 'css-loader'],
|
|
34
|
+
},
|
|
35
|
+
{ test: /\.tsx?$/, loader: 'ts-loader' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
plugins: [
|
|
39
|
+
new HtmlWebpackPlugin({
|
|
40
|
+
template: 'public/index.html',
|
|
41
|
+
}),
|
|
42
|
+
new SignageOSPlugin(),
|
|
43
|
+
],
|
|
44
|
+
infrastructureLogging: {
|
|
45
|
+
level: 'warn',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -23,13 +23,38 @@ declare const OPTION_LIST: readonly [{
|
|
|
23
23
|
}, {
|
|
24
24
|
readonly name: "bundler";
|
|
25
25
|
readonly type: StringConstructor;
|
|
26
|
-
readonly description: "Generate applet with \"webpack\" (default) or \"
|
|
27
|
-
readonly defaultValue: "webpack";
|
|
26
|
+
readonly description: "Generate applet with \"webpack\" (default) or \"rspack\"";
|
|
28
27
|
}, {
|
|
29
28
|
readonly name: "git";
|
|
30
29
|
readonly type: StringConstructor;
|
|
31
30
|
readonly description: "Init applet as git repository \"no\" (default) or \"yes\"";
|
|
31
|
+
readonly defaultValue: "no";
|
|
32
32
|
}];
|
|
33
|
+
/**
|
|
34
|
+
* Command definition for generating a new applet.
|
|
35
|
+
* This command facilitates the creation of a basic applet sample with configurable options such as
|
|
36
|
+
* language, bundler, git initialization, and npm registry. It generates the necessary files and
|
|
37
|
+
* installs dependencies based on the selected options.
|
|
38
|
+
* @param {Object} options - The options for generating the applet
|
|
39
|
+
* @param {string} options.name - The name of the applet
|
|
40
|
+
* @param {string} options.appletVersion - The version of the applet
|
|
41
|
+
* @param {string} options.targetDir - The target directory for the applet
|
|
42
|
+
* @param {string} options.npmRegistry - The npm registry URL
|
|
43
|
+
* @param {string} options.language - The language of the applet (typescript or javascript)
|
|
44
|
+
* @param {string} options.bundler - The bundler to use (webpack or rspack)
|
|
45
|
+
* @param {string} options.git - Whether to initialize a git repository (yes or no)
|
|
46
|
+
* @returns {Promise<void>} - A promise that resolves when the applet is generated
|
|
47
|
+
* @example
|
|
48
|
+
* appletGenerate.run({
|
|
49
|
+
* name: 'my-applet',
|
|
50
|
+
* appletVersion: '1.0.0',
|
|
51
|
+
* targetDir: './output',
|
|
52
|
+
* npmRegistry: 'https://registry.npmjs.org/',
|
|
53
|
+
* language: 'typescript',
|
|
54
|
+
* bundler: 'webpack',
|
|
55
|
+
* git: 'yes',
|
|
56
|
+
* });
|
|
57
|
+
*/
|
|
33
58
|
export declare const appletGenerate: {
|
|
34
59
|
name: "generate";
|
|
35
60
|
description: string;
|
|
@@ -57,12 +82,12 @@ export declare const appletGenerate: {
|
|
|
57
82
|
}, {
|
|
58
83
|
readonly name: "bundler";
|
|
59
84
|
readonly type: StringConstructor;
|
|
60
|
-
readonly description: "Generate applet with \"webpack\" (default) or \"
|
|
61
|
-
readonly defaultValue: "webpack";
|
|
85
|
+
readonly description: "Generate applet with \"webpack\" (default) or \"rspack\"";
|
|
62
86
|
}, {
|
|
63
87
|
readonly name: "git";
|
|
64
88
|
readonly type: StringConstructor;
|
|
65
89
|
readonly description: "Init applet as git repository \"no\" (default) or \"yes\"";
|
|
90
|
+
readonly defaultValue: "no";
|
|
66
91
|
}];
|
|
67
92
|
commands: never[];
|
|
68
93
|
run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
|