create-gasket-app 7.0.0-next.41 → 7.0.0-next.44
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 +51 -48
- package/lib/scaffold/actions/write-gasket-config.js +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -100,38 +100,36 @@ The `prompt` lifecycle is fired using [execWaterfall] and hooks should return a
|
|
|
100
100
|
modified `context` object.
|
|
101
101
|
|
|
102
102
|
```js
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
]);
|
|
126
|
-
|
|
127
|
-
if (answers.wantSoda === true) {
|
|
128
|
-
await addPlugins('gasket-plugin-soda@^2.0.0')
|
|
103
|
+
// gasket-plugin-pizza.js
|
|
104
|
+
|
|
105
|
+
const name = 'gasket-plugin-pizza';
|
|
106
|
+
const hooks = {
|
|
107
|
+
async prompt(gasket, context, { prompt }) {
|
|
108
|
+
const answers = await prompt([
|
|
109
|
+
{
|
|
110
|
+
name: 'pizzaSize',
|
|
111
|
+
message: 'Choose a pizza size:',
|
|
112
|
+
type: 'list',
|
|
113
|
+
choices: ['small', 'medium', 'large']
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'pizzaSauce',
|
|
117
|
+
message: 'Choose a pizza sauce:',
|
|
118
|
+
type: 'list',
|
|
119
|
+
choices: ['red', 'white']
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'wantSoda',
|
|
123
|
+
message: 'Do you want a soda?',
|
|
124
|
+
type: 'confirm'
|
|
129
125
|
}
|
|
126
|
+
]);
|
|
130
127
|
|
|
131
|
-
|
|
132
|
-
}
|
|
128
|
+
return { ...context, ...answers };
|
|
133
129
|
}
|
|
134
130
|
};
|
|
131
|
+
|
|
132
|
+
export default { name, hooks };
|
|
135
133
|
```
|
|
136
134
|
|
|
137
135
|
The hook is passed the following parameters:
|
|
@@ -156,29 +154,31 @@ package.json or register files and templates to be generated.
|
|
|
156
154
|
The `create` lifecycle is fired using [exec].
|
|
157
155
|
|
|
158
156
|
```js
|
|
159
|
-
|
|
157
|
+
// gasket-plugin-pizza.js
|
|
160
158
|
|
|
161
|
-
|
|
162
|
-
id: 'gasket-plugin-pizza',
|
|
163
|
-
hooks: {
|
|
164
|
-
async create(gasket, context) {
|
|
165
|
-
const { pkg, files } = context; // utils from context
|
|
166
|
-
const { pizzaSize, pizzaSauce } = context; // data provided by prompt
|
|
159
|
+
import path from 'path';
|
|
167
160
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
const name = 'gasket-plugin-pizza';
|
|
162
|
+
const hooks = {
|
|
163
|
+
async create(gasket, context) {
|
|
164
|
+
const { pkg, files } = context; // utils from context
|
|
165
|
+
const { pizzaSize, pizzaSauce } = context; // data provided by prompt
|
|
171
166
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
167
|
+
files.add(
|
|
168
|
+
path.join(__dirname, 'generator', 'ingredients', pizzaSauce)
|
|
169
|
+
);
|
|
175
170
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
pkg.add('devDependencies', {
|
|
172
|
+
'pizza-oven': '^1.0.0'
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
pkg.add('scripts', {
|
|
176
|
+
bake: `pizza-oven --size ${ pizzaSize }`
|
|
177
|
+
});
|
|
180
178
|
}
|
|
181
179
|
};
|
|
180
|
+
|
|
181
|
+
export default { name, hooks };
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
The hook is passed the following parameters:
|
|
@@ -206,9 +206,10 @@ generated. This is useful to use in conjunction with any scripts added in the
|
|
|
206
206
|
The `postCreate` lifecycle is fired by [exec]:
|
|
207
207
|
|
|
208
208
|
```js
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
// totally-a-good-idea.js
|
|
210
|
+
|
|
211
|
+
const name = 'totally-a-good-idea';
|
|
212
|
+
const hooks = {
|
|
212
213
|
async create(gasket, context) {
|
|
213
214
|
const { pkg } = context;
|
|
214
215
|
|
|
@@ -221,6 +222,8 @@ module.exports = {
|
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
224
|
};
|
|
225
|
+
|
|
226
|
+
export default { name, hooks };
|
|
224
227
|
```
|
|
225
228
|
|
|
226
229
|
The hook is passed the following parameters:
|
|
@@ -106,7 +106,7 @@ async function writeGasketConfig({ context }) {
|
|
|
106
106
|
createInjectionAssignments(gasketConfig.fields, assignments);
|
|
107
107
|
cleanupFields(gasketConfig);
|
|
108
108
|
|
|
109
|
-
const pluginImports = `[\n${writePluginImports(plugins)}\n
|
|
109
|
+
const pluginImports = `[\n${writePluginImports(plugins)}\n]`;
|
|
110
110
|
contents += `\nexport default makeGasket(${JSON5.stringify(gasketConfig.fields, null, 2)});\n`;
|
|
111
111
|
contents = contents.replace('\'FILENAME_REPLACE\'', 'import.meta.filename');
|
|
112
112
|
contents = contents.replace('\'PLUGIN_REPLACE\'', pluginImports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-gasket-app",
|
|
3
|
-
"version": "7.0.0-next.
|
|
3
|
+
"version": "7.0.0-next.44",
|
|
4
4
|
"description": "starter pack for creating a gasket app",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/create-gasket-app",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@gasket/core": "^7.0.0-next.
|
|
37
|
-
"@gasket/plugin-command": "^7.0.0-next.
|
|
38
|
-
"@gasket/plugin-docs": "^7.0.0-next.
|
|
39
|
-
"@gasket/plugin-docusaurus": "^7.0.0-next.
|
|
40
|
-
"@gasket/plugin-git": "^7.0.0-next.
|
|
41
|
-
"@gasket/plugin-logger": "^7.0.0-next.
|
|
42
|
-
"@gasket/plugin-metadata": "^7.0.0-next.
|
|
43
|
-
"@gasket/utils": "^7.0.0-next.
|
|
36
|
+
"@gasket/core": "^7.0.0-next.44",
|
|
37
|
+
"@gasket/plugin-command": "^7.0.0-next.44",
|
|
38
|
+
"@gasket/plugin-docs": "^7.0.0-next.44",
|
|
39
|
+
"@gasket/plugin-docusaurus": "^7.0.0-next.44",
|
|
40
|
+
"@gasket/plugin-git": "^7.0.0-next.44",
|
|
41
|
+
"@gasket/plugin-logger": "^7.0.0-next.44",
|
|
42
|
+
"@gasket/plugin-metadata": "^7.0.0-next.44",
|
|
43
|
+
"@gasket/utils": "^7.0.0-next.44",
|
|
44
44
|
"commander": "^12.0.0",
|
|
45
45
|
"deepmerge": "^4.3.1",
|
|
46
46
|
"glob": "^8.1.0",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"jest": {
|
|
84
84
|
"transform": {}
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "3a1d51a5e98ce4bad06faa2fceae90c580c8a0a9"
|
|
87
87
|
}
|