aberlaas-init 2.10.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/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Tim Carry (tim@pixelastic.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/lib/helper.js ADDED
@@ -0,0 +1,193 @@
1
+ import path from 'path';
2
+ import Gilmore from 'gilmore';
3
+ import {
4
+ absolute,
5
+ copy,
6
+ error as firostError,
7
+ isFile,
8
+ move,
9
+ read,
10
+ write,
11
+ } from 'firost';
12
+ import { _ } from 'golgoth';
13
+ import helper from 'aberlaas-helper';
14
+ import { nodeVersion, yarnVersion } from 'aberlaas-versions';
15
+
16
+ /**
17
+ * This hold functions shared for both the monorepo and simple init scenarios
18
+ */
19
+ export default {
20
+ /**
21
+ * Return name of the current project, as the name of the current directory
22
+ * @returns {string} Name of the project
23
+ */
24
+ getProjectName() {
25
+ return path.basename(helper.hostRoot());
26
+ },
27
+
28
+ /**
29
+ * Return the name of the current author based on the GitHub project owner
30
+ * @returns {string} Name of the author, or __placeholder__ if undefined
31
+ */
32
+ async getProjectAuthor() {
33
+ const repo = this.__getRepo();
34
+ return (await repo.githubRepoOwner()) || '__placeholder__';
35
+ },
36
+
37
+ /**
38
+ * Copy a config template to the host
39
+ * @param {string} source Path to source file, relative to ./templates folder
40
+ * @param {string} destination Path to destination file, relative to the host
41
+ * @returns {boolean} False if can't copy file, true otherwise
42
+ */
43
+ async copyTemplateToHost(source, destination) {
44
+ const absoluteSource = absolute('../templates/', source);
45
+ const absoluteDestination = helper.hostPath(destination);
46
+
47
+ // Source file does not exist
48
+ if (!(await isFile(absoluteSource))) {
49
+ throw firostError(
50
+ 'ERROR_INIT_COPY_FILE',
51
+ `Unable to locate ${absoluteSource} file`,
52
+ );
53
+ }
54
+ // Destination file already exist
55
+ if (await isFile(absoluteDestination)) {
56
+ // Do nothing if content is already the same
57
+ const sourceContent = await read(absoluteSource);
58
+ const destinationContent = await read(absoluteDestination);
59
+ if (sourceContent === destinationContent) {
60
+ return true;
61
+ }
62
+
63
+ // Otherwise create a backup
64
+ const backupDestination = `${absoluteDestination}.backup`;
65
+ await move(absoluteDestination, backupDestination);
66
+ }
67
+
68
+ await copy(absoluteSource, absoluteDestination);
69
+
70
+ return true;
71
+ },
72
+
73
+ /**
74
+ * Add MIT license file
75
+ * @param {string} hostFilepath Path to the LICENSE file, relative to the host
76
+ */
77
+ async addLicenseFile(hostFilepath) {
78
+ // Start by adding a template
79
+ await this.copyTemplateToHost('LICENSE', hostFilepath);
80
+
81
+ // Replace placeholder with real value
82
+ const licensePath = helper.hostPath(hostFilepath);
83
+ const author = await this.getProjectAuthor();
84
+ const templateContent = await read(licensePath);
85
+ const actualContent = _.replace(templateContent, '{author}', author);
86
+
87
+ // Write it again
88
+ await write(actualContent, licensePath);
89
+ },
90
+
91
+ /**
92
+ * Add CircleCI Config file
93
+ */
94
+ async addCircleCIConfigFile() {
95
+ const configFilepath = helper.hostPath('./.circleci/config.yml');
96
+
97
+ // Start by adding a template
98
+ await this.copyTemplateToHost('_circleci/config.yml', configFilepath);
99
+
100
+ // Replace placeholder with real value
101
+ const templateContent = await read(configFilepath);
102
+ const actualContent = _.chain(templateContent)
103
+ .replace('{nodeVersion}', nodeVersion)
104
+ .replace('{yarnVersion}', yarnVersion)
105
+ .value();
106
+
107
+ // Write it again
108
+ await write(actualContent, configFilepath);
109
+ },
110
+
111
+ /**
112
+ * Add default script files
113
+ */
114
+ async addScripts() {
115
+ // Common
116
+ await this.copyTemplateToHost('scripts/ci', 'scripts/ci');
117
+ await this.copyTemplateToHost('scripts/compress', 'scripts/compress');
118
+ await this.copyTemplateToHost('scripts/lint', 'scripts/lint');
119
+ await this.copyTemplateToHost('scripts/lint-fix', 'scripts/lint-fix');
120
+
121
+ // Hooks
122
+ await this.copyTemplateToHost(
123
+ './scripts/hooks/pre-commit',
124
+ './scripts/hooks/pre-commit',
125
+ );
126
+
127
+ // Lib
128
+ await this.copyTemplateToHost('scripts/lib/release', 'scripts/lib/release');
129
+ await this.copyTemplateToHost('scripts/lib/test', 'scripts/lib/test');
130
+ await this.copyTemplateToHost(
131
+ 'scripts/lib/test-watch',
132
+ 'scripts/lib/test-watch',
133
+ );
134
+ },
135
+
136
+ /**
137
+ * Add config files to the host. Each config files reference the default
138
+ * aberlaas config for its tool. This pattern allow end-users to use aberlaas
139
+ * default rules and overwrite them as they see fit
140
+ */
141
+ async addConfigFiles() {
142
+ // Git
143
+ await this.copyTemplateToHost('./_gitignore', './.gitignore');
144
+ await this.copyTemplateToHost('./_gitattributes', './.gitattributes');
145
+
146
+ // Yarn
147
+ await this.copyTemplateToHost('_yarnrc.yml', '.yarnrc.yml');
148
+
149
+ // ESLint
150
+ await this.copyTemplateToHost('eslint.config.js', 'eslint.config.js');
151
+
152
+ // Lint-staged
153
+ await this.copyTemplateToHost(
154
+ 'lintstaged.config.js',
155
+ 'lintstaged.config.js',
156
+ );
157
+
158
+ // Vite
159
+ await this.copyTemplateToHost('vite.config.js', 'vite.config.js');
160
+
161
+ // Prettier
162
+ await this.copyTemplateToHost('prettier.config.js', 'prettier.config.js');
163
+
164
+ // Stylelint
165
+ await this.copyTemplateToHost('stylelint.config.js', 'stylelint.config.js');
166
+
167
+ // Renovate
168
+ await this.copyTemplateToHost(
169
+ '_github/renovate.json',
170
+ '.github/renovate.json',
171
+ );
172
+
173
+ // CircleCI
174
+ await this.copyTemplateToHost(
175
+ '_circleci/config.yml',
176
+ '.circleci/config.yml',
177
+ );
178
+ },
179
+
180
+ /**
181
+ * Add default files required to have the minimum lib module
182
+ */
183
+ async addLibFiles() {
184
+ await this.copyTemplateToHost('lib/main.js', 'lib/main.js');
185
+ await this.copyTemplateToHost(
186
+ 'lib/__tests__/main.js',
187
+ 'lib/__tests__/main.js',
188
+ );
189
+ },
190
+ __getRepo() {
191
+ return new Gilmore(helper.hostRoot());
192
+ },
193
+ };
package/lib/main.js ADDED
@@ -0,0 +1,59 @@
1
+ import { consoleInfo, run, spinner, write } from 'firost';
2
+
3
+ import Gilmore from 'gilmore';
4
+ import helper from 'aberlaas-helper';
5
+ import { nodeVersion } from 'aberlaas-versions';
6
+ import initMonorepo from './monorepo.js';
7
+ import initModule from './module.js';
8
+
9
+ export default {
10
+ /**
11
+ * Configure git hooks to use scripts/hooks instead of .git/hooks
12
+ */
13
+ async configureGit() {
14
+ const repo = new Gilmore(helper.hostRoot());
15
+ await repo.setConfig('core.hooksPath', 'scripts/hooks');
16
+ },
17
+ /**
18
+ * Pin the node version through nvm
19
+ */
20
+ async configureNode() {
21
+ const nvmrcPath = helper.hostPath('.nvmrc');
22
+ await write(nodeVersion, nvmrcPath);
23
+ },
24
+ /**
25
+ * Run yarn install to install all deps
26
+ */
27
+ async yarnInstall() {
28
+ await run('yarn install');
29
+ },
30
+ /**
31
+ * Copy all config files and configure the scripts
32
+ * @param {object} args Argument object, as passed by minimist
33
+ */
34
+ async run(args = {}) {
35
+ const isMonorepo = args.monorepo;
36
+
37
+ const progress = this.__spinner();
38
+
39
+ progress.tick('Configuring Git & Node');
40
+ await this.configureGit();
41
+ await this.configureNode();
42
+
43
+ progress.tick('Adding default files ');
44
+
45
+ // Create a different scaffolding based on if creating a monorepo or not
46
+ isMonorepo ? await initMonorepo.run() : await initModule.run();
47
+
48
+ progress.success('aberlaas project initialized');
49
+
50
+ this.__consoleInfo('Synchronizing dependencies');
51
+ await this.yarnInstall();
52
+
53
+ this.__consoleInfo(
54
+ "Don't forget to run aberlaas setup after pushing your repository",
55
+ );
56
+ },
57
+ __consoleInfo: consoleInfo,
58
+ __spinner: spinner,
59
+ };
package/lib/module.js ADDED
@@ -0,0 +1,105 @@
1
+ import { writeJson } from 'firost';
2
+
3
+ import { aberlaasVersion, nodeVersion, yarnVersion } from 'aberlaas-versions';
4
+ import helper from 'aberlaas-helper';
5
+ import initHelper from './helper.js';
6
+
7
+ export default {
8
+ /**
9
+ * Create the top-level package.json
10
+ */
11
+ async createPackageJson() {
12
+ const name = await this.__getProjectName();
13
+ const version = '0.0.1';
14
+
15
+ const author = await this.__getProjectAuthor();
16
+ const description = '';
17
+ const keywords = [];
18
+ const repository = `${author}/${name}`;
19
+ const homepage = `https://projects.pixelastic.com/${name}`;
20
+
21
+ const type = 'module';
22
+ const license = 'MIT';
23
+ const engines = {
24
+ node: `>=${nodeVersion}`,
25
+ };
26
+ const packageManager = `yarn@${yarnVersion}`;
27
+
28
+ const files = ['*.js'];
29
+ const exports = {
30
+ '.': './main.js',
31
+ };
32
+ const main = './main.js';
33
+
34
+ const dependencies = {};
35
+ const devDependencies = {
36
+ aberlaas: aberlaasVersion,
37
+ };
38
+
39
+ const scripts = {
40
+ // Docs
41
+ build: './scripts/docs/build',
42
+ 'build:prod': './scripts/docs/build-prod',
43
+ cms: './scripts/docs/cms',
44
+ serve: './scripts/docs/serve',
45
+ // Lib
46
+ release: './scripts/lib/release',
47
+ test: './scripts/lib/test',
48
+ 'test:watch': './scripts/lib/test-watch',
49
+ // Common
50
+ ci: './scripts/ci',
51
+ compress: './scripts/compress',
52
+ lint: './scripts/lint',
53
+ 'lint:fix': './scripts/lint-fix',
54
+ };
55
+
56
+ const packageContent = {
57
+ // Name and version
58
+ name,
59
+ version,
60
+
61
+ // Metadata
62
+ author,
63
+ description,
64
+ keywords,
65
+ repository,
66
+ homepage,
67
+
68
+ // Compatibility
69
+ type,
70
+ license,
71
+ engines,
72
+ packageManager,
73
+
74
+ // Exports
75
+ files,
76
+ exports,
77
+ main,
78
+
79
+ // Dependencies
80
+ dependencies,
81
+ devDependencies,
82
+
83
+ // Scripts
84
+ scripts,
85
+ };
86
+
87
+ await writeJson(packageContent, helper.hostPath('./package.json'), {
88
+ sort: false,
89
+ });
90
+ },
91
+
92
+ /**
93
+ * Scaffold a repo for use in a simple module contexte
94
+ */
95
+ async run() {
96
+ await this.createPackageJson();
97
+
98
+ await initHelper.addLicenseFile('LICENSE');
99
+ await initHelper.addConfigFiles();
100
+ await initHelper.addScripts();
101
+ await initHelper.addLibFiles();
102
+ },
103
+ __getProjectName: initHelper.getProjectName.bind(initHelper),
104
+ __getProjectAuthor: initHelper.getProjectAuthor.bind(initHelper),
105
+ };
@@ -0,0 +1,264 @@
1
+ import { writeJson } from 'firost';
2
+
3
+ import helper from 'aberlaas-helper';
4
+ import {
5
+ aberlaasVersion,
6
+ lernaVersion,
7
+ nodeVersion,
8
+ norskaThemeDocsVersion,
9
+ norskaVersion,
10
+ yarnVersion,
11
+ } from 'aberlaas-versions';
12
+ import initHelper from './helper.js';
13
+
14
+ export default {
15
+ /**
16
+ * Create the top-level monorepo root workspace
17
+ */
18
+ async createRootWorkspace() {
19
+ const sharedProjectData = await this.getSharedProjectData();
20
+
21
+ const packageContent = {
22
+ // Visibility
23
+ private: true,
24
+ workspaces: ['docs', 'lib'],
25
+
26
+ // Name and version
27
+ name: `${sharedProjectData.name}-monorepo`,
28
+ version: '0.0.1',
29
+
30
+ // Metadata
31
+ author: sharedProjectData.author,
32
+ description: `${sharedProjectData.name} monorepo`,
33
+ repository: sharedProjectData.repository,
34
+ homepage: sharedProjectData.homepage,
35
+
36
+ // Compatibility
37
+ type: 'module',
38
+ license: sharedProjectData.license,
39
+ packageManager: `yarn@${yarnVersion}`,
40
+
41
+ // Exports
42
+
43
+ // Dependencies
44
+ dependencies: {},
45
+ devDependencies: {
46
+ aberlaas: aberlaasVersion,
47
+ lerna: lernaVersion,
48
+ },
49
+
50
+ // Scripts
51
+ scripts: {
52
+ // ==> Docs-specific
53
+ build: './scripts/docs/build',
54
+ 'build:prod': './scripts/docs/build-prod',
55
+ cms: './scripts/docs/cms',
56
+ serve: './scripts/docs/serve',
57
+ // ==> Lib-specific
58
+ release: './scripts/lib/release',
59
+ test: './scripts/lib/test',
60
+ 'test:watch': './scripts/lib/test-watch',
61
+ // Common
62
+ ci: './scripts/ci',
63
+ compress: './scripts/compress',
64
+ lint: './scripts/lint',
65
+ 'lint:fix': './scripts/lint-fix',
66
+
67
+ // Global (called as aliases from any workspace)
68
+ // ==> Docs-specific
69
+ 'g:build': './scripts/docs/build',
70
+ 'g:build:prod': './scripts/docs/build-prod',
71
+ 'g:cms': './scripts/docs/cms',
72
+ 'g:serve': './scripts/docs/serve',
73
+ // ==> Lib-specific
74
+ 'g:release': './scripts/lib/release',
75
+ 'g:test': './scripts/lib/test',
76
+ 'g:test:watch': './scripts/lib/test-watch',
77
+ // Common
78
+ 'g:compress': './scripts/compress',
79
+ 'g:lint': './scripts/lint',
80
+ 'g:lint:fix': './scripts/lint-fix',
81
+ },
82
+ };
83
+ await writeJson(packageContent, helper.hostPath('./package.json'), {
84
+ sort: false,
85
+ });
86
+ },
87
+ /**
88
+ * Create the docs workspace
89
+ */
90
+ async createDocsWorkspace() {
91
+ const sharedProjectData = await this.getSharedProjectData();
92
+
93
+ const packageContent = {
94
+ // Visibility
95
+ private: true,
96
+
97
+ // Name & Version
98
+ name: `${sharedProjectData.name}-docs`,
99
+ version: '0.0.1',
100
+
101
+ // Metadata
102
+ author: sharedProjectData.author,
103
+ description: `${sharedProjectData.name} docs`,
104
+ repository: sharedProjectData.repository,
105
+ homepage: sharedProjectData.homepage,
106
+
107
+ // Compatibility
108
+ license: sharedProjectData.license,
109
+
110
+ // Exports
111
+
112
+ // Dependencies
113
+ dependencies: {
114
+ norska: norskaVersion,
115
+ 'norska-theme-docs': norskaThemeDocsVersion,
116
+ },
117
+ devDependencies: {},
118
+
119
+ // Scripts
120
+ scripts: sharedProjectData.scripts,
121
+ };
122
+ await writeJson(packageContent, helper.hostPath('./docs/package.json'), {
123
+ sort: false,
124
+ });
125
+ },
126
+ /**
127
+ * Create the lib workspace
128
+ */
129
+ async createLibWorkspace() {
130
+ const sharedProjectData = await this.getSharedProjectData();
131
+ const engines = {
132
+ node: `>=${nodeVersion}`,
133
+ };
134
+
135
+ const packageContent = {
136
+ // Visibility
137
+ private: false,
138
+
139
+ // Name and version
140
+ name: sharedProjectData.name,
141
+ version: '0.0.1',
142
+
143
+ // Metadata
144
+ author: sharedProjectData.author,
145
+ description: '',
146
+ keywords: [],
147
+ repository: sharedProjectData.repository,
148
+ homepage: sharedProjectData.homepage,
149
+
150
+ // Compatibility
151
+ type: 'module',
152
+ license: sharedProjectData.license,
153
+ engines,
154
+
155
+ // Exports
156
+ files: ['*.js'],
157
+ exports: {
158
+ '.': './main.js',
159
+ },
160
+ main: './main.js',
161
+
162
+ // Dependencies
163
+ dependencies: {},
164
+ devDependencies: {},
165
+
166
+ // Scripts
167
+ scripts: sharedProjectData.scripts,
168
+ };
169
+ await writeJson(packageContent, helper.hostPath('./lib/package.json'), {
170
+ sort: false,
171
+ });
172
+ },
173
+ /**
174
+ * Add MIT license files to the repository
175
+ */
176
+ async addLicenseFiles() {
177
+ // One at the repo root, for GitHub
178
+ await initHelper.addLicenseFile('LICENSE');
179
+ // One in ./lib to be released with the module
180
+ await initHelper.addLicenseFile('lib/LICENSE');
181
+ },
182
+ /**
183
+ * Add config files
184
+ */
185
+ async addConfigFiles() {
186
+ await initHelper.addConfigFiles();
187
+
188
+ // Lerna
189
+ await initHelper.copyTemplateToHost('lerna.json', 'lerna.json');
190
+ },
191
+ /**
192
+ * Add scripts to the repo
193
+ */
194
+ async addScripts() {
195
+ // Common scripts
196
+ await initHelper.addScripts('LICENSE');
197
+
198
+ // Docs scripts
199
+ await initHelper.copyTemplateToHost(
200
+ 'scripts/docs/build',
201
+ 'scripts/docs/build',
202
+ );
203
+ await initHelper.copyTemplateToHost(
204
+ 'scripts/docs/build-prod',
205
+ 'scripts/docs/build-prod',
206
+ );
207
+ await initHelper.copyTemplateToHost('scripts/docs/cms', 'scripts/docs/cms');
208
+ await initHelper.copyTemplateToHost(
209
+ 'scripts/docs/serve',
210
+ 'scripts/docs/serve',
211
+ );
212
+ },
213
+ /**
214
+ * Returns shared project data, like name, author, scripts, etc
215
+ * @returns {object} Object of common keys
216
+ */
217
+ async getSharedProjectData() {
218
+ const name = await this.__getProjectName();
219
+ const author = await this.__getProjectAuthor();
220
+ const homepage = `https://projects.pixelastic.com/${name}`;
221
+ const repository = `${author}/${name}`;
222
+ const license = 'MIT';
223
+ const scripts = {
224
+ // Docs
225
+ build: 'ABERLAAS_CWD=$INIT_CWD yarn g:build',
226
+ 'build:prod': 'ABERLAAS_CWD=$INIT_CWD yarn g:build:prod',
227
+ cms: 'ABERLAAS_CWD=$INIT_CWD yarn g:cms',
228
+ serve: 'ABERLAAS_CWD=$INIT_CWD yarn g:serve',
229
+
230
+ // Lib
231
+ release: 'ABERLAAS_CWD=$INIT_CWD yarn g:release',
232
+ test: 'ABERLAAS_CWD=$INIT_CWD yarn g:test',
233
+ 'test:watch': 'ABERLAAS_CWD=$INIT_CWD yarn g:test:watch',
234
+
235
+ // Common
236
+ compress: 'ABERLAAS_CWD=$INIT_CWD yarn g:compress',
237
+ lint: 'ABERLAAS_CWD=$INIT_CWD yarn g:lint',
238
+ 'lint:fix': 'ABERLAAS_CWD=$INIT_CWD yarn g:lint:fix',
239
+ };
240
+ return {
241
+ author,
242
+ homepage,
243
+ license,
244
+ name,
245
+ repository,
246
+ scripts,
247
+ };
248
+ },
249
+ /**
250
+ * Scaffold a repo for use in a monorepo module contexte
251
+ */
252
+ async run() {
253
+ await this.createRootWorkspace();
254
+ await this.createDocsWorkspace();
255
+ await this.createLibWorkspace();
256
+
257
+ await this.addLicenseFiles();
258
+ await this.addScripts();
259
+ await this.addConfigFiles();
260
+ await initHelper.addLibFiles();
261
+ },
262
+ __getProjectName: initHelper.getProjectName,
263
+ __getProjectAuthor: initHelper.getProjectAuthor.bind(initHelper),
264
+ };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "aberlaas-init",
3
+ "type": "module",
4
+ "description": "aberlaas init command: Setup the repository with all needed config",
5
+ "version": "2.10.0",
6
+ "repository": "pixelastic/aberlaas",
7
+ "homepage": "https://projects.pixelastic.com/aberlaas/",
8
+ "author": "Tim Carry (@pixelastic)",
9
+ "license": "MIT",
10
+ "files": [
11
+ "lib/*.js",
12
+ "templates/"
13
+ ],
14
+ "exports": {
15
+ ".": "./lib/main.js"
16
+ },
17
+ "main": "./lib/main.js",
18
+ "engines": {
19
+ "node": ">=18.18.0"
20
+ },
21
+ "scripts": {
22
+ "build": "../../scripts/local/build",
23
+ "build:prod": "../../scripts/local/build-prod",
24
+ "cms": "../../scripts/local/cms",
25
+ "serve": "../../scripts/local/serve",
26
+ "ci": "../../scripts/local/ci",
27
+ "release": "../../scripts/local/release",
28
+ "update": "node ../../scripts/meta/update.js",
29
+ "test:meta": "../../scripts/local/test-meta",
30
+ "test": "../../scripts/local/test",
31
+ "test:watch": "../../scripts/local/test-watch",
32
+ "compress": "../../scripts/local/compress",
33
+ "lint": "../../scripts/local/lint",
34
+ "lint:fix": "../../scripts/local/lint-fix"
35
+ },
36
+ "dependencies": {
37
+ "aberlaas-helper": "^2.10.0",
38
+ "aberlaas-versions": "^2.10.0",
39
+ "firost": "4.3.0",
40
+ "gilmore": "1.0.0"
41
+ },
42
+ "gitHead": "bcdaf87c198a588e02b5539c222f611e356d3079"
43
+ }
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) {author}
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ version: 2.1
2
+
3
+ aliases:
4
+ - &defaults
5
+ docker:
6
+ - image: cimg/node:{nodeVersion}
7
+ - &restore_cache
8
+ restore_cache:
9
+ key: yarn-cache-{{ checksum "yarn.lock" }}
10
+ - &install_yarn
11
+ run:
12
+ name: 'Installing correct yarn version'
13
+ command: |
14
+ corepack enable --install-directory="/home/circleci/bin"
15
+ yarn set version {yarnVersion}
16
+ - &install_dependencies
17
+ run:
18
+ name: 'Installing dependencies'
19
+ command: 'yarn install'
20
+ - &save_cache
21
+ save_cache:
22
+ key: yarn-cache-{{ checksum "yarn.lock" }}
23
+ paths:
24
+ - ~/.cache/yarn
25
+
26
+ jobs:
27
+ ci:
28
+ <<: *defaults
29
+ steps:
30
+ - checkout
31
+ - *restore_cache
32
+ - *install_yarn
33
+ - *install_dependencies
34
+ - *save_cache
35
+ - run: 'yarn run ci'
36
+
37
+ workflows:
38
+ version: 2
39
+ # On every commit
40
+ commit:
41
+ jobs:
42
+ - ci
@@ -0,0 +1,4 @@
1
+ /.yarn/** linguist-vendored
2
+ /.yarn/releases/* binary
3
+ /.yarn/plugins/**/* binary
4
+ /.pnp.* binary linguist-generated
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["config:js-lib", "aberlaas"]
3
+ }
@@ -0,0 +1,29 @@
1
+ # Hidden files
2
+ .DS_Store
3
+ .envrc
4
+
5
+ # Directories
6
+ build/
7
+ dist/
8
+ node_modules/
9
+ tmp/
10
+
11
+ # Files
12
+ Thumbs.db
13
+ lerna-debug.log
14
+ npm-debug.log
15
+ yarn-error.log
16
+ *~
17
+
18
+ # Yarn
19
+ # https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
20
+ .yarn/*
21
+ !.yarn/patches
22
+ !.yarn/plugins
23
+ !.yarn/releases
24
+ !.yarn/sdks
25
+ !.yarn/versions
26
+
27
+
28
+ # Netlify
29
+ .netlify
@@ -0,0 +1,15 @@
1
+ compressionLevel: 0
2
+
3
+ defaultSemverRangePrefix: ''
4
+
5
+ enableGlobalCache: true
6
+
7
+ # Keep old-school saving of dependencies in node_modules
8
+ # This makes debugging imported modules so much easier
9
+ nodeLinker: node-modules
10
+
11
+ # Use hardlinks to a global cache
12
+ nmMode: hardlinks-local
13
+
14
+ # Make sure each workspace has its own local node_modules
15
+ nmHoistingLimits: workspaces
@@ -0,0 +1,3 @@
1
+ import config from 'aberlaas/configs/eslint';
2
+
3
+ export default [...config];
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "useWorkspaces": true,
4
+ "packages": ["lib", "docs"],
5
+ "npmClient": "yarn"
6
+ }
@@ -0,0 +1,13 @@
1
+ import current from '../main.js';
2
+
3
+ describe('main', () => {
4
+ describe('run', () => {
5
+ it('should pass', async () => {
6
+ const input = 'something';
7
+
8
+ const actual = current.run(input);
9
+
10
+ expect(actual).toBe('something');
11
+ });
12
+ });
13
+ });
@@ -0,0 +1,5 @@
1
+ export default {
2
+ run(input) {
3
+ return input;
4
+ },
5
+ };
@@ -0,0 +1,5 @@
1
+ import config from 'aberlaas/configs/lintstaged';
2
+
3
+ export default {
4
+ ...config,
5
+ };
@@ -0,0 +1,5 @@
1
+ import config from 'aberlaas/configs/prettier';
2
+
3
+ export default {
4
+ ...config,
5
+ };
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ echo "node $(node --version), yarn $(yarn --version)"
5
+
6
+ aberlaas ci "$@"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ aberlaas compress "${@:-$INIT_CWD}"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ echo "TODO: Set a default script"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ echo "TODO: Set a default script"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ echo "TODO: Set a default script"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ echo "TODO: Set a default script"
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env sh
2
+ # This script *should be* automatically triggered before each git commit.
3
+ #
4
+ # If it doesn't work, make sure your local git repo is configured to use
5
+ # ./scripts/hooks as the base directory for git hooks.
6
+ #
7
+ # If not, run:
8
+ # $ git config core.hooksPath scripts/hooks
9
+ set -e
10
+
11
+ yarn run aberlaas precommit
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ yarn run test
5
+ lerna publish --yes "$@"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ cd ./lib
5
+ aberlaas test "$@"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ cd ./lib
5
+ aberlaas test --watch "$@"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ aberlaas lint "${@:-$INIT_CWD}"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ aberlaas lint --fix "${@:-$INIT_CWD}"
@@ -0,0 +1,5 @@
1
+ import config from 'aberlaas/configs/stylelint';
2
+
3
+ export default {
4
+ ...config,
5
+ };
@@ -0,0 +1,5 @@
1
+ import config from 'aberlaas/configs/vite';
2
+
3
+ export default {
4
+ ...config,
5
+ };