aberlaas-init 2.18.1 → 2.20.1
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/lib/helper.js +150 -119
- package/lib/layouts/__tests__/libdocs.js +55 -58
- package/lib/layouts/__tests__/module.js +22 -20
- package/lib/layouts/__tests__/monorepo.js +54 -62
- package/lib/layouts/libdocs.js +73 -68
- package/lib/layouts/module.js +33 -22
- package/lib/layouts/monorepo.js +75 -74
- package/lib/main.js +59 -43
- package/package.json +19 -21
- package/templates/_README.template.md +5 -0
- package/templates/_editorconfig +8 -0
- package/templates/_gitignore +11 -19
- package/templates/scripts/build +4 -0
- package/templates/scripts/build-prod +4 -0
- package/templates/scripts/ci +4 -0
- package/templates/scripts/cms +4 -0
- package/templates/scripts/compress +4 -0
- package/templates/scripts/{__module/hooks → hooks}/pre-commit +1 -1
- package/templates/scripts/lint +4 -0
- package/templates/scripts/lint-fix +4 -0
- package/templates/scripts/release +4 -0
- package/templates/scripts/serve +4 -0
- package/templates/scripts/test +4 -0
- package/templates/scripts/test-watch +4 -0
- package/templates/_gitattributes +0 -4
- package/templates/lerna.json +0 -6
- package/templates/scripts/__libdocs/hooks/pre-commit +0 -11
- package/templates/scripts/__libdocs/local/build +0 -5
- package/templates/scripts/__libdocs/local/build-prod +0 -5
- package/templates/scripts/__libdocs/local/ci +0 -5
- package/templates/scripts/__libdocs/local/cms +0 -4
- package/templates/scripts/__libdocs/local/compress +0 -5
- package/templates/scripts/__libdocs/local/lint +0 -5
- package/templates/scripts/__libdocs/local/lint-fix +0 -5
- package/templates/scripts/__libdocs/local/release +0 -5
- package/templates/scripts/__libdocs/local/serve +0 -5
- package/templates/scripts/__libdocs/local/test +0 -5
- package/templates/scripts/__libdocs/local/test-watch +0 -6
- package/templates/scripts/__libdocs/meta/build +0 -4
- package/templates/scripts/__libdocs/meta/build-prod +0 -4
- package/templates/scripts/__libdocs/meta/ci +0 -4
- package/templates/scripts/__libdocs/meta/cms +0 -4
- package/templates/scripts/__libdocs/meta/compress +0 -4
- package/templates/scripts/__libdocs/meta/lint +0 -4
- package/templates/scripts/__libdocs/meta/lint-fix +0 -4
- package/templates/scripts/__libdocs/meta/release +0 -5
- package/templates/scripts/__libdocs/meta/serve +0 -4
- package/templates/scripts/__libdocs/meta/test +0 -4
- package/templates/scripts/__libdocs/meta/test-watch +0 -4
- package/templates/scripts/__module/ci +0 -6
- package/templates/scripts/__module/compress +0 -4
- package/templates/scripts/__module/lint +0 -4
- package/templates/scripts/__module/lint-fix +0 -4
- package/templates/scripts/__module/release +0 -4
- package/templates/scripts/__module/test +0 -5
- package/templates/scripts/__module/test-watch +0 -5
- package/templates/scripts/__monorepo/hooks/pre-commit +0 -11
- package/templates/scripts/__monorepo/local/build +0 -5
- package/templates/scripts/__monorepo/local/build-prod +0 -5
- package/templates/scripts/__monorepo/local/ci +0 -5
- package/templates/scripts/__monorepo/local/cms +0 -5
- package/templates/scripts/__monorepo/local/compress +0 -5
- package/templates/scripts/__monorepo/local/lint +0 -5
- package/templates/scripts/__monorepo/local/lint-fix +0 -5
- package/templates/scripts/__monorepo/local/release +0 -5
- package/templates/scripts/__monorepo/local/serve +0 -5
- package/templates/scripts/__monorepo/local/test +0 -5
- package/templates/scripts/__monorepo/local/test-watch +0 -6
- package/templates/scripts/__monorepo/meta/build +0 -4
- package/templates/scripts/__monorepo/meta/build-prod +0 -4
- package/templates/scripts/__monorepo/meta/ci +0 -4
- package/templates/scripts/__monorepo/meta/cms +0 -4
- package/templates/scripts/__monorepo/meta/compress +0 -4
- package/templates/scripts/__monorepo/meta/lint +0 -4
- package/templates/scripts/__monorepo/meta/lint-fix +0 -4
- package/templates/scripts/__monorepo/meta/release +0 -5
- package/templates/scripts/__monorepo/meta/serve +0 -4
- package/templates/scripts/__monorepo/meta/test +0 -4
- package/templates/scripts/__monorepo/meta/test-watch +0 -4
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
import { exists, glob, readJson, remove, tmpDirectory } from 'firost';
|
|
2
|
-
import helper from 'aberlaas-helper';
|
|
3
1
|
import {
|
|
4
|
-
|
|
2
|
+
exists,
|
|
3
|
+
glob,
|
|
4
|
+
readJson,
|
|
5
|
+
remove,
|
|
6
|
+
tmpDirectory,
|
|
7
|
+
writeJson,
|
|
8
|
+
} from 'firost';
|
|
9
|
+
import { hostGitPath, hostGitRoot, mockHelperPaths } from 'aberlaas-helper';
|
|
10
|
+
import {
|
|
5
11
|
nodeVersion,
|
|
6
12
|
norskaThemeDocsVersion,
|
|
7
13
|
norskaVersion,
|
|
8
14
|
yarnVersion,
|
|
9
15
|
} from 'aberlaas-versions';
|
|
10
|
-
import
|
|
16
|
+
import { __ as initHelper } from '../../helper.js';
|
|
17
|
+
import { __, run } from '../monorepo.js';
|
|
11
18
|
|
|
12
19
|
describe('init > monorepo', () => {
|
|
20
|
+
const testDirectory = tmpDirectory('aberlaas/init/monorepo');
|
|
13
21
|
beforeEach(async () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
mockHelperPaths(testDirectory);
|
|
23
|
+
|
|
24
|
+
// Create a package.json with aberlaas in devDependencies
|
|
25
|
+
await writeJson(
|
|
26
|
+
{ devDependencies: { aberlaas: '1.2.3' } },
|
|
27
|
+
hostGitPath('package.json'),
|
|
18
28
|
);
|
|
19
29
|
|
|
20
|
-
vi.spyOn(
|
|
21
|
-
vi.spyOn(
|
|
22
|
-
vi.spyOn(current, '__getAberlaasVersion').mockReturnValue('1.2.3');
|
|
30
|
+
vi.spyOn(initHelper, 'getProjectName').mockReturnValue('my-project');
|
|
31
|
+
vi.spyOn(initHelper, 'getProjectAuthor').mockReturnValue('my-name');
|
|
23
32
|
});
|
|
24
33
|
afterEach(async () => {
|
|
25
|
-
await remove(
|
|
34
|
+
await remove(hostGitRoot());
|
|
26
35
|
});
|
|
27
36
|
|
|
28
37
|
// WORKSPACES
|
|
@@ -49,20 +58,18 @@ describe('init > monorepo', () => {
|
|
|
49
58
|
dependencies: {},
|
|
50
59
|
devDependencies: {
|
|
51
60
|
aberlaas: '1.2.3',
|
|
52
|
-
lerna: lernaVersion,
|
|
53
61
|
},
|
|
54
62
|
scripts: {
|
|
55
|
-
build: './scripts/
|
|
56
|
-
release: './scripts/
|
|
57
|
-
lint: './scripts/
|
|
58
|
-
learn: 'lerna',
|
|
63
|
+
build: './scripts/build',
|
|
64
|
+
release: './scripts/release',
|
|
65
|
+
lint: './scripts/lint',
|
|
59
66
|
},
|
|
60
67
|
},
|
|
61
68
|
],
|
|
62
69
|
])('%s', async (_title, expected) => {
|
|
63
|
-
await
|
|
70
|
+
await __.createRootWorkspace();
|
|
64
71
|
|
|
65
|
-
const actual = await readJson(
|
|
72
|
+
const actual = await readJson(hostGitPath('package.json'));
|
|
66
73
|
|
|
67
74
|
expect(actual).toMatchObject(expected);
|
|
68
75
|
});
|
|
@@ -91,18 +98,16 @@ describe('init > monorepo', () => {
|
|
|
91
98
|
'norska-theme-docs': norskaThemeDocsVersion,
|
|
92
99
|
},
|
|
93
100
|
scripts: {
|
|
94
|
-
build: '
|
|
95
|
-
release: '
|
|
96
|
-
lint: '
|
|
101
|
+
build: 'cd ../.. && ./scripts/build',
|
|
102
|
+
release: 'cd ../.. && ./scripts/release',
|
|
103
|
+
lint: 'cd ../.. && ./scripts/lint',
|
|
97
104
|
},
|
|
98
105
|
},
|
|
99
106
|
],
|
|
100
107
|
])('%s', async (_title, expected) => {
|
|
101
|
-
await
|
|
108
|
+
await __.createDocsWorkspace();
|
|
102
109
|
|
|
103
|
-
const actual = await readJson(
|
|
104
|
-
helper.hostPath('modules/docs/package.json'),
|
|
105
|
-
);
|
|
110
|
+
const actual = await readJson(hostGitPath('modules/docs/package.json'));
|
|
106
111
|
|
|
107
112
|
expect(actual).toMatchObject(expected);
|
|
108
113
|
});
|
|
@@ -142,18 +147,16 @@ describe('init > monorepo', () => {
|
|
|
142
147
|
dependencies: {},
|
|
143
148
|
|
|
144
149
|
scripts: {
|
|
145
|
-
build: '
|
|
146
|
-
release: '
|
|
147
|
-
lint: '
|
|
150
|
+
build: 'cd ../.. && ./scripts/build',
|
|
151
|
+
release: 'cd ../.. && ./scripts/release',
|
|
152
|
+
lint: 'cd ../.. && ./scripts/lint',
|
|
148
153
|
},
|
|
149
154
|
},
|
|
150
155
|
],
|
|
151
156
|
])('%s', async (_title, expected) => {
|
|
152
|
-
await
|
|
157
|
+
await __.createLibWorkspace();
|
|
153
158
|
|
|
154
|
-
const actual = await readJson(
|
|
155
|
-
helper.hostPath('modules/lib/package.json'),
|
|
156
|
-
);
|
|
159
|
+
const actual = await readJson(hostGitPath('modules/lib/package.json'));
|
|
157
160
|
|
|
158
161
|
expect(actual).toMatchObject(expected);
|
|
159
162
|
});
|
|
@@ -161,31 +164,31 @@ describe('init > monorepo', () => {
|
|
|
161
164
|
|
|
162
165
|
describe('addLicenseFiles', () => {
|
|
163
166
|
it('creates license file in root and ./lib', async () => {
|
|
164
|
-
await
|
|
167
|
+
await __.addLicenseFiles();
|
|
165
168
|
|
|
166
|
-
expect(await exists(
|
|
167
|
-
expect(await exists(
|
|
169
|
+
expect(await exists(hostGitPath('LICENSE'))).toBe(true);
|
|
170
|
+
expect(await exists(hostGitPath('modules/lib/LICENSE'))).toBe(true);
|
|
168
171
|
});
|
|
169
172
|
});
|
|
170
173
|
|
|
171
174
|
describe('run', () => {
|
|
172
175
|
it('should build a monorepo structure', async () => {
|
|
173
|
-
await
|
|
176
|
+
await run();
|
|
174
177
|
|
|
175
178
|
const actual = await glob('**/*', {
|
|
176
|
-
cwd:
|
|
179
|
+
cwd: hostGitPath(),
|
|
177
180
|
absolutePaths: false,
|
|
178
181
|
directories: false,
|
|
179
182
|
});
|
|
180
183
|
|
|
181
184
|
expect(actual).toEqual([
|
|
182
185
|
'.circleci/config.yml',
|
|
183
|
-
'.
|
|
186
|
+
'.editorconfig',
|
|
184
187
|
'.github/renovate.json',
|
|
185
188
|
'.gitignore',
|
|
189
|
+
'.README.template.md',
|
|
186
190
|
'.yarnrc.yml',
|
|
187
191
|
'eslint.config.js',
|
|
188
|
-
'lerna.json',
|
|
189
192
|
'LICENSE',
|
|
190
193
|
'lintstaged.config.js',
|
|
191
194
|
'modules/docs/package.json',
|
|
@@ -195,29 +198,18 @@ describe('init > monorepo', () => {
|
|
|
195
198
|
'modules/lib/package.json',
|
|
196
199
|
'package.json',
|
|
197
200
|
'prettier.config.js',
|
|
201
|
+
'scripts/build',
|
|
202
|
+
'scripts/build-prod',
|
|
203
|
+
'scripts/ci',
|
|
204
|
+
'scripts/cms',
|
|
205
|
+
'scripts/compress',
|
|
198
206
|
'scripts/hooks/pre-commit',
|
|
199
|
-
'scripts/
|
|
200
|
-
'scripts/
|
|
201
|
-
'scripts/
|
|
202
|
-
'scripts/
|
|
203
|
-
'scripts/
|
|
204
|
-
'scripts/
|
|
205
|
-
'scripts/local/lint-fix',
|
|
206
|
-
'scripts/local/release',
|
|
207
|
-
'scripts/local/serve',
|
|
208
|
-
'scripts/local/test',
|
|
209
|
-
'scripts/local/test-watch',
|
|
210
|
-
'scripts/meta/build',
|
|
211
|
-
'scripts/meta/build-prod',
|
|
212
|
-
'scripts/meta/ci',
|
|
213
|
-
'scripts/meta/cms',
|
|
214
|
-
'scripts/meta/compress',
|
|
215
|
-
'scripts/meta/lint',
|
|
216
|
-
'scripts/meta/lint-fix',
|
|
217
|
-
'scripts/meta/release',
|
|
218
|
-
'scripts/meta/serve',
|
|
219
|
-
'scripts/meta/test',
|
|
220
|
-
'scripts/meta/test-watch',
|
|
207
|
+
'scripts/lint',
|
|
208
|
+
'scripts/lint-fix',
|
|
209
|
+
'scripts/release',
|
|
210
|
+
'scripts/serve',
|
|
211
|
+
'scripts/test',
|
|
212
|
+
'scripts/test-watch',
|
|
221
213
|
'stylelint.config.js',
|
|
222
214
|
'vite.config.js',
|
|
223
215
|
]);
|
package/lib/layouts/libdocs.js
CHANGED
|
@@ -1,22 +1,50 @@
|
|
|
1
1
|
import { writeJson } from 'firost';
|
|
2
|
-
|
|
3
|
-
import helper from 'aberlaas-helper';
|
|
2
|
+
import { hostGitPath } from 'aberlaas-helper';
|
|
4
3
|
import {
|
|
5
|
-
lernaVersion,
|
|
6
4
|
nodeVersion,
|
|
7
5
|
norskaThemeDocsVersion,
|
|
8
6
|
norskaVersion,
|
|
9
7
|
yarnVersion,
|
|
10
8
|
} from 'aberlaas-versions';
|
|
11
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
addConfigFiles,
|
|
11
|
+
addDefaultScripts,
|
|
12
|
+
addDocsScripts,
|
|
13
|
+
addLibFiles,
|
|
14
|
+
addLicenseFile,
|
|
15
|
+
getAberlaasVersion,
|
|
16
|
+
getProjectAuthor,
|
|
17
|
+
getProjectName,
|
|
18
|
+
} from '../helper.js';
|
|
19
|
+
|
|
20
|
+
export let __;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Scaffold a repo:
|
|
24
|
+
* - As a monorepo
|
|
25
|
+
* - With ./libs and ./docs subfolders
|
|
26
|
+
*/
|
|
27
|
+
export async function run() {
|
|
28
|
+
await __.createRootWorkspace();
|
|
29
|
+
await __.createDocsWorkspace();
|
|
30
|
+
await __.createLibWorkspace();
|
|
31
|
+
await __.addLicenseFiles();
|
|
32
|
+
|
|
33
|
+
await addConfigFiles();
|
|
34
|
+
await addDefaultScripts();
|
|
35
|
+
await addDocsScripts();
|
|
36
|
+
await addLibFiles();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
__ = {
|
|
40
|
+
// Public methods
|
|
12
41
|
|
|
13
|
-
export default {
|
|
14
42
|
/**
|
|
15
43
|
* Create the top-level workspace
|
|
16
44
|
*/
|
|
17
45
|
async createRootWorkspace() {
|
|
18
|
-
const aberlaasVersion =
|
|
19
|
-
const sharedProjectData = await
|
|
46
|
+
const aberlaasVersion = await getAberlaasVersion();
|
|
47
|
+
const sharedProjectData = await __.getSharedProjectData();
|
|
20
48
|
const engines = {
|
|
21
49
|
node: `>=${nodeVersion}`,
|
|
22
50
|
};
|
|
@@ -45,39 +73,36 @@ export default {
|
|
|
45
73
|
dependencies: {},
|
|
46
74
|
devDependencies: {
|
|
47
75
|
aberlaas: aberlaasVersion,
|
|
48
|
-
lerna: lernaVersion,
|
|
49
76
|
},
|
|
50
77
|
|
|
51
78
|
// Scripts
|
|
52
79
|
scripts: {
|
|
53
80
|
// Docs
|
|
54
|
-
build: './scripts/
|
|
55
|
-
'build:prod': './scripts/
|
|
56
|
-
cms: './scripts/
|
|
57
|
-
serve: './scripts/
|
|
81
|
+
build: './scripts/build',
|
|
82
|
+
'build:prod': './scripts/build-prod',
|
|
83
|
+
cms: './scripts/cms',
|
|
84
|
+
serve: './scripts/serve',
|
|
58
85
|
|
|
59
86
|
// Lib
|
|
60
|
-
release: './scripts/
|
|
61
|
-
test: './scripts/
|
|
62
|
-
'test:watch': './scripts/
|
|
63
|
-
ci: './scripts/
|
|
64
|
-
compress: './scripts/
|
|
65
|
-
lint: './scripts/
|
|
66
|
-
'lint:fix': './scripts/
|
|
67
|
-
|
|
68
|
-
// Typo
|
|
69
|
-
learn: 'lerna',
|
|
87
|
+
release: './scripts/release',
|
|
88
|
+
test: './scripts/test',
|
|
89
|
+
'test:watch': './scripts/test-watch',
|
|
90
|
+
ci: './scripts/ci',
|
|
91
|
+
compress: './scripts/compress',
|
|
92
|
+
lint: './scripts/lint',
|
|
93
|
+
'lint:fix': './scripts/lint-fix',
|
|
70
94
|
},
|
|
71
95
|
};
|
|
72
|
-
await writeJson(packageContent,
|
|
96
|
+
await writeJson(packageContent, hostGitPath('./package.json'), {
|
|
73
97
|
sort: false,
|
|
74
98
|
});
|
|
75
99
|
},
|
|
100
|
+
|
|
76
101
|
/**
|
|
77
102
|
* Create the docs workspace
|
|
78
103
|
*/
|
|
79
104
|
async createDocsWorkspace() {
|
|
80
|
-
const sharedProjectData = await
|
|
105
|
+
const sharedProjectData = await __.getSharedProjectData();
|
|
81
106
|
|
|
82
107
|
const packageContent = {
|
|
83
108
|
// Name & Version
|
|
@@ -106,15 +131,16 @@ export default {
|
|
|
106
131
|
// Scripts
|
|
107
132
|
scripts: sharedProjectData.scripts,
|
|
108
133
|
};
|
|
109
|
-
await writeJson(packageContent,
|
|
134
|
+
await writeJson(packageContent, hostGitPath('./docs/package.json'), {
|
|
110
135
|
sort: false,
|
|
111
136
|
});
|
|
112
137
|
},
|
|
138
|
+
|
|
113
139
|
/**
|
|
114
140
|
* Create the lib workspace
|
|
115
141
|
*/
|
|
116
142
|
async createLibWorkspace() {
|
|
117
|
-
const sharedProjectData = await
|
|
143
|
+
const sharedProjectData = await __.getSharedProjectData();
|
|
118
144
|
const engines = {
|
|
119
145
|
node: `>=${nodeVersion}`,
|
|
120
146
|
};
|
|
@@ -154,50 +180,43 @@ export default {
|
|
|
154
180
|
// Scripts
|
|
155
181
|
scripts: sharedProjectData.scripts,
|
|
156
182
|
};
|
|
157
|
-
await writeJson(packageContent,
|
|
183
|
+
await writeJson(packageContent, hostGitPath('./lib/package.json'), {
|
|
158
184
|
sort: false,
|
|
159
185
|
});
|
|
160
186
|
},
|
|
187
|
+
|
|
161
188
|
/**
|
|
162
189
|
* Add MIT license files to the repository
|
|
163
190
|
*/
|
|
164
191
|
async addLicenseFiles() {
|
|
165
192
|
// One at the repo root, for GitHub
|
|
166
|
-
await
|
|
193
|
+
await addLicenseFile('LICENSE');
|
|
167
194
|
// One in ./lib to be released with the module
|
|
168
|
-
await
|
|
195
|
+
await addLicenseFile('lib/LICENSE');
|
|
169
196
|
},
|
|
170
|
-
/**
|
|
171
|
-
* Add config files
|
|
172
|
-
*/
|
|
173
|
-
async addConfigFiles() {
|
|
174
|
-
await initHelper.addConfigFiles();
|
|
175
197
|
|
|
176
|
-
// Lerna
|
|
177
|
-
await initHelper.copyTemplateToHost('lerna.json', 'lerna.json');
|
|
178
|
-
},
|
|
179
198
|
/**
|
|
180
199
|
* Returns shared project data, like name, author, scripts, etc
|
|
181
200
|
* @returns {object} Object of common keys
|
|
182
201
|
*/
|
|
183
202
|
async getSharedProjectData() {
|
|
184
|
-
const name = await
|
|
185
|
-
const author = await
|
|
203
|
+
const name = await getProjectName();
|
|
204
|
+
const author = await getProjectAuthor();
|
|
186
205
|
const homepage = `https://projects.pixelastic.com/${name}`;
|
|
187
206
|
const repository = `${author}/${name}`;
|
|
188
207
|
const license = 'MIT';
|
|
189
208
|
const scripts = {
|
|
190
|
-
build: '
|
|
191
|
-
'build:prod': '
|
|
192
|
-
cms: '
|
|
193
|
-
serve: '
|
|
194
|
-
ci: '
|
|
195
|
-
release: '
|
|
196
|
-
test: '
|
|
197
|
-
'test:watch': '
|
|
198
|
-
compress: '
|
|
199
|
-
lint: '
|
|
200
|
-
'lint:fix': '
|
|
209
|
+
build: 'cd .. && ./scripts/build',
|
|
210
|
+
'build:prod': 'cd .. && ./scripts/build-prod',
|
|
211
|
+
cms: 'cd .. && ./scripts/cms',
|
|
212
|
+
serve: 'cd .. && ./scripts/serve',
|
|
213
|
+
ci: 'cd .. && ./scripts/ci',
|
|
214
|
+
release: 'cd .. && ./scripts/release',
|
|
215
|
+
test: 'cd .. && ./scripts/test',
|
|
216
|
+
'test:watch': 'cd .. && ./scripts/test-watch',
|
|
217
|
+
compress: 'cd .. && ./scripts/compress',
|
|
218
|
+
lint: 'cd .. && ./scripts/lint',
|
|
219
|
+
'lint:fix': 'cd .. && ./scripts/lint-fix',
|
|
201
220
|
};
|
|
202
221
|
return {
|
|
203
222
|
author,
|
|
@@ -208,22 +227,8 @@ export default {
|
|
|
208
227
|
scripts,
|
|
209
228
|
};
|
|
210
229
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
*/
|
|
216
|
-
async run() {
|
|
217
|
-
await this.createRootWorkspace();
|
|
218
|
-
await this.createDocsWorkspace();
|
|
219
|
-
await this.createLibWorkspace();
|
|
220
|
-
|
|
221
|
-
await this.addLicenseFiles();
|
|
222
|
-
await this.addConfigFiles();
|
|
223
|
-
await initHelper.addScripts('__libdocs');
|
|
224
|
-
await initHelper.addLibFiles();
|
|
225
|
-
},
|
|
226
|
-
__getProjectName: initHelper.getProjectName,
|
|
227
|
-
__getProjectAuthor: initHelper.getProjectAuthor.bind(initHelper),
|
|
228
|
-
__getAberlaasVersion: initHelper.getAberlaasVersion,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export default {
|
|
233
|
+
run,
|
|
229
234
|
};
|
package/lib/layouts/module.js
CHANGED
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
import { writeJson } from 'firost';
|
|
2
|
+
import { hostGitPath } from 'aberlaas-helper';
|
|
2
3
|
import { nodeVersion, yarnVersion } from 'aberlaas-versions';
|
|
3
|
-
import
|
|
4
|
-
|
|
4
|
+
import {
|
|
5
|
+
addConfigFiles,
|
|
6
|
+
addDefaultScripts,
|
|
7
|
+
addLibFiles,
|
|
8
|
+
addLicenseFile,
|
|
9
|
+
getAberlaasVersion,
|
|
10
|
+
getProjectAuthor,
|
|
11
|
+
getProjectName,
|
|
12
|
+
} from '../helper.js';
|
|
5
13
|
|
|
6
|
-
export
|
|
14
|
+
export let __;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Scaffold a repo:
|
|
18
|
+
* - With ./lib holding the code
|
|
19
|
+
*/
|
|
20
|
+
export async function run() {
|
|
21
|
+
await __.createPackageJson();
|
|
22
|
+
|
|
23
|
+
await addLicenseFile('LICENSE');
|
|
24
|
+
await addConfigFiles();
|
|
25
|
+
await addDefaultScripts();
|
|
26
|
+
await addLibFiles();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
__ = {
|
|
7
30
|
/**
|
|
8
31
|
* Create the package.json
|
|
9
32
|
*/
|
|
10
33
|
async createPackageJson() {
|
|
11
|
-
const aberlaasVersion =
|
|
12
|
-
const name = await
|
|
34
|
+
const aberlaasVersion = await getAberlaasVersion();
|
|
35
|
+
const name = await getProjectName();
|
|
13
36
|
const version = '0.0.1';
|
|
14
37
|
|
|
15
|
-
const author = await
|
|
38
|
+
const author = await getProjectAuthor();
|
|
16
39
|
const description = '';
|
|
17
40
|
const keywords = [];
|
|
18
41
|
const repository = `${author}/${name}`;
|
|
@@ -79,24 +102,12 @@ export default {
|
|
|
79
102
|
scripts,
|
|
80
103
|
};
|
|
81
104
|
|
|
82
|
-
await writeJson(packageContent,
|
|
105
|
+
await writeJson(packageContent, hostGitPath('./package.json'), {
|
|
83
106
|
sort: false,
|
|
84
107
|
});
|
|
85
108
|
},
|
|
109
|
+
};
|
|
86
110
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
* - With ./lib holding the code
|
|
90
|
-
*/
|
|
91
|
-
async run() {
|
|
92
|
-
await this.createPackageJson();
|
|
93
|
-
|
|
94
|
-
await initHelper.addLicenseFile('LICENSE');
|
|
95
|
-
await initHelper.addConfigFiles();
|
|
96
|
-
await initHelper.addScripts('__module');
|
|
97
|
-
await initHelper.addLibFiles();
|
|
98
|
-
},
|
|
99
|
-
__getProjectName: initHelper.getProjectName,
|
|
100
|
-
__getProjectAuthor: initHelper.getProjectAuthor.bind(initHelper),
|
|
101
|
-
__getAberlaasVersion: initHelper.getAberlaasVersion,
|
|
111
|
+
export default {
|
|
112
|
+
run,
|
|
102
113
|
};
|