dazscript-framework 0.1.9 → 0.1.10
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 +92 -0
- package/package.json +2 -2
- package/webpack.config.js +70 -0
package/README.md
CHANGED
|
@@ -1 +1,93 @@
|
|
|
1
1
|
# DazScript Framework
|
|
2
|
+
|
|
3
|
+
The **DazScript Framework** is a TypeScript-based framework for writing Daz Studio scripts. It provides all the advantages of a typed language such as autocompletion, error checking, and method parameter documentation and hinting. The framework also includes a set of dialog helpers for rapid UI development.
|
|
4
|
+
|
|
5
|
+
## Benefits
|
|
6
|
+
|
|
7
|
+
- **Autocompletion:** Take advantage of IDE autocompletion for faster and more efficient script development.
|
|
8
|
+
- **Error Checking:** Catch potential errors early in the development process with TypeScript's static analysis.
|
|
9
|
+
- **Method Documentation & Hinting:** Get contextual documentation and hints for methods, classes, and parameters.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- TypeScript support with full IntelliSense.
|
|
14
|
+
- A powerful set of decorators and helper methods for building interactive scripts.
|
|
15
|
+
- Easy integration with Daz Studio for quick script deployment.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
To install the **DazScript Framework**, run the following command:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install dazscript-framework
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Setup
|
|
26
|
+
|
|
27
|
+
After installing the package, you will need to configure a few files for your project.
|
|
28
|
+
|
|
29
|
+
1. **babel.config.js**
|
|
30
|
+
|
|
31
|
+
Create the file and add the following content:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
const sharedBabelConfig = require('dazscript-framework/babel');
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
...sharedBabelConfig,
|
|
38
|
+
presets: [...sharedBabelConfig.presets],
|
|
39
|
+
plugins: [...sharedBabelConfig.plugins],
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. **package.json**
|
|
44
|
+
|
|
45
|
+
Add the following scripts to your package.json:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
"scripts": {
|
|
49
|
+
"prebuild": "npm run installer",
|
|
50
|
+
"build": "webpack --env outputPath=./out",
|
|
51
|
+
"postbuild": "npm run icons",
|
|
52
|
+
"watch": "webpack --env outputPath=./out --watch",
|
|
53
|
+
"icons": "copyfiles -u 1 src/**/*.png out/",
|
|
54
|
+
"installer": "node ./node_modules/dazscript-framework/dist/scripts/install-generator.js -p ./src/scripts -m /My Scripts"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
3. **tsconfig.json**
|
|
59
|
+
|
|
60
|
+
Create the file and add the following content:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"extends": "./node_modules/dazscript-framework/tsconfig.json",
|
|
65
|
+
"compilerOptions": {
|
|
66
|
+
"baseUrl": "./",
|
|
67
|
+
"paths": {
|
|
68
|
+
"shared/*": ["src/shared/*"],
|
|
69
|
+
"@dst/*": ["node_modules/dazscript-types/*"],
|
|
70
|
+
"@dsf/*": ["node_modules/dazscript-framework/src/*"]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"include": ["node_modules/dazscript-types/**/*", "src/**/*"]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
4. **webpack.config.js**
|
|
78
|
+
Create the file and add the following content:
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
const sharedWebpackConfig = require('dazscript-framework/webpack');
|
|
82
|
+
|
|
83
|
+
module.exports = (env, argv) => {
|
|
84
|
+
const sharedConfig = sharedWebpackConfig(env, argv);
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
...sharedConfig,
|
|
88
|
+
// You can override or add more customizations here if needed
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Usage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dazscript-framework",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"author": "Freddy Diaz",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"tsconfig.json",
|
|
31
|
-
"webpack.config",
|
|
31
|
+
"webpack.config.js",
|
|
32
32
|
"babel.config.js",
|
|
33
33
|
"dist/**/*",
|
|
34
34
|
"src/**/*"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const glob = require('glob');
|
|
3
|
+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
4
|
+
|
|
5
|
+
module.exports = (env, argv) => {
|
|
6
|
+
const isFileSpecified = env && env.file;
|
|
7
|
+
const entryFiles = isFileSpecified
|
|
8
|
+
? [`./src/${env.file}.dsa.ts`]
|
|
9
|
+
: glob.sync('./src/**/*.dsa.ts');
|
|
10
|
+
|
|
11
|
+
const outputPath =
|
|
12
|
+
env && env.outputPath
|
|
13
|
+
? path.resolve(env.outputPath)
|
|
14
|
+
: path.resolve(__dirname, 'out');
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
mode: 'production',
|
|
18
|
+
optimization: {
|
|
19
|
+
usedExports: true,
|
|
20
|
+
},
|
|
21
|
+
entry: entryFiles.reduce((acc, filePath) => {
|
|
22
|
+
const entry = filePath.replace('.dsa.ts', '').replace('src/', '');
|
|
23
|
+
acc[entry] = `./${filePath}`;
|
|
24
|
+
return acc;
|
|
25
|
+
}, {}),
|
|
26
|
+
module: {
|
|
27
|
+
rules: [
|
|
28
|
+
{
|
|
29
|
+
test: /\.ts$/,
|
|
30
|
+
use: [
|
|
31
|
+
{
|
|
32
|
+
loader: 'babel-loader',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
loader: 'ts-loader',
|
|
36
|
+
options: {
|
|
37
|
+
allowTsInNodeModules: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
exclude: [
|
|
42
|
+
{
|
|
43
|
+
and: [path.resolve(__dirname, 'node_modules')],
|
|
44
|
+
not: [
|
|
45
|
+
path.resolve(__dirname, 'node_modules/dazscript-framework/src'),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
resolve: {
|
|
53
|
+
extensions: ['.ts'],
|
|
54
|
+
plugins: [new TsconfigPathsPlugin()],
|
|
55
|
+
},
|
|
56
|
+
output: {
|
|
57
|
+
filename: '[name].dsa',
|
|
58
|
+
path: outputPath,
|
|
59
|
+
environment: {
|
|
60
|
+
arrowFunction: false,
|
|
61
|
+
bigIntLiteral: false,
|
|
62
|
+
const: false,
|
|
63
|
+
destructuring: false,
|
|
64
|
+
dynamicImport: false,
|
|
65
|
+
forOf: true,
|
|
66
|
+
module: false,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
};
|