aberlaas 2.7.0 → 2.9.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 +20 -125
- package/commands/init/helper.js +192 -0
- package/commands/init/index.js +16 -388
- package/commands/init/module.js +111 -0
- package/commands/init/monorepo.js +261 -0
- package/commands/precommit/index.js +3 -0
- package/commands/test/index.js +47 -14
- package/configs/eslint.cjs +5 -0
- package/configs/lintstaged.js +1 -1
- package/configs/vite.js +12 -3
- package/package.json +4 -3
- package/templates/_circleci/config.yml +13 -4
package/commands/init/index.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
consoleInfo,
|
|
4
|
-
copy,
|
|
5
|
-
firostError,
|
|
6
|
-
isFile,
|
|
7
|
-
move,
|
|
8
|
-
read,
|
|
9
|
-
readJson,
|
|
10
|
-
run,
|
|
11
|
-
spinner,
|
|
12
|
-
write,
|
|
13
|
-
writeJson,
|
|
14
|
-
} from 'firost';
|
|
1
|
+
import { consoleInfo, run, spinner, write } from 'firost';
|
|
15
2
|
|
|
16
3
|
import Gilmore from 'gilmore';
|
|
17
4
|
import helper from '../../helper.js';
|
|
18
5
|
import nodeConfig from '../../configs/node.cjs';
|
|
6
|
+
import initMonorepo from './monorepo.js';
|
|
7
|
+
import initModule from './module.js';
|
|
19
8
|
|
|
20
9
|
export default {
|
|
21
10
|
/**
|
|
@@ -33,399 +22,38 @@ export default {
|
|
|
33
22
|
await write(nodeConfig.nodeVersion, nvmrcPath);
|
|
34
23
|
},
|
|
35
24
|
/**
|
|
36
|
-
*
|
|
25
|
+
* Run yarn install to install all deps
|
|
37
26
|
**/
|
|
38
|
-
async
|
|
39
|
-
|
|
40
|
-
const sharedProjectData = await this.getSharedProjectData();
|
|
41
|
-
|
|
42
|
-
const packageContent = {
|
|
43
|
-
// Visibility
|
|
44
|
-
private: true,
|
|
45
|
-
workspaces: ['docs', 'lib'],
|
|
46
|
-
|
|
47
|
-
// Name and version
|
|
48
|
-
name: `${sharedProjectData.name}-monorepo`,
|
|
49
|
-
version: '0.0.1',
|
|
50
|
-
|
|
51
|
-
// Metadata
|
|
52
|
-
author: sharedProjectData.author,
|
|
53
|
-
description: `${sharedProjectData.name} monorepo`,
|
|
54
|
-
repository: sharedProjectData.repository,
|
|
55
|
-
homepage: sharedProjectData.homepage,
|
|
56
|
-
|
|
57
|
-
// Compatibility
|
|
58
|
-
type: 'module',
|
|
59
|
-
license: sharedProjectData.license,
|
|
60
|
-
packageManager: `yarn@${nodeConfig.yarnVersion}`,
|
|
61
|
-
|
|
62
|
-
// Exports
|
|
63
|
-
|
|
64
|
-
// Dependencies
|
|
65
|
-
dependencies: {},
|
|
66
|
-
devDependencies: {
|
|
67
|
-
aberlaas: aberlaasData.version,
|
|
68
|
-
lerna: nodeConfig.lernaVersion,
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
// Scripts
|
|
72
|
-
scripts: {
|
|
73
|
-
// ==> Docs-specific
|
|
74
|
-
build: './scripts/docs/build',
|
|
75
|
-
'build:prod': './scripts/docs/build-prod',
|
|
76
|
-
cms: './scripts/docs/cms',
|
|
77
|
-
serve: './scripts/docs/serve',
|
|
78
|
-
// ==> Lib-specific
|
|
79
|
-
release: './scripts/lib/release',
|
|
80
|
-
test: './scripts/lib/test',
|
|
81
|
-
'test:watch': './scripts/lib/test-watch',
|
|
82
|
-
// Common
|
|
83
|
-
ci: './scripts/ci',
|
|
84
|
-
compress: './scripts/compress',
|
|
85
|
-
lint: './scripts/lint',
|
|
86
|
-
'lint:fix': './scripts/lint-fix',
|
|
87
|
-
|
|
88
|
-
// Global (called as aliases from any workspace)
|
|
89
|
-
// ==> Docs-specific
|
|
90
|
-
'g:build': './scripts/docs/build',
|
|
91
|
-
'g:build:prod': './scripts/docs/build-prod',
|
|
92
|
-
'g:cms': './scripts/docs/cms',
|
|
93
|
-
'g:serve': './scripts/docs/serve',
|
|
94
|
-
// ==> Lib-specific
|
|
95
|
-
'g:release': './scripts/lib/release',
|
|
96
|
-
'g:test': './scripts/lib/test',
|
|
97
|
-
'g:test:watch': './scripts/lib/test-watch',
|
|
98
|
-
// Common
|
|
99
|
-
'g:compress': './scripts/compress',
|
|
100
|
-
'g:lint': './scripts/lint',
|
|
101
|
-
'g:lint:fix': './scripts/lint-fix',
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
await writeJson(packageContent, helper.hostPath('./package.json'), {
|
|
105
|
-
sort: false,
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
/**
|
|
109
|
-
* Create the docs workspace
|
|
110
|
-
**/
|
|
111
|
-
async createDocsWorkspace() {
|
|
112
|
-
const sharedProjectData = await this.getSharedProjectData();
|
|
113
|
-
|
|
114
|
-
const packageContent = {
|
|
115
|
-
// Visibility
|
|
116
|
-
private: true,
|
|
117
|
-
|
|
118
|
-
// Name & Version
|
|
119
|
-
name: `${sharedProjectData.name}-docs`,
|
|
120
|
-
version: '0.0.1',
|
|
121
|
-
|
|
122
|
-
// Metadata
|
|
123
|
-
author: sharedProjectData.author,
|
|
124
|
-
description: `${sharedProjectData.name} docs`,
|
|
125
|
-
repository: sharedProjectData.repository,
|
|
126
|
-
homepage: sharedProjectData.homepage,
|
|
127
|
-
|
|
128
|
-
// Compatibility
|
|
129
|
-
license: sharedProjectData.license,
|
|
130
|
-
|
|
131
|
-
// Exports
|
|
132
|
-
|
|
133
|
-
// Dependencies
|
|
134
|
-
dependencies: {
|
|
135
|
-
norska: nodeConfig.norskaVersion,
|
|
136
|
-
'norska-theme-docs': nodeConfig.norskaThemeDocsVersion,
|
|
137
|
-
},
|
|
138
|
-
devDependencies: {},
|
|
139
|
-
|
|
140
|
-
// Scripts
|
|
141
|
-
scripts: sharedProjectData.scripts,
|
|
142
|
-
};
|
|
143
|
-
await writeJson(packageContent, helper.hostPath('./docs/package.json'), {
|
|
144
|
-
sort: false,
|
|
145
|
-
});
|
|
146
|
-
},
|
|
147
|
-
/**
|
|
148
|
-
* Create the lib workspace
|
|
149
|
-
**/
|
|
150
|
-
async createLibWorkspace() {
|
|
151
|
-
const sharedProjectData = await this.getSharedProjectData();
|
|
152
|
-
|
|
153
|
-
const packageContent = {
|
|
154
|
-
// Visibility
|
|
155
|
-
private: false,
|
|
156
|
-
|
|
157
|
-
// Name and version
|
|
158
|
-
name: sharedProjectData.name,
|
|
159
|
-
version: '0.0.1',
|
|
160
|
-
|
|
161
|
-
// Metadata
|
|
162
|
-
author: sharedProjectData.author,
|
|
163
|
-
description: '',
|
|
164
|
-
keywords: [],
|
|
165
|
-
repository: sharedProjectData.repository,
|
|
166
|
-
homepage: sharedProjectData.homepage,
|
|
167
|
-
|
|
168
|
-
// Compatibility
|
|
169
|
-
type: 'module',
|
|
170
|
-
license: sharedProjectData.license,
|
|
171
|
-
engines: sharedProjectData.engines,
|
|
172
|
-
|
|
173
|
-
// Exports
|
|
174
|
-
files: ['*.js'],
|
|
175
|
-
exports: {
|
|
176
|
-
'.': './main.js',
|
|
177
|
-
},
|
|
178
|
-
main: './main.js',
|
|
179
|
-
|
|
180
|
-
// Dependencies
|
|
181
|
-
dependencies: {},
|
|
182
|
-
devDependencies: {},
|
|
183
|
-
|
|
184
|
-
// Scripts
|
|
185
|
-
scripts: sharedProjectData.scripts,
|
|
186
|
-
};
|
|
187
|
-
await writeJson(packageContent, helper.hostPath('./lib/package.json'), {
|
|
188
|
-
sort: false,
|
|
189
|
-
});
|
|
190
|
-
},
|
|
191
|
-
/**
|
|
192
|
-
* Add config files to the host. Each config files reference the default
|
|
193
|
-
* aberlaas config for its tool. This pattern allow end-users to use aberlaas
|
|
194
|
-
* default rules and overwrite them as they see fit
|
|
195
|
-
**/
|
|
196
|
-
async addConfigFiles() {
|
|
197
|
-
// Git
|
|
198
|
-
await this.copyToHost('./templates/_gitignore', './.gitignore');
|
|
199
|
-
await this.copyToHost('./templates/_gitattributes', './.gitattributes');
|
|
200
|
-
|
|
201
|
-
// Yarn
|
|
202
|
-
await this.copyToHost('templates/_yarnrc.yml', '.yarnrc.yml');
|
|
203
|
-
|
|
204
|
-
// Lerna
|
|
205
|
-
await this.copyToHost('templates/lerna.json', 'lerna.json');
|
|
206
|
-
|
|
207
|
-
// ESLint
|
|
208
|
-
await this.copyToHost('templates/_eslintrc.cjs', '.eslintrc.cjs');
|
|
209
|
-
await this.copyToHost('templates/_eslintignore.conf', '.eslintignore');
|
|
210
|
-
|
|
211
|
-
// Lint-staged
|
|
212
|
-
await this.copyToHost(
|
|
213
|
-
'templates/lintstaged.config.js',
|
|
214
|
-
'lintstaged.config.js',
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
// Vite
|
|
218
|
-
await this.copyToHost('templates/vite.config.js', 'vite.config.js');
|
|
219
|
-
|
|
220
|
-
// Prettier
|
|
221
|
-
await this.copyToHost('templates/prettier.config.js', 'prettier.config.js');
|
|
222
|
-
|
|
223
|
-
// Stylelint
|
|
224
|
-
await this.copyToHost(
|
|
225
|
-
'templates/stylelint.config.js',
|
|
226
|
-
'stylelint.config.js',
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
// Renovate
|
|
230
|
-
await this.copyToHost(
|
|
231
|
-
'templates/_github/renovate.json',
|
|
232
|
-
'.github/renovate.json',
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
// CircleCI
|
|
236
|
-
await this.copyToHost(
|
|
237
|
-
'templates/_circleci/config.yml',
|
|
238
|
-
'.circleci/config.yml',
|
|
239
|
-
);
|
|
240
|
-
},
|
|
241
|
-
/**
|
|
242
|
-
* Add default script files
|
|
243
|
-
**/
|
|
244
|
-
async addScripts() {
|
|
245
|
-
// Docs
|
|
246
|
-
await this.copyToHost('templates/scripts/docs/build', 'scripts/docs/build');
|
|
247
|
-
await this.copyToHost(
|
|
248
|
-
'templates/scripts/docs/build-prod',
|
|
249
|
-
'scripts/docs/build-prod',
|
|
250
|
-
);
|
|
251
|
-
await this.copyToHost('templates/scripts/docs/cms', 'scripts/docs/cms');
|
|
252
|
-
await this.copyToHost('templates/scripts/docs/serve', 'scripts/docs/serve');
|
|
253
|
-
|
|
254
|
-
// Hooks
|
|
255
|
-
await this.copyToHost(
|
|
256
|
-
'./templates/scripts/hooks/pre-commit',
|
|
257
|
-
'./scripts/hooks/pre-commit',
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
// Lib
|
|
261
|
-
await this.copyToHost(
|
|
262
|
-
'templates/scripts/lib/release',
|
|
263
|
-
'scripts/lib/release',
|
|
264
|
-
);
|
|
265
|
-
await this.copyToHost('templates/scripts/lib/test', 'scripts/lib/test');
|
|
266
|
-
await this.copyToHost(
|
|
267
|
-
'templates/scripts/lib/test-watch',
|
|
268
|
-
'scripts/lib/test-watch',
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
// Common
|
|
272
|
-
await this.copyToHost('templates/scripts/ci', 'scripts/ci');
|
|
273
|
-
await this.copyToHost('templates/scripts/compress', 'scripts/compress');
|
|
274
|
-
await this.copyToHost('templates/scripts/lint', 'scripts/lint');
|
|
275
|
-
await this.copyToHost('templates/scripts/lint-fix', 'scripts/lint-fix');
|
|
276
|
-
},
|
|
277
|
-
/**
|
|
278
|
-
* Add MIT license files to the repository
|
|
279
|
-
**/
|
|
280
|
-
async addLicenseFiles() {
|
|
281
|
-
// Add the LICENSE template to the root
|
|
282
|
-
await this.copyToHost('templates/LICENSE', 'LICENSE');
|
|
283
|
-
|
|
284
|
-
// Replace placeholder with real value
|
|
285
|
-
const sharedProjectData = await this.getSharedProjectData();
|
|
286
|
-
const licensePath = helper.hostPath('LICENSE');
|
|
287
|
-
const templateContent = await read(licensePath);
|
|
288
|
-
const actualContent = _.replace(
|
|
289
|
-
templateContent,
|
|
290
|
-
'{author}',
|
|
291
|
-
sharedProjectData.author,
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
// Write the LICENSE to root and lib
|
|
295
|
-
await write(actualContent, licensePath);
|
|
296
|
-
await write(actualContent, helper.hostPath('lib/LICENSE'));
|
|
297
|
-
},
|
|
298
|
-
/**
|
|
299
|
-
* Add default files required to have the minimum lib module
|
|
300
|
-
**/
|
|
301
|
-
async addLibFiles() {
|
|
302
|
-
await this.copyToHost('templates/lib/main.js', 'lib/main.js');
|
|
303
|
-
await this.copyToHost(
|
|
304
|
-
'templates/lib/__tests__/main.js',
|
|
305
|
-
'lib/__tests__/main.js',
|
|
306
|
-
);
|
|
307
|
-
},
|
|
308
|
-
/**
|
|
309
|
-
* Copy a config template to the host
|
|
310
|
-
* @param {string} source Path to source file, relative to aberlaas
|
|
311
|
-
* @param {string} destination Path to destination file, relative to the host
|
|
312
|
-
* @returns {boolean} False if can't copy file, true otherwise
|
|
313
|
-
**/
|
|
314
|
-
async copyToHost(source, destination) {
|
|
315
|
-
const absoluteSource = helper.aberlaasPath(source);
|
|
316
|
-
const absoluteDestination = helper.hostPath(destination);
|
|
317
|
-
|
|
318
|
-
// Source file does not exist
|
|
319
|
-
if (!(await isFile(absoluteSource))) {
|
|
320
|
-
throw firostError(
|
|
321
|
-
'ERROR_INIT_COPY_FILE',
|
|
322
|
-
`Unable to locate ${absoluteSource} file`,
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
// Destination file already exist
|
|
326
|
-
if (await isFile(absoluteDestination)) {
|
|
327
|
-
// Do nothing if content is already the same
|
|
328
|
-
const sourceContent = await read(absoluteSource);
|
|
329
|
-
const destinationContent = await read(absoluteDestination);
|
|
330
|
-
if (sourceContent === destinationContent) {
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// Otherwise create a backup
|
|
335
|
-
const backupDestination = `${absoluteDestination}.backup`;
|
|
336
|
-
await move(absoluteDestination, backupDestination);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
await copy(absoluteSource, absoluteDestination);
|
|
340
|
-
|
|
341
|
-
return true;
|
|
342
|
-
},
|
|
343
|
-
/**
|
|
344
|
-
* Return name of the current project based on the GitHub project name
|
|
345
|
-
* @returns {string} Name of the project
|
|
346
|
-
**/
|
|
347
|
-
async getProjectName() {
|
|
348
|
-
const repo = new Gilmore(helper.hostRoot());
|
|
349
|
-
return await repo.githubRepoName();
|
|
350
|
-
},
|
|
351
|
-
/**
|
|
352
|
-
* Return the name of the current author based on the GitHub project owner
|
|
353
|
-
* @returns {string} Name of the author
|
|
354
|
-
**/
|
|
355
|
-
async getProjectAuthor() {
|
|
356
|
-
const repo = new Gilmore(helper.hostRoot());
|
|
357
|
-
return await repo.githubRepoOwner();
|
|
358
|
-
},
|
|
359
|
-
/**
|
|
360
|
-
* Returns shared project data, like name, author, scripts, etc
|
|
361
|
-
* @returns {object} Object of common keys
|
|
362
|
-
**/
|
|
363
|
-
async getSharedProjectData() {
|
|
364
|
-
const name = await this.getProjectName();
|
|
365
|
-
const author = await this.getProjectAuthor();
|
|
366
|
-
const homepage = `https://projects.pixelastic.com/${name}`;
|
|
367
|
-
const repository = `${author}/${name}`;
|
|
368
|
-
const license = 'MIT';
|
|
369
|
-
const engines = {
|
|
370
|
-
node: `>=${nodeConfig.nodeVersion}`,
|
|
371
|
-
};
|
|
372
|
-
const scripts = {
|
|
373
|
-
// Docs
|
|
374
|
-
build: 'ABERLAAS_CWD=$INIT_CWD yarn g:build',
|
|
375
|
-
'build:prod': 'ABERLAAS_CWD=$INIT_CWD yarn g:build:prod',
|
|
376
|
-
cms: 'ABERLAAS_CWD=$INIT_CWD yarn g:cms',
|
|
377
|
-
serve: 'ABERLAAS_CWD=$INIT_CWD yarn g:serve',
|
|
378
|
-
|
|
379
|
-
// Lib
|
|
380
|
-
release: 'ABERLAAS_CWD=$INIT_CWD yarn g:release',
|
|
381
|
-
test: 'ABERLAAS_CWD=$INIT_CWD yarn g:test',
|
|
382
|
-
'test:watch': 'ABERLAAS_CWD=$INIT_CWD yarn g:test:watch',
|
|
383
|
-
|
|
384
|
-
// Common
|
|
385
|
-
compress: 'ABERLAAS_CWD=$INIT_CWD yarn g:compress',
|
|
386
|
-
lint: 'ABERLAAS_CWD=$INIT_CWD yarn g:lint',
|
|
387
|
-
'lint:fix': 'ABERLAAS_CWD=$INIT_CWD yarn g:lint:fix',
|
|
388
|
-
};
|
|
389
|
-
return {
|
|
390
|
-
author,
|
|
391
|
-
engines,
|
|
392
|
-
homepage,
|
|
393
|
-
license,
|
|
394
|
-
name,
|
|
395
|
-
repository,
|
|
396
|
-
scripts,
|
|
397
|
-
};
|
|
27
|
+
async yarnInstall() {
|
|
28
|
+
await run('yarn install');
|
|
398
29
|
},
|
|
399
30
|
/**
|
|
400
31
|
* Copy all config files and configure the scripts
|
|
32
|
+
* @param {object} args Argument object, as passed by minimist
|
|
401
33
|
**/
|
|
402
|
-
async run() {
|
|
403
|
-
const
|
|
34
|
+
async run(args = {}) {
|
|
35
|
+
const isMonorepo = args.monorepo;
|
|
36
|
+
|
|
37
|
+
const progress = this.__spinner();
|
|
404
38
|
|
|
405
39
|
progress.tick('Configuring Git & Node');
|
|
406
40
|
await this.configureGit();
|
|
407
41
|
await this.configureNode();
|
|
408
42
|
|
|
409
|
-
progress.tick('
|
|
410
|
-
await this.createRootWorkspace();
|
|
411
|
-
await this.createDocsWorkspace();
|
|
412
|
-
await this.createLibWorkspace();
|
|
43
|
+
progress.tick('Adding default files ');
|
|
413
44
|
|
|
414
|
-
|
|
415
|
-
await
|
|
416
|
-
await this.addConfigFiles();
|
|
417
|
-
await this.addScripts();
|
|
418
|
-
await this.addLibFiles();
|
|
45
|
+
// Create a different scaffolding based on if creating a monorepo or not
|
|
46
|
+
isMonorepo ? await initMonorepo.run() : await initModule.run();
|
|
419
47
|
|
|
420
48
|
progress.success('aberlaas project initialized');
|
|
421
49
|
|
|
422
50
|
this.__consoleInfo('Synchronizing dependencies');
|
|
423
|
-
await
|
|
51
|
+
await this.yarnInstall();
|
|
424
52
|
|
|
425
53
|
this.__consoleInfo(
|
|
426
54
|
"Don't forget to run aberlaas setup after pushing your repository",
|
|
427
55
|
);
|
|
428
56
|
},
|
|
429
|
-
__run: run,
|
|
430
57
|
__consoleInfo: consoleInfo,
|
|
58
|
+
__spinner: spinner,
|
|
431
59
|
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { readJson, writeJson } from 'firost';
|
|
2
|
+
|
|
3
|
+
import helper from '../../helper.js';
|
|
4
|
+
import nodeConfig from '../../configs/node.cjs';
|
|
5
|
+
import initHelper from './helper.js';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
/**
|
|
9
|
+
* Create the top-level package.json
|
|
10
|
+
**/
|
|
11
|
+
async createPackageJson() {
|
|
12
|
+
// Get language and dependency version
|
|
13
|
+
const { version: aberlaasVersion } = await readJson(
|
|
14
|
+
helper.aberlaasPath('./package.json'),
|
|
15
|
+
);
|
|
16
|
+
const { nodeVersion, yarnVersion } = nodeConfig;
|
|
17
|
+
|
|
18
|
+
const name = await this.__getProjectName();
|
|
19
|
+
const version = '0.0.1';
|
|
20
|
+
|
|
21
|
+
const author = await this.__getProjectAuthor();
|
|
22
|
+
const description = '';
|
|
23
|
+
const keywords = [];
|
|
24
|
+
const repository = `${author}/${name}`;
|
|
25
|
+
const homepage = `https://projects.pixelastic.com/${name}`;
|
|
26
|
+
|
|
27
|
+
const type = 'module';
|
|
28
|
+
const license = 'MIT';
|
|
29
|
+
const engines = {
|
|
30
|
+
node: `>=${nodeVersion}`,
|
|
31
|
+
};
|
|
32
|
+
const packageManager = `yarn@${yarnVersion}`;
|
|
33
|
+
|
|
34
|
+
const files = ['*.js'];
|
|
35
|
+
const exports = {
|
|
36
|
+
'.': './main.js',
|
|
37
|
+
};
|
|
38
|
+
const main = './main.js';
|
|
39
|
+
|
|
40
|
+
const dependencies = {};
|
|
41
|
+
const devDependencies = {
|
|
42
|
+
aberlaas: aberlaasVersion,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const scripts = {
|
|
46
|
+
// Docs
|
|
47
|
+
build: './scripts/docs/build',
|
|
48
|
+
'build:prod': './scripts/docs/build-prod',
|
|
49
|
+
cms: './scripts/docs/cms',
|
|
50
|
+
serve: './scripts/docs/serve',
|
|
51
|
+
// Lib
|
|
52
|
+
release: './scripts/lib/release',
|
|
53
|
+
test: './scripts/lib/test',
|
|
54
|
+
'test:watch': './scripts/lib/test-watch',
|
|
55
|
+
// Common
|
|
56
|
+
ci: './scripts/ci',
|
|
57
|
+
compress: './scripts/compress',
|
|
58
|
+
lint: './scripts/lint',
|
|
59
|
+
'lint:fix': './scripts/lint-fix',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const packageContent = {
|
|
63
|
+
// Name and version
|
|
64
|
+
name,
|
|
65
|
+
version,
|
|
66
|
+
|
|
67
|
+
// Metadata
|
|
68
|
+
author,
|
|
69
|
+
description,
|
|
70
|
+
keywords,
|
|
71
|
+
repository,
|
|
72
|
+
homepage,
|
|
73
|
+
|
|
74
|
+
// Compatibility
|
|
75
|
+
type,
|
|
76
|
+
license,
|
|
77
|
+
engines,
|
|
78
|
+
packageManager,
|
|
79
|
+
|
|
80
|
+
// Exports
|
|
81
|
+
files,
|
|
82
|
+
exports,
|
|
83
|
+
main,
|
|
84
|
+
|
|
85
|
+
// Dependencies
|
|
86
|
+
dependencies,
|
|
87
|
+
devDependencies,
|
|
88
|
+
|
|
89
|
+
// Scripts
|
|
90
|
+
scripts,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
await writeJson(packageContent, helper.hostPath('./package.json'), {
|
|
94
|
+
sort: false,
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Scaffold a repo for use in a simple module contexte
|
|
100
|
+
**/
|
|
101
|
+
async run() {
|
|
102
|
+
await this.createPackageJson();
|
|
103
|
+
|
|
104
|
+
await initHelper.addLicenseFile('LICENSE');
|
|
105
|
+
await initHelper.addConfigFiles();
|
|
106
|
+
await initHelper.addScripts();
|
|
107
|
+
await initHelper.addLibFiles();
|
|
108
|
+
},
|
|
109
|
+
__getProjectName: initHelper.getProjectName.bind(initHelper),
|
|
110
|
+
__getProjectAuthor: initHelper.getProjectAuthor.bind(initHelper),
|
|
111
|
+
};
|