creatium 0.0.2
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/CHANGELOG.md +10 -0
- package/LICENSE +676 -0
- package/README.md +852 -0
- package/build.config.js +9 -0
- package/dist/main.d.mts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.mjs +1 -0
- package/docs/index.md +103 -0
- package/examples/simple/bin.js +27 -0
- package/examples/simple/templates/js-project/main.js +6 -0
- package/examples/simple/templates/js-project/package.json +4 -0
- package/examples/simple/templates/ts-project/package.json +4 -0
- package/examples/simple/templates/ts-project/src/main.ts +6 -0
- package/package.json +42 -0
- package/src/main.ts +1 -0
- package/tsconfig.json +6 -0
package/build.config.js
ADDED
package/dist/main.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@creatium/core';
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@creatium/core';
|
package/dist/main.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@creatium/core';
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# 🚀 Usage
|
|
2
|
+
|
|
3
|
+
Create a cli and a library project with `{{pkg.extra.id}}`
|
|
4
|
+
|
|
5
|
+
Simple usage example:
|
|
6
|
+
|
|
7
|
+
## Project structure
|
|
8
|
+
|
|
9
|
+
Create a project with the following structure:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
📂 src
|
|
13
|
+
├── bin.js
|
|
14
|
+
├── lib.js
|
|
15
|
+
└── main.js
|
|
16
|
+
📂 templates
|
|
17
|
+
└── 📂 js-project
|
|
18
|
+
└── 📂 ts-project
|
|
19
|
+
📄 package.json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## src/main.js
|
|
23
|
+
|
|
24
|
+
Create a new instance of `{{pkg.extra.id}}` and export it as `core`
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
|
|
28
|
+
import { dirname, join } from 'node:path'
|
|
29
|
+
import { fileURLToPath } from 'node:url'
|
|
30
|
+
import { version } from './package.json'
|
|
31
|
+
import { Creatium } from '{{pkg.extra.id}}'
|
|
32
|
+
|
|
33
|
+
const currentDir = join( dirname( fileURLToPath( import.meta.url ) ) )
|
|
34
|
+
const templatesDir = join( currentDir, '..', 'templates' )
|
|
35
|
+
|
|
36
|
+
export const core = new Creatium( {
|
|
37
|
+
name: 'Simple test',
|
|
38
|
+
version,
|
|
39
|
+
templates : {
|
|
40
|
+
js : {
|
|
41
|
+
input : join( templatesDir, 'js-project' ),
|
|
42
|
+
name : 'JavaScript project',
|
|
43
|
+
},
|
|
44
|
+
ts : {
|
|
45
|
+
input : join( templatesDir, 'ts-project' ),
|
|
46
|
+
name : 'TypeScript project',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
} )
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## src/bin.js
|
|
53
|
+
|
|
54
|
+
Create a bin file and call the `cli` method of the `core` instance.
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
|
|
58
|
+
// create cli
|
|
59
|
+
import { core } from './main.js'
|
|
60
|
+
await core.cli()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## src/lib.js
|
|
64
|
+
|
|
65
|
+
Create a library file and export the `create` function for use outside.
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
import { core } from './main.js'
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Create project template.
|
|
72
|
+
* @param {Parameters<typeof core.build>[0]} params - The parameters required for creation.
|
|
73
|
+
* @returns {Promise<Object>} A promise that resolves to the result of the creation process.
|
|
74
|
+
*/
|
|
75
|
+
export const create = async ( params ) => {
|
|
76
|
+
|
|
77
|
+
return await core.build( params )
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## package.json
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"name": "create-{my-library-name}",
|
|
87
|
+
"version": "0.0.1",
|
|
88
|
+
"type": "module",
|
|
89
|
+
"main": "src/lib.js",
|
|
90
|
+
"module": "src/lib.js",
|
|
91
|
+
"bin": {
|
|
92
|
+
"create-{my-library-name}": "bin.js"
|
|
93
|
+
},
|
|
94
|
+
"files": [
|
|
95
|
+
"src",
|
|
96
|
+
"templates",
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## templates
|
|
102
|
+
|
|
103
|
+
Create a template folder with your templates.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dirname,
|
|
3
|
+
join,
|
|
4
|
+
} from 'node:path'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
|
|
7
|
+
import { Creatium } from '../../dist/main.mjs'
|
|
8
|
+
|
|
9
|
+
const currentDir = join( dirname( fileURLToPath( import.meta.url ) ) )
|
|
10
|
+
const templatesDir = join( currentDir, 'templates' )
|
|
11
|
+
|
|
12
|
+
const core = new Creatium( {
|
|
13
|
+
name : 'Simple test',
|
|
14
|
+
version : '0.0.1',
|
|
15
|
+
templates : {
|
|
16
|
+
js : {
|
|
17
|
+
input : join( templatesDir, 'js-project' ),
|
|
18
|
+
name : 'JavaScript project',
|
|
19
|
+
},
|
|
20
|
+
ts : {
|
|
21
|
+
input : join( templatesDir, 'ts-project' ),
|
|
22
|
+
name : 'TypeScript project',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
} )
|
|
26
|
+
|
|
27
|
+
core.cli()
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "creatium",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"bugs": {
|
|
5
|
+
"url": "https://github.com/pigeonposse/creatium/issues",
|
|
6
|
+
"email": "dev@pigeonposse.com"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/pigeonposse/creatium",
|
|
11
|
+
"directory": "packages/lib"
|
|
12
|
+
},
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "individual",
|
|
15
|
+
"url": "https://pigeonposse.com/?popup=donate"
|
|
16
|
+
},
|
|
17
|
+
"license": "GPL-3.0",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Angelo",
|
|
20
|
+
"email": "angelo@pigeonposse.com",
|
|
21
|
+
"url": "https://github.com/angelespejo"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "dist/main.mjs",
|
|
25
|
+
"module": "dist/main.mjs",
|
|
26
|
+
"types": "dist/main.d.ts",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@creatium/core": "0.0.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@creatium/repo-config": "0.0.2"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"registry": "https://registry.npmjs.org/"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "unbuild",
|
|
39
|
+
"dev": "tsx examples/simple/bin.js",
|
|
40
|
+
"test": "vitest run -r src --passWithNoTests"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/main.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@creatium/core'
|