@kosdev-code/kos-nx-plugin 2.0.40 → 2.0.42
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/generators.json +5 -0
- package/package.json +2 -2
- package/src/generators/kos-content-project/files/assets/.gitkeep +2 -0
- package/src/generators/kos-content-project/files/vite.config.ts.template +48 -0
- package/src/generators/kos-content-project/generator.d.ts +5 -0
- package/src/generators/kos-content-project/generator.d.ts.map +1 -0
- package/src/generators/kos-content-project/generator.js +55 -0
- package/src/generators/kos-content-project/generator.js.map +1 -0
- package/src/generators/kos-content-project/schema.d.ts +3 -0
- package/src/generators/kos-content-project/schema.json +18 -0
package/generators.json
CHANGED
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
"schema": "./src/generators/kos-theme-project/schema.json",
|
|
41
41
|
"description": "Create a new theme project for kos"
|
|
42
42
|
},
|
|
43
|
+
"kos-content-project": {
|
|
44
|
+
"factory": "./src/generators/kos-content-project/generator",
|
|
45
|
+
"schema": "./src/generators/kos-content-project/schema.json",
|
|
46
|
+
"description": "Create a new content project for KAB (Kos Asset Bundle) generation"
|
|
47
|
+
},
|
|
43
48
|
"kos-i18n-project": {
|
|
44
49
|
"factory": "./src/generators/kos-i18n-project/generator",
|
|
45
50
|
"schema": "./src/generators/kos-i18n-project/schema.json",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-nx-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.42",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"generators": "./generators.json",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"main": "./src/index.js",
|
|
20
20
|
"kos": {
|
|
21
21
|
"build": {
|
|
22
|
-
"gitHash": "
|
|
22
|
+
"gitHash": "04ed84eabdd07cebb95c0e356946f1cd36aad247"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types='vitest' />
|
|
2
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { defineConfig } from 'vite';
|
|
6
|
+
import dts from 'vite-plugin-dts';
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
root: __dirname,
|
|
10
|
+
cacheDir: '../../node_modules/.vite/<%= name %>',
|
|
11
|
+
publicDir: 'assets',
|
|
12
|
+
plugins: [
|
|
13
|
+
react(),
|
|
14
|
+
nxViteTsPaths(),
|
|
15
|
+
dts({
|
|
16
|
+
entryRoot: 'src',
|
|
17
|
+
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
// Uncomment this if you are using workers.
|
|
22
|
+
// worker: {
|
|
23
|
+
// plugins: [ nxViteTsPaths() ],
|
|
24
|
+
// },
|
|
25
|
+
|
|
26
|
+
// Configuration for building your library.
|
|
27
|
+
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
28
|
+
build: {
|
|
29
|
+
outDir: '../../dist/<%= name %>',
|
|
30
|
+
reportCompressedSize: true,
|
|
31
|
+
commonjsOptions: {
|
|
32
|
+
transformMixedEsModules: true,
|
|
33
|
+
},
|
|
34
|
+
lib: {
|
|
35
|
+
// Could also be a dictionary or array of multiple entry points.
|
|
36
|
+
entry: 'src/index.ts',
|
|
37
|
+
name: '<%= name %>',
|
|
38
|
+
fileName: '<%= name %>',
|
|
39
|
+
// Change this to the formats you want to support.
|
|
40
|
+
// Don't forget to update your package.json as well.
|
|
41
|
+
formats: ['es', 'cjs'],
|
|
42
|
+
},
|
|
43
|
+
rollupOptions: {
|
|
44
|
+
// External packages that should not be bundled into your library.
|
|
45
|
+
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tree } from "@nx/devkit";
|
|
2
|
+
import { KosContentProjectGeneratorSchema } from "./schema";
|
|
3
|
+
export declare function kosContentProjectGenerator(tree: Tree, options: KosContentProjectGeneratorSchema): Promise<void>;
|
|
4
|
+
export default kosContentProjectGenerator;
|
|
5
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/generators/kos-content-project/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAE5D,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gCAAgC,iBAmD1C;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kosContentProjectGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const eslint_1 = require("@nx/eslint");
|
|
6
|
+
const react_1 = require("@nx/react");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
async function kosContentProjectGenerator(tree, options) {
|
|
9
|
+
const config = (0, devkit_1.readNxJson)(tree);
|
|
10
|
+
const root = config?.workspaceLayout?.libsDir || "";
|
|
11
|
+
const projectRootDir = path.join(root, "content", options.name);
|
|
12
|
+
await (0, react_1.libraryGenerator)(tree, {
|
|
13
|
+
name: options.name,
|
|
14
|
+
bundler: "vite",
|
|
15
|
+
directory: projectRootDir,
|
|
16
|
+
component: false,
|
|
17
|
+
minimal: true,
|
|
18
|
+
projectNameAndRootFormat: "as-provided",
|
|
19
|
+
style: "css",
|
|
20
|
+
linter: eslint_1.Linter.EsLint,
|
|
21
|
+
});
|
|
22
|
+
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, options.name);
|
|
23
|
+
// Add KAB (Kos Asset Bundle) build targets similar to theme project
|
|
24
|
+
const externalJson = {
|
|
25
|
+
kab: {
|
|
26
|
+
command: `node tools/scripts/kabtool.mjs build ${options.name} && node tools/scripts/kabtool.mjs list ${options.name} `,
|
|
27
|
+
options: {
|
|
28
|
+
outputPath: `dist/archives/packages/${options.name}/`,
|
|
29
|
+
zipName: "ui.zip",
|
|
30
|
+
kabName: `${options.name}.kab`,
|
|
31
|
+
},
|
|
32
|
+
dependsOn: ["zip"],
|
|
33
|
+
},
|
|
34
|
+
zip: {
|
|
35
|
+
command: `node tools/scripts/archiver.js ${options.name}`,
|
|
36
|
+
options: {
|
|
37
|
+
outputPath: `dist/archives/packages/${options.name}/`,
|
|
38
|
+
zipName: "ui.zip",
|
|
39
|
+
},
|
|
40
|
+
dependsOn: ["build"],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.name, {
|
|
44
|
+
...projectConfiguration,
|
|
45
|
+
targets: {
|
|
46
|
+
...projectConfiguration.targets,
|
|
47
|
+
...externalJson,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, "files"), projectRootDir, options);
|
|
51
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
52
|
+
}
|
|
53
|
+
exports.kosContentProjectGenerator = kosContentProjectGenerator;
|
|
54
|
+
exports.default = kosContentProjectGenerator;
|
|
55
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/generators/kos-content-project/generator.ts"],"names":[],"mappings":";;;AAAA,uCAOoB;AACpB,uCAAoC;AACpC,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EF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;QAC7C,GAAG,oBAAoB;QACvB,OAAO,EAAE;YACP,GAAG,oBAAoB,CAAC,OAAO;YAC/B,GAAG,YAAY;SAChB;KACF,CAAC,CAAC;IAEH,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAE5E,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AArDD,gEAqDC;AAED,kBAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "KosContentProject",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use?"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["name"]
|
|
18
|
+
}
|